blame-1.4-20240206/0000755000000000000000000000000014560374630012041 5ustar rootrootblame-1.4-20240206/config.guess0000755000000000000000000014304614532712033014361 0ustar rootroot#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2023 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2023-10-19' # 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 3 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, 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system '$me' is run on. Options: -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 1992-2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # Just in case it came from the environment. GUESS= # 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. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD=$driver 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 ; 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 case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #if defined(__ANDROID__) LIBC=android #else #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #elif defined(__LLVM_LIBC__) LIBC=llvm #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #endif #endif EOF cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$cc_set_libc" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl; then LIBC=musl fi # If the system lacks a compiler, then just pick glibc. # We could probably try harder. if [ "$LIBC" = unknown ]; then LIBC=gnu fi ;; esac # 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 tuples: *-*-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". UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` case $UNAME_MACHINE_ARCH in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-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) and ABI. case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ 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 # Determine ABI tags. case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; 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/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. GUESS=$machine-${os}${release}${abi-} ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE ;; *:SecBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE ;; *:MidnightBSD:*:*) GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE ;; *:ekkoBSD:*:*) GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE ;; *:SolidBSD:*:*) GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE ;; *:OS108:*:*) GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE ;; macppc:MirBSD:*:*) GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE ;; *:MirBSD:*:*) GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE ;; *:Sortix:*:*) GUESS=$UNAME_MACHINE-unknown-sortix ;; *:Twizzler:*:*) GUESS=$UNAME_MACHINE-unknown-twizzler ;; *:Redox:*:*) GUESS=$UNAME_MACHINE-unknown-redox ;; mips:OSF1:*.*) GUESS=mips-dec-osf1 ;; alpha:OSF1:*:*) # Reset EXIT trap before exiting to avoid spurious non-zero exit code. trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` GUESS=$UNAME_MACHINE-dec-osf$OSF_REL ;; Amiga*:UNIX_System_V:4.0:*) GUESS=m68k-unknown-sysv4 ;; *:[Aa]miga[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-amigaos ;; *:[Mm]orph[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-morphos ;; *:OS/390:*:*) GUESS=i370-ibm-openedition ;; *:z/VM:*:*) GUESS=s390-ibm-zvmoe ;; *:OS400:*:*) GUESS=powerpc-ibm-os400 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) GUESS=arm-acorn-riscix$UNAME_RELEASE ;; arm*:riscos:*:*|arm*:RISCOS:*:*) GUESS=arm-unknown-riscos ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) GUESS=hppa1.1-hitachi-hiuxmpp ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. case `(/bin/universe) 2>/dev/null` in att) GUESS=pyramid-pyramid-sysv3 ;; *) GUESS=pyramid-pyramid-bsd ;; esac ;; NILE*:*:*:dcosx) GUESS=pyramid-pyramid-svr4 ;; DRS?6000:unix:4.0:6*) GUESS=sparc-icl-nx6 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) GUESS=sparc-icl-nx7 ;; esac ;; s390x:SunOS:*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL ;; sun4H:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-hal-solaris2$SUN_REL ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris2$SUN_REL ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) GUESS=i386-pc-auroraux$UNAME_RELEASE ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$SUN_ARCH-pc-solaris2$SUN_REL ;; 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. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris3$SUN_REL ;; 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'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; sun3*:SunOS:*:*) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; 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) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac ;; aushp:SunOS:*:*) GUESS=sparc-auspex-sunos$UNAME_RELEASE ;; # 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:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) GUESS=m68k-milan-mint$UNAME_RELEASE ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) GUESS=m68k-hades-mint$UNAME_RELEASE ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) GUESS=m68k-unknown-mint$UNAME_RELEASE ;; m68k:machten:*:*) GUESS=m68k-apple-machten$UNAME_RELEASE ;; powerpc:machten:*:*) GUESS=powerpc-apple-machten$UNAME_RELEASE ;; RISC*:Mach:*:*) GUESS=mips-dec-mach_bsd4.3 ;; RISC*:ULTRIX:*:*) GUESS=mips-dec-ultrix$UNAME_RELEASE ;; VAX*:ULTRIX*:*:*) GUESS=vax-dec-ultrix$UNAME_RELEASE ;; 2020:CLIX:*:* | 2430:CLIX:*:*) GUESS=clipper-intergraph-clix$UNAME_RELEASE ;; mips:*:*:UMIPS | mips:*:*:RISCos) 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" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } GUESS=mips-mips-riscos$UNAME_RELEASE ;; Motorola:PowerMAX_OS:*:*) GUESS=powerpc-motorola-powermax ;; Motorola:*:4.3:PL8-*) GUESS=powerpc-harris-powermax ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) GUESS=powerpc-harris-powermax ;; Night_Hawk:Power_UNIX:*:*) GUESS=powerpc-harris-powerunix ;; m88k:CX/UX:7*:*) GUESS=m88k-harris-cxux7 ;; m88k:*:4*:R4*) GUESS=m88k-motorola-sysv4 ;; m88k:*:3*:R3*) GUESS=m88k-motorola-sysv3 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then GUESS=m88k-dg-dgux$UNAME_RELEASE else GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else GUESS=i586-dg-dgux$UNAME_RELEASE fi ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) GUESS=m88k-dolphin-sysv3 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 GUESS=m88k-motorola-sysv3 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) GUESS=m88k-tektronix-sysv3 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) GUESS=m68k-tektronix-bsd ;; *:IRIX*:*:*) IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` GUESS=mips-sgi-irix$IRIX_REL ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) GUESS=i386-ibm-aix ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then 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 if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then GUESS=$SYSTEM_NAME else GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then GUESS=rs6000-ibm-aix3.2.4 else GUESS=rs6000-ibm-aix3.2 fi ;; *:AIX:*:[4567]) 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 test -x /usr/bin/lslpp ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$IBM_ARCH-ibm-aix$IBM_REV ;; *:AIX:*:*) GUESS=rs6000-ibm-aix ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) GUESS=romp-ibm-bsd4.4 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) GUESS=rs6000-bull-bosx ;; DPX/2?00:B.O.S.:*:*) GUESS=m68k-bull-sysv3 ;; 9000/[34]??:4.3bsd:1.*:*) GUESS=m68k-hp-bsd ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) GUESS=m68k-hp-bsd4.4 ;; 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 test -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 test "$HP_ARCH" = ""; then 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 test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi GUESS=$HP_ARCH-hp-hpux$HPUX_REV ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` GUESS=ia64-hp-hpux$HPUX_REV ;; 3050*:HI-UX:*:*) 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" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } GUESS=unknown-hitachi-hiuxwe2 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) GUESS=hppa1.1-hp-bsd ;; 9000/8??:4.3bsd:*:*) GUESS=hppa1.0-hp-bsd ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) GUESS=hppa1.0-hp-mpeix ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) GUESS=hppa1.1-hp-osf ;; hp8??:OSF1:*:*) GUESS=hppa1.0-hp-osf ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then GUESS=$UNAME_MACHINE-unknown-osf1mk else GUESS=$UNAME_MACHINE-unknown-osf1 fi ;; parisc*:Lites*:*:*) GUESS=hppa1.1-hp-lites ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) GUESS=c1-convex-bsd ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) GUESS=c34-convex-bsd ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) GUESS=c38-convex-bsd ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) GUESS=c4-convex-bsd ;; CRAY*Y-MP:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=ymp-cray-unicos$CRAY_REL ;; 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 ;; CRAY*TS:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=t90-cray-unicos$CRAY_REL ;; CRAY*T3E:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=alphaev5-cray-unicosmk$CRAY_REL ;; CRAY*SV1:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=sv1-cray-unicos$CRAY_REL ;; *:UNICOS/mp:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=craynv-cray-unicosmp$CRAY_REL ;; 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/ /_/'` GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; 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/ /_/'` GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE ;; sparc*:BSD/OS:*:*) GUESS=sparc-unknown-bsdi$UNAME_RELEASE ;; *:BSD/OS:*:*) GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL ;; i*:CYGWIN*:*) GUESS=$UNAME_MACHINE-pc-cygwin ;; *:MINGW64*:*) GUESS=$UNAME_MACHINE-pc-mingw64 ;; *:MINGW*:*) GUESS=$UNAME_MACHINE-pc-mingw32 ;; *:MSYS*:*) GUESS=$UNAME_MACHINE-pc-msys ;; i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; *:SerenityOS:*:*) GUESS=$UNAME_MACHINE-pc-serenity ;; *:Interix*:*) case $UNAME_MACHINE in x86) GUESS=i586-pc-interix$UNAME_RELEASE ;; authenticamd | genuineintel | EM64T) GUESS=x86_64-unknown-interix$UNAME_RELEASE ;; IA64) GUESS=ia64-unknown-interix$UNAME_RELEASE ;; esac ;; i*:UWIN*:*) GUESS=$UNAME_MACHINE-pc-uwin ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) GUESS=x86_64-pc-cygwin ;; prep*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=powerpcle-unknown-solaris2$SUN_REL ;; *:GNU:*:*) # the GNU system GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL ;; *:GNU/*:*:*) # other systems with GNU libc and userland GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) GUESS="$UNAME_MACHINE-pc-managarm-mlibc" ;; *:[Mm]anagarm:*:*) GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) set_cc_for_build CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then ABI=64 sed 's/^ //' << EOF > "$dummy.c" #ifdef __ARM_EABI__ #ifdef __ARM_PCS_VFP ABI=eabihf #else ABI=eabi #endif #endif EOF cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` eval "$cc_set_abi" case $ABI in eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; esac fi GUESS=$CPU-unknown-linux-$LIBCABI ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` 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 -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi ;; avr32*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; cris:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; crisv32:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; e2k:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; frv:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; hexagon:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:Linux:*:*) GUESS=$UNAME_MACHINE-pc-linux-$LIBC ;; ia64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; kvx:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; kvx:cos:*:*) GUESS=$UNAME_MACHINE-unknown-cos ;; kvx:mbr:*:*) GUESS=$UNAME_MACHINE-unknown-mbr ;; loongarch32:Linux:*:* | loongarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m68*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; openrisc*:Linux:*:*) GUESS=or1k-unknown-linux-$LIBC ;; or32:Linux:*:* | or1k*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; padre:Linux:*:*) GUESS=sparc-unknown-linux-$LIBC ;; parisc64:Linux:*:* | hppa64:Linux:*:*) GUESS=hppa64-unknown-linux-$LIBC ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; *) GUESS=hppa-unknown-linux-$LIBC ;; esac ;; ppc64:Linux:*:*) GUESS=powerpc64-unknown-linux-$LIBC ;; ppc:Linux:*:*) GUESS=powerpc-unknown-linux-$LIBC ;; ppc64le:Linux:*:*) GUESS=powerpc64le-unknown-linux-$LIBC ;; ppcle:Linux:*:*) GUESS=powerpcle-unknown-linux-$LIBC ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; s390:Linux:*:* | s390x:Linux:*:*) GUESS=$UNAME_MACHINE-ibm-linux-$LIBC ;; sh64*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sh*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sparc:Linux:*:* | sparc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; tile*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; vax:Linux:*:*) GUESS=$UNAME_MACHINE-dec-linux-$LIBC ;; x86_64:Linux:*:*) set_cc_for_build CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then ABI=64 sed 's/^ //' << EOF > "$dummy.c" #ifdef __i386__ ABI=x86 #else #ifdef __ILP32__ ABI=x32 #endif #endif EOF cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` eval "$cc_set_abi" case $ABI in x86) CPU=i686 ;; x32) LIBCABI=${LIBC}x32 ;; esac fi GUESS=$CPU-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; 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. GUESS=i386-sequent-sysv4 ;; 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. GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) # If we were able to find 'uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; i*86:XTS-300:*:STOP) GUESS=$UNAME_MACHINE-unknown-stop ;; i*86:atheos:*:*) GUESS=$UNAME_MACHINE-unknown-atheos ;; i*86:syllable:*:*) GUESS=$UNAME_MACHINE-pc-syllable ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) GUESS=i386-unknown-lynxos$UNAME_RELEASE ;; i*86:*DOS:*:*) GUESS=$UNAME_MACHINE-pc-msdosdjgpp ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} ;; 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 GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv32 fi ;; 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 i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. GUESS=i586-pc-msdosdjgpp ;; Intel:Mach:3*:*) GUESS=i386-pc-mach3 ;; paragon:*:*:*) GUESS=i860-intel-osf1 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi ;; mini*:CTIX:SYS*5:*) # "miniframe" GUESS=m68010-convergent-sysv ;; mc68k:UNIX:SYSTEM5:3.51m) GUESS=m68k-convergent-sysv ;; M680?0:D-NIX:5.3:*) GUESS=m68k-diab-dnix ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' 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; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) GUESS=m68k-unknown-lynxos$UNAME_RELEASE ;; mc68030:UNIX_System_V:4.*:*) GUESS=m68k-atari-sysv4 ;; TSUNAMI:LynxOS:2.*:*) GUESS=sparc-unknown-lynxos$UNAME_RELEASE ;; rs6000:LynxOS:2.*:*) GUESS=rs6000-unknown-lynxos$UNAME_RELEASE ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) GUESS=powerpc-unknown-lynxos$UNAME_RELEASE ;; SM[BE]S:UNIX_SV:*:*) GUESS=mips-dde-sysv$UNAME_RELEASE ;; RM*:ReliantUNIX-*:*:*) GUESS=mips-sni-sysv4 ;; RM*:SINIX-*:*:*) GUESS=mips-sni-sysv4 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` GUESS=$UNAME_MACHINE-sni-sysv4 else GUESS=ns32k-sni-sysv fi ;; PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort # says GUESS=i586-unisys-sysv4 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm GUESS=hppa1.1-stratus-sysv4 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. GUESS=i860-stratus-sysv4 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. GUESS=$UNAME_MACHINE-stratus-vos ;; *:VOS:*:*) # From Paul.Green@stratus.com. GUESS=hppa1.1-stratus-vos ;; mc68*:A/UX:*:*) GUESS=m68k-apple-aux$UNAME_RELEASE ;; news*:NEWS-OS:6*:*) GUESS=mips-sony-newsos6 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then GUESS=mips-nec-sysv$UNAME_RELEASE else GUESS=mips-unknown-sysv$UNAME_RELEASE fi ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. GUESS=powerpc-be-beos ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. GUESS=powerpc-apple-beos ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. GUESS=i586-pc-beos ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; ppc:Haiku:*:*) # Haiku running on Apple PowerPC GUESS=powerpc-apple-haiku ;; *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) GUESS=$UNAME_MACHINE-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE ;; SX-5:SUPER-UX:*:*) GUESS=sx5-nec-superux$UNAME_RELEASE ;; SX-6:SUPER-UX:*:*) GUESS=sx6-nec-superux$UNAME_RELEASE ;; SX-7:SUPER-UX:*:*) GUESS=sx7-nec-superux$UNAME_RELEASE ;; SX-8:SUPER-UX:*:*) GUESS=sx8-nec-superux$UNAME_RELEASE ;; SX-8R:SUPER-UX:*:*) GUESS=sx8r-nec-superux$UNAME_RELEASE ;; SX-ACE:SUPER-UX:*:*) GUESS=sxace-nec-superux$UNAME_RELEASE ;; Power*:Rhapsody:*:*) GUESS=powerpc-apple-rhapsody$UNAME_RELEASE ;; *:Rhapsody:*:*) GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE ;; arm64:Darwin:*:*) GUESS=aarch64-apple-darwin$UNAME_RELEASE ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE ;; *:QNX:*:4*) GUESS=i386-pc-qnx ;; NEO-*:NONSTOP_KERNEL:*:*) GUESS=neo-tandem-nsk$UNAME_RELEASE ;; NSE-*:NONSTOP_KERNEL:*:*) GUESS=nse-tandem-nsk$UNAME_RELEASE ;; NSR-*:NONSTOP_KERNEL:*:*) GUESS=nsr-tandem-nsk$UNAME_RELEASE ;; NSV-*:NONSTOP_KERNEL:*:*) GUESS=nsv-tandem-nsk$UNAME_RELEASE ;; NSX-*:NONSTOP_KERNEL:*:*) GUESS=nsx-tandem-nsk$UNAME_RELEASE ;; *:NonStop-UX:*:*) GUESS=mips-compaq-nonstopux ;; BS2000:POSIX*:*:*) GUESS=bs2000-siemens-sysv ;; DS/*:UNIX_System_V:*:*) GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE ;; *: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 elif test "x${cputype-}" != x; then UNAME_MACHINE=$cputype fi GUESS=$UNAME_MACHINE-unknown-plan9 ;; *:TOPS-10:*:*) GUESS=pdp10-unknown-tops10 ;; *:TENEX:*:*) GUESS=pdp10-unknown-tenex ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) GUESS=pdp10-dec-tops20 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) GUESS=pdp10-xkl-tops20 ;; *:TOPS-20:*:*) GUESS=pdp10-unknown-tops20 ;; *:ITS:*:*) GUESS=pdp10-unknown-its ;; SEI:*:*:SEIUX) GUESS=mips-sei-seiux$UNAME_RELEASE ;; *:DragonFly:*:*) DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case $UNAME_MACHINE in A*) GUESS=alpha-dec-vms ;; I*) GUESS=ia64-dec-vms ;; V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) GUESS=i386-pc-xenix ;; i*86:skyos:*:*) SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL ;; i*86:rdos:*:*) GUESS=$UNAME_MACHINE-pc-rdos ;; i*86:Fiwix:*:*) GUESS=$UNAME_MACHINE-pc-fiwix ;; *:AROS:*:*) GUESS=$UNAME_MACHINE-unknown-aros ;; x86_64:VMkernel:*:*) GUESS=$UNAME_MACHINE-unknown-esx ;; amd64:Isilon\ OneFS:*:*) GUESS=x86_64-unknown-onefs ;; *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; *:Ironclad:*:*) GUESS=$UNAME_MACHINE-unknown-ironclad ;; esac # Do we have a guess based on uname results? if test "x$GUESS" != x; then echo "$GUESS" exit fi # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #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 (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 #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #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 && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&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 fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: blame-1.4-20240206/doc/0000755000000000000000000000000014560302724012601 5ustar rootrootblame-1.4-20240206/doc/Makefile.in0000644000000000000000000000125714175310144014650 0ustar rootroot# Copyright 2022, Thomas E. Dickey # makefile-template for autoconf @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ VPATH = @srcdir@ THIS = blame ACTUAL = `echo $(THIS) | sed '$(transform)'` transform = @program_transform_name@ prefix = @prefix@ datarootdir = @datarootdir@ datadir = @datadir@ mandir = @mandir@ man1dir = $(mandir)/man1 INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ all: check: clean: distclean: -rm -f Makefile $(DESTDIR)$(man1dir) : mkdir -p $@ install: $(DESTDIR)$(man1dir) $(THIS).1 $(INSTALL_DATA) "$(THIS).1" "$(DESTDIR)$(man1dir)/$(ACTUAL)".1 uninstall: rm -f "$(DESTDIR)$(man1dir)/$(ACTUAL).1" .PHONY: all check clean distclean install uninstall blame-1.4-20240206/doc/blame.10000644000000000000000000002013414560302724013743 0ustar rootroot.de Id .ds Rv \\$3 .ds Dt \\$4 .. .Id $Id: blame.1,v 1.5 2024/02/06 01:05:24 tom Exp $ .ds b \fBblame\fP .ds i \&\s-1ISO\s0 .ds r \&\s-1RCS\s0 .ds u \&\s-1UTC\s0 .TH BLAME 1 \*(Dt "1.4" "User Commands" .SH NAME \*b \- annotate RCS files .SH SYNOPSIS .B \*b .RI [ options ] " file " .\|.\|. .SH DESCRIPTION .B \*b outputs an annotated revision from each \*r file. An annotated RCS file describes the revision and date in which each line was added to the file, and the author of each line. .PP Pathnames matching an \*r suffix denote \*r files; all others denote working files. Names are paired as explained in .BR ci (1). .PP A revision is selected by options for revision or branch number, checkin date/time, author, or state. When the selection options are applied in combination, .B \*b retrieves the latest revision that satisfies all of them. If none of the selection options is specified, .B \*b retrieves the latest revision on the default branch (normally the trunk, see the .B \-b option of .BR rcs (1)). The options .BR "\-d " ( \-\^\-date ), .BR "\-s " ( \-\^\-state ), and .BR "\-w " ( \-\^\-author ) retrieve from a single branch, the .I selected branch, which is specified by .BR "\-r " ( \-\-revision ), or the default branch. .PP .B \*b always performs keyword substitution (see .SM "KEYWORD SUBSTITUTION" in .BR co (1)). .PP Strings of the form .BI $ keyword $ and .BI $ keyword : .\|.\|. $ embedded in the text are replaced with strings of the form .BI $ keyword : value $ as described in .BR co (1). .SH OPTIONS .TP .BR \-r ", " \-\^\-revision "[=\fIrev\fP]" Retrieves the latest revision whose number is less than or equal to .IR rev . If .I rev indicates a branch rather than a revision, the latest revision on that branch is retrieved. If .I rev is omitted, the latest revision on the default branch (see the .B \-b option of .BR rcs (1)) is annotated. If .I rev is .BR $ , .B \*b determines the revision number from keyword values in the working file. Otherwise, a revision is composed of one or more numeric or symbolic fields separated by periods. If .I rev begins with a period, then the default branch (normally the trunk) is prepended to it. If .I rev is a branch number followed by a period, then the latest revision on that branch is used. The numeric equivalent of a symbolic field is specified with the .B \-n option of the commands .BR ci (1) and .BR rcs (1). .TP .BR \-kkv ", " \-\^\-expand "=kv" Generate keyword strings using the default form, e.g.\& .B "$\&Revision: \*(Rv $" for the .B Revision keyword. This is the default. .TP .BR \-kkvl ", " \-\^\-expand "=kvl" Like .BR \-kkv , except that a locker's name is inserted into the value of the .BR Header , .BR Id , and .B Locker keyword strings if the given revision is currently locked. .TP .BR \-kk ", " \-\^\-expand "=k" Generate only keyword names in keyword strings; omit their values. See .SM "KEYWORD SUBSTITUTION" in .BR co (1). For example, for the .B Revision keyword, generate the string .B $\&Revision$ instead of .BR "$\&Revision: \*(Rv $" . Log messages are inserted after .B $\&Log$ keywords even if this option is specified. .TP .BR \-ko ", " \-\^\-expand "=o" Generate the old keyword string, present in the working file just before it was checked in. For example, for the .B Revision keyword, generate the string .B "$\&Revision: 1.1 $" instead of .B "$\&Revision: \*(Rv $" if that is how the string appeared when the file was checked in. .TP .BR \-kb ", " \-\^\-expand "=b" Generate a binary image of the old keyword string. This acts like .BR \-ko , except it performs all working file input and output in binary mode. This makes little difference on Posix and Unix hosts. .TP .BR \-kv ", " \-\^\-expand "=v" Generate only keyword values for keyword strings. For example, for the .B Revision keyword, generate the string .B \*(Rv instead of .BR "$\&Revision: \*(Rv $" . .TP .BR \-d ", " \-\^\-date "=\fIdate\fP" Retrieves the latest revision on the selected branch whose checkin date/time is less than or equal to .IR date . The date and time can be given in free format. The time zone .B LT stands for local time; other common time zone names are understood. For example, the following .IR date s are equivalent if local time is January 11, 1990, 8pm Pacific Standard Time, eight hours west of Coordinated Universal Time (\*u): .RS .LP .RS .nf .ta \w'\f3Thu, 11 Jan 1990 20:00:00 \-0800\fP 'u .ne 10 \f38:00 pm lt\fP \f34:00 AM, Jan. 12, 1990\fP default is \*u \f31990-01-12 04:00:00+00\fP \*i 8601 (\*u) \f31990-01-11 20:00:00\-08\fP \*i 8601 (local time) \f31990/01/12 04:00:00\fP traditional \*r format \f3Thu Jan 11 20:00:00 1990 LT\fP output of \f3ctime\fP(3) + \f3LT\fP \f3Thu Jan 11 20:00:00 PST 1990\fP output of \f3date\fP(1) \f3Fri Jan 12 04:00:00 GMT 1990\fP \f3Thu, 11 Jan 1990 20:00:00 \-0800\fP Internet RFC 822 \f312-January-1990, 04:00 WET\fP .ta 4n +4n +4n +4n .fi .RE .LP Most fields in the date and time can be defaulted. The default time zone is normally \*u, but this can be overridden by the .B \-z option. The other defaults are determined in the order year, month, day, hour, minute, and second (most to least significant). At least one of these fields must be provided. For omitted fields that are of higher significance than the highest provided field, the time zone's current values are assumed. For all other omitted fields, the lowest possible values are assumed. For example, without .BR \-z , the date .B "20, 10:30" defaults to 10:30:00 \*u of the 20th of the \*u time zone's current month and year. The date/time must be quoted if it contains spaces. .RE .TP .BR \-s ", " \-\^\-state "=\fIstate\fP" Retrieves the latest revision on the selected branch whose state is set to .IR state . .TP .BR \-w ", " \-\^\-login "[=\fIlogin\fP]" Retrieves the latest revision on the selected branch which was checked in by the user with login name .IR login . If the argument .I login is omitted, the caller's login is assumed. .TP .BR \-V ", " \-\^\-version "[=\fIver\fP]" If no argument is supplied, print \*b's version number, and the version of \*r it emulates by default. Otherwise emulate the specified version. See .BR co (1) for details. .TP .BR \-x ", " \-\^\-suffixes "=\fIsuffixes\fP" Use .I suffixes to characterize \*r files. See .BR ci (1) for details. .TP .BR \-z ", " \-\^\-zone "=\fIzone\fP" Specifies the date output format in keyword substitution, and specifies the default time zone for .I date in the .BI \-d date option. The .I zone should be empty, a numeric \*u offset, or the special string .B LT for local time. The default is an empty .IR zone , which uses the traditional \*r format of \*u without any time zone indication and with slashes separating the parts of the date; otherwise, times are output in \*i 8601 format with time zone indication. For example, if local time is January 11, 1990, 8pm Pacific Standard Time, eight hours west of \*u, then the time is output as follows: .RS .LP .RS .nf .ta \w'\f3\-z+05:30\fP 'u +\w'\f31990-01-11 09:30:00+05:30\fP 'u .ne 4 \f2option\fP \f2time output\fP \f3\-z\fP \f31990/01/12 04:00:00\fP \f2(default)\fP \f3\-zLT\fP \f31990-01-11 20:00:00\-08\fP \f3\-z+05:30\fP \f31990-01-12 09:30:00+05:30\fP .ta 4n +4n +4n +4n .fi .RE .RE .SH DIAGNOSTICS The working pathname and a separator line is written to the diagnostic output. The exit status is zero if and only if all operations were successful. .SH ENVIRONMENT .TP .B \s-1RCSINIT\s0 options prepended to the argument list, separated by spaces. See .BR ci (1) for details. .TP .B \s-1RCS_DIR\s0 if defined, specifies the directory in which rcs archive files are found. Normally files are found in "./RCS". .SH FILES \*b never changes an \*r or working file. It uses the effective user for all accesses, and it does not even read the working file unless a revision number of .B $ is specified. .SH EXAMPLES One day, there will be a whole bunch of useful examples here. .SH AUTHORS Michael Chapman .br Thomas E. Dickey .PP Portions of this manual page are from .BR ci (1) and .BR co (1) by Walter F. Tichy and Paul Eggert. .SH SEE ALSO .BR rcsintro (1), .BR ci (1), .BR co (1), .BR ctime (3), .BR date (1), .BR rcs (1), .BR rcsfile (5), .BR checkout (1), .BR checkin (1) blame-1.4-20240206/m4/0000755000000000000000000000000014560004236012351 5ustar rootrootblame-1.4-20240206/m4/eoverflow.m40000644000000000000000000000413610203114517014621 0ustar rootroot# eoverflow.m4 serial 1 dnl Copyright (C) 2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. # The EOVERFLOW errno value ought to be defined in , according to # POSIX. But some systems (like AIX 3) don't define it, and some systems # (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. # Define EOVERFLOW as a C macro and as a substituted macro in such a way that # 1. on all systems, after inclusion of , EOVERFLOW is usable, # 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric # value. AC_DEFUN([gl_EOVERFLOW], [ AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [ AC_EGREP_CPP(yes,[ #include #ifdef EOVERFLOW yes #endif ], have_eoverflow=1) if test -n "$have_eoverflow"; then dnl EOVERFLOW exists in . Don't need to define EOVERFLOW ourselves. ac_cv_decl_EOVERFLOW=yes else AC_EGREP_CPP(yes,[ #define _XOPEN_SOURCE_EXTENDED 1 #include #ifdef EOVERFLOW yes #endif ], have_eoverflow=1) if test -n "$have_eoverflow"; then dnl EOVERFLOW exists but is hidden. dnl Define it to the same value. _AC_COMPUTE_INT([EOVERFLOW], ac_cv_decl_EOVERFLOW, [ #define _XOPEN_SOURCE_EXTENDED 1 #include /* The following two lines are a workaround against an autoconf-2.52 bug. */ #include #include ]) else dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but dnl don't define it as EINVAL, because snprintf() callers want to dnl distinguish EINVAL and EOVERFLOW. ac_cv_decl_EOVERFLOW=E2BIG fi fi ]) if test "$ac_cv_decl_EOVERFLOW" != yes; then AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW], [Define as good substitute value for EOVERFLOW.]) EOVERFLOW="$ac_cv_decl_EOVERFLOW" AC_SUBST(EOVERFLOW) fi ]) blame-1.4-20240206/m4/strndup.m40000644000000000000000000000267014332563676014336 0ustar rootroot# strndup.m4 serial 11 dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRNDUP], [ dnl Persuade glibc to declare strndup(). AC_REQUIRE([AC_GNU_SOURCE]) AC_CHECK_DECLS([strndup]) # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. AC_CACHE_CHECK([for working strndup], gl_cv_func_strndup, [AC_RUN_IFELSE([ AC_LANG_PROGRAM([#include #include ], [[ #ifndef HAVE_DECL_STRNDUP extern char *strndup (const char *, size_t); #endif char *s; s = strndup ("some longer string", 15); free (s); s = strndup ("shorter string", 13); return s[13] != '\0';]])], [gl_cv_func_strndup=yes], [gl_cv_func_strndup=no], [AC_CHECK_FUNC([strndup], [AC_EGREP_CPP([too risky], [ #ifdef _AIX too risky #endif ], [gl_cv_func_strndup=no], [gl_cv_func_strndup=yes])], [gl_cv_func_strndup=no])])]) if test $gl_cv_func_strndup = yes; then AC_DEFINE([HAVE_STRNDUP], 1, [Define if you have the strndup() function and it works.]) else AC_LIBOBJ([strndup]) gl_PREREQ_STRNDUP fi ]) # Prerequisites of lib/strndup.c. AC_DEFUN([gl_PREREQ_STRNDUP], [:]) blame-1.4-20240206/m4/eealloc.m40000644000000000000000000000140414556137512014227 0ustar rootroot# eealloc.m4 serial 1 dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_EEALLOC], [ AC_REQUIRE([gl_EEMALLOC]) AC_REQUIRE([gl_EEREALLOC]) AC_REQUIRE([AC_C_INLINE]) ]) AC_DEFUN([gl_EEMALLOC], [ AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], 0, [Stub: FIXME]) ]) AC_DEFUN([gl_EEREALLOC], [ _AC_FUNC_REALLOC_IF( [gl_cv_func_realloc_0_nonnull=1], [gl_cv_func_realloc_0_nonnull=0]) AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], $gl_cv_func_realloc_0_nonnull, [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this to 0.]) ]) blame-1.4-20240206/m4/error.m40000644000000000000000000000103410203114517013734 0ustar rootroot#serial 11 # Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 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. AC_DEFUN([gl_ERROR], [ AC_FUNC_ERROR_AT_LINE dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]). gl_PREREQ_ERROR ]) # Prerequisites of lib/error.c. AC_DEFUN([gl_PREREQ_ERROR], [ AC_REQUIRE([AC_FUNC_STRERROR_R]) : ]) blame-1.4-20240206/m4/strcase.m40000644000000000000000000000165710527555560014302 0ustar rootroot# strcase.m4 serial 4 dnl Copyright (C) 2002, 2005-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STRCASE], [ gl_FUNC_STRCASECMP gl_FUNC_STRNCASECMP ]) AC_DEFUN([gl_FUNC_STRCASECMP], [ dnl No known system has a strcasecmp() function that works correctly in dnl multibyte locales. Therefore we use our version always. AC_LIBOBJ(strcasecmp) gl_PREREQ_STRCASECMP ]) AC_DEFUN([gl_FUNC_STRNCASECMP], [ AC_REPLACE_FUNCS(strncasecmp) AC_CHECK_DECLS(strncasecmp) if test $ac_cv_func_strncasecmp = no; then gl_PREREQ_STRNCASECMP fi ]) # Prerequisites of lib/strcasecmp.c. AC_DEFUN([gl_PREREQ_STRCASECMP], [ AC_REQUIRE([gl_FUNC_MBRTOWC]) : ]) # Prerequisites of lib/strncasecmp.c. AC_DEFUN([gl_PREREQ_STRNCASECMP], [ : ]) blame-1.4-20240206/m4/sysexits.m40000644000000000000000000000063210203114523014476 0ustar rootroot# sysexits.m4 serial 2 dnl Copyright (C) 2003,2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_SYSEXITS], [ AC_CHECK_HEADERS(sysexits.h, [SYSEXITS_H=], [SYSEXITS_H=sysexits.h]) AC_SUBST([SYSEXITS_H]) ]) blame-1.4-20240206/m4/memcpy.m40000644000000000000000000000072310203114520014073 0ustar rootroot# memcpy.m4 serial 2 dnl Copyright (C) 2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MEMCPY], [ AC_REPLACE_FUNCS(memcpy) if test $ac_cv_func_memcpy = no; then gl_PREREQ_MEMCPY fi ]) # Prerequisites of lib/memcpy.c. AC_DEFUN([gl_PREREQ_MEMCPY], [ : ]) blame-1.4-20240206/m4/lstat.m40000644000000000000000000000075310527555560013761 0ustar rootroot#serial 15 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 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. dnl From Jim Meyering. AC_DEFUN([gl_FUNC_LSTAT], [ AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ(lstat). : ]) blame-1.4-20240206/m4/tzset.m40000644000000000000000000000345310203114523013760 0ustar rootroot#serial 2 # Copyright (C) 2003 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. # See if we have a working tzset function. # If so, arrange to compile the wrapper function. # For at least Solaris 2.5.1 and 2.6, this is necessary # because tzset can clobber the contents of the buffer # used by localtime. # Written by Paul Eggert and Jim Meyering. AC_DEFUN([gl_FUNC_TZSET_CLOBBER], [ AC_REQUIRE([AC_HEADER_TIME]) AC_CACHE_CHECK([whether tzset clobbers localtime buffer], gl_cv_func_tzset_clobber, [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include int main () { time_t t1 = 853958121; struct tm *p, s; putenv ("TZ=GMT0"); p = localtime (&t1); s = *p; putenv ("TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"); tzset (); exit (p->tm_year != s.tm_year || p->tm_mon != s.tm_mon || p->tm_mday != s.tm_mday || p->tm_hour != s.tm_hour || p->tm_min != s.tm_min || p->tm_sec != s.tm_sec); } ]])], [gl_cv_func_tzset_clobber=no], [gl_cv_func_tzset_clobber=yes], [gl_cv_func_tzset_clobber=yes])]) AC_DEFINE(HAVE_RUN_TZSET_TEST, 1, [Define to 1 if you have run the test for working tzset.]) if test $gl_cv_func_tzset_clobber = yes; then gl_GETTIMEOFDAY_REPLACE_LOCALTIME AC_DEFINE(tzset, rpl_tzset, [Define to rpl_tzset if the wrapper function should be used.]) AC_DEFINE(TZSET_CLOBBERS_LOCALTIME_BUFFER, 1, [Define if tzset clobbers localtime's static buffer.]) fi ]) blame-1.4-20240206/m4/mbrtowc.m40000644000000000000000000000212510337302572014272 0ustar rootroot# mbrtowc.m4 serial 8 dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere. AC_DEFUN([gl_FUNC_MBRTOWC], [ dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], gl_cv_func_mbrtowc, [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[wchar_t wc; char const s[] = ""; size_t n = 1; mbstate_t state; return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], gl_cv_func_mbrtowc=yes, gl_cv_func_mbrtowc=no)]) if test $gl_cv_func_mbrtowc = yes; then AC_DEFINE([HAVE_MBRTOWC], 1, [Define to 1 if mbrtowc and mbstate_t are properly declared.]) fi ]) blame-1.4-20240206/m4/xgetcwd.m40000644000000000000000000000055610527555566014306 0ustar rootroot#serial 6 dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_XGETCWD], [ AC_LIBOBJ([xgetcwd]) AC_REQUIRE([gl_FUNC_GETCWD]) ]) blame-1.4-20240206/m4/extensions.m40000644000000000000000000000014614560000216015005 0ustar rootroot# placeholder to appease gnulib modules - see CF_XOPEN_SOURCE AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],[]) blame-1.4-20240206/m4/inline.m40000644000000000000000000000313710527555557014115 0ustar rootroot# inline.m4 serial 3 dnl Copyright (C) 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Test for the 'inline' keyword or equivalent. dnl Define 'inline' to a supported equivalent, or to nothing if not supported, dnl like AC_C_INLINE does. Also, define HAVE_INLINE if 'inline' or an dnl equivalent is effectively supported, i.e. if the compiler is likely to dnl drop unused 'static inline' functions. AC_DEFUN([gl_INLINE], [ AC_REQUIRE([AC_C_INLINE]) AC_CACHE_CHECK([whether the compiler generally respects inline], [gl_cv_c_inline_effective], [if test $ac_cv_c_inline = no; then gl_cv_c_inline_effective=no else dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is dnl specified. dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result dnl depends on optimization flags, which can be in CFLAGS. dnl (AC_EGREP_CPP looks only at the CPPFLAGS.) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[]], [[#ifdef __NO_INLINE__ #error "inline is not effective" #endif]])], [gl_cv_c_inline_effective=yes], [gl_cv_c_inline_effective=no]) fi ]) if test $gl_cv_c_inline_effective = yes; then AC_DEFINE([HAVE_INLINE], 1, [Define to 1 if the compiler supports one of the keywords 'inline', '__inline__', '__inline' and effectively inlines functions marked as such.]) fi ]) blame-1.4-20240206/m4/ulonglong.m40000644000000000000000000000353210527555560014634 0ustar rootroot# ulonglong.m4 serial 6 dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. # This fixes a bug in Autoconf 2.60, but can be removed once we # assume 2.61 everywhere. # Note: If the type 'unsigned long long int' exists but is only 32 bits # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT # will not be defined. In this case you can treat 'unsigned long long int' # like 'unsigned long int'. AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], [ AC_CACHE_CHECK([for unsigned long long int], [ac_cv_type_unsigned_long_long_int], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[unsigned long long int ull = 18446744073709551615ULL; typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1 ? 1 : -1)]; int i = 63;]], [[unsigned long long int ullmax = 18446744073709551615ull; return (ull << 63 | ull >> 63 | ull << i | ull >> i | ullmax / ull | ullmax % ull);]])], [ac_cv_type_unsigned_long_long_int=yes], [ac_cv_type_unsigned_long_long_int=no])]) if test $ac_cv_type_unsigned_long_long_int = yes; then AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, [Define to 1 if the system has the type `unsigned long long int'.]) fi ]) # This macro is obsolescent and should go away soon. AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG], [ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int if test $ac_cv_type_unsigned_long_long = yes; then AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, [Define if you have the 'unsigned long long' type.]) fi ]) blame-1.4-20240206/m4/xstrndup.m40000644000000000000000000000061610527555557014525 0ustar rootroot# xstrndup.m4 serial 2 dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_XSTRNDUP], [ gl_PREREQ_XSTRNDUP ]) # Prerequisites of lib/xstrndup.c. AC_DEFUN([gl_PREREQ_XSTRNDUP], [ : ]) blame-1.4-20240206/m4/getcwd.m40000644000000000000000000000300410527555560014077 0ustar rootroot# getcwd.m4 - check for working getcwd that is compatible with glibc # Copyright (C) 2001, 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. # Written by Paul Eggert. AC_DEFUN([gl_FUNC_GETCWD_NULL], [ AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result], [gl_cv_func_getcwd_null], [AC_TRY_RUN( [ # include # include # ifndef getcwd char *getcwd (); # endif int main () { if (chdir ("/") != 0) exit (1); else { char *f = getcwd (NULL, 0); exit (! (f && f[0] == '/' && !f[1])); } }], [gl_cv_func_getcwd_null=yes], [gl_cv_func_getcwd_null=no], [gl_cv_func_getcwd_null=no])]) ]) AC_DEFUN([gl_FUNC_GETCWD], [ AC_REQUIRE([gl_FUNC_GETCWD_NULL]) gl_abort_bug=no case $gl_cv_func_getcwd_null in yes) gl_FUNC_GETCWD_PATH_MAX gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes]);; esac case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_path_max,$gl_abort_bug in yes,yes,no) ;; *) AC_LIBOBJ([getcwd]) AC_DEFINE([__GETCWD_PREFIX], [[rpl_]], [Define to rpl_ if the getcwd replacement function should be used.]) gl_PREREQ_GETCWD;; esac ]) # Prerequisites of lib/getcwd.c. AC_DEFUN([gl_PREREQ_GETCWD], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO]) : ]) blame-1.4-20240206/m4/mbchar.m40000644000000000000000000000137614332563500014057 0ustar rootroot# mbchar.m4 serial 4 dnl Copyright (C) 2005-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl autoconf tests required for use of mbchar.m4 dnl From Bruno Haible. AC_DEFUN([gl_MBCHAR], [ AC_REQUIRE([AC_GNU_SOURCE]) dnl The following line is that so the user can test HAVE_WCHAR_H dnl before #include "mbchar.h". AC_CHECK_HEADERS([wchar.h]) dnl Compile mbchar.c only if HAVE_WCHAR_H. if test $ac_cv_header_wchar_h = yes; then AC_LIBOBJ([mbchar]) dnl Prerequisites of mbchar.h and mbchar.c. AC_CHECK_HEADERS([wctype.h]) AC_CHECK_FUNCS([iswcntrl]) fi ]) blame-1.4-20240206/m4/gettimeofday.m40000644000000000000000000000407310254677266015317 0ustar rootroot#serial 7 # Copyright (C) 2001, 2002, 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. dnl From Jim Meyering. dnl dnl See if gettimeofday clobbers the static buffer that localtime uses dnl for its return value. The gettimeofday function from Mac OS X 10.0.4 dnl (i.e., Darwin 1.3.7) has this problem. dnl dnl If it does, then arrange to use gettimeofday and localtime only via dnl the wrapper functions that work around the problem. AC_DEFUN([AC_FUNC_GETTIMEOFDAY_CLOBBER], [ AC_REQUIRE([AC_HEADER_TIME]) AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer], jm_cv_func_gettimeofday_clobber, [AC_TRY_RUN([ #include #include #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include int main () { time_t t = 0; struct tm *lt; struct tm saved_lt; struct timeval tv; lt = localtime (&t); saved_lt = *lt; gettimeofday (&tv, NULL); if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0) exit (1); exit (0); } ], jm_cv_func_gettimeofday_clobber=no, jm_cv_func_gettimeofday_clobber=yes, dnl When crosscompiling, assume it is broken. jm_cv_func_gettimeofday_clobber=yes) ]) if test $jm_cv_func_gettimeofday_clobber = yes; then gl_GETTIMEOFDAY_REPLACE_LOCALTIME AC_DEFINE(gettimeofday, rpl_gettimeofday, [Define to rpl_gettimeofday if the replacement function should be used.]) gl_PREREQ_GETTIMEOFDAY fi ]) AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [ AC_LIBOBJ(gettimeofday) AC_DEFINE(gmtime, rpl_gmtime, [Define to rpl_gmtime if the replacement function should be used.]) AC_DEFINE(localtime, rpl_localtime, [Define to rpl_localtime if the replacement function should be used.]) ]) # Prerequisites of lib/gettimeofday.c. AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [ AC_REQUIRE([AC_HEADER_TIME]) ]) blame-1.4-20240206/m4/vsnprintf.m40000644000000000000000000000073214332563676014665 0ustar rootroot# vsnprintf.m4 serial 2 dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_VSNPRINTF], [ AC_REPLACE_FUNCS(vsnprintf) AC_CHECK_DECLS(vsnprintf) gl_PREREQ_VSNPRINTF ]) # Prerequisites of lib/vsnprintf.c. AC_DEFUN([gl_PREREQ_VSNPRINTF], [:]) blame-1.4-20240206/m4/mktime.m40000644000000000000000000001346714560004236014114 0ustar rootroot#serial 8 dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Jim Meyering. # Redefine AC_FUNC_MKTIME, to fix a bug in Autoconf 2.60a and earlier. # This redefinition can be removed once a new version of Autoconf is assumed. # The redefinition is taken from # . # AC_FUNC_MKTIME # -------------- AC_DEFUN([AC_FUNC_MKTIME], [AC_REQUIRE([AC_HEADER_TIME])dnl AC_CHECK_HEADERS(sys/time.h unistd.h) AC_CHECK_FUNCS(alarm) AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime, [AC_RUN_IFELSE([AC_LANG_SOURCE( [[/* Test program from Paul Eggert and Tony Leneis. */ #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #include #ifdef HAVE_UNISTD_H # include #endif #ifndef HAVE_ALARM # define alarm(X) /* empty */ #endif /* Work around redefinition to rpl_putenv by other config tests. */ #undef putenv static time_t time_t_max; static time_t time_t_min; /* Values we'll use to set the TZ environment variable. */ static char *tz_strings[] = { (char *) 0, "TZ=GMT0", "TZ=JST-9", "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" }; #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) /* Return 0 if mktime fails to convert a date in the spring-forward gap. Based on a problem report from Andreas Jaeger. */ static int spring_forward_gap (void) { /* glibc (up to about 1998-10-07) failed this test. */ struct tm tm; /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); tm.tm_year = 98; tm.tm_mon = 3; tm.tm_mday = 5; tm.tm_hour = 2; tm.tm_min = 0; tm.tm_sec = 0; tm.tm_isdst = -1; return mktime (&tm) != (time_t) -1; } static int mktime_test1 (time_t now) { struct tm *lt; return ! (lt = localtime (&now)) || mktime (lt) == now; } static int mktime_test (time_t now) { return (mktime_test1 (now) && mktime_test1 ((time_t) (time_t_max - now)) && mktime_test1 ((time_t) (time_t_min + now))); } static int irix_6_4_bug (void) { /* Based on code from Ariel Faigon. */ struct tm tm; tm.tm_year = 96; tm.tm_mon = 3; tm.tm_mday = 0; tm.tm_hour = 0; tm.tm_min = 0; tm.tm_sec = 0; tm.tm_isdst = -1; mktime (&tm); return tm.tm_mon == 2 && tm.tm_mday == 31; } static int bigtime_test (int j) { struct tm tm; time_t now; tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j; now = mktime (&tm); if (now != (time_t) -1) { struct tm *lt = localtime (&now); if (! (lt && lt->tm_year == tm.tm_year && lt->tm_mon == tm.tm_mon && lt->tm_mday == tm.tm_mday && lt->tm_hour == tm.tm_hour && lt->tm_min == tm.tm_min && lt->tm_sec == tm.tm_sec && lt->tm_yday == tm.tm_yday && lt->tm_wday == tm.tm_wday && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) return 0; } return 1; } static int year_2050_test (void) { /* The correct answer for 2050-02-01 00:00:00 in Pacific time, ignoring leap seconds. */ unsigned long int answer = 2527315200UL; struct tm tm; time_t t; tm.tm_year = 2050 - 1900; tm.tm_mon = 2 - 1; tm.tm_mday = 1; tm.tm_hour = tm.tm_min = tm.tm_sec = 0; tm.tm_isdst = -1; /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); t = mktime (&tm); /* Check that the result is either a failure, or close enough to the correct answer that we can assume the discrepancy is due to leap seconds. */ return (t == (time_t) -1 || (0 < t && answer - 120 <= t && t <= answer + 120)); } int main (void) { time_t t, delta; int i, j; /* This test makes some buggy mktime implementations loop. Give up after a few seconds; a mktime slower than that isn't worth using anyway. */ alarm (3); for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) continue; time_t_max--; if ((time_t) -1 < 0) for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2) continue; delta = time_t_max / 997; /* a suitable prime number */ for (i = 0; i < N_STRINGS; i++) { if (tz_strings[i]) putenv (tz_strings[i]); for (t = 0; t <= time_t_max - delta; t += delta) if (! mktime_test (t)) return 1; if (! (mktime_test ((time_t) 1) && mktime_test ((time_t) (60 * 60)) && mktime_test ((time_t) (60 * 60 * 24)))) return 1; for (j = 1; 0 < j; j *= 2) if (! bigtime_test (j)) return 1; if (! bigtime_test (j - 1)) return 1; } return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); }]])], [ac_cv_func_working_mktime=yes], [ac_cv_func_working_mktime=no], [ac_cv_func_working_mktime=no])]) if test $ac_cv_func_working_mktime = no; then AC_LIBOBJ([mktime]) fi ])# AC_FUNC_MKTIME AC_DEFUN([gl_FUNC_MKTIME], [ AC_REQUIRE([AC_FUNC_MKTIME]) if test $ac_cv_func_working_mktime = no; then AC_DEFINE(mktime, rpl_mktime, [Define to rpl_mktime if the replacement function should be used.]) gl_PREREQ_MKTIME fi ]) # Prerequisites of lib/mktime.c. AC_DEFUN([gl_PREREQ_MKTIME], [:]) blame-1.4-20240206/m4/stdint_h.m40000644000000000000000000000161410527555560014443 0ustar rootroot# stdint_h.m4 serial 6 dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_STDINT_H_WITH_UINTMAX if exists, # doesn't clash with , and declares uintmax_t. AC_DEFUN([gl_AC_HEADER_STDINT_H], [ AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1; return !i;], gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)]) if test $gl_cv_header_stdint_h = yes; then AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, [Define if exists, doesn't clash with , and declares uintmax_t. ]) fi ]) blame-1.4-20240206/m4/getdelim.m40000644000000000000000000000026614557040132014412 0ustar rootrootAC_DEFUN([gl_FUNC_GETDELIM], [ AC_REPLACE_FUNCS(getdelim) AC_CHECK_DECLS(getdelim) if test $ac_cv_func_getdelim = no; then AC_CHECK_FUNCS([flockfile funlockfile]) fi ]) blame-1.4-20240206/m4/memchr.m40000644000000000000000000000077010203114520014056 0ustar rootroot# memchr.m4 serial 4 dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MEMCHR], [ AC_REPLACE_FUNCS(memchr) if test $ac_cv_func_memchr = no; then gl_PREREQ_MEMCHR fi ]) # Prerequisites of lib/memchr.c. AC_DEFUN([gl_PREREQ_MEMCHR], [ AC_CHECK_HEADERS(bp-sym.h) ]) blame-1.4-20240206/m4/stdbool.m40000644000000000000000000000615714332563243014277 0ustar rootroot# Check for stdbool.h that conforms to C99. dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # This macro is only needed in autoconf <= 2.59. Newer versions of autoconf # have this macro built-in. AC_DEFUN([AC_HEADER_STDBOOL], [AC_CACHE_CHECK([for stdbool.h that conforms to C99], [ac_cv_header_stdbool_h], [AC_TRY_COMPILE( [ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; bool e = &s; char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; #if defined __xlc__ || defined __GNUC__ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 reported by James Lemley on 2005-10-05; see http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html This test is not quite right, since xlc is allowed to reject this program, as the initializer for xlcbug is not one of the forms that C requires support for. However, doing the test right would require a run-time test, and that would make cross-compilation harder. Let us hope that IBM fixes the xlc bug, and also adds support for this kind of constant expression. In the meantime, this test will reject xlc, which is OK, since our stdbool.h substitute should suffice. We also test this with GCC, where it should work, to detect more quickly whether someone messes up the test in the future. */ char digs[] = "0123456789"; int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); #endif /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; ], [ *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ], [ac_cv_header_stdbool_h=yes], [ac_cv_header_stdbool_h=no])]) AC_CHECK_TYPES([_Bool]) if test $ac_cv_header_stdbool_h = yes; then AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.]) fi]) blame-1.4-20240206/m4/dirname.m40000644000000000000000000000106210527555560014243 0ustar rootroot#serial 7 -*- autoconf -*- dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_DIRNAME], [ AC_LIBOBJ([basename]) AC_LIBOBJ([dirname]) AC_LIBOBJ([stripslash]) dnl Prerequisites of lib/dirname.h. AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c. ]) blame-1.4-20240206/m4/getopt.m40000644000000000000000000000435314556047326014136 0ustar rootroot# getopt.m4 serial 13 dnl Copyright 2024 Thomas E. Dickey dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # The getopt module assume you want GNU getopt, with getopt_long etc, # rather than vanilla POSIX getopt. This means your code should # always include for the getopt prototypes. AC_DEFUN([gl_GETOPT_CHECK_HEADERS], [ if test -z "$GETOPT_H"; then AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h]) fi if test -z "$GETOPT_H"; then AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) fi dnl BSD getopt_long uses an incompatible method to reset option processing, dnl and (as of 2004-10-15) mishandles optional option-arguments. if test -z "$GETOPT_H"; then AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include ]) fi dnl Solaris 10 getopt doesn't handle `+' as a leading character in an dnl option string (as of 2005-05-05). if test -z "$GETOPT_H"; then AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([#include ], [[ char *myargv[3]; myargv[0] = "conftest"; myargv[1] = "-+"; myargv[2] = 0; return getopt (2, myargv, "+a") != '?'; ]])], [gl_cv_func_gnu_getopt=yes], [gl_cv_func_gnu_getopt=no], [dnl cross compiling - pessimistically guess based on decls dnl Solaris 10 getopt doesn't handle `+' as a leading character in an dnl option string (as of 2005-05-05). AC_CHECK_DECL([getopt_clip], [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes], [#include ])])]) if test "$gl_cv_func_gnu_getopt" = "no"; then GETOPT_H=getopt.h fi fi ]) AC_DEFUN([gl_GETOPT], [ AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) AC_LIBOBJ([getopt]) AC_LIBOBJ([getopt1]) if test -n "$GETOPT_H" then : else GETOPT_H=getopt.h AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], [Define to rpl_ if the getopt replacement functions and variables should be used.]) AC_SUBST([GETOPT_H]) fi AC_CHECK_DECLS([getenv]) ]) blame-1.4-20240206/m4/readlink.m40000644000000000000000000000076710203114521014403 0ustar rootroot# readlink.m4 serial 2 dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_READLINK], [ AC_CHECK_FUNCS(readlink) if test $ac_cv_func_readlink = no; then AC_LIBOBJ(readlink) gl_PREREQ_READLINK fi ]) # Prerequisites of lib/readlink.c. AC_DEFUN([gl_PREREQ_READLINK], [ : ]) blame-1.4-20240206/m4/langinfo.m40000644000000000000000000000356114332563500014416 0ustar rootroot# langinfo.m4 dnl Copyright (C) 2004 Michael Chapman dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. AC_DEFUN([mac_HAVE_NL_LANGINFO], [ AC_CHECK_HEADERS([langinfo.h]) m4_pattern_allow(AM_STR) if test "$ac_cv_header_langinfo_h" = yes; then AC_CACHE_CHECK([for nl_langinfo in langinfo.h], mac_cv_have_nl_langinfo, [ AC_LINK_IFELSE(AC_LANG_PROGRAM([[ #include ]], [[ char* am = nl_langinfo(AM_STR); char* pm = nl_langinfo(PM_STR); char* m1 = nl_langinfo(MON_1); char* am1 = nl_langinfo(ABMON_1); char* d1 = nl_langinfo(DAY_1); char* ad1 = nl_langinfo(ABDAY_1); ]]), mac_cv_have_nl_langinfo=yes, mac_cv_have_nl_langinfo=no ) ]) if test "$mac_cv_have_nl_langinfo" = yes; then AC_CACHE_CHECK([for decimal point constant for nl_langinfo], mac_cv_nl_langinfo_dp, [ AC_LINK_IFELSE(AC_LANG_PROGRAM([[ #include ]], [[ char* dp = nl_langinfo(DECIMAL_POINT); ]]), mac_cv_nl_langinfo_dp=DECIMAL_POINT, [AC_LINK_IFELSE(AC_LANG_PROGRAM([[ #include ]], [[ char* dp = nl_langinfo(RADIXCHAR); ]]), mac_cv_nl_langinfo_dp=RADIXCHAR, mac_cv_have_nl_langinfo=unknown )]) ]) else mac_cv_nl_langinfo_dp=unknown fi if test "$mac_cv_have_nl_langinfo" != no; then AC_DEFINE(HAVE_NL_LANGINFO, 1, [Define if you have the `nl_langinfo' function.] ) fi if test "$mac_cv_nl_langinfo_dp" != unknown; then AC_DEFINE_UNQUOTED(NL_LANGINFO_DP, $mac_cv_nl_langinfo_dp, [Define to the decimal point constant for use in the `nl_langinfo' function. Do not define if no constant is available.] ) fi fi ]) blame-1.4-20240206/m4/setenv.m40000644000000000000000000000356514332563500014131 0ustar rootroot# setenv.m4 serial 6 dnl Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gt_FUNC_SETENV], [ AC_REPLACE_FUNCS(setenv unsetenv) if test $ac_cv_func_setenv = no; then gl_PREREQ_SETENV fi if test $ac_cv_func_unsetenv = no; then gl_PREREQ_UNSETENV else AC_CACHE_CHECK([for unsetenv() return type], gt_cv_func_unsetenv_ret, [AC_TRY_COMPILE([#include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(__cplusplus) int unsetenv (const char *name); #else int unsetenv(); #endif ], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')]) if test $gt_cv_func_unsetenv_ret = 'void'; then AC_DEFINE(VOID_UNSETENV, 1, [Define if unsetenv() returns void, not int.]) fi fi ]) # Check if a variable is properly declared. # gt_CHECK_VAR_DECL(includes,variable) AC_DEFUN([gt_CHECK_VAR_DECL], [ define([gt_cv_var], [gt_cv_var_]$2[_declaration]) AC_MSG_CHECKING([if $2 is properly declared]) AC_CACHE_VAL(gt_cv_var, [ AC_TRY_COMPILE([$1 extern struct { int foo; } $2;], [$2.foo = 1;], gt_cv_var=no, gt_cv_var=yes)]) AC_MSG_RESULT($gt_cv_var) if test $gt_cv_var = yes; then AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z])[_DECL], 1, [Define if you have the declaration of $2.]) fi ]) # Prerequisites of lib/setenv.c. AC_DEFUN([gl_PREREQ_SETENV], [ AC_REQUIRE([AC_FUNC_ALLOCA]) AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(search.h) AC_CHECK_FUNCS(tsearch) gt_CHECK_VAR_DECL([#include ], environ) ]) # Prerequisites of lib/unsetenv.c. AC_DEFUN([gl_PREREQ_UNSETENV], [ AC_CHECK_HEADERS(unistd.h) gt_CHECK_VAR_DECL([#include ], environ) ]) blame-1.4-20240206/m4/getcwd-abort-bug.m40000644000000000000000000000555214332563676015776 0ustar rootroot#serial 1 # Determine whether getcwd aborts when the length of the working directory # name is unusually large. Any length between 4k and 16k trigger the bug # when using glibc-2.4.90-9 or older. # Copyright (C) 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. # From Jim Meyering # gl_FUNC_GETCWD_ABORT_BUG([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG], [ AC_CHECK_DECLS(getcwd) AC_CHECK_FUNCS(getpagesize) AC_CACHE_CHECK([whether getcwd aborts when 4k < cwd_length < 16k], gl_cv_func_getcwd_abort_bug, [# Remove any remnants of a previous test. rm -rf confdir-14B--- # Arrange for deletion of the temporary directory this test creates. ac_clean_files="$ac_clean_files confdir-14B---" AC_RUN_IFELSE( [AC_LANG_SOURCE( [[ #include #include #include #include #include /* Don't get link errors because mkdir is redefined to rpl_mkdir. */ #undef mkdir #ifndef S_IRWXU # define S_IRWXU 0700 #endif /* FIXME: skip the run-test altogether on systems without getpagesize. */ #if ! HAVE_GETPAGESIZE # define getpagesize() 0 #endif /* This size is chosen to be larger than PATH_MAX (4k), yet smaller than the 16kB pagesize on ia64 linux. Those conditions make the code below trigger a bug in glibc's getcwd implementation before 2.4.90-10. */ #define TARGET_LEN (5 * 1024) int main () { char const *dir_name = "confdir-14B---"; char *cwd; size_t initial_cwd_len; int fail = 0; size_t desired_depth; size_t d; /* The bug is triggered when PATH_MAX < getpagesize (), so skip this relative expensive and invasive test if that's not true. */ if (getpagesize () <= PATH_MAX) return 0; cwd = getcwd (NULL, 0); if (cwd == NULL) return 0; initial_cwd_len = strlen (cwd); free (cwd); desired_depth = ((TARGET_LEN - 1 - initial_cwd_len) / (1 + strlen (dir_name))); for (d = 0; d < desired_depth; d++) { if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0) { fail = 3; /* Unable to construct deep hierarchy. */ break; } } /* If libc has the bug in question, this invocation of getcwd results in a failed assertion. */ cwd = getcwd (NULL, 0); if (cwd == NULL) fail = 4; /* getcwd failed. This is ok, and expected. */ free (cwd); /* Call rmdir first, in case the above chdir failed. */ rmdir (dir_name); while (0 < d--) { if (chdir ("..") < 0) break; rmdir (dir_name); } return 0; } ]])], [gl_cv_func_getcwd_abort_bug=no], [gl_cv_func_getcwd_abort_bug=yes], [gl_cv_func_getcwd_abort_bug=yes]) ]) AS_IF([test $gl_cv_func_getcwd_abort_bug = yes], [$1], [$2]) ]) blame-1.4-20240206/m4/minmax.m40000644000000000000000000000233510337302611014103 0ustar rootroot# minmax.m4 serial 2 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_PREREQ(2.52) AC_DEFUN([gl_MINMAX], [ AC_REQUIRE([gl_PREREQ_MINMAX]) ]) # Prerequisites of lib/minmax.h. AC_DEFUN([gl_PREREQ_MINMAX], [ gl_MINMAX_IN_HEADER([limits.h]) gl_MINMAX_IN_HEADER([sys/param.h]) ]) dnl gl_MINMAX_IN_HEADER(HEADER) dnl The parameter has to be a literal header name; it cannot be macro, dnl nor a shell variable. (Because autoheader collects only AC_DEFINE dnl invocations with a literal macro name.) AC_DEFUN([gl_MINMAX_IN_HEADER], [ m4_pushdef([header], AS_TR_SH([$1])) m4_pushdef([HEADER], AS_TR_CPP([$1])) AC_CACHE_CHECK([whether <$1> defines MIN and MAX], [gl_cv_minmax_in_]header, [AC_TRY_COMPILE([#include <$1> int x = MIN (42, 17);], [], [gl_cv_minmax_in_]header[=yes], [gl_cv_minmax_in_]header[=no])]) if test $gl_cv_minmax_in_[]header = yes; then AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1, [Define to 1 if <$1> defines the MIN and MAX macros.]) fi m4_popdef([HEADER]) m4_popdef([header]) ]) blame-1.4-20240206/m4/inttypes_h.m40000644000000000000000000000164410527555560015020 0ustar rootroot# inttypes_h.m4 serial 7 dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, # doesn't clash with , and declares uintmax_t. AC_DEFUN([gl_AC_HEADER_INTTYPES_H], [ AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1; return !i;], gl_cv_header_inttypes_h=yes, gl_cv_header_inttypes_h=no)]) if test $gl_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, [Define if exists, doesn't clash with , and declares uintmax_t. ]) fi ]) blame-1.4-20240206/m4/gnulib-comp.m40000644000000000000000000001665014556136705015053 0ustar rootroot# DO NOT EDIT! GENERATED AUTOMATICALLY! # Copyright (C) 2004-2006 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General # Public License, this file may be distributed as part of a program # that contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. # # This file represents the compiled summary of the specification in # gnulib-cache.m4. It lists the computed macro invocations that need # to be invoked from configure.ac. # In projects using CVS, this file can be treated like other built files. # This macro should be invoked from ./configure.ac, in the section # "Checks for programs", right after AC_PROG_CC, and certainly before # any checks for libraries, header files, types and library functions. AC_DEFUN([gl_EARLY], [ m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace m4_pattern_allow([^gl_ES$])dnl a valid locale name m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable AC_REQUIRE([AC_PROG_RANLIB]) AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) ]) # This macro should be invoked from ./configure.ac, in the section # "Check for header files, types and library functions". AC_DEFUN([gl_INIT], [ m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) gl_cond_libtool=false gl_libdeps= gl_ltlibdeps= gl_source_base='lib' gl_FUNC_ALLOCA gl_ALLOCSA gl_ARGP AC_FUNC_CALLOC AC_FUNC_CANONICALIZE_FILE_NAME gl_CYCLE_CHECK gl_CHECK_TYPE_STRUCT_DIRENT_D_INO gl_DIRNAME gl_ERROR gl_EXITFAIL dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac. gl_FILE_NAME_CONCAT gl_FUNC_FREE gl_FUNC_GETCWD gl_FUNC_GETDELIM gl_FUNC_GETLINE gl_GETOPT AC_FUNC_GETTIMEOFDAY_CLOBBER gl_INLINE gl_FUNC_LSTAT AC_FUNC_MALLOC gl_MBCHAR gl_MBITER gl_FUNC_MEMCHR gl_FUNC_MEMCMP gl_FUNC_MEMCPY gl_FUNC_MEMMOVE gl_FUNC_MEMPCPY gl_FUNC_MEMSET gl_MINMAX gl_FUNC_MKTIME AC_FUNC_OBSTACK dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]). gl_PATHMAX gl_FUNC_READLINK dnl AC_FUNC_REALLOC gt_FUNC_SETENV gl_SIZE_MAX gt_TYPE_SSIZE_T dnl gl_STDINT_H gl_STRCASE gl_FUNC_STRCHRNUL gl_FUNC_STRDUP gl_FUNC_GNU_STRFTIME gl_FUNC_STRNDUP gl_FUNC_STRNLEN gl_FUNC_STRPBRK gl_FUNC_STRSTR gl_FUNC_STRTOL gl_FUNC_STRTOUL dnl gl_HEADER_SYS_STAT_H gl_SYSEXITS gl_TIME_R gl_FUNC_TZSET_CLOBBER dnl gl_HEADER_UNISTD gl_FUNC_GLIBC_UNLOCKED_IO dnl gl_FUNC_VASNPRINTF gl_FUNC_VSNPRINTF gl_FUNC_WCWIDTH gl_XALLOC gl_XGETCWD gl_XREADLINK gl_XSIZE gl_XSTRNDUP LIBMISC_LIBDEPS="$gl_libdeps" AC_SUBST([LIBMISC_LIBDEPS]) LIBMISC_LTLIBDEPS="$gl_ltlibdeps" AC_SUBST([LIBMISC_LTLIBDEPS]) m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_LIBOBJ]) AC_CONFIG_COMMANDS_PRE([ gl_libobjs= gl_ltlibobjs= if test -n "$gl_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do gl_libobjs="$gl_libobjs $i.$ac_objext" gl_ltlibobjs="$gl_ltlibobjs $i.lo" done fi AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) ]) ]) # Like AC_LIBOBJ, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gl_LIBOBJ], [gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"]) # Like AC_REPLACE_FUNCS, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gl_REPLACE_FUNCS], [AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])]) # Like AC_LIBSOURCES, except that it does nothing. # We rely on EXTRA_lib..._SOURCES instead. AC_DEFUN([gl_LIBSOURCES], []) # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([gl_FILE_LIST], [ lib/alloca.c lib/alloca_.h lib/allocsa.c lib/allocsa.h lib/allocsa.valgrind lib/argp-ba.c lib/argp-eexst.c lib/argp-fmtstream.c lib/argp-fmtstream.h lib/argp-fs-xinl.c lib/argp-help.c lib/argp-namefrob.h lib/argp-parse.c lib/argp-pin.c lib/argp-pv.c lib/argp-pvh.c lib/argp-xinl.c lib/argp.h lib/asnprintf.c lib/basename.c lib/calloc.c lib/canonicalize.c lib/canonicalize.h lib/cycle-check.c lib/cycle-check.h lib/dev-ino.h lib/dirname.c lib/dirname.h lib/error.c lib/error.h lib/exit.h lib/exitfail.c lib/exitfail.h lib/filenamecat.c lib/filenamecat.h lib/free.c lib/getcwd.c lib/getcwd.h lib/getdelim.c lib/getdelim.h lib/getline.c lib/getline.h lib/getopt.c lib/getopt1.c lib/getopt_.h lib/getopt_int.h lib/gettext.h lib/gettimeofday.c lib/lstat.c lib/lstat.h lib/malloc.c lib/mbchar.c lib/mbchar.h lib/mbuiter.h lib/memchr.c lib/memcmp.c lib/memcpy.c lib/memmove.c lib/mempcpy.c lib/mempcpy.h lib/memset.c lib/minmax.h lib/mktime.c lib/obstack.c lib/obstack.h lib/pathmax.h lib/printf-args.c lib/printf-args.h lib/printf-parse.c lib/printf-parse.h lib/progname.c lib/progname.h lib/readlink.c lib/realloc.c lib/same-inode.h lib/setenv.c lib/setenv.h lib/size_max.h lib/stat_.h lib/stdbool_.h lib/stdint_.h lib/strcase.h lib/strcasecmp.c lib/strchrnul.c lib/strchrnul.h lib/strdup.c lib/strdup.h lib/strftime.c lib/strftime.h lib/stripslash.c lib/strncasecmp.c lib/strndup.c lib/strndup.h lib/strnlen.c lib/strnlen.h lib/strnlen1.c lib/strnlen1.h lib/strpbrk.c lib/strpbrk.h lib/strstr.c lib/strstr.h lib/strtol.c lib/strtoul.c lib/sysexit_.h lib/time_r.c lib/time_r.h lib/unlocked-io.h lib/unsetenv.c lib/vasnprintf.c lib/vasnprintf.h lib/vsnprintf.c lib/vsnprintf.h lib/wcwidth.h lib/xalloc-die.c lib/xalloc.h lib/xgetcwd.c lib/xgetcwd.h lib/xmalloc.c lib/xreadlink.c lib/xreadlink.h lib/xsize.h lib/xstrndup.c lib/xstrndup.h m4/alloca.m4 m4/allocsa.m4 m4/argp.m4 m4/calloc.m4 m4/canonicalize.m4 m4/cycle-check.m4 m4/d-ino.m4 m4/dirname.m4 m4/dos.m4 m4/double-slash-root.m4 m4/eealloc.m4 m4/eoverflow.m4 m4/error.m4 m4/exitfail.m4 m4/extensions.m4 m4/filenamecat.m4 m4/free.m4 m4/getcwd-abort-bug.m4 m4/getcwd-path-max.m4 m4/getcwd.m4 m4/getdelim.m4 m4/getline.m4 m4/getopt.m4 m4/gettimeofday.m4 m4/inline.m4 m4/intmax_t.m4 m4/inttypes_h.m4 m4/longdouble.m4 m4/longlong.m4 m4/lstat.m4 m4/mbchar.m4 m4/mbiter.m4 m4/mbrtowc.m4 m4/mbstate_t.m4 m4/memchr.m4 m4/memcmp.m4 m4/memcpy.m4 m4/memmove.m4 m4/mempcpy.m4 m4/memset.m4 m4/minmax.m4 m4/mktime.m4 m4/pathmax.m4 m4/readlink.m4 m4/setenv.m4 m4/size_max.m4 m4/ssize_t.m4 m4/stdbool.m4 m4/stdint.m4 m4/stdint_h.m4 m4/strcase.m4 m4/strchrnul.m4 m4/strdup.m4 m4/strftime.m4 m4/strndup.m4 m4/strnlen.m4 m4/strpbrk.m4 m4/strstr.m4 m4/strtol.m4 m4/strtoul.m4 m4/sys_stat_h.m4 m4/sysexits.m4 m4/time_r.m4 m4/tm_gmtoff.m4 m4/tzset.m4 m4/ulonglong.m4 m4/unistd_h.m4 m4/unlocked-io.m4 m4/vasnprintf.m4 m4/vsnprintf.m4 m4/wchar_t.m4 m4/wcwidth.m4 m4/wint_t.m4 m4/xalloc.m4 m4/xgetcwd.m4 m4/xreadlink.m4 m4/xsize.m4 m4/xstrndup.m4 ]) blame-1.4-20240206/m4/d-ino.m40000644000000000000000000000164110527555560013635 0ustar rootroot#serial 8 dnl From Jim Meyering. dnl dnl Check whether struct dirent has a member named d_ino. dnl # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 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. AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO], [AC_CACHE_CHECK([for d_ino member in directory struct], jm_cv_struct_dirent_d_ino, [AC_TRY_LINK(dnl [ #include #include ], [struct dirent dp; dp.d_ino = 0;], jm_cv_struct_dirent_d_ino=yes, jm_cv_struct_dirent_d_ino=no) ] ) if test $jm_cv_struct_dirent_d_ino = yes; then AC_DEFINE(D_INO_IN_DIRENT, 1, [Define if there is a member named d_ino in the struct describing directory headers.]) fi ] ) blame-1.4-20240206/m4/tm_gmtoff.m40000644000000000000000000000101610203114523014562 0ustar rootroot# tm_gmtoff.m4 serial 2 dnl Copyright (C) 2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_TM_GMTOFF], [ AC_CHECK_MEMBER([struct tm.tm_gmtoff], [AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if struct tm has the tm_gmtoff member.])], , [#include ]) ]) blame-1.4-20240206/m4/longdouble.m40000644000000000000000000000227710527555560014767 0ustar rootroot# longdouble.m4 serial 2 (gettext-0.15) dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether the compiler supports the 'long double' type. dnl Prerequisite: AC_PROG_CC dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics. AC_DEFUN([gt_TYPE_LONGDOUBLE], [ AC_CACHE_CHECK([for long double], gt_cv_c_long_double, [if test "$GCC" = yes; then gt_cv_c_long_double=yes else AC_TRY_COMPILE([ /* The Stardent Vistra knows sizeof(long double), but does not support it. */ long double foo = 0.0; /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ int array [2*(sizeof(long double) >= sizeof(double)) - 1]; ], , gt_cv_c_long_double=yes, gt_cv_c_long_double=no) fi]) if test $gt_cv_c_long_double = yes; then AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) fi ]) blame-1.4-20240206/m4/xreadlink.m40000644000000000000000000000062510527555566014617 0ustar rootroot#serial 8 dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_XREADLINK], [ AC_LIBOBJ([xreadlink]) dnl Prerequisites of lib/xreadlink.c. AC_REQUIRE([gt_TYPE_SSIZE_T]) ]) blame-1.4-20240206/m4/free.m40000644000000000000000000000253110337302611013531 0ustar rootroot# Check whether free (NULL) is supposed to work. # Copyright (C) 2003, 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. # Written by Paul Eggert. # We can't test for free (NULL) even at runtime, since it might # happen to "work" for our test program, but not in general. So, be # conservative and use feature tests for relatively modern hosts, # where free (NULL) is known to work. This costs a bit of # performance on some older hosts, but we can fix that later if # needed. AC_DEFUN([gl_FUNC_FREE], [ AC_CACHE_CHECK([whether free (NULL) is known to work], [gl_cv_func_free], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[@%:@include ]], [[@%:@if _POSIX_VERSION < 199009L && \ (defined unix || defined _unix || defined _unix_ \ || defined __unix || defined __unix__) @%:@error "'free (NULL)' is not known to work" @%:@endif]])], [gl_cv_func_free=yes], [gl_cv_func_free=no])]) if test $gl_cv_func_free = no; then AC_LIBOBJ(free) AC_DEFINE(free, rpl_free, [Define to rpl_free if the replacement function should be used.]) fi ]) # Prerequisites of lib/free.c. AC_DEFUN([gl_PREREQ_FREE], [:]) blame-1.4-20240206/m4/strtol.m40000644000000000000000000000052510527555560014156 0ustar rootroot# strtol.m4 serial 4 dnl Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOL], [ AC_REPLACE_FUNCS(strtol) ]) blame-1.4-20240206/m4/unlocked-io.m40000644000000000000000000000276614332563676015056 0ustar rootroot# unlocked-io.m4 serial 14 # Copyright (C) 1998, 1999, 2000, 2001, 2002, 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. dnl From Jim Meyering. dnl dnl See if the glibc *_unlocked I/O macros or functions are available. dnl Use only those *_unlocked macros or functions that are declared dnl (because some of them were declared in Solaris 2.5.1 but were removed dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run dnl on Solaris 2.6). AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], [ AC_DEFINE([USE_UNLOCKED_IO], 1, [Define to 1 if you want getc etc. to use unlocked I/O if available. Unlocked I/O can improve performance in unithreaded apps, but it is not safe for multithreaded apps.]) dnl Persuade glibc and Solaris to declare dnl fgets_unlocked(), fputs_unlocked() etc. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_DECLS([clearerr_unlocked]) AC_CHECK_DECLS([feof_unlocked]) AC_CHECK_DECLS([ferror_unlocked]) AC_CHECK_DECLS([fflush_unlocked]) AC_CHECK_DECLS([fgets_unlocked]) AC_CHECK_DECLS([fputc_unlocked]) AC_CHECK_DECLS([fputs_unlocked]) AC_CHECK_DECLS([fread_unlocked]) AC_CHECK_DECLS([fwrite_unlocked]) AC_CHECK_DECLS([getc_unlocked]) AC_CHECK_DECLS([getchar_unlocked]) AC_CHECK_DECLS([putc_unlocked]) AC_CHECK_DECLS([putchar_unlocked]) ]) blame-1.4-20240206/m4/memmove.m40000644000000000000000000000073210203114520014246 0ustar rootroot# memmove.m4 serial 2 dnl Copyright (C) 2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MEMMOVE], [ AC_REPLACE_FUNCS(memmove) if test $ac_cv_func_memmove = no; then gl_PREREQ_MEMMOVE fi ]) # Prerequisites of lib/memmove.c. AC_DEFUN([gl_PREREQ_MEMMOVE], [ : ]) blame-1.4-20240206/m4/intmax_t.m40000644000000000000000000000375710527555560014464 0ustar rootroot# intmax_t.m4 serial 5 dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. AC_PREREQ(2.13) # Define intmax_t to 'long' or 'long long' # if it is not already defined in or . AC_DEFUN([gl_AC_TYPE_INTMAX_T], [ dnl For simplicity, we assume that a header file defines 'intmax_t' if and dnl only if it defines 'uintmax_t'. AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) test $ac_cv_type_long_long = yes \ && ac_type='long long' \ || ac_type='long' AC_DEFINE_UNQUOTED(intmax_t, $ac_type, [Define to long or long long if and don't define.]) else AC_DEFINE(HAVE_INTMAX_T, 1, [Define if you have the 'intmax_t' type in or .]) fi ]) dnl An alternative would be to explicitly test for 'intmax_t'. AC_DEFUN([gt_AC_TYPE_INTMAX_T], [ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, [AC_TRY_COMPILE([ #include #include #if HAVE_STDINT_H_WITH_UINTMAX #include #endif #if HAVE_INTTYPES_H_WITH_UINTMAX #include #endif ], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) if test $gt_cv_c_intmax_t = yes; then AC_DEFINE(HAVE_INTMAX_T, 1, [Define if you have the 'intmax_t' type in or .]) else AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) test $ac_cv_type_long_long = yes \ && ac_type='long long' \ || ac_type='long' AC_DEFINE_UNQUOTED(intmax_t, $ac_type, [Define to long or long long if and don't define.]) fi ]) blame-1.4-20240206/m4/alloca.m40000644000000000000000000000331510527555560014062 0ustar rootroot# alloca.m4 serial 7 dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ALLOCA], [ dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. AC_REQUIRE([AC_PROG_CPP]) AC_REQUIRE([AC_PROG_EGREP]) AC_REQUIRE([AC_FUNC_ALLOCA]) if test $ac_cv_func_alloca_works = no; then gl_PREREQ_ALLOCA fi # Define an additional variable used in the Makefile substitution. if test $ac_cv_working_alloca_h = yes; then AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [ AC_EGREP_CPP([Need own alloca], [ #if defined __GNUC__ || defined _AIX || defined _MSC_VER Need own alloca #endif ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no]) ]) if test $gl_cv_rpl_alloca = yes; then dnl OK, alloca can be implemented through a compiler built-in. AC_DEFINE([HAVE_ALLOCA], 1, [Define to 1 if you have 'alloca' after including , a header that may be supplied by this distribution.]) ALLOCA_H=alloca.h else dnl alloca exists as a library function, i.e. it is slow and probably dnl a memory leak. Don't define HAVE_ALLOCA in this case. ALLOCA_H= fi else ALLOCA_H=alloca.h fi AC_SUBST([ALLOCA_H]) AC_DEFINE(HAVE_ALLOCA_H, 1, [Define HAVE_ALLOCA_H for backward compatibility with older code that includes only if HAVE_ALLOCA_H is defined.]) ]) # Prerequisites of lib/alloca.c. # STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. AC_DEFUN([gl_PREREQ_ALLOCA], [:]) blame-1.4-20240206/m4/strtoul.m40000644000000000000000000000052210527555560014340 0ustar rootroot# strtoul.m4 serial 3 dnl Copyright (C) 2002, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOUL], [ AC_REPLACE_FUNCS(strtoul) ]) blame-1.4-20240206/m4/memcmp.m40000644000000000000000000000112410203114520014053 0ustar rootroot# memcmp.m4 serial 11 dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MEMCMP], [ AC_REQUIRE([AC_FUNC_MEMCMP]) if test $ac_cv_func_memcmp_working = no; then AC_DEFINE(memcmp, rpl_memcmp, [Define to rpl_memcmp if the replacement function should be used.]) gl_PREREQ_MEMCMP fi ]) # Prerequisites of lib/memcmp.c. AC_DEFUN([gl_PREREQ_MEMCMP], [:]) blame-1.4-20240206/m4/argp.m40000644000000000000000000000534014556050554013557 0ustar rootroot# argp.m4 serial 7 dnl Copyright (C) 2003-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_ARGP], [ dnl AC_REQUIRE([AC_C_INLINE]) dnl AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) dnl AC_REQUIRE([gl_GETOPT]) AC_CHECK_DECL([program_invocation_name], [AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_NAME, 1, [Define if program_invocation_name is declared])], [AC_DEFINE(GNULIB_PROGRAM_INVOCATION_NAME, 1, [Define to 1 to add extern declaration of program_invocation_name to argp.h])], [#include ]) AC_CHECK_DECL([program_invocation_short_name], [AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME, 1, [Define if program_invocation_short_name is declared])], [AC_DEFINE(GNULIB_PROGRAM_INVOCATION_SHORT_NAME, 1, [Define to 1 to add extern declaration of program_invocation_short_name to argp.h])], [#include ]) # Check if program_invocation_name and program_invocation_short_name # are defined elsewhere. It is improbable that only one of them will # be defined and other not, I prefer to stay on the safe side and to # test each one separately. AC_MSG_CHECKING(whether program_invocation_name is defined) AC_TRY_COMPILE([#include ], [ program_invocation_name = "test"; ], [ AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME,1, [Define if program_invocation_name is defined]) AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no)] ) AC_MSG_CHECKING(whether program_invocation_short_name is defined) AC_TRY_COMPILE([#include ], [ program_invocation_short_name = "test"; ], [ AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME,1, [Define if program_invocation_short_name is defined]) AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no)] ) AC_CHECK_DECLS([clearerr_unlocked]) AC_CHECK_DECLS([feof_unlocked]) AC_CHECK_DECLS([ferror_unlocked]) AC_CHECK_DECLS([fflush_unlocked]) AC_CHECK_DECLS([fgets_unlocked]) AC_CHECK_DECLS([fputc_unlocked]) AC_CHECK_DECLS([fputs_unlocked]) AC_CHECK_DECLS([fread_unlocked]) AC_CHECK_DECLS([fwrite_unlocked]) AC_CHECK_DECLS([getc_unlocked]) AC_CHECK_DECLS([getchar_unlocked]) AC_CHECK_DECLS([putc_unlocked]) AC_CHECK_DECLS([putchar_unlocked]) AC_CHECK_FUNCS([flockfile funlockfile]) AC_CHECK_HEADERS([features.h linewrap.h]) ]) blame-1.4-20240206/m4/ssize_t.m40000644000000000000000000000136210527555560014307 0ustar rootroot# ssize_t.m4 serial 4 (gettext-0.15) dnl Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether ssize_t is defined. AC_DEFUN([gt_TYPE_SSIZE_T], [ AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], [AC_TRY_COMPILE([#include ], [int x = sizeof (ssize_t *) + sizeof (ssize_t); return !x;], [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) if test $gt_cv_ssize_t = no; then AC_DEFINE([ssize_t], [int], [Define as a signed type of the same size as size_t.]) fi ]) blame-1.4-20240206/m4/xalloc.m40000644000000000000000000000105510527555560014110 0ustar rootroot# xalloc.m4 serial 16 dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_XALLOC], [ AC_LIBOBJ([xmalloc]) gl_PREREQ_XALLOC gl_PREREQ_XMALLOC ]) # Prerequisites of lib/xalloc.h. AC_DEFUN([gl_PREREQ_XALLOC], [ AC_REQUIRE([gl_INLINE]) : ]) # Prerequisites of lib/xmalloc.c. AC_DEFUN([gl_PREREQ_XMALLOC], [ : ]) blame-1.4-20240206/m4/exitfail.m40000644000000000000000000000060610527555560014434 0ustar rootroot# exitfail.m4 serial 6 dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_EXITFAIL], [ AC_LIBOBJ([exitfail]) dnl No prerequisites of lib/exitfail.c. : ]) blame-1.4-20240206/m4/strdup.m40000644000000000000000000000072114332563676014153 0ustar rootroot# strdup.m4 serial 7 dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRDUP], [ AC_REPLACE_FUNCS(strdup) AC_CHECK_DECLS(strdup) gl_PREREQ_STRDUP ]) # Prerequisites of lib/strdup.c. AC_DEFUN([gl_PREREQ_STRDUP], [:]) blame-1.4-20240206/m4/xsize.m40000644000000000000000000000064510203114524013752 0ustar rootroot# xsize.m4 serial 3 dnl Copyright (C) 2003-2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_XSIZE], [ dnl Prerequisites of lib/xsize.h. AC_REQUIRE([gl_SIZE_MAX]) AC_REQUIRE([AC_C_INLINE]) AC_CHECK_HEADERS(stdint.h) ]) blame-1.4-20240206/m4/strnlen.m40000644000000000000000000000014014557036721014305 0ustar rootrootAC_DEFUN([gl_FUNC_STRNLEN], [ CF_VERBOSE(add replacement for strnlen) AC_LIBOBJ(strnlen) ]) blame-1.4-20240206/m4/pathmax.m40000644000000000000000000000060314332563500014255 0ustar rootroot# pathmax.m4 serial 6 dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_PATHMAX], [ dnl Prerequisites of lib/pathmax.h. AC_CHECK_HEADERS(sys/param.h) ]) blame-1.4-20240206/m4/size_max.m40000644000000000000000000000461010527555560014445 0ustar rootroot# size_max.m4 serial 5 dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN([gl_SIZE_MAX], [ AC_CHECK_HEADERS(stdint.h) dnl First test whether the system already has SIZE_MAX. AC_MSG_CHECKING([for SIZE_MAX]) AC_CACHE_VAL([gl_cv_size_max], [ gl_cv_size_max= AC_EGREP_CPP([Found it], [ #include #if HAVE_STDINT_H #include #endif #ifdef SIZE_MAX Found it #endif ], gl_cv_size_max=yes) if test -z "$gl_cv_size_max"; then dnl Define it ourselves. Here we assume that the type 'size_t' is not wider dnl than the type 'unsigned long'. Try hard to find a definition that can dnl be used in a preprocessor #if, i.e. doesn't contain a cast. _AC_COMPUTE_INT([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1, [#include #include ], size_t_bits_minus_1=) _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, [#include ], fits_in_uint=) if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then if test $fits_in_uint = 1; then dnl Even though SIZE_MAX fits in an unsigned int, it must be of type dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. AC_TRY_COMPILE([#include extern size_t foo; extern unsigned long foo; ], [], fits_in_uint=0) fi dnl We cannot use 'expr' to simplify this expression, because 'expr' dnl works only with 'long' integers in the host environment, while we dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. if test $fits_in_uint = 1; then gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" else gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" fi else dnl Shouldn't happen, but who knows... gl_cv_size_max='((size_t)~(size_t)0)' fi fi ]) AC_MSG_RESULT([$gl_cv_size_max]) if test "$gl_cv_size_max" != yes; then AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], [Define as the maximum value of type 'size_t', if the system doesn't define it.]) fi ]) blame-1.4-20240206/m4/mempcpy.m40000644000000000000000000000014014557036755014301 0ustar rootrootAC_DEFUN([gl_FUNC_MEMPCPY], [ CF_VERBOSE(add replacement for mempcpy) AC_LIBOBJ(mempcpy) ]) blame-1.4-20240206/m4/wint_t.m40000644000000000000000000000130410203114524014105 0ustar rootroot# wint_t.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether has the 'wint_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WINT_T], [ AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, [AC_TRY_COMPILE([#include wint_t foo = (wchar_t)'\0';], , gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) if test $gt_cv_c_wint_t = yes; then AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) fi ]) blame-1.4-20240206/m4/canonicalize.m40000644000000000000000000000117314332563676015273 0ustar rootroot#serial 11 # 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. # Written by Jim Meyering. AC_DEFUN([AC_FUNC_CANONICALIZE_FILE_NAME], [ AC_LIBOBJ([canonicalize]) AC_CHECK_HEADERS([sys/param.h]) AC_CHECK_DECLS([canonicalize_file_name]) AC_CHECK_FUNCS([canonicalize_file_name resolvepath]) AC_DEFINE([PROVIDE_CANONICALIZE_FILENAME_MODE], 1, [Define to 1 to provide canonicalize_filename_mode.]) ]) blame-1.4-20240206/m4/mbiter.m40000644000000000000000000000105310337302572014076 0ustar rootroot# mbiter.m4 serial 2 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl autoconf tests required for use of mbiter.h dnl From Bruno Haible. AC_DEFUN([gl_MBITER], [ AC_REQUIRE([AC_TYPE_MBSTATE_T]) dnl The following line is that so the user can test HAVE_MBRTOWC before dnl #include "mbiter.h" or "mbuiter.h". AC_REQUIRE([gl_FUNC_MBRTOWC]) : ]) blame-1.4-20240206/m4/mbstate_t.m40000644000000000000000000000177610203114520014574 0ustar rootroot# mbstate_t.m4 serial 9 dnl Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # From Paul Eggert. # BeOS 5 has but does not define mbstate_t, # so you can't declare an object of that type. # Check for this incompatibility with Standard C. # AC_TYPE_MBSTATE_T # ----------------- AC_DEFUN([AC_TYPE_MBSTATE_T], [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t, [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT # include ], [mbstate_t x; return sizeof x;])], [ac_cv_type_mbstate_t=yes], [ac_cv_type_mbstate_t=no])]) if test $ac_cv_type_mbstate_t = yes; then AC_DEFINE([HAVE_MBSTATE_T], 1, [Define to 1 if declares mbstate_t.]) else AC_DEFINE([mbstate_t], int, [Define to a type if does not define.]) fi]) blame-1.4-20240206/m4/wcwidth.m40000644000000000000000000000164114332563574014302 0ustar rootroot# wcwidth.m4 serial 6 dnl Copyright (C) 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_WCWIDTH], [ dnl Persuade glibc to declare wcwidth(). AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_CHECK_HEADERS([wchar.h wctype.h]) AC_CHECK_FUNCS([iswprint wcwidth]) AC_CHECK_DECLS([wcwidth], [], [], [ /* AIX 3.2.5 declares wcwidth in . */ #include #if HAVE_WCHAR_H /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.1 has a bug: and must be included before . */ # include # include # include #endif ])]) blame-1.4-20240206/m4/allocsa.m40000644000000000000000000000112010527555560014235 0ustar rootroot# allocsa.m4 serial 6 dnl Copyright (C) 2003-2004, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_ALLOCSA], [ dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables dnl @ALLOCA@ and @LTALLOCA@. dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. AC_REQUIRE([gl_EEMALLOC]) AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) ]) blame-1.4-20240206/m4/strchrnul.m40000644000000000000000000000014614557036737014661 0ustar rootrootAC_DEFUN([gl_FUNC_STRCHRNUL], [ CF_VERBOSE(add replacement for strchrnul) AC_LIBOBJ(strchrnul) ]) blame-1.4-20240206/m4/getcwd-path-max.m40000644000000000000000000001156114332563637015625 0ustar rootroot#serial 12 # Check for several getcwd bugs with long file names. # If so, arrange to compile the wrapper function. # This is necessary for at least GNU libc on linux-2.4.19 and 2.4.20. # I've heard that this is due to a Linux kernel bug, and that it has # been fixed between 2.4.21-pre3 and 2.4.21-pre4. */ # 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. # From Jim Meyering AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX], [ AC_CHECK_DECLS(getcwd) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CACHE_CHECK([whether getcwd handles long file names properly], gl_cv_func_getcwd_path_max, [# Arrange for deletion of the temporary directory this test creates. ac_clean_files="$ac_clean_files confdir3" AC_RUN_IFELSE( [AC_LANG_SOURCE( [[ #include #include #include #include #include #include #include #include #ifndef AT_FDCWD # define AT_FDCWD 0 #endif #ifdef ENAMETOOLONG # define is_ENAMETOOLONG(x) ((x) == ENAMETOOLONG) #else # define is_ENAMETOOLONG(x) 0 #endif /* Don't get link errors because mkdir is redefined to rpl_mkdir. */ #undef mkdir #ifndef S_IRWXU # define S_IRWXU 0700 #endif /* The length of this name must be 8. */ #define DIR_NAME "confdir3" #define DIR_NAME_LEN 8 #define DIR_NAME_SIZE (DIR_NAME_LEN + 1) /* The length of "../". */ #define DOTDOTSLASH_LEN 3 /* Leftover bytes in the buffer, to work around library or OS bugs. */ #define BUF_SLOP 20 int main () { #ifndef PATH_MAX /* The Hurd doesn't define this, so getcwd can't exhibit the bug -- at least not on a local file system. And if we were to start worrying about remote file systems, we'd have to enable the wrapper function all of the time, just to be safe. That's not worth the cost. */ exit (0); #elif ((INT_MAX / (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) \ - DIR_NAME_SIZE - BUF_SLOP) \ <= PATH_MAX) /* FIXME: Assuming there's a system for which this is true, this should be done in a compile test. */ exit (0); #else char buf[PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) + DIR_NAME_SIZE + BUF_SLOP]; char *cwd = getcwd (buf, PATH_MAX); size_t initial_cwd_len; size_t cwd_len; int fail = 0; size_t n_chdirs = 0; if (cwd == NULL) exit (1); cwd_len = initial_cwd_len = strlen (cwd); while (1) { size_t dotdot_max = PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN); char *c = NULL; cwd_len += DIR_NAME_SIZE; /* If mkdir or chdir fails, it could be that this system cannot create any file with an absolute name longer than PATH_MAX, such as cygwin. If so, leave fail as 0, because the current working directory can't be too long for getcwd if it can't even be created. For other errors, be pessimistic and consider that as a failure, too. */ if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0) { if (! (errno == ERANGE || is_ENAMETOOLONG (errno))) fail = 2; break; } if (PATH_MAX <= cwd_len && cwd_len < PATH_MAX + DIR_NAME_SIZE) { c = getcwd (buf, PATH_MAX); if (!c && errno == ENOENT) { fail = 1; break; } if (c || ! (errno == ERANGE || is_ENAMETOOLONG (errno))) { fail = 2; break; } } if (dotdot_max <= cwd_len - initial_cwd_len) { if (dotdot_max + DIR_NAME_SIZE < cwd_len - initial_cwd_len) break; c = getcwd (buf, cwd_len + 1); if (!c) { if (! (errno == ERANGE || errno == ENOENT || is_ENAMETOOLONG (errno))) { fail = 2; break; } if (AT_FDCWD || errno == ERANGE || errno == ENOENT) { fail = 1; break; } } } if (c && strlen (c) != cwd_len) { fail = 2; break; } ++n_chdirs; } /* Leaving behind such a deep directory is not polite. So clean up here, right away, even though the driving shell script would also clean up. */ { size_t i; /* Try rmdir first, in case the chdir failed. */ rmdir (DIR_NAME); for (i = 0; i <= n_chdirs; i++) { if (chdir ("..") < 0) break; rmdir (DIR_NAME); } } exit (fail); #endif } ]])], [gl_cv_func_getcwd_path_max=yes], [case $? in 1) gl_cv_func_getcwd_path_max='no, but it is partly working';; *) gl_cv_func_getcwd_path_max=no;; esac], [gl_cv_func_getcwd_path_max=no]) ]) case $gl_cv_func_getcwd_path_max in no,*) AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], 1, [Define to 1 if getcwd works, except it sometimes fails when it shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT. If __GETCWD_PREFIX is not defined, it doesn't matter whether HAVE_PARTLY_WORKING_GETCWD is defined.]);; esac ]) blame-1.4-20240206/m4/strftime.m40000644000000000000000000000163214332563574014466 0ustar rootroot#serial 28 # Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 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. # Written by Jim Meyering and Paul Eggert. AC_DEFUN([gl_FUNC_GNU_STRFTIME], [AC_REQUIRE([gl_FUNC_STRFTIME])dnl ]) # These are the prerequisite macros for GNU's strftime.c replacement. AC_DEFUN([gl_FUNC_STRFTIME], [ AC_LIBOBJ([strftime]) # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE. AC_REQUIRE([AC_STRUCT_TIMEZONE]) AC_REQUIRE([AC_HEADER_TIME]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_REQUIRE([gl_TM_GMTOFF]) AC_CHECK_FUNCS(mblen mbrlen mempcpy tzset) AC_CHECK_HEADERS(sys/time.h wchar.h) AC_DEFINE([my_strftime], [nstrftime], [Define to the name of the strftime replacement function.]) ]) blame-1.4-20240206/m4/strpbrk.m40000644000000000000000000000073310203114523014274 0ustar rootroot# strpbrk.m4 serial 2 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRPBRK], [ AC_REPLACE_FUNCS(strpbrk) if test $ac_cv_func_strpbrk = no; then gl_PREREQ_STRPBRK fi ]) # Prerequisites of lib/strpbrk.c. AC_DEFUN([gl_PREREQ_STRPBRK], [:]) blame-1.4-20240206/m4/longlong.m40000644000000000000000000000464010527555560014450 0ustar rootroot# longlong.m4 serial 10 dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_LONG_LONG_INT if 'long long int' works. # This fixes a bug in Autoconf 2.60, but can be removed once we # assume 2.61 everywhere. # Note: If the type 'long long int' exists but is only 32 bits large # (as on some very old compilers), HAVE_LONG_LONG_INT will not be # defined. In this case you can treat 'long long int' like 'long int'. AC_DEFUN([AC_TYPE_LONG_LONG_INT], [ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) ? 1 : -1)]; int i = 63;]], [[long long int llmax = 9223372036854775807ll; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) | (llmax / ll) | (llmax % ll));]])], [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. dnl If cross compiling, assume the bug isn't important, since dnl nobody cross compiles for this platform as far as we know. AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[@%:@include @%:@ifndef LLONG_MAX @%:@ define HALF \ (1LL << (sizeof (long long int) * CHAR_BIT - 2)) @%:@ define LLONG_MAX (HALF - 1 + HALF) @%:@endif]], [[long long int n = 1; int i; for (i = 0; ; i++) { long long int m = n << i; if (m >> i != n) return 1; if (LLONG_MAX / 2 < m) break; } return 0;]])], [ac_cv_type_long_long_int=yes], [ac_cv_type_long_long_int=no], [ac_cv_type_long_long_int=yes])], [ac_cv_type_long_long_int=no])]) if test $ac_cv_type_long_long_int = yes; then AC_DEFINE([HAVE_LONG_LONG_INT], 1, [Define to 1 if the system has the type `long long int'.]) fi ]) # This macro is obsolescent and should go away soon. AC_DEFUN([gl_AC_TYPE_LONG_LONG], [ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ac_cv_type_long_long=$ac_cv_type_long_long_int if test $ac_cv_type_long_long = yes; then AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have the 'long long' type.]) fi ]) blame-1.4-20240206/m4/cycle-check.m40000644000000000000000000000050410527555557015004 0ustar rootroot#serial 4 dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_CYCLE_CHECK], [ AC_LIBOBJ([cycle-check]) ]) blame-1.4-20240206/m4/getline.m40000644000000000000000000000434714557040132014253 0ustar rootroot# getline.m4 serial 15 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Free Software dnl Foundation, Inc. dnl dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl See if there's a working, system-supplied version of the getline function. dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems dnl have a function by that name in -linet that doesn't have anything dnl to do with the function we need. AC_DEFUN([gl_FUNC_GETLINE], [ AC_CHECK_DECLS([getline]) gl_getline_needs_run_time_check=no AC_CHECK_FUNC(getline, dnl Found it in some library. Verify that it works. gl_getline_needs_run_time_check=yes, am_cv_func_working_getline=no) if test $gl_getline_needs_run_time_check = yes; then AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline, [echo fooN |tr -d '\012'|tr N '\012' > conftest.data AC_TRY_RUN([ # include # include # include int main () { /* Based on a test program from Karl Heuer. */ char *line = NULL; size_t siz = 0; int len; FILE *in = fopen ("./conftest.data", "r"); if (!in) return 1; len = getline (&line, &siz, in); exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1); } ], am_cv_func_working_getline=yes dnl The library version works. , am_cv_func_working_getline=no dnl The library version does NOT work. , dnl We're cross compiling. Assume it works on glibc2 systems. [AC_EGREP_CPP([Lucky GNU user], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ >= 2) Lucky GNU user #endif #endif ], [am_cv_func_working_getline=yes], [am_cv_func_working_getline=no])] )]) fi if test $am_cv_func_working_getline = no; then dnl We must choose a different name for our function, since on ELF systems dnl a broken getline() in libc.so would override our getline() in dnl libgettextlib.so. AC_DEFINE([getline], [gnu_getline], [Define to a replacement function name for getline().]) AC_LIBOBJ(getline) gl_FUNC_GETDELIM fi ]) blame-1.4-20240206/m4/wchar_t.m40000644000000000000000000000132610203114524014234 0ustar rootroot# wchar_t.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether has the 'wchar_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WCHAR_T], [ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, [AC_TRY_COMPILE([#include wchar_t foo = (wchar_t)'\0';], , gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) if test $gt_cv_c_wchar_t = yes; then AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) fi ]) blame-1.4-20240206/m4/strstr.m40000644000000000000000000000111410337302611014145 0ustar rootroot# strstr.m4 serial 5 dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRSTR], [ dnl No known system has a strstr() function that works correctly in dnl multibyte locales. Therefore we use our version always. AC_LIBOBJ(strstr) gl_PREREQ_STRSTR ]) # Prerequisites of lib/strstr.c. AC_DEFUN([gl_PREREQ_STRSTR], [ AC_REQUIRE([gl_FUNC_MBRTOWC]) : ]) blame-1.4-20240206/m4/memset.m40000644000000000000000000000072310203114520014073 0ustar rootroot# memset.m4 serial 2 dnl Copyright (C) 2002 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MEMSET], [ AC_REPLACE_FUNCS(memset) if test $ac_cv_func_memset = no; then gl_PREREQ_MEMSET fi ]) # Prerequisites of lib/memset.c. AC_DEFUN([gl_PREREQ_MEMSET], [ : ]) blame-1.4-20240206/m4/time_r.m40000644000000000000000000000217514556134740014110 0ustar rootrootdnl Reentrant time functions like localtime_r. dnl Copyright (C) 2003, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Paul Eggert. AC_DEFUN([gl_TIME_R], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) dnl AC_REQUIRE([AC_C_RESTRICT]) AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature], [gl_cv_time_r_posix], [AC_TRY_COMPILE( [#include ], [/* We don't need to append 'restrict's to the argument types, even though the POSIX signature has the 'restrict's, since C99 says they can't affect type compatibility. */ struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r; if (ptr) return 0;], [gl_cv_time_r_posix=yes], [gl_cv_time_r_posix=no])]) if test $gl_cv_time_r_posix = yes; then AC_DEFINE([HAVE_TIME_R_POSIX], 1, [Define to 1 if localtime_r, etc. have the type signatures that POSIX requires.]) else AC_LIBOBJ([time_r]) fi ]) blame-1.4-20240206/m4/filenamecat.m40000644000000000000000000000015614557040132015066 0ustar rootrootAC_DEFUN([gl_FILE_NAME_CONCAT], [ CF_VERBOSE(add replacement for filenamecat) AC_LIBOBJ([filenamecat]) ]) blame-1.4-20240206/m4/calloc.m40000644000000000000000000000322210527555560014061 0ustar rootroot# calloc.m4 serial 6 # Copyright (C) 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. # Written by Jim Meyering. # Determine whether calloc (N, S) returns non-NULL when N*S is zero, # and returns NULL when N*S overflows. # If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc # and arrange to use a calloc wrapper function that does work in that case. # _AC_FUNC_CALLOC_IF(IF-WORKS, IF-NOT) # ------------------------------------- # If `calloc (0, 0)' is properly handled, run IF-WORKS, otherwise, IF-NOT. AC_DEFUN([_AC_FUNC_CALLOC_IF], [AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_CACHE_CHECK([for GNU libc compatible calloc], ac_cv_func_calloc_0_nonnull, [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [exit (!calloc (0, 0) || calloc ((size_t) -1 / 8 + 1, 8));])], [ac_cv_func_calloc_0_nonnull=yes], [ac_cv_func_calloc_0_nonnull=no], [ac_cv_func_calloc_0_nonnull=no])]) AS_IF([test $ac_cv_func_calloc_0_nonnull = yes], [$1], [$2]) ])# AC_FUNC_CALLOC # AC_FUNC_CALLOC # --------------- # Report whether `calloc (0, 0)' is properly handled, and replace calloc if # needed. AC_DEFUN([AC_FUNC_CALLOC], [_AC_FUNC_CALLOC_IF( [AC_DEFINE([HAVE_CALLOC], 1, [Define to 1 if your system has a GNU libc compatible `calloc' function, and to 0 otherwise.])], [AC_DEFINE([HAVE_CALLOC], 0) AC_LIBOBJ([calloc]) AC_DEFINE([calloc], [rpl_calloc], [Define to rpl_calloc if the replacement function should be used.])]) ])# AC_FUNC_CALLOC blame-1.4-20240206/m4/dos.m40000644000000000000000000000454610527555560013423 0ustar rootroot#serial 10 -*- autoconf -*- # Define some macros required for proper operation of code in lib/*.c # on MSDOS/Windows systems. # Copyright (C) 2000, 2001, 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. # From Jim Meyering. AC_DEFUN([gl_AC_DOS], [ AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos], [ AC_TRY_COMPILE([], [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ neither MSDOS nor Windows #endif], [ac_cv_win_or_dos=yes], [ac_cv_win_or_dos=no]) ]) if test x"$ac_cv_win_or_dos" = xyes; then ac_fs_accepts_drive_letter_prefix=1 ac_fs_backslash_is_file_name_separator=1 AC_CACHE_CHECK([whether drive letter can start relative path], [ac_cv_drive_letter_can_be_relative], [ AC_TRY_COMPILE([], [#if defined __CYGWIN__ drive letters are always absolute #endif], [ac_cv_drive_letter_can_be_relative=yes], [ac_cv_drive_letter_can_be_relative=no]) ]) if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then ac_fs_drive_letter_can_be_relative=1 else ac_fs_drive_letter_can_be_relative=0 fi else ac_fs_accepts_drive_letter_prefix=0 ac_fs_backslash_is_file_name_separator=0 ac_fs_drive_letter_can_be_relative=0 fi AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX], $ac_fs_accepts_drive_letter_prefix, [Define on systems for which file names may have a so-called `drive letter' prefix, define this to compute the length of that prefix, including the colon.]) AH_VERBATIM(ISSLASH, [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR # define ISSLASH(C) ((C) == '/' || (C) == '\\') #else # define ISSLASH(C) ((C) == '/') #endif]) AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR], $ac_fs_backslash_is_file_name_separator, [Define if the backslash character may also serve as a file name component separator.]) AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE], $ac_fs_drive_letter_can_be_relative, [Define if a drive letter prefix denotes a relative path if it is not followed by a file name component separator.]) ]) blame-1.4-20240206/m4/double-slash-root.m40000644000000000000000000000266510527555557016207 0ustar rootroot#serial 1 -*- autoconf -*- dnl Copyright (C) 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_DOUBLE_SLASH_ROOT], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether // is distinct from /], [ac_cv_double_slash_root], [ if test x"$cross_compiling" = xyes ; then # When cross-compiling, there is no way to tell whether // is special # short of a list of hosts. However, the only known hosts to date # that have a distinct // are Apollo DomainOS (too old to port to) # and Cygwin. If anyone knows of another system for which // has # special semantics and is distinct from /, please report it to # . case $host in *-cygwin) ac_cv_double_slash_root=yes ;; *) # Be optimistic and assume that / and // are the same when we # don't know. ac_cv_double_slash_root='unknown, assuming no' ;; esac else set x `ls -di / //` if test $[2] = $[4]; then ac_cv_double_slash_root=no else ac_cv_double_slash_root=yes fi fi]) if test x"$ac_cv_double_slash_root" = xyes; then ac_double_slash_root=1 else ac_double_slash_root=0 fi AC_DEFINE_UNQUOTED([DOUBLE_SLASH_IS_DISTINCT_ROOT], $ac_double_slash_root, [Define to 1 if // is a file system root distinct from /.]) ]) blame-1.4-20240206/missing0000755000000000000000000002466610125542443013446 0ustar rootroot#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2003-09-02.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi 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 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi 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) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi 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) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi 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*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi 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) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi 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 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 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 [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $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 [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi 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 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $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." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && 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-end: "$" # End: blame-1.4-20240206/package/0000755000000000000000000000000014560122473013430 5ustar rootrootblame-1.4-20240206/package/debian/0000755000000000000000000000000014560122473014652 5ustar rootrootblame-1.4-20240206/package/debian/copyright0000644000000000000000000000076111716244277016620 0ustar rootrootThis package was debianized by Andrew Pollock on Thu, 15 Oct 2009 23:25:35 -0700. It was downloaded from Upstream Author: Michael Chapman Copyright: Copyright (C) 2004 Michael Chapman License: GPL-2 The Debian packaging is (C) 2009, Andrew Pollock and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. date.c: Copyright 1993, 1994, 1995 Paul Eggert blame-1.4-20240206/package/debian/rules.old0000755000000000000000000000453011716244370016512 0ustar rootroot#!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) else CROSS= --build $(DEB_BUILD_GNU_TYPE) endif config.status: configure dh_testdir # Add here commands to configure the package. ifneq "$(wildcard /usr/share/misc/config.sub)" "" cp -f /usr/share/misc/config.sub config.sub endif ifneq "$(wildcard /usr/share/misc/config.guess)" "" cp -f /usr/share/misc/config.guess config.guess endif ./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: config.status dh_testdir # Add here commands to compile the package. $(MAKE) touch $@ clean: dh_testdir dh_testroot rm -f build-stamp # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) distclean rm -f config.sub config.guess dh_clean install: build dh_testdir dh_testroot dh_prep dh_installdirs # Add here commands to install the package into debian/rcs-blame. $(MAKE) DESTDIR=$(CURDIR)/debian/rcs-blame install # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs ChangeLog dh_installdocs dh_installexamples dh_installman dh_lintian dh_link dh_strip dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install blame-1.4-20240206/package/debian/docs0000644000000000000000000000001411716244277015527 0ustar rootrootNEWS README blame-1.4-20240206/package/debian/compat0000644000000000000000000000000314175306075016055 0ustar rootroot10 blame-1.4-20240206/package/debian/lintian-overrides0000644000000000000000000000010611716244277020237 0ustar rootrootrcs-blame: manpage-has-bad-whatis-entry usr/share/man/man1/blame.1.gz blame-1.4-20240206/package/debian/rules0000755000000000000000000000046514175306624015743 0ustar rootroot#!/usr/bin/make -f export DEB_CFLAGS_MAINT_APPEND = -fcommon # +format causes a build failure, emailed upstream export DEB_BUILD_MAINT_OPTIONS=hardening=-format %: dh $@ # dh_autoreconf interferes with portability -- skip it override_dh_autoreconf: echo "skip: dh_autoreconf autoreconf-dickey -- -f -i" blame-1.4-20240206/package/debian/control0000644000000000000000000000114314175101136016247 0ustar rootrootSource: rcs-blame Section: devel Priority: optional Maintainer: Thomas E. Dickey Build-Depends: debhelper (>= 9), autotools-dev, flex, bison Standards-Version: 3.9.5 Homepage: https://invisible-island.net/rcs-blame/rcs-blame.html Package: rcs-blame Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Enhances: rcs Description: display the last modification for each line in an RCS file Blame is the equivalent for CVS's annotate command. . An annotated RCS file describes the revision and date in which each line was added to the file, and the author of each line. blame-1.4-20240206/package/debian/source/0000755000000000000000000000000014010017700016134 5ustar rootrootblame-1.4-20240206/package/debian/source/format0000644000000000000000000000001514010017700017343 0ustar rootroot3.0 (native) blame-1.4-20240206/package/debian/watch0000644000000000000000000000034614175104104015677 0ustar rootrootversion=4 # Patch-dates are always in yyyymmdd format. opts=pgpmode=auto,\ dversionmangle=s/-/./,\ oversionmangle=s/^(\d+\.\d+\.\d+).(\d+)/$1-$2/ \ https://invisible-mirror.net/archives/rcs-blame/blame-(\d+\.\d+\.\d+-\d+)\.tgz blame-1.4-20240206/package/debian/changelog0000644000000000000000000000472714560122473016536 0ustar rootrootrcs-blame (1.4+20240206) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Mon, 05 Feb 2024 04:07:07 -0500 rcs-blame (1.3.1+20240204) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Fri, 02 Feb 2024 03:56:29 -0500 rcs-blame (1.3.1+20240201) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Mon, 29 Jan 2024 20:22:20 -0500 rcs-blame (1.3.1+20221113) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Tue, 08 Nov 2022 17:22:54 -0500 rcs-blame (1.3.1+20221108) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Tue, 08 Nov 2022 04:06:51 -0500 rcs-blame (1.3.1.20220129) unstable; urgency=medium * eliminate automake as a dependency, to improve portability -- Thomas E. Dickey Sat, 29 Jan 2022 09:44:17 -0500 rcs-blame (1.3.1.20210207) unstable; urgency=medium * change source-format to "native" -- Thomas E. Dickey Sun, 07 Feb 2021 12:15:23 -0500 rcs-blame (1.3.1-4.2) unstable; urgency=medium * Non-maintainer upload. * Fix ftbfs with GCC-10. (Closes: #957752) -- Sudip Mukherjee Thu, 21 Jan 2021 19:39:22 +0000 rcs-blame (1.3.1-4.1) unstable; urgency=medium * Non-maintainer upload * Fix FTBFS from gcc-5 on. Closes: #778101, #868970 -- Christoph Biedl Sat, 27 Oct 2018 13:43:11 +0200 rcs-blame (1.3.1-4) unstable; urgency=low * debian/rules: Use --with autotools-dev to update config.sub/guess and fix build on arm64 (closes: #750615) -- Andrew Pollock Fri, 06 Jun 2014 15:02:00 +1000 rcs-blame (1.3.1-3) unstable; urgency=low * debian/control: bump Standards-Version (no changes) * debian/rules: convert to using dh * debian/compat: bump to 9 to get hardening support -- Andrew Pollock Mon, 12 May 2014 11:12:55 +1000 rcs-blame (1.3.1-2) unstable; urgency=low * debian/rules: add build-{arch,indep} targets * debian/control: Bump Standards-Version (no changes) * Convert to 3.0 (quilt) source format -- Andrew Pollock Mon, 13 Feb 2012 09:36:18 -0800 rcs-blame (1.3.1-1) unstable; urgency=low * Initial release (Closes: #551210) -- Andrew Pollock Thu, 15 Oct 2009 23:25:35 -0700 blame-1.4-20240206/package/blame.spec0000644000000000000000000000226214560122473015366 0ustar rootroot%define AppProgram blame %define AppVersion 1.4 %define AppRelease 20240206 Name: %{AppProgram} Version: %{AppVersion} Release: %{AppRelease} Summary: annotate RCS files License: GPLv2 Group: Applications/Development URL: https://invisible-island.net/%{AppProgram} Source0: https://invisible-island.net/archives/%{AppProgram}/%{AppProgram}-%{AppVersion}-%{AppRelease}.tgz %description blame outputs an annotated revision from each RCS file. An annotated RCS file describes the revision and date in which each line was added to the file, and the author of each line. %prep %define debug_package %{nil} %setup -q -n %{AppProgram}-%{AppVersion}-%{AppRelease} %build %configure \ --prefix=%{_prefix} \ --exec-prefix=%{_exec_prefix} \ --mandir=%{_mandir} make CFLAGS="-fcommon -fPIC" %check make check %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT make install DESTDIR="$RPM_BUILD_ROOT" # prefix=#{buildroot}#{_prefix} mandir=#{buildroot}#{_mandir} %files %license COPYING %doc AUTHORS ChangeLog NEWS README %{_bindir}/%{name} %{_mandir}/man1/%{name}.1* %changelog # each patch should add its ChangeLog entries here * Sun Feb 07 2021 Thomas Dickey - initial version blame-1.4-20240206/VERSION0000644000000000000000000000001514560122473013101 0ustar rootroot1.4 20240206 blame-1.4-20240206/configure.ac0000644000000000000000000001054514560124235014326 0ustar rootroot# Process this file with autoconf to produce a configure script. # $Id: configure.ac,v 1.28 2024/02/05 09:21:33 tom Exp $ AC_INIT([blame], [1.4], [dickey@invisible-island.net]) AC_CONFIG_SRCDIR([src/blame.c]) AC_CONFIG_HEADER([config.h]) CHECK_VERSION=`sed -e 's/[[ ]].*//' $srcdir/VERSION` test "[$]CHECK_VERSION" = "[$]PACKAGE_VERSION" || AC_MSG_ERROR(inconsistent VERSION) PACKAGE_DATE=`sed -e 's/^[[^ ]]*[[ ]]*//' $srcdir/VERSION` AC_SUBST(PACKAGE_DATE) AC_SUBST(PACKAGE_STRING) AC_SUBST(PACKAGE_BUGREPORT) echo "configuring $PACKAGE_NAME ($PACKAGE_VERSION $PACKAGE_DATE)" AC_AIX AC_MINIX CF_WITHOUT_X # Checks for programs. CF_PROG_CC AC_PROG_LEX AC_PROG_YACC AC_PROG_RANLIB AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_AWK CF_AR_FLAGS CF_CYGPATH_W # Checks for libraries. # Checks for header files. gl_USE_SYSTEM_EXTENSIONS CF_XOPEN_SOURCE AC_HEADER_STDC AC_CHECK_HEADERS([libintl.h]) AC_HEADER_STDBOOL # Define two additional variables used in the Makefile substitution. if test "$ac_cv_header_stdbool_h" = yes; then STDBOOL_H='' else STDBOOL_H='stdbool.h' fi if test "$ac_cv_type__Bool" = yes; then HAVE__BOOL=1 else HAVE__BOOL=0 fi AC_SUBST(STDBOOL_H) AC_SUBST(HAVE__BOOL) CF_DISABLE_ECHO CF_ENABLE_WARNINGS(Wno-undef) # Checks for typedefs, structures, and compiler characteristics. dnl CF_LARGEFILE CF_SIZEOF_TIME_T AC_C_CONST AC_C_INLINE AC_C_PROTOTYPES gl_INLINE AC_C_STRINGIZE AC_C_VOLATILE AC_TYPE_SIZE_T AC_TYPE_OFF_T AC_FUNC_MKTIME dnl FIXME: gl_INIT gl_FUNC_ALLOCA gl_GETOPT gl_ARGP gl_CHECK_TYPE_STRUCT_DIRENT_D_INO gl_TIME_R gl_TM_GMTOFF gl_SYSEXITS gt_TYPE_WCHAR_T gl_AC_TYPE_LONG_LONG gt_TYPE_LONGDOUBLE gl_CYCLE_CHECK gl_FUNC_GETDELIM gl_FUNC_GETLINE gl_FILE_NAME_CONCAT gl_FUNC_STRCHRNUL gl_FUNC_MEMPCPY gl_FUNC_STRNLEN gl_XALLOC gl_XGETCWD gl_XREADLINK AC_FUNC_CANONICALIZE_FILE_NAME AC_MSG_CHECKING(for error module) AC_TRY_LINK([ $ac_includes_default #include ],[ error (0, 1, "testing: %d", 2);], cf_have_func_error=yes, cf_have_func_error=no) AC_MSG_RESULT($cf_have_func_error) if test "$cf_have_func_error" = no; then AC_LIBOBJ(error) fi AC_MSG_CHECKING(for obstack module) AC_TRY_LINK([ $ac_includes_default #include ],[ struct obstack *data = 0; __obstack_free(data, 0); (void) data;], cf_have_func_obstack=yes, cf_have_func_obstack=no) AC_MSG_RESULT($cf_have_func_obstack) if test "$cf_have_func_obstack" = no; then AC_LIBOBJ(obstack) fi AH_BOTTOM([ /* Avoid memory leak in argp */ #define GNULIB_ARGP_DISABLE_DIRNAME 1 ]) # Checks for library functions. mac_HAVE_NL_LANGINFO AC_FUNC_MMAP AC_SYS_LONG_FILE_NAMES dnl This relies on certain dos.m4 behaviour... AC_SUBST(FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR, [$ac_fs_backslash_is_file_name_separator]) AH_BOTTOM([ #if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR # define SUFFIXES "\\,v" # define DIRECTORY_SEPARATOR '\\' # define SSLASH "\\" #else /* ! FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR */ # define SUFFIXES ",v/" # define DIRECTORY_SEPARATOR '/' # define SSLASH "/" #endif /* ! FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR */ ]) AC_ARG_ENABLE(debug, AC_HELP_STRING(--enable-debug, [include debug code (e.g. assertions)])) case "$enable_debug" in no|"") AC_DEFINE(NDEBUG, 1, [Define to 1 to disable assertions]) ;; *) ;; esac AC_ARG_ENABLE(debug, AC_HELP_STRING(--enable-profile, [enable profiling])) case "$enable_profile" in no|"") ;; *) if test "$GCC" != "yes"; then AC_MSG_ERROR([I can only use profiling on GCC]) fi CFLAGS=`echo $CFLAGS -pg -fprofile-arcs -ftest-coverage | sed -e s,-O2,-O0,` LDFLAGS="$LDFLAGS -pg -fprofile-arcs -ftest-coverage" ;; esac AC_ARG_ENABLE(fastexit, AC_HELP_STRING(--disable-fastexit, [free all memory when exiting])) case "$enable_fastexit" in yes|"") AC_DEFINE(FASTEXIT, 1, [Define to 1 to exit quickly without freeing all memory]) FASTEXIT=1 ;; *) FASTEXIT=0 ;; esac AC_SUBST([FASTEXIT]) CFLAGS=`echo $CFLAGS | sed -e s,-O2,-O3,` NEWS=NEWS AC_SUBST_FILE(NEWS) AC_CONFIG_FILES([ Makefile doc/Makefile lib/Makefile src/Makefile tests/Makefile tests/atlocal ]) echo "creating tests/atconfig" cat >tests/atconfig < #include "strndup.h" #include #include #include "strnlen.h" char * strndup (char const *s, size_t n) { size_t len = strnlen (s, n); char *new = malloc (len + 1); if (new == NULL) return NULL; new[len] = '\0'; return memcpy (new, s, len); } blame-1.4-20240206/lib/memset.c0000644000000000000000000000170510241344117014235 0ustar rootroot/* memset.c -- set an area of memory to a given value Copyright (C) 1991, 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. */ #include void * memset (void *str, int c, size_t len) { register char *st = str; while (len-- > 0) *st++ = c; return str; } blame-1.4-20240206/lib/allocsa.valgrind0000644000000000000000000000026210142427523015745 0ustar rootroot# Suppress a valgrind message about use of uninitialized memory in freesa(). # This use is OK because it provides only a speedup. { freesa Memcheck:Cond fun:freesa } blame-1.4-20240206/lib/xgetcwd.h0000644000000000000000000000147010241344124014412 0ustar rootroot/* prototype for xgetcwd Copyright (C) 1995, 2001, 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. */ extern char *xgetcwd (void); blame-1.4-20240206/lib/strchrnul.c0000644000000000000000000000200014557307522014771 0ustar rootroot/* Searching in a string. Copyright (C) 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. */ /* Specification. */ #include "strchrnul.h" /* Find the first occurrence of C in S or the final NUL byte. */ char * strchrnul (const char *s, int c_in) { char c = (char) c_in; while (*s && (*s != c)) s++; return (char *) s; } blame-1.4-20240206/lib/canonicalize.c0000644000000000000000000001531414557310015015407 0ustar rootroot/* Return the canonical absolute name of a given file. Copyright (C) 1996-2006 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; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "canonicalize.h" #include #include #if HAVE_SYS_PARAM_H # include #endif #include #include #include #include #include "cycle-check.h" #include "filenamecat.h" #include "xalloc.h" #include "xgetcwd.h" #ifndef ELOOP # define ELOOP 0 #endif #ifndef __set_errno # define __set_errno(Val) errno = (Val) #endif #include "pathmax.h" #include "xreadlink.h" #if !HAVE_CANONICALIZE_FILE_NAME /* Return the canonical absolute name of file NAME. A canonical name does not contain any `.', `..' components nor any repeated file name separators ('/') or symlinks. All components must exist. The result is malloc'd. */ char * canonicalize_file_name (const char *name) { # if HAVE_RESOLVEPATH char *resolved, *extra_buf = NULL; size_t resolved_size; ssize_t resolved_len; if (name == NULL) { __set_errno (EINVAL); return NULL; } if (name[0] == '\0') { __set_errno (ENOENT); return NULL; } /* All known hosts with resolvepath (e.g. Solaris 7) don't turn relative names into absolute ones, so prepend the working directory if the file name is not absolute. */ if (name[0] != '/') { char *wd; if (!(wd = xgetcwd ())) return NULL; extra_buf = file_name_concat (wd, name, NULL); name = extra_buf; free (wd); } resolved_size = strlen (name); while (1) { resolved_size = 2 * resolved_size + 1; resolved = xmalloc (resolved_size); resolved_len = resolvepath (name, resolved, resolved_size); if (resolved_len < 0) { free (resolved); free (extra_buf); return NULL; } if (resolved_len < resolved_size) break; free (resolved); } free (extra_buf); /* NUL-terminate the resulting name. */ resolved[resolved_len] = '\0'; return resolved; # else return canonicalize_filename_mode (name, CAN_EXISTING); # endif /* !HAVE_RESOLVEPATH */ } #endif /* !HAVE_CANONICALIZE_FILE_NAME */ /* Return the canonical absolute name of file NAME. A canonical name does not contain any `.', `..' components nor any repeated file name separators ('/') or symlinks. Whether components must exist or not depends on canonicalize mode. The result is malloc'd. */ char * canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode) { char *rname, *dest, *extra_buf = NULL; char const *start; char const *end; char const *rname_limit; size_t extra_len = 0; struct cycle_check_state cycle_state; if (name == NULL) { __set_errno (EINVAL); return NULL; } if (name[0] == '\0') { __set_errno (ENOENT); return NULL; } if (name[0] != '/') { rname = xgetcwd (); if (!rname) return NULL; dest = strchr (rname, '\0'); if (dest - rname < PATH_MAX) { char *p = xrealloc (rname, PATH_MAX); dest = p + (dest - rname); rname = p; rname_limit = rname + PATH_MAX; } else { rname_limit = dest; } } else { rname = xmalloc (PATH_MAX); rname_limit = rname + PATH_MAX; rname[0] = '/'; dest = rname + 1; } cycle_check_init (&cycle_state); for (start = end = name; *start; start = end) { /* Skip sequence of multiple file name separators. */ while (*start == '/') ++start; /* Find end of component. */ for (end = start; *end && *end != '/'; ++end) /* Nothing. */; if (end - start == 0) break; else if (end - start == 1 && start[0] == '.') /* nothing */; else if (end - start == 2 && start[0] == '.' && start[1] == '.') { /* Back up to previous component, ignore if at root already. */ if (dest > rname + 1) while ((--dest)[-1] != '/'); } else { struct stat st; if (dest[-1] != '/') *dest++ = '/'; if (dest + (end - start) >= rname_limit) { ptrdiff_t dest_offset = dest - rname; size_t new_size = (size_t) (rname_limit - rname); if (end - start + 1 > PATH_MAX) new_size += (size_t) (end - start + 1); else new_size += PATH_MAX; rname = xrealloc (rname, new_size); rname_limit = rname + new_size; dest = rname + dest_offset; } dest = memcpy (dest, start, (size_t) (end - start)); dest += end - start; *dest = '\0'; if (lstat (rname, &st) != 0) { if (can_mode == CAN_EXISTING) goto error; if (can_mode == CAN_ALL_BUT_LAST && *end) goto error; st.st_mode = 0; } if (S_ISLNK (st.st_mode)) { char *buf; size_t n, len; if (cycle_check (&cycle_state, &st)) { __set_errno (ELOOP); if (can_mode == CAN_MISSING) continue; else goto error; } buf = xreadlink (rname, (size_t) st.st_size); if (!buf) { if (can_mode == CAN_MISSING) continue; else goto error; } n = strlen (buf); len = strlen (end); if (!extra_len) { extra_len = ((n + len + 1) > PATH_MAX) ? (n + len + 1) : PATH_MAX; extra_buf = xmalloc (extra_len); } else if ((n + len + 1) > extra_len) { extra_len = n + len + 1; extra_buf = xrealloc (extra_buf, extra_len); } /* Careful here, end may be a pointer into extra_buf... */ memmove (&extra_buf[n], end, len + 1); name = end = memcpy (extra_buf, buf, n); if (buf[0] == '/') dest = rname + 1; /* It's an absolute symlink */ else /* Back up to previous component, ignore if at root already: */ if (dest > rname + 1) while ((--dest)[-1] != '/'); free (buf); } else { if (!S_ISDIR (st.st_mode) && *end && (can_mode != CAN_MISSING)) { errno = ENOTDIR; goto error; } } } } if (dest > rname + 1 && dest[-1] == '/') --dest; *dest = '\0'; free (extra_buf); return rname; error: free (extra_buf); free (rname); return NULL; } blame-1.4-20240206/lib/xalloc-die.c0000644000000000000000000000254310527555560015002 0ustar rootroot/* Report a memory allocation failure and exit. Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006 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. */ #include #include "xalloc.h" #include #include "error.h" #include "exitfail.h" #include "gettext.h" #define _(msgid) gettext (msgid) void xalloc_die (void) { error (exit_failure, 0, "%s", _("memory exhausted")); /* The `noreturn' cannot be given to error, since it may return if its first argument is 0. To help compilers understand the xalloc_die does not return, call abort. Also, the abort is a safety feature if exit_failure is 0 (which shouldn't happen). */ abort (); } blame-1.4-20240206/lib/time_r.c0000644000000000000000000000241310527555560014234 0ustar rootroot/* Reentrant time functions like localtime_r. Copyright (C) 2003, 2006 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. */ /* Written by Paul Eggert. */ #include #include "time_r.h" #include static struct tm * copy_tm_result (struct tm *dest, struct tm const *src) { if (! src) return 0; *dest = *src; return dest; } struct tm * gmtime_r (time_t const * restrict t, struct tm * restrict tp) { return copy_tm_result (tp, gmtime (t)); } struct tm * localtime_r (time_t const * restrict t, struct tm * restrict tp) { return copy_tm_result (tp, localtime (t)); } blame-1.4-20240206/lib/strncasecmp.c0000644000000000000000000000354710527555560015310 0ustar rootroot/* strncasecmp.c -- case insensitive string comparator Copyright (C) 1998-1999, 2005-2006 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. */ #include /* Specification. */ #include "strcase.h" #include #include #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) /* Compare no more than N bytes of strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ int strncasecmp (const char *s1, const char *s2, size_t n) { register const unsigned char *p1 = (const unsigned char *) s1; register const unsigned char *p2 = (const unsigned char *) s2; unsigned char c1, c2; if (p1 == p2 || n == 0) return 0; do { c1 = TOLOWER (*p1); c2 = TOLOWER (*p2); if (--n == 0 || c1 == '\0') break; ++p1; ++p2; } while (c1 == c2); if (UCHAR_MAX <= INT_MAX) return c1 - c2; else /* On machines where 'char' and 'int' are types of the same size, the difference of two 'unsigned char' values - including the sign bit - doesn't fit in an 'int'. */ return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); } blame-1.4-20240206/lib/dirname.c0000644000000000000000000000573510527555557014414 0ustar rootroot/* dirname.c -- return all but the last element in a file name Copyright (C) 1990, 1998, 2000, 2001, 2003, 2004, 2005, 2006 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. */ #include #include "dirname.h" #include #include "xalloc.h" /* Return the length of the prefix of FILE that will be used by dir_name. If FILE is in the working directory, this returns zero even though `dir_name (FILE)' will return ".". Works properly even if there are trailing slashes (by effectively ignoring them). */ size_t dir_len (char const *file) { size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); size_t length; /* Advance prefix_length beyond important leading slashes. */ prefix_length += (prefix_length != 0 ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && ISSLASH (file[prefix_length])) : (ISSLASH (file[0]) ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT && ISSLASH (file[1]) && ! ISSLASH (file[2]) ? 2 : 1)) : 0)); /* Strip the basename and any redundant slashes before it. */ for (length = last_component (file) - file; prefix_length < length; length--) if (! ISSLASH (file[length - 1])) break; return length; } /* In general, we can't use the builtin `dirname' function if available, since it has different meanings in different environments. In some environments the builtin `dirname' modifies its argument. Return the leading directories part of FILE, allocated with xmalloc. Works properly even if there are trailing slashes (by effectively ignoring them). Unlike POSIX dirname(), FILE cannot be NULL. If lstat (FILE) would succeed, then { chdir (dir_name (FILE)); lstat (base_name (FILE)); } will access the same file. Likewise, if the sequence { chdir (dir_name (FILE)); rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE to "foo" in the same directory FILE was in. */ char * dir_name (char const *file) { size_t length = dir_len (file); bool append_dot = (length == 0 || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && length == FILE_SYSTEM_PREFIX_LEN (file) && file[2] != '\0' && ! ISSLASH (file[2]))); char *dir = xmalloc (length + append_dot + 1); memcpy (dir, file, length); if (append_dot) dir[length++] = '.'; dir[length] = '\0'; return dir; } blame-1.4-20240206/lib/printf-args.h0000644000000000000000000000550110527555557015225 0ustar rootroot/* Decomposed printf argument list. Copyright (C) 1999, 2002-2003, 2006 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. */ #ifndef _PRINTF_ARGS_H #define _PRINTF_ARGS_H /* Get size_t. */ #include /* Get wchar_t. */ #ifdef HAVE_WCHAR_T # include #endif /* Get wint_t. */ #ifdef HAVE_WINT_T # include #endif /* Get va_list. */ #include /* Argument types */ typedef enum { TYPE_NONE, TYPE_SCHAR, TYPE_UCHAR, TYPE_SHORT, TYPE_USHORT, TYPE_INT, TYPE_UINT, TYPE_LONGINT, TYPE_ULONGINT, #ifdef HAVE_LONG_LONG_INT TYPE_LONGLONGINT, TYPE_ULONGLONGINT, #endif TYPE_DOUBLE, #ifdef HAVE_LONG_DOUBLE TYPE_LONGDOUBLE, #endif TYPE_CHAR, #ifdef HAVE_WINT_T TYPE_WIDE_CHAR, #endif TYPE_STRING, #ifdef HAVE_WCHAR_T TYPE_WIDE_STRING, #endif TYPE_POINTER, TYPE_COUNT_SCHAR_POINTER, TYPE_COUNT_SHORT_POINTER, TYPE_COUNT_INT_POINTER, TYPE_COUNT_LONGINT_POINTER #ifdef HAVE_LONG_LONG_INT , TYPE_COUNT_LONGLONGINT_POINTER #endif } arg_type; /* Polymorphic argument */ typedef struct { arg_type type; union { signed char a_schar; unsigned char a_uchar; short a_short; unsigned short a_ushort; int a_int; unsigned int a_uint; long int a_longint; unsigned long int a_ulongint; #ifdef HAVE_LONG_LONG_INT long long int a_longlongint; unsigned long long int a_ulonglongint; #endif float a_float; double a_double; #ifdef HAVE_LONG_DOUBLE long double a_longdouble; #endif int a_char; #ifdef HAVE_WINT_T wint_t a_wide_char; #endif const char* a_string; #ifdef HAVE_WCHAR_T const wchar_t* a_wide_string; #endif void* a_pointer; signed char * a_count_schar_pointer; short * a_count_short_pointer; int * a_count_int_pointer; long int * a_count_longint_pointer; #ifdef HAVE_LONG_LONG_INT long long int * a_count_longlongint_pointer; #endif } a; } argument; typedef struct { size_t count; argument *arg; } arguments; /* Fetch the arguments, putting them into a. */ #ifdef STATIC STATIC #else extern #endif int printf_fetchargs (va_list args, arguments *a); #endif /* _PRINTF_ARGS_H */ blame-1.4-20240206/lib/stdbool_.h0000644000000000000000000001100610527555560014565 0ustar rootroot/* Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. Written by Bruno Haible , 2001. 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. */ #ifndef _STDBOOL_H #define _STDBOOL_H /* ISO C 99 for platforms that lack it. */ /* Usage suggestions: Programs that use should be aware of some limitations and standards compliance issues. Standards compliance: - must be #included before 'bool', 'false', 'true' can be used. - You cannot assume that sizeof (bool) == 1. - Programs should not undefine the macros bool, true, and false, as C99 lists that as an "obsolescent feature". Limitations of this substitute, when used in a C89 environment: - must be #included before the '_Bool' type can be used. - You cannot assume that _Bool is a typedef; it might be a macro. - In C99, casts and automatic conversions to '_Bool' or 'bool' are performed in such a way that every nonzero value gets converted to 'true', and zero gets converted to 'false'. This doesn't work with this substitute. With this substitute, only the values 0 and 1 give the expected result when converted to _Bool' or 'bool'. Also, it is suggested that programs use 'bool' rather than '_Bool'; this isn't required, but 'bool' is more common. */ /* 7.16. Boolean type and values */ /* BeOS already #defines false 0, true 1. We use the same definitions below, but temporarily we have to #undef them. */ #ifdef __BEOS__ # include /* defines bool but not _Bool */ # undef false # undef true #endif /* For the sake of symbolic names in gdb, we define true and false as enum constants, not only as macros. It is tempting to write typedef enum { false = 0, true = 1 } _Bool; so that gdb prints values of type 'bool' symbolically. But if we do this, values of type '_Bool' may promote to 'int' or 'unsigned int' (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the enum; this ensures that '_Bool' promotes to 'int'. */ #if defined __cplusplus || defined __BEOS__ /* A compiler known to have 'bool'. */ /* If the compiler already has both 'bool' and '_Bool', we can assume they are the same types. */ # if !@HAVE__BOOL@ typedef bool _Bool; # endif #else # if !defined __GNUC__ /* If @HAVE__BOOL@: Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when the built-in _Bool type is used. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html Similar bugs are likely with other compilers as well; this file wouldn't be used if was working. So we override the _Bool type. If !@HAVE__BOOL@: Need to define _Bool ourselves. As 'signed char' or as an enum type? Use of a typedef, with SunPRO C, leads to a stupid "warning: _Bool is a keyword in ISO C99". Use of an enum type, with IRIX cc, leads to a stupid "warning(1185): enumerated type mixed with another type". The only benefit of the enum type, debuggability, is not important with these compilers. So use 'signed char' and no typedef. */ # define _Bool signed char enum { false = 0, true = 1 }; # else /* With this compiler, trust the _Bool type if the compiler has it. */ # if !@HAVE__BOOL@ typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; # endif # endif #endif #define bool _Bool /* The other macros must be usable in preprocessor directives. */ #define false 0 #define true 1 #define __bool_true_false_are_defined 1 #endif /* _STDBOOL_H */ blame-1.4-20240206/lib/getopt1.c0000644000000000000000000000762310527555557014356 0ustar rootroot/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ #ifdef _LIBC # include #else # include # include "getopt.h" #endif #include "getopt_int.h" #include /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 0, 0); } int _getopt_long_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, 0, 0, d); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 1, 0); } int _getopt_long_only_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, 0, d); } #ifdef TEST #include int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ blame-1.4-20240206/lib/alloca_.h0000644000000000000000000000347610527555557014374 0ustar rootroot/* Memory allocation on the stack. Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004, 2006 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. */ /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H means there is a real alloca function. */ #ifndef _GNULIB_ALLOCA_H # define _GNULIB_ALLOCA_H /* alloca (N) returns a pointer to N bytes of memory allocated on the stack, which will last until the function returns. Use of alloca should be avoided: - inside arguments of function calls - undefined behaviour, - in inline functions - the allocation may actually last until the calling function returns, - for huge N (say, N >= 65536) - you never know how large (or small) the stack is, and when the stack cannot fulfill the memory allocation request, the program just crashes. */ #ifndef alloca # ifdef __GNUC__ # define alloca __builtin_alloca # elif defined _AIX # define alloca __alloca # elif defined _MSC_VER # include # define alloca _alloca # else # include # ifdef __cplusplus extern "C" # endif void *alloca (size_t); # endif #endif #endif /* _GNULIB_ALLOCA_H */ blame-1.4-20240206/lib/getopt_.h0000644000000000000000000001760210527555557014437 0ustar rootroot/* Declarations for getopt. Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ #ifndef _GETOPT_H #ifndef __need_getopt # define _GETOPT_H 1 #endif /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables defined in this header. When this happens, include the headers that might declare getopt so that they will not cause confusion if included after this file. Then systematically rename identifiers so that they do not collide with the system functions and variables. Renaming avoids problems with some compilers and linkers. */ #if defined __GETOPT_PREFIX && !defined __need_getopt # include # include # include # undef __need_getopt # undef getopt # undef getopt_long # undef getopt_long_only # undef optarg # undef opterr # undef optind # undef optopt # define __GETOPT_CONCAT(x, y) x ## y # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) # define getopt __GETOPT_ID (getopt) # define getopt_long __GETOPT_ID (getopt_long) # define getopt_long_only __GETOPT_ID (getopt_long_only) # define optarg __GETOPT_ID (optarg) # define opterr __GETOPT_ID (opterr) # define optind __GETOPT_ID (optind) # define optopt __GETOPT_ID (optopt) #endif /* Standalone applications get correct prototypes for getopt_long and getopt_long_only; they declare "char **argv". libc uses prototypes with "char *const *argv" that are incorrect because getopt_long and getopt_long_only can permute argv; this is required for backward compatibility (e.g., for LSB 2.0.1). This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', but it caused redefinition warnings if both unistd.h and getopt.h were included, since unistd.h includes getopt.h having previously defined __need_getopt. The only place where __getopt_argv_const is used is in definitions of getopt_long and getopt_long_only below, but these are visible only if __need_getopt is not defined, so it is quite safe to rewrite the conditional as follows: */ #if !defined __need_getopt # if defined __GETOPT_PREFIX # define __getopt_argv_const /* empty */ # else # define __getopt_argv_const const # endif #endif /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifndef __THROW # ifndef __GNUC_PREREQ # define __GNUC_PREREQ(maj, min) (0) # endif # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # else # define __THROW # endif #endif #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* need getopt */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `-', then non-option arguments are treated as arguments to the option '\1'. This behavior is specific to the GNU `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in the environment, then do not permute arguments. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; #ifndef __need_getopt extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; #endif #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt #endif /* getopt.h */ blame-1.4-20240206/lib/mempcpy.c0000644000000000000000000000207310241344116014413 0ustar rootroot/* Copy memory area and return pointer after last written byte. Copyright (C) 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. */ /* Specification. */ #include "mempcpy.h" #include /* Copy N bytes of SRC to DEST, return pointer to bytes after the last written byte. */ void * mempcpy (void *dest, const void *src, size_t n) { return (char *) memcpy (dest, src, n) + n; } blame-1.4-20240206/lib/minmax.h0000644000000000000000000000456310254677263014265 0ustar rootroot/* MIN, MAX macros. Copyright (C) 1995, 1998, 2001, 2003, 2005 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. */ #ifndef _MINMAX_H #define _MINMAX_H /* Note: MIN, MAX are also defined in on some systems (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about MIN, MAX macro redefinitions on some systems; the workaround is to #include this file as the last one among the #include list. */ /* Before we define the following symbols we get the file since otherwise we get redefinitions on some systems if is included after this file. Likewise for . If more than one of these system headers define MIN and MAX, pick just one of the headers (because the definitions most likely are the same). */ #if HAVE_MINMAX_IN_LIMITS_H # include #elif HAVE_MINMAX_IN_SYS_PARAM_H # include #endif /* Note: MIN and MAX should be used with two arguments of the same type. They might not return the minimum and maximum of their two arguments, if the arguments have different types or have unusual floating-point values. For example, on a typical host with 32-bit 'int', 64-bit 'long long', and 64-bit IEEE 754 'double' types: MAX (-1, 2147483648) returns 4294967295. MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0. MAX (NaN, 0.0) returns 0.0. MAX (+0.0, -0.0) returns -0.0. and in each case the answer is in some sense bogus. */ /* MAX(a,b) returns the maximum of A and B. */ #ifndef MAX # define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif /* MIN(a,b) returns the minimum of A and B. */ #ifndef MIN # define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif #endif /* _MINMAX_H */ blame-1.4-20240206/lib/alloca.c0000644000000000000000000003320410527555557014220 0ustar rootroot/* alloca.c -- allocate automatically reclaimed memory (Mostly) portable public-domain implementation -- D A Gwyn This implementation of the PWB library alloca function, which is used to allocate space off the run-time stack so that it is automatically reclaimed upon procedure exit, was inspired by discussions with J. Q. Johnson of Cornell. J.Otto Tennant contributed the Cray support. There are some preprocessor constants that can be defined when compiling for your specific system, for improved efficiency; however, the defaults should be okay. The general concept of this implementation is to keep track of all alloca-allocated blocks, and reclaim any that are found to be deeper in the stack than the current invocation. This heuristic does not reclaim storage as soon as it becomes invalid, but it will do so eventually. As a special case, alloca(0) reclaims storage without allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ #include #include #include #include #ifdef emacs # include "lisp.h" # include "blockinput.h" # ifdef EMACS_FREE # undef free # define free EMACS_FREE # endif #else # define memory_full() abort () #endif /* If compiling with GCC 2, this file's not needed. */ #if !defined (__GNUC__) || __GNUC__ < 2 /* If someone has defined alloca as a macro, there must be some other way alloca is supposed to work. */ # ifndef alloca # ifdef emacs # ifdef static /* actually, only want this if static is defined as "" -- this is for usg, in which emacs must undefine static in order to make unexec workable */ # ifndef STACK_DIRECTION you lose -- must know STACK_DIRECTION at compile-time /* Using #error here is not wise since this file should work for old and obscure compilers. */ # endif /* STACK_DIRECTION undefined */ # endif /* static */ # endif /* emacs */ /* If your stack is a linked list of frames, you have to provide an "address metric" ADDRESS_FUNCTION macro. */ # if defined (CRAY) && defined (CRAY_STACKSEG_END) long i00afunc (); # define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) # else # define ADDRESS_FUNCTION(arg) &(arg) # endif /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ # ifndef STACK_DIRECTION # define STACK_DIRECTION 0 /* Direction unknown. */ # endif # if STACK_DIRECTION != 0 # define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ # else /* STACK_DIRECTION == 0; need run-time code. */ static int stack_dir; /* 1 or -1 once known. */ # define STACK_DIR stack_dir static void find_stack_direction (void) { static char *addr = NULL; /* Address of first `dummy', once known. */ auto char dummy; /* To get stack address. */ if (addr == NULL) { /* Initial entry. */ addr = ADDRESS_FUNCTION (dummy); find_stack_direction (); /* Recurse once. */ } else { /* Second entry. */ if (ADDRESS_FUNCTION (dummy) > addr) stack_dir = 1; /* Stack grew upward. */ else stack_dir = -1; /* Stack grew downward. */ } } # endif /* STACK_DIRECTION == 0 */ /* An "alloca header" is used to: (a) chain together all alloca'ed blocks; (b) keep track of stack depth. It is very important that sizeof(header) agree with malloc alignment chunk size. The following default should work okay. */ # ifndef ALIGN_SIZE # define ALIGN_SIZE sizeof(double) # endif typedef union hdr { char align[ALIGN_SIZE]; /* To force sizeof(header). */ struct { union hdr *next; /* For chaining headers. */ char *deep; /* For stack depth measure. */ } h; } header; static header *last_alloca_header = NULL; /* -> last alloca header. */ /* Return a pointer to at least SIZE bytes of storage, which will be automatically reclaimed upon exit from the procedure that called alloca. Originally, this space was supposed to be taken from the current stack frame of the caller, but that method cannot be made to work for some implementations of C, for example under Gould's UTX/32. */ void * alloca (size_t size) { auto char probe; /* Probes stack depth: */ register char *depth = ADDRESS_FUNCTION (probe); # if STACK_DIRECTION == 0 if (STACK_DIR == 0) /* Unknown growth direction. */ find_stack_direction (); # endif /* Reclaim garbage, defined as all alloca'd storage that was allocated from deeper in the stack than currently. */ { register header *hp; /* Traverses linked list. */ # ifdef emacs BLOCK_INPUT; # endif for (hp = last_alloca_header; hp != NULL;) if ((STACK_DIR > 0 && hp->h.deep > depth) || (STACK_DIR < 0 && hp->h.deep < depth)) { register header *np = hp->h.next; free (hp); /* Collect garbage. */ hp = np; /* -> next header. */ } else break; /* Rest are not deeper. */ last_alloca_header = hp; /* -> last valid storage. */ # ifdef emacs UNBLOCK_INPUT; # endif } if (size == 0) return NULL; /* No allocation required. */ /* Allocate combined header + user data storage. */ { /* Address of header. */ register header *new; size_t combined_size = sizeof (header) + size; if (combined_size < sizeof (header)) memory_full (); new = malloc (combined_size); if (! new) memory_full (); new->h.next = last_alloca_header; new->h.deep = depth; last_alloca_header = new; /* User storage begins just after header. */ return (void *) (new + 1); } } # if defined (CRAY) && defined (CRAY_STACKSEG_END) # ifdef DEBUG_I00AFUNC # include # endif # ifndef CRAY_STACK # define CRAY_STACK # ifndef CRAY2 /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ struct stack_control_header { long shgrow:32; /* Number of times stack has grown. */ long shaseg:32; /* Size of increments to stack. */ long shhwm:32; /* High water mark of stack. */ long shsize:32; /* Current size of stack (all segments). */ }; /* The stack segment linkage control information occurs at the high-address end of a stack segment. (The stack grows from low addresses to high addresses.) The initial part of the stack segment linkage control information is 0200 (octal) words. This provides for register storage for the routine which overflows the stack. */ struct stack_segment_linkage { long ss[0200]; /* 0200 overflow words. */ long sssize:32; /* Number of words in this segment. */ long ssbase:32; /* Offset to stack base. */ long:32; long sspseg:32; /* Offset to linkage control of previous segment of stack. */ long:32; long sstcpt:32; /* Pointer to task common address block. */ long sscsnm; /* Private control structure number for microtasking. */ long ssusr1; /* Reserved for user. */ long ssusr2; /* Reserved for user. */ long sstpid; /* Process ID for pid based multi-tasking. */ long ssgvup; /* Pointer to multitasking thread giveup. */ long sscray[7]; /* Reserved for Cray Research. */ long ssa0; long ssa1; long ssa2; long ssa3; long ssa4; long ssa5; long ssa6; long ssa7; long sss0; long sss1; long sss2; long sss3; long sss4; long sss5; long sss6; long sss7; }; # else /* CRAY2 */ /* The following structure defines the vector of words returned by the STKSTAT library routine. */ struct stk_stat { long now; /* Current total stack size. */ long maxc; /* Amount of contiguous space which would be required to satisfy the maximum stack demand to date. */ long high_water; /* Stack high-water mark. */ long overflows; /* Number of stack overflow ($STKOFEN) calls. */ long hits; /* Number of internal buffer hits. */ long extends; /* Number of block extensions. */ long stko_mallocs; /* Block allocations by $STKOFEN. */ long underflows; /* Number of stack underflow calls ($STKRETN). */ long stko_free; /* Number of deallocations by $STKRETN. */ long stkm_free; /* Number of deallocations by $STKMRET. */ long segments; /* Current number of stack segments. */ long maxs; /* Maximum number of stack segments so far. */ long pad_size; /* Stack pad size. */ long current_address; /* Current stack segment address. */ long current_size; /* Current stack segment size. This number is actually corrupted by STKSTAT to include the fifteen word trailer area. */ long initial_address; /* Address of initial segment. */ long initial_size; /* Size of initial segment. */ }; /* The following structure describes the data structure which trails any stack segment. I think that the description in 'asdef' is out of date. I only describe the parts that I am sure about. */ struct stk_trailer { long this_address; /* Address of this block. */ long this_size; /* Size of this block (does not include this trailer). */ long unknown2; long unknown3; long link; /* Address of trailer block of previous segment. */ long unknown5; long unknown6; long unknown7; long unknown8; long unknown9; long unknown10; long unknown11; long unknown12; long unknown13; long unknown14; }; # endif /* CRAY2 */ # endif /* not CRAY_STACK */ # ifdef CRAY2 /* Determine a "stack measure" for an arbitrary ADDRESS. I doubt that "lint" will like this much. */ static long i00afunc (long *address) { struct stk_stat status; struct stk_trailer *trailer; long *block, size; long result = 0; /* We want to iterate through all of the segments. The first step is to get the stack status structure. We could do this more quickly and more directly, perhaps, by referencing the $LM00 common block, but I know that this works. */ STKSTAT (&status); /* Set up the iteration. */ trailer = (struct stk_trailer *) (status.current_address + status.current_size - 15); /* There must be at least one stack segment. Therefore it is a fatal error if "trailer" is null. */ if (trailer == 0) abort (); /* Discard segments that do not contain our argument address. */ while (trailer != 0) { block = (long *) trailer->this_address; size = trailer->this_size; if (block == 0 || size == 0) abort (); trailer = (struct stk_trailer *) trailer->link; if ((block <= address) && (address < (block + size))) break; } /* Set the result to the offset in this segment and add the sizes of all predecessor segments. */ result = address - block; if (trailer == 0) { return result; } do { if (trailer->this_size <= 0) abort (); result += trailer->this_size; trailer = (struct stk_trailer *) trailer->link; } while (trailer != 0); /* We are done. Note that if you present a bogus address (one not in any segment), you will get a different number back, formed from subtracting the address of the first block. This is probably not what you want. */ return (result); } # else /* not CRAY2 */ /* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. Determine the number of the cell within the stack, given the address of the cell. The purpose of this routine is to linearize, in some sense, stack addresses for alloca. */ static long i00afunc (long address) { long stkl = 0; long size, pseg, this_segment, stack; long result = 0; struct stack_segment_linkage *ssptr; /* Register B67 contains the address of the end of the current stack segment. If you (as a subprogram) store your registers on the stack and find that you are past the contents of B67, you have overflowed the segment. B67 also points to the stack segment linkage control area, which is what we are really interested in. */ stkl = CRAY_STACKSEG_END (); ssptr = (struct stack_segment_linkage *) stkl; /* If one subtracts 'size' from the end of the segment, one has the address of the first word of the segment. If this is not the first segment, 'pseg' will be nonzero. */ pseg = ssptr->sspseg; size = ssptr->sssize; this_segment = stkl - size; /* It is possible that calling this routine itself caused a stack overflow. Discard stack segments which do not contain the target address. */ while (!(this_segment <= address && address <= stkl)) { # ifdef DEBUG_I00AFUNC fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); # endif if (pseg == 0) break; stkl = stkl - pseg; ssptr = (struct stack_segment_linkage *) stkl; size = ssptr->sssize; pseg = ssptr->sspseg; this_segment = stkl - size; } result = address - this_segment; /* If you subtract pseg from the current end of the stack, you get the address of the previous stack segment's end. This seems a little convoluted to me, but I'll bet you save a cycle somewhere. */ while (pseg != 0) { # ifdef DEBUG_I00AFUNC fprintf (stderr, "%011o %011o\n", pseg, size); # endif stkl = stkl - pseg; ssptr = (struct stack_segment_linkage *) stkl; size = ssptr->sssize; pseg = ssptr->sspseg; result += size; } return (result); } # endif /* not CRAY2 */ # endif /* CRAY */ # endif /* no alloca */ #endif /* not GCC version 2 */ blame-1.4-20240206/lib/xsize.h0000644000000000000000000000667310241344125014122 0ustar rootroot/* xsize.h -- Checked size_t computations. Copyright (C) 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. */ #ifndef _XSIZE_H #define _XSIZE_H /* Get size_t. */ #include /* Get SIZE_MAX. */ #include #if HAVE_STDINT_H # include #endif /* The size of memory objects is often computed through expressions of type size_t. Example: void* p = malloc (header_size + n * element_size). These computations can lead to overflow. When this happens, malloc() returns a piece of memory that is way too small, and the program then crashes while attempting to fill the memory. To avoid this, the functions and macros in this file check for overflow. The convention is that SIZE_MAX represents overflow. malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc implementation that uses mmap --, it's recommended to use size_overflow_p() or size_in_bounds_p() before invoking malloc(). The example thus becomes: size_t size = xsum (header_size, xtimes (n, element_size)); void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); */ /* Convert an arbitrary value >= 0 to type size_t. */ #define xcast_size_t(N) \ ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) /* Sum of two sizes, with overflow check. */ static inline size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif xsum (size_t size1, size_t size2) { size_t sum = size1 + size2; return (sum >= size1 ? sum : SIZE_MAX); } /* Sum of three sizes, with overflow check. */ static inline size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif xsum3 (size_t size1, size_t size2, size_t size3) { return xsum (xsum (size1, size2), size3); } /* Sum of four sizes, with overflow check. */ static inline size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif xsum4 (size_t size1, size_t size2, size_t size3, size_t size4) { return xsum (xsum (xsum (size1, size2), size3), size4); } /* Maximum of two sizes, with overflow check. */ static inline size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif xmax (size_t size1, size_t size2) { /* No explicit check is needed here, because for any n: max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */ return (size1 >= size2 ? size1 : size2); } /* Multiplication of a count with an element size, with overflow check. The count must be >= 0 and the element size must be > 0. This is a macro, not an inline function, so that it works correctly even when N is of a wider tupe and N > SIZE_MAX. */ #define xtimes(N, ELSIZE) \ ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) /* Check for overflow. */ #define size_overflow_p(SIZE) \ ((SIZE) == SIZE_MAX) /* Check against overflow. */ #define size_in_bounds_p(SIZE) \ ((SIZE) != SIZE_MAX) #endif /* _XSIZE_H */ blame-1.4-20240206/lib/strtoul.c0000644000000000000000000000151710241344123014455 0ustar rootroot/* Copyright (C) 1991, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ #define UNSIGNED 1 #include "strtol.c" blame-1.4-20240206/lib/xalloc.h0000644000000000000000000001657514556306747014271 0ustar rootroot/* xalloc.h -- malloc with out-of-memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2003, 2004, 2006 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. */ #ifndef XALLOC_H_ # define XALLOC_H_ # include # ifdef __cplusplus extern "C" { # endif # ifndef __attribute__ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __attribute__(x) # endif # endif # ifndef ATTRIBUTE_NORETURN # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # endif /* This function is always triggered when memory is exhausted. It must be defined by the application, either explicitly or by using gnulib's xalloc-die module. This is the function to call when one wants the program to die because of a memory allocation failure. */ extern void xalloc_die (void) ATTRIBUTE_NORETURN; void *xmalloc (size_t s); void *xzalloc (size_t s); void *xcalloc (size_t n, size_t s); void *xrealloc (void *p, size_t s); void *x2realloc (void *p, size_t *pn); void *xmemdup (void const *p, size_t s); char *xstrdup (char const *str); /* Return 1 if an array of N objects, each of size S, cannot exist due to size arithmetic overflow. S must be positive and N must be nonnegative. This is a macro, not an inline function, so that it works correctly even when SIZE_MAX < N. By gnulib convention, SIZE_MAX represents overflow in size calculations, so the conservative dividend to use here is SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. However, malloc (SIZE_MAX) fails on all known hosts where sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for exactly-SIZE_MAX allocations on such hosts; this avoids a test and branch when S is known to be 1. */ # define xalloc_oversized(n, s) \ ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) /* In the following macros, T must be an elementary or structure/union or typedef'ed type, or a pointer to such a type. To apply one of the following macros to a function pointer or array type, you need to typedef it first and use the typedef name. */ /* Allocate an object of type T dynamically, with error checking. */ /* extern t *XMALLOC (typename t); */ # define XMALLOC(t) ((t *) xmalloc (sizeof (t))) /* Allocate memory for N elements of type T, with error checking. */ /* extern t *XNMALLOC (size_t n, typename t); */ # define XNMALLOC(n, t) \ ((t *) (sizeof (t) == 1 ? xmalloc (n) : xnmalloc (n, sizeof (t)))) /* Allocate an object of type T dynamically, with error checking, and zero it. */ /* extern t *XZALLOC (typename t); */ # define XZALLOC(t) ((t *) xzalloc (sizeof (t))) /* Allocate memory for N elements of type T, with error checking, and zero it. */ /* extern t *XCALLOC (size_t n, typename t); */ # define XCALLOC(n, t) \ ((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t)))) # if HAVE_INLINE # define static_inline static inline # else void *xnmalloc (size_t n, size_t s); void *xnrealloc (void *p, size_t n, size_t s); void *x2nrealloc (void *p, size_t *pn, size_t s); char *xcharalloc (size_t n); # endif # ifdef static_inline /* Allocate an array of N objects, each with S bytes of memory, dynamically, with error checking. S must be nonzero. */ static_inline void * xnmalloc (size_t n, size_t s) { if (xalloc_oversized (n, s)) xalloc_die (); return xmalloc (n * s); } /* Change the size of an allocated block of memory P to an array of N objects each of S bytes, with error checking. S must be nonzero. */ static_inline void * xnrealloc (void *p, size_t n, size_t s) { if (xalloc_oversized (n, s)) xalloc_die (); return xrealloc (p, n * s); } /* If P is null, allocate a block of at least *PN such objects; otherwise, reallocate P so that it contains more than *PN objects each of S bytes. *PN must be nonzero unless P is null, and S must be nonzero. Set *PN to the new number of objects, and return the pointer to the new block. *PN is never set to zero, and the returned pointer is never null. Repeated reallocations are guaranteed to make progress, either by allocating an initial block with a nonzero size, or by allocating a larger block. In the following implementation, nonzero sizes are doubled so that repeated reallocations have O(N log N) overall cost rather than O(N**2) cost, but the specification for this function does not guarantee that sizes are doubled. Here is an example of use: int *p = NULL; size_t used = 0; size_t allocated = 0; void append_int (int value) { if (used == allocated) p = x2nrealloc (p, &allocated, sizeof *p); p[used++] = value; } This causes x2nrealloc to allocate a block of some nonzero size the first time it is called. To have finer-grained control over the initial size, set *PN to a nonzero value before calling this function with P == NULL. For example: int *p = NULL; size_t used = 0; size_t allocated = 0; size_t allocated1 = 1000; void append_int (int value) { if (used == allocated) { p = x2nrealloc (p, &allocated1, sizeof *p); allocated = allocated1; } p[used++] = value; } */ static_inline void * x2nrealloc (void *p, size_t *pn, size_t s) { size_t n = *pn; if (! p) { if (! n) { /* The approximate size to use for initial small allocation requests, when the invoking code specifies an old size of zero. 64 bytes is the largest "small" request for the GNU C library malloc. */ enum { DEFAULT_MXFAST = 64 }; n = DEFAULT_MXFAST / s; n += !n; } } else { if (((size_t) -1) / 2 / s < n) xalloc_die (); n *= 2; } *pn = n; return xrealloc (p, n * s); } /* Return a pointer to a new buffer of N bytes. This is like xmalloc, except it returns char *. */ static_inline char * xcharalloc (size_t n) { return XNMALLOC (n, char); } # endif # ifdef __cplusplus } /* C++ does not allow conversions from void * to other pointer types without a cast. Use templates to work around the problem when possible. */ template inline T * xrealloc (T *p, size_t s) { return (T *) xrealloc ((void *) p, s); } template inline T * xnrealloc (T *p, size_t n, size_t s) { return (T *) xnrealloc ((void *) p, n, s); } template inline T * x2realloc (T *p, size_t *pn) { return (T *) x2realloc ((void *) p, pn); } template inline T * x2nrealloc (T *p, size_t *pn, size_t s) { return (T *) x2nrealloc ((void *) p, pn, s); } template inline T * xmemdup (T const *p, size_t s) { return (T *) xmemdup ((void const *) p, s); } # endif #endif /* !XALLOC_H_ */ blame-1.4-20240206/lib/argp-fs-xinl.c0000644000000000000000000000317110337302606015254 0ustar rootroot/* Real definitions for extern inline functions in argp-fmtstream.h Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ #ifdef HAVE_CONFIG_H # include #endif #define ARGP_FS_EI #undef __OPTIMIZE__ #define __OPTIMIZE__ 1 #include "argp-fmtstream.h" #if 0 /* Not exported. */ /* Add weak aliases. */ #if _LIBC - 0 && !defined (ARGP_FMTSTREAM_USE_LINEWRAP) && defined (weak_alias) weak_alias (__argp_fmtstream_putc, argp_fmtstream_putc) weak_alias (__argp_fmtstream_puts, argp_fmtstream_puts) weak_alias (__argp_fmtstream_write, argp_fmtstream_write) weak_alias (__argp_fmtstream_set_lmargin, argp_fmtstream_set_lmargin) weak_alias (__argp_fmtstream_set_rmargin, argp_fmtstream_set_rmargin) weak_alias (__argp_fmtstream_set_wmargin, argp_fmtstream_set_wmargin) weak_alias (__argp_fmtstream_point, argp_fmtstream_point) #endif #endif blame-1.4-20240206/lib/strdup.c0000644000000000000000000000262310527555560014301 0ustar rootroot/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ #ifndef _LIBC # include /* Get specification. */ # include "strdup.h" #endif #include #include #undef __strdup #ifdef _LIBC # undef strdup #endif #ifndef weak_alias # define __strdup strdup #endif /* Duplicate S, returning an identical malloc'd string. */ char * __strdup (const char *s) { size_t len = strlen (s) + 1; void *new = malloc (len); if (new == NULL) return NULL; return (char *) memcpy (new, s, len); } #ifdef libc_hidden_def libc_hidden_def (__strdup) #endif #ifdef weak_alias weak_alias (__strdup, strdup) #endif blame-1.4-20240206/lib/argp-parse.c0000644000000000000000000007174014560263173015024 0ustar rootroot/* Hierarchial argument parsing, layered over getopt Copyright (C) 1995-2000, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include #include #include #ifdef _LIBC # include # undef dgettext # define dgettext(domain, msgid) \ INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES) #else # include "gettext.h" #endif #define N_(msgid) msgid #include "argp.h" #include "argp-namefrob.h" #define alignof(type) offsetof (struct { char c; type x; }, x) #define alignto(n, d) ((((n) + (d) - 1) / (d)) * (d)) /* Getopt return values. */ #define KEY_END (-1) /* The end of the options. */ #define KEY_ARG 1 /* A non-option argument. */ #define KEY_ERR '?' /* An error parsing the options. */ /* The meta-argument used to prevent any further arguments being interpreted as options. */ #define QUOTE "--" /* The number of bits we steal in a long-option value for our own use. */ #define GROUP_BITS CHAR_BIT /* The number of bits available for the user value. */ #define USER_BITS ((sizeof ((struct option *)0)->val * CHAR_BIT) - GROUP_BITS) #define USER_MASK ((1 << USER_BITS) - 1) /* EZ alias for ARGP_ERR_UNKNOWN. */ #define EBADKEY ARGP_ERR_UNKNOWN /* Default options. */ /* When argp is given the --HANG switch, _ARGP_HANG is set and argp will sleep for one second intervals, decrementing _ARGP_HANG until it's zero. Thus you can force the program to continue by attaching a debugger and setting it to 0 yourself. */ static volatile int _argp_hang; #define OPT_PROGNAME -2 #define OPT_USAGE -3 #define OPT_HANG -4 static const struct argp_option argp_default_options[] = { {"help", '?', 0, 0, N_("give this help list"), -1}, {"usage", OPT_USAGE, 0, 0, N_("give a short usage message"), 0}, {"program-name",OPT_PROGNAME,N_("NAME"), OPTION_HIDDEN, N_("set the program name"), 0}, {"HANG", OPT_HANG, N_("SECS"), OPTION_ARG_OPTIONAL | OPTION_HIDDEN, N_("hang for SECS seconds (default 3600)"), 0}, {NULL, 0, 0, 0, NULL, 0} }; static error_t argp_default_parser (int key, char *arg, struct argp_state *state) { switch (key) { case '?': __argp_state_help (state, state->out_stream, ARGP_HELP_STD_HELP); break; case OPT_USAGE: __argp_state_help (state, state->out_stream, ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK); break; case OPT_PROGNAME: /* Set the program name. */ #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_NAME program_invocation_name = arg; #endif /* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined to be that, so we have to be a bit careful here.] */ /* Update what we use for messages. */ state->name = __argp_base_name (arg); #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME program_invocation_short_name = state->name; #endif if ((state->flags & (ARGP_PARSE_ARGV0 | ARGP_NO_ERRS)) == ARGP_PARSE_ARGV0) /* Update what getopt uses too. */ state->argv[0] = arg; break; case OPT_HANG: _argp_hang = atoi (arg ? arg : "3600"); while (_argp_hang-- > 0) __sleep (1); break; default: return EBADKEY; } return 0; } static const struct argp argp_default_argp = {argp_default_options, &argp_default_parser, NULL, NULL, NULL, NULL, "libc"}; static const struct argp_option argp_version_options[] = { {"version", 'V', 0, 0, N_("print program version"), -1}, {NULL, 0, 0, 0, NULL, 0} }; static error_t argp_version_parser (int key, char *arg, struct argp_state *state) { (void) arg; switch (key) { case 'V': if (argp_program_version_hook) (*argp_program_version_hook) (state->out_stream, state); else if (argp_program_version) fprintf (state->out_stream, "%s\n", argp_program_version); else __argp_error (state, "%s", dgettext (state->root_argp->argp_domain, "(PROGRAM ERROR) No version known!?")); if (! (state->flags & ARGP_NO_EXIT)) exit (0); break; default: return EBADKEY; } return 0; } static const struct argp argp_version_argp = {argp_version_options, &argp_version_parser, NULL, NULL, NULL, NULL, "libc"}; /* Returns the offset into the getopt long options array LONG_OPTIONS of a long option with called NAME, or -1 if none is found. Passing NULL as NAME will return the number of options. */ static int find_long_option (struct option *long_options, const char *name) { struct option *l = long_options; while (l->name != NULL) if (name != NULL && strcmp (l->name, name) == 0) return (int) (l - long_options); else l++; if (name == NULL) return (int) (l - long_options); else return -1; } /* The state of a `group' during parsing. Each group corresponds to a particular argp structure from the tree of such descending from the top level argp passed to argp_parse. */ struct group { /* This group's parsing function. */ argp_parser_t parser; /* Which argp this group is from. */ const struct argp *argp; /* Points to the point in SHORT_OPTS corresponding to the end of the short options for this group. We use it to determine from which group a particular short options is from. */ char *short_end; /* The number of non-option args successfully handled by this parser. */ unsigned args_processed; /* This group's parser's parent's group. */ struct group *parent; unsigned parent_index; /* And the our position in the parent. */ /* These fields are swapped into and out of the state structure when calling this group's parser. */ void *input, **child_inputs; void *hook; }; /* Call GROUP's parser with KEY and ARG, swapping any group-specific info from STATE before calling, and back into state afterwards. If GROUP has no parser, EBADKEY is returned. */ static error_t group_parse (struct group *group, struct argp_state *state, int key, char *arg) { if (group->parser) { error_t err; state->hook = group->hook; state->input = group->input; state->child_inputs = group->child_inputs; state->arg_num = group->args_processed; err = (*group->parser)(key, arg, state); group->hook = state->hook; return err; } else return EBADKEY; } struct parser { const struct argp *argp; /* SHORT_OPTS is the getopt short options string for the union of all the groups of options. */ char *short_opts; /* LONG_OPTS is the array of getop long option structures for the union of all the groups of options. */ struct option *long_opts; /* OPT_DATA is the getopt data used for the re-entrant getopt. */ struct _getopt_data opt_data; /* States of the various parsing groups. */ struct group *groups; /* The end of the GROUPS array. */ struct group *egroup; /* An vector containing storage for the CHILD_INPUTS field in all groups. */ void **child_inputs; /* True if we think using getopt is still useful; if false, then remaining arguments are just passed verbatim with ARGP_KEY_ARG. This is cleared whenever getopt returns KEY_END, but may be set again if the user moves the next argument pointer backwards. */ int try_getopt; /* State block supplied to parsing routines. */ struct argp_state state; /* Memory used by this parser. */ void *storage; }; /* The next usable entries in the various parser tables being filled in by convert_options. */ struct parser_convert_state { struct parser *parser; char *short_end; struct option *long_end; void **child_inputs_end; }; /* Converts all options in ARGP (which is put in GROUP) and ancestors into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and CVT->LONG_END are the points at which new options are added. Returns the next unused group entry. CVT holds state used during the conversion. */ static struct group * convert_options (const struct argp *argp, struct group *parent, unsigned parent_index, struct group *group, struct parser_convert_state *cvt) { /* REAL is the most recent non-alias value of OPT. */ const struct argp_option *real = argp->options; const struct argp_child *children = argp->children; if (real || argp->parser) { const struct argp_option *opt; if (real) for (opt = real; !__option_is_end (opt); opt++) { if (! (opt->flags & OPTION_ALIAS)) /* OPT isn't an alias, so we can use values from it. */ real = opt; if (! (real->flags & OPTION_DOC)) /* A real option (not just documentation). */ { if (__option_is_short (opt)) /* OPT can be used as a short option. */ { *cvt->short_end++ = (char) opt->key; if (real->arg) { *cvt->short_end++ = ':'; if (real->flags & OPTION_ARG_OPTIONAL) *cvt->short_end++ = ':'; } *cvt->short_end = '\0'; /* keep 0 terminated */ } if (opt->name && find_long_option (cvt->parser->long_opts, opt->name) < 0) /* OPT can be used as a long option. */ { cvt->long_end->name = opt->name; cvt->long_end->has_arg = (real->arg ? (real->flags & OPTION_ARG_OPTIONAL ? optional_argument : required_argument) : no_argument); cvt->long_end->flag = 0; /* we add a disambiguating code to all the user's values (which is removed before we actually call the function to parse the value); this means that the user loses use of the high 8 bits in all his values (the sign of the lower bits is preserved however)... */ cvt->long_end->val = (int) (((opt->key | real->key) & USER_MASK) + (((group - cvt->parser->groups) + 1) << USER_BITS)); /* Keep the LONG_OPTS list terminated. */ (++cvt->long_end)->name = NULL; } } } group->parser = argp->parser; group->argp = argp; group->short_end = cvt->short_end; group->args_processed = 0; group->parent = parent; group->parent_index = parent_index; group->input = 0; group->hook = 0; group->child_inputs = 0; if (children) /* Assign GROUP's CHILD_INPUTS field some space from CVT->child_inputs_end.*/ { unsigned num_children = 0; while (children[num_children].argp) num_children++; group->child_inputs = cvt->child_inputs_end; cvt->child_inputs_end += num_children; } parent = group++; } else parent = 0; if (children) { unsigned index = 0; while (children->argp) group = convert_options (children++->argp, parent, index++, group, cvt); } return group; } /* Find the merged set of getopt options, with keys appropriately prefixed. */ static void parser_convert (struct parser *parser, const struct argp *argp, int flags) { struct parser_convert_state cvt; cvt.parser = parser; cvt.short_end = parser->short_opts; cvt.long_end = parser->long_opts; cvt.child_inputs_end = parser->child_inputs; if (flags & ARGP_IN_ORDER) *cvt.short_end++ = '-'; else if (flags & ARGP_NO_ARGS) *cvt.short_end++ = '+'; *cvt.short_end = '\0'; cvt.long_end->name = NULL; parser->argp = argp; if (argp) parser->egroup = convert_options (argp, 0, 0, parser->groups, &cvt); else parser->egroup = parser->groups; /* No parsers at all! */ } /* Lengths of various parser fields which we will allocated. */ struct parser_sizes { size_t short_len; /* Getopt short options string. */ size_t long_len; /* Getopt long options vector. */ size_t num_groups; /* Group structures we allocate. */ size_t num_child_inputs; /* Child input slots. */ }; /* For ARGP, increments the NUM_GROUPS field in SZS by the total number of argp structures descended from it, and the SHORT_LEN & LONG_LEN fields by the maximum lengths of the resulting merged getopt short options string and long-options array, respectively. */ static void calc_sizes (const struct argp *argp, struct parser_sizes *szs) { const struct argp_child *child = argp->children; const struct argp_option *opt = argp->options; if (opt || argp->parser) { szs->num_groups++; if (opt) { size_t num_opts = 0; while (!__option_is_end (opt++)) num_opts++; szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */ szs->long_len += num_opts; } } if (child) while (child->argp) { calc_sizes ((child++)->argp, szs); szs->num_child_inputs++; } } /* Initializes PARSER to parse ARGP in a manner described by FLAGS. */ static error_t parser_init (struct parser *parser, const struct argp *argp, int argc, char **argv, int flags, void *input) { error_t err = 0; struct group *group; struct parser_sizes szs; struct _getopt_data opt_data = _GETOPT_DATA_INITIALIZER; char *storage; size_t glen, gsum; size_t clen, csum; size_t llen, lsum; size_t slen, ssum; szs.short_len = (flags & ARGP_NO_ARGS) ? 0 : 1; szs.long_len = 0; szs.num_groups = 0; szs.num_child_inputs = 0; if (argp) calc_sizes (argp, &szs); /* Lengths of the various bits of storage used by PARSER. */ glen = (szs.num_groups + 1) * sizeof (struct group); clen = szs.num_child_inputs * sizeof (void *); llen = (szs.long_len + 1) * sizeof (struct option); slen = szs.short_len + 1; /* Sums of previous lengths, properly aligned. There's no need to align gsum, since struct group is aligned at least as strictly as void * (since it contains a void * member). And there's no need to align lsum, since struct option is aligned at least as strictly as char. */ gsum = glen; csum = alignto (gsum + clen, alignof (struct option)); lsum = csum + llen; ssum = lsum + slen; parser->storage = malloc (ssum); if (! parser->storage) return ENOMEM; storage = parser->storage; parser->groups = parser->storage; parser->child_inputs = (void **) (storage + gsum); parser->long_opts = (struct option *) (storage + csum); parser->short_opts = storage + lsum; parser->opt_data = opt_data; memset (parser->child_inputs, 0, clen); parser_convert (parser, argp, flags); memset (&parser->state, 0, sizeof (struct argp_state)); parser->state.root_argp = parser->argp; parser->state.argc = argc; parser->state.argv = argv; parser->state.flags = (unsigned) flags; parser->state.err_stream = stderr; parser->state.out_stream = stdout; parser->state.next = 0; /* Tell getopt to initialize. */ parser->state.pstate = parser; parser->try_getopt = 1; /* Call each parser for the first time, giving it a chance to propagate values to child parsers. */ if (parser->groups < parser->egroup) parser->groups->input = input; for (group = parser->groups; group < parser->egroup && (!err || err == EBADKEY); group++) { if (group->parent) /* If a child parser, get the initial input value from the parent. */ group->input = group->parent->child_inputs[group->parent_index]; if (!group->parser && group->argp->children && group->argp->children->argp) /* For the special case where no parsing function is supplied for an argp, propagate its input to its first child, if any (this just makes very simple wrapper argps more convenient). */ group->child_inputs[0] = group->input; err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0); } if (err == EBADKEY) err = 0; /* Some parser didn't understand. */ if (err) return err; if (parser->state.flags & ARGP_NO_ERRS) { parser->opt_data.opterr = 0; if (parser->state.flags & ARGP_PARSE_ARGV0) /* getopt always skips ARGV[0], so we have to fake it out. As long as OPTERR is 0, then it shouldn't actually try to access it. */ parser->state.argv--, parser->state.argc++; } else parser->opt_data.opterr = 1; /* Print error messages. */ if (parser->state.argv == argv && argv[0]) /* There's an argv[0]; use it for messages. */ parser->state.name = __argp_base_name (argv[0]); else parser->state.name = __argp_short_program_name (); return 0; } /* Free any storage consumed by PARSER (but not PARSER itself). */ static error_t parser_finalize (struct parser *parser, error_t err, int arg_ebadkey, int *end_index) { struct group *group; if (err == EBADKEY && arg_ebadkey) /* Suppress errors generated by unparsed arguments. */ err = 0; if (! err) { if (parser->state.next == parser->state.argc) /* We successfully parsed all arguments! Call all the parsers again, just a few more times... */ { for (group = parser->groups; group < parser->egroup && (!err || err==EBADKEY); group++) if (group->args_processed == 0) err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0); for (group = parser->egroup - 1; group >= parser->groups && (!err || err==EBADKEY); group--) err = group_parse (group, &parser->state, ARGP_KEY_END, 0); if (err == EBADKEY) err = 0; /* Some parser didn't understand. */ /* Tell the user that all arguments are parsed. */ if (end_index) *end_index = parser->state.next; } else if (end_index) /* Return any remaining arguments to the user. */ *end_index = parser->state.next; else /* No way to return the remaining arguments, they must be bogus. */ { if (!(parser->state.flags & ARGP_NO_ERRS) && parser->state.err_stream) fprintf (parser->state.err_stream, dgettext (parser->argp->argp_domain, "%s: Too many arguments\n"), parser->state.name); err = EBADKEY; } } /* Okay, we're all done, with either an error or success; call the parsers to indicate which one. */ if (err) { /* Maybe print an error message. */ if (err == EBADKEY) /* An appropriate message describing what the error was should have been printed earlier. */ __argp_state_help (&parser->state, parser->state.err_stream, ARGP_HELP_STD_ERR); /* Since we didn't exit, give each parser an error indication. */ for (group = parser->groups; group < parser->egroup; group++) group_parse (group, &parser->state, ARGP_KEY_ERROR, 0); } else /* Notify parsers of success, and propagate back values from parsers. */ { /* We pass over the groups in reverse order so that child groups are given a chance to do there processing before passing back a value to the parent. */ for (group = parser->egroup - 1 ; group >= parser->groups && (!err || err == EBADKEY) ; group--) err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0); if (err == EBADKEY) err = 0; /* Some parser didn't understand. */ } /* Call parsers once more, to do any final cleanup. Errors are ignored. */ for (group = parser->egroup - 1; group >= parser->groups; group--) group_parse (group, &parser->state, ARGP_KEY_FINI, 0); if (err == EBADKEY) err = EINVAL; free (parser->storage); return err; } /* Call the user parsers to parse the non-option argument VAL, at the current position, returning any error. The state NEXT pointer is assumed to have been adjusted (by getopt) to point after this argument; this function will adjust it correctly to reflect however many args actually end up being consumed. */ static error_t parser_parse_arg (struct parser *parser, char *val) { /* Save the starting value of NEXT, first adjusting it so that the arg we're parsing is again the front of the arg vector. */ int index = --parser->state.next; error_t err = EBADKEY; struct group *group; int key = 0; /* Which of ARGP_KEY_ARG[S] we used. */ /* Try to parse the argument in each parser. */ for (group = parser->groups ; group < parser->egroup && err == EBADKEY ; group++) { parser->state.next++; /* For ARGP_KEY_ARG, consume the arg. */ key = ARGP_KEY_ARG; err = group_parse (group, &parser->state, key, val); if (err == EBADKEY) /* This parser doesn't like ARGP_KEY_ARG; try ARGP_KEY_ARGS instead. */ { parser->state.next--; /* For ARGP_KEY_ARGS, put back the arg. */ key = ARGP_KEY_ARGS; err = group_parse (group, &parser->state, key, 0); } } if (! err) { if (key == ARGP_KEY_ARGS) /* The default for ARGP_KEY_ARGS is to assume that if NEXT isn't changed by the user, *all* arguments should be considered consumed. */ parser->state.next = parser->state.argc; if (parser->state.next > index) /* Remember that we successfully processed a non-option argument -- but only if the user hasn't gotten tricky and set the clock back. */ (--group)->args_processed += (unsigned) (parser->state.next - index); else /* The user wants to reparse some args, give getopt another try. */ parser->try_getopt = 1; } return err; } /* Call the user parsers to parse the option OPT, with argument VAL, at the current position, returning any error. */ static error_t parser_parse_opt (struct parser *parser, int opt, char *val) { /* The group key encoded in the high bits; 0 for short opts or group_number + 1 for long opts. */ int group_key = opt >> USER_BITS; error_t err = EBADKEY; (void) val; if (group_key == 0) /* A short option. By comparing OPT's position in SHORT_OPTS to the various starting positions in each group's SHORT_END field, we can determine which group OPT came from. */ { struct group *group; char *short_index = strchr (parser->short_opts, opt); if (short_index) for (group = parser->groups; group < parser->egroup; group++) if (group->short_end > short_index) { err = group_parse (group, &parser->state, opt, parser->opt_data.optarg); break; } } else { int user_key = ((opt & (1 << (USER_BITS - 1))) ? ~USER_MASK : 0) | (opt & USER_MASK); err = group_parse (&parser->groups[group_key - 1], &parser->state, user_key, parser->opt_data.optarg); } if (err == EBADKEY) /* At least currently, an option not recognized is an error in the parser, because we pre-compute which parser is supposed to deal with each option. */ { static const char bad_key_err[] = N_("(PROGRAM ERROR) Option should have been recognized!?"); if (group_key == 0) __argp_error (&parser->state, "-%c: %s", opt, dgettext (parser->argp->argp_domain, bad_key_err)); else { struct option *long_opt = parser->long_opts; while (long_opt->val != opt && long_opt->name) long_opt++; __argp_error (&parser->state, "--%s: %s", long_opt->name ? long_opt->name : "???", dgettext (parser->argp->argp_domain, bad_key_err)); } } return err; } /* Parse the next argument in PARSER (as indicated by PARSER->state.next). Any error from the parsers is returned, and *ARGP_EBADKEY indicates whether a value of EBADKEY is due to an unrecognized argument (which is generally not fatal). */ static error_t parser_parse_next (struct parser *parser, int *arg_ebadkey) { int opt; error_t err = 0; if (parser->state.quoted && parser->state.next < parser->state.quoted) /* The next argument pointer has been moved to before the quoted region, so pretend we never saw the quoting `--', and give getopt another chance. If the user hasn't removed it, getopt will just process it again. */ parser->state.quoted = 0; if (parser->try_getopt && !parser->state.quoted) /* Give getopt a chance to parse this. */ { /* Put it back in OPTIND for getopt. */ parser->opt_data.optind = parser->state.next; /* Distinguish KEY_ERR from a real option. */ parser->opt_data.optopt = KEY_END; if (parser->state.flags & ARGP_LONG_ONLY) opt = _getopt_long_only_r (parser->state.argc, parser->state.argv, parser->short_opts, parser->long_opts, 0, &parser->opt_data); else opt = _getopt_long_r (parser->state.argc, parser->state.argv, parser->short_opts, parser->long_opts, 0, &parser->opt_data); /* And see what getopt did. */ parser->state.next = parser->opt_data.optind; if (opt == KEY_END) /* Getopt says there are no more options, so stop using getopt; we'll continue if necessary on our own. */ { parser->try_getopt = 0; if (parser->state.next > 1 && strcmp (parser->state.argv[parser->state.next - 1], QUOTE) == 0) /* Not only is this the end of the options, but it's a `quoted' region, which may have args that *look* like options, so we definitely shouldn't try to use getopt past here, whatever happens. */ parser->state.quoted = parser->state.next; } else if (opt == KEY_ERR && parser->opt_data.optopt != KEY_END) /* KEY_ERR can have the same value as a valid user short option, but in the case of a real error, getopt sets OPTOPT to the offending character, which can never be KEY_END. */ { *arg_ebadkey = 0; return EBADKEY; } } else opt = KEY_END; if (opt == KEY_END) { /* We're past what getopt considers the options. */ if (parser->state.next >= parser->state.argc || (parser->state.flags & ARGP_NO_ARGS)) /* Indicate that we're done. */ { *arg_ebadkey = 1; return EBADKEY; } else /* A non-option arg; simulate what getopt might have done. */ { opt = KEY_ARG; parser->opt_data.optarg = parser->state.argv[parser->state.next++]; } } if (opt == KEY_ARG) /* A non-option argument; try each parser in turn. */ err = parser_parse_arg (parser, parser->opt_data.optarg); else err = parser_parse_opt (parser, opt, parser->opt_data.optarg); if (err == EBADKEY) *arg_ebadkey = (opt == KEY_END || opt == KEY_ARG); return err; } /* Parse the options strings in ARGC & ARGV according to the argp in ARGP. FLAGS is one of the ARGP_ flags above. If END_INDEX is non-NULL, the index in ARGV of the first unparsed option is returned in it. If an unknown option is present, EINVAL is returned; if some parser routine returned a non-zero value, it is returned; otherwise 0 is returned. */ error_t __argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags, int *end_index, void *input) { error_t err; struct parser parser; /* If true, then err == EBADKEY is a result of a non-option argument failing to be parsed (which in some cases isn't actually an error). */ int arg_ebadkey = 0; #ifndef _LIBC if (!(flags & ARGP_PARSE_ARGV0)) { #ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME if (!program_invocation_name) program_invocation_name = argv[0]; #endif #ifdef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME if (!program_invocation_short_name) program_invocation_short_name = __argp_base_name (argv[0]); #endif } #endif if (! (flags & ARGP_NO_HELP)) /* Add our own options. */ { struct argp_child *child = alloca (4 * sizeof (struct argp_child)); struct argp *top_argp = alloca (sizeof (struct argp)); /* TOP_ARGP has no options, it just serves to group the user & default argps. */ memset (top_argp, 0, sizeof (*top_argp)); top_argp->children = child; memset (child, 0, 4 * sizeof (struct argp_child)); if (argp) (child++)->argp = argp; (child++)->argp = &argp_default_argp; if (argp_program_version || argp_program_version_hook) (child++)->argp = &argp_version_argp; child->argp = 0; argp = top_argp; } /* Construct a parser for these arguments. */ err = parser_init (&parser, argp, argc, argv, (int) flags, input); if (! err) /* Parse! */ { while (! err) err = parser_parse_next (&parser, &arg_ebadkey); err = parser_finalize (&parser, err, arg_ebadkey, end_index); } return err; } #ifdef weak_alias weak_alias (__argp_parse, argp_parse) #endif /* Return the input field for ARGP in the parser corresponding to STATE; used by the help routines. */ void * __argp_input (const struct argp *argp, const struct argp_state *state) { if (state) { struct group *group; struct parser *parser = state->pstate; for (group = parser->groups; group < parser->egroup; group++) if (group->argp == argp) return group->input; } return 0; } #ifdef weak_alias weak_alias (__argp_input, _argp_input) #endif blame-1.4-20240206/lib/exit.h0000644000000000000000000000205710527555557013745 0ustar rootroot/* exit() function. Copyright (C) 1995, 2001 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. */ #ifndef _EXIT_H #define _EXIT_H /* Get exit() declaration. */ #include /* Some systems do not define EXIT_*, despite otherwise supporting C89. */ #ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 #endif #ifndef EXIT_FAILURE # define EXIT_FAILURE 1 #endif #endif /* _EXIT_H */ blame-1.4-20240206/lib/lstat.c0000644000000000000000000000530510527555557014115 0ustar rootroot/* Work around a bug of lstat on some systems Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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. */ /* written by Jim Meyering */ #include /* The specification of these functions is in sys_stat.h. But we cannot include this include file here, because on some systems, a "#define lstat lstat64" is being used, and sys_stat.h deletes this definition. */ #include #include #include #include /* lstat works differently on Linux and Solaris systems. POSIX (see `pathname resolution' in the glossary) requires that programs like `ls' take into consideration the fact that FILE has a trailing slash when FILE is a symbolic link. On Linux and Solaris 10 systems, the lstat function already has the desired semantics (in treating `lstat ("symlink/", sbuf)' just like `lstat ("symlink/.", sbuf)', but on Solaris 9 and earlier it does not. If FILE has a trailing slash and specifies a symbolic link, then use stat() to get more info on the referent of FILE. If the referent is a non-directory, then set errno to ENOTDIR and return -1. Otherwise, return stat's result. */ int rpl_lstat (const char *file, struct stat *sbuf) { size_t len; int lstat_result = lstat (file, sbuf); if (lstat_result != 0 || !S_ISLNK (sbuf->st_mode)) return lstat_result; len = strlen (file); if (len == 0 || file[len - 1] != '/') return 0; /* FILE refers to a symbolic link and the name ends with a slash. Call stat() to get info about the link's referent. */ /* If stat fails, then we do the same. */ if (stat (file, sbuf) != 0) return -1; /* If FILE references a directory, return 0. */ if (S_ISDIR (sbuf->st_mode)) return 0; /* Here, we know stat succeeded and FILE references a non-directory. But it was specified via a name including a trailing slash. Fail with errno set to ENOTDIR to indicate the contradiction. */ errno = ENOTDIR; return -1; } blame-1.4-20240206/lib/sysexit_.h0000644000000000000000000000245410527555560014636 0ustar rootroot/* exit() exit codes for some BSD system programs. Copyright (C) 2003, 2006 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. */ /* Written by Simon Josefsson based on sysexits(3) man page */ #ifndef _SYSEXITS_H #define _SYSEXITS_H #define EX_OK 0 /* same value as EXIT_SUCCESS */ #define EX_USAGE 64 #define EX_DATAERR 65 #define EX_NOINPUT 66 #define EX_NOUSER 67 #define EX_NOHOST 68 #define EX_UNAVAILABLE 69 #define EX_SOFTWARE 70 #define EX_OSERR 71 #define EX_OSFILE 72 #define EX_CANTCREAT 73 #define EX_IOERR 74 #define EX_TEMPFAIL 75 #define EX_PROTOCOL 76 #define EX_NOPERM 77 #define EX_CONFIG 78 #endif /* _SYSEXITS_H */ blame-1.4-20240206/lib/allocsa.c0000644000000000000000000001135610527555557014407 0ustar rootroot/* Safe automatic memory allocation. Copyright (C) 2003, 2006 Free Software Foundation, Inc. Written by Bruno Haible , 2003. 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. */ #include /* Specification. */ #include "allocsa.h" /* The speed critical point in this file is freesa() applied to an alloca() result: it must be fast, to match the speed of alloca(). The speed of mallocsa() and freesa() in the other case are not critical, because they are only invoked for big memory sizes. */ #if HAVE_ALLOCA /* Store the mallocsa() results in a hash table. This is needed to reliably distinguish a mallocsa() result and an alloca() result. Although it is possible that the same pointer is returned by alloca() and by mallocsa() at different times in the same application, it does not lead to a bug in freesa(), because: - Before a pointer returned by alloca() can point into malloc()ed memory, the function must return, and once this has happened the programmer must not call freesa() on it anyway. - Before a pointer returned by mallocsa() can point into the stack, it must be freed. The only function that can free it is freesa(), and when freesa() frees it, it also removes it from the hash table. */ #define MAGIC_NUMBER 0x1415fb4a #define MAGIC_SIZE sizeof (int) /* This is how the header info would look like without any alignment considerations. */ struct preliminary_header { void *next; char room[MAGIC_SIZE]; }; /* But the header's size must be a multiple of sa_alignment_max. */ #define HEADER_SIZE \ (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max) struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; }; /* Verify that HEADER_SIZE == sizeof (struct header). */ typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1]; /* We make the hash table quite big, so that during lookups the probability of empty hash buckets is quite high. There is no need to make the hash table resizable, because when the hash table gets filled so much that the lookup becomes slow, it means that the application has memory leaks. */ #define HASH_TABLE_SIZE 257 static void * mallocsa_results[HASH_TABLE_SIZE]; #endif void * mallocsa (size_t n) { #if HAVE_ALLOCA /* Allocate one more word, that serves as an indicator for malloc()ed memory, so that freesa() of an alloca() result is fast. */ size_t nplus = n + HEADER_SIZE; if (nplus >= n) { char *p = (char *) malloc (nplus); if (p != NULL) { size_t slot; p += HEADER_SIZE; /* Put a magic number into the indicator word. */ ((int *) p)[-1] = MAGIC_NUMBER; /* Enter p into the hash table. */ slot = (unsigned long) p % HASH_TABLE_SIZE; ((struct header *) (p - HEADER_SIZE))->next = mallocsa_results[slot]; mallocsa_results[slot] = p; return p; } } /* Out of memory. */ return NULL; #else # if !MALLOC_0_IS_NONNULL if (n == 0) n = 1; # endif return malloc (n); #endif } #if HAVE_ALLOCA void freesa (void *p) { /* mallocsa() may have returned NULL. */ if (p != NULL) { /* Attempt to quickly distinguish the mallocsa() result - which has a magic indicator word - and the alloca() result - which has an uninitialized indicator word. It is for this test that sa_increment additional bytes are allocated in the alloca() case. */ if (((int *) p)[-1] == MAGIC_NUMBER) { /* Looks like a mallocsa() result. To see whether it really is one, perform a lookup in the hash table. */ size_t slot = (unsigned long) p % HASH_TABLE_SIZE; void **chain = &mallocsa_results[slot]; for (; *chain != NULL;) { if (*chain == p) { /* Found it. Remove it from the hash table and free it. */ char *p_begin = (char *) p - HEADER_SIZE; *chain = ((struct header *) p_begin)->next; free (p_begin); return; } chain = &((struct header *) ((char *) *chain - HEADER_SIZE))->next; } } /* At this point, we know it was not a mallocsa() result. */ } } #endif blame-1.4-20240206/lib/obstack.c0000644000000000000000000003401310527555557014412 0ustar rootroot/* obstack.c - subroutines used implicitly by object stack macros Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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. */ #ifdef _LIBC # include # include #else # include # include "obstack.h" #endif /* NOTE BEFORE MODIFYING THIS FILE: This version number must be incremented whenever callers compiled using an old obstack.h can no longer properly call the functions in this obstack.c. */ #define OBSTACK_INTERFACE_VERSION 1 /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself, and the installed library supports the same library interface we do. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #include /* Random thing to get __GNU_LIBRARY__. */ #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 # include # if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #include #ifndef ELIDE_CODE # include /* Determine default alignment. */ union fooround { uintmax_t i; long double d; void *p; }; struct fooalign { char c; union fooround u; }; /* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. But in fact it might be less smart and round addresses to as much as DEFAULT_ROUNDING. So we prepare for it to do that. */ enum { DEFAULT_ALIGNMENT = offsetof (struct fooalign, u), DEFAULT_ROUNDING = sizeof (union fooround) }; /* When we copy a long block of data, this is the unit to do it with. On some machines, copying successive ints does not work; in such a case, redefine COPYING_UNIT to `long' (if that works) or `char' as a last resort. */ # ifndef COPYING_UNIT # define COPYING_UNIT int # endif /* The functions allocating more room by calling `obstack_chunk_alloc' jump to the handler pointed to by `obstack_alloc_failed_handler'. This can be set to a user defined function which should either abort gracefully or use longjump - but shouldn't return. This variable by default points to the internal function `print_and_abort'. */ static void print_and_abort (void); void (*obstack_alloc_failed_handler) (void) = print_and_abort; /* Exit value used when `print_and_abort' is used. */ # include # ifdef _LIBC int obstack_exit_failure = EXIT_FAILURE; # else # include "exitfail.h" # define obstack_exit_failure exit_failure # endif # ifdef _LIBC # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) /* A looong time ago (before 1994, anyway; we're not sure) this global variable was used by non-GNU-C macros to avoid multiple evaluation. The GNU C library still exports it because somebody might use it. */ struct obstack *_obstack_compat; compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0); # endif # endif /* Define a macro that either calls functions with the traditional malloc/free calling interface, or calls functions with the mmalloc/mfree interface (that adds an extra first argument), based on the state of use_extra_arg. For free, do not use ?:, since some compilers, like the MIPS compilers, do not allow (expr) ? void : void. */ # define CALL_CHUNKFUN(h, size) \ (((h) -> use_extra_arg) \ ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size))) # define CALL_FREEFUN(h, old_chunk) \ do { \ if ((h) -> use_extra_arg) \ (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ else \ (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \ } while (0) /* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). Objects start on multiples of ALIGNMENT (0 means use default). CHUNKFUN is the function to use to allocate chunks, and FREEFUN the function to free them. Return nonzero if successful, calls obstack_alloc_failed_handler if allocation fails. */ int _obstack_begin (struct obstack *h, int size, int alignment, void *(*chunkfun) (long), void (*freefun) (void *)) { register struct _obstack_chunk *chunk; /* points to new chunk */ if (alignment == 0) alignment = DEFAULT_ALIGNMENT; if (size == 0) /* Default size is what GNU malloc can fit in a 4096-byte block. */ { /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. Use the values for range checking, because if range checking is off, the extra bytes won't be missed terribly, but if range checking is on and we used a larger request, a whole extra 4096 bytes would be allocated. These number are irrelevant to the new GNU malloc. I suspect it is less sensitive to the size of the request. */ int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + 4 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)); size = 4096 - extra; } h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun; h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; h->chunk_size = size; h->alignment_mask = alignment - 1; h->use_extra_arg = 0; chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); if (!chunk) (*obstack_alloc_failed_handler) (); h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; /* The initial chunk now contains no empty object. */ h->maybe_empty_object = 0; h->alloc_failed = 0; return 1; } int _obstack_begin_1 (struct obstack *h, int size, int alignment, void *(*chunkfun) (void *, long), void (*freefun) (void *, void *), void *arg) { register struct _obstack_chunk *chunk; /* points to new chunk */ if (alignment == 0) alignment = DEFAULT_ALIGNMENT; if (size == 0) /* Default size is what GNU malloc can fit in a 4096-byte block. */ { /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. Use the values for range checking, because if range checking is off, the extra bytes won't be missed terribly, but if range checking is on and we used a larger request, a whole extra 4096 bytes would be allocated. These number are irrelevant to the new GNU malloc. I suspect it is less sensitive to the size of the request. */ int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + 4 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)); size = 4096 - extra; } h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun; h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; h->chunk_size = size; h->alignment_mask = alignment - 1; h->extra_arg = arg; h->use_extra_arg = 1; chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); if (!chunk) (*obstack_alloc_failed_handler) (); h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; /* The initial chunk now contains no empty object. */ h->maybe_empty_object = 0; h->alloc_failed = 0; return 1; } /* Allocate a new current chunk for the obstack *H on the assumption that LENGTH bytes need to be added to the current object, or a new object of length LENGTH allocated. Copies any partial object from the end of the old chunk to the beginning of the new one. */ void _obstack_newchunk (struct obstack *h, int length) { register struct _obstack_chunk *old_chunk = h->chunk; register struct _obstack_chunk *new_chunk; register long new_size; register long obj_size = h->next_free - h->object_base; register long i; long already; char *object_base; /* Compute size for new chunk. */ new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100; if (new_size < h->chunk_size) new_size = h->chunk_size; /* Allocate and initialize the new chunk. */ new_chunk = CALL_CHUNKFUN (h, new_size); if (!new_chunk) (*obstack_alloc_failed_handler) (); h->chunk = new_chunk; new_chunk->prev = old_chunk; new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; /* Compute an aligned object_base in the new chunk */ object_base = __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask); /* Move the existing object to the new chunk. Word at a time is fast and is safe if the object is sufficiently aligned. */ if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) { for (i = obj_size / sizeof (COPYING_UNIT) - 1; i >= 0; i--) ((COPYING_UNIT *)object_base)[i] = ((COPYING_UNIT *)h->object_base)[i]; /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, but that can cross a page boundary on a machine which does not do strict alignment for COPYING_UNITS. */ already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); } else already = 0; /* Copy remaining bytes one by one. */ for (i = already; i < obj_size; i++) object_base[i] = h->object_base[i]; /* If the object just copied was the only data in OLD_CHUNK, free that chunk and remove it from the chain. But not if that chunk might contain an empty object. */ if (! h->maybe_empty_object && (h->object_base == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, h->alignment_mask))) { new_chunk->prev = old_chunk->prev; CALL_FREEFUN (h, old_chunk); } h->object_base = object_base; h->next_free = h->object_base + obj_size; /* The new chunk certainly contains no empty object yet. */ h->maybe_empty_object = 0; } # ifdef _LIBC libc_hidden_def (_obstack_newchunk) # endif /* Return nonzero if object OBJ has been allocated from obstack H. This is here for debugging. If you use it in a program, you are probably losing. */ /* Suppress -Wmissing-prototypes warning. We don't want to declare this in obstack.h because it is just for debugging. */ int _obstack_allocated_p (struct obstack *h, void *obj); int _obstack_allocated_p (struct obstack *h, void *obj) { register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ register struct _obstack_chunk *plp; /* point to previous chunk if any */ lp = (h)->chunk; /* We use >= rather than > since the object cannot be exactly at the beginning of the chunk but might be an empty object exactly at the end of an adjacent chunk. */ while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) { plp = lp->prev; lp = plp; } return lp != 0; } /* Free objects in obstack H, including OBJ and everything allocate more recently than OBJ. If OBJ is zero, free everything in H. */ # undef obstack_free void __obstack_free (struct obstack *h, void *obj) { register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ register struct _obstack_chunk *plp; /* point to previous chunk if any */ lp = h->chunk; /* We use >= because there cannot be an object at the beginning of a chunk. But there can be an empty object at that address at the end of another chunk. */ while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) { plp = lp->prev; CALL_FREEFUN (h, lp); lp = plp; /* If we switch chunks, we can't tell whether the new current chunk contains an empty object, so assume that it may. */ h->maybe_empty_object = 1; } if (lp) { h->object_base = h->next_free = (char *) (obj); h->chunk_limit = lp->limit; h->chunk = lp; } else if (obj != 0) /* obj is not in any of the chunks! */ abort (); } # ifdef _LIBC /* Older versions of libc used a function _obstack_free intended to be called by non-GCC compilers. */ strong_alias (obstack_free, _obstack_free) # endif int _obstack_memory_used (struct obstack *h) { register struct _obstack_chunk* lp; register int nbytes = 0; for (lp = h->chunk; lp != 0; lp = lp->prev) { nbytes += lp->limit - (char *) lp; } return nbytes; } /* Define the error handler. */ # ifdef _LIBC # include # else # include "gettext.h" # endif # ifndef _ # define _(msgid) gettext (msgid) # endif # ifdef _LIBC # include # endif # ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif # endif static void __attribute__ ((noreturn)) print_and_abort (void) { /* Don't change any of these strings. Yes, it would be possible to add the newline to the string and use fputs or so. But this must not happen because the "memory exhausted" message appears in other places like this and the translation should be reused instead of creating a very similar string which requires a separate translation. */ # ifdef _LIBC (void) __fxprintf (NULL, "%s\n", _("memory exhausted")); # else fprintf (stderr, "%s\n", _("memory exhausted")); # endif exit (obstack_exit_failure); } #endif /* !ELIDE_CODE */ blame-1.4-20240206/lib/xstrndup.c0000644000000000000000000000231710527555557014655 0ustar rootroot/* Duplicate a bounded initial segment of a string, with out-of-memory checking. Copyright (C) 2003, 2006 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. */ #include /* Specification. */ #include "xstrndup.h" #include "strndup.h" #include "xalloc.h" /* Return a newly allocated copy of at most N bytes of STRING. In other words, return a copy of the initial segment of length N of STRING. */ char * xstrndup (const char *string, size_t n) { char *s = strndup (string, n); if (! s) xalloc_die (); return s; } blame-1.4-20240206/lib/getline.h0000644000000000000000000000210610337302606014376 0ustar rootroot/* getline.h --- Prototype for replacement getline function. Copyright (C) 2005 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. */ /* Written by Simon Josefsson. */ /* Get size_t, FILE, ssize_t. And getline, if available. */ # include # include # include #if !HAVE_DECL_GETLINE ssize_t getline (char **lineptr, size_t *n, FILE *stream); #endif /* !HAVE_GETLINE */ blame-1.4-20240206/lib/printf-parse.h0000644000000000000000000000416010241344120015352 0ustar rootroot/* Parse printf format string. Copyright (C) 1999, 2002-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. */ #ifndef _PRINTF_PARSE_H #define _PRINTF_PARSE_H #include "printf-args.h" /* Flags */ #define FLAG_GROUP 1 /* ' flag */ #define FLAG_LEFT 2 /* - flag */ #define FLAG_SHOWSIGN 4 /* + flag */ #define FLAG_SPACE 8 /* space flag */ #define FLAG_ALT 16 /* # flag */ #define FLAG_ZERO 32 /* arg_index value indicating that no argument is consumed. */ #define ARG_NONE (~(size_t)0) /* A parsed directive. */ typedef struct { const char* dir_start; const char* dir_end; int flags; const char* width_start; const char* width_end; size_t width_arg_index; const char* precision_start; const char* precision_end; size_t precision_arg_index; char conversion; /* d i o u x X f e E g G c s p n U % but not C S */ size_t arg_index; } char_directive; /* A parsed format string. */ typedef struct { size_t count; char_directive *dir; size_t max_width_length; size_t max_precision_length; } char_directives; /* Parses the format string. Fills in the number N of directives, and fills in directives[0], ..., directives[N-1], and sets directives[N].dir_start to the end of the format string. Also fills in the arg_type fields of the arguments and the needed count of arguments. */ #ifdef STATIC STATIC #else extern #endif int printf_parse (const char *format, char_directives *d, arguments *a); #endif /* _PRINTF_PARSE_H */ blame-1.4-20240206/lib/getcwd.c0000644000000000000000000002414710527555557014250 0ustar rootroot/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2004,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ #if !_LIBC # include # include "getcwd.h" #endif #include #include #include #include #include #include /* For AT_FDCWD on Solaris 9. */ #ifndef __set_errno # define __set_errno(val) (errno = (val)) #endif #include #ifndef _D_EXACT_NAMLEN # define _D_EXACT_NAMLEN(d) strlen ((d)->d_name) #endif #ifndef _D_ALLOC_NAMLEN # define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1) #endif #include #include #include #if _LIBC # ifndef mempcpy # define mempcpy __mempcpy # endif #else # include "mempcpy.h" #endif #include /* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its value exceeds INT_MAX, so its use as an int doesn't conform to the C standard, and GCC and Sun C complain in some cases. */ #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553 # undef AT_FDCWD # define AT_FDCWD (-3041965) #endif #ifdef ENAMETOOLONG # define is_ENAMETOOLONG(x) ((x) == ENAMETOOLONG) #else # define is_ENAMETOOLONG(x) 0 #endif #ifndef MAX # define MAX(a, b) ((a) < (b) ? (b) : (a)) #endif #ifndef MIN # define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif #ifndef PATH_MAX # ifdef MAXPATHLEN # define PATH_MAX MAXPATHLEN # else # define PATH_MAX 1024 # endif #endif #if D_INO_IN_DIRENT # define MATCHING_INO(dp, ino) ((dp)->d_ino == (ino)) #else # define MATCHING_INO(dp, ino) true #endif #if !_LIBC # define __getcwd getcwd # define __lstat lstat # define __closedir closedir # define __opendir opendir # define __readdir readdir #endif /* Get the name of the current working directory, and put it in SIZE bytes of BUF. Returns NULL if the directory couldn't be determined or SIZE was too small. If successful, returns BUF. In GNU, if BUF is NULL, an array is allocated with `malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary. */ char * __getcwd (char *buf, size_t size) { /* Lengths of big file name components and entire file names, and a deep level of file name nesting. These numbers are not upper bounds; they are merely large values suitable for initial allocations, designed to be large enough for most real-world uses. */ enum { BIG_FILE_NAME_COMPONENT_LENGTH = 255, BIG_FILE_NAME_LENGTH = MIN (4095, PATH_MAX - 1), DEEP_NESTING = 100 }; #ifdef AT_FDCWD int fd = AT_FDCWD; bool fd_needs_closing = false; #else char dots[DEEP_NESTING * sizeof ".." + BIG_FILE_NAME_COMPONENT_LENGTH + 1]; char *dotlist = dots; size_t dotsize = sizeof dots; size_t dotlen = 0; #endif DIR *dirstream = NULL; dev_t rootdev, thisdev; ino_t rootino, thisino; char *dir; register char *dirp; struct stat st; size_t allocated = size; size_t used; #if HAVE_PARTLY_WORKING_GETCWD && !defined AT_FDCWD /* The system getcwd works, except it sometimes fails when it shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT. If AT_FDCWD is not defined, the algorithm below is O(N**2) and this is much slower than the system getcwd (at least on GNU/Linux). So trust the system getcwd's results unless they look suspicious. */ # undef getcwd dir = getcwd (buf, size); if (dir || (errno != ERANGE && !is_ENAMETOOLONG (errno) && errno != ENOENT)) return dir; #endif if (size == 0) { if (buf != NULL) { __set_errno (EINVAL); return NULL; } allocated = BIG_FILE_NAME_LENGTH + 1; } if (buf == NULL) { dir = malloc (allocated); if (dir == NULL) return NULL; } else dir = buf; dirp = dir + allocated; *--dirp = '\0'; if (__lstat (".", &st) < 0) goto lose; thisdev = st.st_dev; thisino = st.st_ino; if (__lstat ("/", &st) < 0) goto lose; rootdev = st.st_dev; rootino = st.st_ino; while (!(thisdev == rootdev && thisino == rootino)) { struct dirent *d; dev_t dotdev; ino_t dotino; bool mount_point; int parent_status; size_t dirroom; size_t namlen; bool use_d_ino = true; /* Look at the parent directory. */ #ifdef AT_FDCWD fd = openat (fd, "..", O_RDONLY); if (fd < 0) goto lose; fd_needs_closing = true; parent_status = fstat (fd, &st); #else dotlist[dotlen++] = '.'; dotlist[dotlen++] = '.'; dotlist[dotlen] = '\0'; parent_status = __lstat (dotlist, &st); #endif if (parent_status != 0) goto lose; if (dirstream && __closedir (dirstream) != 0) { dirstream = NULL; goto lose; } /* Figure out if this directory is a mount point. */ dotdev = st.st_dev; dotino = st.st_ino; mount_point = dotdev != thisdev; /* Search for the last directory. */ #ifdef AT_FDCWD dirstream = fdopendir (fd); if (dirstream == NULL) goto lose; fd_needs_closing = false; #else dirstream = __opendir (dotlist); if (dirstream == NULL) goto lose; dotlist[dotlen++] = '/'; #endif for (;;) { /* Clear errno to distinguish EOF from error if readdir returns NULL. */ __set_errno (0); d = __readdir (dirstream); /* When we've iterated through all directory entries without finding one with a matching d_ino, rewind the stream and consider each name again, but this time, using lstat. This is necessary in a chroot on at least one system (glibc-2.3.6 + linux 2.6.12), where .., ../.., ../../.., etc. all had the same device number, yet the d_ino values for entries in / did not match those obtained via lstat. */ if (d == NULL && errno == 0 && use_d_ino) { use_d_ino = false; rewinddir (dirstream); d = __readdir (dirstream); } if (d == NULL) { if (errno == 0) /* EOF on dirstream, which can mean e.g., that the current directory has been removed. */ __set_errno (ENOENT); goto lose; } if (d->d_name[0] == '.' && (d->d_name[1] == '\0' || (d->d_name[1] == '.' && d->d_name[2] == '\0'))) continue; if (use_d_ino) { bool match = (MATCHING_INO (d, thisino) || mount_point); if (! match) continue; } { int entry_status; #ifdef AT_FDCWD entry_status = fstatat (fd, d->d_name, &st, AT_SYMLINK_NOFOLLOW); #else /* Compute size needed for this file name, or for the file name ".." in the same directory, whichever is larger. Room for ".." might be needed the next time through the outer loop. */ size_t name_alloc = _D_ALLOC_NAMLEN (d); size_t filesize = dotlen + MAX (sizeof "..", name_alloc); if (filesize < dotlen) goto memory_exhausted; if (dotsize < filesize) { /* My, what a deep directory tree you have, Grandma. */ size_t newsize = MAX (filesize, dotsize * 2); size_t i; if (newsize < dotsize) goto memory_exhausted; if (dotlist != dots) free (dotlist); dotlist = malloc (newsize); if (dotlist == NULL) goto lose; dotsize = newsize; i = 0; do { dotlist[i++] = '.'; dotlist[i++] = '.'; dotlist[i++] = '/'; } while (i < dotlen); } memcpy (dotlist + dotlen, d->d_name, _D_ALLOC_NAMLEN (d)); entry_status = __lstat (dotlist, &st); #endif /* We don't fail here if we cannot stat() a directory entry. This can happen when (network) file systems fail. If this entry is in fact the one we are looking for we will find out soon as we reach the end of the directory without having found anything. */ if (entry_status == 0 && S_ISDIR (st.st_mode) && st.st_dev == thisdev && st.st_ino == thisino) break; } } dirroom = dirp - dir; namlen = _D_EXACT_NAMLEN (d); if (dirroom <= namlen) { if (size != 0) { __set_errno (ERANGE); goto lose; } else { char *tmp; size_t oldsize = allocated; allocated += MAX (allocated, namlen); if (allocated < oldsize || ! (tmp = realloc (dir, allocated))) goto memory_exhausted; /* Move current contents up to the end of the buffer. This is guaranteed to be non-overlapping. */ dirp = memcpy (tmp + allocated - (oldsize - dirroom), tmp + dirroom, oldsize - dirroom); dir = tmp; } } dirp -= namlen; memcpy (dirp, d->d_name, namlen); *--dirp = '/'; thisdev = dotdev; thisino = dotino; } if (dirstream && __closedir (dirstream) != 0) { dirstream = NULL; goto lose; } if (dirp == &dir[allocated - 1]) *--dirp = '/'; #ifndef AT_FDCWD if (dotlist != dots) free (dotlist); #endif used = dir + allocated - dirp; memmove (dir, dirp, used); if (buf == NULL && size == 0) /* Ensure that the buffer is only as large as necessary. */ buf = realloc (dir, used); if (buf == NULL) /* Either buf was NULL all along, or `realloc' failed but we still have the original string. */ buf = dir; return buf; memory_exhausted: __set_errno (ENOMEM); lose: { int save = errno; if (dirstream) __closedir (dirstream); #ifdef AT_FDCWD if (fd_needs_closing) close (fd); #else if (dotlist != dots) free (dotlist); #endif if (buf == NULL) free (dir); __set_errno (save); } return NULL; } #ifdef weak_alias weak_alias (__getcwd, getcwd) #endif blame-1.4-20240206/lib/argp-pvh.c0000644000000000000000000000264310337302606014474 0ustar rootroot/* Default definition for ARGP_PROGRAM_VERSION_HOOK. Copyright (C) 1996, 1997, 1999, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ #ifdef HAVE_CONFIG_H # include #endif #include "argp.h" /* If set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which calls this function with a stream to print the version to and a pointer to the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ void (*argp_program_version_hook) (FILE *stream, struct argp_state *state) = NULL; blame-1.4-20240206/lib/strdup.h0000644000000000000000000000210410241344123014260 0ustar rootroot/* strdup.h -- duplicate a string Copyright (C) 2004 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. */ #ifndef STRDUP_H_ #define STRDUP_H_ /* Get strdup declaration, if available. */ #include #if defined HAVE_DECL_STRDUP && !HAVE_DECL_STRDUP && !defined strdup /* Duplicate S, returning an identical malloc'd string. */ extern char *strdup (const char *s); #endif #endif /* STRDUP_H_ */ blame-1.4-20240206/lib/calloc.c0000644000000000000000000000255210527555557014224 0ustar rootroot/* calloc() function that is glibc compatible. This wrapper function is required at least on Tru64 UNIX 5.1. Copyright (C) 2004, 2005, 2006 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. */ /* written by Jim Meyering */ #include #undef calloc #include /* Allocate and zero-fill an NxS-byte block of memory from the heap. If N or S is zero, allocate and zero-fill a 1-byte block. */ void * rpl_calloc (size_t n, size_t s) { size_t bytes; if (n == 0 || s == 0) return calloc (1, 1); /* Defend against buggy calloc implementations that mishandle size_t overflow. */ bytes = n * s; if (bytes / s != n) return NULL; return calloc (n, s); } blame-1.4-20240206/lib/getline.c0000644000000000000000000000202010527555557014404 0ustar rootroot/* getline.c --- Implementation of replacement getline function. Copyright (C) 2005, 2006 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. */ /* Written by Simon Josefsson. */ #include #include "getdelim.h" #include "getline.h" ssize_t getline (char **lineptr, size_t *n, FILE *stream) { return getdelim (lineptr, n, '\n', stream); } blame-1.4-20240206/lib/getdelim.h0000644000000000000000000000213310337302571014542 0ustar rootroot/* getdelim.h --- Prototype for replacement getdelim function. Copyright (C) 2005 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. */ /* Written by Simon Josefsson. */ /* Get size_t, FILE, ssize_t. And getdelim, if available. */ # include # include # include #if !HAVE_DECL_GETDELIM ssize_t getdelim (char **lineptr, size_t *n, int delimiter, FILE *stream); #endif /* !HAVE_GETDELIM */ blame-1.4-20240206/lib/mbuiter.h0000644000000000000000000001521414560254740014431 0ustar rootroot/* Iterating through multibyte strings: macros for multi-byte encodings. Copyright (C) 2001, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Bruno Haible . */ /* The macros in this file implement forward iteration through a multi-byte string, without knowing its length a-priori. With these macros, an iteration loop that looks like char *iter; for (iter = buf; *iter != '\0'; iter++) { do_something (*iter); } becomes mbui_iterator_t iter; for (mbui_init (iter, buf); mbui_avail (iter); mbui_advance (iter)) { do_something (mbui_cur_ptr (iter), mb_len (mbui_cur (iter))); } The benefit of these macros over plain use of mbrtowc is: - Handling of invalid multibyte sequences is possible without making the code more complicated, while still preserving the invalid multibyte sequences. Compared to mbiter.h, the macros here don't need to know the string's length a-priori. The downside is that at each step, the look-ahead that guards against overrunning the terminating '\0' is more expensive. The mbui_* macros are therefore suitable when there is a high probability that only the first few multibyte characters need to be inspected. Whereas the mbi_* macros are better if usually the iteration runs through the entire string. mbui_iterator_t is a type usable for variable declarations. mbui_init (iter, startptr) initializes the iterator, starting at startptr. mbui_avail (iter) returns true if there are more multibyte characters available before the end of string is reached. In this case, mbui_cur (iter) is initialized to the next multibyte character. mbui_advance (iter) advances the iterator by one multibyte character. mbui_cur (iter) returns the current multibyte character, of type mbchar_t. All the macros defined in mbchar.h can be used on it. mbui_cur_ptr (iter) return a pointer to the beginning of the current multibyte character. mbui_reloc (iter, ptrdiff) relocates iterator when the string is moved by ptrdiff bytes. Here are the function prototypes of the macros. extern void mbui_init (mbui_iterator_t iter, const char *startptr); extern bool mbui_avail (mbui_iterator_t iter); extern void mbui_advance (mbui_iterator_t iter); extern mbchar_t mbui_cur (mbui_iterator_t iter); extern const char * mbui_cur_ptr (mbui_iterator_t iter); extern void mbui_reloc (mbui_iterator_t iter, ptrdiff_t ptrdiff); */ #ifndef _MBUITER_H #define _MBUITER_H 1 #include #include #include /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.1 has a bug: and must be included before . */ #include #include #include #include "mbchar.h" #include "strnlen1.h" struct mbuiter_multi { bool in_shift; /* true if next byte may not be interpreted as ASCII */ mbstate_t state; /* if in_shift: current shift state */ bool next_done; /* true if mbui_avail has already filled the following */ struct mbchar cur; /* the current character: const char *cur.ptr pointer to current character The following are only valid after mbui_avail. size_t cur.bytes number of bytes of current character bool cur.wc_valid true if wc is a valid wide character wchar_t cur.wc if wc_valid: the current character */ }; static inline void mbuiter_multi_next (struct mbuiter_multi *iter) { if (iter->next_done) return; if (iter->in_shift) goto with_shift; /* Handle most ASCII characters quickly, without calling mbrtowc(). */ if (is_basic (*iter->cur.ptr)) { /* These characters are part of the basic character set. ISO C 99 guarantees that their wide character code is identical to their char code. */ iter->cur.bytes = 1; iter->cur.wc = *iter->cur.ptr; iter->cur.wc_valid = true; } else { assert (mbsinit (&iter->state)); iter->in_shift = true; with_shift: iter->cur.bytes = mbrtowc (&iter->cur.wc, iter->cur.ptr, strnlen1 (iter->cur.ptr, MB_CUR_MAX), &iter->state); if (iter->cur.bytes == (size_t) -1) { /* An invalid multibyte sequence was encountered. */ iter->cur.bytes = 1; iter->cur.wc_valid = false; /* Whether to set iter->in_shift = false and reset iter->state or not is not very important; the string is bogus anyway. */ } else if (iter->cur.bytes == (size_t) -2) { /* An incomplete multibyte character at the end. */ iter->cur.bytes = strlen (iter->cur.ptr); iter->cur.wc_valid = false; /* Whether to set iter->in_shift = false and reset iter->state or not is not important; the string end is reached anyway. */ } else { if (iter->cur.bytes == 0) { /* A null wide character was encountered. */ iter->cur.bytes = 1; assert (*iter->cur.ptr == '\0'); assert (iter->cur.wc == 0); } iter->cur.wc_valid = true; /* When in the initial state, we can go back treating ASCII characters more quickly. */ if (mbsinit (&iter->state)) iter->in_shift = false; } } iter->next_done = true; } static inline void mbuiter_multi_reloc (struct mbuiter_multi *iter, ptrdiff_t ptrdiff) { iter->cur.ptr += ptrdiff; } /* Iteration macros. */ typedef struct mbuiter_multi mbui_iterator_t; #define mbui_init(iter, startptr) \ ((iter).cur.ptr = (startptr), \ (iter).in_shift = false, memset (&(iter).state, '\0', sizeof (mbstate_t)), \ (iter).next_done = false) #define mbui_avail(iter) \ (mbuiter_multi_next (&(iter)), !mb_isnul ((iter).cur)) #define mbui_advance(iter) \ ((iter).cur.ptr += (iter).cur.bytes, (iter).next_done = false) /* Access to the current character. */ #define mbui_cur(iter) (iter).cur #define mbui_cur_ptr(iter) (iter).cur.ptr /* Relocation. */ #define mbui_reloc(iter, ptrdiff) mbuiter_multi_reloc (&iter, ptrdiff) #endif /* _MBUITER_H */ blame-1.4-20240206/lib/xgetcwd.c0000644000000000000000000000234210527555560014423 0ustar rootroot/* xgetcwd.c -- return current directory with unlimited length Copyright (C) 2001, 2003, 2004, 2006 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. */ /* Written by Jim Meyering. */ #include #include "xgetcwd.h" #include #include "getcwd.h" #include "xalloc.h" /* Return the current directory, newly allocated. Upon an out-of-memory error, call xalloc_die. Upon any other type of error, return NULL. */ char * xgetcwd (void) { char *cwd = getcwd (NULL, 0); if (! cwd && errno == ENOMEM) xalloc_die (); return cwd; } blame-1.4-20240206/lib/realloc.c0000644000000000000000000000245110527555557014406 0ustar rootroot/* realloc() function that is glibc compatible. Copyright (C) 1997, 2003, 2004, 2006 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. */ /* written by Jim Meyering */ #include #undef realloc #include /* Change the size of an allocated block of memory P to N bytes, with error checking. If N is zero, change it to 1. If P is NULL, use malloc. */ void * rpl_realloc (void *p, size_t n) { if (n == 0) { n = 1; /* In theory realloc might fail, so don't rely on it to free. */ free (p); p = NULL; } if (p == NULL) return malloc (n); return realloc (p, n); } blame-1.4-20240206/lib/mbchar.c0000644000000000000000000000227410527555557014224 0ustar rootroot/* Copyright (C) 2001, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include "mbchar.h" #if IS_BASIC_ASCII /* Bit table of characters in the ISO C "basic character set". */ const unsigned int is_basic_table [UCHAR_MAX / 32 + 1] = { 0x00001a00, /* '\t' '\v' '\f' */ 0xffffffef, /* ' '...'#' '%'...'?' */ 0xfffffffe, /* 'A'...'Z' '[' '\\' ']' '^' '_' */ 0x7ffffffe /* 'a'...'z' '{' '|' '}' '~' */ /* The remaining bits are 0. */ }; #endif /* IS_BASIC_ASCII */ blame-1.4-20240206/lib/stdint_.h0000644000000000000000000003265210527555557014444 0ustar rootroot/* Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. 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. */ #ifndef _GL_STDINT_H #define _GL_STDINT_H /* * ISO C 99 for platforms that lack it. * */ /* Get those types that are already defined in other system include files, so that we can "#define int8_t signed char" below without worrying about a later system include file containing a "typedef signed char int8_t;" that will get messed up by our macro. Our macros should all be consistent with the system versions, except for the "fast" types and macros, which we recommend against using in public interfaces due to compiler differences. */ #if @HAVE_STDINT_H@ # if defined __sgi && ! defined __c99 /* Bypass IRIX's if in C89 mode, since it merely annoys users with "This header file is to be used only for c99 mode compilations" diagnostics. */ # define __STDINT_H__ # endif /* Other systems may have an incomplete or buggy . Include it before , since any "#include " in would reinclude us, skipping our contents because _GL_STDINT_H is defined. */ # include @ABSOLUTE_STDINT_H@ #endif /* defines some of the stdint.h types as well, on glibc, IRIX 6.5, and OpenBSD 3.8 (via ). AIX 5.2 isn't needed and causes troubles. MacOS X 10.4.6 includes (which is us), but relies on the system definitions, so include after @ABSOLUTE_STDINT_H@. */ #if @HAVE_SYS_TYPES_H@ && ! defined _AIX # include #endif /* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ #include #if @HAVE_INTTYPES_H@ /* In OpenBSD 3.8, includes , which defines int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. also defines intptr_t and uintptr_t. */ # define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H # include # undef _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H #elif @HAVE_SYS_INTTYPES_H@ /* Solaris 7 has the types except the *_fast*_t types, and the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ # include #endif #if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ /* Linux libc4 >= 4.6.7 and libc5 have a that defines int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is included by . */ # include #endif #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS /* Get WCHAR_MIN, WCHAR_MAX. */ # if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) /* BSD/OS 4.1 has a bug: and must be included before . */ # include # include # include # endif #endif /* Minimum and maximum values for a integer type under the usual assumption. Return an unspecified value if BITS == 0, adding a check to pacify picky compilers. */ #define _STDINT_MIN(signed, bits, zero) \ ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) #define _STDINT_MAX(signed, bits, zero) \ ((signed) \ ? ~ _STDINT_MIN (signed, bits, zero) \ : ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1) /* 7.18.1.1. Exact-width integer types */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. */ #undef int8_t #undef uint8_t #define int8_t signed char #define uint8_t unsigned char #undef int16_t #undef uint16_t #define int16_t short int #define uint16_t unsigned short int #undef int32_t #undef uint32_t #define int32_t int #define uint32_t unsigned int #undef int64_t #if LONG_MAX >> 31 >> 31 == 1 # define int64_t long int #elif defined _MSC_VER # define int64_t __int64 #elif @HAVE_LONG_LONG_INT@ # define int64_t long long int #endif #undef uint64_t #if ULONG_MAX >> 31 >> 31 >> 1 == 1 # define uint64_t unsigned long int #elif defined _MSC_VER # define uint64_t unsigned __int64 #elif @HAVE_UNSIGNED_LONG_LONG_INT@ # define uint64_t unsigned long long int #endif /* Avoid collision with Solaris 2.5.1 etc. */ #define _UINT8_T #define _UINT32_T #define _UINT64_T /* 7.18.1.2. Minimum-width integer types */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types are the same as the corresponding N_t types. */ #undef int_least8_t #undef uint_least8_t #undef int_least16_t #undef uint_least16_t #undef int_least32_t #undef uint_least32_t #undef int_least64_t #undef uint_least64_t #define int_least8_t int8_t #define uint_least8_t uint8_t #define int_least16_t int16_t #define uint_least16_t uint16_t #define int_least32_t int32_t #define uint_least32_t uint32_t #ifdef int64_t # define int_least64_t int64_t #endif #ifdef uint64_t # define uint_least64_t uint64_t #endif /* 7.18.1.3. Fastest minimum-width integer types */ /* Note: Other substitutes may define these types differently. It is not recommended to use these types in public header files. */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types are taken from the same list of types. Assume that 'long int' is fast enough for all narrower integers. */ #undef int_fast8_t #undef uint_fast8_t #undef int_fast16_t #undef uint_fast16_t #undef int_fast32_t #undef uint_fast32_t #undef int_fast64_t #undef uint_fast64_t #define int_fast8_t long int #define uint_fast8_t unsigned int_fast8_t #define int_fast16_t long int #define uint_fast16_t unsigned int_fast16_t #define int_fast32_t long int #define uint_fast32_t unsigned int_fast32_t #ifdef int64_t # define int_fast64_t int64_t #endif #ifdef uint64_t # define uint_fast64_t uint64_t #endif /* 7.18.1.4. Integer types capable of holding object pointers */ #undef intptr_t #undef uintptr_t #define intptr_t long int #define uintptr_t unsigned long int /* 7.18.1.5. Greatest-width integer types */ /* Note: These types are compiler dependent. It may be unwise to use them in public header files. */ #undef intmax_t #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 # define intmax_t long long int #elif defined int64_t # define intmax_t int64_t #else # define intmax_t long int #endif #undef uintmax_t #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 # define uintmax_t unsigned long long int #elif defined uint64_t # define uintmax_t uint64_t #else # define uintmax_t unsigned long int #endif /* 7.18.2. Limits of specified-width integer types */ #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS /* 7.18.2.1. Limits of exact-width integer types */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. */ #undef INT8_MIN #undef INT8_MAX #undef UINT8_MAX #define INT8_MIN (~ INT8_MAX) #define INT8_MAX 127 #define UINT8_MAX 255 #undef INT16_MIN #undef INT16_MAX #undef UINT16_MAX #define INT16_MIN (~ INT16_MAX) #define INT16_MAX 32767 #define UINT16_MAX 65535 #undef INT32_MIN #undef INT32_MAX #undef UINT32_MAX #define INT32_MIN (~ INT32_MAX) #define INT32_MAX 2147483647 #define UINT32_MAX 4294967295U #undef INT64_MIN #undef INT64_MAX #ifdef int64_t # define INT64_MIN (~ INT64_MAX) # define INT64_MAX INTMAX_C (9223372036854775807) #endif #undef UINT64_MAX #ifdef uint64_t # define UINT64_MAX UINTMAX_C (18446744073709551615) #endif /* 7.18.2.2. Limits of minimum-width integer types */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types are the same as the corresponding N_t types. */ #undef INT_LEAST8_MIN #undef INT_LEAST8_MAX #undef UINT_LEAST8_MAX #define INT_LEAST8_MIN INT8_MIN #define INT_LEAST8_MAX INT8_MAX #define UINT_LEAST8_MAX UINT8_MAX #undef INT_LEAST16_MIN #undef INT_LEAST16_MAX #undef UINT_LEAST16_MAX #define INT_LEAST16_MIN INT16_MIN #define INT_LEAST16_MAX INT16_MAX #define UINT_LEAST16_MAX UINT16_MAX #undef INT_LEAST32_MIN #undef INT_LEAST32_MAX #undef UINT_LEAST32_MAX #define INT_LEAST32_MIN INT32_MIN #define INT_LEAST32_MAX INT32_MAX #define UINT_LEAST32_MAX UINT32_MAX #undef INT_LEAST64_MIN #undef INT_LEAST64_MAX #ifdef int64_t # define INT_LEAST64_MIN INT64_MIN # define INT_LEAST64_MAX INT64_MAX #endif #undef UINT_LEAST64_MAX #ifdef uint64_t # define UINT_LEAST64_MAX UINT64_MAX #endif /* 7.18.2.3. Limits of fastest minimum-width integer types */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types are taken from the same list of types. */ #undef INT_FAST8_MIN #undef INT_FAST8_MAX #undef UINT_FAST8_MAX #define INT_FAST8_MIN LONG_MIN #define INT_FAST8_MAX LONG_MAX #define UINT_FAST8_MAX ULONG_MAX #undef INT_FAST16_MIN #undef INT_FAST16_MAX #undef UINT_FAST16_MAX #define INT_FAST16_MIN LONG_MIN #define INT_FAST16_MAX LONG_MAX #define UINT_FAST16_MAX ULONG_MAX #undef INT_FAST32_MIN #undef INT_FAST32_MAX #undef UINT_FAST32_MAX #define INT_FAST32_MIN LONG_MIN #define INT_FAST32_MAX LONG_MAX #define UINT_FAST32_MAX ULONG_MAX #undef INT_FAST64_MIN #undef INT_FAST64_MAX #ifdef int64_t # define INT_FAST64_MIN INT64_MIN # define INT_FAST64_MAX INT64_MAX #endif #undef UINT_FAST64_MAX #ifdef uint64_t # define UINT_FAST64_MAX UINT64_MAX #endif /* 7.18.2.4. Limits of integer types capable of holding object pointers */ #undef INTPTR_MIN #undef INTPTR_MAX #undef UINTPTR_MAX #define INTPTR_MIN LONG_MIN #define INTPTR_MAX LONG_MAX #define UINTPTR_MAX ULONG_MAX /* 7.18.2.5. Limits of greatest-width integer types */ #undef INTMAX_MIN #undef INTMAX_MAX #define INTMAX_MIN (~ INTMAX_MAX) #ifdef INT64_MAX # define INTMAX_MAX INT64_MAX #else # define INTMAX_MAX INT32_MAX #endif #undef UINTMAX_MAX #ifdef UINT64_MAX # define UINTMAX_MAX UINT64_MAX #else # define UINTMAX_MAX UINT32_MAX #endif /* 7.18.3. Limits of other integer types */ /* ptrdiff_t limits */ #undef PTRDIFF_MIN #undef PTRDIFF_MAX #define PTRDIFF_MIN \ _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) #define PTRDIFF_MAX \ _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) /* sig_atomic_t limits */ #undef SIG_ATOMIC_MIN #undef SIG_ATOMIC_MAX #define SIG_ATOMIC_MIN \ _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ 0@SIG_ATOMIC_T_SUFFIX@) #define SIG_ATOMIC_MAX \ _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ 0@SIG_ATOMIC_T_SUFFIX@) /* size_t limit */ #undef SIZE_MAX #define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) /* wchar_t limits */ #undef WCHAR_MIN #undef WCHAR_MAX #define WCHAR_MIN \ _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) #define WCHAR_MAX \ _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) /* wint_t limits */ #undef WINT_MIN #undef WINT_MAX #define WINT_MIN \ _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) #define WINT_MAX \ _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) #endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ /* 7.18.4. Macros for integer constants */ #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS /* 7.18.4.1. Macros for minimum-width integer constants */ /* According to ISO C 99 Technical Corrigendum 1 */ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ #undef INT8_C #undef UINT8_C #define INT8_C(x) x #define UINT8_C(x) x #undef INT16_C #undef UINT16_C #define INT16_C(x) x #define UINT16_C(x) x #undef INT32_C #undef UINT32_C #define INT32_C(x) x #define UINT32_C(x) x ## U #undef INT64_C #undef UINT64_C #if LONG_MAX >> 31 >> 31 == 1 # define INT64_C(x) x##L #elif defined _MSC_VER # define INT64_C(x) x##i64 #elif @HAVE_LONG_LONG_INT@ # define INT64_C(x) x##LL #endif #if ULONG_MAX >> 31 >> 31 >> 1 == 1 # define UINT64_C(x) x##UL #elif defined _MSC_VER # define UINT64_C(x) x##ui64 #elif @HAVE_UNSIGNED_LONG_LONG_INT@ # define UINT64_C(x) x##ULL #endif /* 7.18.4.2. Macros for greatest-width integer constants */ #undef INTMAX_C #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 # define INTMAX_C(x) x##LL #elif defined int64_t # define INTMAX_C(x) INT64_C(x) #else # define INTMAX_C(x) x##L #endif #undef UINTMAX_C #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 # define UINTMAX_C(x) x##ULL #elif defined uint64_t # define UINTMAX_C(x) UINT64_C(x) #else # define UINTMAX_C(x) x##UL #endif #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ #endif /* _GL_STDINT_H */ blame-1.4-20240206/lib/progname.c0000644000000000000000000000333210527555557014574 0ustar rootroot/* Program name management. Copyright (C) 2001-2003, 2005-2006 Free Software Foundation, Inc. Written by Bruno Haible , 2001. 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. */ #include /* Specification. */ #undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */ #include "progname.h" #include /* String containing name the program is called with. To be initialized by main(). */ const char *program_name = NULL; /* Set program_name, based on argv[0]. */ void set_program_name (const char *argv0) { /* libtool creates a temporary executable whose name is sometimes prefixed with "lt-" (depends on the platform). It also makes argv[0] absolute. Remove this "/.libs/" or "/.libs/lt-" prefix here. */ const char *slash; const char *base; slash = strrchr (argv0, '/'); base = (slash != NULL ? slash + 1 : argv0); if (base - argv0 >= 7 && memcmp (base - 7, "/.libs/", 7) == 0) argv0 = base; if (strncmp (base, "lt-", 3) == 0) argv0 = base + 3; program_name = argv0; } blame-1.4-20240206/lib/time_r.h0000644000000000000000000000350410527555560014243 0ustar rootroot/* Reentrant time functions like localtime_r. Copyright (C) 2003, 2005, 2006 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. */ /* Written by Paul Eggert. */ #ifndef _TIME_R_H #define _TIME_R_H /* Include first, since it may declare these functions with signatures that disagree with POSIX, and we don't want to rename those declarations. */ #include #if !HAVE_TIME_R_POSIX /* Don't bother with asctime_r and ctime_r, since these functions are not safe (like asctime and ctime, they can overrun their 26-byte output buffers when given outlandish struct tm values), and we don't want to encourage applications to use unsafe functions. Use strftime or even sprintf instead. */ # undef gmtime_r # undef localtime_r # define gmtime_r rpl_gmtime_r # define localtime_r rpl_localtime_r /* See the POSIX:2001 specification . */ struct tm *gmtime_r (time_t const * restrict, struct tm * restrict); /* See the POSIX:2001 specification . */ struct tm *localtime_r (time_t const * restrict, struct tm * restrict); #endif #endif blame-1.4-20240206/lib/gettimeofday.c0000644000000000000000000000631510527555557015451 0ustar rootroot/* Work around the bug in some systems whereby gettimeofday clobbers the static buffer that localtime uses for it's return value. The gettimeofday function from Mac OS X 10.0.4, i.e. Darwin 1.3.7 has this problem. The tzset replacement is necessary for at least Solaris 2.5, 2.5.1, and 2.6. Copyright (C) 2001, 2002, 2003, 2006 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. */ /* written by Jim Meyering */ #include /* Disable the definitions of these functions (from config.h) so we can use the library versions here. */ #undef gettimeofday #undef gmtime #undef localtime #undef tzset #include #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include static struct tm *localtime_buffer_addr; /* This is a wrapper for localtime. It is used only on systems for which gettimeofday clobbers the static buffer used for localtime's result. On the first call, record the address of the static buffer that localtime uses for its result. */ struct tm * rpl_localtime (const time_t *timep) { struct tm *tm = localtime (timep); if (! localtime_buffer_addr) localtime_buffer_addr = tm; return tm; } /* Same as above, since gmtime and localtime use the same buffer. */ struct tm * rpl_gmtime (const time_t *timep) { struct tm *tm = gmtime (timep); if (! localtime_buffer_addr) localtime_buffer_addr = tm; return tm; } /* This is a wrapper for gettimeofday. It is used only on systems for which gettimeofday clobbers the static buffer used for localtime's result. Save and restore the contents of the buffer used for localtime's result around the call to gettimeofday. */ int rpl_gettimeofday (struct timeval *tv, struct timezone *tz) { struct tm save; int result; if (! localtime_buffer_addr) { time_t t = 0; localtime_buffer_addr = localtime (&t); } save = *localtime_buffer_addr; result = gettimeofday (tv, tz); *localtime_buffer_addr = save; return result; } /* This is a wrapper for tzset. It is used only on systems for which tzset may clobber the static buffer used for localtime's result. Save and restore the contents of the buffer used for localtime's result around the call to tzset. */ void rpl_tzset (void) { struct tm save; if (! localtime_buffer_addr) { time_t t = 0; localtime_buffer_addr = localtime (&t); } save = *localtime_buffer_addr; tzset (); *localtime_buffer_addr = save; } blame-1.4-20240206/lib/readlink.c0000644000000000000000000000306010527555557014553 0ustar rootroot/* Stub for readlink(). Copyright (C) 2003-2006 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. */ #include #include #include #include #include #if !HAVE_READLINK /* readlink() substitute for systems that don't have a readlink() function, such as DJGPP 2.03 and mingw32. */ /* The official POSIX return type of readlink() is ssize_t, but since here we have no declaration in a public header file, we use 'int' as return type. */ int readlink (const char *path, char *buf, size_t bufsize) { struct stat statbuf; /* In general we should use lstat() here, not stat(). But on platforms without symbolic links lstat() - if it exists - would be equivalent to stat(), therefore we can use stat(). This saves us a configure check. */ if (stat (path, &statbuf) >= 0) errno = EINVAL; return -1; } #endif blame-1.4-20240206/lib/dev-ino.h0000644000000000000000000000022410104544062014303 0ustar rootroot#ifndef DEV_INO_H # define DEV_INO_H 1 # include # include struct dev_ino { ino_t st_ino; dev_t st_dev; }; #endif blame-1.4-20240206/lib/filenamecat.c0000644000000000000000000000731214557310210015214 0ustar rootroot/* Concatenate two arbitrary file names. Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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. */ /* Written by Jim Meyering. */ #include /* Specification. */ #include "filenamecat.h" #include #include "dirname.h" #include "xalloc.h" #if ! HAVE_MEMPCPY && ! defined mempcpy # define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N))) #endif /* Return the longest suffix of F that is a relative file name. If it has no such suffix, return the empty string. */ static char const * longest_relative_suffix (char const *f) { for (f += FILE_SYSTEM_PREFIX_LEN (f); ISSLASH (*f); f++) continue; return f; } /* Concatenate two file name components, DIR and ABASE, in newly-allocated storage and return the result. The resulting file name F is such that the commands "ls F" and "(cd DIR; ls BASE)" refer to the same file, where BASE is ABASE with any file system prefixes and leading separators removed. Arrange for a directory separator if necessary between DIR and BASE in the result, removing any redundant separators. In any case, if BASE_IN_RESULT is non-NULL, set *BASE_IN_RESULT to point to the copy of ABASE in the returned concatenation. However, if ABASE begins with more than one slash, set *BASE_IN_RESULT to point to the sole corresponding slash that is copied into the result buffer. Report an error if memory is exhausted. */ char * file_name_concat (char const *dir, char const *abase, char **base_in_result) { char const *dirbase = last_component (dir); size_t dirbaselen = base_len (dirbase); size_t dirlen = (size_t) (dirbase - dir) + dirbaselen; size_t needs_separator = (dirbaselen && ! ISSLASH (dirbase[dirbaselen - 1])); char const *base = longest_relative_suffix (abase); size_t baselen = strlen (base); char *p_concat = xmalloc (dirlen + needs_separator + baselen + 1); char *p; p = mempcpy (p_concat, dir, dirlen); *p = DIRECTORY_SEPARATOR; p += needs_separator; if (base_in_result) *base_in_result = p - IS_ABSOLUTE_FILE_NAME (abase); p = mempcpy (p, base, baselen); *p = '\0'; return p_concat; } #ifdef TEST_FILE_NAME_CONCAT # include # include int main () { static char const *const tests[][3] = { {"a", "b", "a/b"}, {"a/", "b", "a/b"}, {"a/", "/b", "a/b"}, {"a", "/b", "a/b"}, {"/", "b", "/b"}, {"/", "/b", "/b"}, {"/", "/", "/"}, {"a", "/", "a/"}, /* this might deserve a diagnostic */ {"/a", "/", "/a/"}, /* this might deserve a diagnostic */ {"a", "//b", "a/b"}, }; size_t i; bool fail = false; for (i = 0; i < sizeof tests / sizeof tests[0]; i++) { char *base_in_result; char const *const *t = tests[i]; char *res = file_name_concat (t[0], t[1], &base_in_result); if (strcmp (res, t[2]) != 0) { printf ("got %s, expected %s\n", res, t[2]); fail = true; } } exit (fail ? EXIT_FAILURE : EXIT_SUCCESS); } #endif blame-1.4-20240206/lib/strpbrk.h0000644000000000000000000000175110241344123014435 0ustar rootroot/* Searching in a string. Copyright (C) 2001-2002 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. */ #if HAVE_STRPBRK /* Get strpbrk() declaration. */ #include #else /* Find the first occurrence in S of any character in ACCEPT. */ extern char *strpbrk (const char *s, const char *accept); #endif blame-1.4-20240206/lib/vasnprintf.c0000644000000000000000000005351510527555560015160 0ustar rootroot/* vsprintf with automatic memory allocation. Copyright (C) 1999, 2002-2006 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. */ /* Tell glibc's to provide a prototype for snprintf(). This must come before because may include , and once has been included, it's too late. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #include #ifndef IN_LIBINTL # include #endif /* Specification. */ #if WIDE_CHAR_VERSION # include "vasnwprintf.h" #else # include "vasnprintf.h" #endif #include /* snprintf(), sprintf() */ #include /* abort(), malloc(), realloc(), free() */ #include /* memcpy(), strlen() */ #include /* errno */ #include /* CHAR_BIT */ #include /* DBL_MAX_EXP, LDBL_MAX_EXP */ #if WIDE_CHAR_VERSION # include "wprintf-parse.h" #else # include "printf-parse.h" #endif /* Checked size_t computations. */ #include "xsize.h" #ifdef HAVE_WCHAR_T # ifdef HAVE_WCSLEN # define local_wcslen wcslen # else /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid a dependency towards this library, here is a local substitute. Define this substitute only once, even if this file is included twice in the same compilation unit. */ # ifndef local_wcslen_defined # define local_wcslen_defined 1 static size_t local_wcslen (const wchar_t *s) { const wchar_t *ptr; for (ptr = s; *ptr != (wchar_t) 0; ptr++) ; return ptr - s; } # endif # endif #endif #if WIDE_CHAR_VERSION # define VASNPRINTF vasnwprintf # define CHAR_T wchar_t # define DIRECTIVE wchar_t_directive # define DIRECTIVES wchar_t_directives # define PRINTF_PARSE wprintf_parse # define USE_SNPRINTF 1 # if HAVE_DECL__SNWPRINTF /* On Windows, the function swprintf() has a different signature than on Unix; we use the _snwprintf() function instead. */ # define SNPRINTF _snwprintf # else /* Unix. */ # define SNPRINTF swprintf # endif #else # define VASNPRINTF vasnprintf # define CHAR_T char # define DIRECTIVE char_directive # define DIRECTIVES char_directives # define PRINTF_PARSE printf_parse # define USE_SNPRINTF (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) # if HAVE_DECL__SNPRINTF /* Windows. */ # define SNPRINTF _snprintf # else /* Unix. */ # define SNPRINTF snprintf # endif #endif CHAR_T * VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list args) { DIRECTIVES d; arguments a; if (PRINTF_PARSE (format, &d, &a) < 0) { errno = EINVAL; return NULL; } #define CLEANUP() \ free (d.dir); \ if (a.arg) \ free (a.arg); if (printf_fetchargs (args, &a) < 0) { CLEANUP (); errno = EINVAL; return NULL; } { size_t buf_neededlength; CHAR_T *buf; CHAR_T *buf_malloced; const CHAR_T *cp; size_t i; DIRECTIVE *dp; /* Output string accumulator. */ CHAR_T *result; size_t allocated; size_t length; /* Allocate a small buffer that will hold a directive passed to sprintf or snprintf. */ buf_neededlength = xsum4 (7, d.max_width_length, d.max_precision_length, 6); #if HAVE_ALLOCA if (buf_neededlength < 4000 / sizeof (CHAR_T)) { buf = (CHAR_T *) alloca (buf_neededlength * sizeof (CHAR_T)); buf_malloced = NULL; } else #endif { size_t buf_memsize = xtimes (buf_neededlength, sizeof (CHAR_T)); if (size_overflow_p (buf_memsize)) goto out_of_memory_1; buf = (CHAR_T *) malloc (buf_memsize); if (buf == NULL) goto out_of_memory_1; buf_malloced = buf; } if (resultbuf != NULL) { result = resultbuf; allocated = *lengthp; } else { result = NULL; allocated = 0; } length = 0; /* Invariants: result is either == resultbuf or == NULL or malloc-allocated. If length > 0, then result != NULL. */ /* Ensures that allocated >= needed. Aborts through a jump to out_of_memory if needed is SIZE_MAX or otherwise too big. */ #define ENSURE_ALLOCATION(needed) \ if ((needed) > allocated) \ { \ size_t memory_size; \ CHAR_T *memory; \ \ allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ if ((needed) > allocated) \ allocated = (needed); \ memory_size = xtimes (allocated, sizeof (CHAR_T)); \ if (size_overflow_p (memory_size)) \ goto out_of_memory; \ if (result == resultbuf || result == NULL) \ memory = (CHAR_T *) malloc (memory_size); \ else \ memory = (CHAR_T *) realloc (result, memory_size); \ if (memory == NULL) \ goto out_of_memory; \ if (result == resultbuf && length > 0) \ memcpy (memory, result, length * sizeof (CHAR_T)); \ result = memory; \ } for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) { if (cp != dp->dir_start) { size_t n = dp->dir_start - cp; size_t augmented_length = xsum (length, n); ENSURE_ALLOCATION (augmented_length); memcpy (result + length, cp, n * sizeof (CHAR_T)); length = augmented_length; } if (i == d.count) break; /* Execute a single directive. */ if (dp->conversion == '%') { size_t augmented_length; if (!(dp->arg_index == ARG_NONE)) abort (); augmented_length = xsum (length, 1); ENSURE_ALLOCATION (augmented_length); result[length] = '%'; length = augmented_length; } else { if (!(dp->arg_index != ARG_NONE)) abort (); if (dp->conversion == 'n') { switch (a.arg[dp->arg_index].type) { case TYPE_COUNT_SCHAR_POINTER: *a.arg[dp->arg_index].a.a_count_schar_pointer = length; break; case TYPE_COUNT_SHORT_POINTER: *a.arg[dp->arg_index].a.a_count_short_pointer = length; break; case TYPE_COUNT_INT_POINTER: *a.arg[dp->arg_index].a.a_count_int_pointer = length; break; case TYPE_COUNT_LONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longint_pointer = length; break; #ifdef HAVE_LONG_LONG_INT case TYPE_COUNT_LONGLONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; break; #endif default: abort (); } } else { arg_type type = a.arg[dp->arg_index].type; CHAR_T *p; unsigned int prefix_count; int prefixes[2]; #if !USE_SNPRINTF size_t tmp_length; CHAR_T tmpbuf[700]; CHAR_T *tmp; /* Allocate a temporary buffer of sufficient size for calling sprintf. */ { size_t width; size_t precision; width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; width = (arg < 0 ? (unsigned int) (-arg) : arg); } else { const CHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } } precision = 6; if (dp->precision_start != dp->precision_end) { if (dp->precision_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->precision_arg_index].a.a_int; precision = (arg < 0 ? 0 : arg); } else { const CHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) precision = xsum (xtimes (precision, 10), *digitp++ - '0'); } } switch (dp->conversion) { case 'd': case 'i': case 'u': # ifdef HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Multiply by 2, as an estimate for FLAG_GROUP. */ tmp_length = xsum (tmp_length, tmp_length); /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; case 'o': # ifdef HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; case 'x': case 'X': # ifdef HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Add 2, to account for a leading sign or alternate form. */ tmp_length = xsum (tmp_length, 2); break; case 'f': case 'F': # ifdef HAVE_LONG_DOUBLE if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_MAX_EXP * 0.30103 /* binary -> decimal */ * 2 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ else # endif tmp_length = (unsigned int) (DBL_MAX_EXP * 0.30103 /* binary -> decimal */ * 2 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ tmp_length = xsum (tmp_length, precision); break; case 'e': case 'E': case 'g': case 'G': case 'a': case 'A': tmp_length = 12; /* sign, decimal point, exponent etc. */ tmp_length = xsum (tmp_length, precision); break; case 'c': # if defined HAVE_WINT_T && !WIDE_CHAR_VERSION if (type == TYPE_WIDE_CHAR) tmp_length = MB_CUR_MAX; else # endif tmp_length = 1; break; case 's': # ifdef HAVE_WCHAR_T if (type == TYPE_WIDE_STRING) { tmp_length = local_wcslen (a.arg[dp->arg_index].a.a_wide_string); # if !WIDE_CHAR_VERSION tmp_length = xtimes (tmp_length, MB_CUR_MAX); # endif } else # endif tmp_length = strlen (a.arg[dp->arg_index].a.a_string); break; case 'p': tmp_length = (unsigned int) (sizeof (void *) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1 /* turn floor into ceil */ + 2; /* account for leading 0x */ break; default: abort (); } if (tmp_length < width) tmp_length = width; tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ } if (tmp_length <= sizeof (tmpbuf) / sizeof (CHAR_T)) tmp = tmpbuf; else { size_t tmp_memsize = xtimes (tmp_length, sizeof (CHAR_T)); if (size_overflow_p (tmp_memsize)) /* Overflow, would lead to out of memory. */ goto out_of_memory; tmp = (CHAR_T *) malloc (tmp_memsize); if (tmp == NULL) /* Out of memory. */ goto out_of_memory; } #endif /* Construct the format string for calling snprintf or sprintf. */ p = buf; *p++ = '%'; if (dp->flags & FLAG_GROUP) *p++ = '\''; if (dp->flags & FLAG_LEFT) *p++ = '-'; if (dp->flags & FLAG_SHOWSIGN) *p++ = '+'; if (dp->flags & FLAG_SPACE) *p++ = ' '; if (dp->flags & FLAG_ALT) *p++ = '#'; if (dp->flags & FLAG_ZERO) *p++ = '0'; if (dp->width_start != dp->width_end) { size_t n = dp->width_end - dp->width_start; memcpy (p, dp->width_start, n * sizeof (CHAR_T)); p += n; } if (dp->precision_start != dp->precision_end) { size_t n = dp->precision_end - dp->precision_start; memcpy (p, dp->precision_start, n * sizeof (CHAR_T)); p += n; } switch (type) { #ifdef HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: case TYPE_ULONGLONGINT: *p++ = 'l'; /*FALLTHROUGH*/ #endif case TYPE_LONGINT: case TYPE_ULONGINT: #ifdef HAVE_WINT_T case TYPE_WIDE_CHAR: #endif #ifdef HAVE_WCHAR_T case TYPE_WIDE_STRING: #endif *p++ = 'l'; break; #ifdef HAVE_LONG_DOUBLE case TYPE_LONGDOUBLE: *p++ = 'L'; break; #endif default: break; } *p = dp->conversion; #if USE_SNPRINTF p[1] = '%'; p[2] = 'n'; p[3] = '\0'; #else p[1] = '\0'; #endif /* Construct the arguments for calling snprintf or sprintf. */ prefix_count = 0; if (dp->width_arg_index != ARG_NONE) { if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int; } if (dp->precision_arg_index != ARG_NONE) { if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int; } #if USE_SNPRINTF /* Prepare checking whether snprintf returns the count via %n. */ ENSURE_ALLOCATION (xsum (length, 1)); result[length] = '\0'; #endif for (;;) { size_t maxlen; int count; int retcount; maxlen = allocated - length; count = -1; retcount = 0; #if USE_SNPRINTF # define SNPRINTF_BUF(arg) \ switch (prefix_count) \ { \ case 0: \ retcount = SNPRINTF (result + length, maxlen, buf, \ arg, &count); \ break; \ case 1: \ retcount = SNPRINTF (result + length, maxlen, buf, \ prefixes[0], arg, &count); \ break; \ case 2: \ retcount = SNPRINTF (result + length, maxlen, buf, \ prefixes[0], prefixes[1], arg, \ &count); \ break; \ default: \ abort (); \ } #else # define SNPRINTF_BUF(arg) \ switch (prefix_count) \ { \ case 0: \ count = sprintf (tmp, buf, arg); \ break; \ case 1: \ count = sprintf (tmp, buf, prefixes[0], arg); \ break; \ case 2: \ count = sprintf (tmp, buf, prefixes[0], prefixes[1],\ arg); \ break; \ default: \ abort (); \ } #endif switch (type) { case TYPE_SCHAR: { int arg = a.arg[dp->arg_index].a.a_schar; SNPRINTF_BUF (arg); } break; case TYPE_UCHAR: { unsigned int arg = a.arg[dp->arg_index].a.a_uchar; SNPRINTF_BUF (arg); } break; case TYPE_SHORT: { int arg = a.arg[dp->arg_index].a.a_short; SNPRINTF_BUF (arg); } break; case TYPE_USHORT: { unsigned int arg = a.arg[dp->arg_index].a.a_ushort; SNPRINTF_BUF (arg); } break; case TYPE_INT: { int arg = a.arg[dp->arg_index].a.a_int; SNPRINTF_BUF (arg); } break; case TYPE_UINT: { unsigned int arg = a.arg[dp->arg_index].a.a_uint; SNPRINTF_BUF (arg); } break; case TYPE_LONGINT: { long int arg = a.arg[dp->arg_index].a.a_longint; SNPRINTF_BUF (arg); } break; case TYPE_ULONGINT: { unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint; SNPRINTF_BUF (arg); } break; #ifdef HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: { long long int arg = a.arg[dp->arg_index].a.a_longlongint; SNPRINTF_BUF (arg); } break; case TYPE_ULONGLONGINT: { unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint; SNPRINTF_BUF (arg); } break; #endif case TYPE_DOUBLE: { double arg = a.arg[dp->arg_index].a.a_double; SNPRINTF_BUF (arg); } break; #ifdef HAVE_LONG_DOUBLE case TYPE_LONGDOUBLE: { long double arg = a.arg[dp->arg_index].a.a_longdouble; SNPRINTF_BUF (arg); } break; #endif case TYPE_CHAR: { int arg = a.arg[dp->arg_index].a.a_char; SNPRINTF_BUF (arg); } break; #ifdef HAVE_WINT_T case TYPE_WIDE_CHAR: { wint_t arg = a.arg[dp->arg_index].a.a_wide_char; SNPRINTF_BUF (arg); } break; #endif case TYPE_STRING: { const char *arg = a.arg[dp->arg_index].a.a_string; SNPRINTF_BUF (arg); } break; #ifdef HAVE_WCHAR_T case TYPE_WIDE_STRING: { const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; SNPRINTF_BUF (arg); } break; #endif case TYPE_POINTER: { void *arg = a.arg[dp->arg_index].a.a_pointer; SNPRINTF_BUF (arg); } break; default: abort (); } #if USE_SNPRINTF /* Portability: Not all implementations of snprintf() are ISO C 99 compliant. Determine the number of bytes that snprintf() has produced or would have produced. */ if (count >= 0) { /* Verify that snprintf() has NUL-terminated its result. */ if (count < maxlen && result[length + count] != '\0') abort (); /* Portability hack. */ if (retcount > count) count = retcount; } else { /* snprintf() doesn't understand the '%n' directive. */ if (p[1] != '\0') { /* Don't use the '%n' directive; instead, look at the snprintf() return value. */ p[1] = '\0'; continue; } else { /* Look at the snprintf() return value. */ if (retcount < 0) { /* HP-UX 10.20 snprintf() is doubly deficient: It doesn't understand the '%n' directive, *and* it returns -1 (rather than the length that would have been required) when the buffer is too small. */ size_t bigger_need = xsum (xtimes (allocated, 2), 12); ENSURE_ALLOCATION (bigger_need); continue; } else count = retcount; } } #endif /* Attempt to handle failure. */ if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EINVAL; return NULL; } #if !USE_SNPRINTF if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the code above! */ abort (); #endif /* Make room for the result. */ if (count >= maxlen) { /* Need at least count bytes. But allocate proportionally, to avoid looping eternally if snprintf() reports a too small count. */ size_t n = xmax (xsum (length, count), xtimes (allocated, 2)); ENSURE_ALLOCATION (n); #if USE_SNPRINTF continue; #endif } #if USE_SNPRINTF /* The snprintf() result did fit. */ #else /* Append the sprintf() result. */ memcpy (result + length, tmp, count * sizeof (CHAR_T)); if (tmp != tmpbuf) free (tmp); #endif length += count; break; } } } } /* Add the final NUL. */ ENSURE_ALLOCATION (xsum (length, 1)); result[length] = '\0'; if (result != resultbuf && length + 1 < allocated) { /* Shrink the allocated memory if possible. */ CHAR_T *memory; memory = (CHAR_T *) realloc (result, (length + 1) * sizeof (CHAR_T)); if (memory != NULL) result = memory; } if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); *lengthp = length; /* Note that we can produce a big string of a length > INT_MAX. POSIX says that snprintf() fails with errno = EOVERFLOW in this case, but that's only because snprintf() returns an 'int'. This function does not have this limitation. */ return result; out_of_memory: if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); out_of_memory_1: CLEANUP (); errno = ENOMEM; return NULL; } } #undef SNPRINTF #undef USE_SNPRINTF #undef PRINTF_PARSE #undef DIRECTIVES #undef DIRECTIVE #undef CHAR_T #undef VASNPRINTF blame-1.4-20240206/lib/cycle-check.c0000644000000000000000000000526210527555557015142 0ustar rootroot/* help detect directory cycles efficiently Copyright (C) 2003, 2004, 2005, 2006 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; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Jim Meyering */ #include #include #include #include #include #include #include #include "cycle-check.h" #define CC_MAGIC 9827862 /* Return true if I is a power of 2, or is zero. */ static inline bool is_zero_or_power_of_two (uintmax_t i) { return (i & (i - 1)) == 0; } void cycle_check_init (struct cycle_check_state *state) { state->chdir_counter = 0; state->magic = CC_MAGIC; } /* In traversing a directory hierarchy, call this function once for each descending chdir call, with SB corresponding to the chdir operand. If SB corresponds to a directory that has already been seen, return true to indicate that there is a directory cycle. Note that this is done `lazily', which means that some of the directories in the cycle may be processed twice before the cycle is detected. */ bool cycle_check (struct cycle_check_state *state, struct stat const *sb) { assert (state->magic == CC_MAGIC); /* If the current directory ever happens to be the same as the one we last recorded for the cycle detection, then it's obviously part of a cycle. */ if (state->chdir_counter && SAME_INODE (*sb, state->dev_ino)) return true; /* If the number of `descending' chdir calls is a power of two, record the dev/ino of the current directory. */ if (is_zero_or_power_of_two (++(state->chdir_counter))) { /* On all architectures that we know about, if the counter overflows then there is a directory cycle here somewhere, even if we haven't detected it yet. Typically this happens only after the counter is incremented 2**64 times, so it's a fairly theoretical point. */ if (state->chdir_counter == 0) return true; state->dev_ino.st_dev = sb->st_dev; state->dev_ino.st_ino = sb->st_ino; } return false; } blame-1.4-20240206/lib/printf-args.c0000644000000000000000000001005510527555557015220 0ustar rootroot/* Decomposed printf argument list. Copyright (C) 1999, 2002-2003, 2005-2006 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. */ #include /* Specification. */ #include "printf-args.h" #ifdef STATIC STATIC #endif int printf_fetchargs (va_list args, arguments *a) { size_t i; argument *ap; for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++) switch (ap->type) { case TYPE_SCHAR: ap->a.a_schar = va_arg (args, /*signed char*/ int); break; case TYPE_UCHAR: ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); break; case TYPE_SHORT: ap->a.a_short = va_arg (args, /*short*/ int); break; case TYPE_USHORT: ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); break; case TYPE_INT: ap->a.a_int = va_arg (args, int); break; case TYPE_UINT: ap->a.a_uint = va_arg (args, unsigned int); break; case TYPE_LONGINT: ap->a.a_longint = va_arg (args, long int); break; case TYPE_ULONGINT: ap->a.a_ulongint = va_arg (args, unsigned long int); break; #ifdef HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: ap->a.a_longlongint = va_arg (args, long long int); break; case TYPE_ULONGLONGINT: ap->a.a_ulonglongint = va_arg (args, unsigned long long int); break; #endif case TYPE_DOUBLE: ap->a.a_double = va_arg (args, double); break; #ifdef HAVE_LONG_DOUBLE case TYPE_LONGDOUBLE: ap->a.a_longdouble = va_arg (args, long double); break; #endif case TYPE_CHAR: ap->a.a_char = va_arg (args, int); break; #ifdef HAVE_WINT_T case TYPE_WIDE_CHAR: /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by default argument promotions", this is not the case in mingw32, where wint_t is 'unsigned short'. */ ap->a.a_wide_char = (sizeof (wint_t) < sizeof (int) ? va_arg (args, int) : va_arg (args, wint_t)); break; #endif case TYPE_STRING: ap->a.a_string = va_arg (args, const char *); /* A null pointer is an invalid argument for "%s", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_string == NULL) ap->a.a_string = "(NULL)"; break; #ifdef HAVE_WCHAR_T case TYPE_WIDE_STRING: ap->a.a_wide_string = va_arg (args, const wchar_t *); /* A null pointer is an invalid argument for "%ls", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_wide_string == NULL) { static const wchar_t wide_null_string[] = { (wchar_t)'(', (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', (wchar_t)')', (wchar_t)0 }; ap->a.a_wide_string = wide_null_string; } break; #endif case TYPE_POINTER: ap->a.a_pointer = va_arg (args, void *); break; case TYPE_COUNT_SCHAR_POINTER: ap->a.a_count_schar_pointer = va_arg (args, signed char *); break; case TYPE_COUNT_SHORT_POINTER: ap->a.a_count_short_pointer = va_arg (args, short *); break; case TYPE_COUNT_INT_POINTER: ap->a.a_count_int_pointer = va_arg (args, int *); break; case TYPE_COUNT_LONGINT_POINTER: ap->a.a_count_longint_pointer = va_arg (args, long int *); break; #ifdef HAVE_LONG_LONG_INT case TYPE_COUNT_LONGLONGINT_POINTER: ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); break; #endif default: /* Unknown type. */ return -1; } return 0; } blame-1.4-20240206/lib/progname.h0000644000000000000000000000354410527555557014606 0ustar rootroot/* Program name management. Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. Written by Bruno Haible , 2001. 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. */ #ifndef _PROGNAME_H #define _PROGNAME_H /* Programs using this file should do the following in main(): set_program_name (argv[0]); */ #ifdef __cplusplus extern "C" { #endif /* String containing name the program is called with. */ extern const char *program_name; /* Set program_name, based on argv[0]. */ extern void set_program_name (const char *argv0); #if ENABLE_RELOCATABLE /* Set program_name, based on argv[0], and original installation prefix and directory, for relocatability. */ extern void set_program_name_and_installdir (const char *argv0, const char *orig_installprefix, const char *orig_installdir); #undef set_program_name #define set_program_name(ARG0) \ set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR) /* Return the full pathname of the current executable, based on the earlier call to set_program_name_and_installdir. Return NULL if unknown. */ extern char *get_full_program_name (void); #endif #ifdef __cplusplus } #endif #endif /* _PROGNAME_H */ blame-1.4-20240206/lib/same-inode.h0000644000000000000000000000177510527555557015023 0ustar rootroot/* Determine whether two stat buffers refer to the same file. Copyright (C) 2006 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. */ #ifndef SAME_INODE_H # define SAME_INODE_H 1 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \ ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \ && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev) #endif blame-1.4-20240206/lib/strstr.h0000644000000000000000000000246110337302610014307 0ustar rootroot/* Searching in a string. Copyright (C) 2001-2003, 2005 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. */ /* Include string.h: on glibc systems, it contains a macro definition of strstr() that would collide with our definition if included afterwards. */ #include #ifdef __cplusplus extern "C" { #endif /* No known system has a strstr() function that works correctly in multibyte locales. Therefore we use our version always. */ #undef strstr #define strstr rpl_strstr /* Find the first occurrence of NEEDLE in HAYSTACK. */ extern char *strstr (const char *haystack, const char *needle); #ifdef __cplusplus } #endif blame-1.4-20240206/lib/setenv.h0000644000000000000000000000271710241344121014253 0ustar rootroot/* Setting environment variables. Copyright (C) 2001-2004 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. */ #if HAVE_SETENV || HAVE_UNSETENV /* Get setenv(), unsetenv() declarations. */ # include #endif #ifdef __cplusplus extern "C" { #endif #if !HAVE_SETENV /* Set NAME to VALUE in the environment. If REPLACE is nonzero, overwrite an existing value. */ extern int setenv (const char *name, const char *value, int replace); #endif #if HAVE_UNSETENV # if VOID_UNSETENV /* On some systems, unsetenv() returns void. This is the case for FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */ # define unsetenv(name) ((unsetenv)(name), 0) # endif #else /* Remove the variable NAME from the environment. */ extern int unsetenv (const char *name); #endif #ifdef __cplusplus } #endif blame-1.4-20240206/lib/exitfail.c0000644000000000000000000000163310527555557014573 0ustar rootroot/* Failure exit status Copyright (C) 2002, 2003, 2005, 2006 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; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "exitfail.h" #include "exit.h" int volatile exit_failure = EXIT_FAILURE; blame-1.4-20240206/lib/strnlen1.h0000644000000000000000000000234010527555560014527 0ustar rootroot/* Find the length of STRING + 1, but scan at most MAXLEN bytes. Copyright (C) 2005 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. */ #ifndef _STRNLEN1_H #define _STRNLEN1_H #include #ifdef __cplusplus extern "C" { #endif /* Find the length of STRING + 1, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many characters, return MAXLEN. */ /* This is the same as strnlen (string, maxlen - 1) + 1. */ extern size_t strnlen1 (const char *string, size_t maxlen); #ifdef __cplusplus } #endif #endif /* _STRNLEN1_H */ blame-1.4-20240206/lib/vasnprintf.h0000644000000000000000000000536514556307007015162 0ustar rootroot/* vsprintf with automatic memory allocation. Copyright (C) 2002-2004 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. */ #ifndef _VASNPRINTF_H #define _VASNPRINTF_H /* Get va_list. */ #include /* Get size_t. */ #include #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) # define __format__ format # define __printf__ printf # endif #endif #ifdef __cplusplus extern "C" { #endif /* Write formatted output to a string dynamically allocated with malloc(). You can pass a preallocated buffer for the result in RESULTBUF and its size in *LENGTHP; otherwise you pass RESULTBUF = NULL. If successful, return the address of the string (this may be = RESULTBUF if no dynamic memory allocation was necessary) and set *LENGTHP to the number of resulting bytes, excluding the trailing NUL. Upon error, set errno and return NULL. When dynamic memory allocation occurs, the preallocated buffer is left alone (with possibly modified contents). This makes it possible to use a statically allocated or stack-allocated buffer, like this: char buf[100]; size_t len = sizeof (buf); char *output = vasnprintf (buf, &len, format, args); if (output == NULL) ... error handling ...; else { ... use the output string ...; if (output != buf) free (output); } */ extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) __attribute__ ((__format__ (__printf__, 3, 0))); #ifdef __cplusplus } #endif #endif /* _VASNPRINTF_H */ blame-1.4-20240206/lib/xreadlink.c0000644000000000000000000000511514557307547014747 0ustar rootroot/* xreadlink.c -- readlink wrapper to return the link name in malloc'd storage Copyright (C) 2001, 2003, 2004, 2005, 2006 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; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Jim Meyering */ #include #include "xreadlink.h" #include #include #include #include #include #include #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif #ifndef SSIZE_MAX # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif #define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX) #include "xalloc.h" /* Call readlink to get the symbolic link value of FILE. SIZE is a hint as to how long the link is expected to be; typically it is taken from st_size. It need not be correct. Return a pointer to that NUL-terminated string in malloc'd storage. If readlink fails, return NULL (caller may use errno to diagnose). If malloc fails, or if the link value is longer than SSIZE_MAX :-), give a diagnostic and exit. */ char * xreadlink (char const *file, size_t size) { /* The initial buffer size for the link value. A power of 2 detects arithmetic overflow earlier, but is not required. */ size_t buf_size = size < MAXSIZE ? size + 1 : MAXSIZE; while (1) { char *buffer = xmalloc (buf_size); ssize_t r = readlink (file, buffer, buf_size); size_t link_length = (size_t) r; /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1 with errno == ERANGE if the buffer is too small. */ if (r < 0 && errno != ERANGE) { int saved_errno = errno; free (buffer); errno = saved_errno; return NULL; } if (link_length < buf_size) { buffer[link_length] = 0; return buffer; } free (buffer); if (buf_size <= MAXSIZE / 2) buf_size *= 2; else if (buf_size < MAXSIZE) buf_size = MAXSIZE; else xalloc_die (); } } blame-1.4-20240206/lib/argp-ba.c0000644000000000000000000000236210241344111014246 0ustar rootroot/* Default definition for ARGP_PROGRAM_BUG_ADDRESS. Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ /* If set by the user program, it should point to string that is the bug-reporting address for the program. It will be printed by argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help messages), embedded in a sentence that says something like `Report bugs to ADDR.'. */ const char *argp_program_bug_address; blame-1.4-20240206/lib/stat_.h0000644000000000000000000001273510527555557014112 0ustar rootroot/* Provide a more complete sys/stat header file. Copyright (C) 2006 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. */ /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ #ifndef _gl_SYS_STAT_H #define _gl_SYS_STAT_H /* This file is supposed to be used on platforms where is incomplete. It is intended to provide definitions and prototypes needed by an application. Start with what the system provides. */ #include @ABSOLUTE_SYS_STAT_H@ #ifndef S_IFMT # define S_IFMT 0170000 #endif #if STAT_MACROS_BROKEN # undef S_ISBLK # undef S_ISCHR # undef S_ISDIR # undef S_ISFIFO # undef S_ISLNK # undef S_ISNAM # undef S_ISMPB # undef S_ISMPC # undef S_ISNWK # undef S_ISREG # undef S_ISSOCK #endif #ifndef S_ISBLK # ifdef S_IFBLK # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) # else # define S_ISBLK(m) 0 # endif #endif #ifndef S_ISCHR # ifdef S_IFCHR # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) # else # define S_ISCHR(m) 0 # endif #endif #ifndef S_ISDIR # ifdef S_IFDIR # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) # else # define S_ISDIR(m) 0 # endif #endif #ifndef S_ISDOOR /* Solaris 2.5 and up */ # define S_ISDOOR(m) 0 #endif #ifndef S_ISFIFO # ifdef S_IFIFO # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) # else # define S_ISFIFO(m) 0 # endif #endif #ifndef S_ISLNK # ifdef S_IFLNK # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) # else # define S_ISLNK(m) 0 # endif #endif #ifndef S_ISMPB /* V7 */ # ifdef S_IFMPB # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) # else # define S_ISMPB(m) 0 # define S_ISMPC(m) 0 # endif #endif #ifndef S_ISNAM /* Xenix */ # ifdef S_IFNAM # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) # else # define S_ISNAM(m) 0 # endif #endif #ifndef S_ISNWK /* HP/UX */ # ifdef S_IFNWK # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) # else # define S_ISNWK(m) 0 # endif #endif #ifndef S_ISPORT /* Solaris 10 and up */ # define S_ISPORT(m) 0 #endif #ifndef S_ISREG # ifdef S_IFREG # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) # else # define S_ISREG(m) 0 # endif #endif #ifndef S_ISSOCK # ifdef S_IFSOCK # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) # else # define S_ISSOCK(m) 0 # endif #endif #ifndef S_TYPEISMQ # define S_TYPEISMQ(p) 0 #endif #ifndef S_TYPEISTMO # define S_TYPEISTMO(p) 0 #endif #ifndef S_TYPEISSEM # ifdef S_INSEM # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) # else # define S_TYPEISSEM(p) 0 # endif #endif #ifndef S_TYPEISSHM # ifdef S_INSHD # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) # else # define S_TYPEISSHM(p) 0 # endif #endif /* high performance ("contiguous data") */ #ifndef S_ISCTG # define S_ISCTG(p) 0 #endif /* Cray DMF (data migration facility): off line, with data */ #ifndef S_ISOFD # define S_ISOFD(p) 0 #endif /* Cray DMF (data migration facility): off line, with no data */ #ifndef S_ISOFL # define S_ISOFL(p) 0 #endif /* 4.4BSD whiteout */ #ifndef S_ISWHT # define S_ISWHT(m) 0 #endif /* If any of the following are undefined, define them to their de facto standard values. */ #if !S_ISUID # define S_ISUID 04000 #endif #if !S_ISGID # define S_ISGID 02000 #endif /* S_ISVTX is a common extension to POSIX. */ #ifndef S_ISVTX # define S_ISVTX 01000 #endif #if !S_IRUSR && S_IREAD # define S_IRUSR S_IREAD #endif #if !S_IRUSR # define S_IRUSR 00400 #endif #if !S_IRGRP # define S_IRGRP (S_IRUSR >> 3) #endif #if !S_IROTH # define S_IROTH (S_IRUSR >> 6) #endif #if !S_IWUSR && S_IWRITE # define S_IWUSR S_IWRITE #endif #if !S_IWUSR # define S_IWUSR 00200 #endif #if !S_IWGRP # define S_IWGRP (S_IWUSR >> 3) #endif #if !S_IWOTH # define S_IWOTH (S_IWUSR >> 6) #endif #if !S_IXUSR && S_IEXEC # define S_IXUSR S_IEXEC #endif #if !S_IXUSR # define S_IXUSR 00100 #endif #if !S_IXGRP # define S_IXGRP (S_IXUSR >> 3) #endif #if !S_IXOTH # define S_IXOTH (S_IXUSR >> 6) #endif #if !S_IRWXU # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) #endif #if !S_IRWXG # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) #endif #if !S_IRWXO # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) #endif /* S_IXUGO is a common extension to POSIX. */ #if !S_IXUGO # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) #endif #ifndef S_IRWXUGO # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) #endif /* mingw does not support symlinks, therefore it does not have lstat. But without links, stat does just fine. */ #if ! HAVE_LSTAT # define lstat stat #endif /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. Additionally, it declares _mkdir (and depending on compile flags, an alias mkdir), only in the nonstandard io.h. */ #if ! HAVE_DECL_MKDIR && HAVE_IO_H # include static inline int rpl_mkdir (char const *name, mode_t mode) { return _mkdir (name); } # define mkdir rpl_mkdir #endif #endif /* _gl_SYS_STAT_H */ blame-1.4-20240206/lib/Makefile.in0000644000000000000000000000554314557764257014701 0ustar rootroot# $Id: Makefile.in,v 1.13 2024/02/04 19:42:39 tom Exp $ # Copyright 2022,2024 Thomas E. Dickey # makefile-template for autoconf @SET_MAKE@ VPATH = @srcdir@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = .. INSTALL = @INSTALL@ transform = $(program_transform_name) AR = @AR@ ARFLAGS = @ARFLAGS@ CC = @CC@ CPP = @CPP@ CPPFLAGS = @DEFS@ @CPPFLAGS@ -I. -I$(srcdir) -I$(top_builddir) EXTRA_CFLAGS = @EXTRA_CFLAGS@ CFLAGS = @CFLAGS@ $(EXTRA_CFLAGS) COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) CYGPATH_W = @CYGPATH_W@ OBJEXT = @OBJEXT@ RANLIB = @RANLIB@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ LIBOBJS = @LIBOBJS@ \ basename.o \ exitfail.o \ strcasecmp.o \ strndup.o \ strstr.o prefix = @prefix@ SOURCES = \ allocsa.c argp-ba.c \ argp-eexst.c \ argp-fmtstream.c \ argp-fs-xinl.c \ argp-help.c \ argp-parse.c \ argp-pin.c \ argp-pv.c \ argp-pvh.c \ argp-xinl.c \ progname.c \ strnlen1.c \ xalloc-die.c \ xstrndup.c OBJECTS = $(SOURCES:.c=.$(OBJEXT)) EXTRA_OBJECTS = $(LIBOBJS) HAVE__BOOL = @HAVE__BOOL@ ALLOCA_H = @ALLOCA_H@ GETOPT_H = @GETOPT_H@ STDBOOL_H = @STDBOOL_H@ SYSEXITS_H = @SYSEXITS_H@ BUILT_SOURCES = $(ALLOCA_H) $(GETOPT_H) $(STDBOOL_H) $(SYSEXITS_H) all: $(BUILT_SOURCES) libmisc.a .SUFFIXES: .SUFFIXES: .c .i .o .obj libmisc.a: $(OBJECTS) $(EXTRA_OBJECTS) -rm -f $@ $(AR) $(ARFLAGS) $@ $(OBJECTS) $(EXTRA_OBJECTS) $(RANLIB) $@ .c.o: @RULE_CC@ @ECHO_CC@$(COMPILE) -c $< .c.i: @RULE_CC@ @ECHO_CC@$(CPP) $(CPPFLAGS) -C $< >$@ .c.obj: @RULE_CC@ @ECHO_CC@$(COMPILE) -c `$(CYGPATH_W) '$<'` check: install: all uninstall: clean: -rm -f *.$(OBJEXT) *.i -rm -f libmisc.a distclean: clean -rm -f $(BUILT_SOURCES) -rm -f Makefile .PHONY: all check clean distclean install uninstall # We need the following in order to create when the system # doesn't have one that works with the given compiler. alloca.h: alloca_.h { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/alloca_.h; \ } > $@-t mv -f $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt_.h { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/getopt_.h; \ } > $@-t mv -f $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdbool.h: stdbool_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \ } > $@-t mv -f $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. sysexits.h: sysexit_.h { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/sysexit_.h; \ } > $@-t mv -f $@-t $@ blame-1.4-20240206/lib/getopt.c0000644000000000000000000007667614557307454014311 0ustar rootroot/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ #ifndef _LIBC # include #endif #include "getopt.h" #include #include #include #include #ifdef __VMS # include #endif #ifdef _LIBC # include #else # include "gettext.h" # define _(msgid) gettext (msgid) #endif #if defined _LIBC && defined USE_IN_LIBIO # include #endif #ifndef attribute_hidden # define attribute_hidden #endif /* Unlike standard Unix `getopt', functions like `getopt_long' let the user intersperse the options with the other arguments. As `getopt_long' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Using `getopt' or setting the environment variable POSIXLY_CORRECT disables permutation. Then the application's behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt_int.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Keep a global copy of all internal members of getopt_data. */ static struct _getopt_data getopt_data; #if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV extern char *getenv (); #endif #ifdef _LIBC /* Stored original parameters. XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ extern int __libc_argc; extern char **__libc_argv; /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ # ifdef USE_NONOPTION_FLAGS /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; # endif # ifdef USE_NONOPTION_FLAGS # define SWAP_FLAGS(ch1, ch2) \ if (d->__nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } # else # define SWAP_FLAGS(ch1, ch2) # endif #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange (char **argv, struct _getopt_data *d) { int bottom = d->__first_nonopt; int middle = d->__last_nonopt; int top = d->optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, d->__nonoption_flags_max_len), '\0', top + 1 - d->__nonoption_flags_max_len); d->__nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ d->__first_nonopt += (d->optind - d->__last_nonopt); d->__last_nonopt = d->optind; } /* Initialize the internal data when the first call is made. */ static const char * _getopt_initialize (int argc, char **argv, const char *optstring, int posixly_correct, struct _getopt_data *d) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ (void) argc; (void) argv; d->__first_nonopt = d->__last_nonopt = d->optind; d->__nextchar = NULL; d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { d->__ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { d->__ordering = REQUIRE_ORDER; ++optstring; } else if (d->__posixly_correct) d->__ordering = REQUIRE_ORDER; else d->__ordering = PERMUTE; #if defined _LIBC && defined USE_NONOPTION_FLAGS if (!d->__posixly_correct && argc == __libc_argc && argv == __libc_argv) { if (d->__nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') d->__nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = d->__nonoption_flags_max_len = strlen (orig_str); if (d->__nonoption_flags_max_len < argc) d->__nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (d->__nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) d->__nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', d->__nonoption_flags_max_len - len); } } d->__nonoption_flags_len = d->__nonoption_flags_max_len; } else d->__nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT environment variable were set. */ int _getopt_internal_r (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, int posixly_correct, struct _getopt_data *d) { int print_errors = d->opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; d->optarg = NULL; if (d->optind == 0 || !d->__initialized) { if (d->optind == 0) d->optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring, posixly_correct, d); d->__initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \ || (d->optind < d->__nonoption_flags_len \ && __getopt_nonoption_flags[d->optind] == '1')) #else # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') #endif if (d->__nextchar == NULL || *d->__nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (d->__last_nonopt > d->optind) d->__last_nonopt = d->optind; if (d->__first_nonopt > d->optind) d->__first_nonopt = d->optind; if (d->__ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (d->__first_nonopt != d->__last_nonopt && d->__last_nonopt != d->optind) exchange ((char **) argv, d); else if (d->__last_nonopt != d->optind) d->__first_nonopt = d->optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (d->optind < argc && NONOPTION_P) d->optind++; d->__last_nonopt = d->optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (d->optind != argc && !strcmp (argv[d->optind], "--")) { d->optind++; if (d->__first_nonopt != d->__last_nonopt && d->__last_nonopt != d->optind) exchange ((char **) argv, d); else if (d->__first_nonopt == d->__last_nonopt) d->__first_nonopt = d->optind; d->__last_nonopt = argc; d->optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (d->optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (d->__first_nonopt != d->__last_nonopt) d->optind = d->__first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (d->__ordering == REQUIRE_ORDER) return -1; d->optarg = argv[d->optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ d->__nextchar = (argv[d->optind] + 1 + (longopts != NULL && argv[d->optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[d->optind][1] == '-' || (long_only && (argv[d->optind][2] || !strchr (optstring, argv[d->optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, d->__nextchar, (size_t) (nameend - d->__nextchar))) { if ((unsigned int) (nameend - d->__nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), argv[0], argv[d->optind]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[d->optind]); #endif } d->__nextchar += strlen (d->__nextchar); d->optind++; d->optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; d->optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) d->optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (argv[d->optind - 1][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #else fprintf (stderr, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name); #else fprintf (stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->__nextchar += strlen (d->__nextchar); d->optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (d->optind < argc) d->optarg = argv[d->optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]); #endif } d->__nextchar += strlen (d->__nextchar); d->optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } d->__nextchar += strlen (d->__nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[d->optind][1] == '-' || strchr (optstring, *d->__nextchar) == NULL) { static char empty[1]; if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (argv[d->optind][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), argv[0], d->__nextchar); #else fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], d->__nextchar); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #else fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->__nextchar = empty; d->optind++; d->optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *d->__nextchar++; char *temp = strchr (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*d->__nextchar == '\0') ++d->optind; if (temp == NULL || c == ':') { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (d->__posixly_correct) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: illegal option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); #endif } else { #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: invalid option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ d->optind++; } else if (d->optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option requires an argument -- %c\n"), argv[0], c) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } d->optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `d->optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, d->__nextchar, (size_t) (nameend - d->__nextchar))) { if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[d->optind]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[d->optind]); #endif } d->__nextchar += strlen (d->__nextchar); d->optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) d->optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } d->__nextchar += strlen (d->__nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (d->optind < argc) d->optarg = argv[d->optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]); #endif } d->__nextchar += strlen (d->__nextchar); return optstring[0] == ':' ? ':' : '?'; } } d->__nextchar += strlen (d->__nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } d->__nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; d->optind++; } else d->optarg = NULL; d->__nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ d->optind++; } else if (d->optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option requires an argument -- %c\n"), argv[0], c) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } d->optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; d->__nextchar = NULL; } } return c; } } int _getopt_internal (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, int posixly_correct) { int result; getopt_data.optind = optind; getopt_data.opterr = opterr; result = _getopt_internal_r (argc, argv, optstring, longopts, longind, long_only, posixly_correct, &getopt_data); optind = getopt_data.optind; optarg = getopt_data.optarg; optopt = getopt_data.optopt; return result; } /* glibc gets a LSB-compliant getopt. Standalone applications get a POSIX-compliant getopt. */ #if _LIBC enum { POSIXLY_CORRECT = 0 }; #else enum { POSIXLY_CORRECT = 1 }; #endif int getopt (int argc, char *const *argv, const char *optstring) { return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, POSIXLY_CORRECT); } #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ blame-1.4-20240206/lib/pathmax.h0000644000000000000000000000270010337302607014412 0ustar rootroot/* Define PATH_MAX somehow. Requires sys/types.h. Copyright (C) 1992, 1999, 2001, 2003, 2005 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. */ #ifndef _PATHMAX_H # define _PATHMAX_H # include # include # ifndef _POSIX_PATH_MAX # define _POSIX_PATH_MAX 256 # endif # if !defined PATH_MAX && defined _PC_PATH_MAX # define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \ : pathconf ("/", _PC_PATH_MAX)) # endif /* Don't include sys/param.h if it already has been. */ # if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN # include # endif # if !defined PATH_MAX && defined MAXPATHLEN # define PATH_MAX MAXPATHLEN # endif # ifndef PATH_MAX # define PATH_MAX _POSIX_PATH_MAX # endif #endif /* _PATHMAX_H */ blame-1.4-20240206/lib/vsnprintf.c0000644000000000000000000000401710527555560015010 0ustar rootroot/* Formatted output to strings. Copyright (C) 2004, 2006 Free Software Foundation, Inc. Written by Simon Josefsson and Yoann Vandoorselaere . 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. */ #ifdef HAVE_CONFIG_H # include #endif /* Specification. */ #include "vsnprintf.h" #include #include #include #include #include #include #include "vasnprintf.h" /* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ #ifndef EOVERFLOW # define EOVERFLOW E2BIG #endif /* Print formatted output to string STR. Similar to vsprintf, but additional length SIZE limit how much is written into STR. Returns string length of formatted string (which may be larger than SIZE). STR may be NULL, in which case nothing will be written. On error, return a negative value. */ int vsnprintf (char *str, size_t size, const char *format, va_list args) { char *output; size_t len; size_t lenbuf = size; output = vasnprintf (str, &lenbuf, format, args); len = lenbuf; if (!output) return -1; if (output != str) { if (size) { size_t pruned_len = (len < size ? len : size - 1); memcpy (str, output, pruned_len); str[pruned_len] = '\0'; } free (output); } if (len > INT_MAX) { errno = EOVERFLOW; return -1; } return len; } blame-1.4-20240206/lib/strchrnul.h0000644000000000000000000000166314556553316015017 0ustar rootroot/* Searching in a string. Copyright (C) 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. */ /* Find the first occurrence of C in S or the final NUL byte. */ #define strchrnul(s,n) replaced_strchrnul(s,n) extern char *strchrnul (const char *s, int c_in); blame-1.4-20240206/lib/unlocked-io.h0000644000000000000000000000702110254677264015176 0ustar rootroot/* Prefer faster, non-thread-safe stdio functions if available. Copyright (C) 2001, 2002, 2003, 2004 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. */ /* Written by Jim Meyering. */ #ifndef UNLOCKED_IO_H # define UNLOCKED_IO_H 1 /* These are wrappers for functions/macros from the GNU C library, and from other C libraries supporting POSIX's optional thread-safe functions. The standard I/O functions are thread-safe. These *_unlocked ones are more efficient but not thread-safe. That they're not thread-safe is fine since all of the applications in this package are single threaded. Also, some code that is shared with the GNU C library may invoke the *_unlocked functions directly. On hosts that lack those functions, invoke the non-thread-safe versions instead. */ # include # if HAVE_DECL_CLEARERR_UNLOCKED # undef clearerr # define clearerr(x) clearerr_unlocked (x) # else # define clearerr_unlocked(x) clearerr (x) # endif # if HAVE_DECL_FEOF_UNLOCKED # undef feof # define feof(x) feof_unlocked (x) # else # define feof_unlocked(x) feof (x) # endif # if HAVE_DECL_FERROR_UNLOCKED # undef ferror # define ferror(x) ferror_unlocked (x) # else # define ferror_unlocked(x) ferror (x) # endif # if HAVE_DECL_FFLUSH_UNLOCKED # undef fflush # define fflush(x) fflush_unlocked (x) # else # define fflush_unlocked(x) fflush (x) # endif # if HAVE_DECL_FGETS_UNLOCKED # undef fgets # define fgets(x,y,z) fgets_unlocked (x,y,z) # else # define fgets_unlocked(x,y,z) fgets (x,y,z) # endif # if HAVE_DECL_FPUTC_UNLOCKED # undef fputc # define fputc(x,y) fputc_unlocked (x,y) # else # define fputc_unlocked(x,y) fputc (x,y) # endif # if HAVE_DECL_FPUTS_UNLOCKED # undef fputs # define fputs(x,y) fputs_unlocked (x,y) # else # define fputs_unlocked(x,y) fputs (x,y) # endif # if HAVE_DECL_FREAD_UNLOCKED # undef fread # define fread(w,x,y,z) fread_unlocked (w,x,y,z) # else # define fread_unlocked(w,x,y,z) fread (w,x,y,z) # endif # if HAVE_DECL_FWRITE_UNLOCKED # undef fwrite # define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) # else # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) # endif # if HAVE_DECL_GETC_UNLOCKED # undef getc # define getc(x) getc_unlocked (x) # else # define getc_unlocked(x) getc (x) # endif # if HAVE_DECL_GETCHAR_UNLOCKED # undef getchar # define getchar() getchar_unlocked () # else # define getchar_unlocked() getchar () # endif # if HAVE_DECL_PUTC_UNLOCKED # undef putc # define putc(x,y) putc_unlocked (x,y) # else # define putc_unlocked(x,y) putc (x,y) # endif # if HAVE_DECL_PUTCHAR_UNLOCKED # undef putchar # define putchar(x) putchar_unlocked (x) # else # define putchar_unlocked(x) putchar (x) # endif # undef flockfile # define flockfile(x) ((void) 0) # undef ftrylockfile # define ftrylockfile(x) 0 # undef funlockfile # define funlockfile(x) ((void) 0) #endif /* UNLOCKED_IO_H */ blame-1.4-20240206/lib/argp-help.c0000644000000000000000000015774614560263231014650 0ustar rootroot/* Hierarchial argument parsing help output Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include #include #include #include #ifdef USE_IN_LIBIO # include #endif #ifdef _LIBC # include # undef dgettext # define dgettext(domain, msgid) \ INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES) #else # include "gettext.h" #endif #include "argp.h" #include "argp-fmtstream.h" #include "argp-namefrob.h" #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif /* User-selectable (using an environment variable) formatting parameters. These may be specified in an environment variable called `ARGP_HELP_FMT', with a contents like: VAR1=VAL1,VAR2=VAL2,BOOLVAR2,no-BOOLVAR2 Where VALn must be a positive integer. The list of variables is in the UPARAM_NAMES vector, below. */ /* Default parameters. */ #define DUP_ARGS 0 /* True if option argument can be duplicated. */ #define DUP_ARGS_NOTE 1 /* True to print a note about duplicate args. */ #define SHORT_OPT_COL 2 /* column in which short options start */ #define LONG_OPT_COL 6 /* column in which long options start */ #define DOC_OPT_COL 2 /* column in which doc options start */ #define OPT_DOC_COL 29 /* column in which option text starts */ #define HEADER_COL 1 /* column in which group headers are printed */ #define USAGE_INDENT 12 /* indentation of wrapped usage lines */ #define RMARGIN 79 /* right margin used for wrapping */ /* User-selectable (using an environment variable) formatting parameters. They must all be of type `int' for the parsing code to work. */ struct uparams { /* If true, arguments for an option are shown with both short and long options, even when a given option has both, e.g. `-x ARG, --longx=ARG'. If false, then if an option has both, the argument is only shown with the long one, e.g., `-x, --longx=ARG', and a message indicating that this really means both is printed below the options. */ int dup_args; /* This is true if when DUP_ARGS is false, and some duplicate arguments have been suppressed, an explanatory message should be printed. */ int dup_args_note; /* Various output columns. */ int short_opt_col; /* column in which short options start */ int long_opt_col; /* column in which long options start */ int doc_opt_col; /* column in which doc options start */ int opt_doc_col; /* column in which option text starts */ int header_col; /* column in which group headers are printed */ int usage_indent; /* indentation of wrapped usage lines */ int rmargin; /* right margin used for wrapping */ int valid; /* True when the values in here are valid. */ }; /* This is a global variable, as user options are only ever read once. */ static struct uparams uparams = { DUP_ARGS, DUP_ARGS_NOTE, SHORT_OPT_COL, LONG_OPT_COL, DOC_OPT_COL, OPT_DOC_COL, HEADER_COL, USAGE_INDENT, RMARGIN, 0 }; /* A particular uparam, and what the user name is. */ struct uparam_name { const char *name; /* User name. */ int is_bool; /* Whether it's `boolean'. */ size_t uparams_offs; /* Location of the (int) field in UPARAMS. */ }; /* The name-field mappings we know about. */ static const struct uparam_name uparam_names[] = { { "dup-args", 1, offsetof (struct uparams, dup_args) }, { "dup-args-note", 1, offsetof (struct uparams, dup_args_note) }, { "short-opt-col", 0, offsetof (struct uparams, short_opt_col) }, { "long-opt-col", 0, offsetof (struct uparams, long_opt_col) }, { "doc-opt-col", 0, offsetof (struct uparams, doc_opt_col) }, { "opt-doc-col", 0, offsetof (struct uparams, opt_doc_col) }, { "header-col", 0, offsetof (struct uparams, header_col) }, { "usage-indent", 0, offsetof (struct uparams, usage_indent) }, { "rmargin", 0, offsetof (struct uparams, rmargin) }, { 0 } }; static void validate_uparams (const struct argp_state *state, struct uparams *upptr) { const struct uparam_name *up; for (up = uparam_names; up->name; up++) { if (up->is_bool || up->uparams_offs == offsetof (struct uparams, rmargin)) continue; if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin) { __argp_failure (state, 0, 0, dgettext (state->root_argp->argp_domain, "\ ARGP_HELP_FMT: %s value is less than or equal to %s"), "rmargin", up->name); return; } } uparams = *upptr; uparams.valid = 1; } /* Read user options from the environment, and fill in UPARAMS appropriately. */ static void fill_in_uparams (const struct argp_state *state) { const char *var = getenv ("ARGP_HELP_FMT"); struct uparams new_params = uparams; #define SKIPWS(p) do { while (isspace (*p)) p++; } while (0); if (var) { /* Parse var. */ while (*var) { SKIPWS (var); if (isalpha (*var)) { size_t var_len; const struct uparam_name *un; int unspec = 0, val = 0; const char *arg = var; while (isalnum (*arg) || *arg == '-' || *arg == '_') arg++; var_len = (size_t) (arg - var); SKIPWS (arg); if (*arg == '\0' || *arg == ',') unspec = 1; else if (*arg == '=') { arg++; SKIPWS (arg); } if (unspec) { if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') { val = 0; var += 3; var_len -= 3; } else val = 1; } else if (isdigit (*arg)) { val = atoi (arg); while (isdigit (*arg)) arg++; SKIPWS (arg); } for (un = uparam_names; un->name; un++) if (strlen (un->name) == var_len && strncmp (var, un->name, var_len) == 0) { if (unspec && !un->is_bool) __argp_failure (state, 0, 0, dgettext (state->root_argp->argp_domain, "\ %.*s: ARGP_HELP_FMT parameter requires a value"), (int) var_len, var); else if (val < 0) __argp_failure (state, 0, 0, dgettext (state->root_argp->argp_domain, "\ %.*s: ARGP_HELP_FMT parameter must be positive"), (int) var_len, var); else *(int *)((char *)&new_params + un->uparams_offs) = val; break; } if (! un->name) __argp_failure (state, 0, 0, dgettext (state->root_argp->argp_domain, "\ %.*s: Unknown ARGP_HELP_FMT parameter"), (int) var_len, var); var = arg; if (*var == ',') var++; } else if (*var) { __argp_failure (state, 0, 0, dgettext (state->root_argp->argp_domain, "Garbage in ARGP_HELP_FMT: %s"), var); break; } } validate_uparams (state, &new_params); } } /* Returns true if OPT hasn't been marked invisible. Visibility only affects whether OPT is displayed or used in sorting, not option shadowing. */ #define ovisible(opt) (! ((opt)->flags & OPTION_HIDDEN)) /* Returns true if OPT is an alias for an earlier option. */ #define oalias(opt) ((opt)->flags & OPTION_ALIAS) /* Returns true if OPT is an documentation-only entry. */ #define odoc(opt) ((opt)->flags & OPTION_DOC) /* Returns true if OPT should not be translated */ #define onotrans(opt) ((opt)->flags & OPTION_NO_TRANS) /* Returns true if OPT is the end-of-list marker for a list of options. */ #define oend(opt) __option_is_end (opt) /* Returns true if OPT has a short option. */ #define oshort(opt) __option_is_short (opt) /* The help format for a particular option is like: -xARG, -yARG, --long1=ARG, --long2=ARG Documentation... Where ARG will be omitted if there's no argument, for this option, or will be surrounded by "[" and "]" appropriately if the argument is optional. The documentation string is word-wrapped appropriately, and if the list of options is long enough, it will be started on a separate line. If there are no short options for a given option, the first long option is indented slightly in a way that's supposed to make most long options appear to be in a separate column. For example, the following output (from ps): -p PID, --pid=PID List the process PID --pgrp=PGRP List processes in the process group PGRP -P, -x, --no-parent Include processes without parents -Q, --all-fields Don't elide unusable fields (normally if there's some reason ps can't print a field for any process, it's removed from the output entirely) -r, --reverse, --gratuitously-long-reverse-option Reverse the order of any sort --session[=SID] Add the processes from the session SID (which defaults to the sid of the current process) Here are some more options: -f ZOT, --foonly=ZOT Glork a foonly -z, --zaza Snit a zar -?, --help Give this help list --usage Give a short usage message -V, --version Print program version The struct argp_option array for the above could look like: { {"pid", 'p', "PID", 0, "List the process PID"}, {"pgrp", OPT_PGRP, "PGRP", 0, "List processes in the process group PGRP"}, {"no-parent", 'P', 0, 0, "Include processes without parents"}, {0, 'x', 0, OPTION_ALIAS}, {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally" " if there's some reason ps can't" " print a field for any process, it's" " removed from the output entirely)" }, {"reverse", 'r', 0, 0, "Reverse the order of any sort"}, {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS}, {"session", OPT_SESS, "SID", OPTION_ARG_OPTIONAL, "Add the processes from the session" " SID (which defaults to the sid of" " the current process)" }, {0,0,0,0, "Here are some more options:"}, {"foonly", 'f', "ZOT", 0, "Glork a foonly"}, {"zaza", 'z', 0, 0, "Snit a zar"}, {0} } Note that the last three options are automatically supplied by argp_parse, unless you tell it not to with ARGP_NO_HELP. */ /* Returns true if CH occurs between BEG and END. */ static int find_char (char ch, char *beg, char *end) { while (beg < end) if (*beg == ch) return 1; else beg++; return 0; } struct hol_cluster; /* fwd decl */ struct hol_entry { /* First option. */ const struct argp_option *opt; /* Number of options (including aliases). */ unsigned num; /* A pointers into the HOL's short_options field, to the first short option letter for this entry. The order of the characters following this point corresponds to the order of options pointed to by OPT, and there are at most NUM. A short option recorded in a option following OPT is only valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's probably been shadowed by some other entry). */ char *short_options; /* Entries are sorted by their group first, in the order: 1, 2, ..., n, 0, -m, ..., -2, -1 and then alphabetically within each group. The default is 0. */ int group; /* The cluster of options this entry belongs to, or 0 if none. */ struct hol_cluster *cluster; /* The argp from which this option came. */ const struct argp *argp; }; /* A cluster of entries to reflect the argp tree structure. */ struct hol_cluster { /* A descriptive header printed before options in this cluster. */ const char *header; /* Used to order clusters within the same group with the same parent, according to the order in which they occurred in the parent argp's child list. */ int index; /* How to sort this cluster with respect to options and other clusters at the same depth (clusters always follow options in the same group). */ int group; /* The cluster to which this cluster belongs, or 0 if it's at the base level. */ struct hol_cluster *parent; /* The argp from which this cluster is (eventually) derived. */ const struct argp *argp; /* The distance this cluster is from the root. */ int depth; /* Clusters in a given hol are kept in a linked list, to make freeing them possible. */ struct hol_cluster *next; }; /* A list of options for help. */ struct hol { /* An array of hol_entry's. */ struct hol_entry *entries; /* The number of entries in this hol. If this field is zero, the others are undefined. */ unsigned num_entries; /* A string containing all short options in this HOL. Each entry contains pointers into this string, so the order can't be messed with blindly. */ char *short_options; /* Clusters of entries in this hol. */ struct hol_cluster *clusters; }; /* Create a struct hol from the options in ARGP. CLUSTER is the hol_cluster in which these entries occur, or 0, if at the root. */ static struct hol * make_hol (const struct argp *argp, struct hol_cluster *cluster) { char *so; const struct argp_option *o; const struct argp_option *opts = argp->options; struct hol_entry *entry; unsigned num_short_options = 0; struct hol *hol = malloc (sizeof (struct hol)); assert (hol); hol->num_entries = 0; hol->clusters = 0; if (opts) { int cur_group = 0; /* The first option must not be an alias. */ assert (! oalias (opts)); /* Calculate the space needed. */ for (o = opts; ! oend (o); o++) { if (! oalias (o)) hol->num_entries++; if (oshort (o)) num_short_options++; /* This is an upper bound. */ } hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries); hol->short_options = malloc (num_short_options + 1); assert (hol->entries && hol->short_options); if (SIZE_MAX <= UINT_MAX) assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry)); /* Fill in the entries. */ so = hol->short_options; for (o = opts, entry = hol->entries; ! oend (o); entry++) { entry->opt = o; entry->num = 0; entry->short_options = so; entry->group = cur_group = o->group ? o->group : ((!o->name && !o->key) ? cur_group + 1 : cur_group); entry->cluster = cluster; entry->argp = argp; do { entry->num++; if (oshort (o) && ! find_char ((char) o->key, hol->short_options, so)) /* O has a valid short option which hasn't already been used.*/ *so++ = (char) o->key; o++; } while (! oend (o) && oalias (o)); } *so = '\0'; /* null terminated so we can find the length */ } return hol; } /* Add a new cluster to HOL, with the given GROUP and HEADER (taken from the associated argp child list entry), INDEX, and PARENT, and return a pointer to it. ARGP is the argp that this cluster results from. */ static struct hol_cluster * hol_add_cluster (struct hol *hol, int group, const char *header, int index, struct hol_cluster *parent, const struct argp *argp) { struct hol_cluster *cl = malloc (sizeof (struct hol_cluster)); if (cl) { cl->group = group; cl->header = header; cl->index = index; cl->parent = parent; cl->argp = argp; cl->depth = parent ? parent->depth + 1 : 0; cl->next = hol->clusters; hol->clusters = cl; } return cl; } /* Free HOL and any resources it uses. */ static void hol_free (struct hol *hol) { struct hol_cluster *cl = hol->clusters; while (cl) { struct hol_cluster *next = cl->next; free (cl); cl = next; } if (hol->num_entries > 0) { free (hol->entries); free (hol->short_options); } free (hol); } static int hol_entry_short_iterate (const struct hol_entry *entry, int (*func)(const struct argp_option *opt, const struct argp_option *real, const char *domain, void *cookie), const char *domain, void *cookie) { unsigned nopts; int val = 0; const struct argp_option *opt, *real = entry->opt; char *so = entry->short_options; for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--) if (oshort (opt) && *so == opt->key) { if (!oalias (opt)) real = opt; if (ovisible (opt)) val = (*func)(opt, real, domain, cookie); so++; } return val; } static inline int __attribute__ ((always_inline)) hol_entry_long_iterate (const struct hol_entry *entry, int (*func)(const struct argp_option *opt, const struct argp_option *real, const char *domain, void *cookie), const char *domain, void *cookie) { unsigned nopts; int val = 0; const struct argp_option *opt, *real = entry->opt; for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--) if (opt->name) { if (!oalias (opt)) real = opt; if (ovisible (opt)) val = (*func)(opt, real, domain, cookie); } return val; } /* Iterator that returns true for the first short option. */ static inline int until_short (const struct argp_option *opt, const struct argp_option *real, const char *domain, void *cookie) { (void) real; (void) domain; (void) cookie; return oshort (opt) ? opt->key : 0; } /* Returns the first valid short option in ENTRY, or 0 if there is none. */ static char hol_entry_first_short (const struct hol_entry *entry) { return (char) hol_entry_short_iterate (entry, until_short, entry->argp->argp_domain, 0); } /* Returns the first valid long option in ENTRY, or 0 if there is none. */ static const char * hol_entry_first_long (const struct hol_entry *entry) { const struct argp_option *opt; unsigned num; for (opt = entry->opt, num = entry->num; num > 0; opt++, num--) if (opt->name && ovisible (opt)) return opt->name; return 0; } /* Returns the entry in HOL with the long option name NAME, or 0 if there is none. */ static struct hol_entry * hol_find_entry (struct hol *hol, const char *name) { struct hol_entry *entry = hol->entries; unsigned num_entries = hol->num_entries; while (num_entries-- > 0) { const struct argp_option *opt = entry->opt; unsigned num_opts = entry->num; while (num_opts-- > 0) if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0) return entry; else opt++; entry++; } return 0; } /* If an entry with the long option NAME occurs in HOL, set it's special sort position to GROUP. */ static void hol_set_group (struct hol *hol, const char *name, int group) { struct hol_entry *entry = hol_find_entry (hol, name); if (entry) entry->group = group; } /* Order by group: 0, 1, 2, ..., n, -m, ..., -2, -1. EQ is what to return if GROUP1 and GROUP2 are the same. */ static int group_cmp (int group1, int group2, int eq) { if (group1 == group2) return eq; else if ((group1 < 0 && group2 < 0) || (group1 >= 0 && group2 >= 0)) return group1 - group2; else return group2 - group1; } /* Compare clusters CL1 & CL2 by the order that they should appear in output. */ static int hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2) { /* If one cluster is deeper than the other, use its ancestor at the same level, so that finding the common ancestor is straightforward. */ while (cl1->depth < cl2->depth) cl1 = cl1->parent; while (cl2->depth < cl1->depth) cl2 = cl2->parent; /* Now reduce both clusters to their ancestors at the point where both have a common parent; these can be directly compared. */ while (cl1->parent != cl2->parent) cl1 = cl1->parent, cl2 = cl2->parent; return group_cmp (cl1->group, cl2->group, cl2->index - cl1->index); } /* Return the ancestor of CL that's just below the root (i.e., has a parent of 0). */ static struct hol_cluster * hol_cluster_base (struct hol_cluster *cl) { while (cl->parent) cl = cl->parent; return cl; } /* Return true if CL1 is a child of CL2. */ static int hol_cluster_is_child (const struct hol_cluster *cl1, const struct hol_cluster *cl2) { while (cl1 && cl1 != cl2) cl1 = cl1->parent; return cl1 == cl2; } /* Given the name of a OPTION_DOC option, modifies NAME to start at the tail that should be used for comparisons, and returns true iff it should be treated as a non-option. */ static int canon_doc_option (const char **name) { int non_opt; if (!*name) non_opt = 1; else { /* Skip initial whitespace. */ while (isspace (**name)) (*name)++; /* Decide whether this looks like an option (leading `-') or not. */ non_opt = (**name != '-'); /* Skip until part of name used for sorting. */ while (**name && !isalnum (**name)) (*name)++; } return non_opt; } /* Order ENTRY1 & ENTRY2 by the order which they should appear in a help listing. */ static int hol_entry_cmp (const struct hol_entry *entry1, const struct hol_entry *entry2) { /* The group numbers by which the entries should be ordered; if either is in a cluster, then this is just the group within the cluster. */ int group1 = entry1->group, group2 = entry2->group; if (entry1->cluster != entry2->cluster) { /* The entries are not within the same cluster, so we can't compare them directly, we have to use the appropriate clustering level too. */ if (! entry1->cluster) /* ENTRY1 is at the `base level', not in a cluster, so we have to compare it's group number with that of the base cluster in which ENTRY2 resides. Note that if they're in the same group, the clustered option always comes laster. */ return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1); else if (! entry2->cluster) /* Likewise, but ENTRY2's not in a cluster. */ return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1); else /* Both entries are in clusters, we can just compare the clusters. */ return hol_cluster_cmp (entry1->cluster, entry2->cluster); } else if (group1 == group2) /* The entries are both in the same cluster and group, so compare them alphabetically. */ { int short1 = hol_entry_first_short (entry1); int short2 = hol_entry_first_short (entry2); int doc1 = odoc (entry1->opt); int doc2 = odoc (entry2->opt); const char *long1 = hol_entry_first_long (entry1); const char *long2 = hol_entry_first_long (entry2); if (doc1) doc1 = canon_doc_option (&long1); if (doc2) doc2 = canon_doc_option (&long2); if (doc1 != doc2) /* `documentation' options always follow normal options (or documentation options that *look* like normal options). */ return doc1 - doc2; else if (!short1 && !short2 && long1 && long2) /* Only long options. */ return __strcasecmp (long1, long2); else /* Compare short/short, long/short, short/long, using the first character of long options. Entries without *any* valid options (such as options with OPTION_HIDDEN set) will be put first, but as they're not displayed, it doesn't matter where they are. */ { char first1 = (char) (short1 ? short1 : long1 ? *long1 : 0); char first2 = (char) (short2 ? short2 : long2 ? *long2 : 0); #ifdef _tolower int lower_cmp = _tolower (first1) - _tolower (first2); #else int lower_cmp = tolower (first1) - tolower (first2); #endif /* Compare ignoring case, except when the options are both the same letter, in which case lower-case always comes first. */ return lower_cmp ? lower_cmp : first2 - first1; } } else /* Within the same cluster, but not the same group, so just compare groups. */ return group_cmp (group1, group2, 0); } /* Version of hol_entry_cmp with correct signature for qsort. */ static int hol_entry_qcmp (const void *entry1_v, const void *entry2_v) { return hol_entry_cmp (entry1_v, entry2_v); } /* Sort HOL by group and alphabetically by option name (with short options taking precedence over long). Since the sorting is for display purposes only, the shadowing of options isn't effected. */ static void hol_sort (struct hol *hol) { if (hol->num_entries > 0) qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry), hol_entry_qcmp); } /* Append MORE to HOL, destroying MORE in the process. Options in HOL shadow any in MORE with the same name. */ static void hol_append (struct hol *hol, struct hol *more) { struct hol_cluster **cl_end = &hol->clusters; /* Steal MORE's cluster list, and add it to the end of HOL's. */ while (*cl_end) cl_end = &(*cl_end)->next; *cl_end = more->clusters; more->clusters = 0; /* Merge entries. */ if (more->num_entries > 0) { if (hol->num_entries == 0) { hol->num_entries = more->num_entries; hol->entries = more->entries; hol->short_options = more->short_options; more->num_entries = 0; /* Mark MORE's fields as invalid. */ } else /* Append the entries in MORE to those in HOL, taking care to only add non-shadowed SHORT_OPTIONS values. */ { unsigned left; char *so, *more_so; struct hol_entry *e; unsigned num_entries = hol->num_entries + more->num_entries; struct hol_entry *entries = malloc (num_entries * sizeof (struct hol_entry)); unsigned hol_so_len = (unsigned) strlen (hol->short_options); char *short_options = malloc (hol_so_len + strlen (more->short_options) + 1); assert (entries && short_options); if (SIZE_MAX <= UINT_MAX) assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry)); __mempcpy (__mempcpy (entries, hol->entries, hol->num_entries * sizeof (struct hol_entry)), more->entries, more->num_entries * sizeof (struct hol_entry)); __mempcpy (short_options, hol->short_options, hol_so_len); /* Fix up the short options pointers from HOL. */ for (e = entries, left = hol->num_entries; left > 0; e++, left--) e->short_options += (short_options - hol->short_options); /* Now add the short options from MORE, fixing up its entries too. */ so = short_options + hol_so_len; more_so = more->short_options; for (left = more->num_entries; left > 0; e++, left--) { int opts_left; const struct argp_option *opt; e->short_options = so; for (opts_left = (int) e->num, opt = e->opt; opts_left; opt++, opts_left--) { int ch = *more_so; if (oshort (opt) && ch == opt->key) /* The next short option in MORE_SO, CH, is from OPT. */ { if (! find_char ((char) ch, short_options, short_options + hol_so_len)) /* The short option CH isn't shadowed by HOL's options, so add it to the sum. */ *so++ = (char) ch; more_so++; } } } *so = '\0'; free (hol->entries); free (hol->short_options); hol->entries = entries; hol->num_entries = num_entries; hol->short_options = short_options; } } hol_free (more); } /* Inserts enough spaces to make sure STREAM is at column COL. */ static void indent_to (argp_fmtstream_t stream, unsigned col) { int needed = (int) (col - __argp_fmtstream_point (stream)); while (needed-- > 0) __argp_fmtstream_putc (stream, ' '); } /* Output to STREAM either a space, or a newline if there isn't room for at least ENSURE characters before the right margin. */ static void space (argp_fmtstream_t stream, size_t ensure) { if (__argp_fmtstream_point (stream) + ensure >= __argp_fmtstream_rmargin (stream)) __argp_fmtstream_putc (stream, '\n'); else __argp_fmtstream_putc (stream, ' '); } /* If the option REAL has an argument, we print it in using the printf format REQ_FMT or OPT_FMT depending on whether it's a required or optional argument. */ static void arg (const struct argp_option *real, const char *req_fmt, const char *opt_fmt, const char *domain, argp_fmtstream_t stream) { if (real->arg) { if (real->flags & OPTION_ARG_OPTIONAL) __argp_fmtstream_printf (stream, opt_fmt, dgettext (domain, real->arg)); else __argp_fmtstream_printf (stream, req_fmt, dgettext (domain, real->arg)); } } /* Helper functions for hol_entry_help. */ /* State used during the execution of hol_help. */ struct hol_help_state { /* PREV_ENTRY should contain the previous entry printed, or 0. */ struct hol_entry *prev_entry; /* If an entry is in a different group from the previous one, and SEP_GROUPS is true, then a blank line will be printed before any output. */ int sep_groups; /* True if a duplicate option argument was suppressed (only ever set if UPARAMS.dup_args is false). */ int suppressed_dup_arg; }; /* Some state used while printing a help entry (used to communicate with helper functions). See the doc for hol_entry_help for more info, as most of the fields are copied from its arguments. */ struct pentry_state { const struct hol_entry *entry; argp_fmtstream_t stream; struct hol_help_state *hhstate; /* True if nothing's been printed so far. */ int first; /* If non-zero, the state that was used to print this help. */ const struct argp_state *state; }; /* If a user doc filter should be applied to DOC, do so. */ static const char * filter_doc (const char *doc, int key, const struct argp *argp, const struct argp_state *state) { if (argp->help_filter) /* We must apply a user filter to this output. */ { void *input = __argp_input (argp, state); return (*argp->help_filter) (key, doc, input); } else /* No filter. */ return doc; } /* Prints STR as a header line, with the margin lines set appropriately, and notes the fact that groups should be separated with a blank line. ARGP is the argp that should dictate any user doc filtering to take place. Note that the previous wrap margin isn't restored, but the left margin is reset to 0. */ static void print_header (const char *str, const struct argp *argp, struct pentry_state *pest) { const char *tstr = dgettext (argp->argp_domain, str); const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest->state); if (fstr) { if (*fstr) { if (pest->hhstate->prev_entry) /* Precede with a blank line. */ __argp_fmtstream_putc (pest->stream, '\n'); indent_to (pest->stream, (unsigned) uparams.header_col); __argp_fmtstream_set_lmargin (pest->stream, (size_t) uparams.header_col); __argp_fmtstream_set_wmargin (pest->stream, (size_t) uparams.header_col); __argp_fmtstream_puts (pest->stream, fstr); __argp_fmtstream_set_lmargin (pest->stream, 0); __argp_fmtstream_putc (pest->stream, '\n'); } pest->hhstate->sep_groups = 1; /* Separate subsequent groups. */ } if (fstr != tstr) free ((char *) fstr); } /* Inserts a comma if this isn't the first item on the line, and then makes sure we're at least to column COL. If this *is* the first item on a line, prints any pending whitespace/headers that should precede this line. Also clears FIRST. */ static void comma (unsigned col, struct pentry_state *pest) { if (pest->first) { const struct hol_entry *pe = pest->hhstate->prev_entry; const struct hol_cluster *cl = pest->entry->cluster; if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group) __argp_fmtstream_putc (pest->stream, '\n'); if (cl && cl->header && *cl->header && (!pe || (pe->cluster != cl && !hol_cluster_is_child (pe->cluster, cl)))) /* If we're changing clusters, then this must be the start of the ENTRY's cluster unless that is an ancestor of the previous one (in which case we had just popped into a sub-cluster for a bit). If so, then print the cluster's header line. */ { int old_wm = (int) __argp_fmtstream_wmargin (pest->stream); print_header (cl->header, cl->argp, pest); __argp_fmtstream_set_wmargin (pest->stream, (size_t) old_wm); } pest->first = 0; } else __argp_fmtstream_puts (pest->stream, ", "); indent_to (pest->stream, col); } /* Print help for ENTRY to STREAM. */ static void hol_entry_help (struct hol_entry *entry, const struct argp_state *state, argp_fmtstream_t stream, struct hol_help_state *hhstate) { unsigned num; const struct argp_option *real = entry->opt, *opt; char *so = entry->short_options; int have_long_opt = 0; /* We have any long options. */ /* Saved margins. */ int old_lm = (int) __argp_fmtstream_set_lmargin (stream, 0); int old_wm = (int) __argp_fmtstream_wmargin (stream); /* PEST is a state block holding some of our variables that we'd like to share with helper functions. */ struct pentry_state pest; pest.entry = entry; pest.stream = stream; pest.hhstate = hhstate; pest.first = 1; pest.state = state; if (! odoc (real)) for (opt = real, num = entry->num; num > 0; opt++, num--) if (opt->name && ovisible (opt)) { have_long_opt = 1; break; } /* First emit short options. */ __argp_fmtstream_set_wmargin (stream, (size_t) uparams.short_opt_col); /* For truly bizarre cases. */ for (opt = real, num = entry->num; num > 0; opt++, num--) if (oshort (opt) && opt->key == *so) /* OPT has a valid (non shadowed) short option. */ { if (ovisible (opt)) { comma ((unsigned) uparams.short_opt_col, &pest); __argp_fmtstream_putc (stream, '-'); __argp_fmtstream_putc (stream, *so); if (!have_long_opt || uparams.dup_args) arg (real, " %s", "[%s]", state->root_argp->argp_domain, stream); else if (real->arg) hhstate->suppressed_dup_arg = 1; } so++; } /* Now, long options. */ if (odoc (real)) /* A `documentation' option. */ { __argp_fmtstream_set_wmargin (stream, (unsigned) uparams.doc_opt_col); for (opt = real, num = entry->num; num > 0; opt++, num--) if (opt->name && *opt->name && ovisible (opt)) { comma ((unsigned) uparams.doc_opt_col, &pest); /* Calling dgettext here isn't quite right, since sorting will have been done on the original; but documentation options should be pretty rare anyway... */ __argp_fmtstream_puts (stream, onotrans (opt) ? opt->name : dgettext (state->root_argp->argp_domain, opt->name)); } } else /* A real long option. */ { int first_long_opt = 1; __argp_fmtstream_set_wmargin (stream, (unsigned) uparams.long_opt_col); for (opt = real, num = entry->num; num > 0; opt++, num--) if (opt->name && ovisible (opt)) { comma ((unsigned) uparams.long_opt_col, &pest); __argp_fmtstream_printf (stream, "--%s", opt->name); if (first_long_opt || uparams.dup_args) arg (real, "=%s", "[=%s]", state->root_argp->argp_domain, stream); else if (real->arg) hhstate->suppressed_dup_arg = 1; } } /* Next, documentation strings. */ __argp_fmtstream_set_lmargin (stream, 0); if (pest.first) { /* Didn't print any switches, what's up? */ if (!oshort (real) && !real->name) /* This is a group header, print it nicely. */ print_header (real->doc, entry->argp, &pest); else /* Just a totally shadowed option or null header; print nothing. */ goto cleanup; /* Just return, after cleaning up. */ } else { const char *tstr = real->doc ? dgettext (state->root_argp->argp_domain, real->doc) : 0; const char *fstr = filter_doc (tstr, real->key, entry->argp, state); if (fstr && *fstr) { unsigned int col = (unsigned) __argp_fmtstream_point (stream); __argp_fmtstream_set_lmargin (stream, (size_t) uparams.opt_doc_col); __argp_fmtstream_set_wmargin (stream, (size_t) uparams.opt_doc_col); if (col > (unsigned int) (uparams.opt_doc_col + 3)) __argp_fmtstream_putc (stream, '\n'); else if (col >= (unsigned int) uparams.opt_doc_col) __argp_fmtstream_puts (stream, " "); else indent_to (stream, (unsigned) uparams.opt_doc_col); __argp_fmtstream_puts (stream, fstr); } if (fstr && fstr != tstr) free ((char *) fstr); /* Reset the left margin. */ __argp_fmtstream_set_lmargin (stream, 0); __argp_fmtstream_putc (stream, '\n'); } hhstate->prev_entry = entry; cleanup: __argp_fmtstream_set_lmargin (stream, (size_t) old_lm); __argp_fmtstream_set_wmargin (stream, (size_t) old_wm); } /* Output a long help message about the options in HOL to STREAM. */ static void hol_help (struct hol *hol, const struct argp_state *state, argp_fmtstream_t stream) { unsigned num; struct hol_entry *entry; struct hol_help_state hhstate = { 0, 0, 0 }; for (entry = hol->entries, num = hol->num_entries; num > 0; entry++, num--) hol_entry_help (entry, state, stream, &hhstate); if (hhstate.suppressed_dup_arg && uparams.dup_args_note) { const char *tstr = dgettext (state->root_argp->argp_domain, "\ Mandatory or optional arguments to long options are also mandatory or \ optional for any corresponding short options."); const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE, state ? state->root_argp : 0, state); if (fstr && *fstr) { __argp_fmtstream_putc (stream, '\n'); __argp_fmtstream_puts (stream, fstr); __argp_fmtstream_putc (stream, '\n'); } if (fstr && fstr != tstr) free ((char *) fstr); } } /* Helper functions for hol_usage. */ /* If OPT is a short option without an arg, append its key to the string pointer pointer to by COOKIE, and advance the pointer. */ static int add_argless_short_opt (const struct argp_option *opt, const struct argp_option *real, const char *domain, void *cookie) { char **snao_end = cookie; (void) domain; if (!(opt->arg || real->arg) && !((opt->flags | real->flags) & OPTION_NO_USAGE)) *(*snao_end)++ = (char) opt->key; return 0; } /* If OPT is a short option with an arg, output a usage entry for it to the stream pointed at by COOKIE. */ static int usage_argful_short_opt (const struct argp_option *opt, const struct argp_option *real, const char *domain, void *cookie) { argp_fmtstream_t stream = cookie; const char *arg = opt->arg; int flags = opt->flags | real->flags; if (! arg) arg = real->arg; if (arg && !(flags & OPTION_NO_USAGE)) { arg = dgettext (domain, arg); if (flags & OPTION_ARG_OPTIONAL) __argp_fmtstream_printf (stream, " [-%c[%s]]", opt->key, arg); else { /* Manually do line wrapping so that it (probably) won't get wrapped at the embedded space. */ space (stream, 6 + strlen (arg)); __argp_fmtstream_printf (stream, "[-%c %s]", opt->key, arg); } } return 0; } /* Output a usage entry for the long option opt to the stream pointed at by COOKIE. */ static int usage_long_opt (const struct argp_option *opt, const struct argp_option *real, const char *domain, void *cookie) { argp_fmtstream_t stream = cookie; const char *arg = opt->arg; int flags = opt->flags | real->flags; if (! arg) arg = real->arg; if (! (flags & OPTION_NO_USAGE) && !odoc (opt)) { if (arg) { arg = dgettext (domain, arg); if (flags & OPTION_ARG_OPTIONAL) __argp_fmtstream_printf (stream, " [--%s[=%s]]", opt->name, arg); else __argp_fmtstream_printf (stream, " [--%s=%s]", opt->name, arg); } else __argp_fmtstream_printf (stream, " [--%s]", opt->name); } return 0; } /* Print a short usage description for the arguments in HOL to STREAM. */ static void hol_usage (struct hol *hol, argp_fmtstream_t stream) { if (hol->num_entries > 0) { unsigned nentries; struct hol_entry *entry; char *short_no_arg_opts = alloca (strlen (hol->short_options) + 1); char *snao_end = short_no_arg_opts; /* First we put a list of short options without arguments. */ for (entry = hol->entries, nentries = hol->num_entries ; nentries > 0 ; entry++, nentries--) hol_entry_short_iterate (entry, add_argless_short_opt, entry->argp->argp_domain, &snao_end); if (snao_end > short_no_arg_opts) { *snao_end++ = 0; __argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts); } /* Now a list of short options *with* arguments. */ for (entry = hol->entries, nentries = hol->num_entries ; nentries > 0 ; entry++, nentries--) hol_entry_short_iterate (entry, usage_argful_short_opt, entry->argp->argp_domain, stream); /* Finally, a list of long options (whew!). */ for (entry = hol->entries, nentries = hol->num_entries ; nentries > 0 ; entry++, nentries--) hol_entry_long_iterate (entry, usage_long_opt, entry->argp->argp_domain, stream); } } /* Make a HOL containing all levels of options in ARGP. CLUSTER is the cluster in which ARGP's entries should be clustered, or 0. */ static struct hol * argp_hol (const struct argp *argp, struct hol_cluster *cluster) { const struct argp_child *child = argp->children; struct hol *hol = make_hol (argp, cluster); if (child) while (child->argp) { struct hol_cluster *child_cluster = ((child->group || child->header) /* Put CHILD->argp within its own cluster. */ ? hol_add_cluster (hol, child->group, child->header, (int) (child - argp->children), cluster, argp) /* Just merge it into the parent's cluster. */ : cluster); hol_append (hol, argp_hol (child->argp, child_cluster)) ; child++; } return hol; } /* Calculate how many different levels with alternative args strings exist in ARGP. */ static size_t argp_args_levels (const struct argp *argp) { size_t levels = 0; const struct argp_child *child = argp->children; if (argp->args_doc && strchr (argp->args_doc, '\n')) levels++; if (child) while (child->argp) levels += argp_args_levels ((child++)->argp); return levels; } /* Print all the non-option args documented in ARGP to STREAM. Any output is preceded by a space. LEVELS is a pointer to a byte vector the length returned by argp_args_levels; it should be initialized to zero, and updated by this routine for the next call if ADVANCE is true. True is returned as long as there are more patterns to output. */ static int argp_args_usage (const struct argp *argp, const struct argp_state *state, char **levels, int advance, argp_fmtstream_t stream) { char *our_level = *levels; int multiple = 0; const struct argp_child *child = argp->children; const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = 0; const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, argp, state); if (fdoc) { const char *cp = fdoc; nl = __strchrnul (cp, '\n'); if (*nl != '\0') /* This is a `multi-level' args doc; advance to the correct position as determined by our state in LEVELS, and update LEVELS. */ { int i; multiple = 1; for (i = 0; i < *our_level; i++) cp = nl + 1, nl = __strchrnul (cp, '\n'); (*levels)++; } /* Manually do line wrapping so that it (probably) won't get wrapped at any embedded spaces. */ space (stream, 1 + (size_t) (nl - cp)); __argp_fmtstream_write (stream, cp, (size_t) (nl - cp)); } if (fdoc && fdoc != tdoc) free ((char *)fdoc); /* Free user's modified doc string. */ if (child) while (child->argp) advance = !argp_args_usage ((child++)->argp, state, levels, advance, stream); if (advance && multiple) { /* Need to increment our level. */ if (*nl) /* There's more we can do here. */ { (*our_level)++; advance = 0; /* Our parent shouldn't advance also. */ } else if (*our_level > 0) /* We had multiple levels, but used them up; reset to zero. */ *our_level = 0; } return !advance; } /* Print the documentation for ARGP to STREAM; if POST is false, then everything preceding a `\v' character in the documentation strings (or the whole string, for those with none) is printed, otherwise, everything following the `\v' character (nothing for strings without). Each separate bit of documentation is separated a blank line, and if PRE_BLANK is true, then the first is as well. If FIRST_ONLY is true, only the first occurrence is output. Returns true if anything was output. */ static int argp_doc (const struct argp *argp, const struct argp_state *state, int post, int pre_blank, int first_only, argp_fmtstream_t stream) { const char *text; const char *inp_text; size_t inp_text_len = 0; const char *trans_text; void *input = 0; int anything = 0; const struct argp_child *child = argp->children; if (argp->doc) { char *vt = strchr (argp->doc, '\v'); if (vt) { if (post) inp_text = vt + 1; else { inp_text_len = (size_t) (vt - argp->doc); inp_text = __strndup (argp->doc, inp_text_len); } } else inp_text = post ? 0 : argp->doc; trans_text = inp_text ? dgettext (argp->argp_domain, inp_text) : NULL; } else trans_text = inp_text = 0; if (argp->help_filter) /* We have to filter the doc strings. */ { input = __argp_input (argp, state); text = (*argp->help_filter) (post ? ARGP_KEY_HELP_POST_DOC : ARGP_KEY_HELP_PRE_DOC, trans_text, input); } else text = (const char *) trans_text; if (text) { if (pre_blank) __argp_fmtstream_putc (stream, '\n'); __argp_fmtstream_puts (stream, text); if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream)) __argp_fmtstream_putc (stream, '\n'); anything = 1; } if (text && text != trans_text) free ((char *) text); /* Free TEXT returned from the help filter. */ if (inp_text && inp_text_len) free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */ if (post && argp->help_filter) /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */ { text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input); if (text) { if (anything || pre_blank) __argp_fmtstream_putc (stream, '\n'); __argp_fmtstream_puts (stream, text); free ((char *) text); if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream)) __argp_fmtstream_putc (stream, '\n'); anything = 1; } } if (child) while (child->argp && !(first_only && anything)) anything |= argp_doc ((child++)->argp, state, post, anything || pre_blank, first_only, stream); return anything; } /* Output a usage message for ARGP to STREAM. If called from argp_state_help, STATE is the relevant parsing state. FLAGS are from the set ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */ static void _help (const struct argp *argp, const struct argp_state *state, FILE *stream, unsigned flags, char *name) { int anything = 0; /* Whether we've output anything. */ struct hol *hol = 0; argp_fmtstream_t fs; if (! stream) return; #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) __flockfile (stream); #endif if (! uparams.valid) fill_in_uparams (state); fs = __argp_make_fmtstream (stream, 0, (size_t) uparams.rmargin, 0); if (! fs) { #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) __funlockfile (stream); #endif return; } if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG)) { hol = argp_hol (argp, 0); /* If present, these options always come last. */ hol_set_group (hol, "help", -1); hol_set_group (hol, "version", -1); hol_sort (hol); } if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE)) /* Print a short `Usage:' message. */ { int first_pattern = 1, more_patterns; size_t num_pattern_levels = argp_args_levels (argp); char *pattern_levels = alloca (num_pattern_levels); memset (pattern_levels, 0, num_pattern_levels); do { int old_lm; int old_wm = (int) __argp_fmtstream_set_wmargin (fs, (size_t) uparams.usage_indent); char *levels = pattern_levels; if (first_pattern) __argp_fmtstream_printf (fs, "%s %s", dgettext (argp->argp_domain, "Usage:"), name); else __argp_fmtstream_printf (fs, "%s %s", dgettext (argp->argp_domain, " or: "), name); /* We set the lmargin as well as the wmargin, because hol_usage manually wraps options with newline to avoid annoying breaks. */ old_lm = (int) __argp_fmtstream_set_lmargin (fs, (size_t) uparams.usage_indent); if (flags & ARGP_HELP_SHORT_USAGE) /* Just show where the options go. */ { if (hol->num_entries > 0) __argp_fmtstream_puts (fs, dgettext (argp->argp_domain, " [OPTION...]")); } else /* Actually print the options. */ { hol_usage (hol, fs); flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */ } more_patterns = argp_args_usage (argp, state, &levels, 1, fs); __argp_fmtstream_set_wmargin (fs, (size_t) old_wm); __argp_fmtstream_set_lmargin (fs, (size_t) old_lm); __argp_fmtstream_putc (fs, '\n'); anything = 1; first_pattern = 0; } while (more_patterns); } if (flags & ARGP_HELP_PRE_DOC) anything |= argp_doc (argp, state, 0, 0, 1, fs); if (flags & ARGP_HELP_SEE) { __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "\ Try `%s --help' or `%s --usage' for more information.\n"), name, name); anything = 1; } if (flags & ARGP_HELP_LONG) /* Print a long, detailed help message. */ { /* Print info about all the options. */ if (hol->num_entries > 0) { if (anything) __argp_fmtstream_putc (fs, '\n'); hol_help (hol, state, fs); anything = 1; } } if (flags & ARGP_HELP_POST_DOC) /* Print any documentation strings at the end. */ anything |= argp_doc (argp, state, 1, anything, 0, fs); if ((flags & ARGP_HELP_BUG_ADDR) && argp_program_bug_address) { if (anything) __argp_fmtstream_putc (fs, '\n'); __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "Report bugs to %s.\n"), argp_program_bug_address); anything = 1; } #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) __funlockfile (stream); #endif if (hol) hol_free (hol); __argp_fmtstream_free (fs); } /* Output a usage message for ARGP to STREAM. FLAGS are from the set ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */ void __argp_help (const struct argp *argp, FILE *stream, unsigned flags, char *name) { struct argp_state state; memset (&state, 0, sizeof state); state.root_argp = argp; _help (argp, &state, stream, flags, name); } #ifdef weak_alias weak_alias (__argp_help, argp_help) #endif #if ! (defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME) char * __argp_short_program_name (void) { # if HAVE_DECL_PROGRAM_INVOCATION_NAME return __argp_base_name (program_invocation_name); # else /* FIXME: What now? Miles suggests that it is better to use NULL, but currently the value is passed on directly to fputs_unlocked, so that requires more changes. */ # if __GNUC__ # warning No reasonable value to return # endif /* __GNUC__ */ return ""; # endif } #endif /* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are from the set ARGP_HELP_*. */ void __argp_state_help (const struct argp_state *state, FILE *stream, unsigned flags) { if ((!state || ! (state->flags & ARGP_NO_ERRS)) && stream) { if (state && (state->flags & ARGP_LONG_ONLY)) flags |= ARGP_HELP_LONG_ONLY; _help (state ? state->root_argp : 0, state, stream, flags, state ? state->name : __argp_short_program_name ()); if (!state || ! (state->flags & ARGP_NO_EXIT)) { if (flags & ARGP_HELP_EXIT_ERR) exit (argp_err_exit_status); if (flags & ARGP_HELP_EXIT_OK) exit (0); } } } #ifdef weak_alias weak_alias (__argp_state_help, argp_state_help) #endif /* If appropriate, print the printf string FMT and following args, preceded by the program name and `:', to stderr, and followed by a `Try ... --help' message, then exit (1). */ void __argp_error (const struct argp_state *state, const char *fmt, ...) { if (!state || !(state->flags & ARGP_NO_ERRS)) { FILE *stream = state ? state->err_stream : stderr; if (stream) { va_list ap; #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) __flockfile (stream); #endif va_start (ap, fmt); #ifdef USE_IN_LIBIO if (_IO_fwide (stream, 0) > 0) { char *buf; if (__asprintf (&buf, fmt, ap) < 0) buf = NULL; __fwprintf (stream, L"%s: %s\n", state ? state->name : __argp_short_program_name (), buf); free (buf); } else #endif { fputs_unlocked (state ? state->name : __argp_short_program_name (), stream); putc_unlocked (':', stream); putc_unlocked (' ', stream); vfprintf (stream, fmt, ap); putc_unlocked ('\n', stream); } __argp_state_help (state, stream, ARGP_HELP_STD_ERR); va_end (ap); #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) __funlockfile (stream); #endif } } } #ifdef weak_alias weak_alias (__argp_error, argp_error) #endif /* Similar to the standard gnu error-reporting function error(), but will respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print to STATE->err_stream. This is useful for argument parsing code that is shared between program startup (when exiting is desired) and runtime option parsing (when typically an error code is returned instead). The difference between this function and argp_error is that the latter is for *parsing errors*, and the former is for other problems that occur during parsing but don't reflect a (syntactic) problem with the input. */ void __argp_failure (const struct argp_state *state, int status, int errnum, const char *fmt, ...) { if (!state || !(state->flags & ARGP_NO_ERRS)) { FILE *stream = state ? state->err_stream : stderr; if (stream) { #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) __flockfile (stream); #endif #ifdef USE_IN_LIBIO if (_IO_fwide (stream, 0) > 0) __fwprintf (stream, L"%s", state ? state->name : __argp_short_program_name ()); else #endif fputs_unlocked (state ? state->name : __argp_short_program_name (), stream); if (fmt) { va_list ap; va_start (ap, fmt); #ifdef USE_IN_LIBIO if (_IO_fwide (stream, 0) > 0) { char *buf; if (__asprintf (&buf, fmt, ap) < 0) buf = NULL; __fwprintf (stream, L": %s", buf); free (buf); } else #endif { putc_unlocked (':', stream); putc_unlocked (' ', stream); vfprintf (stream, fmt, ap); } va_end (ap); } if (errnum) { char buf[200]; (void) buf; #ifdef USE_IN_LIBIO if (_IO_fwide (stream, 0) > 0) __fwprintf (stream, L": %s", __strerror_r (errnum, buf, sizeof (buf))); else #endif { char const *s = NULL; putc_unlocked (':', stream); putc_unlocked (' ', stream); #if _LIBC || (HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P) s = __strerror_r (errnum, buf, sizeof buf); #elif HAVE_DECL_STRERROR_R if (__strerror_r (errnum, buf, sizeof buf) == 0) s = buf; #endif #if !_LIBC if (! s && ! (s = strerror (errnum))) s = dgettext (state->root_argp->argp_domain, "Unknown system error"); #endif fputs (s, stream); } } #ifdef USE_IN_LIBIO if (_IO_fwide (stream, 0) > 0) putwc_unlocked (L'\n', stream); else #endif putc_unlocked ('\n', stream); #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) __funlockfile (stream); #endif if (status && (!state || !(state->flags & ARGP_NO_EXIT))) exit (status); } } } #ifdef weak_alias weak_alias (__argp_failure, argp_failure) #endif blame-1.4-20240206/lib/argp-pv.c0000644000000000000000000000232610527555557014342 0ustar rootroot/* Default definition for ARGP_PROGRAM_VERSION. Copyright (C) 1996, 1997, 1999, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ /* If set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which will print this string followed by a newline and exit (unless the ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ const char *argp_program_version; blame-1.4-20240206/lib/size_max.h0000644000000000000000000000230710527555557014611 0ustar rootroot/* size_max.h -- declare SIZE_MAX through system headers Copyright (C) 2005-2006 Free Software Foundation, Inc. Written by Simon Josefsson. 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. */ #ifndef GNULIB_SIZE_MAX_H #define GNULIB_SIZE_MAX_H /* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */ # include /* Get SIZE_MAX declaration on systems like glibc 2. */ # if HAVE_STDINT_H # include # endif /* On systems where these include files don't define it, SIZE_MAX is defined in config.h. */ #endif /* GNULIB_SIZE_MAX_H */ blame-1.4-20240206/lib/argp-fmtstream.c0000644000000000000000000002676714557306065015731 0ustar rootroot/* Word-wrapping and line-truncating streams Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ /* This package emulates glibc `line_wrap_stream' semantics for systems that don't have that. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include "argp-fmtstream.h" #include "argp-namefrob.h" #ifndef ARGP_FMTSTREAM_USE_LINEWRAP #ifndef isblank #define isblank(ch) ((ch)==' ' || (ch)=='\t') #endif #if defined _LIBC && defined USE_IN_LIBIO # include # include # define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a) #endif #define INIT_BUF_SIZE 200 #define PRINTF_SIZE_GUESS 150 /* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines written on it with LMARGIN spaces and limits them to RMARGIN columns total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by replacing the whitespace before them with a newline and WMARGIN spaces. Otherwise, chars beyond RMARGIN are simply dropped until a newline. Returns NULL if there was an error. */ argp_fmtstream_t __argp_make_fmtstream (FILE *stream, size_t lmargin, size_t rmargin, ssize_t wmargin) { argp_fmtstream_t fs; fs = (struct argp_fmtstream *) malloc (sizeof (struct argp_fmtstream)); if (fs != NULL) { fs->stream = stream; fs->lmargin = lmargin; fs->rmargin = rmargin; fs->wmargin = wmargin; fs->point_col = 0; fs->point_offs = 0; fs->buf = (char *) malloc (INIT_BUF_SIZE); if (! fs->buf) { free (fs); fs = 0; } else { fs->p = fs->buf; fs->end = fs->buf + INIT_BUF_SIZE; } } return fs; } #if 0 /* Not exported. */ #ifdef weak_alias weak_alias (__argp_make_fmtstream, argp_make_fmtstream) #endif #endif /* Flush FS to its stream, and free it (but don't close the stream). */ void __argp_fmtstream_free (argp_fmtstream_t fs) { __argp_fmtstream_update (fs); if (fs->p > fs->buf) { #ifdef USE_IN_LIBIO __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf); #else fwrite_unlocked (fs->buf, 1, (size_t) (fs->p - fs->buf), fs->stream); #endif } free (fs->buf); free (fs); } #if 0 /* Not exported. */ #ifdef weak_alias weak_alias (__argp_fmtstream_free, argp_fmtstream_free) #endif #endif /* Process FS's buffer so that line wrapping is done from POINT_OFFS to the end of its buffer. This code is mostly from glibc stdio/linewrap.c. */ void __argp_fmtstream_update (argp_fmtstream_t fs) { char *buf, *nl; size_t len; /* Scan the buffer for newlines. */ buf = fs->buf + fs->point_offs; while (buf < fs->p) { size_t r; if (fs->point_col == 0 && fs->lmargin != 0) { /* We are starting a new line. Print spaces to the left margin. */ const size_t pad = fs->lmargin; if (fs->p + pad < fs->end) { /* We can fit in them in the buffer by moving the buffer text up and filling in the beginning. */ memmove (buf + pad, buf, (size_t) (fs->p - buf)); fs->p += pad; /* Compensate for bigger buffer. */ memset (buf, ' ', pad); /* Fill in the spaces. */ buf += pad; /* Don't bother searching them. */ } else { /* No buffer space for spaces. Must flush. */ size_t i; for (i = 0; i < pad; i++) { #ifdef USE_IN_LIBIO if (_IO_fwide (fs->stream, 0) > 0) putwc_unlocked (L' ', fs->stream); else #endif putc_unlocked (' ', fs->stream); } } fs->point_col = (ssize_t) pad; } len = (size_t) (fs->p - buf); nl = memchr (buf, '\n', len); if (fs->point_col < 0) fs->point_col = 0; if (!nl) { /* The buffer ends in a partial line. */ if ((size_t) fs->point_col + len < fs->rmargin) { /* The remaining buffer text is a partial line and fits within the maximum line width. Advance point for the characters to be written and stop scanning. */ fs->point_col += (ssize_t) len; break; } else /* Set the end-of-line pointer for the code below to the end of the buffer. */ nl = fs->p; } else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin) { /* The buffer contains a full line that fits within the maximum line width. Reset point and scan the next line. */ fs->point_col = 0; buf = nl + 1; continue; } /* This line is too long. */ r = fs->rmargin - 1; if (fs->wmargin < 0) { /* Truncate the line by overwriting the excess with the newline and anything after it in the buffer. */ if (nl < fs->p) { memmove (buf + (r - (size_t) fs->point_col), nl, (size_t) (fs->p - nl)); fs->p -= buf + (r - (size_t) fs->point_col) - nl; /* Reset point for the next line and start scanning it. */ fs->point_col = 0; buf += r + 1; /* Skip full line plus \n. */ } else { /* The buffer ends with a partial line that is beyond the maximum line width. Advance point for the characters written, and discard those past the max from the buffer. */ fs->point_col += (ssize_t) len; fs->p -= (size_t) fs->point_col - r; break; } } else { /* Do word wrap. Go to the column just past the maximum line width and scan back for the beginning of the word there. Then insert a line break. */ char *p, *nextline; int i; p = buf + (r + 1 - (size_t) fs->point_col); while (p >= buf && !isblank (*p)) --p; nextline = p + 1; /* This will begin the next line. */ if (nextline > buf) { /* Swallow separating blanks. */ if (p >= buf) do --p; while (p >= buf && isblank (*p)); nl = p + 1; /* The newline will replace the first blank. */ } else { /* A single word that is greater than the maximum line width. Oh well. Put it on an overlong line by itself. */ p = buf + (r + 1 - (size_t) fs->point_col); /* Find the end of the long word. */ if (p < nl) do ++p; while (p < nl && !isblank (*p)); if (p == nl) { /* It already ends a line. No fussing required. */ fs->point_col = 0; buf = nl + 1; continue; } /* We will move the newline to replace the first blank. */ nl = p; /* Swallow separating blanks. */ do ++p; while (isblank (*p)); /* The next line will start here. */ nextline = p; } /* Note: There are a bunch of tests below for NEXTLINE == BUF + LEN + 1; this case is where NL happens to fall at the end of the buffer, and NEXTLINE is in fact empty (and so we need not be careful to maintain its contents). */ if ((nextline == buf + len + 1 ? fs->end - nl < fs->wmargin + 1 : nextline - (nl + 1) < fs->wmargin) && fs->p > nextline) { /* The margin needs more blanks than we removed. */ if (fs->end - fs->p > fs->wmargin + 1) /* Make some space for them. */ { size_t mv = (size_t) (fs->p - nextline); memmove (nl + 1 + fs->wmargin, nextline, mv); nextline = nl + 1 + fs->wmargin; len = (size_t) (nextline + mv - buf); *nl++ = '\n'; } else /* Output the first line so we can use the space. */ { #ifdef _LIBC __fxprintf (fs->stream, "%.*s\n", (int) (nl - fs->buf), fs->buf); #else if (nl > fs->buf) fwrite_unlocked (fs->buf, 1, (size_t) (nl - fs->buf), fs->stream); putc_unlocked ('\n', fs->stream); #endif len += (size_t) (buf - fs->buf); nl = buf = fs->buf; } } else /* We can fit the newline and blanks in before the next word. */ *nl++ = '\n'; if (nextline - nl >= fs->wmargin || (nextline == buf + len + 1 && fs->end - nextline >= fs->wmargin)) /* Add blanks up to the wrap margin column. */ for (i = 0; i < fs->wmargin; ++i) *nl++ = ' '; else for (i = 0; i < fs->wmargin; ++i) #ifdef USE_IN_LIBIO if (_IO_fwide (fs->stream, 0) > 0) putwc_unlocked (L' ', fs->stream); else #endif putc_unlocked (' ', fs->stream); /* Copy the tail of the original buffer into the current buffer position. */ if (nl < nextline) memmove (nl, nextline, (size_t) (buf + len - nextline)); len -= (size_t) (nextline - buf); /* Continue the scan on the remaining lines in the buffer. */ buf = nl; /* Restore bufp to include all the remaining text. */ fs->p = nl + len; /* Reset the counter of what has been output this line. If wmargin is 0, we want to avoid the lmargin getting added, so we set point_col to a magic value of -1 in that case. */ fs->point_col = fs->wmargin ? fs->wmargin : -1; } } /* Remember that we've scanned as far as the end of the buffer. */ fs->point_offs = (size_t) (fs->p - fs->buf); } /* Ensure that FS has space for AMOUNT more bytes in its buffer, either by growing the buffer, or by flushing it. True is returned iff we succeed. */ int __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount) { if ((size_t) (fs->end - fs->p) < amount) { ssize_t wrote; /* Flush FS's buffer. */ __argp_fmtstream_update (fs); #ifdef _LIBC __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf); wrote = fs->p - fs->buf; #else wrote = (ssize_t) fwrite_unlocked (fs->buf, 1, (size_t) (fs->p - fs->buf), fs->stream); #endif if (wrote == fs->p - fs->buf) { fs->p = fs->buf; fs->point_offs = 0; } else { fs->p -= wrote; fs->point_offs -= (size_t) wrote; memmove (fs->buf, fs->buf + wrote, (size_t) (fs->p - fs->buf)); return 0; } if ((size_t) (fs->end - fs->buf) < amount) /* Gotta grow the buffer. */ { size_t old_size = (size_t) (fs->end - fs->buf); size_t new_size = old_size + amount; char *new_buf; if (new_size < old_size || ! (new_buf = realloc (fs->buf, new_size))) { __set_errno (ENOMEM); return 0; } fs->buf = new_buf; fs->end = new_buf + new_size; fs->p = fs->buf; } } return 1; } ssize_t __argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...) { int out; size_t avail; size_t size_guess = PRINTF_SIZE_GUESS; /* How much space to reserve. */ do { va_list args; if (! __argp_fmtstream_ensure (fs, size_guess)) return -1; va_start (args, fmt); avail = (size_t) (fs->end - fs->p); out = __vsnprintf (fs->p, avail, fmt, args); va_end (args); if ((size_t) out >= avail) size_guess = (size_t) (out + 1); } while ((size_t) out >= avail); fs->p += out; return out; } #if 0 /* Not exported. */ #ifdef weak_alias weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf) #endif #endif #endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */ blame-1.4-20240206/lib/gettext.h0000644000000000000000000002235110527555557014457 0ustar rootroot/* Convenience header for conditional use of GNU . Copyright (C) 1995-1998, 2000-2002, 2004-2006 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. */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 /* NLS can be disabled through the configure --disable-nls option. */ #if ENABLE_NLS /* Get declarations of GNU message catalog functions. */ # include /* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by the gettext() and ngettext() macros. This is an alternative to calling textdomain(), and is useful for libraries. */ # ifdef DEFAULT_TEXT_DOMAIN # undef gettext # define gettext(Msgid) \ dgettext (DEFAULT_TEXT_DOMAIN, Msgid) # undef ngettext # define ngettext(Msgid1, Msgid2, N) \ dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) # endif #else /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of a NOP. We don't include as well because people using "gettext.h" will not include , and also including would fail on SunOS 4, whereas is OK. */ #if defined(__sun) # include #endif /* Many header files from the libstdc++ coming with g++ 3.3 or newer include , which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of a NOP. */ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) # include # if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H # include # endif #endif /* Disabled NLS. The casts to 'const char *' serve the purpose of producing warnings for invalid uses of the value returned from these functions. On pre-ANSI systems without 'const', the config.h file is supposed to contain "#define const". */ # define gettext(Msgid) ((const char *) (Msgid)) # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) # define dcgettext(Domainname, Msgid, Category) \ ((void) (Category), dgettext (Domainname, Msgid)) # define ngettext(Msgid1, Msgid2, N) \ ((N) == 1 \ ? ((void) (Msgid2), (const char *) (Msgid1)) \ : ((void) (Msgid1), (const char *) (Msgid2))) # define dngettext(Domainname, Msgid1, Msgid2, N) \ ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) # define textdomain(Domainname) ((const char *) (Domainname)) # define bindtextdomain(Domainname, Dirname) \ ((void) (Domainname), (const char *) (Dirname)) # define bind_textdomain_codeset(Domainname, Codeset) \ ((void) (Domainname), (const char *) (Codeset)) #endif /* A pseudo function call that serves as a marker for the automated extraction of messages, but does not call gettext(). The run-time translation is done at a different place in the code. The argument, String, should be a literal string. Concatenated strings and other string expressions won't work. The macro's expansion is not parenthesized, so that it is suitable as initializer for static 'char[]' or 'const char[]' variables. */ #define gettext_noop(String) String /* The separator between msgctxt and msgid in a .mo file. */ #define GETTEXT_CONTEXT_GLUE "\004" /* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be short and rarely need to change. The letter 'p' stands for 'particular' or 'special'. */ #ifdef DEFAULT_TEXT_DOMAIN # define pgettext(Msgctxt, Msgid) \ pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #else # define pgettext(Msgctxt, Msgid) \ pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #endif #define dpgettext(Domainname, Msgctxt, Msgid) \ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) #ifdef DEFAULT_TEXT_DOMAIN # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #else # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #endif #define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * pgettext_aux (const char *domain, const char *msg_ctxt_id, const char *msgid, int category) { const char *translation = dcgettext (domain, msg_ctxt_id, category); if (translation == msg_ctxt_id) return msgid; else return translation; } #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * npgettext_aux (const char *domain, const char *msg_ctxt_id, const char *msgid, const char *msgid_plural, unsigned long int n, int category) { const char *translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); if (translation == msg_ctxt_id || translation == msgid_plural) return (n == 1 ? msgid : msgid_plural); else return translation; } /* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID can be arbitrary expressions. But for string literals these macros are less efficient than those above. */ #include #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ (__GNUC__ >= 3 || __GNUG__ >= 2 /* || __STDC_VERSION__ >= 199901L */ ) #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #include #endif #define pgettext_expr(Msgctxt, Msgid) \ dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) #define dpgettext_expr(Domainname, Msgctxt, Msgid) \ dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * dcpgettext_expr (const char *domain, const char *msgctxt, const char *msgid, int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; const char *translation; #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS char msg_ctxt_id[msgctxt_len + msgid_len]; #else char buf[1024]; char *msg_ctxt_id = (msgctxt_len + msgid_len <= sizeof (buf) ? buf : (char *) malloc (msgctxt_len + msgid_len)); if (msg_ctxt_id != NULL) #endif { memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcgettext (domain, msg_ctxt_id, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif if (translation != msg_ctxt_id) return translation; } return msgid; } #define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) #define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * dcnpgettext_expr (const char *domain, const char *msgctxt, const char *msgid, const char *msgid_plural, unsigned long int n, int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; const char *translation; #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS char msg_ctxt_id[msgctxt_len + msgid_len]; #else char buf[1024]; char *msg_ctxt_id = (msgctxt_len + msgid_len <= sizeof (buf) ? buf : (char *) malloc (msgctxt_len + msgid_len)); if (msg_ctxt_id != NULL) #endif { memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif if (!(translation == msg_ctxt_id || translation == msgid_plural)) return translation; } return (n == 1 ? msgid : msgid_plural); } #endif /* _LIBGETTEXT_H */ blame-1.4-20240206/lib/error.c0000644000000000000000000001757210527555557014130 0ustar rootroot/* Error handler for noninteractive utilities Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* Written by David MacKenzie . */ #if !_LIBC # include #endif #include "error.h" #include #include #include #include #if !_LIBC && ENABLE_NLS # include "gettext.h" #endif #ifdef _LIBC # include # include # include # include # define mbsrtowcs __mbsrtowcs #endif #if USE_UNLOCKED_IO # include "unlocked-io.h" #endif #ifndef _ # define _(String) String #endif /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ void (*error_print_progname) (void); /* This variable is incremented each time `error' is called. */ unsigned int error_message_count; #ifdef _LIBC /* In the GNU C library, there is a predefined variable for this. */ # define program_name program_invocation_name # include # include # include /* In GNU libc we want do not want to use the common name `error' directly. Instead make it a weak alias. */ extern void __error (int status, int errnum, const char *message, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void __error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) __attribute__ ((__format__ (__printf__, 5, 6)));; # define error __error # define error_at_line __error_at_line # include # define fflush(s) INTUSE(_IO_fflush) (s) # undef putc # define putc(c, fp) INTUSE(_IO_putc) (c, fp) # include #else /* not _LIBC */ # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P # ifndef HAVE_DECL_STRERROR_R "this configure-time declaration test was not run" # endif char *strerror_r (); # endif /* The calling program should define program_name and set it to the name of the executing program. */ extern char *program_name; # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r # endif /* HAVE_STRERROR_R || defined strerror_r */ #endif /* not _LIBC */ static void print_errno_message (int errnum) { char const *s; #if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; # if STRERROR_R_CHAR_P || _LIBC s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) s = errbuf; else s = 0; # endif #else s = strerror (errnum); #endif #if !_LIBC if (! s) s = _("Unknown system error"); #endif #if _LIBC __fxprintf (NULL, ": %s", s); #else fprintf (stderr, ": %s", s); #endif } static void error_tail (int status, int errnum, const char *message, va_list args) { #if _LIBC if (_IO_fwide (stderr, 0) > 0) { # define ALLOCA_LIMIT 2000 size_t len = strlen (message) + 1; wchar_t *wmessage = NULL; mbstate_t st; size_t res; const char *tmp; bool use_malloc = false; while (1) { if (__libc_use_alloca (len * sizeof (wchar_t))) wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); else { if (!use_malloc) wmessage = NULL; wchar_t *p = (wchar_t *) realloc (wmessage, len * sizeof (wchar_t)); if (p == NULL) { free (wmessage); fputws_unlocked (L"out of memory\n", stderr); return; } wmessage = p; use_malloc = true; } memset (&st, '\0', sizeof (st)); tmp = message; res = mbsrtowcs (wmessage, &tmp, len, &st); if (res != len) break; if (__builtin_expect (len >= SIZE_MAX / 2, 0)) { /* This really should not happen if everything is fine. */ res = (size_t) -1; break; } len *= 2; } if (res == (size_t) -1) { /* The string cannot be converted. */ if (use_malloc) { free (wmessage); use_malloc = false; } wmessage = (wchar_t *) L"???"; } __vfwprintf (stderr, wmessage, args); if (use_malloc) free (wmessage); } else #endif vfprintf (stderr, message, args); va_end (args); ++error_message_count; if (errnum) print_errno_message (errnum); #if _LIBC __fxprintf (NULL, "\n"); #else putc ('\n', stderr); #endif fflush (stderr); if (status) exit (status); } /* Print the program name and error message MESSAGE, which is a printf-style format string with optional args. If ERRNUM is nonzero, print its corresponding system error message. Exit with status STATUS if it is nonzero. */ void error (int status, int errnum, const char *message, ...) { va_list args; #if defined _LIBC && defined __libc_ptf_call /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), 0); #endif fflush (stdout); #ifdef _LIBC _IO_flockfile (stderr); #endif if (error_print_progname) (*error_print_progname) (); else { #if _LIBC __fxprintf (NULL, "%s: ", program_name); #else fprintf (stderr, "%s: ", program_name); #endif } va_start (args, message); error_tail (status, errnum, message, args); #ifdef _LIBC _IO_funlockfile (stderr); # ifdef __libc_ptf_call __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); # endif #endif } /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ int error_one_per_line; void error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) { va_list args; if (error_one_per_line) { static const char *old_file_name; static unsigned int old_line_number; if (old_line_number == line_number && (file_name == old_file_name || strcmp (old_file_name, file_name) == 0)) /* Simply return and print nothing. */ return; old_file_name = file_name; old_line_number = line_number; } #if defined _LIBC && defined __libc_ptf_call /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), 0); #endif fflush (stdout); #ifdef _LIBC _IO_flockfile (stderr); #endif if (error_print_progname) (*error_print_progname) (); else { #if _LIBC __fxprintf (NULL, "%s:", program_name); #else fprintf (stderr, "%s:", program_name); #endif } #if _LIBC __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", file_name, line_number); #else fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", file_name, line_number); #endif va_start (args, message); error_tail (status, errnum, message, args); #ifdef _LIBC _IO_funlockfile (stderr); # ifdef __libc_ptf_call __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); # endif #endif } #ifdef _LIBC /* Make the weak alias. */ # undef error # undef error_at_line weak_alias (__error, error) weak_alias (__error_at_line, error_at_line) #endif blame-1.4-20240206/lib/strnlen.h0000644000000000000000000000230014557040752014441 0ustar rootroot/* Find the length of STRING, but scan at most MAXLEN characters. Copyright (C) 2005 Free Software Foundation, Inc. Written by Simon Josefsson. 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. */ #ifndef STRNLEN_H #define STRNLEN_H #include #include /* Find the length (number of bytes) of STRING, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many bytes, return MAXLEN. */ #define strnlen(s,n) replace_strnlen(s,n) extern size_t strnlen(const char *string, size_t maxlen); #endif /* STRNLEN_H */ blame-1.4-20240206/lib/lstat.h0000644000000000000000000000170010257017120014070 0ustar rootroot/* Retrieving information about files. Copyright (C) 2005 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. */ #include #if !LSTAT_FOLLOWS_SLASHED_SYMLINK extern int rpl_lstat (const char *name, struct stat *buf); # undef lstat # define lstat rpl_lstat #endif blame-1.4-20240206/lib/allocsa.h0000644000000000000000000001037310527555557014412 0ustar rootroot/* Safe automatic memory allocation. Copyright (C) 2003-2006 Free Software Foundation, Inc. Written by Bruno Haible , 2003. 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. */ #ifndef _ALLOCSA_H #define _ALLOCSA_H #include #include #include #ifdef __cplusplus extern "C" { #endif /* safe_alloca(N) is equivalent to alloca(N) when it is safe to call alloca(N); otherwise it returns NULL. It either returns N bytes of memory allocated on the stack, that lasts until the function returns, or NULL. Use of safe_alloca should be avoided: - inside arguments of function calls - undefined behaviour, - in inline functions - the allocation may actually last until the calling function returns. */ #if HAVE_ALLOCA /* The OS usually guarantees only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely allocate anything larger than 4096 bytes. Also care for the possibility of a few compiler-allocated temporary stack slots. This must be a macro, not an inline function. */ # define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL) #else # define safe_alloca(N) ((N), NULL) #endif /* allocsa(N) is a safe variant of alloca(N). It allocates N bytes of memory allocated on the stack, that must be freed using freesa() before the function returns. Upon failure, it returns NULL. */ #if HAVE_ALLOCA # define allocsa(N) \ ((N) < 4032 - sa_increment \ ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \ : mallocsa (N)) #else # define allocsa(N) \ mallocsa (N) #endif extern void * mallocsa (size_t n); /* Free a block of memory allocated through allocsa(). */ #if HAVE_ALLOCA extern void freesa (void *p); #else # define freesa free #endif /* Maybe we should also define a variant nallocsa (size_t n, size_t s) - behaves like allocsa (n * s) If this would be useful in your application. please speak up. */ #ifdef __cplusplus } #endif /* ------------------- Auxiliary, non-public definitions ------------------- */ /* Determine the alignment of a type at compile time. */ #if defined __GNUC__ # define sa_alignof __alignof__ #elif defined __cplusplus template struct sa_alignof_helper { char __slot1; type __slot2; }; # define sa_alignof(type) offsetof (sa_alignof_helper, __slot2) #elif defined __hpux /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof values. */ # define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) #elif defined _AIX /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof values. */ # define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) #else # define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) #endif enum { /* The desired alignment of memory allocations is the maximum alignment among all elementary types. */ sa_alignment_long = sa_alignof (long), sa_alignment_double = sa_alignof (double), #ifdef HAVE_LONG_LONG_INT sa_alignment_longlong = sa_alignof (long long), #endif #ifdef HAVE_LONG_DOUBLE sa_alignment_longdouble = sa_alignof (long double), #endif sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) #ifdef HAVE_LONG_LONG_INT | (sa_alignment_longlong - 1) #endif #ifdef HAVE_LONG_DOUBLE | (sa_alignment_longdouble - 1) #endif ) + 1, /* The increment that guarantees room for a magic word must be >= sizeof (int) and a multiple of sa_alignment_max. */ sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max }; #endif /* _ALLOCSA_H */ blame-1.4-20240206/lib/xstrndup.h0000644000000000000000000000205210527555557014656 0ustar rootroot/* Duplicate a bounded initial segment of a string, with out-of-memory checking. Copyright (C) 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. */ #include /* Return a newly allocated copy of at most N bytes of STRING. In other words, return a copy of the initial segment of length N of STRING. */ extern char *xstrndup (const char *string, size_t n); blame-1.4-20240206/lib/argp-fmtstream.h0000644000000000000000000002525214557426347015730 0ustar rootroot/* Word-wrapping and line-truncating streams. Copyright (C) 1997, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ /* This package emulates glibc `line_wrap_stream' semantics for systems that don't have that. If the system does have it, it is just a wrapper for that. This header file is only used internally while compiling argp, and shouldn't be installed. */ #ifndef _ARGP_FMTSTREAM_H #define _ARGP_FMTSTREAM_H #include #include #include #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) # define __format__ format # define __printf__ printf # endif #endif #if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \ || (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)) /* line_wrap_stream is available, so use that. */ #define ARGP_FMTSTREAM_USE_LINEWRAP #endif #ifdef ARGP_FMTSTREAM_USE_LINEWRAP /* Just be a simple wrapper for line_wrap_stream; the semantics are *slightly* different, as line_wrap_stream doesn't actually make a new object, it just modifies the given stream (reversibly) to do line-wrapping. Since we control who uses this code, it doesn't matter. */ #include typedef FILE *argp_fmtstream_t; #define argp_make_fmtstream line_wrap_stream #define __argp_make_fmtstream line_wrap_stream #define argp_fmtstream_free line_unwrap_stream #define __argp_fmtstream_free line_unwrap_stream #define __argp_fmtstream_putc(fs,ch) putc(ch,fs) #define argp_fmtstream_putc(fs,ch) putc(ch,fs) #define __argp_fmtstream_puts(fs,str) fputs(str,fs) #define argp_fmtstream_puts(fs,str) fputs(str,fs) #define __argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs) #define argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs) #define __argp_fmtstream_printf fprintf #define argp_fmtstream_printf fprintf #define __argp_fmtstream_lmargin line_wrap_lmargin #define argp_fmtstream_lmargin line_wrap_lmargin #define __argp_fmtstream_set_lmargin line_wrap_set_lmargin #define argp_fmtstream_set_lmargin line_wrap_set_lmargin #define __argp_fmtstream_rmargin line_wrap_rmargin #define argp_fmtstream_rmargin line_wrap_rmargin #define __argp_fmtstream_set_rmargin line_wrap_set_rmargin #define argp_fmtstream_set_rmargin line_wrap_set_rmargin #define __argp_fmtstream_wmargin line_wrap_wmargin #define argp_fmtstream_wmargin line_wrap_wmargin #define __argp_fmtstream_set_wmargin line_wrap_set_wmargin #define argp_fmtstream_set_wmargin line_wrap_set_wmargin #define __argp_fmtstream_point line_wrap_point #define argp_fmtstream_point line_wrap_point #else /* !ARGP_FMTSTREAM_USE_LINEWRAP */ /* Guess we have to define our own version. */ struct argp_fmtstream { FILE *stream; /* The stream we're outputting to. */ size_t lmargin, rmargin; /* Left and right margins. */ ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */ /* Point in buffer to which we've processed for wrapping, but not output. */ size_t point_offs; /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin. */ ssize_t point_col; char *buf; /* Output buffer. */ char *p; /* Current end of text in BUF. */ char *end; /* Absolute end of BUF. */ }; typedef struct argp_fmtstream *argp_fmtstream_t; #ifndef ARGP_FS_EI #define ARGP_FS_EI static inline #endif /* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines written on it with LMARGIN spaces and limits them to RMARGIN columns total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by replacing the whitespace before them with a newline and WMARGIN spaces. Otherwise, chars beyond RMARGIN are simply dropped until a newline. Returns NULL if there was an error. */ extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream, size_t __lmargin, size_t __rmargin, ssize_t __wmargin); extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream, size_t __lmargin, size_t __rmargin, ssize_t __wmargin); /* Flush __FS to its stream, and free it (but don't close the stream). */ extern void __argp_fmtstream_free (argp_fmtstream_t __fs); extern void argp_fmtstream_free (argp_fmtstream_t __fs); extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs, const char *__fmt, ...) __attribute__ ((__format__ (printf, 2, 3))); extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs, const char *__fmt, ...) __attribute__ ((__format__ (printf, 2, 3))); ARGP_FS_EI int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); ARGP_FS_EI int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); ARGP_FS_EI int __argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str); ARGP_FS_EI int argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str); /* extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs, const char *__str, size_t __len); */ ARGP_FS_EI size_t argp_fmtstream_write (argp_fmtstream_t __fs, const char *__str, size_t __len); /* Access macros for various bits of state. */ #define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin) #define argp_fmtstream_rmargin(__fs) ((__fs)->rmargin) #define argp_fmtstream_wmargin(__fs) ((__fs)->wmargin) #define __argp_fmtstream_lmargin argp_fmtstream_lmargin #define __argp_fmtstream_rmargin argp_fmtstream_rmargin #define __argp_fmtstream_wmargin argp_fmtstream_wmargin /* Set __FS's left margin to LMARGIN and return the old value. */ ARGP_FS_EI size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin); /* extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin); */ /* Set __FS's right margin to __RMARGIN and return the old value. */ ARGP_FS_EI size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin); /* ARGP_FS_EI size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin); */ /* Set __FS's wrap margin to __WMARGIN and return the old value. */ ARGP_FS_EI size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin); /* extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin); */ /* Return the column number of the current output point in __FS. */ ARGP_FS_EI size_t argp_fmtstream_point (argp_fmtstream_t __fs); /* extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs); */ /* Internal routines. */ extern void _argp_fmtstream_update (argp_fmtstream_t __fs); extern void __argp_fmtstream_update (argp_fmtstream_t __fs); extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); #ifdef __OPTIMIZE__ /* Inline versions of above routines. */ #if !_LIBC #define __argp_fmtstream_putc argp_fmtstream_putc #define __argp_fmtstream_puts argp_fmtstream_puts #define __argp_fmtstream_write argp_fmtstream_write #define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin #define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin #define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin #define __argp_fmtstream_point argp_fmtstream_point #define __argp_fmtstream_update _argp_fmtstream_update #define __argp_fmtstream_ensure _argp_fmtstream_ensure #endif ARGP_FS_EI size_t __argp_fmtstream_write (argp_fmtstream_t __fs, const char *__str, size_t __len) { if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len)) { memcpy (__fs->p, __str, __len); __fs->p += __len; return __len; } else return 0; } ARGP_FS_EI int __argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str) { size_t __len = strlen (__str); if (__len) { size_t __wrote = __argp_fmtstream_write (__fs, __str, __len); return __wrote == __len ? 0 : -1; } else return 0; } ARGP_FS_EI int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch) { if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1)) return *__fs->p++ = (char) __ch; else return EOF; } /* Set __FS's left margin to __LMARGIN and return the old value. */ ARGP_FS_EI size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin) { size_t __old; if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) __argp_fmtstream_update (__fs); __old = __fs->lmargin; __fs->lmargin = __lmargin; return __old; } /* Set __FS's right margin to __RMARGIN and return the old value. */ ARGP_FS_EI size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin) { size_t __old; if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) __argp_fmtstream_update (__fs); __old = __fs->rmargin; __fs->rmargin = __rmargin; return __old; } /* Set FS's wrap margin to __WMARGIN and return the old value. */ ARGP_FS_EI size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin) { size_t __old; if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) __argp_fmtstream_update (__fs); __old = (size_t) __fs->wmargin; __fs->wmargin = (ssize_t) __wmargin; return __old; } /* Return the column number of the current output point in __FS. */ ARGP_FS_EI size_t __argp_fmtstream_point (argp_fmtstream_t __fs) { if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) __argp_fmtstream_update (__fs); return (size_t) (__fs->point_col >= 0 ? __fs->point_col : 0); } #if !_LIBC #undef __argp_fmtstream_putc #undef __argp_fmtstream_puts #undef __argp_fmtstream_write #undef __argp_fmtstream_set_lmargin #undef __argp_fmtstream_set_rmargin #undef __argp_fmtstream_set_wmargin #undef __argp_fmtstream_point #undef __argp_fmtstream_update #undef __argp_fmtstream_ensure #endif #endif /* __OPTIMIZE__ */ #endif /* ARGP_FMTSTREAM_USE_LINEWRAP */ #endif /* argp-fmtstream.h */ blame-1.4-20240206/lib/obstack.h0000644000000000000000000004660514560262744014423 0ustar rootroot/* obstack.h - object stack macros Copyright (C) 1988-1994,1996-1999,2003,2004,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* Summary: All the apparent functions defined here are macros. The idea is that you would use these pre-tested macros to solve a very specific set of problems, and they would run fast. Caution: no side-effects in arguments please!! They may be evaluated MANY times!! These macros operate a stack of objects. Each object starts life small, and may grow to maturity. (Consider building a word syllable by syllable.) An object can move while it is growing. Once it has been "finished" it never changes address again. So the "top of the stack" is typically an immature growing object, while the rest of the stack is of mature, fixed size and fixed address objects. These routines grab large chunks of memory, using a function you supply, called `obstack_chunk_alloc'. On occasion, they free chunks, by calling `obstack_chunk_free'. You must define them and declare them before using any obstack macros. Each independent stack is represented by a `struct obstack'. Each of the obstack macros expects a pointer to such a structure as the first argument. One motivation for this package is the problem of growing char strings in symbol tables. Unless you are "fascist pig with a read-only mind" --Gosper's immortal quote from HAKMEM item 154, out of context--you would not like to put any arbitrary upper limit on the length of your symbols. In practice this often means you will build many short symbols and a few long symbols. At the time you are reading a symbol you don't know how long it is. One traditional method is to read a symbol into a buffer, realloc()ating the buffer every time you try to read a symbol that is longer than the buffer. This is beaut, but you still will want to copy the symbol from the buffer to a more permanent symbol-table entry say about half the time. With obstacks, you can work differently. Use one obstack for all symbol names. As you read a symbol, grow the name in the obstack gradually. When the name is complete, finalize it. Then, if the symbol exists already, free the newly read name. The way we do this is to take a large chunk, allocating memory from low addresses. When you want to build a symbol in the chunk you just add chars above the current "high water mark" in the chunk. When you have finished adding chars, because you got to the end of the symbol, you know how long the chars are, and you can create a new object. Mostly the chars will not burst over the highest address of the chunk, because you would typically expect a chunk to be (say) 100 times as long as an average object. In case that isn't clear, when we have enough chars to make up the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) so we just point to it where it lies. No moving of chars is needed and this is the second win: potentially long strings need never be explicitly shuffled. Once an object is formed, it does not change its address during its lifetime. When the chars burst over a chunk boundary, we allocate a larger chunk, and then copy the partly formed object from the end of the old chunk to the beginning of the new larger chunk. We then carry on accreting characters to the end of the object as we normally would. A special macro is provided to add a single char at a time to a growing object. This allows the use of register variables, which break the ordinary 'growth' macro. Summary: We allocate large chunks. We carve out one object at a time from the current chunk. Once carved, an object never moves. We are free to append data of any size to the currently growing object. Exactly one object is growing in an obstack at any one time. You can run one obstack per control block. You may have as many control blocks as you dare. Because of the way we do it, you can `unwind' an obstack back to a previous state. (You may remove objects much as you would with a stack.) */ /* Don't do the contents of this file more than once. */ #ifndef _OBSTACK_H #define _OBSTACK_H 1 #ifdef __cplusplus extern "C" { #endif /* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is defined, as with GNU C, use that; that way we don't pollute the namespace with 's symbols. Otherwise, include and use ptrdiff_t. */ #ifdef __PTRDIFF_TYPE__ # define PTR_INT_TYPE __PTRDIFF_TYPE__ #else # include # define PTR_INT_TYPE ptrdiff_t #endif /* If B is the base of an object addressed by P, return the result of aligning P to the next multiple of A + 1. B and P must be of type char *. A + 1 must be a power of 2. */ #define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A))) /* Similar to _BPTR_ALIGN (B, P, A), except optimize the common case where pointers can be converted to integers, aligned as integers, and converted back again. If PTR_INT_TYPE is narrower than a pointer (e.g., the AS/400), play it safe and compute the alignment relative to B. Otherwise, use the faster strategy of computing the alignment relative to 0. */ #define __PTR_ALIGN(B, P, A) \ __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \ P, A) #include struct _obstack_chunk /* Lives at front of each chunk. */ { char *limit; /* 1 past end of this chunk */ struct _obstack_chunk *prev; /* address of prior chunk or NULL */ char contents[4]; /* objects begin here */ }; struct obstack /* control current object in current chunk */ { long chunk_size; /* preferred size to allocate chunks in */ struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ char *object_base; /* address of object we are building */ char *next_free; /* where to add next char to current object */ char *chunk_limit; /* address of char after current chunk */ union { PTR_INT_TYPE tempint; void *tempptr; } temp; /* Temporary for some macros. */ int alignment_mask; /* Mask of alignment for each object. */ /* These prototypes vary based on `use_extra_arg', and we use casts to the prototypeless function type in all assignments, but having prototypes here quiets -Wstrict-prototypes. */ struct _obstack_chunk *(*chunkfun) (void *, long); void (*freefun) (void *, struct _obstack_chunk *); void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ unsigned maybe_empty_object:1;/* There is a possibility that the current chunk contains a zero-length object. This prevents freeing the chunk if we allocate a bigger chunk to replace it. */ unsigned alloc_failed:1; /* No longer used, as we now call the failed handler on error, but retained for binary compatibility. */ }; /* Declare the external functions we use; they are in obstack.c. */ extern void _obstack_newchunk (struct obstack *, int); extern int _obstack_begin (struct obstack *, int, int, void *(*) (long), void (*) (void *)); extern int _obstack_begin_1 (struct obstack *, int, int, void *(*) (void *, long), void (*) (void *, void *), void *); extern int _obstack_memory_used (struct obstack *); /* The default name of the function for freeing a chunk is 'obstack_free', but gnulib users can override this by defining '__obstack_free'. */ #ifndef __obstack_free # define __obstack_free obstack_free #endif extern void __obstack_free (struct obstack *obstack, void *block); /* Error handler called when `obstack_chunk_alloc' failed to allocate more memory. This can be set to a user defined function which should either abort gracefully or use longjump - but shouldn't return. The default action is to print a message and abort. */ extern void (*obstack_alloc_failed_handler) (void); /* Exit value used when `print_and_abort' is used. */ extern int obstack_exit_failure; /* Pointer to beginning of object being allocated or to be allocated next. Note that this might not be the final address of the object because a new chunk might be needed to hold the final size. */ #define obstack_base(h) ((void *) (h)->object_base) /* Size for allocating ordinary chunks. */ #define obstack_chunk_size(h) ((h)->chunk_size) /* Pointer to next byte not yet allocated in current chunk. */ #define obstack_next_free(h) ((h)->next_free) /* Mask specifying low bits that should be clear in address of an object. */ #define obstack_alignment_mask(h) ((h)->alignment_mask) /* To prevent prototype warnings provide complete argument list. */ #define obstack_init(h) \ _obstack_begin ((h), 0, 0, \ (void *(*) (long)) obstack_chunk_alloc, \ (void (*) (void *)) obstack_chunk_free) #define obstack_begin(h, size) \ _obstack_begin ((h), (size), 0, \ (void *(*) (long)) obstack_chunk_alloc, \ (void (*) (void *)) obstack_chunk_free) #define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ _obstack_begin ((h), (size), (alignment), \ (void *(*) (long)) (chunkfun), \ (void (*) (void *)) (freefun)) #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ _obstack_begin_1 ((h), (size), (alignment), \ (void *(*) (void *, long)) (chunkfun), \ (void (*) (void *, void *)) (freefun), (arg)) #define obstack_chunkfun(h, newchunkfun) \ ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun)) #define obstack_freefun(h, newfreefun) \ ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar)) #define obstack_blank_fast(h,n) ((h)->next_free += (n)) #define obstack_memory_used(h) _obstack_memory_used (h) #if defined __GNUC__ && defined __STDC__ && __STDC__ /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and does not implement __extension__. But that compiler doesn't define __GNUC_MINOR__. */ # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) # define __extension__ # endif /* For GNU C, if not -traditional, we can define these macros to compute all args only once without using a global variable. Also, we can avoid using the `temp' slot, to make faster code. */ # define obstack_object_size(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (unsigned) (__o->next_free - __o->object_base); }) # define obstack_room(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (unsigned) (__o->chunk_limit - __o->next_free); }) # define obstack_make_room(OBSTACK,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ (void) 0; }) # define obstack_empty_p(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (__o->chunk->prev == 0 \ && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ __o->chunk->contents, \ __o->alignment_mask)); }) # define obstack_grow(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->next_free + __len > __o->chunk_limit) \ _obstack_newchunk (__o, __len); \ memcpy (__o->next_free, where, __len); \ __o->next_free += __len; \ (void) 0; }) # define obstack_grow0(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->next_free + __len + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, __len + 1); \ memcpy (__o->next_free, where, __len); \ __o->next_free += __len; \ *(__o->next_free)++ = 0; \ (void) 0; }) # define obstack_1grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, 1); \ obstack_1grow_fast (__o, datum); \ (void) 0; }) /* These assume that the obstack alignment is good enough for pointers or ints, and that the data added so far to the current object shares that much alignment. */ # define obstack_ptr_grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ _obstack_newchunk (__o, sizeof (void *)); \ obstack_ptr_grow_fast (__o, datum); }) \ # define obstack_int_grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + sizeof (int) > __o->chunk_limit) \ _obstack_newchunk (__o, sizeof (int)); \ obstack_int_grow_fast (__o, datum); }) # define obstack_ptr_grow_fast(OBSTACK,aptr) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ *(const void **) __o1->next_free = (aptr); \ __o1->next_free += sizeof (const void *); \ (void) 0; }) # define obstack_int_grow_fast(OBSTACK,aint) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ *(int *) __o1->next_free = (aint); \ __o1->next_free += sizeof (int); \ (void) 0; }) # define obstack_blank(OBSTACK,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (int) (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ obstack_blank_fast (__o, __len); \ (void) 0; }) # define obstack_alloc(OBSTACK,length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_blank (__h, (length)); \ obstack_finish (__h); }) # define obstack_copy(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_grow (__h, (where), (length)); \ obstack_finish (__h); }) # define obstack_copy0(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_grow0 (__h, (where), (length)); \ obstack_finish (__h); }) /* The local variable is named __o1 to avoid a name conflict when obstack_blank is called. */ # define obstack_finish(OBSTACK) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ void *__value = (void *) __o1->object_base; \ if (__o1->next_free == __value) \ __o1->maybe_empty_object = 1; \ __o1->next_free \ = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ __o1->alignment_mask); \ if (__o1->next_free - (char *)__o1->chunk \ > __o1->chunk_limit - (char *)__o1->chunk) \ __o1->next_free = __o1->chunk_limit; \ __o1->object_base = __o1->next_free; \ __value; }) # define obstack_free(OBSTACK, OBJ) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ void *__obj = (OBJ); \ if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ __o->next_free = __o->object_base = (char *)__obj; \ else (__obstack_free) (__o, __obj); }) #else /* not __GNUC__ or not __STDC__ */ # define obstack_object_size(h) \ (unsigned) ((h)->next_free - (h)->object_base) # define obstack_room(h) \ (unsigned) ((h)->chunk_limit - (h)->next_free) # define obstack_empty_p(h) \ ((h)->chunk->prev == 0 \ && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ (h)->chunk->contents, \ (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions in the arms of the conditional expression. Casting the third operand to void was tried before, but some compilers won't accept it. */ # define obstack_make_room(h,length) \ ( (h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0)) # define obstack_grow(h,where,length) \ ( (h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ memcpy ((h)->next_free, where, (h)->temp.tempint), \ (h)->next_free += (h)->temp.tempint) # define obstack_grow0(h,where,length) \ ( (h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \ memcpy ((h)->next_free, where, (h)->temp.tempint), \ (h)->next_free += (h)->temp.tempint, \ *((h)->next_free)++ = 0) # define obstack_1grow(h,datum) \ ( (((h)->next_free + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), 1), 0) : 0), \ obstack_1grow_fast (h, datum)) # define obstack_ptr_grow(h,datum) \ ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ obstack_ptr_grow_fast (h, datum)) # define obstack_int_grow(h,datum) \ ( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ obstack_int_grow_fast (h, datum)) # define obstack_ptr_grow_fast(h,aptr) \ (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr)) # define obstack_int_grow_fast(h,aint) \ (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint)) # define obstack_blank(h,length) \ ( (h)->temp.tempint = (length), \ (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ obstack_blank_fast (h, (h)->temp.tempint)) # define obstack_alloc(h,length) \ (obstack_blank ((h), (length)), obstack_finish ((h))) # define obstack_copy(h,where,length) \ (obstack_grow ((h), (where), (length)), obstack_finish ((h))) # define obstack_copy0(h,where,length) \ (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) # define obstack_finish(h) \ ( ((h)->next_free == (h)->object_base \ ? (((h)->maybe_empty_object = 1), 0) \ : 0), \ (h)->temp.tempptr = (h)->object_base, \ (h)->next_free \ = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ (h)->alignment_mask), \ (((h)->next_free - (char *) (h)->chunk \ > (h)->chunk_limit - (char *) (h)->chunk) \ ? ((h)->next_free = (h)->chunk_limit) : 0), \ (h)->object_base = (h)->next_free, \ (h)->temp.tempptr) # define obstack_free(h,obj) \ ( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \ ((((h)->temp.tempint > 0 \ && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \ ? (int) ((h)->next_free = (h)->object_base \ = (h)->temp.tempint + (char *) (h)->chunk) \ : (((__obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0))) #endif /* not __GNUC__ or not __STDC__ */ #ifdef __cplusplus } /* C++ */ #endif #endif /* obstack.h */ blame-1.4-20240206/lib/argp-eexst.c0000644000000000000000000000226310337302606015025 0ustar rootroot/* Default definition for ARGP_ERR_EXIT_STATUS Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ #ifdef HAVE_CONFIG_H # include #endif #include #include "argp.h" /* The exit status that argp will use when exiting due to a parsing error. If not defined or set by the user program, this defaults to EX_USAGE from . */ error_t argp_err_exit_status = EX_USAGE; blame-1.4-20240206/lib/strndup.h0000644000000000000000000000237710527555560014472 0ustar rootroot/* Duplicate a size-bounded string. Copyright (C) 2003, 2006 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. */ /* Get size_t. */ #include /* If HAVE_STRNDUP, get the strndup declaration. If !HAVE_STRNDUP, include now so that it doesn't cause trouble if included later. */ #include #if !HAVE_STRNDUP # undef strndup # define strndup rpl_strndup # if !HAVE_DECL_STRNDUP /* Don't risk conflicting declarations. */ /* Return a newly allocated copy of at most N bytes of STRING. */ extern char *strndup (const char *string, size_t n); # endif #endif blame-1.4-20240206/lib/strnlen1.c0000644000000000000000000000245614557306576014542 0ustar rootroot/* Find the length of STRING + 1, but scan at most MAXLEN bytes. Copyright (C) 2005-2006 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. */ #include /* Specification. */ #include "strnlen1.h" #include /* Find the length of STRING + 1, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many characters, return MAXLEN. */ /* This is the same as strnlen (string, maxlen - 1) + 1. */ size_t strnlen1 (const char *string, size_t maxlen) { const char *end = (const char *) memchr (string, '\0', maxlen); if (end != NULL) return (size_t) (end - string + 1); else return maxlen; } blame-1.4-20240206/lib/getopt_int.h0000644000000000000000000001133214557300220015122 0ustar rootroot/* Internal declarations for getopt. Copyright (C) 1989-1994,1996-1999,2001,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ #ifndef _GETOPT_INT_H #define _GETOPT_INT_H 1 extern int _getopt_internal (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct); /* Reentrant versions which can handle parsing multiple argument vectors at the same time. */ /* Data type for reentrant functions. */ struct _getopt_data { /* These have exactly the same meaning as the corresponding global variables, except that they are used for the reentrant versions of getopt. */ int optind; int opterr; int optopt; char *optarg; /* Internal members. */ /* True if the internal members have been initialized. */ int __initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ char *__nextchar; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters, or by calling getopt. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } __ordering; /* If the POSIXLY_CORRECT environment variable is set or getopt was called. */ int __posixly_correct; /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ int __first_nonopt; int __last_nonopt; #if defined _LIBC && defined USE_NONOPTION_FLAGS int __nonoption_flags_max_len; int __nonoption_flags_len; # endif }; /* The initializer is necessary to set OPTIND and OPTERR to their default values and to clear the initialization flag. */ #define _GETOPT_DATA_INITIALIZER { 1, 1, 0, NULL, 0, NULL, 0, 0, 0, 0 } extern int _getopt_internal_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct, struct _getopt_data *__data); extern int _getopt_long_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); extern int _getopt_long_only_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); #endif /* getopt_int.h */ blame-1.4-20240206/lib/asnprintf.c0000644000000000000000000000214410527555557014770 0ustar rootroot/* Formatted output to strings. Copyright (C) 1999, 2002, 2006 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. */ #include /* Specification. */ #include "vasnprintf.h" #include char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) { va_list args; char *result; va_start (args, format); result = vasnprintf (resultbuf, lengthp, format, args); va_end (args); return result; } blame-1.4-20240206/lib/strcase.h0000644000000000000000000000404010527555560014424 0ustar rootroot/* Case-insensitive string comparison functions. Copyright (C) 1995-1996, 2001, 2003, 2005-2006 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. */ #ifndef _STRCASE_H #define _STRCASE_H #include /* Include header files with a possibly conflicting declarations of strcasecmp before we define it as a macro, so that they will be no-ops if included after strcasecmp is defined as a macro. */ #include #ifdef __cplusplus extern "C" { #endif /* No known system has a strcasecmp() function that works correctly in multibyte locales. Therefore we use our version always. */ #define strcasecmp rpl_strcasecmp /* Compare strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function may, in multibyte locales, return 0 for strings of different lengths! */ extern int strcasecmp (const char *s1, const char *s2); /* Compare no more than N characters of strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function can not work correctly in multibyte locales. */ #if ! HAVE_DECL_STRNCASECMP extern int strncasecmp (const char *s1, const char *s2, size_t n); #endif #ifdef __cplusplus } #endif #endif /* _STRCASE_H */ blame-1.4-20240206/lib/argp-pin.c0000644000000000000000000000200310527555557014473 0ustar rootroot/* Full and short program names for argp module Copyright (C) 2005 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. */ #ifdef HAVE_CONFIG_H # include #endif #ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME char *program_invocation_short_name = 0; #endif #ifndef HAVE_PROGRAM_INVOCATION_NAME char *program_invocation_name = 0; #endif blame-1.4-20240206/lib/malloc.c0000644000000000000000000000207410527555557014235 0ustar rootroot/* malloc() function that is glibc compatible. Copyright (C) 1997, 1998, 2006 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. */ /* written by Jim Meyering */ #include #undef malloc #include /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ void * rpl_malloc (size_t n) { if (n == 0) n = 1; return malloc (n); } blame-1.4-20240206/lib/filenamecat.h0000644000000000000000000000165110247667341015235 0ustar rootroot/* Concatenate two arbitrary file names. Copyright (C) 1996, 1997, 2003, 2005 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. */ /* Written by Jim Meyering. */ char *file_name_concat (char const *dir, char const *base, char **base_in_result); blame-1.4-20240206/lib/strftime.h0000644000000000000000000000157510241344123014607 0ustar rootroot/* declarations for strftime.c Copyright (C) 2002, 2004 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. */ #include size_t nstrftime (char *, size_t, char const *, struct tm const *, int, int); blame-1.4-20240206/lib/memcmp.c0000644000000000000000000002114610527555557014245 0ustar rootroot/* Copyright (C) 1991, 1993, 1995, 1997, 1998, 2003, 2006 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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. */ #ifndef _LIBC # include #endif #include #undef memcmp #ifdef _LIBC # include # include # if __BYTE_ORDER == __BIG_ENDIAN # define WORDS_BIGENDIAN # endif #else /* Not in the GNU C library. */ # include /* Type to use for aligned memory operations. This should normally be the biggest type supported by a single load and store. Must be an unsigned type. */ # define op_t unsigned long int # define OPSIZ (sizeof(op_t)) /* Threshold value for when to enter the unrolled loops. */ # define OP_T_THRES 16 /* Type to use for unaligned operations. */ typedef unsigned char byte; # ifndef WORDS_BIGENDIAN # define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2))) # else # define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2))) # endif #endif /* In the GNU C library. */ #ifdef WORDS_BIGENDIAN # define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1) #else # define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b)) #endif /* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */ /* The strategy of this memcmp is: 1. Compare bytes until one of the block pointers is aligned. 2. Compare using memcmp_common_alignment or memcmp_not_common_alignment, regarding the alignment of the other block after the initial byte operations. The maximum number of full words (of type op_t) are compared in this way. 3. Compare the few remaining bytes. */ #ifndef WORDS_BIGENDIAN /* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine. A and B are known to be different. This is needed only on little-endian machines. */ # ifdef __GNUC__ __inline # endif static int memcmp_bytes (long unsigned int a, long unsigned int b) { long int srcp1 = (long int) &a; long int srcp2 = (long int) &b; op_t a0, b0; do { a0 = ((byte *) srcp1)[0]; b0 = ((byte *) srcp2)[0]; srcp1 += 1; srcp2 += 1; } while (a0 == b0); return a0 - b0; } #endif /* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t' objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for memory operations on `op_t's. */ #ifdef __GNUC__ __inline #endif static int memcmp_common_alignment (long int srcp1, long int srcp2, size_t len) { op_t a0, a1; op_t b0, b1; switch (len % 4) { default: /* Avoid warning about uninitialized local variables. */ case 2: a0 = ((op_t *) srcp1)[0]; b0 = ((op_t *) srcp2)[0]; srcp1 -= 2 * OPSIZ; srcp2 -= 2 * OPSIZ; len += 2; goto do1; case 3: a1 = ((op_t *) srcp1)[0]; b1 = ((op_t *) srcp2)[0]; srcp1 -= OPSIZ; srcp2 -= OPSIZ; len += 1; goto do2; case 0: if (OP_T_THRES <= 3 * OPSIZ && len == 0) return 0; a0 = ((op_t *) srcp1)[0]; b0 = ((op_t *) srcp2)[0]; goto do3; case 1: a1 = ((op_t *) srcp1)[0]; b1 = ((op_t *) srcp2)[0]; srcp1 += OPSIZ; srcp2 += OPSIZ; len -= 1; if (OP_T_THRES <= 3 * OPSIZ && len == 0) goto do0; /* Fall through. */ } do { a0 = ((op_t *) srcp1)[0]; b0 = ((op_t *) srcp2)[0]; if (a1 != b1) return CMP_LT_OR_GT (a1, b1); do3: a1 = ((op_t *) srcp1)[1]; b1 = ((op_t *) srcp2)[1]; if (a0 != b0) return CMP_LT_OR_GT (a0, b0); do2: a0 = ((op_t *) srcp1)[2]; b0 = ((op_t *) srcp2)[2]; if (a1 != b1) return CMP_LT_OR_GT (a1, b1); do1: a1 = ((op_t *) srcp1)[3]; b1 = ((op_t *) srcp2)[3]; if (a0 != b0) return CMP_LT_OR_GT (a0, b0); srcp1 += 4 * OPSIZ; srcp2 += 4 * OPSIZ; len -= 4; } while (len != 0); /* This is the right position for do0. Please don't move it into the loop. */ do0: if (a1 != b1) return CMP_LT_OR_GT (a1, b1); return 0; } /* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory operations on `op_t', but SRCP1 *should be unaligned*. */ #ifdef __GNUC__ __inline #endif static int memcmp_not_common_alignment (long int srcp1, long int srcp2, size_t len) { op_t a0, a1, a2, a3; op_t b0, b1, b2, b3; op_t x; int shl, shr; /* Calculate how to shift a word read at the memory operation aligned srcp1 to make it aligned for comparison. */ shl = 8 * (srcp1 % OPSIZ); shr = 8 * OPSIZ - shl; /* Make SRCP1 aligned by rounding it down to the beginning of the `op_t' it points in the middle of. */ srcp1 &= -OPSIZ; switch (len % 4) { default: /* Avoid warning about uninitialized local variables. */ case 2: a1 = ((op_t *) srcp1)[0]; a2 = ((op_t *) srcp1)[1]; b2 = ((op_t *) srcp2)[0]; srcp1 -= 1 * OPSIZ; srcp2 -= 2 * OPSIZ; len += 2; goto do1; case 3: a0 = ((op_t *) srcp1)[0]; a1 = ((op_t *) srcp1)[1]; b1 = ((op_t *) srcp2)[0]; srcp2 -= 1 * OPSIZ; len += 1; goto do2; case 0: if (OP_T_THRES <= 3 * OPSIZ && len == 0) return 0; a3 = ((op_t *) srcp1)[0]; a0 = ((op_t *) srcp1)[1]; b0 = ((op_t *) srcp2)[0]; srcp1 += 1 * OPSIZ; goto do3; case 1: a2 = ((op_t *) srcp1)[0]; a3 = ((op_t *) srcp1)[1]; b3 = ((op_t *) srcp2)[0]; srcp1 += 2 * OPSIZ; srcp2 += 1 * OPSIZ; len -= 1; if (OP_T_THRES <= 3 * OPSIZ && len == 0) goto do0; /* Fall through. */ } do { a0 = ((op_t *) srcp1)[0]; b0 = ((op_t *) srcp2)[0]; x = MERGE(a2, shl, a3, shr); if (x != b3) return CMP_LT_OR_GT (x, b3); do3: a1 = ((op_t *) srcp1)[1]; b1 = ((op_t *) srcp2)[1]; x = MERGE(a3, shl, a0, shr); if (x != b0) return CMP_LT_OR_GT (x, b0); do2: a2 = ((op_t *) srcp1)[2]; b2 = ((op_t *) srcp2)[2]; x = MERGE(a0, shl, a1, shr); if (x != b1) return CMP_LT_OR_GT (x, b1); do1: a3 = ((op_t *) srcp1)[3]; b3 = ((op_t *) srcp2)[3]; x = MERGE(a1, shl, a2, shr); if (x != b2) return CMP_LT_OR_GT (x, b2); srcp1 += 4 * OPSIZ; srcp2 += 4 * OPSIZ; len -= 4; } while (len != 0); /* This is the right position for do0. Please don't move it into the loop. */ do0: x = MERGE(a2, shl, a3, shr); if (x != b3) return CMP_LT_OR_GT (x, b3); return 0; } int rpl_memcmp (const void *s1, const void *s2, size_t len) { op_t a0; op_t b0; long int srcp1 = (long int) s1; long int srcp2 = (long int) s2; op_t res; if (len >= OP_T_THRES) { /* There are at least some bytes to compare. No need to test for LEN == 0 in this alignment loop. */ while (srcp2 % OPSIZ != 0) { a0 = ((byte *) srcp1)[0]; b0 = ((byte *) srcp2)[0]; srcp1 += 1; srcp2 += 1; res = a0 - b0; if (res != 0) return res; len -= 1; } /* SRCP2 is now aligned for memory operations on `op_t'. SRCP1 alignment determines if we can do a simple, aligned compare or need to shuffle bits. */ if (srcp1 % OPSIZ == 0) res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ); else res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ); if (res != 0) return res; /* Number of bytes remaining in the interval [0..OPSIZ-1]. */ srcp1 += len & -OPSIZ; srcp2 += len & -OPSIZ; len %= OPSIZ; } /* There are just a few bytes to compare. Use byte memory operations. */ while (len != 0) { a0 = ((byte *) srcp1)[0]; b0 = ((byte *) srcp2)[0]; srcp1 += 1; srcp2 += 1; res = a0 - b0; if (res != 0) return res; len -= 1; } return 0; } #ifdef weak_alias # undef bcmp weak_alias (memcmp, bcmp) #endif blame-1.4-20240206/lib/strstr.c0000644000000000000000000000641610527555560014325 0ustar rootroot/* Searching in a string. Copyright (C) 2005-2006 Free Software Foundation, Inc. Written by Bruno Haible , 2005. 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. */ #include /* Specification. */ #include "strstr.h" #include /* for NULL */ #if HAVE_MBRTOWC # include "mbuiter.h" #endif /* Find the first occurrence of NEEDLE in HAYSTACK. */ char * strstr (const char *haystack, const char *needle) { /* Be careful not to look at the entire extent of haystack or needle until needed. This is useful because of these two cases: - haystack may be very long, and a match of needle found early, - needle may be very long, and not even a short initial segment of needle may be found in haystack. */ #if HAVE_MBRTOWC if (MB_CUR_MAX > 1) { mbui_iterator_t iter_needle; mbui_init (iter_needle, needle); if (mbui_avail (iter_needle)) { mbui_iterator_t iter_haystack; mbui_init (iter_haystack, haystack); for (;; mbui_advance (iter_haystack)) { if (!mbui_avail (iter_haystack)) /* No match. */ return NULL; if (mb_equal (mbui_cur (iter_haystack), mbui_cur (iter_needle))) /* The first character matches. */ { mbui_iterator_t rhaystack; mbui_iterator_t rneedle; memcpy (&rhaystack, &iter_haystack, sizeof (mbui_iterator_t)); mbui_advance (rhaystack); mbui_init (rneedle, needle); if (!mbui_avail (rneedle)) abort (); mbui_advance (rneedle); for (;; mbui_advance (rhaystack), mbui_advance (rneedle)) { if (!mbui_avail (rneedle)) /* Found a match. */ return (char *) mbui_cur_ptr (iter_haystack); if (!mbui_avail (rhaystack)) /* No match. */ return NULL; if (!mb_equal (mbui_cur (rhaystack), mbui_cur (rneedle))) /* Nothing in this round. */ break; } } } } else return (char *) haystack; } else #endif { if (*needle != '\0') { /* Speed up the following searches of needle by caching its first character. */ char b = *needle++; for (;; haystack++) { if (*haystack == '\0') /* No match. */ return NULL; if (*haystack == b) /* The first character matches. */ { const char *rhaystack = haystack + 1; const char *rneedle = needle; for (;; rhaystack++, rneedle++) { if (*rneedle == '\0') /* Found a match. */ return (char *) haystack; if (*rhaystack == '\0') /* No match. */ return NULL; if (*rhaystack != *rneedle) /* Nothing in this round. */ break; } } } } else return (char *) haystack; } } blame-1.4-20240206/lib/wcwidth.h0000644000000000000000000000377710527555557014457 0ustar rootroot/* Determine the number of screen columns needed for a character. Copyright (C) 2006 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. */ #ifndef _gl_WCWIDTH_H #define _gl_WCWIDTH_H #if HAVE_WCHAR_T /* Get wcwidth if available, along with wchar_t. */ # if HAVE_WCHAR_H /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.1 has a bug: and must be included before . */ # include # include # include # endif /* Get iswprint. */ # if HAVE_WCTYPE_H # include # endif # if !defined iswprint && !HAVE_ISWPRINT static inline int # if HAVE_WINT_T iswprint (wint_t wc) # else iswprint (int wc) # endif { return (wc >= 0 && wc < 128 ? wc >= ' ' && wc <= '~' : 1); } # define iswprint iswprint # endif # ifndef HAVE_DECL_WCWIDTH "this configure-time declaration test was not run" # endif # ifndef wcwidth # if !HAVE_WCWIDTH /* wcwidth doesn't exist, so assume all printable characters have width 1. */ static inline int wcwidth (wchar_t wc) { return wc == 0 ? 0 : iswprint (wc) ? 1 : -1; } # elif !HAVE_DECL_WCWIDTH /* wcwidth exists but is not declared. */ extern # ifdef __cplusplus "C" # endif int wcwidth (int /* actually wchar_t */); # endif # endif #endif /* HAVE_WCHAR_H */ #endif /* _gl_WCWIDTH_H */ blame-1.4-20240206/lib/mktime.c0000644000000000000000000005217714557754742014271 0ustar rootroot/* Convert a `struct tm' to a time_t value. Copyright (C) 1993-1999, 2002-2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Paul Eggert . 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. */ /* Define this to have a standalone program to test this implementation of mktime. */ /* #define DEBUG 1 */ #ifdef HAVE_CONFIG_H # include #endif /* Assume that leap seconds are possible, unless told otherwise. If the host has a `zic' command with a `-L leapsecondfilename' option, then it supports leap seconds; otherwise it probably doesn't. */ #ifndef LEAP_SECONDS_POSSIBLE # define LEAP_SECONDS_POSSIBLE 1 #endif #include /* Some systems define `time_t' here. */ #include #include #include /* For the real memcpy prototype. */ #if DEBUG # include # include /* Make it work even if the system's libc has its own mktime routine. */ # define mktime my_mktime #endif /* DEBUG */ #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wshift-negative-value" #endif /* Shift A right by B bits portably, by dividing A by 2**B and truncating towards minus infinity. A and B should be free of side effects, and B should be in the range 0 <= B <= INT_BITS - 2, where INT_BITS is the number of useful bits in an int. GNU code can assume that INT_BITS is at least 32. ISO C99 says that A >> B is implementation-defined if A < 0. Some implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift right in the usual way when A < 0, so SHR falls back on division if ordinary A >> B doesn't seem to be the usual signed shift. */ #define SHR(a, b) \ (-1 >> 1 == -1 \ ? (a) >> (b) \ : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0)) /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ /* True if the arithmetic type T is an integer type. bool counts as an integer. */ #define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) /* True if negative values of the signed integer type T use two's complement, ones' complement, or signed magnitude representation, respectively. Much GNU code assumes two's complement, but some people like to be portable to all possible C hosts. */ #define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) #define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) #define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) /* True if the arithmetic type T is signed. */ #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) /* The maximum and minimum values for the integer type T. These macros have undefined behavior if T is signed and has padding bits. If this is a problem for you, please let us know how to fix it for your host. */ #define TYPE_MINIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) 0 \ : TYPE_SIGNED_MAGNITUDE (t) \ ? ~ (t) 0 \ : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) #define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) -1 \ : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) #ifndef TIME_T_MIN # define TIME_T_MIN TYPE_MINIMUM (time_t) #endif #ifndef TIME_T_MAX # define TIME_T_MAX TYPE_MAXIMUM (time_t) #endif #define TIME_T_MIDPOINT (SHR (TIME_T_MIN + TIME_T_MAX, 1) + 1) /* Verify a requirement at compile-time (unlike assert, which is runtime). */ #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; } verify (time_t_is_integer, TYPE_IS_INTEGER (time_t)); verify (twos_complement_arithmetic, TYPE_TWOS_COMPLEMENT (int)); /* The code also assumes that signed integer overflow silently wraps around, but this assumption can't be stated without causing a diagnostic on some hosts. */ #define EPOCH_YEAR 1970 #define TM_YEAR_BASE 1900 verify (base_year_is_a_multiple_of_100, TM_YEAR_BASE % 100 == 0); #if INT_MAX <= LONG_MAX / 2 typedef long int long_int; #else typedef long long int long_int; #endif /* Return 1 if YEAR + TM_YEAR_BASE is a leap year. */ static inline int leapyear (long_int year) { /* Don't add YEAR to TM_YEAR_BASE, as that might overflow. Also, work even if YEAR is negative. */ return ((year & 3) == 0 && (year % 100 != 0 || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3))); } /* How many days come before each month (0-12). */ #ifndef _LIBC static #endif const unsigned short int __mon_yday[2][13] = { /* Normal years. */ { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, /* Leap years. */ { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } }; #ifndef _LIBC /* Portable standalone applications should supply a "time_r.h" that declares a POSIX-compliant localtime_r, for the benefit of older implementations that lack localtime_r or have a nonstandard one. See the gnulib time_r module for one way to implement this. */ # include "time_r.h" # undef __localtime_r # define __localtime_r localtime_r # define __mktime_internal mktime_internal #endif /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) - (YEAR0-YDAY0 HOUR0:MIN0:SEC0) in seconds, assuming that the clocks were not adjusted between the time stamps. The YEAR values uses the same numbering as TP->tm_year. Values need not be in the usual range. However, YEAR1 must not be less than 2 * INT_MIN or greater than 2 * INT_MAX. The result may overflow. It is the caller's responsibility to detect overflow. */ static inline time_t ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1, int year0, int yday0, int hour0, int min0, int sec0) { verify (C99_integer_division, -1 / 2 == 0); verify (long_int_year_and_yday_are_wide_enough, INT_MAX == INT_MAX * (long_int) 2 / 2); /* Compute intervening leap days correctly even if year is negative. Take care to avoid integer overflow here. */ int a4 = (int) (SHR (year1, 2) + SHR (TM_YEAR_BASE, 2) - ! (year1 & 3)); int b4 = (int) (SHR (year0, 2) + SHR (TM_YEAR_BASE, 2) - ! (year0 & 3)); int a100 = a4 / 25 - (a4 % 25 < 0); int b100 = b4 / 25 - (b4 % 25 < 0); int a400 = SHR (a100, 2); int b400 = SHR (b100, 2); int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400); /* Compute the desired time in time_t precision. Overflow might occur here. */ time_t tyear1 = year1; time_t years = tyear1 - year0; time_t days = 365 * years + yday1 - yday0 + intervening_leap_days; time_t hours = 24 * days + hour1 - hour0; time_t minutes = 60 * hours + min1 - min0; time_t seconds = 60 * minutes + sec1 - sec0; return seconds; } /* Return a time_t value corresponding to (YEAR-YDAY HOUR:MIN:SEC), assuming that *T corresponds to *TP and that no clock adjustments occurred between *TP and the desired time. If TP is null, return a value not equal to *T; this avoids false matches. If overflow occurs, yield the minimal or maximal value, except do not yield a value equal to *T. */ static time_t guess_time_tm (long_int year, long_int yday, int hour, int min, int sec, const time_t *t, const struct tm *tp) { if (tp) { time_t d = ydhms_diff (year, yday, hour, min, sec, tp->tm_year, tp->tm_yday, tp->tm_hour, tp->tm_min, tp->tm_sec); time_t t1 = *t + d; if ((t1 < *t) == (TYPE_SIGNED (time_t) ? d < 0 : TIME_T_MAX / 2 < d)) return t1; } /* Overflow occurred one way or another. Return the nearest result that is actually in range, except don't report a zero difference if the actual difference is nonzero, as that would cause a false match; and don't oscillate between two values, as that would confuse the spring-forward gap detector. */ return (*t < TIME_T_MIDPOINT ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN) : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX)); } /* Use CONVERT to convert *T to a broken down time in *TP. If *T is out of range for conversion, adjust it so that it is the nearest in-range value and then convert that. */ static struct tm * ranged_convert (struct tm *(*convert) (const time_t *, struct tm *), time_t *t, struct tm *tp) { struct tm *r = convert (t, tp); if (!r && *t) { time_t bad = *t; time_t ok = 0; /* BAD is a known unconvertible time_t, and OK is a known good one. Use binary search to narrow the range between BAD and OK until they differ by 1. */ while (bad != ok + (bad < 0 ? -1 : 1)) { time_t mid = *t = (bad < 0 ? bad + ((ok - bad) >> 1) : ok + ((bad - ok) >> 1)); r = convert (t, tp); if (r) ok = mid; else bad = mid; } if (!r && ok) { /* The last conversion attempt failed; revert to the most recent successful attempt. */ *t = ok; r = convert (t, tp); } } return r; } /* Convert *TP to a time_t value, inverting the monotonic and mostly-unit-linear conversion function CONVERT. Use *OFFSET to keep track of a guess at the offset of the result, compared to what the result would be for UTC without leap seconds. If *OFFSET's guess is correct, only one CONVERT call is needed. This function is external because it is used also by timegm.c. */ static time_t __mktime_internal (struct tm *tp, struct tm *(*convert) (const time_t *, struct tm *), time_t *offset) { time_t t, gt, t0, t1, t2; struct tm tm; /* The maximum number of probes (calls to CONVERT) should be enough to handle any combinations of time zone rule changes, solar time, leap seconds, and oscillations around a spring-forward gap. POSIX.1 prohibits leap seconds, but some hosts have them anyway. */ int remaining_probes = 6; /* Time requested. Copy it in case CONVERT modifies *TP; this can occur if TP is localtime's returned value and CONVERT is localtime. */ int sec = tp->tm_sec; int min = tp->tm_min; int hour = tp->tm_hour; int mday = tp->tm_mday; int mon = tp->tm_mon; int year_requested = tp->tm_year; int isdst = tp->tm_isdst; /* 1 if the previous probe was DST. */ int dst2; /* Ensure that mon is in range, and set year accordingly. */ int mon_remainder = mon % 12; int negative_mon_remainder = mon_remainder < 0; int mon_years = mon / 12 - negative_mon_remainder; long_int lyear_requested = year_requested; long_int year = lyear_requested + mon_years; /* The other values need not be in range: the remaining code handles minor overflows correctly, assuming int and time_t arithmetic wraps around. Major overflows are caught at the end. */ /* Calculate day of year from year, month, and day of month. The result need not be in range. */ int mon_yday = ((__mon_yday[leapyear (year)] [mon_remainder + 12 * negative_mon_remainder]) - 1); long_int lmday = mday; long_int yday = mon_yday + lmday; time_t guessed_offset = *offset; int sec_requested = sec; if (LEAP_SECONDS_POSSIBLE) { /* Handle out-of-range seconds specially, since ydhms_tm_diff assumes every minute has 60 seconds. */ if (sec < 0) sec = 0; if (59 < sec) sec = 59; } /* Invert CONVERT by probing. First assume the same offset as last time. */ t0 = ydhms_diff (year, yday, hour, min, sec, EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, (int) (- guessed_offset)); if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3) { /* time_t isn't large enough to rule out overflows, so check for major overflows. A gross check suffices, since if t0 has overflowed, it is off by a multiple of TIME_T_MAX - TIME_T_MIN + 1. So ignore any component of the difference that is bounded by a small value. */ /* Approximate log base 2 of the number of time units per biennium. A biennium is 2 years; use this unit instead of years to avoid integer overflow. For example, 2 average Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds, which is 63113904 seconds, and rint (log2 (63113904)) is 26. */ int ALOG2_SECONDS_PER_BIENNIUM = 26; int ALOG2_MINUTES_PER_BIENNIUM = 20; int ALOG2_HOURS_PER_BIENNIUM = 14; int ALOG2_DAYS_PER_BIENNIUM = 10; int LOG2_YEARS_PER_BIENNIUM = 1; int approx_requested_biennia = (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM) - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM) + SHR (mday, ALOG2_DAYS_PER_BIENNIUM) + SHR (hour, ALOG2_HOURS_PER_BIENNIUM) + SHR (min, ALOG2_MINUTES_PER_BIENNIUM) + (LEAP_SECONDS_POSSIBLE ? 0 : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM))); int approx_biennia = (int) SHR (t0, ALOG2_SECONDS_PER_BIENNIUM); int diff = approx_biennia - approx_requested_biennia; int abs_diff = diff < 0 ? - diff : diff; /* IRIX 4.0.5 cc miscaculates TIME_T_MIN / 3: it erroneously gives a positive value of 715827882. Setting a variable first then doing math on it seems to work. (ghazi@caip.rutgers.edu) */ time_t time_t_max = TIME_T_MAX; time_t time_t_min = TIME_T_MIN; time_t overflow_threshold = (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM; if (overflow_threshold < abs_diff) { /* Overflow occurred. Try repairing it; this might work if the time zone offset is enough to undo the overflow. */ time_t repaired_t0 = -1 - t0; approx_biennia = (int) SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM); diff = approx_biennia - approx_requested_biennia; abs_diff = diff < 0 ? - diff : diff; if (overflow_threshold < abs_diff) return -1; guessed_offset += repaired_t0 - t0; t0 = repaired_t0; } } /* Repeatedly use the error to improve the guess. */ for (t = t1 = t2 = t0, dst2 = 0; (gt = guess_time_tm (year, yday, hour, min, sec, &t, ranged_convert (convert, &t, &tm)), t != gt); t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0) if (t == t1 && t != t2 && (tm.tm_isdst < 0 || (isdst < 0 ? dst2 <= (tm.tm_isdst != 0) : (isdst != 0) != (tm.tm_isdst != 0)))) /* We can't possibly find a match, as we are oscillating between two values. The requested time probably falls within a spring-forward gap of size GT - T. Follow the common practice in this case, which is to return a time that is GT - T away from the requested time, preferring a time whose tm_isdst differs from the requested value. (If no tm_isdst was requested and only one of the two values has a nonzero tm_isdst, prefer that value.) In practice, this is more useful than returning -1. */ goto offset_found; else if (--remaining_probes == 0) return -1; /* We have a match. Check whether tm.tm_isdst has the requested value, if any. */ if (isdst != tm.tm_isdst && 0 <= isdst && 0 <= tm.tm_isdst) { /* tm.tm_isdst has the wrong value. Look for a neighboring time with the right value, and use its UTC offset. Heuristic: probe the adjacent timestamps in both directions, looking for the desired isdst. This should work for all real time zone histories in the tz database. */ /* Distance between probes when looking for a DST boundary. In tzdata2003a, the shortest period of DST is 601200 seconds (e.g., America/Recife starting 2000-10-08 01:00), and the shortest period of non-DST surrounded by DST is 694800 seconds (Africa/Tunis starting 1943-04-17 01:00). Use the minimum of these two values, so we don't miss these short periods when probing. */ int stride = 601200; /* The longest period of DST in tzdata2003a is 536454000 seconds (e.g., America/Jujuy starting 1946-10-01 01:00). The longest period of non-DST is much longer, but it makes no real sense to search for more than a year of non-DST, so use the DST max. */ int duration_max = 536454000; /* Search in both directions, so the maximum distance is half the duration; add the stride to avoid off-by-1 problems. */ int delta_bound = duration_max / 2 + stride; int delta, direction; for (delta = stride; delta < delta_bound; delta += stride) for (direction = -1; direction <= 1; direction += 2) { time_t ot = t + delta * direction; if ((ot < t) == (direction < 0)) { struct tm otm; ranged_convert (convert, &ot, &otm); if (otm.tm_isdst == isdst) { /* We found the desired tm_isdst. Extrapolate back to the desired time. */ t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm); ranged_convert (convert, &t, &tm); goto offset_found; } } } } offset_found: *offset = guessed_offset + t - t0; if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec) { /* Adjust time to reflect the tm_sec requested, not the normalized value. Also, repair any damage from a false match due to a leap second. */ int sec_adjustment = (sec == 0 && tm.tm_sec == 60) - sec; t1 = t + sec_requested; t2 = t1 + sec_adjustment; if (((t1 < t) != (sec_requested < 0)) | ((t2 < t1) != (sec_adjustment < 0)) | ! convert (&t2, &tm)) return -1; t = t2; } *tp = tm; return t; } /* FIXME: This should use a signed type wide enough to hold any UTC offset in seconds. 'int' should be good enough for GNU code. We can't fix this unilaterally though, as other modules invoke __mktime_internal. */ static time_t localtime_offset; /* Convert *TP to a time_t value. */ time_t mktime (struct tm *tp) { #ifdef _LIBC /* POSIX.1 8.1.1 requires that whenever mktime() is called, the time zone names contained in the external variable `tzname' shall be set as if the tzset() function had been called. */ __tzset (); #endif return __mktime_internal (tp, __localtime_r, &localtime_offset); } #ifdef weak_alias weak_alias (mktime, timelocal) #endif #ifdef _LIBC libc_hidden_def (mktime) libc_hidden_weak (timelocal) #endif #if DEBUG static int not_equal_tm (const struct tm *a, const struct tm *b) { return ((a->tm_sec ^ b->tm_sec) | (a->tm_min ^ b->tm_min) | (a->tm_hour ^ b->tm_hour) | (a->tm_mday ^ b->tm_mday) | (a->tm_mon ^ b->tm_mon) | (a->tm_year ^ b->tm_year) | (a->tm_yday ^ b->tm_yday) | (a->tm_isdst ^ b->tm_isdst)); } static void print_tm (const struct tm *tp) { if (tp) printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d", tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec, tp->tm_yday, tp->tm_wday, tp->tm_isdst); else printf ("0"); } static int check_result (time_t tk, struct tm tmk, time_t tl, const struct tm *lt) { if (tk != tl || !lt || not_equal_tm (&tmk, lt)) { printf ("mktime ("); print_tm (lt); printf (")\nyields ("); print_tm (&tmk); printf (") == %ld, should be %ld\n", (long int) tk, (long int) tl); return 1; } return 0; } int main (int argc, char **argv) { int status = 0; struct tm tm, tmk, tml; struct tm *lt; time_t tk, tl, tl1; char trailer; if ((argc == 3 || argc == 4) && (sscanf (argv[1], "%d-%d-%d%c", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer) == 3) && (sscanf (argv[2], "%d:%d:%d%c", &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer) == 3)) { tm.tm_year -= TM_YEAR_BASE; tm.tm_mon--; tm.tm_isdst = argc == 3 ? -1 : atoi (argv[3]); tmk = tm; tl = mktime (&tmk); lt = localtime (&tl); if (lt) { tml = *lt; lt = &tml; } printf ("mktime returns %ld == ", (long int) tl); print_tm (&tmk); printf ("\n"); status = check_result (tl, tmk, tl, lt); } else if (argc == 4 || (argc == 5 && strcmp (argv[4], "-") == 0)) { time_t from = atol (argv[1]); time_t by = atol (argv[2]); time_t to = atol (argv[3]); if (argc == 4) for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1) { lt = localtime (&tl); if (lt) { tmk = tml = *lt; tk = mktime (&tmk); status |= check_result (tk, tmk, tl, &tml); } else { printf ("localtime (%ld) yields 0\n", (long int) tl); status = 1; } tl1 = tl + by; if ((tl1 < tl) != (by < 0)) break; } else for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1) { /* Null benchmark. */ lt = localtime (&tl); if (lt) { tmk = tml = *lt; tk = tl; status |= check_result (tk, tmk, tl, &tml); } else { printf ("localtime (%ld) yields 0\n", (long int) tl); status = 1; } tl1 = tl + by; if ((tl1 < tl) != (by < 0)) break; } } else printf ("Usage:\ \t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\ \t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\ \t%s FROM BY TO - # Do not test those values (for benchmark).\n", argv[0], argv[0], argv[0]); return status; } #endif /* DEBUG */ /* Local Variables: compile-command: "gcc -DDEBUG -Wall -W -O -g mktime.c -o mktime" End: */ blame-1.4-20240206/lib/free.c0000644000000000000000000000171510527555557013710 0ustar rootroot/* Work around incompatibility on older systems where free (NULL) fails. Copyright (C) 2003, 2006 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. */ /* written by Paul Eggert */ #include #undef free #include void rpl_free (void *p) { if (p) free (p); } blame-1.4-20240206/lib/strnlen.c0000644000000000000000000000226410527555560014446 0ustar rootroot/* Find the length of STRING, but scan at most MAXLEN characters. Copyright (C) 2005, 2006 Free Software Foundation, Inc. Written by Simon Josefsson. 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. */ #include #include "strnlen.h" /* Find the length of STRING, but scan at most MAXLEN characters. If no '\0' terminator is found in that many characters, return MAXLEN. */ size_t strnlen (const char *string, size_t maxlen) { const char *end = memchr (string, '\0', maxlen); return end ? (size_t) (end - string) : maxlen; } blame-1.4-20240206/lib/basename.c0000644000000000000000000000745410527555557014550 0ustar rootroot/* basename.c -- return the last element in a file name Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 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. */ #include #include "dirname.h" #include #include "xalloc.h" #include "xstrndup.h" /* Return the address of the last file name component of NAME. If NAME has no relative file name components because it is a file system root, return the empty string. */ char * last_component (char const *name) { char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); char const *p; bool saw_slash = false; while (ISSLASH (*base)) base++; for (p = base; *p; p++) { if (ISSLASH (*p)) saw_slash = true; else if (saw_slash) { base = p; saw_slash = false; } } return (char *) base; } /* In general, we can't use the builtin `basename' function if available, since it has different meanings in different environments. In some environments the builtin `basename' modifies its argument. Return the last file name component of NAME, allocated with xmalloc. On systems with drive letters, a leading "./" distinguishes relative names that would otherwise look like a drive letter. Unlike POSIX basename(), NAME cannot be NULL, base_name("") returns "", and the first trailing slash is not stripped. If lstat (NAME) would succeed, then { chdir (dir_name (NAME)); lstat (base_name (NAME)); } will access the same file. Likewise, if the sequence { chdir (dir_name (NAME)); rename (base_name (NAME), "foo"); } succeeds, you have renamed NAME to "foo" in the same directory NAME was in. */ char * base_name (char const *name) { char const *base = last_component (name); size_t length; /* If there is no last component, then name is a file system root or the empty string. */ if (! *base) return xstrndup (name, base_len (name)); /* Collapse a sequence of trailing slashes into one. */ length = base_len (base); if (ISSLASH (base[length])) length++; /* On systems with drive letters, `a/b:c' must return `./b:c' rather than `b:c' to avoid confusion with a drive letter. On systems with pure POSIX semantics, this is not an issue. */ if (FILE_SYSTEM_PREFIX_LEN (base)) { char *p = xmalloc (length + 3); p[0] = '.'; p[1] = '/'; memcpy (p + 2, base, length); p[length + 2] = '\0'; return p; } /* Finally, copy the basename. */ return xstrndup (base, length); } /* Return the length of the basename NAME. Typically NAME is the value returned by base_name or last_component. Act like strlen (NAME), except omit all trailing slashes. */ size_t base_len (char const *name) { size_t len; size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) continue; if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1 && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) return 2; if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len && len == prefix_len && ISSLASH (name[prefix_len])) return prefix_len + 1; return len; } blame-1.4-20240206/lib/error.h0000644000000000000000000000463414556303406014116 0ustar rootroot/* Declaration for error-reporting function Copyright (C) 1995, 1996, 1997, 2003, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ #ifndef _ERROR_H #define _ERROR_H 1 #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) # define __format__ format # define __printf__ printf # endif #endif #ifdef __cplusplus extern "C" { #endif /* Print a message with `fprintf (stderr, FORMAT, ...)'; if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) __attribute__ ((__format__ (__printf__, 5, 6))); /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ extern void (*error_print_progname) (void); /* This variable is incremented each time `error' is called. */ extern unsigned int error_message_count; /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ extern int error_one_per_line; #ifdef __cplusplus } #endif #endif /* error.h */ blame-1.4-20240206/lib/xreadlink.h0000644000000000000000000000170510241344125014730 0ustar rootroot/* readlink wrapper to return the link name in malloc'd storage Copyright (C) 2001, 2003, 2004 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; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Jim Meyering */ #include char *xreadlink (char const *, size_t); blame-1.4-20240206/lib/setenv.c0000644000000000000000000001777610527555557014311 0ustar rootroot/* Copyright (C) 1992,1995-1999,2000-2003,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ #if !_LIBC # include #endif #include #include #ifndef __set_errno # define __set_errno(ev) ((errno) = (ev)) #endif #include #include #if _LIBC || HAVE_UNISTD_H # include #endif #if !_LIBC # include "allocsa.h" #endif #if !_LIBC # define __environ environ # ifndef HAVE_ENVIRON_DECL extern char **environ; # endif #endif #if _LIBC /* This lock protects against simultaneous modifications of `environ'. */ # include __libc_lock_define_initialized (static, envlock) # define LOCK __libc_lock_lock (envlock) # define UNLOCK __libc_lock_unlock (envlock) #else # define LOCK # define UNLOCK #endif /* In the GNU C library we must keep the namespace clean. */ #ifdef _LIBC # define setenv __setenv # define clearenv __clearenv # define tfind __tfind # define tsearch __tsearch #endif /* In the GNU C library implementation we try to be more clever and allow arbitrarily many changes of the environment given that the used values are from a small set. Outside glibc this will eat up all memory after a while. */ #if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \ && defined __GNUC__) # define USE_TSEARCH 1 # include typedef int (*compar_fn_t) (const void *, const void *); /* This is a pointer to the root of the search tree with the known values. */ static void *known_values; # define KNOWN_VALUE(Str) \ ({ \ void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ value != NULL ? *(char **) value : NULL; \ }) # define STORE_VALUE(Str) \ tsearch (Str, &known_values, (compar_fn_t) strcmp) #else # undef USE_TSEARCH # define KNOWN_VALUE(Str) NULL # define STORE_VALUE(Str) do { } while (0) #endif /* If this variable is not a null pointer we allocated the current environment. */ static char **last_environ; /* This function is used by `setenv' and `putenv'. The difference between the two functions is that for the former must create a new string which is then placed in the environment, while the argument of `putenv' must be used directly. This is all complicated by the fact that we try to reuse values once generated for a `setenv' call since we can never free the strings. */ int __add_to_environ (const char *name, const char *value, const char *combined, int replace) { register char **ep; register size_t size; const size_t namelen = strlen (name); const size_t vallen = value != NULL ? strlen (value) + 1 : 0; LOCK; /* We have to get the pointer now that we have the lock and not earlier since another thread might have created a new environment. */ ep = __environ; size = 0; if (ep != NULL) { for (; *ep != NULL; ++ep) if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') break; else ++size; } if (ep == NULL || *ep == NULL) { char **new_environ; #ifdef USE_TSEARCH char *new_value; #endif /* We allocated this space; we can extend it. */ new_environ = (char **) (last_environ == NULL ? malloc ((size + 2) * sizeof (char *)) : realloc (last_environ, (size + 2) * sizeof (char *))); if (new_environ == NULL) { UNLOCK; return -1; } /* If the whole entry is given add it. */ if (combined != NULL) /* We must not add the string to the search tree since it belongs to the user. */ new_environ[size] = (char *) combined; else { /* See whether the value is already known. */ #ifdef USE_TSEARCH # ifdef _LIBC new_value = (char *) alloca (namelen + 1 + vallen); __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), value, vallen); # else new_value = (char *) allocsa (namelen + 1 + vallen); if (new_value == NULL) { __set_errno (ENOMEM); UNLOCK; return -1; } memcpy (new_value, name, namelen); new_value[namelen] = '='; memcpy (&new_value[namelen + 1], value, vallen); # endif new_environ[size] = KNOWN_VALUE (new_value); if (new_environ[size] == NULL) #endif { new_environ[size] = (char *) malloc (namelen + 1 + vallen); if (new_environ[size] == NULL) { #if defined USE_TSEARCH && !defined _LIBC freesa (new_value); #endif __set_errno (ENOMEM); UNLOCK; return -1; } #ifdef USE_TSEARCH memcpy (new_environ[size], new_value, namelen + 1 + vallen); #else memcpy (new_environ[size], name, namelen); new_environ[size][namelen] = '='; memcpy (&new_environ[size][namelen + 1], value, vallen); #endif /* And save the value now. We cannot do this when we remove the string since then we cannot decide whether it is a user string or not. */ STORE_VALUE (new_environ[size]); } #if defined USE_TSEARCH && !defined _LIBC freesa (new_value); #endif } if (__environ != last_environ) memcpy ((char *) new_environ, (char *) __environ, size * sizeof (char *)); new_environ[size + 1] = NULL; last_environ = __environ = new_environ; } else if (replace) { char *np; /* Use the user string if given. */ if (combined != NULL) np = (char *) combined; else { #ifdef USE_TSEARCH char *new_value; # ifdef _LIBC new_value = alloca (namelen + 1 + vallen); __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), value, vallen); # else new_value = allocsa (namelen + 1 + vallen); if (new_value == NULL) { __set_errno (ENOMEM); UNLOCK; return -1; } memcpy (new_value, name, namelen); new_value[namelen] = '='; memcpy (&new_value[namelen + 1], value, vallen); # endif np = KNOWN_VALUE (new_value); if (np == NULL) #endif { np = malloc (namelen + 1 + vallen); if (np == NULL) { #if defined USE_TSEARCH && !defined _LIBC freesa (new_value); #endif __set_errno (ENOMEM); UNLOCK; return -1; } #ifdef USE_TSEARCH memcpy (np, new_value, namelen + 1 + vallen); #else memcpy (np, name, namelen); np[namelen] = '='; memcpy (&np[namelen + 1], value, vallen); #endif /* And remember the value. */ STORE_VALUE (np); } #if defined USE_TSEARCH && !defined _LIBC freesa (new_value); #endif } *ep = np; } UNLOCK; return 0; } int setenv (const char *name, const char *value, int replace) { return __add_to_environ (name, value, NULL, replace); } /* The `clearenv' was planned to be added to POSIX.1 but probably never made it. Nevertheless the POSIX.9 standard (POSIX bindings for Fortran 77) requires this function. */ int clearenv (void) { LOCK; if (__environ == last_environ && __environ != NULL) { /* We allocated this environment so we can free it. */ free (__environ); last_environ = NULL; } /* Clear the environment pointer removes the whole environment. */ __environ = NULL; UNLOCK; return 0; } #ifdef _LIBC static void free_mem (void) { /* Remove all traces. */ clearenv (); /* Now remove the search tree. */ __tdestroy (known_values, free); known_values = NULL; } text_set_element (__libc_subfreeres, free_mem); # undef setenv # undef clearenv weak_alias (__setenv, setenv) weak_alias (__clearenv, clearenv) #endif blame-1.4-20240206/lib/dirname.h0000644000000000000000000000437110527555557014414 0ustar rootroot/* Take file names apart into directory and base names. Copyright (C) 1998, 2001, 2003-2006 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. */ #ifndef DIRNAME_H_ # define DIRNAME_H_ 1 # include # include # ifndef DIRECTORY_SEPARATOR # define DIRECTORY_SEPARATOR '/' # endif # ifndef ISSLASH # define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) # endif # ifndef FILE_SYSTEM_PREFIX_LEN # if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX /* This internal macro assumes ASCII, but all hosts that support drive letters use ASCII. */ # define _IS_DRIVE_LETTER(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' \ <= 'z' - 'a') # define FILE_SYSTEM_PREFIX_LEN(Filename) \ (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) # else # define FILE_SYSTEM_PREFIX_LEN(Filename) 0 # endif # endif # ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE # define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 # endif # ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT # define DOUBLE_SLASH_IS_DISTINCT_ROOT 1 # endif # if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE # define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) # else # define IS_ABSOLUTE_FILE_NAME(F) \ (ISSLASH ((F)[0]) || 0 < FILE_SYSTEM_PREFIX_LEN (F)) # endif # define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) char *base_name (char const *file); char *dir_name (char const *file); size_t base_len (char const *file); size_t dir_len (char const *file); char *last_component (char const *file); bool strip_trailing_slashes (char *file); #endif /* not DIRNAME_H_ */ blame-1.4-20240206/lib/strftime.c0000644000000000000000000011063710527555560014622 0ustar rootroot/* Copyright (C) 1991-1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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. */ #ifdef _LIBC # define HAVE_MBLEN 1 # define HAVE_MBRLEN 1 # define HAVE_STRUCT_ERA_ENTRY 1 # define HAVE_TM_GMTOFF 1 # define HAVE_TM_ZONE 1 # define HAVE_TZNAME 1 # define HAVE_TZSET 1 # define MULTIBYTE_IS_FORMAT_SAFE 1 # include "../locale/localeinfo.h" #else # include # if FPRINTFTIME # include "fprintftime.h" # endif #endif #include #include /* Some systems define `time_t' here. */ #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #if HAVE_TZNAME && ! defined tzname extern char *tzname[]; #endif /* Do multibyte processing if multibytes are supported, unless multibyte sequences are safe in formats. Multibyte sequences are safe if they cannot contain byte sequences that look like format conversion specifications. The GNU C Library uses UTF8 multibyte encoding, which is safe for formats, but strftime.c can be used with other C libraries that use unsafe encodings. */ #define DO_MULTIBYTE (HAVE_MBLEN && HAVE_WCHAR_H && ! MULTIBYTE_IS_FORMAT_SAFE) #if DO_MULTIBYTE # if HAVE_MBRLEN # include # else /* Simulate mbrlen with mblen as best we can. */ # define mbstate_t int # define mbrlen(s, n, ps) mblen (s, n) # define mbsinit(ps) (*(ps) == 0) # endif static const mbstate_t mbstate_zero; #endif #include #include #include #include #include #ifdef COMPILE_WIDE # include # define CHAR_T wchar_t # define UCHAR_T unsigned int # define L_(Str) L##Str # define NLW(Sym) _NL_W##Sym # define MEMCPY(d, s, n) __wmemcpy (d, s, n) # define STRLEN(s) __wcslen (s) #else # define CHAR_T char # define UCHAR_T unsigned char # define L_(Str) Str # define NLW(Sym) Sym # define MEMCPY(d, s, n) memcpy (d, s, n) # define STRLEN(s) strlen (s) # ifdef _LIBC # define MEMPCPY(d, s, n) __mempcpy (d, s, n) # else # ifndef HAVE_MEMPCPY # define MEMPCPY(d, s, n) ((void *) ((char *) memcpy (d, s, n) + (n))) # endif # endif #endif /* Shift A right by B bits portably, by dividing A by 2**B and truncating towards minus infinity. A and B should be free of side effects, and B should be in the range 0 <= B <= INT_BITS - 2, where INT_BITS is the number of useful bits in an int. GNU code can assume that INT_BITS is at least 32. ISO C99 says that A >> B is implementation-defined if A < 0. Some implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift right in the usual way when A < 0, so SHR falls back on division if ordinary A >> B doesn't seem to be the usual signed shift. */ #define SHR(a, b) \ (-1 >> 1 == -1 \ ? (a) >> (b) \ : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0)) /* Bound on length of the string representing an integer type or expression T. Subtract 1 for the sign bit if t is signed; log10 (2.0) < 146/485; add 1 for integer division truncation; add 1 more for a minus sign if needed. */ #define INT_STRLEN_BOUND(t) \ ((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2) #define TM_YEAR_BASE 1900 #ifndef __isleap /* Nonzero if YEAR is a leap year (every 4 years, except every 100th isn't, and every 400th is). */ # define __isleap(year) \ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) #endif #ifdef _LIBC # define tzname __tzname # define tzset __tzset #endif #if !HAVE_TM_GMTOFF /* Portable standalone applications should supply a "time_r.h" that declares a POSIX-compliant localtime_r, for the benefit of older implementations that lack localtime_r or have a nonstandard one. See the gnulib time_r module for one way to implement this. */ # include "time_r.h" # undef __gmtime_r # undef __localtime_r # define __gmtime_r gmtime_r # define __localtime_r localtime_r #endif #ifndef FPRINTFTIME # define FPRINTFTIME 0 #endif #if FPRINTFTIME # define STREAM_OR_CHAR_T FILE # define STRFTIME_ARG(x) /* empty */ #else # define STREAM_OR_CHAR_T CHAR_T # define STRFTIME_ARG(x) x, #endif #if FPRINTFTIME # define memset_byte(P, Len, Byte) \ do { size_t _i; for (_i = 0; _i < Len; _i++) fputc (Byte, P); } while (0) # define memset_space(P, Len) memset_byte (P, Len, ' ') # define memset_zero(P, Len) memset_byte (P, Len, '0') #elif defined COMPILE_WIDE # define memset_space(P, Len) (wmemset (P, L' ', Len), (P) += (Len)) # define memset_zero(P, Len) (wmemset (P, L'0', Len), (P) += (Len)) #else # define memset_space(P, Len) (memset (P, ' ', Len), (P) += (Len)) # define memset_zero(P, Len) (memset (P, '0', Len), (P) += (Len)) #endif #if FPRINTFTIME # define advance(P, N) #else # define advance(P, N) ((P) += (N)) #endif #define add(n, f) \ do \ { \ int _n = (n); \ int _delta = width - _n; \ int _incr = _n + (_delta > 0 ? _delta : 0); \ if ((size_t) _incr >= maxsize - i) \ return 0; \ if (p) \ { \ if (digits == 0 && _delta > 0) \ { \ if (pad == L_('0')) \ memset_zero (p, _delta); \ else \ memset_space (p, _delta); \ } \ f; \ advance (p, _n); \ } \ i += _incr; \ } while (0) #if FPRINTFTIME # define add1(C) add (1, fputc (C, p)) #else # define add1(C) add (1, *p = C) #endif #if FPRINTFTIME # define cpy(n, s) \ add ((n), \ if (to_lowcase) \ fwrite_lowcase (p, (s), _n); \ else if (to_uppcase) \ fwrite_uppcase (p, (s), _n); \ else \ fwrite ((s), _n, 1, p)) #else # define cpy(n, s) \ add ((n), \ if (to_lowcase) \ memcpy_lowcase (p, (s), _n LOCALE_ARG); \ else if (to_uppcase) \ memcpy_uppcase (p, (s), _n LOCALE_ARG); \ else \ MEMCPY ((void *) p, (void const *) (s), _n)) #endif #ifdef COMPILE_WIDE # ifndef USE_IN_EXTENDED_LOCALE_MODEL # undef __mbsrtowcs_l # define __mbsrtowcs_l(d, s, l, st, loc) __mbsrtowcs (d, s, l, st) # endif # define widen(os, ws, l) \ { \ mbstate_t __st; \ const char *__s = os; \ memset (&__st, '\0', sizeof (__st)); \ l = __mbsrtowcs_l (NULL, &__s, 0, &__st, loc); \ ws = (wchar_t *) alloca ((l + 1) * sizeof (wchar_t)); \ (void) __mbsrtowcs_l (ws, &__s, l, &__st, loc); \ } #endif #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL /* We use this code also for the extended locale handling where the function gets as an additional argument the locale which has to be used. To access the values we have to redefine the _NL_CURRENT macro. */ # define strftime __strftime_l # define wcsftime __wcsftime_l # undef _NL_CURRENT # define _NL_CURRENT(category, item) \ (current->values[_NL_ITEM_INDEX (item)].string) # define LOCALE_ARG , loc # define LOCALE_PARAM_PROTO , __locale_t loc # define HELPER_LOCALE_ARG , current #else # define LOCALE_PARAM_PROTO # define LOCALE_ARG # ifdef _LIBC # define HELPER_LOCALE_ARG , _NL_CURRENT_DATA (LC_TIME) # else # define HELPER_LOCALE_ARG # endif #endif #ifdef COMPILE_WIDE # ifdef USE_IN_EXTENDED_LOCALE_MODEL # define TOUPPER(Ch, L) __towupper_l (Ch, L) # define TOLOWER(Ch, L) __towlower_l (Ch, L) # else # define TOUPPER(Ch, L) towupper (Ch) # define TOLOWER(Ch, L) towlower (Ch) # endif #else # ifdef USE_IN_EXTENDED_LOCALE_MODEL # define TOUPPER(Ch, L) __toupper_l (Ch, L) # define TOLOWER(Ch, L) __tolower_l (Ch, L) # else # define TOUPPER(Ch, L) toupper (Ch) # define TOLOWER(Ch, L) tolower (Ch) # endif #endif /* We don't use `isdigit' here since the locale dependent interpretation is not what we want here. We only need to accept the arabic digits in the ASCII range. One day there is perhaps a more reliable way to accept other sets of digits. */ #define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9) #if FPRINTFTIME static void fwrite_lowcase (FILE *fp, const CHAR_T *src, size_t len) { while (len-- > 0) { fputc (TOLOWER ((UCHAR_T) *src, loc), fp); ++src; } } static void fwrite_uppcase (FILE *fp, const CHAR_T *src, size_t len) { while (len-- > 0) { fputc (TOUPPER ((UCHAR_T) *src, loc), fp); ++src; } } #else static CHAR_T * memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_PROTO) { while (len-- > 0) dest[len] = TOLOWER ((UCHAR_T) src[len], loc); return dest; } static CHAR_T * memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_PROTO) { while (len-- > 0) dest[len] = TOUPPER ((UCHAR_T) src[len], loc); return dest; } #endif #if ! HAVE_TM_GMTOFF /* Yield the difference between *A and *B, measured in seconds, ignoring leap seconds. */ # define tm_diff ftime_tm_diff static int tm_diff (const struct tm *a, const struct tm *b) { /* Compute intervening leap days correctly even if year is negative. Take care to avoid int overflow in leap day calculations, but it's OK to assume that A and B are close to each other. */ int a4 = SHR (a->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (a->tm_year & 3); int b4 = SHR (b->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (b->tm_year & 3); int a100 = a4 / 25 - (a4 % 25 < 0); int b100 = b4 / 25 - (b4 % 25 < 0); int a400 = SHR (a100, 2); int b400 = SHR (b100, 2); int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400); int years = a->tm_year - b->tm_year; int days = (365 * years + intervening_leap_days + (a->tm_yday - b->tm_yday)); return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour)) + (a->tm_min - b->tm_min)) + (a->tm_sec - b->tm_sec)); } #endif /* ! HAVE_TM_GMTOFF */ /* The number of days from the first day of the first ISO week of this year to the year day YDAY with week day WDAY. ISO weeks start on Monday; the first ISO week has the year's first Thursday. YDAY may be as small as YDAY_MINIMUM. */ #define ISO_WEEK_START_WDAY 1 /* Monday */ #define ISO_WEEK1_WDAY 4 /* Thursday */ #define YDAY_MINIMUM (-366) #ifdef __GNUC__ __inline__ #endif static int iso_week_days (int yday, int wday) { /* Add enough to the first operand of % to make it nonnegative. */ int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7; return (yday - (yday - wday + ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7 + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY); } /* When compiling this file, GNU applications can #define my_strftime to a symbol (typically nstrftime) to get an extended strftime with extra arguments UT and NS. Emacs is a special case for now, but this Emacs-specific code can be removed once Emacs's config.h defines my_strftime. */ #if defined emacs && !defined my_strftime # define my_strftime nstrftime #endif #if FPRINTFTIME # undef my_strftime # define my_strftime fprintftime #endif #ifdef my_strftime # define extra_args , ut, ns # define extra_args_spec , int ut, int ns #else # if defined COMPILE_WIDE # define my_strftime wcsftime # define nl_get_alt_digit _nl_get_walt_digit # else # define my_strftime strftime # define nl_get_alt_digit _nl_get_alt_digit # endif # define extra_args # define extra_args_spec /* We don't have this information in general. */ # define ut 0 # define ns 0 #endif /* Just like my_strftime, below, but with one more parameter, UPCASE, to indicate that the result should be converted to upper case. */ static size_t strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) const CHAR_T *format, const struct tm *tp extra_args_spec LOCALE_PARAM_PROTO) { #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL struct locale_data *const current = loc->__locales[LC_TIME]; #endif #if FPRINTFTIME size_t maxsize = (size_t) -1; #endif int hour12 = tp->tm_hour; #ifdef _NL_CURRENT /* We cannot make the following values variables since we must delay the evaluation of these values until really needed since some expressions might not be valid in every situation. The `struct tm' might be generated by a strptime() call that initialized only a few elements. Dereference the pointers only if the format requires this. Then it is ok to fail if the pointers are invalid. */ # define a_wkday \ ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ABDAY_1) + tp->tm_wday)) # define f_wkday \ ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(DAY_1) + tp->tm_wday)) # define a_month \ ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ABMON_1) + tp->tm_mon)) # define f_month \ ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon)) # define ampm \ ((const CHAR_T *) _NL_CURRENT (LC_TIME, tp->tm_hour > 11 \ ? NLW(PM_STR) : NLW(AM_STR))) # define aw_len STRLEN (a_wkday) # define am_len STRLEN (a_month) # define ap_len STRLEN (ampm) #endif const char *zone; size_t i = 0; STREAM_OR_CHAR_T *p = s; const CHAR_T *f; #if DO_MULTIBYTE && !defined COMPILE_WIDE const char *format_end = NULL; #endif #if ! defined _LIBC && ! HAVE_RUN_TZSET_TEST /* Solaris 2.5.x and 2.6 tzset sometimes modify the storage returned by localtime. On such systems, we must either use the tzset and localtime wrappers to work around the bug (which sets HAVE_RUN_TZSET_TEST) or make a copy of the structure. */ struct tm copy = *tp; tp = © #endif zone = NULL; #if HAVE_TM_ZONE /* The POSIX test suite assumes that setting the environment variable TZ to a new value before calling strftime() will influence the result (the %Z format) even if the information in TP is computed with a totally different time zone. This is bogus: though POSIX allows bad behavior like this, POSIX does not require it. Do the right thing instead. */ zone = (const char *) tp->tm_zone; #endif #if HAVE_TZNAME if (ut) { if (! (zone && *zone)) zone = "GMT"; } else { /* POSIX.1 requires that local time zone information be used as though strftime called tzset. */ # if HAVE_TZSET tzset (); # endif } #endif if (hour12 > 12) hour12 -= 12; else if (hour12 == 0) hour12 = 12; for (f = format; *f != '\0'; ++f) { int pad = 0; /* Padding for number ('-', '_', or 0). */ int modifier; /* Field modifier ('E', 'O', or 0). */ int digits = 0; /* Max digits for numeric format. */ int number_value; /* Numeric value to be printed. */ unsigned int u_number_value; /* (unsigned int) number_value. */ bool negative_number; /* The number is negative. */ bool always_output_a_sign; /* +/- should always be output. */ int tz_colon_mask; /* Bitmask of where ':' should appear. */ const CHAR_T *subfmt; CHAR_T sign_char; CHAR_T *bufp; CHAR_T buf[1 + 2 /* for the two colons in a %::z or %:::z time zone */ + (sizeof (int) < sizeof (time_t) ? INT_STRLEN_BOUND (time_t) : INT_STRLEN_BOUND (int))]; int width = -1; bool to_lowcase = false; bool to_uppcase = upcase; size_t colons; bool change_case = false; int format_char; #if DO_MULTIBYTE && !defined COMPILE_WIDE switch (*f) { case L_('%'): break; case L_('\b'): case L_('\t'): case L_('\n'): case L_('\v'): case L_('\f'): case L_('\r'): case L_(' '): case L_('!'): case L_('"'): case L_('#'): case L_('&'): case L_('\''): case L_('('): case L_(')'): case L_('*'): case L_('+'): case L_(','): case L_('-'): case L_('.'): case L_('/'): case L_('0'): case L_('1'): case L_('2'): case L_('3'): case L_('4'): case L_('5'): case L_('6'): case L_('7'): case L_('8'): case L_('9'): case L_(':'): case L_(';'): case L_('<'): case L_('='): case L_('>'): case L_('?'): case L_('A'): case L_('B'): case L_('C'): case L_('D'): case L_('E'): case L_('F'): case L_('G'): case L_('H'): case L_('I'): case L_('J'): case L_('K'): case L_('L'): case L_('M'): case L_('N'): case L_('O'): case L_('P'): case L_('Q'): case L_('R'): case L_('S'): case L_('T'): case L_('U'): case L_('V'): case L_('W'): case L_('X'): case L_('Y'): case L_('Z'): case L_('['): case L_('\\'): case L_(']'): case L_('^'): case L_('_'): case L_('a'): case L_('b'): case L_('c'): case L_('d'): case L_('e'): case L_('f'): case L_('g'): case L_('h'): case L_('i'): case L_('j'): case L_('k'): case L_('l'): case L_('m'): case L_('n'): case L_('o'): case L_('p'): case L_('q'): case L_('r'): case L_('s'): case L_('t'): case L_('u'): case L_('v'): case L_('w'): case L_('x'): case L_('y'): case L_('z'): case L_('{'): case L_('|'): case L_('}'): case L_('~'): /* The C Standard requires these 98 characters (plus '%') to be in the basic execution character set. None of these characters can start a multibyte sequence, so they need not be analyzed further. */ add1 (*f); continue; default: /* Copy this multibyte sequence until we reach its end, find an error, or come back to the initial shift state. */ { mbstate_t mbstate = mbstate_zero; size_t len = 0; size_t fsize; if (! format_end) format_end = f + strlen (f) + 1; fsize = format_end - f; do { size_t bytes = mbrlen (f + len, fsize - len, &mbstate); if (bytes == 0) break; if (bytes == (size_t) -2) { len += strlen (f + len); break; } if (bytes == (size_t) -1) { len++; break; } len += bytes; } while (! mbsinit (&mbstate)); cpy (len, f); f += len - 1; continue; } } #else /* ! DO_MULTIBYTE */ /* Either multibyte encodings are not supported, they are safe for formats, so any non-'%' byte can be copied through, or this is the wide character version. */ if (*f != L_('%')) { add1 (*f); continue; } #endif /* ! DO_MULTIBYTE */ /* Check for flags that can modify a format. */ while (1) { switch (*++f) { /* This influences the number formats. */ case L_('_'): case L_('-'): case L_('0'): pad = *f; continue; /* This changes textual output. */ case L_('^'): to_uppcase = true; continue; case L_('#'): change_case = true; continue; default: break; } break; } /* As a GNU extension we allow to specify the field width. */ if (ISDIGIT (*f)) { width = 0; do { if (width > INT_MAX / 10 || (width == INT_MAX / 10 && *f - L_('0') > INT_MAX % 10)) /* Avoid overflow. */ width = INT_MAX; else { width *= 10; width += *f - L_('0'); } ++f; } while (ISDIGIT (*f)); } /* Check for modifiers. */ switch (*f) { case L_('E'): case L_('O'): modifier = *f++; break; default: modifier = 0; break; } /* Now do the specified format. */ format_char = *f; switch (format_char) { #define DO_NUMBER(d, v) \ digits = d; \ number_value = v; goto do_number #define DO_SIGNED_NUMBER(d, negative, v) \ digits = d; \ negative_number = negative; \ u_number_value = v; goto do_signed_number /* The mask is not what you might think. When the ordinal i'th bit is set, insert a colon before the i'th digit of the time zone representation. */ #define DO_TZ_OFFSET(d, negative, mask, v) \ digits = d; \ negative_number = negative; \ tz_colon_mask = mask; \ u_number_value = v; goto do_tz_offset #define DO_NUMBER_SPACEPAD(d, v) \ digits = d; \ number_value = v; goto do_number_spacepad case L_('%'): if (modifier != 0) goto bad_format; add1 (*f); break; case L_('a'): if (modifier != 0) goto bad_format; if (change_case) { to_uppcase = true; to_lowcase = false; } #ifdef _NL_CURRENT cpy (aw_len, a_wkday); break; #else goto underlying_strftime; #endif case 'A': if (modifier != 0) goto bad_format; if (change_case) { to_uppcase = true; to_lowcase = false; } #ifdef _NL_CURRENT cpy (STRLEN (f_wkday), f_wkday); break; #else goto underlying_strftime; #endif case L_('b'): case L_('h'): if (change_case) { to_uppcase = true; to_lowcase = false; } if (modifier != 0) goto bad_format; #ifdef _NL_CURRENT cpy (am_len, a_month); break; #else goto underlying_strftime; #endif case L_('B'): if (modifier != 0) goto bad_format; if (change_case) { to_uppcase = true; to_lowcase = false; } #ifdef _NL_CURRENT cpy (STRLEN (f_month), f_month); break; #else goto underlying_strftime; #endif case L_('c'): if (modifier == L_('O')) goto bad_format; #ifdef _NL_CURRENT if (! (modifier == 'E' && (*(subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ERA_D_T_FMT))) != '\0'))) subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_T_FMT)); #else goto underlying_strftime; #endif subformat: { size_t len = strftime_case_ (to_uppcase, NULL, STRFTIME_ARG ((size_t) -1) subfmt, tp extra_args LOCALE_ARG); add (len, strftime_case_ (to_uppcase, p, STRFTIME_ARG (maxsize - i) subfmt, tp extra_args LOCALE_ARG)); } break; #if !(defined _NL_CURRENT && HAVE_STRUCT_ERA_ENTRY) underlying_strftime: { /* The relevant information is available only via the underlying strftime implementation, so use that. */ char ufmt[5]; char *u = ufmt; char ubuf[1024]; /* enough for any single format in practice */ size_t len; /* Make sure we're calling the actual underlying strftime. In some cases, config.h contains something like "#define strftime rpl_strftime". */ # ifdef strftime # undef strftime size_t strftime (); # endif /* The space helps distinguish strftime failure from empty output. */ *u++ = ' '; *u++ = '%'; if (modifier != 0) *u++ = modifier; *u++ = format_char; *u = '\0'; len = strftime (ubuf, sizeof ubuf, ufmt, tp); if (len != 0) cpy (len - 1, ubuf + 1); } break; #endif case L_('C'): if (modifier == L_('O')) goto bad_format; if (modifier == L_('E')) { #if HAVE_STRUCT_ERA_ENTRY struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG); if (era) { # ifdef COMPILE_WIDE size_t len = __wcslen (era->era_wname); cpy (len, era->era_wname); # else size_t len = strlen (era->era_name); cpy (len, era->era_name); # endif break; } #else goto underlying_strftime; #endif } { int century = tp->tm_year / 100 + TM_YEAR_BASE / 100; century -= tp->tm_year % 100 < 0 && 0 < century; DO_SIGNED_NUMBER (2, tp->tm_year < - TM_YEAR_BASE, century); } case L_('x'): if (modifier == L_('O')) goto bad_format; #ifdef _NL_CURRENT if (! (modifier == L_('E') && (*(subfmt = (const CHAR_T *)_NL_CURRENT (LC_TIME, NLW(ERA_D_FMT))) != L_('\0')))) subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_FMT)); goto subformat; #else goto underlying_strftime; #endif case L_('D'): if (modifier != 0) goto bad_format; subfmt = L_("%m/%d/%y"); goto subformat; case L_('d'): if (modifier == L_('E')) goto bad_format; DO_NUMBER (2, tp->tm_mday); case L_('e'): if (modifier == L_('E')) goto bad_format; DO_NUMBER_SPACEPAD (2, tp->tm_mday); /* All numeric formats set DIGITS and NUMBER_VALUE (or U_NUMBER_VALUE) and then jump to one of these labels. */ do_tz_offset: always_output_a_sign = true; goto do_number_body; do_number_spacepad: /* Force `_' flag unless overridden by `0' or `-' flag. */ if (pad != L_('0') && pad != L_('-')) pad = L_('_'); do_number: /* Format NUMBER_VALUE according to the MODIFIER flag. */ negative_number = number_value < 0; u_number_value = number_value; do_signed_number: always_output_a_sign = false; tz_colon_mask = 0; do_number_body: /* Format U_NUMBER_VALUE according to the MODIFIER flag. NEGATIVE_NUMBER is nonzero if the original number was negative; in this case it was converted directly to unsigned int (i.e., modulo (UINT_MAX + 1)) without negating it. */ if (modifier == L_('O') && !negative_number) { #ifdef _NL_CURRENT /* Get the locale specific alternate representation of the number. If none exist NULL is returned. */ const CHAR_T *cp = nl_get_alt_digit (u_number_value HELPER_LOCALE_ARG); if (cp != NULL) { size_t digitlen = STRLEN (cp); if (digitlen != 0) { cpy (digitlen, cp); break; } } #else goto underlying_strftime; #endif } bufp = buf + sizeof (buf) / sizeof (buf[0]); if (negative_number) u_number_value = - u_number_value; do { if (tz_colon_mask & 1) *--bufp = ':'; tz_colon_mask >>= 1; *--bufp = u_number_value % 10 + L_('0'); u_number_value /= 10; } while (u_number_value != 0 || tz_colon_mask != 0); do_number_sign_and_padding: if (digits < width) digits = width; sign_char = (negative_number ? L_('-') : always_output_a_sign ? L_('+') : 0); if (pad == L_('-')) { if (sign_char) add1 (sign_char); } else { int padding = digits - (buf + (sizeof (buf) / sizeof (buf[0])) - bufp) - !!sign_char; if (padding > 0) { if (pad == L_('_')) { if ((size_t) padding >= maxsize - i) return 0; if (p) memset_space (p, padding); i += padding; width = width > padding ? width - padding : 0; if (sign_char) add1 (sign_char); } else { if ((size_t) digits >= maxsize - i) return 0; if (sign_char) add1 (sign_char); if (p) memset_zero (p, padding); i += padding; width = 0; } } else { if (sign_char) add1 (sign_char); } } cpy (buf + sizeof (buf) / sizeof (buf[0]) - bufp, bufp); break; case L_('F'): if (modifier != 0) goto bad_format; subfmt = L_("%Y-%m-%d"); goto subformat; case L_('H'): if (modifier == L_('E')) goto bad_format; DO_NUMBER (2, tp->tm_hour); case L_('I'): if (modifier == L_('E')) goto bad_format; DO_NUMBER (2, hour12); case L_('k'): /* GNU extension. */ if (modifier == L_('E')) goto bad_format; DO_NUMBER_SPACEPAD (2, tp->tm_hour); case L_('l'): /* GNU extension. */ if (modifier == L_('E')) goto bad_format; DO_NUMBER_SPACEPAD (2, hour12); case L_('j'): if (modifier == L_('E')) goto bad_format; DO_SIGNED_NUMBER (3, tp->tm_yday < -1, tp->tm_yday + 1U); case L_('M'): if (modifier == L_('E')) goto bad_format; DO_NUMBER (2, tp->tm_min); case L_('m'): if (modifier == L_('E')) goto bad_format; DO_SIGNED_NUMBER (2, tp->tm_mon < -1, tp->tm_mon + 1U); #ifndef _LIBC case L_('N'): /* GNU extension. */ if (modifier == L_('E')) goto bad_format; number_value = ns; if (width == -1) width = 9; else { /* Take an explicit width less than 9 as a precision. */ int j; for (j = width; j < 9; j++) number_value /= 10; } DO_NUMBER (width, number_value); #endif case L_('n'): add1 (L_('\n')); break; case L_('P'): to_lowcase = true; #ifndef _NL_CURRENT format_char = L_('p'); #endif /* FALLTHROUGH */ case L_('p'): if (change_case) { to_uppcase = false; to_lowcase = true; } #ifdef _NL_CURRENT cpy (ap_len, ampm); break; #else goto underlying_strftime; #endif case L_('R'): subfmt = L_("%H:%M"); goto subformat; case L_('r'): #ifdef _NL_CURRENT if (*(subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(T_FMT_AMPM))) == L_('\0')) subfmt = L_("%I:%M:%S %p"); goto subformat; #else goto underlying_strftime; #endif case L_('S'): if (modifier == L_('E')) goto bad_format; DO_NUMBER (2, tp->tm_sec); case L_('s'): /* GNU extension. */ { struct tm ltm; time_t t; ltm = *tp; t = mktime (<m); /* Generate string value for T using time_t arithmetic; this works even if sizeof (long) < sizeof (time_t). */ bufp = buf + sizeof (buf) / sizeof (buf[0]); negative_number = t < 0; do { int d = t % 10; t /= 10; *--bufp = (negative_number ? -d : d) + L_('0'); } while (t != 0); digits = 1; always_output_a_sign = false; goto do_number_sign_and_padding; } case L_('X'): if (modifier == L_('O')) goto bad_format; #ifdef _NL_CURRENT if (! (modifier == L_('E') && (*(subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ERA_T_FMT))) != L_('\0')))) subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(T_FMT)); goto subformat; #else goto underlying_strftime; #endif case L_('T'): subfmt = L_("%H:%M:%S"); goto subformat; case L_('t'): add1 (L_('\t')); break; case L_('u'): DO_NUMBER (1, (tp->tm_wday - 1 + 7) % 7 + 1); case L_('U'): if (modifier == L_('E')) goto bad_format; DO_NUMBER (2, (tp->tm_yday - tp->tm_wday + 7) / 7); case L_('V'): case L_('g'): case L_('G'): if (modifier == L_('E')) goto bad_format; { /* YEAR is a leap year if and only if (tp->tm_year + TM_YEAR_BASE) is a leap year, except that YEAR and YEAR - 1 both work correctly even when (tp->tm_year + TM_YEAR_BASE) would overflow. */ int year = (tp->tm_year + (tp->tm_year < 0 ? TM_YEAR_BASE % 400 : TM_YEAR_BASE % 400 - 400)); int year_adjust = 0; int days = iso_week_days (tp->tm_yday, tp->tm_wday); if (days < 0) { /* This ISO week belongs to the previous year. */ year_adjust = -1; days = iso_week_days (tp->tm_yday + (365 + __isleap (year - 1)), tp->tm_wday); } else { int d = iso_week_days (tp->tm_yday - (365 + __isleap (year)), tp->tm_wday); if (0 <= d) { /* This ISO week belongs to the next year. */ year_adjust = 1; days = d; } } switch (*f) { case L_('g'): { int yy = (tp->tm_year % 100 + year_adjust) % 100; DO_NUMBER (2, (0 <= yy ? yy : tp->tm_year < -TM_YEAR_BASE - year_adjust ? -yy : yy + 100)); } case L_('G'): DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE - year_adjust, (tp->tm_year + (unsigned int) TM_YEAR_BASE + year_adjust)); default: DO_NUMBER (2, days / 7 + 1); } } case L_('W'): if (modifier == L_('E')) goto bad_format; DO_NUMBER (2, (tp->tm_yday - (tp->tm_wday - 1 + 7) % 7 + 7) / 7); case L_('w'): if (modifier == L_('E')) goto bad_format; DO_NUMBER (1, tp->tm_wday); case L_('Y'): if (modifier == 'E') { #if HAVE_STRUCT_ERA_ENTRY struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG); if (era) { # ifdef COMPILE_WIDE subfmt = era->era_wformat; # else subfmt = era->era_format; # endif goto subformat; } #else goto underlying_strftime; #endif } if (modifier == L_('O')) goto bad_format; else DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE, tp->tm_year + (unsigned int) TM_YEAR_BASE); case L_('y'): if (modifier == L_('E')) { #if HAVE_STRUCT_ERA_ENTRY struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG); if (era) { int delta = tp->tm_year - era->start_date[0]; DO_NUMBER (1, (era->offset + delta * era->absolute_direction)); } #else goto underlying_strftime; #endif } { int yy = tp->tm_year % 100; if (yy < 0) yy = tp->tm_year < - TM_YEAR_BASE ? -yy : yy + 100; DO_NUMBER (2, yy); } case L_('Z'): if (change_case) { to_uppcase = false; to_lowcase = true; } #if HAVE_TZNAME /* The tzset() call might have changed the value. */ if (!(zone && *zone) && tp->tm_isdst >= 0) zone = tzname[tp->tm_isdst != 0]; #endif if (! zone) zone = ""; #ifdef COMPILE_WIDE { /* The zone string is always given in multibyte form. We have to transform it first. */ wchar_t *wczone; size_t len; widen (zone, wczone, len); cpy (len, wczone); } #else cpy (strlen (zone), zone); #endif break; case L_(':'): /* :, ::, and ::: are valid only just before 'z'. :::: etc. are rejected later. */ for (colons = 1; f[colons] == L_(':'); colons++) continue; if (f[colons] != L_('z')) goto bad_format; f += colons; goto do_z_conversion; case L_('z'): colons = 0; do_z_conversion: if (tp->tm_isdst < 0) break; { int diff; int hour_diff; int min_diff; int sec_diff; #if HAVE_TM_GMTOFF diff = tp->tm_gmtoff; #else if (ut) diff = 0; else { struct tm gtm; struct tm ltm; time_t lt; ltm = *tp; lt = mktime (<m); if (lt == (time_t) -1) { /* mktime returns -1 for errors, but -1 is also a valid time_t value. Check whether an error really occurred. */ struct tm tm; if (! __localtime_r (<, &tm) || ((ltm.tm_sec ^ tm.tm_sec) | (ltm.tm_min ^ tm.tm_min) | (ltm.tm_hour ^ tm.tm_hour) | (ltm.tm_mday ^ tm.tm_mday) | (ltm.tm_mon ^ tm.tm_mon) | (ltm.tm_year ^ tm.tm_year))) break; } if (! __gmtime_r (<, >m)) break; diff = tm_diff (<m, >m); } #endif hour_diff = diff / 60 / 60; min_diff = diff / 60 % 60; sec_diff = diff % 60; switch (colons) { case 0: /* +hhmm */ DO_TZ_OFFSET (5, diff < 0, 0, hour_diff * 100 + min_diff); case 1: tz_hh_mm: /* +hh:mm */ DO_TZ_OFFSET (6, diff < 0, 04, hour_diff * 100 + min_diff); case 2: tz_hh_mm_ss: /* +hh:mm:ss */ DO_TZ_OFFSET (9, diff < 0, 024, hour_diff * 10000 + min_diff * 100 + sec_diff); case 3: /* +hh if possible, else +hh:mm, else +hh:mm:ss */ if (sec_diff != 0) goto tz_hh_mm_ss; if (min_diff != 0) goto tz_hh_mm; DO_TZ_OFFSET (3, diff < 0, 0, hour_diff); default: goto bad_format; } } case L_('\0'): /* GNU extension: % at end of format. */ --f; /* Fall through. */ default: /* Unknown format; output the format, including the '%', since this is most likely the right thing to do if a multibyte string has been misparsed. */ bad_format: { int flen; for (flen = 1; f[1 - flen] != L_('%'); flen++) continue; cpy (flen, &f[1 - flen]); } break; } } #if ! FPRINTFTIME if (p && maxsize != 0) *p = L_('\0'); #endif return i; } /* Write information from TP into S according to the format string FORMAT, writing no more that MAXSIZE characters (including the terminating '\0') and returning number of characters written. If S is NULL, nothing will be written anywhere, so to determine how many characters would be written, use NULL for S and (size_t) -1 for MAXSIZE. */ size_t my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) const CHAR_T *format, const struct tm *tp extra_args_spec LOCALE_PARAM_PROTO) { return strftime_case_ (false, s, STRFTIME_ARG (maxsize) format, tp extra_args LOCALE_ARG); } #if defined _LIBC && ! FPRINTFTIME libc_hidden_def (my_strftime) #endif #if defined emacs && ! FPRINTFTIME /* For Emacs we have a separate interface which corresponds to the normal strftime function plus the ut argument, but without the ns argument. */ size_t emacs_strftimeu (char *s, size_t maxsize, const char *format, const struct tm *tp, int ut) { return my_strftime (s, maxsize, format, tp, ut, 0); } #endif blame-1.4-20240206/lib/strcasecmp.c0000644000000000000000000000543114557307724015130 0ustar rootroot/* Case-insensitive string comparison function. Copyright (C) 1998-1999, 2005-2006 Free Software Foundation, Inc. Written by Bruno Haible , 2005, based on earlier glibc code. 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. */ #include /* Specification. */ #include "strcase.h" #include #include #if HAVE_MBRTOWC # include "mbuiter.h" #endif #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) /* Compare strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function may, in multibyte locales, return 0 for strings of different lengths! */ int strcasecmp (const char *s1, const char *s2) { if (s1 == s2) return 0; /* Be careful not to look at the entire extent of s1 or s2 until needed. This is useful because when two strings differ, the difference is most often already in the very few first characters. */ #if HAVE_MBRTOWC if (MB_CUR_MAX > 1) { mbui_iterator_t iter1; mbui_iterator_t iter2; mbui_init (iter1, s1); mbui_init (iter2, s2); while (mbui_avail (iter1) && mbui_avail (iter2)) { int cmp = mb_casecmp (mbui_cur (iter1), mbui_cur (iter2)); if (cmp != 0) return cmp; mbui_advance (iter1); mbui_advance (iter2); } if (mbui_avail (iter1)) /* s2 terminated before s1. */ return 1; if (mbui_avail (iter2)) /* s1 terminated before s2. */ return -1; return 0; } else #endif { const unsigned char *p1 = (const unsigned char *) s1; const unsigned char *p2 = (const unsigned char *) s2; unsigned char c1, c2; do { c1 = (unsigned char) TOLOWER (*p1); c2 = (unsigned char) TOLOWER (*p2); if (c1 == '\0') break; ++p1; ++p2; } while (c1 == c2); if (UCHAR_MAX <= INT_MAX) return c1 - c2; else /* On machines where 'char' and 'int' are types of the same size, the difference of two 'unsigned char' values - including the sign bit - doesn't fit in an 'int'. */ return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); } } blame-1.4-20240206/lib/mempcpy.h0000644000000000000000000000206414556567174014450 0ustar rootroot/* Copy memory area and return pointer after last written byte. Copyright (C) 2003, 2004 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. */ #ifndef mempcpy # include /* Copy N bytes of SRC to DEST, return pointer to bytes after the last written byte. */ #define mempcpy(d,s,n) replace_mempcpy(d,s,n) extern void *mempcpy (void *dest, const void *src, size_t n); #endif blame-1.4-20240206/lib/stripslash.c0000644000000000000000000000311410527555560015150 0ustar rootroot/* stripslash.c -- remove redundant trailing slashes from a file name Copyright (C) 1990, 2001, 2003-2006 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. */ #include #include "dirname.h" /* Remove trailing slashes from FILE. Return true if a trailing slash was removed. This is useful when using file name completion from a shell that adds a "/" after directory names (such as tcsh and bash), because on symlinks to directories, several system calls have different semantics according to whether a trailing slash is present. */ bool strip_trailing_slashes (char *file) { char *base = last_component (file); char *base_lim; bool had_slash; /* last_component returns "" for file system roots, but we need to turn `///' into `/'. */ if (! *base) base = file; base_lim = base + base_len (base); had_slash = (*base_lim != '\0'); *base_lim = '\0'; return had_slash; } blame-1.4-20240206/lib/canonicalize.h0000644000000000000000000000372610527555557015437 0ustar rootroot/* Return the canonical absolute name of a given file. Copyright (C) 1996-2006 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; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CANONICALIZE_H_ # define CANONICALIZE_H_ # ifdef PROVIDE_CANONICALIZE_FILENAME_MODE enum canonicalize_mode_t { /* All components must exist. */ CAN_EXISTING = 0, /* All components excluding last one must exist. */ CAN_ALL_BUT_LAST = 1, /* No requirements on components existence. */ CAN_MISSING = 2 }; typedef enum canonicalize_mode_t canonicalize_mode_t; /* Return a malloc'd string containing the canonical absolute name of the named file. This acts like canonicalize_file_name, except that whether components must exist depends on the canonicalize_mode_t argument. */ char *canonicalize_filename_mode (const char *, canonicalize_mode_t); # endif # if HAVE_DECL_CANONICALIZE_FILE_NAME # include # else /* Return a malloc'd string containing the canonical absolute name of the named file. If any file name component does not exist or is a symlink to a nonexistent file, return NULL. A canonical name does not contain any `.', `..' components nor any repeated file name separators ('/') or symlinks. */ char *canonicalize_file_name (const char *); # endif #endif /* !CANONICALIZE_H_ */ blame-1.4-20240206/lib/memcpy.c0000644000000000000000000000227110527555557014257 0ustar rootroot/* Copyright (C) 1995, 1997, 2000, 2003, 2006 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. */ /* Written by Jim Meyering . */ #include #include /* Copy LEN bytes starting at SRCADDR to DESTADDR. Result undefined if the source overlaps with the destination. Return DESTADDR. */ void * memcpy (void *destaddr, void const *srcaddr, size_t len) { char *dest = destaddr; char const *src = srcaddr; while (len-- > 0) *dest++ = *src++; return destaddr; } blame-1.4-20240206/lib/memmove.c0000644000000000000000000000124110527555557014426 0ustar rootroot/* memmove.c -- copy memory. Copy LENGTH bytes from SOURCE to DEST. Does not null-terminate. In the public domain. By David MacKenzie . */ #include #include void * memmove (void *dest0, void const *source0, size_t length) { char *dest = dest0; char const *source = source0; if (source < dest) /* Moving from low mem to hi mem; start at end. */ for (source += length, dest += length; length; --length) *--dest = *--source; else if (source != dest) { /* Moving from hi mem to low mem; start at beginning. */ for (; length; --length) *dest++ = *source++; } return dest0; } blame-1.4-20240206/lib/strpbrk.c0000644000000000000000000000237710527555560014455 0ustar rootroot/* Copyright (C) 1991, 1994, 2000, 2002-2003, 2006 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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. */ #include #include #include #undef strpbrk /* Find the first occurrence in S of any character in ACCEPT. */ char * strpbrk (const char *s, const char *accept) { while (*s != '\0') { const char *a = accept; while (*a != '\0') if (*a++ == *s) return (char *) s; ++s; } return NULL; } blame-1.4-20240206/lib/vsnprintf.h0000644000000000000000000000221310241344124014772 0ustar rootroot/* Formatted output to strings. Copyright (C) 2004 Free Software Foundation, Inc. Written by Simon Josefsson and Yoann Vandoorselaere . 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. */ #ifndef VSNPRINTF_H #define VSNPRINTF_H #include /* Get vsnprintf declaration, if available. */ #include #if defined HAVE_DECL_VSNPRINTF && !HAVE_DECL_VSNPRINTF int vsnprintf (char *str, size_t size, const char *format, va_list args); #endif #endif /* VSNPRINTF_H */ blame-1.4-20240206/lib/getdelim.c0000644000000000000000000000562210527555557014562 0ustar rootroot/* getdelim.c --- Implementation of replacement getdelim function. Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006 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. */ /* Ported from glibc by Simon Josefsson. */ #include #include "getdelim.h" #include #include #include #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif #ifndef SSIZE_MAX # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif #if !HAVE_FLOCKFILE # undef flockfile # define flockfile(x) ((void) 0) #endif #if !HAVE_FUNLOCKFILE # undef funlockfile # define funlockfile(x) ((void) 0) #endif /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and NUL-terminate it). *LINEPTR is a pointer returned from malloc (or NULL), pointing to *N characters of space. It is realloc'ed as necessary. Returns the number of characters read (not including the null terminator), or -1 on error or EOF. */ ssize_t getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp) { ssize_t result; size_t cur_len = 0; if (lineptr == NULL || n == NULL || fp == NULL) { errno = EINVAL; return -1; } flockfile (fp); if (*lineptr == NULL || *n == 0) { *n = 120; *lineptr = (char *) malloc (*n); if (*lineptr == NULL) { result = -1; goto unlock_return; } } for (;;) { int i; i = getc (fp); if (i == EOF) { result = -1; break; } /* Make enough space for len+1 (for final NUL) bytes. */ if (cur_len + 1 >= *n) { size_t needed_max = SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX; size_t needed = 2 * *n + 1; /* Be generous. */ char *new_lineptr; if (needed_max < needed) needed = needed_max; if (cur_len + 1 >= needed) { result = -1; goto unlock_return; } new_lineptr = (char *) realloc (*lineptr, needed); if (new_lineptr == NULL) { result = -1; goto unlock_return; } *lineptr = new_lineptr; *n = needed; } (*lineptr)[cur_len] = i; cur_len++; if (i == delimiter) break; } (*lineptr)[cur_len] = '\0'; result = cur_len ? cur_len : result; unlock_return: funlockfile (fp); return result; } blame-1.4-20240206/lib/xmalloc.c0000644000000000000000000000646210527555560014424 0ustar rootroot/* xmalloc.c -- malloc with out of memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006 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. */ #include #if ! HAVE_INLINE # define static_inline #endif #include "xalloc.h" #undef static_inline #include #include #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif /* 1 if calloc is known to be compatible with GNU calloc. This matters if we are not also using the calloc module, which defines HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ #if defined HAVE_CALLOC || defined __GLIBC__ enum { HAVE_GNU_CALLOC = 1 }; #else enum { HAVE_GNU_CALLOC = 0 }; #endif /* Allocate N bytes of memory dynamically, with error checking. */ void * xmalloc (size_t n) { void *p = malloc (n); if (!p && n != 0) xalloc_die (); return p; } /* Change the size of an allocated block of memory P to N bytes, with error checking. */ void * xrealloc (void *p, size_t n) { p = realloc (p, n); if (!p && n != 0) xalloc_die (); return p; } /* If P is null, allocate a block of at least *PN bytes; otherwise, reallocate P so that it contains more than *PN bytes. *PN must be nonzero unless P is null. Set *PN to the new block's size, and return the pointer to the new block. *PN is never set to zero, and the returned pointer is never null. */ void * x2realloc (void *p, size_t *pn) { return x2nrealloc (p, pn, 1); } /* Allocate S bytes of zeroed memory dynamically, with error checking. There's no need for xnzalloc (N, S), since it would be equivalent to xcalloc (N, S). */ void * xzalloc (size_t s) { return memset (xmalloc (s), 0, s); } /* Allocate zeroed memory for N elements of S bytes, with error checking. S must be nonzero. */ void * xcalloc (size_t n, size_t s) { void *p; /* Test for overflow, since some calloc implementations don't have proper overflow checks. But omit overflow and size-zero tests if HAVE_GNU_CALLOC, since GNU calloc catches overflow and never returns NULL if successful. */ if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s)) || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0))) xalloc_die (); return p; } /* Clone an object P of size S, with error checking. There's no need for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any need for an arithmetic overflow check. */ void * xmemdup (void const *p, size_t s) { return memcpy (xmalloc (s), p, s); } /* Clone STRING. */ char * xstrdup (char const *string) { return xmemdup (string, strlen (string) + 1); } blame-1.4-20240206/lib/getcwd.h0000644000000000000000000000303110337302606014222 0ustar rootroot/* Get the working directory, compatibly with the GNU C Library. Copyright (C) 2004-2005 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. */ /* Written by Paul Eggert. */ /* Include the headers that might declare getcwd so that they will not cause confusion if included after this file. */ #include #include /* If necessary, systematically rename identifiers so that they do not collide with the system function. Renaming avoids problems with some compilers and linkers. */ #ifdef __GETCWD_PREFIX # undef getcwd # define __GETCWD_CONCAT(x, y) x ## y # define __GETCWD_XCONCAT(x, y) __GETCWD_CONCAT (x, y) # define __GETCWD_ID(y) __GETCWD_XCONCAT (__GETCWD_PREFIX, y) # define getcwd __GETCWD_ID (getcwd) /* See the POSIX:2001 specification . */ char *getcwd (char *, size_t); #endif blame-1.4-20240206/lib/cycle-check.h0000644000000000000000000000323010527555557015140 0ustar rootroot/* help detect directory cycles efficiently Copyright (C) 2003, 2004, 2006 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; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Jim Meyering */ #ifndef CYCLE_CHECK_H # define CYCLE_CHECK_H 1 # include # include # include "dev-ino.h" # include "same-inode.h" struct cycle_check_state { struct dev_ino dev_ino; uintmax_t chdir_counter; int magic; }; void cycle_check_init (struct cycle_check_state *state); bool cycle_check (struct cycle_check_state *state, struct stat const *sb); # define CYCLE_CHECK_REFLECT_CHDIR_UP(State, SB_dir, SB_subdir) \ do \ { \ /* You must call cycle_check at least once before using this macro. */ \ if ((State)->chdir_counter == 0) \ abort (); \ if (SAME_INODE ((State)->dev_ino, SB_subdir)) \ { \ (State)->dev_ino.st_dev = (SB_dir).st_dev; \ (State)->dev_ino.st_ino = (SB_dir).st_ino; \ } \ } \ while (0) #endif blame-1.4-20240206/lib/memchr.c0000644000000000000000000001431110527555557014236 0ustar rootroot/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2006 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), with help from Dan Sahlin (dan@sics.se) and commentary by Jim Blandy (jimb@ai.mit.edu); adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), and implemented by Roland McGrath (roland@ai.mit.edu). NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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. */ #ifndef _LIBC # include #endif #include #include #if defined _LIBC # include #else # define reg_char char #endif #include #if HAVE_BP_SYM_H || defined _LIBC # include #else # define BP_SYM(sym) sym #endif #undef memchr #undef __memchr /* Search no more than N bytes of S for C. */ void * __memchr (void const *s, int c_in, size_t n) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; unsigned long int longword, magic_bits, charmask; unsigned reg_char c; int i; c = (unsigned char) c_in; /* Handle the first few characters by reading one character at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ for (char_ptr = (const unsigned char *) s; n > 0 && (size_t) char_ptr % sizeof longword != 0; --n, ++char_ptr) if (*char_ptr == c) return (void *) char_ptr; /* All these elucidatory comments refer to 4-byte longwords, but the theory applies equally well to any size longwords. */ longword_ptr = (const unsigned long int *) char_ptr; /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits the "holes." Note that there is a hole just to the left of each byte, with an extra at the end: bits: 01111110 11111110 11111110 11111111 bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD The 1-bits make sure that carries propagate to the next 0-bit. The 0-bits provide holes for carries to fall into. */ /* Set MAGIC_BITS to be this pattern of 1 and 0 bits. Set CHARMASK to be a longword, each of whose bytes is C. */ magic_bits = 0xfefefefe; charmask = c | (c << 8); charmask |= charmask << 16; #if 0xffffffffU < ULONG_MAX magic_bits |= magic_bits << 32; charmask |= charmask << 32; if (8 < sizeof longword) for (i = 64; i < sizeof longword * 8; i *= 2) { magic_bits |= magic_bits << i; charmask |= charmask << i; } #endif magic_bits = (ULONG_MAX >> 1) & (magic_bits | 1); /* Instead of the traditional loop which tests each character, we will test a longword at a time. The tricky part is testing if *any of the four* bytes in the longword in question are zero. */ while (n >= sizeof longword) { /* We tentatively exit the loop if adding MAGIC_BITS to LONGWORD fails to change any of the hole bits of LONGWORD. 1) Is this safe? Will it catch all the zero bytes? Suppose there is a byte with all zeros. Any carry bits propagating from its left will fall into the hole at its least significant bit and stop. Since there will be no carry from its most significant bit, the LSB of the byte to the left will be unchanged, and the zero will be detected. 2) Is this worthwhile? Will it ignore everything except zero bytes? Suppose every byte of LONGWORD has a bit set somewhere. There will be a carry into bit 8. If bit 8 is set, this will carry into bit 16. If bit 8 is clear, one of bits 9-15 must be set, so there will be a carry into bit 16. Similarly, there will be a carry into bit 24. If one of bits 24-30 is set, there will be a carry into bit 31, so all of the hole bits will be changed. The one misfire occurs when bits 24-30 are clear and bit 31 is set; in this case, the hole at bit 31 is not changed. If we had access to the processor carry flag, we could close this loophole by putting the fourth hole at bit 32! So it ignores everything except 128's, when they're aligned properly. 3) But wait! Aren't we looking for C, not zero? Good point. So what we do is XOR LONGWORD with a longword, each of whose bytes is C. This turns each byte that is C into a zero. */ longword = *longword_ptr++ ^ charmask; /* Add MAGIC_BITS to LONGWORD. */ if ((((longword + magic_bits) /* Set those bits that were unchanged by the addition. */ ^ ~longword) /* Look at only the hole bits. If any of the hole bits are unchanged, most likely one of the bytes was a zero. */ & ~magic_bits) != 0) { /* Which of the bytes was C? If none of them were, it was a misfire; continue the search. */ const unsigned char *cp = (const unsigned char *) (longword_ptr - 1); if (cp[0] == c) return (void *) cp; if (cp[1] == c) return (void *) &cp[1]; if (cp[2] == c) return (void *) &cp[2]; if (cp[3] == c) return (void *) &cp[3]; if (4 < sizeof longword && cp[4] == c) return (void *) &cp[4]; if (5 < sizeof longword && cp[5] == c) return (void *) &cp[5]; if (6 < sizeof longword && cp[6] == c) return (void *) &cp[6]; if (7 < sizeof longword && cp[7] == c) return (void *) &cp[7]; if (8 < sizeof longword) for (i = 8; i < sizeof longword; i++) if (cp[i] == c) return (void *) &cp[i]; } n -= sizeof longword; } char_ptr = (const unsigned char *) longword_ptr; while (n-- > 0) { if (*char_ptr == c) return (void *) char_ptr; else ++char_ptr; } return 0; } #ifdef weak_alias weak_alias (__memchr, BP_SYM (memchr)) #endif blame-1.4-20240206/lib/exitfail.h0000644000000000000000000000150310241344113014545 0ustar rootroot/* Failure exit status Copyright (C) 2002 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; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ extern int volatile exit_failure; blame-1.4-20240206/lib/argp-namefrob.h0000644000000000000000000001275610527555557015523 0ustar rootroot/* Name frobnication for compiling argp outside of glibc Copyright (C) 1997, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ #if !_LIBC /* This code is written for inclusion in gnu-libc, and uses names in the namespace reserved for libc. If we're not compiling in libc, define those names to be the normal ones instead. */ /* argp-parse functions */ #undef __argp_parse #define __argp_parse argp_parse #undef __option_is_end #define __option_is_end _option_is_end #undef __option_is_short #define __option_is_short _option_is_short #undef __argp_input #define __argp_input _argp_input /* argp-help functions */ #undef __argp_help #define __argp_help argp_help #undef __argp_error #define __argp_error argp_error #undef __argp_failure #define __argp_failure argp_failure #undef __argp_state_help #define __argp_state_help argp_state_help #undef __argp_usage #define __argp_usage argp_usage /* argp-fmtstream functions */ #undef __argp_make_fmtstream #define __argp_make_fmtstream argp_make_fmtstream #undef __argp_fmtstream_free #define __argp_fmtstream_free argp_fmtstream_free #undef __argp_fmtstream_putc #define __argp_fmtstream_putc argp_fmtstream_putc #undef __argp_fmtstream_puts #define __argp_fmtstream_puts argp_fmtstream_puts #undef __argp_fmtstream_write #define __argp_fmtstream_write argp_fmtstream_write #undef __argp_fmtstream_printf #define __argp_fmtstream_printf argp_fmtstream_printf #undef __argp_fmtstream_set_lmargin #define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin #undef __argp_fmtstream_set_rmargin #define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin #undef __argp_fmtstream_set_wmargin #define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin #undef __argp_fmtstream_point #define __argp_fmtstream_point argp_fmtstream_point #undef __argp_fmtstream_update #define __argp_fmtstream_update _argp_fmtstream_update #undef __argp_fmtstream_ensure #define __argp_fmtstream_ensure _argp_fmtstream_ensure #undef __argp_fmtstream_lmargin #define __argp_fmtstream_lmargin argp_fmtstream_lmargin #undef __argp_fmtstream_rmargin #define __argp_fmtstream_rmargin argp_fmtstream_rmargin #undef __argp_fmtstream_wmargin #define __argp_fmtstream_wmargin argp_fmtstream_wmargin #include "mempcpy.h" #include "strcase.h" #include "strchrnul.h" #include "strndup.h" /* normal libc functions we call */ #undef __flockfile #define __flockfile flockfile #undef __funlockfile #define __funlockfile funlockfile #undef __mempcpy #define __mempcpy mempcpy #undef __sleep #define __sleep sleep #undef __strcasecmp #define __strcasecmp strcasecmp #undef __strchrnul #define __strchrnul strchrnul #undef __strerror_r #define __strerror_r strerror_r #undef __strndup #define __strndup strndup #undef __vsnprintf #define __vsnprintf vsnprintf #if defined(HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED # define clearerr_unlocked(x) clearerr (x) #endif #if defined(HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED # define feof_unlocked(x) feof (x) # endif #if defined(HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED # define ferror_unlocked(x) ferror (x) # endif #if defined(HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED # define fflush_unlocked(x) fflush (x) # endif #if defined(HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED # define fgets_unlocked(x,y,z) fgets (x,y,z) # endif #if defined(HAVE_DECL_FPUTC_UNLOCKED) && !HAVE_DECL_FPUTC_UNLOCKED # define fputc_unlocked(x,y) fputc (x,y) # endif #if defined(HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED # define fputs_unlocked(x,y) fputs (x,y) # endif #if defined(HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED # define fread_unlocked(w,x,y,z) fread (w,x,y,z) # endif #if defined(HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) # endif #if defined(HAVE_DECL_GETC_UNLOCKED) && !HAVE_DECL_GETC_UNLOCKED # define getc_unlocked(x) getc (x) # endif #if defined(HAVE_DECL_GETCHAR_UNLOCKED) && !HAVE_DECL_GETCHAR_UNLOCKED # define getchar_unlocked() getchar () # endif #if defined(HAVE_DECL_PUTC_UNLOCKED) && !HAVE_DECL_PUTC_UNLOCKED # define putc_unlocked(x,y) putc (x,y) # endif #if defined(HAVE_DECL_PUTCHAR_UNLOCKED) && !HAVE_DECL_PUTCHAR_UNLOCKED # define putchar_unlocked(x) putchar (x) # endif #endif /* !_LIBC */ #ifndef __set_errno #define __set_errno(e) (errno = (e)) #endif #if defined GNULIB_ARGP_DISABLE_DIRNAME # define __argp_base_name(arg) arg #elif defined GNULIB_ARGP_EXTERN_BASENAME extern char *__argp_base_name(const char *arg); #else # include "dirname.h" # define __argp_base_name base_name #endif #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME # define __argp_short_program_name() (program_invocation_short_name) #else extern char *__argp_short_program_name (void); #endif blame-1.4-20240206/lib/strtol.c0000644000000000000000000002546710527555560014322 0ustar rootroot/* Convert string representation of a number into an integer value. Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005, 2006 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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. */ #ifdef _LIBC # define USE_NUMBER_GROUPING #else # include #endif #include #include #ifndef __set_errno # define __set_errno(Val) errno = (Val) #endif #include #include #include #include #ifdef USE_NUMBER_GROUPING # include "../locale/localeinfo.h" #endif /* Nonzero if we are defining `strtoul' or `strtoull', operating on unsigned integers. */ #ifndef UNSIGNED # define UNSIGNED 0 # define INT LONG int #else # define INT unsigned LONG int #endif /* Determine the name. */ #ifdef USE_IN_EXTENDED_LOCALE_MODEL # if UNSIGNED # ifdef USE_WIDE_CHAR # ifdef QUAD # define strtol __wcstoull_l # else # define strtol __wcstoul_l # endif # else # ifdef QUAD # define strtol __strtoull_l # else # define strtol __strtoul_l # endif # endif # else # ifdef USE_WIDE_CHAR # ifdef QUAD # define strtol __wcstoll_l # else # define strtol __wcstol_l # endif # else # ifdef QUAD # define strtol __strtoll_l # else # define strtol __strtol_l # endif # endif # endif #else # if UNSIGNED # ifdef USE_WIDE_CHAR # ifdef QUAD # define strtol wcstoull # else # define strtol wcstoul # endif # else # ifdef QUAD # define strtol strtoull # else # define strtol strtoul # endif # endif # else # ifdef USE_WIDE_CHAR # ifdef QUAD # define strtol wcstoll # else # define strtol wcstol # endif # else # ifdef QUAD # define strtol strtoll # endif # endif # endif #endif /* If QUAD is defined, we are defining `strtoll' or `strtoull', operating on `long long int's. */ #ifdef QUAD # define LONG long long # define STRTOL_LONG_MIN LONG_LONG_MIN # define STRTOL_LONG_MAX LONG_LONG_MAX # define STRTOL_ULONG_MAX ULONG_LONG_MAX /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ /* True if negative values of the signed integer type T use two's complement, ones' complement, or signed magnitude representation, respectively. Much GNU code assumes two's complement, but some people like to be portable to all possible C hosts. */ # define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) # define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) # define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) /* True if the arithmetic type T is signed. */ # define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) /* The maximum and minimum values for the integer type T. These macros have undefined behavior if T is signed and has padding bits. If this is a problem for you, please let us know how to fix it for your host. */ # define TYPE_MINIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) 0 \ : TYPE_SIGNED_MAGNITUDE (t) \ ? ~ (t) 0 \ : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) # define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) -1 \ : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) # ifndef ULONG_LONG_MAX # define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long) # endif # ifndef LONG_LONG_MAX # define LONG_LONG_MAX TYPE_MAXIMUM (long long int) # endif # ifndef LONG_LONG_MIN # define LONG_LONG_MIN TYPE_MINIMUM (long long int) # endif # if __GNUC__ == 2 && __GNUC_MINOR__ < 7 /* Work around gcc bug with using this constant. */ static const unsigned long long int maxquad = ULONG_LONG_MAX; # undef STRTOL_ULONG_MAX # define STRTOL_ULONG_MAX maxquad # endif #else # define LONG long # define STRTOL_LONG_MIN LONG_MIN # define STRTOL_LONG_MAX LONG_MAX # define STRTOL_ULONG_MAX ULONG_MAX #endif /* We use this code also for the extended locale handling where the function gets as an additional argument the locale which has to be used. To access the values we have to redefine the _NL_CURRENT macro. */ #ifdef USE_IN_EXTENDED_LOCALE_MODEL # undef _NL_CURRENT # define _NL_CURRENT(category, item) \ (current->values[_NL_ITEM_INDEX (item)].string) # define LOCALE_PARAM , loc # define LOCALE_PARAM_PROTO , __locale_t loc #else # define LOCALE_PARAM # define LOCALE_PARAM_PROTO #endif #if defined _LIBC || defined HAVE_WCHAR_H # include #endif #ifdef USE_WIDE_CHAR # include # define L_(Ch) L##Ch # define UCHAR_TYPE wint_t # define STRING_TYPE wchar_t # ifdef USE_IN_EXTENDED_LOCALE_MODEL # define ISSPACE(Ch) __iswspace_l ((Ch), loc) # define ISALPHA(Ch) __iswalpha_l ((Ch), loc) # define TOUPPER(Ch) __towupper_l ((Ch), loc) # else # define ISSPACE(Ch) iswspace (Ch) # define ISALPHA(Ch) iswalpha (Ch) # define TOUPPER(Ch) towupper (Ch) # endif #else # define L_(Ch) Ch # define UCHAR_TYPE unsigned char # define STRING_TYPE char # ifdef USE_IN_EXTENDED_LOCALE_MODEL # define ISSPACE(Ch) __isspace_l ((Ch), loc) # define ISALPHA(Ch) __isalpha_l ((Ch), loc) # define TOUPPER(Ch) __toupper_l ((Ch), loc) # else # define ISSPACE(Ch) isspace (Ch) # define ISALPHA(Ch) isalpha (Ch) # define TOUPPER(Ch) toupper (Ch) # endif #endif #define INTERNAL(X) INTERNAL1(X) #define INTERNAL1(X) __##X##_internal #define WEAKNAME(X) WEAKNAME1(X) #ifdef USE_NUMBER_GROUPING /* This file defines a function to check for correct grouping. */ # include "grouping.h" #endif /* Convert NPTR to an `unsigned long int' or `long int' in base BASE. If BASE is 0 the base is determined by the presence of a leading zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal. If BASE is < 2 or > 36, it is reset to 10. If ENDPTR is not NULL, a pointer to the character after the last one converted is stored in *ENDPTR. */ INT INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr, int base, int group LOCALE_PARAM_PROTO) { int negative; register unsigned LONG int cutoff; register unsigned int cutlim; register unsigned LONG int i; register const STRING_TYPE *s; register UCHAR_TYPE c; const STRING_TYPE *save, *end; int overflow; #ifdef USE_NUMBER_GROUPING # ifdef USE_IN_EXTENDED_LOCALE_MODEL struct locale_data *current = loc->__locales[LC_NUMERIC]; # endif /* The thousands character of the current locale. */ wchar_t thousands = L'\0'; /* The numeric grouping specification of the current locale, in the format described in . */ const char *grouping; if (group) { grouping = _NL_CURRENT (LC_NUMERIC, GROUPING); if (*grouping <= 0 || *grouping == CHAR_MAX) grouping = NULL; else { /* Figure out the thousands separator character. */ # if defined _LIBC || defined _HAVE_BTOWC thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)); if (thousands == WEOF) thousands = L'\0'; # endif if (thousands == L'\0') grouping = NULL; } } else grouping = NULL; #endif if (base < 0 || base == 1 || base > 36) { __set_errno (EINVAL); return 0; } save = s = nptr; /* Skip white space. */ while (ISSPACE (*s)) ++s; if (*s == L_('\0')) goto noconv; /* Check for a sign. */ if (*s == L_('-')) { negative = 1; ++s; } else if (*s == L_('+')) { negative = 0; ++s; } else negative = 0; /* Recognize number prefix and if BASE is zero, figure it out ourselves. */ if (*s == L_('0')) { if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X')) { s += 2; base = 16; } else if (base == 0) base = 8; } else if (base == 0) base = 10; /* Save the pointer so we can check later if anything happened. */ save = s; #ifdef USE_NUMBER_GROUPING if (group) { /* Find the end of the digit string and check its grouping. */ end = s; for (c = *end; c != L_('\0'); c = *++end) if ((wchar_t) c != thousands && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9')) && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base)) break; if (*s == thousands) end = s; else end = correctly_grouped_prefix (s, end, thousands, grouping); } else #endif end = NULL; cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base; cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base; overflow = 0; i = 0; for (c = *s; c != L_('\0'); c = *++s) { if (s == end) break; if (c >= L_('0') && c <= L_('9')) c -= L_('0'); else if (ISALPHA (c)) c = TOUPPER (c) - L_('A') + 10; else break; if ((int) c >= base) break; /* Check for overflow. */ if (i > cutoff || (i == cutoff && c > cutlim)) overflow = 1; else { i *= (unsigned LONG int) base; i += c; } } /* Check if anything actually happened. */ if (s == save) goto noconv; /* Store in ENDPTR the address of one character past the last character we converted. */ if (endptr != NULL) *endptr = (STRING_TYPE *) s; #if !UNSIGNED /* Check for a value that is within the range of `unsigned LONG int', but outside the range of `LONG int'. */ if (overflow == 0 && i > (negative ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1 : (unsigned LONG int) STRTOL_LONG_MAX)) overflow = 1; #endif if (overflow) { __set_errno (ERANGE); #if UNSIGNED return STRTOL_ULONG_MAX; #else return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX; #endif } /* Return the result of the appropriate sign. */ return negative ? -i : i; noconv: /* We must handle a special case here: the base is 0 or 16 and the first two characters are '0' and 'x', but the rest are no hexadecimal digits. This is no error case. We return 0 and ENDPTR points to the `x`. */ if (endptr != NULL) { if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X') && save[-2] == L_('0')) *endptr = (STRING_TYPE *) &save[-1]; else /* There was no number to convert. */ *endptr = (STRING_TYPE *) nptr; } return 0L; } /* External user entry point. */ INT #ifdef weak_function weak_function #endif strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr, int base LOCALE_PARAM_PROTO) { return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM); } blame-1.4-20240206/lib/printf-parse.c0000644000000000000000000003035710527555557015405 0ustar rootroot/* Formatted output to strings. Copyright (C) 1999-2000, 2002-2003, 2006 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. */ #include /* Specification. */ #if WIDE_CHAR_VERSION # include "wprintf-parse.h" #else # include "printf-parse.h" #endif /* Get size_t, NULL. */ #include /* Get intmax_t. */ #if HAVE_STDINT_H_WITH_UINTMAX # include #endif #if HAVE_INTTYPES_H_WITH_UINTMAX # include #endif /* malloc(), realloc(), free(). */ #include /* Checked size_t computations. */ #include "xsize.h" #if WIDE_CHAR_VERSION # define PRINTF_PARSE wprintf_parse # define CHAR_T wchar_t # define DIRECTIVE wchar_t_directive # define DIRECTIVES wchar_t_directives #else # define PRINTF_PARSE printf_parse # define CHAR_T char # define DIRECTIVE char_directive # define DIRECTIVES char_directives #endif #ifdef STATIC STATIC #endif int PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) { const CHAR_T *cp = format; /* pointer into format */ size_t arg_posn = 0; /* number of regular arguments consumed */ size_t d_allocated; /* allocated elements of d->dir */ size_t a_allocated; /* allocated elements of a->arg */ size_t max_width_length = 0; size_t max_precision_length = 0; d->count = 0; d_allocated = 1; d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE)); if (d->dir == NULL) /* Out of memory. */ return -1; a->count = 0; a_allocated = 0; a->arg = NULL; #define REGISTER_ARG(_index_,_type_) \ { \ size_t n = (_index_); \ if (n >= a_allocated) \ { \ size_t memory_size; \ argument *memory; \ \ a_allocated = xtimes (a_allocated, 2); \ if (a_allocated <= n) \ a_allocated = xsum (n, 1); \ memory_size = xtimes (a_allocated, sizeof (argument)); \ if (size_overflow_p (memory_size)) \ /* Overflow, would lead to out of memory. */ \ goto error; \ memory = (argument *) (a->arg \ ? realloc (a->arg, memory_size) \ : malloc (memory_size)); \ if (memory == NULL) \ /* Out of memory. */ \ goto error; \ a->arg = memory; \ } \ while (a->count <= n) \ a->arg[a->count++].type = TYPE_NONE; \ if (a->arg[n].type == TYPE_NONE) \ a->arg[n].type = (_type_); \ else if (a->arg[n].type != (_type_)) \ /* Ambiguous type for positional argument. */ \ goto error; \ } while (*cp != '\0') { CHAR_T c = *cp++; if (c == '%') { size_t arg_index = ARG_NONE; DIRECTIVE *dp = &d->dir[d->count];/* pointer to next directive */ /* Initialize the next directive. */ dp->dir_start = cp - 1; dp->flags = 0; dp->width_start = NULL; dp->width_end = NULL; dp->width_arg_index = ARG_NONE; dp->precision_start = NULL; dp->precision_end = NULL; dp->precision_arg_index = ARG_NONE; dp->arg_index = ARG_NONE; /* Test for positional argument. */ if (*cp >= '0' && *cp <= '9') { const CHAR_T *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum (xtimes (n, 10), *np - '0'); if (n == 0) /* Positional argument 0. */ goto error; if (size_overflow_p (n)) /* n too large, would lead to out of memory later. */ goto error; arg_index = n - 1; cp = np + 1; } } /* Read the flags. */ for (;;) { if (*cp == '\'') { dp->flags |= FLAG_GROUP; cp++; } else if (*cp == '-') { dp->flags |= FLAG_LEFT; cp++; } else if (*cp == '+') { dp->flags |= FLAG_SHOWSIGN; cp++; } else if (*cp == ' ') { dp->flags |= FLAG_SPACE; cp++; } else if (*cp == '#') { dp->flags |= FLAG_ALT; cp++; } else if (*cp == '0') { dp->flags |= FLAG_ZERO; cp++; } else break; } /* Parse the field width. */ if (*cp == '*') { dp->width_start = cp; cp++; dp->width_end = cp; if (max_width_length < 1) max_width_length = 1; /* Test for positional argument. */ if (*cp >= '0' && *cp <= '9') { const CHAR_T *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum (xtimes (n, 10), *np - '0'); if (n == 0) /* Positional argument 0. */ goto error; if (size_overflow_p (n)) /* n too large, would lead to out of memory later. */ goto error; dp->width_arg_index = n - 1; cp = np + 1; } } if (dp->width_arg_index == ARG_NONE) { dp->width_arg_index = arg_posn++; if (dp->width_arg_index == ARG_NONE) /* arg_posn wrapped around. */ goto error; } REGISTER_ARG (dp->width_arg_index, TYPE_INT); } else if (*cp >= '0' && *cp <= '9') { size_t width_length; dp->width_start = cp; for (; *cp >= '0' && *cp <= '9'; cp++) ; dp->width_end = cp; width_length = dp->width_end - dp->width_start; if (max_width_length < width_length) max_width_length = width_length; } /* Parse the precision. */ if (*cp == '.') { cp++; if (*cp == '*') { dp->precision_start = cp - 1; cp++; dp->precision_end = cp; if (max_precision_length < 2) max_precision_length = 2; /* Test for positional argument. */ if (*cp >= '0' && *cp <= '9') { const CHAR_T *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum (xtimes (n, 10), *np - '0'); if (n == 0) /* Positional argument 0. */ goto error; if (size_overflow_p (n)) /* n too large, would lead to out of memory later. */ goto error; dp->precision_arg_index = n - 1; cp = np + 1; } } if (dp->precision_arg_index == ARG_NONE) { dp->precision_arg_index = arg_posn++; if (dp->precision_arg_index == ARG_NONE) /* arg_posn wrapped around. */ goto error; } REGISTER_ARG (dp->precision_arg_index, TYPE_INT); } else { size_t precision_length; dp->precision_start = cp - 1; for (; *cp >= '0' && *cp <= '9'; cp++) ; dp->precision_end = cp; precision_length = dp->precision_end - dp->precision_start; if (max_precision_length < precision_length) max_precision_length = precision_length; } } { arg_type type; /* Parse argument type/size specifiers. */ { int flags = 0; for (;;) { if (*cp == 'h') { flags |= (1 << (flags & 1)); cp++; } else if (*cp == 'L') { flags |= 4; cp++; } else if (*cp == 'l') { flags += 8; cp++; } #ifdef HAVE_INTMAX_T else if (*cp == 'j') { if (sizeof (intmax_t) > sizeof (long)) { /* intmax_t = long long */ flags += 16; } else if (sizeof (intmax_t) > sizeof (int)) { /* intmax_t = long */ flags += 8; } cp++; } #endif else if (*cp == 'z' || *cp == 'Z') { /* 'z' is standardized in ISO C 99, but glibc uses 'Z' because the warning facility in gcc-2.95.2 understands only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ if (sizeof (size_t) > sizeof (long)) { /* size_t = long long */ flags += 16; } else if (sizeof (size_t) > sizeof (int)) { /* size_t = long */ flags += 8; } cp++; } else if (*cp == 't') { if (sizeof (ptrdiff_t) > sizeof (long)) { /* ptrdiff_t = long long */ flags += 16; } else if (sizeof (ptrdiff_t) > sizeof (int)) { /* ptrdiff_t = long */ flags += 8; } cp++; } else break; } /* Read the conversion character. */ c = *cp++; switch (c) { case 'd': case 'i': #ifdef HAVE_LONG_LONG_INT /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_LONGLONGINT; else #endif /* If 'long long' exists and is the same as 'long', we parse "lld" into TYPE_LONGINT. */ if (flags >= 8) type = TYPE_LONGINT; else if (flags & 2) type = TYPE_SCHAR; else if (flags & 1) type = TYPE_SHORT; else type = TYPE_INT; break; case 'o': case 'u': case 'x': case 'X': #ifdef HAVE_LONG_LONG_INT /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_ULONGLONGINT; else #endif /* If 'unsigned long long' exists and is the same as 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ if (flags >= 8) type = TYPE_ULONGINT; else if (flags & 2) type = TYPE_UCHAR; else if (flags & 1) type = TYPE_USHORT; else type = TYPE_UINT; break; case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': case 'a': case 'A': #ifdef HAVE_LONG_DOUBLE if (flags >= 16 || (flags & 4)) type = TYPE_LONGDOUBLE; else #endif type = TYPE_DOUBLE; break; case 'c': if (flags >= 8) #ifdef HAVE_WINT_T type = TYPE_WIDE_CHAR; #else goto error; #endif else type = TYPE_CHAR; break; #ifdef HAVE_WINT_T case 'C': type = TYPE_WIDE_CHAR; c = 'c'; break; #endif case 's': if (flags >= 8) #ifdef HAVE_WCHAR_T type = TYPE_WIDE_STRING; #else goto error; #endif else type = TYPE_STRING; break; #ifdef HAVE_WCHAR_T case 'S': type = TYPE_WIDE_STRING; c = 's'; break; #endif case 'p': type = TYPE_POINTER; break; case 'n': #ifdef HAVE_LONG_LONG_INT /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_COUNT_LONGLONGINT_POINTER; else #endif /* If 'long long' exists and is the same as 'long', we parse "lln" into TYPE_COUNT_LONGINT_POINTER. */ if (flags >= 8) type = TYPE_COUNT_LONGINT_POINTER; else if (flags & 2) type = TYPE_COUNT_SCHAR_POINTER; else if (flags & 1) type = TYPE_COUNT_SHORT_POINTER; else type = TYPE_COUNT_INT_POINTER; break; case '%': type = TYPE_NONE; break; default: /* Unknown conversion character. */ goto error; } } if (type != TYPE_NONE) { dp->arg_index = arg_index; if (dp->arg_index == ARG_NONE) { dp->arg_index = arg_posn++; if (dp->arg_index == ARG_NONE) /* arg_posn wrapped around. */ goto error; } REGISTER_ARG (dp->arg_index, type); } dp->conversion = c; dp->dir_end = cp; } d->count++; if (d->count >= d_allocated) { size_t memory_size; DIRECTIVE *memory; d_allocated = xtimes (d_allocated, 2); memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); if (size_overflow_p (memory_size)) /* Overflow, would lead to out of memory. */ goto error; memory = (DIRECTIVE *) realloc (d->dir, memory_size); if (memory == NULL) /* Out of memory. */ goto error; d->dir = memory; } } } d->dir[d->count].dir_start = cp; d->max_width_length = max_width_length; d->max_precision_length = max_precision_length; return 0; error: if (a->arg) free (a->arg); if (d->dir) free (d->dir); return -1; } #undef DIRECTIVES #undef DIRECTIVE #undef CHAR_T #undef PRINTF_PARSE blame-1.4-20240206/lib/mbchar.h0000644000000000000000000003626010527555557014233 0ustar rootroot/* Multibyte character data type. Copyright (C) 2001, 2005-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Bruno Haible . */ /* A multibyte character is a short subsequence of a char* string, representing a single wide character. We use multibyte characters instead of wide characters because of the following goals: 1) correct multibyte handling, i.e. operate according to the LC_CTYPE locale, 2) ease of maintenance, i.e. the maintainer needs not know all details of the ISO C 99 standard, 3) don't fail grossly if the input is not in the encoding set by the locale, because often different encodings are in use in the same countries (ISO-8859-1/UTF-8, EUC-JP/Shift_JIS, ...), 4) fast in the case of ASCII characters, 5) portability, i.e. don't make unportable assumptions about wchar_t. Multibyte characters are only accessed through the mb* macros. mb_ptr (mbc) return a pointer to the beginning of the multibyte sequence. mb_len (mbc) returns the number of bytes occupied by the multibyte sequence. Always > 0. mb_iseq (mbc, sc) returns true if mbc is the standard ASCII character sc. mb_isnul (mbc) returns true if mbc is the nul character. mb_cmp (mbc1, mbc2) returns a positive, zero, or negative value depending on whether mbc1 sorts after, same or before mbc2. mb_casecmp (mbc1, mbc2) returns a positive, zero, or negative value depending on whether mbc1 sorts after, same or before mbc2, modulo upper/lowercase conversion. mb_equal (mbc1, mbc2) returns true if mbc1 and mbc2 are equal. mb_caseequal (mbc1, mbc2) returns true if mbc1 and mbc2 are equal modulo upper/lowercase conversion. mb_isalnum (mbc) returns true if mbc is alphanumeric. mb_isalpha (mbc) returns true if mbc is alphabetic. mb_isascii(mbc) returns true if mbc is plain ASCII. mb_isblank (mbc) returns true if mbc is a blank. mb_iscntrl (mbc) returns true if mbc is a control character. mb_isdigit (mbc) returns true if mbc is a decimal digit. mb_isgraph (mbc) returns true if mbc is a graphic character. mb_islower (mbc) returns true if mbc is lowercase. mb_isprint (mbc) returns true if mbc is a printable character. mb_ispunct (mbc) returns true if mbc is a punctuation character. mb_isspace (mbc) returns true if mbc is a space character. mb_isupper (mbc) returns true if mbc is uppercase. mb_isxdigit (mbc) returns true if mbc is a hexadecimal digit. mb_width (mbc) returns the number of columns on the output device occupied by mbc. Always >= 0. mb_putc (mbc, stream) outputs mbc on stream, a byte oriented FILE stream opened for output. mb_setascii (&mbc, sc) assigns the standard ASCII character sc to mbc. mb_copy (&destmbc, &srcmbc) copies srcmbc to destmbc. Here are the function prototypes of the macros. extern const char * mb_ptr (const mbchar_t mbc); extern size_t mb_len (const mbchar_t mbc); extern bool mb_iseq (const mbchar_t mbc, char sc); extern bool mb_isnul (const mbchar_t mbc); extern int mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2); extern int mb_casecmp (const mbchar_t mbc1, const mbchar_t mbc2); extern bool mb_equal (const mbchar_t mbc1, const mbchar_t mbc2); extern bool mb_caseequal (const mbchar_t mbc1, const mbchar_t mbc2); extern bool mb_isalnum (const mbchar_t mbc); extern bool mb_isalpha (const mbchar_t mbc); extern bool mb_isascii (const mbchar_t mbc); extern bool mb_isblank (const mbchar_t mbc); extern bool mb_iscntrl (const mbchar_t mbc); extern bool mb_isdigit (const mbchar_t mbc); extern bool mb_isgraph (const mbchar_t mbc); extern bool mb_islower (const mbchar_t mbc); extern bool mb_isprint (const mbchar_t mbc); extern bool mb_ispunct (const mbchar_t mbc); extern bool mb_isspace (const mbchar_t mbc); extern bool mb_isupper (const mbchar_t mbc); extern bool mb_isxdigit (const mbchar_t mbc); extern int mb_width (const mbchar_t mbc); extern void mb_putc (const mbchar_t mbc, FILE *stream); extern void mb_setascii (mbchar_t *new, char sc); extern void mb_copy (mbchar_t *new, const mbchar_t *old); */ #ifndef _MBCHAR_H #define _MBCHAR_H 1 #include #include /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.1 has a bug: and must be included before . */ #include #include #include /* BeOS 5 has the functions but no . */ #if HAVE_WCTYPE_H # include #endif /* FreeBSD 4.4 to 4.11 has but lacks the functions. Assume all 12 functions are implemented the same way, or not at all. */ #if !defined iswalnum && !HAVE_ISWCNTRL static inline int iswalnum (wint_t wc) { return (wc >= 0 && wc < 128 ? (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z') : 0); } # define iswalnum iswalnum #endif #if !defined iswalpha && !HAVE_ISWCNTRL static inline int iswalpha (wint_t wc) { return (wc >= 0 && wc < 128 ? (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z' : 0); } # define iswalpha iswalpha #endif #if !defined iswblank && !HAVE_ISWCNTRL static inline int iswblank (wint_t wc) { return (wc >= 0 && wc < 128 ? wc == ' ' || wc == '\t' : 0); } # define iswblank iswblank #endif #if !defined iswcntrl && !HAVE_ISWCNTRL static inline int iswcntrl (wint_t wc) { return (wc >= 0 && wc < 128 ? (wc & ~0x1f) == 0 || wc == 0x7f : 0); } # define iswcntrl iswcntrl #endif #if !defined iswdigit && !HAVE_ISWCNTRL static inline int iswdigit (wint_t wc) { return (wc >= '0' && wc <= '9'); } # define iswdigit iswdigit #endif #if !defined iswgraph && !HAVE_ISWCNTRL static inline int iswgraph (wint_t wc) { return (wc >= 0 && wc < 128 ? wc >= '!' && wc <= '~' : 1); } # define iswgraph iswgraph #endif #if !defined iswlower && !HAVE_ISWCNTRL static inline int iswlower (wint_t wc) { return (wc >= 0 && wc < 128 ? wc >= 'a' && wc <= 'z' : 0); } # define iswlower iswlower #endif #if !defined iswprint && !HAVE_ISWCNTRL static inline int iswprint (wint_t wc) { return (wc >= 0 && wc < 128 ? wc >= ' ' && wc <= '~' : 1); } # define iswprint iswprint #endif #if !defined iswpunct && !HAVE_ISWCNTRL static inline int iswpunct (wint_t wc) { return (wc >= 0 && wc < 128 ? wc >= '!' && wc <= '~' && !((wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')) : 1); } # define iswpunct iswpunct #endif #if !defined iswspace && !HAVE_ISWCNTRL static inline int iswspace (wint_t wc) { return (wc >= 0 && wc < 128 ? wc == ' ' || wc == '\t' || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r' : 0); } # define iswspace iswspace #endif #if !defined iswupper && !HAVE_ISWCNTRL static inline int iswupper (wint_t wc) { return (wc >= 0 && wc < 128 ? wc >= 'A' && wc <= 'Z' : 0); } # define iswupper iswupper #endif #if !defined iswxdigit && !HAVE_ISWCNTRL static inline int iswxdigit (wint_t wc) { return (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'); } # define iswxdigit iswxdigit #endif #include "wcwidth.h" #define MBCHAR_BUF_SIZE 24 struct mbchar { const char *ptr; /* pointer to current character */ size_t bytes; /* number of bytes of current character, > 0 */ bool wc_valid; /* true if wc is a valid wide character */ wchar_t wc; /* if wc_valid: the current character */ char buf[MBCHAR_BUF_SIZE]; /* room for the bytes, used for file input only */ }; /* EOF (not a real character) is represented with bytes = 0 and wc_valid = false. */ typedef struct mbchar mbchar_t; /* Access the current character. */ #define mb_ptr(mbc) ((mbc).ptr) #define mb_len(mbc) ((mbc).bytes) /* Comparison of characters. */ #define mb_iseq(mbc, sc) ((mbc).wc_valid && (mbc).wc == (sc)) #define mb_isnul(mbc) ((mbc).wc_valid && (mbc).wc == 0) #define mb_cmp(mbc1, mbc2) \ ((mbc1).wc_valid \ ? ((mbc2).wc_valid \ ? (int) (mbc1).wc - (int) (mbc2).wc \ : -1) \ : ((mbc2).wc_valid \ ? 1 \ : (mbc1).bytes == (mbc2).bytes \ ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \ : (mbc1).bytes < (mbc2).bytes \ ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \ : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1))) #define mb_casecmp(mbc1, mbc2) \ ((mbc1).wc_valid \ ? ((mbc2).wc_valid \ ? (int) towlower ((mbc1).wc) - (int) towlower ((mbc2).wc) \ : -1) \ : ((mbc2).wc_valid \ ? 1 \ : (mbc1).bytes == (mbc2).bytes \ ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \ : (mbc1).bytes < (mbc2).bytes \ ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \ : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1))) #define mb_equal(mbc1, mbc2) \ ((mbc1).wc_valid && (mbc2).wc_valid \ ? (mbc1).wc == (mbc2).wc \ : (mbc1).bytes == (mbc2).bytes \ && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0) #define mb_caseequal(mbc1, mbc2) \ ((mbc1).wc_valid && (mbc2).wc_valid \ ? towlower ((mbc1).wc) == towlower ((mbc2).wc) \ : (mbc1).bytes == (mbc2).bytes \ && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0) /* , classification. */ #define mb_isascii(mbc) \ ((mbc).wc_valid && (mbc).wc >= 0 && (mbc).wc <= 127) #define mb_isalnum(mbc) ((mbc).wc_valid && iswalnum ((mbc).wc)) #define mb_isalpha(mbc) ((mbc).wc_valid && iswalpha ((mbc).wc)) #define mb_isblank(mbc) ((mbc).wc_valid && iswblank ((mbc).wc)) #define mb_iscntrl(mbc) ((mbc).wc_valid && iswcntrl ((mbc).wc)) #define mb_isdigit(mbc) ((mbc).wc_valid && iswdigit ((mbc).wc)) #define mb_isgraph(mbc) ((mbc).wc_valid && iswgraph ((mbc).wc)) #define mb_islower(mbc) ((mbc).wc_valid && iswlower ((mbc).wc)) #define mb_isprint(mbc) ((mbc).wc_valid && iswprint ((mbc).wc)) #define mb_ispunct(mbc) ((mbc).wc_valid && iswpunct ((mbc).wc)) #define mb_isspace(mbc) ((mbc).wc_valid && iswspace ((mbc).wc)) #define mb_isupper(mbc) ((mbc).wc_valid && iswupper ((mbc).wc)) #define mb_isxdigit(mbc) ((mbc).wc_valid && iswxdigit ((mbc).wc)) /* Extra function. */ /* Unprintable characters appear as a small box of width 1. */ #define MB_UNPRINTABLE_WIDTH 1 static inline int mb_width_aux (wint_t wc) { int w = wcwidth (wc); /* For unprintable characters, arbitrarily return 0 for control characters and MB_UNPRINTABLE_WIDTH otherwise. */ return (w >= 0 ? w : iswcntrl (wc) ? 0 : MB_UNPRINTABLE_WIDTH); } #define mb_width(mbc) \ ((mbc).wc_valid ? mb_width_aux ((mbc).wc) : MB_UNPRINTABLE_WIDTH) /* Output. */ #define mb_putc(mbc, stream) fwrite ((mbc).ptr, 1, (mbc).bytes, (stream)) /* Assignment. */ #define mb_setascii(mbc, sc) \ ((mbc)->ptr = (mbc)->buf, (mbc)->bytes = 1, (mbc)->wc_valid = 1, \ (mbc)->wc = (mbc)->buf[0] = (sc)) /* Copying a character. */ static inline void mb_copy (mbchar_t *new_mbc, const mbchar_t *old_mbc) { if (old_mbc->ptr == &old_mbc->buf[0]) { memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes); new_mbc->ptr = &new_mbc->buf[0]; } else new_mbc->ptr = old_mbc->ptr; new_mbc->bytes = old_mbc->bytes; if ((new_mbc->wc_valid = old_mbc->wc_valid)) new_mbc->wc = old_mbc->wc; } /* is_basic(c) tests whether the single-byte character c is in the ISO C "basic character set". This is a convenience function, and is in this file only to share code between mbiter_multi.h and mbfile_multi.h. */ #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) /* The character set is ISO-646, not EBCDIC. */ # define IS_BASIC_ASCII 1 extern const unsigned int is_basic_table[]; static inline bool is_basic (char c) { return (is_basic_table [(unsigned char) c >> 5] >> ((unsigned char) c & 31)) & 1; } #else static inline bool is_basic (char c) { switch (c) { case '\t': case '\v': case '\f': case ' ': case '!': case '"': case '#': case '%': case '&': case '\'': case '(': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case ':': case ';': case '<': case '=': case '>': case '?': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case '{': case '|': case '}': case '~': return 1; default: return 0; } } #endif #endif /* _MBCHAR_H */ blame-1.4-20240206/lib/argp.h0000644000000000000000000006544014560263077013724 0ustar rootroot/* Hierarchial argument parsing, layered over getopt. Copyright (C) 1995-1999,2003-2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ #ifndef _ARGP_H #define _ARGP_H #include #include #include #include #define __need_error_t #include #ifndef __THROW # define __THROW #endif #ifndef __NTH # define __NTH(fct) fct __THROW #endif #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) # define __format__ format # define __printf__ printf # endif #endif /* GCC 2.95 and later have "__restrict"; C99 compilers have "restrict", and "configure" may have defined "restrict". */ #ifndef __restrict # if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) # if defined restrict || 199901L <= __STDC_VERSION__ # define __restrict restrict # else # define __restrict # endif # endif #endif #ifndef __error_t_defined typedef int error_t; # define __error_t_defined #endif #ifdef __cplusplus extern "C" { #endif /* A description of a particular option. A pointer to an array of these is passed in the OPTIONS field of an argp structure. Each option entry can correspond to one long option and/or one short option; more names for the same option can be added by following an entry in an option array with options having the OPTION_ALIAS flag set. */ struct argp_option { /* The long option name. For more than one name for the same option, you can use following options with the OPTION_ALIAS flag set. */ const char *name; /* What key is returned for this option. If > 0 and printable, then it's also accepted as a short option. */ int key; /* If non-NULL, this is the name of the argument associated with this option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */ const char *arg; /* OPTION_ flags. */ int flags; /* The doc string for this option. If both NAME and KEY are 0, This string will be printed outdented from the normal option column, making it useful as a group header (it will be the first thing printed in its group); in this usage, it's conventional to end the string with a `:'. Write the initial value as N_("TEXT") if you want xgettext to collect it into a POT file. */ const char *doc; /* The group this option is in. In a long help message, options are sorted alphabetically within each group, and the groups presented in the order 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with if this field 0 will inherit the group number of the previous entry, or zero if it's the first one, unless its a group header (NAME and KEY both 0), in which case, the previous entry + 1 is the default. Automagic options such as --help are put into group -1. */ int group; }; /* The argument associated with this option is optional. */ #define OPTION_ARG_OPTIONAL 0x1 /* This option isn't displayed in any help messages. */ #define OPTION_HIDDEN 0x2 /* This option is an alias for the closest previous non-alias option. This means that it will be displayed in the same help entry, and will inherit fields other than NAME and KEY from the aliased option. */ #define OPTION_ALIAS 0x4 /* This option isn't actually an option (and so should be ignored by the actual option parser), but rather an arbitrary piece of documentation that should be displayed in much the same manner as the options. If this flag is set, then the option NAME field is displayed unmodified (e.g., no `--' prefix is added) at the left-margin (where a *short* option would normally be displayed), and the documentation string in the normal place. The NAME field will be translated using gettext, unless OPTION_NO_TRANS is set (see below). For purposes of sorting, any leading whitespace and punctuation is ignored, except that if the first non-whitespace character is not `-', this entry is displayed after all options (and OPTION_DOC entries with a leading `-') in the same group. */ #define OPTION_DOC 0x8 /* This option shouldn't be included in `long' usage messages (but is still included in help messages). This is mainly intended for options that are completely documented in an argp's ARGS_DOC field, in which case including the option in the generic usage list would be redundant. For instance, if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to distinguish these two cases, -x should probably be marked OPTION_NO_USAGE. */ #define OPTION_NO_USAGE 0x10 /* Valid only in conjunction with OPTION_DOC. This option disables translation of option name. */ #define OPTION_NO_TRANS 0x20 struct argp; /* fwd declare this type */ struct argp_state; /* " */ struct argp_child; /* " */ /* The type of a pointer to an argp parsing function. */ typedef error_t (*argp_parser_t) (int key, char *arg, struct argp_state *state); /* What to return for unrecognized keys. For special ARGP_KEY_ keys, such returns will simply be ignored. For user keys, this error will be turned into EINVAL (if the call to argp_parse is such that errors are propagated back to the user instead of exiting); returning EINVAL itself would result in an immediate stop to parsing in *all* cases. */ #define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */ /* Special values for the KEY argument to an argument parsing function. ARGP_ERR_UNKNOWN should be returned if they aren't understood. The sequence of keys to a parsing function is either (where each uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key): INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized The third case is where every parser returned ARGP_KEY_UNKNOWN for an argument, in which case parsing stops at that argument (returning the unparsed arguments to the caller of argp_parse if requested, or stopping with an error message if not). If an error occurs (either detected by argp, or because the parsing function returned an error value), then the parser is called with ARGP_KEY_ERROR, and no further calls are made. */ /* This is not an option at all, but rather a command line argument. If a parser receiving this key returns success, the fact is recorded, and the ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the argument, a parser function decrements the NEXT field of the state it's passed, the option won't be considered processed; this is to allow you to actually modify the argument (perhaps into an option), and have it processed again. */ #define ARGP_KEY_ARG 0 /* There are remaining arguments not parsed by any parser, which may be found starting at (STATE->argv + STATE->next). If success is returned, but STATE->next left untouched, it's assumed that all arguments were consume, otherwise, the parser should adjust STATE->next to reflect any arguments consumed. */ #define ARGP_KEY_ARGS 0x1000006 /* There are no more command line arguments at all. */ #define ARGP_KEY_END 0x1000001 /* Because it's common to want to do some special processing if there aren't any non-option args, user parsers are called with this key if they didn't successfully process any non-option arguments. Called just before ARGP_KEY_END (where more general validity checks on previously parsed arguments can take place). */ #define ARGP_KEY_NO_ARGS 0x1000002 /* Passed in before any parsing is done. Afterwards, the values of each element of the CHILD_INPUT field, if any, in the state structure is copied to each child's state to be the initial value of the INPUT field. */ #define ARGP_KEY_INIT 0x1000003 /* Use after all other keys, including SUCCESS & END. */ #define ARGP_KEY_FINI 0x1000007 /* Passed in when parsing has successfully been completed (even if there are still arguments remaining). */ #define ARGP_KEY_SUCCESS 0x1000004 /* Passed in if an error occurs. */ #define ARGP_KEY_ERROR 0x1000005 /* An argp structure contains a set of options declarations, a function to deal with parsing one, documentation string, a possible vector of child argp's, and perhaps a function to filter help output. When actually parsing options, getopt is called with the union of all the argp structures chained together through their CHILD pointers, with conflicts being resolved in favor of the first occurrence in the chain. */ struct argp { /* An array of argp_option structures, terminated by an entry with both NAME and KEY having a value of 0. */ const struct argp_option *options; /* What to do with an option from this structure. KEY is the key associated with the option, and ARG is any associated argument (NULL if none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then parsing is stopped immediately, and that value is returned from argp_parse(). For special (non-user-supplied) values of KEY, see the ARGP_KEY_ definitions below. */ argp_parser_t parser; /* A string describing what other arguments are wanted by this program. It is only used by argp_usage to print the `Usage:' message. If it contains newlines, the strings separated by them are considered alternative usage patterns, and printed on separate lines (lines after the first are prefix by ` or: ' instead of `Usage:'). */ const char *args_doc; /* If non-NULL, a string containing extra text to be printed before and after the options in a long help message (separated by a vertical tab `\v' character). Write the initial value as N_("BEFORE-TEXT") "\v" N_("AFTER-TEXT") if you want xgettext to collect the two pieces of text into a POT file. */ const char *doc; /* A vector of argp_children structures, terminated by a member with a 0 argp field, pointing to child argps should be parsed with this one. Any conflicts are resolved in favor of this argp, or early argps in the CHILDREN list. This field is useful if you use libraries that supply their own argp structure, which you want to use in conjunction with your own. */ const struct argp_child *children; /* If non-zero, this should be a function to filter the output of help messages. KEY is either a key from an option, in which case TEXT is that option's help text, or a special key from the ARGP_KEY_HELP_ defines, below, describing which other help text TEXT is. The function should return either TEXT, if it should be used as-is, a replacement string, which should be malloced, and will be freed by argp, or NULL, meaning `print nothing'. The value for TEXT is *after* any translation has been done, so if any of the replacement text also needs translation, that should be done by the filter function. INPUT is either the input supplied to argp_parse, or NULL, if argp_help was called directly. */ char *(*help_filter) (int __key, const char *__text, void *__input); /* If non-zero the strings used in the argp library are translated using the domain described by this string. Otherwise the currently installed default domain is used. */ const char *argp_domain; }; /* Possible KEY arguments to a help filter function. */ #define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceding options. */ #define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ #define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ #define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; TEXT is NULL for this key. */ /* Explanatory note emitted when duplicate option arguments have been suppressed. */ #define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005 #define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */ /* When an argp has a non-zero CHILDREN field, it should point to a vector of argp_child structures, each of which describes a subsidiary argp. */ struct argp_child { /* The child parser. */ const struct argp *argp; /* Flags for this child. */ int flags; /* If non-zero, an optional header to be printed in help output before the child options. As a side-effect, a non-zero value forces the child options to be grouped together; to achieve this effect without actually printing a header string, use a value of "". */ const char *header; /* Where to group the child options relative to the other (`consolidated') options in the parent argp; the values are the same as the GROUP field in argp_option structs, but all child-groupings follow parent options at a particular group level. If both this field and HEADER are zero, then they aren't grouped at all, but rather merged with the parent options (merging the child's grouping levels with the parents). */ int group; }; /* Parsing state. This is provided to parsing functions called by argp, which may examine and, as noted, modify fields. */ struct argp_state { /* The top level ARGP being parsed. */ const struct argp *root_argp; /* The argument vector being parsed. May be modified. */ int argc; char **argv; /* The index in ARGV of the next arg that to be parsed. May be modified. */ int next; /* The flags supplied to argp_parse. May be modified. */ unsigned flags; /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the number of the current arg, starting at zero, and incremented after each such call returns. At all other times, this is the number of such arguments that have been processed. */ unsigned arg_num; /* If non-zero, the index in ARGV of the first argument following a special `--' argument (which prevents anything following being interpreted as an option). Only set once argument parsing has proceeded past this point. */ int quoted; /* An arbitrary pointer passed in from the user. */ void *input; /* Values to pass to child parsers. This vector will be the same length as the number of children for the current parser. */ void **child_inputs; /* For the parser's use. Initialized to 0. */ void *hook; /* The name used when printing messages. This is initialized to ARGV[0], or PROGRAM_INVOCATION_NAME if that is unavailable. */ char *name; /* Streams used when argp prints something. */ FILE *err_stream; /* For errors; initialized to stderr. */ FILE *out_stream; /* For information; initialized to stdout. */ void *pstate; /* Private, for use by argp. */ }; /* Flags for argp_parse (note that the defaults are those that are convenient for program command line parsing): */ /* Don't ignore the first element of ARGV. Normally (and always unless ARGP_NO_ERRS is set) the first element of the argument vector is skipped for option parsing purposes, as it corresponds to the program name in a command line. */ #define ARGP_PARSE_ARGV0 0x01 /* Don't print error messages for unknown options to stderr; unless this flag is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program name in the error messages. This flag implies ARGP_NO_EXIT (on the assumption that silent exiting upon errors is bad behaviour). */ #define ARGP_NO_ERRS 0x02 /* Don't parse any non-option args. Normally non-option args are parsed by calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg as the value. Since it's impossible to know which parse function wants to handle it, each one is called in turn, until one returns 0 or an error other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the argp_parse returns prematurely (but with a return value of 0). If all args have been parsed without error, all parsing functions are called one last time with a key of ARGP_KEY_END. This flag needn't normally be set, as the normal behavior is to stop parsing as soon as some argument can't be handled. */ #define ARGP_NO_ARGS 0x04 /* Parse options and arguments in the same order they occur on the command line -- normally they're rearranged so that all options come first. */ #define ARGP_IN_ORDER 0x08 /* Don't provide the standard long option --help, which causes usage and option help information to be output to stdout, and exit (0) called. */ #define ARGP_NO_HELP 0x10 /* Don't exit on errors (they may still result in error messages). */ #define ARGP_NO_EXIT 0x20 /* Use the gnu getopt `long-only' rules for parsing arguments. */ #define ARGP_LONG_ONLY 0x40 /* Turns off any message-printing/exiting options. */ #define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP) /* Parse the options strings in ARGC & ARGV according to the options in ARGP. FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the index in ARGV of the first unparsed option is returned in it. If an unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser routine returned a non-zero value, it is returned; otherwise 0 is returned. This function may also call exit unless the ARGP_NO_HELP flag is set. INPUT is a pointer to a value to be passed in to the parser. */ extern error_t argp_parse (const struct argp *__restrict __argp, int /*argc*/, char **__restrict /*argv*/, unsigned __flags, int *__restrict __arg_index, void *__restrict __input); extern error_t __argp_parse (const struct argp *__restrict __argp, int /*argc*/, char **__restrict /*argv*/, unsigned __flags, int *__restrict __arg_index, void *__restrict __input); /* Global variables. */ /* GNULIB makes sure both program_invocation_name and program_invocation_short_name are available */ #ifdef GNULIB_PROGRAM_INVOCATION_NAME extern char *program_invocation_name; # undef HAVE_DECL_PROGRAM_INVOCATION_NAME # define HAVE_DECL_PROGRAM_INVOCATION_NAME 1 #endif #ifdef GNULIB_PROGRAM_INVOCATION_SHORT_NAME extern char *program_invocation_short_name; # undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME # define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1 #endif /* If defined or set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which will print this string followed by a newline and exit (unless the ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ extern const char *argp_program_version; /* If defined or set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which calls this function with a stream to print the version to and a pointer to the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ extern void (*argp_program_version_hook) (FILE *__restrict __stream, struct argp_state *__restrict __state); /* If defined or set by the user program, it should point to string that is the bug-reporting address for the program. It will be printed by argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help messages), embedded in a sentence that says something like `Report bugs to ADDR.'. */ extern const char *argp_program_bug_address; /* The exit status that argp will use when exiting due to a parsing error. If not defined or set by the user program, this defaults to EX_USAGE from . */ extern error_t argp_err_exit_status; /* Flags for argp_help. */ #define ARGP_HELP_USAGE 0x01 /* a Usage: message. */ #define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */ #define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */ #define ARGP_HELP_LONG 0x08 /* a long help message. */ #define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */ #define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */ #define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC) #define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */ #define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to reflect ARGP_LONG_ONLY mode. */ /* These ARGP_HELP flags are only understood by argp_state_help. */ #define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */ #define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */ /* The standard thing to do after a program command line parsing error, if an error message has already been printed. */ #define ARGP_HELP_STD_ERR \ (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) /* The standard thing to do after a program command line parsing error, if no more specific error message has been printed. */ #define ARGP_HELP_STD_USAGE \ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) /* The standard thing to do in response to a --help option. */ #define ARGP_HELP_STD_HELP \ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \ | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR) /* Output a usage message for ARGP to STREAM. FLAGS are from the set ARGP_HELP_*. */ extern void argp_help (const struct argp *__restrict __argp, FILE *__restrict __stream, unsigned __flags, char *__restrict __name); extern void __argp_help (const struct argp *__restrict __argp, FILE *__restrict __stream, unsigned __flags, char *__name); /* The following routines are intended to be called from within an argp parsing routine (thus taking an argp_state structure as the first argument). They may or may not print an error message and exit, depending on the flags in STATE -- in any case, the caller should be prepared for them *not* to exit, and should return an appropriate error after calling them. [argp_usage & argp_error should probably be called argp_state_..., but they're used often enough that they should be short] */ /* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are from the set ARGP_HELP_*. */ extern void argp_state_help (const struct argp_state *__restrict __state, FILE *__restrict __stream, unsigned int __flags); extern void __argp_state_help (const struct argp_state *__restrict __state, FILE *__restrict __stream, unsigned int __flags); /* Possibly output the standard usage message for ARGP to stderr and exit. */ /* extern void argp_usage (const struct argp_state *__state); */ /* extern void __argp_usage (const struct argp_state *__state); */ /* If appropriate, print the printf string FMT and following args, preceded by the program name and `:', to stderr, and followed by a `Try ... --help' message, then exit (1). */ extern void argp_error (const struct argp_state *__restrict __state, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); extern void __argp_error (const struct argp_state *__restrict __state, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); /* Similar to the standard gnu error-reporting function error(), but will respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print to STATE->err_stream. This is useful for argument parsing code that is shared between program startup (when exiting is desired) and runtime option parsing (when typically an error code is returned instead). The difference between this function and argp_error is that the latter is for *parsing errors*, and the former is for other problems that occur during parsing but don't reflect a (syntactic) problem with the input. */ extern void argp_failure (const struct argp_state *__restrict __state, int __status, int __errnum, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 4, 5))); extern void __argp_failure (const struct argp_state *__restrict __state, int __status, int __errnum, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 4, 5))); # ifndef ARGP_EI # define ARGP_EI static __inline__ # define __ARG_UP /* nothing */ # else # define __ARG_UP __THROW # endif /* Returns true if the option OPT is a valid short option. */ ARGP_EI int _option_is_short (const struct argp_option *__opt) __ARG_UP; #if defined(__USE_EXTERN_INLINES) && !_LIBC /* ARGP_EI int __option_is_short (const struct argp_option *__opt) __ARG_UP; */ #endif /* Returns true if the option OPT is in fact the last (unused) entry in an options array. */ ARGP_EI int _option_is_end (const struct argp_option *__opt) __ARG_UP; #if defined(__USE_EXTERN_INLINES) && !_LIBC /* ARGP_EI int __option_is_end (const struct argp_option *__opt) __ARG_UP; */ #endif /* Return the input field for ARGP in the parser corresponding to STATE; used by the help routines. */ extern void *_argp_input (const struct argp *__restrict __argp, const struct argp_state *__restrict __state) __THROW; extern void *__argp_input (const struct argp *__restrict __argp, const struct argp_state *__restrict __state) __THROW; #ifdef __USE_EXTERN_INLINES # if !_LIBC # define __argp_usage argp_usage # define __argp_state_help argp_state_help # define __option_is_short _option_is_short # define __option_is_end _option_is_end # endif ARGP_EI void __argp_usage (const struct argp_state *__state) { __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); } ARGP_EI int (__option_is_short (const struct argp_option *__opt)) { if (__opt->flags & OPTION_DOC) return 0; else { int __key = __opt->key; return __key > 0 && __key <= UCHAR_MAX && isprint (__key); } } ARGP_EI int (__option_is_end (const struct argp_option *__opt)) { return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; } # if !_LIBC # undef __argp_usage # undef __argp_state_help # undef __option_is_short # undef __option_is_end # endif #endif /* Use extern inlines. */ #ifdef __cplusplus } #endif #endif /* argp.h */ blame-1.4-20240206/lib/unsetenv.c0000644000000000000000000000412110527555560014622 0ustar rootroot/* Copyright (C) 1992,1995-1999,2000-2002,2005-2006 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ #include #include #if !_LIBC # define __set_errno(ev) ((errno) = (ev)) #endif #include #include #include #if !_LIBC # define __environ environ # ifndef HAVE_ENVIRON_DECL extern char **environ; # endif #endif #if _LIBC /* This lock protects against simultaneous modifications of `environ'. */ # include __libc_lock_define_initialized (static, envlock) # define LOCK __libc_lock_lock (envlock) # define UNLOCK __libc_lock_unlock (envlock) #else # define LOCK # define UNLOCK #endif /* In the GNU C library we must keep the namespace clean. */ #ifdef _LIBC # define unsetenv __unsetenv #endif int unsetenv (const char *name) { size_t len; char **ep; if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { __set_errno (EINVAL); return -1; } len = strlen (name); LOCK; ep = __environ; while (*ep != NULL) if (!strncmp (*ep, name, len) && (*ep)[len] == '=') { /* Found it. Remove this pointer by moving later ones back. */ char **dp = ep; do dp[0] = dp[1]; while (*dp++); /* Continue the loop in case NAME appears again. */ } else ++ep; UNLOCK; return 0; } #ifdef _LIBC # undef unsetenv weak_alias (__unsetenv, unsetenv) #endif blame-1.4-20240206/lib/argp-xinl.c0000644000000000000000000000256410337302606014653 0ustar rootroot/* Real definitions for extern inline functions in argp.h Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . 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. */ #ifdef HAVE_CONFIG_H # include #endif #if defined _LIBC || defined HAVE_FEATURES_H # include #endif #ifndef __USE_EXTERN_INLINES # define __USE_EXTERN_INLINES 1 #endif #define ARGP_EI #undef __OPTIMIZE__ #define __OPTIMIZE__ 1 #include "argp.h" /* Add weak aliases. */ #if _LIBC - 0 && defined (weak_alias) weak_alias (__argp_usage, argp_usage) weak_alias (__option_is_short, _option_is_short) weak_alias (__option_is_end, _option_is_end) #endif blame-1.4-20240206/README0000644000000000000000000000351414332413463012717 0ustar rootrootBlame ===== 1. Description -------------- Blame displays the last modification for each line in an RCS file. It is the RCS equivalent of CVS's "annotate" command. An annotated RCS file describes the revision and date in which each line was added to the file and the author of each line. 2. Requirements --------------- To compile Blame you will need a C compiler and standard C library. Once installed, Blame does not have any external dependencies. It uses its own RCS parsing code, so it does not itself require RCS. 3. Installation --------------- In general, the standard $ ./configure $ make # make install will do what you want. You may wish to run "make check" before switching to root. This will run Blame's testsuite, which will test many aspects of the program on your system. 4. Usage -------- A full list of valid command-line options can be viewed using `--help': $ blame --help Blame accepts many of the standard RCS options, such as `-r' (to select a revision): $ blame -r1.123 myfile 5. Getting Help --------------- If Blame doesn't compile on your system please send me the config.log file generated by configure, and a description of which bits don't compile. If you're having trouble running Blame on certain files you might want to try the test suite in the tarball. Simply run make check after compilation. If Blame segfaults and you're feeling adventurous, you can enable full debugging by using the --enable-debug option in configure. This turns on a bunch of assertions -- hopefully this will turn the segfault into an identifiable assertion failure. If you're still stuck, feel free to mail bug reports to . 6. Legal Stuff -------------- Blame is released under the terms and conditions of the GNU General Public License version 2. Please read the COPYING file carefully. blame-1.4-20240206/Makefile.in0000644000000000000000000000126614557765104014121 0ustar rootroot# $Id: Makefile.in,v 1.5 2024/02/04 19:49:24 tom Exp $ # Copyright 2022,2024 Thomas E. Dickey # makefile-template for autoconf @SET_MAKE@ VPATH = @srcdir@ SHELL = @SHELL@ all :: config.h all \ check \ clean \ distclean \ install \ uninstall :: ( cd doc && $(MAKE) $@ ) ( cd lib && $(MAKE) $@ ) ( cd src && $(MAKE) $@ ) ( cd tests && $(MAKE) $@ ) distclean :: -rm -f blame.spec -rm -f *.log *.out distclean :: -rm -f config.h stamp-h1 -rm -f config.status config.cache config.log -rm -f configure.lineno configure.status.lineno -rm -f Makefile .SUFFIXES: .PHONY: all check \ clean \ info install install-data install-exec install-info install-man \ installdirs \ uninstall blame-1.4-20240206/config.h.in0000644000000000000000000002432614560122356014067 0ustar rootroot/* config.h.in. Generated automatically from configure.ac by autoheader. */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define if using `alloca.c'. */ #undef C_ALLOCA /* Define if there is a member named d_ino in the struct describing directory headers. */ #undef D_INO_IN_DIRENT /* Define to 1 to exit quickly without freeing all memory */ #undef FASTEXIT /* Define to noreturn-attribute for gcc */ #undef GCC_NORETURN /* Define to 1 if the compiler supports gcc-like printf attribute. */ #undef GCC_PRINTF /* Define to printf-attribute for gcc */ #undef GCC_PRINTFLIKE /* Define to 1 if the compiler supports gcc-like scanf attribute. */ #undef GCC_SCANF /* Define to sscanf-attribute for gcc */ #undef GCC_SCANFLIKE /* Define to unused-attribute for gcc */ #undef GCC_UNUSED /* Define to 1 to add extern declaration of program_invocation_name to argp.h */ #undef GNULIB_PROGRAM_INVOCATION_NAME /* Define to 1 to add extern declaration of program_invocation_short_name to argp.h */ #undef GNULIB_PROGRAM_INVOCATION_SHORT_NAME /* Define if you have the `alarm' function. */ #undef HAVE_ALARM /* Define to 1 if you have 'alloca' after including , a header that may be supplied by this distribution. */ #undef HAVE_ALLOCA /* Define HAVE_ALLOCA_H for backward compatibility with older code that includes only if HAVE_ALLOCA_H is defined. */ #undef HAVE_ALLOCA_H /* Define if you have the `canonicalize_file_name' function. */ #undef HAVE_CANONICALIZE_FILE_NAME /* Define to 1 if you have the declaration of `canonicalize_file_name', and to 0 if you don't. */ #undef HAVE_DECL_CANONICALIZE_FILE_NAME /* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_CLEARERR_UNLOCKED /* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FEOF_UNLOCKED /* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FERROR_UNLOCKED /* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FFLUSH_UNLOCKED /* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FGETS_UNLOCKED /* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FPUTC_UNLOCKED /* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FPUTS_UNLOCKED /* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FREAD_UNLOCKED /* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FWRITE_UNLOCKED /* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_GETCHAR_UNLOCKED /* Define to 1 if you have the declaration of `getcwd', and to 0 if you don't. */ #undef HAVE_DECL_GETCWD /* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_GETC_UNLOCKED /* Define to 1 if you have the declaration of `getdelim', and to 0 if you don't. */ #undef HAVE_DECL_GETDELIM /* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. */ #undef HAVE_DECL_GETENV /* Define to 1 if you have the declaration of `getline', and to 0 if you don't. */ #undef HAVE_DECL_GETLINE /* Define if program_invocation_name is declared */ #undef HAVE_DECL_PROGRAM_INVOCATION_NAME /* Define if program_invocation_short_name is declared */ #undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_PUTCHAR_UNLOCKED /* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_PUTC_UNLOCKED /* Define if you have the header file. */ #undef HAVE_FEATURES_H /* Define if you have the `flockfile' function. */ #undef HAVE_FLOCKFILE /* Define if you have the `funlockfile' function. */ #undef HAVE_FUNLOCKFILE /* Define if you have the `getdelim' function. */ #undef HAVE_GETDELIM /* Define if you have the header file. */ #undef HAVE_GETOPT_H /* Define if you have the `getopt_long_only' function. */ #undef HAVE_GETOPT_LONG_ONLY /* Define if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if the compiler supports one of the keywords 'inline', '__inline__', '__inline' and effectively inlines functions marked as such. */ #undef HAVE_INLINE /* Define if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if you have the header file. */ #undef HAVE_LANGINFO_H /* Define if you have the header file. */ #undef HAVE_LIBINTL_H /* Define if you have the header file. */ #undef HAVE_LINEWRAP_H /* Define if you have the 'long double' type. */ #undef HAVE_LONG_DOUBLE /* Define if you support file names longer than 14 characters. */ #undef HAVE_LONG_FILE_NAMES /* Define if you have the 'long long' type. */ #undef HAVE_LONG_LONG /* Define to 1 if the system has the type `long long int'. */ #undef HAVE_LONG_LONG_INT /* Define if you have the header file. */ #undef HAVE_MEMORY_H /* Define if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define if you have the `nl_langinfo' function. */ #undef HAVE_NL_LANGINFO /* Define to 1 if getcwd works, except it sometimes fails when it shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT. If __GETCWD_PREFIX is not defined, it doesn't matter whether HAVE_PARTLY_WORKING_GETCWD is defined. */ #undef HAVE_PARTLY_WORKING_GETCWD /* Define if program_invocation_name is defined */ #undef HAVE_PROGRAM_INVOCATION_NAME /* Define if program_invocation_short_name is defined */ #undef HAVE_PROGRAM_INVOCATION_SHORT_NAME /* Define if you have the `resolvepath' function. */ #undef HAVE_RESOLVEPATH /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define if you have the header file. */ #undef HAVE_STDINT_H /* Define if you have the header file. */ #undef HAVE_STDLIB_H /* Define if header is available and working */ #undef HAVE_STDNORETURN_H /* Define if cpp supports the ANSI # stringizing operator. */ #undef HAVE_STRINGIZE /* Define if you have the header file. */ #undef HAVE_STRINGS_H /* Define if you have the header file. */ #undef HAVE_STRING_H /* Define if you have the header file. */ #undef HAVE_SYSEXITS_H /* Define if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if localtime_r, etc. have the type signatures that POSIX requires. */ #undef HAVE_TIME_R_POSIX /* Define if struct tm has the tm_gmtoff member. */ #undef HAVE_TM_GMTOFF /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the 'wchar_t' type. */ #undef HAVE_WCHAR_T /* Define if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Define to 1 to disable assertions */ #undef NDEBUG /* Define to the decimal point constant for use in the `nl_langinfo' function. Do not define if no constant is available. */ #undef NL_LANGINFO_DP /* Define if the C compiler supports function prototypes. */ #undef PROTOTYPES /* Define to 1 to provide canonicalize_filename_mode. */ #undef PROVIDE_CANONICALIZE_FILENAME_MODE /* The size of a `time_t', as computed by sizeof. */ #undef SIZEOF_TIME_T /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if C11 _Noreturn keyword is supported */ #undef STDC_NORETURN /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER /* Define if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Define if on MINIX. */ #undef _MINIX /* Define if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to rpl_ if the getcwd replacement function should be used. */ #undef __GETCWD_PREFIX /* Define to rpl_ if the getopt replacement functions and variables should be used. */ #undef __GETOPT_PREFIX /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to a replacement function name for getline(). */ #undef getline /* Define as `__inline' if that's what the C compiler calls it, or to nothing if it is not supported. */ #undef inline /* Define to `long' if does not define. */ #undef off_t /* Define to `unsigned' if does not define. */ #undef size_t /* Define as a signed type of the same size as size_t. */ #undef ssize_t /* Define to empty if the keyword `volatile' does not work. Warning: valid code using `volatile' can become incorrect without. Disable with care. */ #undef volatile /* Avoid memory leak in argp */ #define GNULIB_ARGP_DISABLE_DIRNAME 1 #if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR # define SUFFIXES "\\,v" # define DIRECTORY_SEPARATOR '\\' # define SSLASH "\\" #else /* ! FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR */ # define SUFFIXES ",v/" # define DIRECTORY_SEPARATOR '/' # define SSLASH "/" #endif /* ! FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR */ blame-1.4-20240206/AUTHORS0000644000000000000000000000013614175250644013111 0ustar rootrootMichael Chapman Thomas E. Dickey blame-1.4-20240206/config.sub0000755000000000000000000010775614543033627014043 0ustar rootroot#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2023 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2023-12-02' # 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 3 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, 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # 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. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # 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. # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -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 1992-2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ | windows-* ) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 basic_os=$field2 ;; zephyr*) basic_machine=$field1-unknown basic_os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | 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 | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 basic_os= ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; convex-c1) basic_machine=c1-convex basic_os=bsd ;; convex-c2) basic_machine=c2-convex basic_os=bsd ;; convex-c32) basic_machine=c32-convex basic_os=bsd ;; convex-c34) basic_machine=c34-convex basic_os=bsd ;; convex-c38) basic_machine=c38-convex basic_os=bsd ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull basic_os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next case $basic_os in openstep*) ;; nextstep*) ;; ns2*) basic_os=nextstep2 ;; *) basic_os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x"$basic_os" != x then # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. obj= case $basic_os in gnu/linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read kernel os <&2 fi ;; *) echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 exit 1 ;; esac case $obj in aout* | coff* | elf* | pe*) ;; '') # empty is fine ;; *) echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 exit 1 ;; esac # Here we handle the constraint that a (synthetic) cpu and os are # valid only in combination with each other and nowhere else. case $cpu-$os in # The "javascript-unknown-ghcjs" triple is used by GHC; we # accept it here in order to tolerate that, but reject any # variations. javascript-ghcjs) ;; javascript-* | *-ghcjs) echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os-$obj in linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ | linux-mlibc*- | linux-musl*- | linux-newlib*- \ | linux-relibc*- | linux-uclibc*- ) ;; uclinux-uclibc*- ) ;; managarm-mlibc*- | managarm-kernel*- ) ;; windows*-msvc*-) ;; -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ | -uclibc*- ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 exit 1 ;; -kernel*- ) echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 exit 1 ;; *-kernel*- ) echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 exit 1 ;; *-msvc*- ) echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 exit 1 ;; kfreebsd*-gnu*- | kopensolaris*-gnu*-) ;; vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) ;; nto-qnx*-) ;; os2-emx-) ;; *-eabi*- | *-gnueabi*-) ;; none--*) # None (no kernel, i.e. freestanding / bare metal), # can be paired with an machine code file format ;; -*-) # Blank kernel with real OS is always fine. ;; --*) # Blank kernel and OS with real machine code file format is always fine. ;; *-*-*) echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-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 ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) 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 ;; esac echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: blame-1.4-20240206/install-sh0000755000000000000000000003577613761220263014061 0ustar rootroot#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # 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. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # 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_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly 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 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. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -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 By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " 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 *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi 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 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac 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 if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 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 problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi 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 # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # 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 # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/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-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # 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 oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && 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=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_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 && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $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` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # 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 "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$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 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: blame-1.4-20240206/ChangeLog0000644000000000000000000004273314560305772013625 0ustar rootroot2024-02-06 Thomas E. Dickey * change version to "1.4", with patch-date * spelling/documentation fixes * support $RCS_DIR for compatibility with cm_tools utilities. * make test-suite run from the build-directory rather than the installed copy of blame. 2024-02-04 Thomas E. Dickey * modify top-level makefile to work around pmake's reordering of rules (report by Robert Clausecker). * fix a build problem with lib/mktime.c on NetBSD i386 (report by Robert Clausecker, patch adapted from Paul Eggert change in 2011 for gnulib). * modify configure script to permit building with 64-bit time_t on 32-bit system. * require standard C, e.g., c89 and later for compiler * reduce stricter compiler warnings 2024-02-01 Thomas E. Dickey * fixes to build/work with MacOS and Solaris 10. 2024-01-30 Thomas E. Dickey * build-fixes to work with c11, c23 * convert m4/getopt.m4 to autoconf-252 * config.guess: update to 2023-12-02 * config.sub: update to 2023-12-27 2022-11-13 Thomas E. Dickey * configure configure.ac aclocal.m4 m4/* lib/*: begin conversion to autoconf-252, addressing problems both in updating the configure script as well as portability of the configure script. * lib/Makefile.in src/Makefile.in: add .c.i rule 2022-11-08 Thomas E. Dickey * README: update contact address * VERSION: add, to put version information in scriptable form. * doc/blame.1: minor cleanup * install-sh: update to 2020-11-14.01 * config.guess: update to 2022-08-01 * config.sub: update to 2022-08-01 * config.rpath: delete/obsolete 2022-01-29 Thomas E. Dickey * .../Makefile.in: rewrite to eliminate automake * .../Makefile.am: delete; some extraneous files such as depcomp are retained but unsupported. 2021-02-07 Thomas E. Dickey * configure: comment-out the change of CFLAGS to use -O3, to reduce breakage in gcc-10's support for inlining. * src/blame.c src/lexer.c: linkage-fixes. * src/system.h: build-fix for standard C * lib/argp-parse.c src/util.c: build-fixes for stricter compiling * m4/mktime.m4, configure: shorten the timeout, which was excessive * blame.spec: remove unused file * lib/argp.h src/blame.c src/date.c: compiler warnings * lib/argp-fmtstream.h, lib/argp.h: apply patch from Debian #778101, Debian #868970 * adapt Debian package-scripts for test-builds. 2020-01-25 Thomas E. Dickey * update config.guess, config.sub 2006-11-23 Michael Chapman * Makefile.am: Use mock, not mockbuild * Released 1.3.1 2006-11-20 Michael Chapman * author.at: Fix test when current username is longer than 8 characters. * Makefile.am: New mockbuild targets -- build against fc4/fc5/fc6. 2006-11-19 Michael Chapman * blame.spec.in: Add disttag. * date.c (undefine, date_parse): Fix warnings. * system.h (SALLOC): Take the string length without the null-terminator. * keyword.c (_keyword_unescape, _keyword_escape): Fix calls to SALLOC. * system.h (SREALLOC): New macro. * rcs.c (_rcs_find_rev): Use it. * config.sub: Added. * Resync with gnulib. base_name now returns a newly malloced string. * configure.ac: Define GNULIB_ARGP_DISABLE_DIRNAME, because argp leaks memory with the new base_name. * util.c (does_working_filename_match_rcs_filename, find_matching_rcs_filename, find_matching_working_filename): Various base_name memory leak cleanups. * atlocal.in: Use special error code for valgrind errors. * testsuite.at (MAC_CHECK_STDERR): Catch valgrind errors. * argv.at, working.at: Remember to check stderr on every failure. 2005-12-02 Michael Chapman * Released 1.3 2005-11-18 Michael Chapman * keyword.c (_keyword_shrink_output, keyword_annotate): Don't explicitly use unlocked IO calls since this is handled by gnulib. * keyword.c (keyword_annotate): Use fputs where possible. * keyword.c (keyword_annotate): Fix handling of @ symbols within $-delimited text ranges. * working.at: New test. * More testdata for new test. * Resync with gnulib. * configure.ac: Remove gl_* calls that are handled by gnulib internally). 2005-06-30 Michael Chapman * keyword.c (_keyword_shrink_output, keyword_annotate): Use unlocked IO. * system.h: Include unlocked-io.h. * branch.at: Spelling fix. * Released 1.2. 2005-06-29 Michael Chapman * blame.c (annotate_revision, annotate, parse_options, main), configure.ac, atlocal.in: Add fastexit support. * blame.c (annotate_revision), date.c (date_sprintf_prefix), keyword.c (keyword_annotate): Malloc less often by outputting on the fly. 2005-06-28 Michael Chapman * src/Makefile.am (AM_LFLAGS): Add -8. * rcs.at: New test. * blame.c (annotate_revision): Rework last-line handling. * Fix last-line handling testdata. * Resync with gnulib. * configure.ac (gl_MODULES): Update list. 2005-06-17 Michael Chapman * author.at: Don't use substring expansion. * Resync with gnulib. * configure.ac (gl_MODULES): Update list. 2004-11-25 Michael Chapman * Released 1.1. 2004-11-24 Michael Chapman * Said GCC 3.4 bugs weren't actually bugs. * Remove function attributes -- they're too dangerous! * blame.spec.in (%build): Run tests after build. 2004-11-23 Michael Chapman * Resync with gnulib... * getopt_.h (__need_getopt, __getopt_argv_const), getopt.m4 (gl_GETOPT): ... and remove local fixes. * tests/blame: Replace ${1+"$@"}, so that Zsh (such as on Mac OS X) works. * keyword.c (keyword_expand): Work around "cast used as lvalue" warning. * hash.c (_hash_entry_new): Remove useless assertion. * Released 1.0. * Rebuild RPM with -mtune=i386 to work around GCC 3.4 bugs. 2004-11-20 Michael Chapman * Resync with gnulib... * getopt_.h (__need_getopt, __getopt_argv_const), getopt.m4 (gl_GETOPT): ... modulo some fixes. * configure.ac (RELEASE): Bump release number. 2004-11-18 Michael Chapman * blame.c (parse_options): Fix ordering of options in --help. 2004-11-14 Michael Chapman * lines.c (lines_apply): Handle a delta text without an empty last line properly. Bug discovered by Bob Proulx . * rcs.at: Check the bug doesn't happen again. * More testdata for new test. 2004-11-11 Michael Chapman * branch.at: Fix duplicated test. * Released 0.3. 2004-11-10 Michael Chapman * argv.at: -V output has changed. * blame.c (parse_options): Store the correct version in rcs_emulation. * date.c (date_parse), keyword.c (_keyword_escape, keyword_expand): Emulate old RCS versions. * rcs.h (_rcs): Comment prefix in RCS files is now used. * log.at, version.at: New tests. * More testdata for new tests. * blame.1: Documentation update. 2004-11-09 Michael Chapman * blame.c: Parse -V[VER] and --version[=VER] (but the result is not used yet). 2004-11-08 Michael Chapman * doc/blame.1: Initial cut of manpage. 2004-11-07 Michael Chapman * blame.c (parse_options, main): Use $RCSINIT environment variable. * rcsinit.at, testsuite.at: New tests. * Resync with gnulib. 2004-10-23 Michael Chapman * blame.c (main): s/TAG/REV/, and make --rev an alias for --revision. 2004-10-22 Michael Chapman * configure.ac (RELEASE): Bump release number. * README: Turn "Known Issues" into "Getting Help" -- it didn't describe any actual known issues... 2004-10-21 Michael Chapman * lexer.l, parser.y: No need for a pure parser. * configure.ac (AC_INIT): Use my Sourceforge email address. * Released 0.2. 2004-10-20 Michael Chapman * configure.ac (gl_MODULES): Update list. * parser.y (deltatext): Move declaration of delta to top of block. * blame.c (annotate), lines.c (lines_append_nocopy), system.h (OINIT, OALLOC, _OALLOC, OFREEALL): Use obstacks to allocate lines. * blame.c (main): Set program_name from argv[0]. 2004-10-19 Michael Chapman * Major reworking of memory management. Profiling showed that most time was spent in redundant memory movement. By mmapping the file into we can form pointers to interesting bits of it, rather than copying the interesting bits in the lexer. Using a private mmap means we can modify it by strategically placing '\0' characters in it. This also means many of the program's data structures no longer need to concern themselves with memory management. * The algorithm to apply deltas has been modified to be far more efficient. The line buffer is memcpy'ed at most once during a single lines_apply call. No memory is malloced or freed at all during the entire annotation run. * configure.ac: Add -fprofile-arcs -ftest-coverage for profiling. * src/Makefile.am (AM_LFLAGS): Add -f. * llist.c, llist.h: Removed. * Globally replace llist with vector. * Scrap vector iterators. * vector.c (vector_insert, vector_insert_nocopy, vector_remove): Functions not used any more (because of dedicated vector handling for line buffers in lines.c). * vector.c (vector_append_nocopy), vector.h (vector_append): New functions. * blame.c (annotate_revision): Always exit function at the bottom. * blame.c (annotate_revision): Copy rev so that it can be modified on the fly. Use pointer comparisons rather than string comparisons wherever possible. * rcs.c (rcs_parse): Mmap the input file and pass the buffer to the lexer. * delta.c, delta.h: Point to locations in mmapped file rather than using duplicates. * delta.h (for_each_branch_base): A delta may not have a branch hash. * lines.c, lines.h: Almost a complete rewrite. Shrink amount to memcpy as much as possible, by reading and writing different line buffers. Text is pointers into mmapped file. * blame.c (annotate_revision): Use spare line buffer, swapping with current buffer after applying each delta. * lexer.l: Rework rules to grab as much as possible per yylex call. * parser.y: Use pointers into mmapped file. * keyword.c (_keyword_append_mem): Handle @@ -> @ conversion here, rather than the lexer. * blame.c (annotate): When extracting a revision from a working file, ensure it is valid. * blame.c (parse_options), data.h, hash.c, hash.h: Make NULL/NULL be no-op dup and free functions; explicitly use string_dup/string_free for the old behaviour. * pairing.at, working.at: New tests. * More testdata for new tests. * Resync with gnulib. 2004-10-08 Michael Chapman * system.h (ALLOCA): New macro. * blame.c (annotate_revision): Make prefix an auto variable. * keyword.c (keyword_extract_revision): Allocate buffer on stack. * lines.c (lines_new): Allocate ll on stack. * Resync with gnulib. * configure.ac (RELEASE): Bump release number. 2004-09-28 Michael Chapman * date.c (date_sprintf), system.h (_UNUSED, _UNUSED_LABEL): Split macros up. * configure.ac (RELEASE): Bump release number. * date.c (date_parse_rev): Handle old RCS files with dates before year 2000. Original patch from Mats Kronberg . 2004-09-27 Michael Chapman * util.c (does_working_filename_match_rcs_filename) (find_matching_rcs_filename, find_matching_working_filename): Use the gnulib-supplied base_name. * rcs.c (rcs_parse): Call canonicalize_file_name and base_name directly. * fs.c, fs.h: Removed -- no longer used. * Released 0.1. 2004-09-26 Michael Chapman * blame.c (main): Change assignments to argp_program_version and argp_program_bug_address to global variable definitions, so that picky linkers don't complain about undefined symbols. * atlocal.in: Replace computing $testdir with an experimental test. This automatically resolves ".", ".." and symlinks all at once. * *.at: Check that stderr is not empty when it shouldn't be. * rev.at, branch.at: New tests. * More testdata for new tests. * blame.c (annotate_revision), date.c (_date_parse_decimal, date_parse_zone, parse_pattern_letter) (date_parse), lines.c (lines_apply), rcs.c (_isidchar, rcs_rev_is_valid, rcs_branch_is_valid), system.h (ISALNUM, ISALPHA, ISDIGIT, ISGRAPH, ISSPACE): Explicitly cast argument to all character classification functions, since they're macros with a subscript lookup on some platforms. * rcs.c (_rcs_get_base, _rcs_find_rev, _rcs_find_rev_before) (rcs_resolve_tag): Move error messages deeper down. 2004-09-25 Michael Chapman * src/Makefile.am [GCC] (AM_CFLAGS): More aggressive warnings. * blame.c (main): Assign parser.options at run-time, since it's value isn't known at compile-time. * blame.c (main), date.c: End all struct initializers properly. * date.c (parse_pattern_letter): Remove assertion that am and pm differ (it generates too much for older CPP implementations). Use AM/PM if the locale doesn't have its own values. * parser.y (rcstext): Cast count to unsigned when comparing. * system.h (UNUSED, PURE, MALLOC, NONNULL, NONNULL_PARAMS): New macros. * delta.h (delta_ref_free): Mark delta with UNUSED. * parser.y (yyerror): Mark rcs with UNUSED. * src/*.h: Mark functions with appropriate attributes. * rcs.c (rcs_resolve_tag): Add zone_offset parameter. Use it when formatting error messages containing dates. * mixed.at: Added expout for tests that should succeed. * date.c (date_sprintf): Handle missing tm_gmtoff member. * date.c (date_sprintf_prefix): UTC time not local time. I think. * m4/langinfo.m4, date.c (_date_parse_decimal): Use RADIXCHAR instead of DECIMAL_POINT, if the latter is not found. * atlocal.in: Make $testdir sed script work on Sparc. * author.at : Build a replacement string for $username that's exactly 8 characters long. 2004-09-24 Michael Chapman * atlocal.in: Normalize $testdir. * parser.y (_parser_count_deltalist, rcstext), rcs.c (rcs_free, _rcs_get_base, _revcmp, _rcs_find_rev_before) (rcs_resolve_tag), rcs.h (rcs_t): Build trunk branches. * argv.at, author.at, date.at, expand.at, rev.at, state.at, suffixes.at, testsuite.at: Copy expected output/errors into expout/experr rather than using M4 macro. * mixed.at: New tests. * tests/atlocal.in, tests/blame, tests/Makefile.am, configure.at (AC_CONFIG_TESTDIR): Provide a way to pass tests through valgrind. * Resync with gnulib. * rcs.c (rcs_resolve_tag): Error if a tag is resolved but the date is too late. * blame.c (parse_options): Error on multiple keyword substitution types. 2004-09-23 Michael Chapman * date.c (_date_parse_decimal): Bugfixes. * argv.at, rev.at, date.at: Extended tests. * date.at, author.at, state.at, expand.at, suffixes.at: New tests. * More testdata for new tests. * configure.ac blame.spec.in: Use NEWS as the AC_SUBST_FILE variable. * configure.ac: Determine directory separator differently. * dirsep.m4: Removed. * blame.c, system.h, util.c: Use different directory separator. * util.c: Fix broken suffix parsing. * keyword.c (keyword_expand): Colon should be output only if both key and value are to be output. 2004-09-22 Michael Chapman * Resync with gnulib. * configure.ac (gl_MODULES): Add getline and setenv. * configure.ac (gl_AC_TYPE_UINTMAX_T): Needed by lib/canonicalize.c. * date.c, lexer.l, system.h, working.c: Add #includes for gnulib headers. * blame.c (program_name): Needed by lib/error.c. * vector.h (vector_t): Use unsigned int rather than u_int32_t. * tests/*, tests/testdata/*: Added test directory. * argv.at, rev.at, date.at: Added tests. 2004-09-21 Michael Chapman * blame.c (annotate_revision): Command-line keyword expansion overrides the RCS file's default. * parser.y (admin_expand): Free $2 after parsing it. * keyword.c (keyword_expand): Add support for Locker keyword. * rcs.c rcs.h (rcs_get_locker): Added. * fs.c (fs_get_short_name): strdup the return value. * Convert ALLOC to CALLOC/MALLOC/SALLOC variants. * Resync with gnulib. * configure.ac (gl_LIB): Now defined by gnulib * configure.ac (AC_SYS_LONG_FILE_NAMES): Needed by lib/same.c 2004-09-20 Michael Chapman * configure.ac, Makefile.am: Use GCC Automake conditional to control whether -Wno-format-y2k is used. * keyword.c (_keyword_append_mem): Preallocate 32 extra bytes at a time. * More comments! 2004-09-19 Michael Chapman * Comments! 2004-09-18 Michael Chapman * ChangeLog, NEWS, rsxs.spec.in: Added. * configure.ac: Use gnulib. 2004-09-04 Michael Chapman * Initial lexer/parser for Blame. blame-1.4-20240206/NEWS0000644000000000000000000000254710531540012012527 0ustar rootroot* Thu Nov 23 2006 Michael Chapman 1.3.1-1 - Gnulib updates. - Rebuilt for fc4/fc5/fc6. * Fri Dec 02 2005 Michael Chapman 1.3-1 - Minor bugfixes. * Thu Jun 30 2005 Michael Chapman 1.2-1 - Minor bugfixes. * Thu Nov 24 2004 Michael Chapman 1.1-1 - Rebuilt. * Thu Nov 24 2004 Michael Chapman 1.0-3 - Said gcc 3.4 bugs weren't actually bugs. * Thu Nov 23 2004 Michael Chapman 1.0-2 - Rebuild RPM with -mtune=i386 to work around gcc 3.4 bugs. * Thu Nov 23 2004 Michael Chapman 1.0-1 - Stable release. * Thu Nov 20 2004 Michael Chapman 0.3-2 - Fixed bug involving delta texts without empty last lines. - Fixed --help output. * Thu Nov 11 2004 Michael Chapman 0.3-1 - Support for $RCSINIT environment variable. - Support for -V and --version to emulate old RCS versions. - Minor bugfixes. - Added manpage. * Thu Oct 21 2004 Michael Chapman 0.2-1 - Major speed improvements. * Tue Sep 28 2004 Michael Chapman 0.1-2 - Fixed build for old Red Hat. * Mon Sep 27 2004 Michael Chapman 0.1-1 - Initial RPM release. blame-1.4-20240206/src/0000755000000000000000000000000014560306717012631 5ustar rootrootblame-1.4-20240206/src/working.c0000644000000000000000000000317214557003772014461 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include /* * Extracts and returns a revision number out of the working file . * Returns NULL on error or if no revision was found. On an error, an error * message is printed. */ char * working_extract_revision(const char *filename) { FILE *stream; char *rev, *line; size_t len; ssize_t read; assert(filename); stream = fopen(filename, "r"); if (!stream) { error(0, errno, "%s", filename); return NULL; } rev = NULL; line = NULL; len = 0; while ( (read = getline(&line, &len, stream)) != -1) if ( (rev = keyword_extract_revision(line, (size_t) read)) ) break; if (line) FREE(line); if (!rev) error(0, 0, "%s: no revision found", filename); if (fclose(stream)) error(0, errno, "%s", filename); return rev; } blame-1.4-20240206/src/keyword.h0000644000000000000000000000256514557463356014507 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004, 2005 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _KEYWORD_H #define _KEYWORD_H #include #include struct rcs; /* * Various types of keyword expansion. EXPAND_BINARY_STING is essentially * synonmyous with EXPAND_OLD_STRING since we're always writing on stdout. */ typedef enum { EXPAND_UNDEFINED, EXPAND_KEY_VALUE, EXPAND_KEY_VALUE_LOCKER, EXPAND_KEY_ONLY, EXPAND_OLD_STRING, EXPAND_BINARY_STRING, EXPAND_VALUE_ONLY } expand_t; char * keyword_extract_revision (const char *, size_t); void keyword_annotate ( const line_t *, const struct rcs *, expand_t, const char *, long ); #endif /* _KEYWORD_H */ blame-1.4-20240206/src/rcs.h0000644000000000000000000001046714557463510013602 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _RCS_H #define _RCS_H #include #include #include #include #include /* * An RCS file. */ typedef struct rcs { char *filename; /* Absolute/relative RCS filename. */ char *full_filename; /* Absolute RCS filename. */ char *short_filename; /* Last component of RCS filename. */ char *start; size_t length; delta_t *head; /* The head revision; NULL if RCS file is empty. */ char *branch; /* The default branch (NULL if RCS file is empty). */ hash_t *branches; /* Branches on the trunk. */ vector_t *access; /* Access list; parsed but not used. */ hash_t *symbols; /* Symbol table. */ hash_t *locks; /* Lock table; parsed but not used. */ int strict; /* Strict locking; parsed but not used. */ const char *comment; /* Comment prefix. */ expand_t expand; /* Default expansion mode. */ hash_t *delta_list; /* Mapping of revision to delta. */ unsigned int lines; } rcs_t; rcs_t * rcs_parse (const char *); void rcs_free (rcs_t *); /* * Returns the filename field in . */ static inline const char * rcs_get_filename(const rcs_t *rcs) { assert(rcs); return rcs->filename; } /* * Returns the full_filename field in . */ static inline const char * rcs_get_full_filename(const rcs_t *rcs) { assert(rcs); return rcs->full_filename; } /* * Returns the short_filename field in . */ static inline const char * rcs_get_short_filename(const rcs_t *rcs) { assert(rcs); return rcs->short_filename; } /* * Returns this RCS file's head revision. */ static inline const delta_t * rcs_get_head(const rcs_t *rcs) { assert(rcs); return rcs->head; } /* * Returns the branch field in . */ static inline const char * rcs_get_branch(const rcs_t *rcs) { assert(rcs); return rcs->branch; } /* * Returns the revision for symbol in , if it exists. */ static inline const char * rcs_get_symbol(const rcs_t *rcs, const char *symbol) { const char **rev; assert(rcs); assert(symbol); rev = (const char **)hash_get(rcs->symbols, symbol); return (rev ? *rev : NULL); } const char * rcs_get_locker (const rcs_t *, const char *); /* * Returns the comment field in . */ static inline const char * rcs_get_comment(const rcs_t *rcs) { assert(rcs); return rcs->comment; } /* * Returns the expand field in . */ static inline expand_t rcs_get_expand(const rcs_t *rcs) { assert(rcs); return rcs->expand; } /* * Returns delta in , if it exists. */ static inline const delta_t * rcs_get_delta(const rcs_t *rcs, const char *rev) { const delta_t **d; assert(rcs); assert(rev); d = (const delta_t **)hash_get(rcs->delta_list, rev); return (d ? *d : NULL); } /* * Returns a new delta template for delta in , * or an existing delta if it already exists. */ static inline delta_t * rcs_get_delta_template(const rcs_t *rcs, const char *rev) { delta_t **d, *delta; assert(rcs); assert(rev); d = (delta_t **)hash_get(rcs->delta_list, rev); if (d) return *d; delta = delta_new_template(rev); hash_insert_nocopy(rcs->delta_list, rev, delta); return delta; } char * rcs_resolve_tag ( const rcs_t *, const char *, time_t, long, const char *, const char * ); int rcs_rev_is_valid (const char *); int rcs_branch_is_valid (const char *); char * rcs_rev_to_branch (const char *); #endif /* _RCS_H */ blame-1.4-20240206/src/vector.c0000644000000000000000000000536710135204066014276 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #define DEFAULT_VECTOR_CAPACITY 50 #include #include /* * Returns a new vector with the specified dup and free functions. */ vector_t * vector_new(dup_fn_t dup_fn, free_fn_t free_fn) { vector_t *vector; vector = MALLOC(1, vector_t); vector->dup_fn = dup_fn; vector->free_fn = free_fn; vector->capacity = DEFAULT_VECTOR_CAPACITY; vector->count = 0; vector->data = MALLOC(vector->capacity, void *); return vector; } /* * Returns a deep duplicate of . */ vector_t * vector_dup(const vector_t *vector) { vector_t *result; unsigned int i; assert(vector); result = MALLOC(1, vector_t); result->dup_fn = vector->dup_fn; result->free_fn = vector->free_fn; result->capacity = vector->capacity; result->count = vector->count; result->data = MALLOC(result->capacity, void *); if (result->dup_fn) for (i = 0; i < result->count; i++) result->data[i] = (result->dup_fn)(vector->data[i]); else memcpy(result->data, vector->data, result->count * sizeof(void *)); return result; } /* * Ensures can contain at least entries. */ void vector_expand(vector_t *vector, unsigned int c) { assert(vector); if (c <= vector->capacity) return; vector->capacity = c; vector->data = REALLOC(vector->data, vector->capacity, void *); } /* * Appends to without duplicating. */ void vector_append_nocopy(vector_t *vector, void *x) { assert(vector); if (vector->count == vector->capacity) vector_expand(vector, 2 * vector->count); vector->data[vector->count] = x; vector->count++; } /* * Deeply frees . */ void vector_free(vector_t *vector) { unsigned int i; assert(vector); if (vector->free_fn) for (i = 0; i < vector->count; i++) (vector->free_fn)(vector->data[i]); FREE(vector->data); FREE(vector); } /* * Frees , but DOES NOT free each entry. Use with caution. */ void vector_free_nofree(vector_t *vector) { assert(vector); FREE(vector->data); FREE(vector); } blame-1.4-20240206/src/parser.c0000644000000000000000000017172314557463400014303 0ustar rootroot/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 1 /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { NUM = 258, ID = 259, SYM = 260, STR = 261, STR_FINAL = 262, HEAD = 263, BRANCH = 264, ACCESS = 265, SYMBOLS = 266, LOCKS = 267, STRICT = 268, COMMENT = 269, EXPAND = 270, DATE = 271, AUTHOR = 272, STATE = 273, BRANCHES = 274, NEXT = 275, DESC = 276, LOG = 277, TEXT = 278 }; #endif /* Tokens. */ #define NUM 258 #define ID 259 #define SYM 260 #define STR 261 #define STR_FINAL 262 #define HEAD 263 #define BRANCH 264 #define ACCESS 265 #define SYMBOLS 266 #define LOCKS 267 #define STRICT 268 #define COMMENT 269 #define EXPAND 270 #define DATE 271 #define AUTHOR 272 #define STATE 273 #define BRANCHES 274 #define NEXT 275 #define DESC 276 #define LOG 277 #define TEXT 278 /* Copy the first part of user declarations. */ #line 1 "parser.y" /* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include extern int yylex (void); static void yyerror (const char *, rcs_t *, char const *); static int _parser_count_deltalist (const rcs_t *, const delta_t *, hash_t *); typedef struct { unsigned int line; off_t off; off_t next; } loc_t; #define YYLTYPE loc_t #define YYLLOC_DEFAULT(Current, Rhs, N) \ ((Current).line = (Rhs)[1].line, \ (Current).off = (Rhs)[1].off, \ (Current).next = (Rhs)[N].next) static unsigned int lines; /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 1 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE #line 43 "parser.y" { char *s; unsigned int i; time_t date; hash_t *hash; vector_t *vector; lines_t *lines; delta_t *delta; struct { delta_t *head; hash_t *branches; } trunk; expand_t expand; } /* Line 193 of yacc.c. */ #line 199 "parser.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; } YYLTYPE; # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #line 224 "parser.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; YYLTYPE yyls; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 82 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 26 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 37 /* YYNRULES -- Number of rules. */ #define YYNRULES 63 /* YYNRULES -- Number of states. */ #define YYNSTATES 108 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 278 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 25, 24, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 4, 5, 20, 24, 27, 28, 32, 35, 39, 43, 47, 48, 51, 52, 56, 59, 60, 64, 67, 68, 71, 79, 83, 87, 91, 94, 98, 101, 105, 108, 111, 112, 115, 116, 122, 126, 127, 130, 134, 135, 138, 139, 142, 144, 147, 148, 153, 154, 159, 160, 164, 165, 168, 170, 172, 174, 176, 178, 180, 183, 184 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 27, 0, -1, -1, -1, 28, 30, 31, 32, 33, 34, 35, 36, 37, 57, 38, 29, 45, 46, -1, 8, 3, 24, -1, 8, 24, -1, -1, 9, 3, 24, -1, 9, 24, -1, 10, 53, 24, -1, 11, 56, 24, -1, 12, 55, 24, -1, -1, 13, 24, -1, -1, 14, 7, 24, -1, 14, 24, -1, -1, 15, 7, 24, -1, 15, 24, -1, -1, 38, 39, -1, 3, 40, 41, 42, 43, 44, 57, -1, 16, 3, 24, -1, 17, 60, 24, -1, 18, 60, 24, -1, 18, 24, -1, 19, 54, 24, -1, 19, 24, -1, 20, 3, 24, -1, 20, 24, -1, 21, 61, -1, -1, 46, 47, -1, -1, 3, 48, 49, 57, 51, -1, 22, 50, 7, -1, -1, 50, 6, -1, 23, 52, 7, -1, -1, 52, 6, -1, -1, 53, 60, -1, 3, -1, 54, 3, -1, -1, 55, 60, 25, 3, -1, -1, 56, 5, 25, 3, -1, -1, 60, 58, 24, -1, -1, 58, 59, -1, 4, -1, 3, -1, 61, -1, 25, -1, 4, -1, 5, -1, 62, 7, -1, -1, 62, 6, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 101, 101, 117, 101, 159, 160, 164, 165, 166, 170, 174, 178, 182, 183, 187, 188, 189, 193, 194, 212, 215, 217, 221, 241, 253, 257, 258, 262, 263, 267, 272, 276, 279, 281, 285, 285, 303, 312, 313, 317, 325, 326, 333, 334, 338, 347, 362, 365, 373, 374, 384, 386, 389, 391, 395, 396, 397, 398, 402, 403, 407, 410, 412 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "NUM", "ID", "SYM", "STR", "STR_FINAL", "HEAD", "BRANCH", "ACCESS", "SYMBOLS", "LOCKS", "STRICT", "COMMENT", "EXPAND", "DATE", "AUTHOR", "STATE", "BRANCHES", "NEXT", "DESC", "LOG", "TEXT", "';'", "':'", "$accept", "rcstext", "@1", "@2", "admin_head", "admin_branch", "admin_access", "admin_symbols", "admin_locks", "admin_strict", "admin_comment", "admin_expand", "delta_list", "delta", "delta_date", "delta_author", "delta_state", "delta_branches", "delta_next", "desc", "deltatext_list", "deltatext", "@3", "deltatext_log", "deltatext_log_bit", "deltatext_text", "deltatext_text_string", "id_list", "num_list", "id_num_list", "sym_num_list", "newphrase_list", "word_list", "word", "id_or_sym", "gobble_string", "gobble_string_bit", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 59, 58 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 26, 28, 29, 27, 30, 30, 31, 31, 31, 32, 33, 34, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 39, 40, 41, 42, 42, 43, 43, 44, 44, 45, 46, 46, 48, 47, 49, 50, 50, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 59, 59, 60, 60, 61, 62, 62 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 0, 14, 3, 2, 0, 3, 2, 3, 3, 3, 0, 2, 0, 3, 2, 0, 3, 2, 0, 2, 7, 3, 3, 3, 2, 3, 2, 3, 2, 2, 0, 2, 0, 5, 3, 0, 2, 3, 0, 2, 0, 2, 1, 2, 0, 4, 0, 4, 0, 3, 0, 2, 1, 1, 1, 1, 1, 1, 2, 0, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 2, 0, 0, 1, 0, 7, 0, 6, 0, 0, 5, 0, 9, 43, 0, 8, 0, 49, 0, 59, 60, 10, 44, 0, 47, 13, 0, 11, 0, 0, 15, 0, 12, 0, 14, 0, 18, 50, 0, 0, 17, 0, 51, 48, 16, 0, 20, 21, 53, 19, 3, 62, 0, 0, 22, 56, 55, 52, 58, 54, 57, 0, 0, 0, 62, 33, 63, 61, 0, 0, 0, 32, 4, 24, 0, 0, 0, 35, 34, 25, 27, 0, 0, 0, 0, 26, 45, 29, 0, 0, 51, 38, 51, 46, 28, 0, 31, 23, 0, 0, 30, 39, 37, 41, 36, 0, 42, 40 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 1, 2, 53, 5, 9, 14, 18, 25, 30, 36, 42, 50, 54, 63, 70, 76, 83, 90, 65, 72, 78, 84, 92, 98, 104, 105, 16, 88, 28, 23, 47, 51, 59, 48, 60, 61 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -73 static const yytype_int8 yypact[] = { -73, 8, 13, -73, 0, 34, 20, -73, 1, 36, -73, 21, -73, -73, 37, -73, 5, -73, 38, -73, -73, -73, -73, 6, -73, 39, 22, -73, 9, 25, 40, 48, -73, 30, -73, 10, 41, -73, 54, 42, -73, 12, 27, -73, -73, 43, -73, -73, -73, -73, 55, -2, 44, 47, -73, -73, -73, -73, -73, -73, -73, 31, 58, 45, -73, -73, -73, -73, 46, 27, 51, -73, 60, -73, 49, 11, 52, -73, -73, -73, -73, 50, 2, 56, 53, -73, -73, -73, 3, 4, 27, -73, 27, -73, -73, 57, -73, -73, 33, 59, -73, -73, -73, -73, -73, 35, -73, -73 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -72, -73, -73, -16, 14, -73 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 22, 55, 56, 6, 11, 86, 93, 95, 3, 19, 20, 26, 33, 19, 20, 19, 20, 39, 97, 45, 99, 4, 57, 58, 7, 12, 87, 94, 96, 21, 27, 19, 20, 32, 40, 80, 46, 66, 67, 101, 102, 106, 107, 8, 10, 15, 13, 31, 17, 34, 24, 37, 29, 74, 35, 38, 41, 43, 52, 81, 62, 68, 69, 77, 0, 0, 44, 49, 64, 75, 73, 82, 0, 79, 85, 91, 89, 0, 71, 0, 0, 100, 103 }; static const yytype_int8 yycheck[] = { 16, 3, 4, 3, 3, 3, 3, 3, 0, 4, 5, 5, 28, 4, 5, 4, 5, 7, 90, 7, 92, 8, 24, 25, 24, 24, 24, 24, 24, 24, 24, 4, 5, 24, 24, 24, 24, 6, 7, 6, 7, 6, 7, 9, 24, 24, 10, 25, 11, 24, 12, 3, 13, 69, 14, 25, 15, 3, 3, 75, 16, 3, 17, 3, -1, -1, 24, 24, 21, 18, 24, 19, -1, 24, 24, 22, 20, -1, 64, -1, -1, 24, 23 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 27, 28, 0, 8, 30, 3, 24, 9, 31, 24, 3, 24, 10, 32, 24, 53, 11, 33, 4, 5, 24, 60, 56, 12, 34, 5, 24, 55, 13, 35, 25, 24, 60, 24, 14, 36, 3, 25, 7, 24, 15, 37, 3, 24, 7, 24, 57, 60, 24, 38, 58, 3, 29, 39, 3, 4, 24, 25, 59, 61, 62, 16, 40, 21, 45, 6, 7, 3, 17, 41, 61, 46, 24, 60, 18, 42, 3, 47, 24, 24, 60, 19, 43, 48, 24, 3, 24, 54, 20, 44, 22, 49, 3, 24, 3, 24, 57, 50, 57, 24, 6, 7, 23, 51, 52, 6, 7 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (filename, rcs, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value, Location, filename, rcs); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, const char *filename, rcs_t *rcs) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, filename, rcs) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; YYLTYPE const * const yylocationp; const char *filename; rcs_t *rcs; #endif { if (!yyvaluep) return; YYUSE (yylocationp); YYUSE (filename); YYUSE (rcs); # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, const char *filename, rcs_t *rcs) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, filename, rcs) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; YYLTYPE const * const yylocationp; const char *filename; rcs_t *rcs; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); YY_LOCATION_PRINT (yyoutput, *yylocationp); YYFPRINTF (yyoutput, ": "); yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, filename, rcs); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, const char *filename, rcs_t *rcs) #else static void yy_reduce_print (yyvsp, yylsp, yyrule, filename, rcs) YYSTYPE *yyvsp; YYLTYPE *yylsp; int yyrule; const char *filename; rcs_t *rcs; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) , filename, rcs); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, yylsp, Rule, filename, rcs); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, const char *filename, rcs_t *rcs) #else static void yydestruct (yymsg, yytype, yyvaluep, yylocationp, filename, rcs) const char *yymsg; int yytype; YYSTYPE *yyvaluep; YYLTYPE *yylocationp; const char *filename; rcs_t *rcs; #endif { YYUSE (yyvaluep); YYUSE (yylocationp); YYUSE (filename); YYUSE (rcs); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (const char *filename, rcs_t *rcs); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /* Location data for the look-ahead symbol. */ YYLTYPE yylloc; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (const char *filename, rcs_t *rcs) #else int yyparse (filename, rcs) const char *filename; rcs_t *rcs; #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; /* The locations where the error started and ended. */ YYLTYPE yyerror_range[2]; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; yylsp = yyls; #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 0; #endif goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = (yytype_int16) yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; YYLTYPE *yyls1 = yyls; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); yyls = yyls1; yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); YYSTACK_RELOCATE (yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; yylsp = yyls + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; *++yylsp = yylloc; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: #line 101 "parser.y" { yylloc.line = 1; yylloc.off = yylloc.next = 0; lines = 0; rcs->delta_list = hash_new((dup_fn_t)delta_dup, (free_fn_t)delta_free); } break; case 3: #line 117 "parser.y" { if ((yyvsp[(2) - (11)].s)) { int count; (yyval.trunk).head = (delta_t *)rcs_get_delta(rcs, (yyvsp[(2) - (11)].s)); if (!(yyval.trunk).head) { yyerror(filename, rcs, "head revision is missing"); YYERROR; } (yyval.trunk).branches = hash_new(NULL, NULL); count = _parser_count_deltalist(rcs, (yyval.trunk).head, (yyval.trunk).branches); if (count < 0) { yyerror(filename, rcs, "delta tree is malformed"); YYERROR; } if ((unsigned)count != hash_count(rcs->delta_list)) { yyerror(filename, rcs, "unreachable deltas exist"); YYERROR; } } else { (yyval.trunk).head = NULL; (yyval.trunk).branches = NULL; } } break; case 4: #line 144 "parser.y" { rcs->head = (yyvsp[(12) - (14)].trunk).head; rcs->branch = ((yyvsp[(3) - (14)].s) ? strdup((yyvsp[(3) - (14)].s)) : ((yyvsp[(2) - (14)].s) ? rcs_rev_to_branch((yyvsp[(2) - (14)].s)) : NULL)); rcs->branches = (yyvsp[(12) - (14)].trunk).branches; rcs->access = (yyvsp[(4) - (14)].vector); rcs->symbols = (yyvsp[(5) - (14)].hash); rcs->locks = (yyvsp[(6) - (14)].hash); rcs->strict = (int) (yyvsp[(7) - (14)].i); rcs->comment = (yyvsp[(8) - (14)].s); rcs->expand = (yyvsp[(9) - (14)].expand); rcs->lines = lines; } break; case 5: #line 159 "parser.y" { (yyval.s) = rcs->start + (yylsp[(2) - (3)]).off; *((yyval.s) + (yyvsp[(2) - (3)].i)) = '\0'; } break; case 6: #line 160 "parser.y" { (yyval.s) = NULL; } break; case 7: #line 164 "parser.y" { (yyval.s) = NULL; } break; case 8: #line 165 "parser.y" { (yyval.s) = rcs->start + (yylsp[(2) - (3)]).off; *((yyval.s) + (yyvsp[(2) - (3)].i)) = '\0'; } break; case 9: #line 166 "parser.y" { (yyval.s) = NULL; } break; case 10: #line 170 "parser.y" { (yyval.vector) = (yyvsp[(2) - (3)].vector); } break; case 11: #line 174 "parser.y" { (yyval.hash) = (yyvsp[(2) - (3)].hash); } break; case 12: #line 178 "parser.y" { (yyval.hash) = (yyvsp[(2) - (3)].hash); } break; case 13: #line 182 "parser.y" { (yyval.i) = 0; } break; case 14: #line 183 "parser.y" { (yyval.i) = 1; } break; case 15: #line 187 "parser.y" { (yyval.s) = NULL; } break; case 16: #line 188 "parser.y" { (yyval.s) = rcs->start + (yylsp[(2) - (3)]).off; *((yyval.s) + (yyvsp[(2) - (3)].i)) = '\0'; } break; case 17: #line 189 "parser.y" { (yyval.s) = NULL; } break; case 18: #line 193 "parser.y" { (yyval.expand) = EXPAND_UNDEFINED; } break; case 19: #line 194 "parser.y" { if (!strncmp(rcs->start + (yylsp[(2) - (3)]).off, "kv", (yyvsp[(2) - (3)].i))) (yyval.expand) = EXPAND_KEY_VALUE; else if (!strncmp(rcs->start + (yylsp[(2) - (3)]).off, "kvl", (yyvsp[(2) - (3)].i))) (yyval.expand) = EXPAND_KEY_VALUE_LOCKER; else if (!strncmp(rcs->start + (yylsp[(2) - (3)]).off, "k", (yyvsp[(2) - (3)].i))) (yyval.expand) = EXPAND_KEY_ONLY; else if (!strncmp(rcs->start + (yylsp[(2) - (3)]).off, "o", (yyvsp[(2) - (3)].i))) (yyval.expand) = EXPAND_OLD_STRING; else if (!strncmp(rcs->start + (yylsp[(2) - (3)]).off, "b", (yyvsp[(2) - (3)].i))) (yyval.expand) = EXPAND_BINARY_STRING; else if (!strncmp(rcs->start + (yylsp[(2) - (3)]).off, "v", (yyvsp[(2) - (3)].i))) (yyval.expand) = EXPAND_VALUE_ONLY; else { yyerror(filename, rcs, "invalid keyword expansion type"); YYERROR; } } break; case 20: #line 212 "parser.y" { (yyval.expand) = EXPAND_UNDEFINED; } break; case 23: #line 228 "parser.y" { char *num = rcs->start + (yylsp[(1) - (7)]).off; *(num + (yyvsp[(1) - (7)].i)) = '\0'; (yyval.delta) = rcs_get_delta_template(rcs, num); if (!delta_is_template((yyval.delta))) { yyerror(filename, rcs, "delta is multiply defined"); YYERROR; } delta_complete_template_nocopy((yyval.delta), (yyvsp[(2) - (7)].date), (yyvsp[(3) - (7)].s), (yyvsp[(4) - (7)].s), (yyvsp[(5) - (7)].hash), (yyvsp[(6) - (7)].delta)); } break; case 24: #line 241 "parser.y" { char *num = rcs->start + (yylsp[(2) - (3)]).off; *(num + (yyvsp[(2) - (3)].i)) = '\0'; (yyval.date) = date_parse_rev(num); if ((yyval.date) < 0) { yyerror(filename, rcs, "invalid date"); YYERROR; } } break; case 25: #line 253 "parser.y" { (yyval.s) = (yyvsp[(2) - (3)].s); } break; case 26: #line 257 "parser.y" { (yyval.s) = (yyvsp[(2) - (3)].s); } break; case 27: #line 258 "parser.y" { (yyval.s) = NULL; } break; case 28: #line 262 "parser.y" { (yyval.hash) = (yyvsp[(2) - (3)].hash); } break; case 29: #line 263 "parser.y" { (yyval.hash) = NULL; } break; case 30: #line 267 "parser.y" { char *num = rcs->start + (yylsp[(2) - (3)]).off; *(num + (yyvsp[(2) - (3)].i)) = '\0'; (yyval.delta) = rcs_get_delta_template(rcs, num); } break; case 31: #line 272 "parser.y" { (yyval.delta) = NULL; } break; case 35: #line 285 "parser.y" { const delta_t *delta; char *num = rcs->start + (yylsp[(1) - (1)]).off; *(num + (yyvsp[(1) - (1)].i)) = '\0'; delta = rcs_get_delta(rcs, num); if (delta && !delta_is_template(delta)) (yyval.delta) = (delta_t *)delta; else { yyerror(filename, rcs, "invalid delta revision"); YYERROR; } } break; case 36: #line 299 "parser.y" { delta_complete_text_nocopy((yyvsp[(2) - (5)].delta), (yyvsp[(3) - (5)].s), (yyvsp[(5) - (5)].lines)); } break; case 37: #line 303 "parser.y" { /* Sigh... Can't rely on @2 because the empty rule below * screws up the location stack. */ rcs->start[(yylsp[(3) - (3)]).off + (yyvsp[(3) - (3)].i)] = '\0'; (yyval.s) = rcs->start + (yylsp[(3) - (3)]).off - (yyvsp[(2) - (3)].i); } break; case 38: #line 312 "parser.y" { (yyval.i) = 0; } break; case 39: #line 313 "parser.y" { (yyval.i) = (yyvsp[(1) - (2)].i) + (yyvsp[(2) - (2)].i); } break; case 40: #line 317 "parser.y" { (yyval.lines) = (yyvsp[(2) - (3)].lines); lines_append_nocopy((yyval.lines), rcs->start + (yylsp[(3) - (3)]).off, (yyvsp[(3) - (3)].i)); lines++; } break; case 41: #line 325 "parser.y" { (yyval.lines) = lines_new(); } break; case 42: #line 326 "parser.y" { lines_append_nocopy((yyval.lines), rcs->start + (yylsp[(2) - (2)]).off, (yyvsp[(2) - (2)].i)); lines++; } break; case 43: #line 333 "parser.y" { (yyval.vector) = vector_new(NULL, NULL); } break; case 44: #line 334 "parser.y" { vector_append_nocopy((yyval.vector), (yyvsp[(2) - (2)].s)); } break; case 45: #line 338 "parser.y" { char *branch, *num; (yyval.hash) = hash_new(NULL, NULL); num = rcs->start + (yylsp[(1) - (1)]).off; *(num + (yyvsp[(1) - (1)].i)) = '\0'; branch = rcs_rev_to_branch(num); hash_insert_nocopy((yyval.hash), branch, rcs_get_delta_template(rcs, num)); FREE(branch); } break; case 46: #line 347 "parser.y" { char *branch, *num; num = rcs->start + (yylsp[(2) - (2)]).off; *(num + (yyvsp[(2) - (2)].i)) = '\0'; if (!rcs_rev_is_valid(num)) { yyerror(filename, rcs, "branch revision is malformed"); YYERROR; } branch = rcs_rev_to_branch(num); hash_insert_nocopy((yyval.hash), branch, rcs_get_delta_template(rcs, num)); FREE(branch); } break; case 47: #line 362 "parser.y" { (yyval.hash) = hash_new(NULL, NULL); } break; case 48: #line 365 "parser.y" { char *num = rcs->start + (yylsp[(4) - (4)]).off; *(num + (yyvsp[(4) - (4)].i)) = '\0'; hash_insert_nocopy((yyval.hash), (yyvsp[(2) - (4)].s), rcs_get_delta_template(rcs, num)); } break; case 49: #line 373 "parser.y" { (yyval.hash) = hash_new(NULL, NULL); } break; case 50: #line 374 "parser.y" { char *sym, *num; sym = rcs->start + (yylsp[(2) - (4)]).off; *(sym + (yyvsp[(2) - (4)].i)) = '\0'; num = rcs->start + (yylsp[(4) - (4)]).off; *(num + (yyvsp[(4) - (4)].i)) = '\0'; hash_insert_nocopy((yyval.hash), sym, num); } break; case 59: #line 402 "parser.y" { (yyval.s) = rcs->start + (yylsp[(1) - (1)]).off; *((yyval.s) + (yyvsp[(1) - (1)].i)) = '\0'; } break; case 60: #line 403 "parser.y" { (yyval.s) = rcs->start + (yylsp[(1) - (1)]).off; *((yyval.s) + (yyvsp[(1) - (1)].i)) = '\0'; } break; /* Line 1267 of yacc.c. */ #line 1911 "parser.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; *++yylsp = yyloc; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (filename, rcs, YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (filename, rcs, yymsg); } else { yyerror (filename, rcs, YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } yyerror_range[0] = yylloc; if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval, &yylloc, filename, rcs); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; yyerror_range[0] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yyerror_range[0] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, filename, rcs); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of the look-ahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (filename, rcs, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, filename, rcs); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp, yylsp, filename, rcs); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } #line 415 "parser.y" static void yyerror( const char *filename, __attribute__((unused)) rcs_t *rcs, char const *err ) { assert(filename); assert(rcs); assert(err); error(0, 0, "%s: %s at line %u", filename, err, yylloc.line); } /* * Returns the number of reachable revisions from in . * If a loop is detected, -1 is returned. */ static int _parser_count_deltalist(const rcs_t *rcs, const delta_t *delta, hash_t *branches) { int count; const char *prev; if (delta_is_template(delta)) return -1; prev = NULL; count = 0; while (delta) { const delta_t *base; hash_iter_t iter; count++; if (branches) { const char *rev, *dot; rev = delta_get_revision(delta); dot = strrchr(rev, '.'); assert(dot); if (!prev || strncmp(prev, rev, (size_t) (dot - rev + 1))) { char *copy = strndup(rev, (size_t) (dot - rev)); hash_insert(branches, copy, delta); FREE(copy); prev = rev; } } for_each_branch_base(base, delta, iter) { int c; assert(base); if ((c = _parser_count_deltalist(rcs, base, NULL)) < 0) { hash_iter_free(iter); return -1; } count += c; } hash_iter_free(iter); delta = delta_get_next(delta); } return count; } blame-1.4-20240206/src/working.h0000644000000000000000000000164114557463535014474 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _WORKING_H #define _WORKING_H #include char * working_extract_revision (const char *); #endif /* _WORKING_H */ blame-1.4-20240206/src/util.c0000644000000000000000000001240014560306717013747 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * Copyright 2024 Thomas E. Dickey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include /* * Allow $RCS_DIR to override the conventional "RCS", for compatibility with * https://invisible-island.net/ded/ */ static const char * rcs_dir(void) { static char *result; if (result == NULL) { result = getenv("RCS_DIR"); if (result == NULL || *result == '\0') result = strdup("RCS"); } return (const char *) result; } /* * "RCS/" */ static const char * rcs_slash(void) { static char *result; if (result == NULL) { const char *part = rcs_dir(); size_t need = strlen(part) + strlen(SSLASH) + 1; result = malloc(need); strcpy(result, part); strcat(result, SSLASH); } return (const char *) result; } /* * "/RCS/" */ static const char * slash_rcs_slash(void) { static char *result; if (result == NULL) { const char *part = rcs_slash(); if (*part == SSLASH[0]) { result = strdup(part); } else { size_t need = strlen(SSLASH) + strlen(part) + 1; result = malloc(need); strcpy(result, SSLASH); strcat(result, part); } } return (const char *) result; } /* * Returns true iff and constitute a valid * working file/RCS file pair. */ int does_working_filename_match_rcs_filename( const char *working_filename, const char *rcs_filename ) { const char *from, *to; char *a, *b; size_t al, bl; int result; assert(working_filename && rcs_filename); a = base_name(working_filename); al = base_len(a); b = base_name(rcs_filename); bl = base_len(b); result = 1; from = (suffixes ? suffixes : SUFFIXES); while (1) { to = strchrnul(from, DIRECTORY_SEPARATOR); if (al + (size_t) (to - from) == bl && !strncmp(a, b, al) && !strncmp(from, b + bl - (to - from), (size_t) (to - from))) goto out; if (!*to) break; from = to + 1; } result = 0; out: FREE(a); FREE(b); return result; } /* * Returns true iff is a valid RCS filename. */ int is_rcs_filename(const char *filename) { const char *from, *to; assert(filename); from = (suffixes ? suffixes : SUFFIXES); while (1) { to = strchrnul(from, DIRECTORY_SEPARATOR); if (from == to) { const char *leading = rcs_slash(); if (!strncmp(filename, leading, strlen(leading))) return 1; if (strstr(filename, slash_rcs_slash())) return 1; } else { if (!strncmp(from, filename + strlen(filename) - (to - from), (size_t) (to - from))) return 1; } if (!*to) break; from = to + 1; } return 0; } /* * Returns the RCS filename that best matches , or NULL if * it could not be found. This function will print any error messages. */ char * find_matching_rcs_filename(const char *working_filename) { const char *from, *to, *a; char *first; int first_error; assert(working_filename); a = last_component(working_filename); first = NULL; first_error = 0; from = (suffixes ? suffixes : SUFFIXES); while (1) { char *buffer; size_t length; to = strchrnul(from, DIRECTORY_SEPARATOR); length = strlen(working_filename) + (size_t) (to - from) + 4; buffer = SALLOC(length); strncat(buffer, working_filename, (size_t) (a - working_filename)); strcat(buffer, rcs_slash()); strncat(buffer, a, base_len(a)); strncat(buffer, from, (size_t) (to - from)); if (!access(buffer, F_OK)) { if (first) FREE(first); return buffer; } if (!first) { first_error = errno; first = strdup(buffer); } if (from != to) { memset(buffer, '\0', length); strncpy(buffer, working_filename, (size_t) (a - working_filename)); strncat(buffer, a, base_len(a)); strncat(buffer, from, (size_t) (to - from)); if (!access(buffer, F_OK)) { if (first) FREE(first); return buffer; } } FREE(buffer); if (!*to) break; from = to + 1; } assert(first); assert(first_error); error(0, first_error, "%s", first); FREE(first); return NULL; } /* * Returns the working filename that best matches , or NULL if * it could not be determined. */ char * find_matching_working_filename(const char *rcs_filename) { const char *from, *to; char *a; size_t al; assert(rcs_filename); a = base_name(rcs_filename); al = base_len(a); from = (suffixes ? suffixes : SUFFIXES); while (1) { to = strchrnul(from, DIRECTORY_SEPARATOR); if (!strncmp(from, a + al - (to - from), (size_t) (to - from))) { char *result = strndup(a, al - (size_t) (to - from)); FREE(a); return result; } if (!*to) break; from = to + 1; } FREE(a); return NULL; } blame-1.4-20240206/src/delta.h0000644000000000000000000001225014557463462014102 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DELTA_H #define _DELTA_H #include #include #include /* * An RCS delta entry. This contains info from both the delta and deltatext * portions of the RCS file. */ typedef struct _delta_t { int template; /* If true, then all but the revision field is empty. */ const char *revision; /* The delta's revision. */ time_t date; /* The delta's date. */ const char *author; /* The delta's author. */ const char *state; /* The delta's state. */ hash_t *branches; /* Maps (char *) to (delta_t). */ /* The delta's log entry. */ const char *log; /* * The delta's text. Verbatim for the head revision; otherwise a sequence * of deletions or additions. */ lines_t *text; /* * A pointer to the next revision, or NULL if it is at a branch tip or * the bottom of the trunk. During RCS file parsing this may point to * a template delta. */ const struct _delta_t *next; } delta_t; /* * Loop each branch base on delta using hash_iter_t . */ #define for_each_branch_base(B, D, I) \ for ( \ (I) = ((D)->branches ? hash_iter((D)->branches) : NULL); \ (I) && ((B) = (const delta_t *)hash_get_value(I), 1); \ (I) = hash_next(I) \ ) /* * Returns a new delta template for revision . */ static inline delta_t * delta_new_template(const char *rev) { delta_t *delta; assert(rev); delta = MALLOC(1, delta_t); delta->template = 1; delta->revision = rev; delta->log = NULL; delta->text = NULL; return delta; } /* * Completes delta template using the specified values. may * be a delta template. */ static inline void delta_complete_template_nocopy(delta_t *delta, time_t date, char *author, char *state, hash_t *branches, const delta_t *next ) { assert(delta && delta->template); assert(date >= 0); assert(author); assert(state); delta->template = 0; delta->date = date; delta->author = author; delta->state = state; delta->branches = branches; delta->next = next; } /* * Completes the log and text fields in delta . must not be * a template. */ static inline void delta_complete_text_nocopy(delta_t *delta, char *log, lines_t *text) { assert(delta && !delta->template); assert(log); assert(text); delta->log = log; delta->text = text; } delta_t * delta_dup (const delta_t *); void delta_free (delta_t *); /* * Dup and free functions for data structures that should not own the delta_t. */ static inline const delta_t * delta_ref_dup(const delta_t *delta) { return delta; } static inline void delta_ref_free(const delta_t *delta _UNUSED) {} /* * Returns true iff is a template. */ static inline int delta_is_template(const delta_t *delta) { assert(delta); return delta->template; } /* * Returns the revision field in . */ static inline const char * delta_get_revision(const delta_t *delta) { assert(delta && delta->revision); return delta->revision; } /* * Returns the date field in . */ static inline time_t delta_get_date(const delta_t *delta) { assert(delta && !delta_is_template(delta)); return delta->date; } /* * Returns the author field in . */ static inline const char * delta_get_author(const delta_t *delta) { assert(delta && !delta_is_template(delta)); return delta->author; } /* * Returns the state field in . */ static inline const char * delta_get_state(const delta_t *delta) { assert(delta && !delta_is_template(delta)); return delta->state; } /* * Returns the base of branch in , or NULL if it doesn't * exist. */ static inline const delta_t * delta_get_branch(const delta_t *delta, const char *branch) { const delta_t **base; assert(delta && !delta_is_template(delta)); base = (const delta_t **)hash_get(delta->branches, branch); return (base ? *base : NULL); } /* * Returns the log field in . */ static inline const char * delta_get_log(const delta_t *delta) { assert(delta && !delta_is_template(delta)); return delta->log; } /* * Returns the text field in . */ static inline const lines_t * delta_get_text(const delta_t *delta) { assert(delta && !delta_is_template(delta)); return delta->text; } /* * Returns the next delta after the specified , or NULL if is * a branch tip or the base of the trunk. */ static inline const delta_t * delta_get_next(const delta_t *delta) { assert(delta && !delta_is_template(delta)); return delta->next; } #endif /* _DELTA_H */ blame-1.4-20240206/src/lines.c0000644000000000000000000001232514557431433014112 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #define DEFAULT_LINES_CAPACITY 200 extern obstack_t blame_lines_obstack; /* * Ensures can contain at least entries. */ static void _lines_expand(lines_t *lines, unsigned int c) { assert(lines); if (c <= lines->capacity) return; lines->capacity = c * 2; lines->lines = REALLOC(lines->lines, lines->capacity, line_t *); } /* * Returns a new line buffer. */ lines_t * lines_new() { lines_t *lines = lines_new_with_capacity(DEFAULT_LINES_CAPACITY); return lines; } /* * Returns a new line buffer. */ lines_t * lines_new_with_capacity(unsigned int capacity) { lines_t *lines; lines = MALLOC(1, lines_t); lines->capacity = capacity; lines->count = 0; lines->lines = MALLOC(capacity, line_t *); return lines; } /* * Returns a duplicate of . */ lines_t * lines_dup(const lines_t *lines, unsigned int capacity) { lines_t *result; assert(lines); result = MALLOC(1, lines_t); result->capacity = capacity; result->count = lines->count; result->lines = MALLOC(capacity, line_t *); memcpy(result->lines, lines->lines, result->count * sizeof(line_t *)); return result; } /* * Frees the line buffer . */ void lines_free(lines_t *lines) { assert(lines && lines->lines); FREE(lines->lines); FREE(lines); } /* * Appends (of length ) to . This should only be called on * line buffers created with lines_new (not lines_dup). */ void lines_append_nocopy(lines_t *lines, const char *text, size_t len) { line_t *line; assert(lines); assert(text); line = OALLOC(&blame_lines_obstack, 1, line_t); line->delta = NULL; /* Need this? */ line->text = text; line->len = len; _lines_expand(lines, lines_count(lines) + 1); lines->lines[lines->count++] = line; } /* * Applies the changes between and to , placing the * output in . If we are on the trunk, should be true. This * should only be called on line buffers created with lines_dup (not * lines_new). */ int lines_apply( const lines_t *in, lines_t *out, const delta_t *prev, const delta_t *delta, int on_trunk ) { const lines_t *cmds; line_t * const *cmd, * const *last, * const *from; line_t **to; unsigned int from_line; assert(in); assert(out); assert(delta); assert(!on_trunk || prev); /* Otherwise we don't know who owned deleted lines */ cmds = delta_get_text(delta); cmd = cmds->lines; last = cmd + lines_count(cmds); from = in->lines; from_line = 0; to = out->lines; while (cmd < last) { const char *x; if (!(*cmd)->len) break; x = (*cmd++)->text; switch (*x++) { case 'a': { unsigned int line, count; line = 0; while (*x >= '0' && *x <= '9') { line *= 10; line += (unsigned) (*x++ - '0'); } x++; count = 0; while (*x >= '0' && *x <= '9') { count *= 10; count += (unsigned) (*x++ - '0'); } memcpy(to, from + from_line, (line - from_line) * sizeof(line_t *)); to += line - from_line; if (on_trunk) { memcpy(to, cmd, count * sizeof(line_t *)); to += count; cmd += count; } else while (count--) { assert(!(*cmd)->delta); (*cmd)->delta = delta; *to++ = *cmd++; } from_line = line; } break; case 'd': { unsigned int line, count; line = 0; while (*x >= '0' && *x <= '9') { line *= 10; line += (unsigned) (*x++ - '0'); } line--; x++; count = 0; while (*x >= '0' && *x <= '9') { count *= 10; count += (unsigned) (*x++ - '0'); } memcpy(to, from + from_line, (line - from_line) * sizeof(line_t *)); to += line - from_line; from_line = line + count; if (on_trunk) { line_t * const *temp = from + line; while (count--) { assert(!(*temp)->delta); (*temp++)->delta = prev; } } } break; default: return -1; } } memcpy(to, from + from_line, (lines_count(in) - from_line) * sizeof(line_t *)); out->count = (unsigned) ((to - out->lines) + (lines_count(in) - from_line)); return 0; } /* * Sets all unaccounted lines in to refer to . This should only * be called on line buffers created with lines_dup (not lines_new). */ void lines_finalize(lines_t *lines, const delta_t *delta) { unsigned int i; assert(lines); assert(delta); for (i = lines_count(lines); i--; ) { line_t *line = lines_get(lines, i); if (!line->delta) line->delta = delta; } } blame-1.4-20240206/src/date.h0000644000000000000000000000231514557463435013727 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004, 2005 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DATE_H #define _DATE_H #include #define TM_UNDEFINED_ZONE ((long) -24 * 60 * 60) #define TM_LOCAL_ZONE (TM_UNDEFINED_ZONE - 1) const char * date_parse_zone (const char *, long *); time_t date_parse (const char *, int, long); time_t date_parse_rev (const char *); char * date_format (time_t); char * date_sprintf (time_t, long); size_t date_sprintf_prefix (time_t, char *, size_t); #endif /* _DATE_H */ blame-1.4-20240206/src/hash.c0000644000000000000000000001464014557426446013735 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #define DEFAULT_HASH_CAPACITY 50 /* * Returns a hash for . */ static inline unsigned int hash_fn(const char *key) { unsigned int h, t; h = 0; if (key) { while (*key) { t = h & 0xf8000000; h <<= 5; h ^= t >> 27; h ^= (unsigned) *key++; } } return h; } /* * Returns a new hash table with the specified dup and free functions. */ hash_t * hash_new(dup_fn_t dup_fn, free_fn_t free_fn) { hash_t *hash; hash = MALLOC(1, hash_t); hash->dup_fn = dup_fn; hash->free_fn = free_fn; hash->capacity = DEFAULT_HASH_CAPACITY; hash->count = 0; hash->data = CALLOC(hash->capacity, vector_t *); return hash; } /* * Returns a deep duplicate of . */ hash_t * hash_dup(const hash_t *hash) { hash_t *result; unsigned int i; assert(hash && hash->data); result = MALLOC(1, hash_t); result->dup_fn = hash->dup_fn; result->free_fn = hash->free_fn; result->capacity = hash->capacity; result->count = hash->count; result->data = MALLOC(hash->capacity, vector_t *); for (i = 0; i < hash->capacity; i++) result->data[i] = (hash->data[i] ? vector_dup(hash->data[i]) : NULL); return result; } /* * Returns a new hash table entry. */ static hash_entry_t * _hash_entry_new( dup_fn_t dup_fn, free_fn_t free_fn, const char *key, void *value ) { hash_entry_t *entry; entry = MALLOC(1, hash_entry_t); entry->dup_fn = dup_fn; entry->free_fn = free_fn; entry->key = (key ? strdup(key) : NULL); entry->hash = hash_fn(key); entry->value = value; return entry; } /* * Returns a deep duplicate of . */ static hash_entry_t * _hash_entry_dup(const hash_entry_t *entry) { hash_entry_t *result; assert(entry); result = MALLOC(1, hash_entry_t); result->dup_fn = entry->dup_fn; result->free_fn = entry->free_fn; result->key = (entry->key ? strdup(entry->key) : NULL); result->hash = entry->hash; result->value = ( entry->dup_fn ? (entry->dup_fn)(entry->value) : entry->value ); return result; } /* * Deeply frees . */ static void _hash_entry_free(hash_entry_t *entry) { assert(entry); if (entry->key) FREE(entry->key); if (entry->free_fn) (entry->free_fn)(entry->value); FREE(entry); } /* * Inserts a duplicate of into . */ #define _hash_insert_entry(HASH, ENTRY) \ _hash_insert_entry_nocopy((HASH), _hash_entry_dup(ENTRY)) /* * Inserts a into without duplicating. */ static void _hash_insert_entry_nocopy(hash_t *hash, hash_entry_t *entry) { unsigned int slot; unsigned int i; hash_entry_t *e; assert(hash); assert(hash->data); assert(entry); slot = entry->hash % hash->capacity; if (!hash->data[slot]) hash->data[slot] = vector_new( (dup_fn_t)_hash_entry_dup, (free_fn_t)_hash_entry_free ); for (i = 0; i < vector_count(hash->data[slot]); i++) { e = (hash_entry_t *)vector_get(hash->data[slot], i); if ( e->hash == entry->hash && ( (e->key == entry->key) || ( e->key && entry->key && !strcmp(e->key, entry->key) ) ) ) { if (hash->free_fn) (hash->free_fn)(e->value); e->value = entry->value; if (entry->key) FREE(entry->key); FREE(entry); return; } } vector_append_nocopy(hash->data[slot], entry); } /* * Ensures can contain at least entries. */ void hash_expand(hash_t *hash, unsigned int c) { unsigned int i, j, cap; vector_t **data; assert(hash); assert(hash->data); if (c <= hash->capacity) return; cap = hash->capacity; hash->capacity = c; data = hash->data; hash->data = CALLOC(hash->capacity, vector_t *); for (i = 0; i < cap; i++) if (data[i]) { for (j = 0; j < vector_count(data[i]); j++) _hash_insert_entry_nocopy(hash, (hash_entry_t *)vector_get(data[i], j)); vector_free_nofree(data[i]); } FREE(data); } /* * Maps to in the hash table without duplicating . * is duplicated, however. */ void hash_insert_nocopy(hash_t *hash, const char *key, void *value) { hash_entry_t *entry; assert(hash); if (hash->count++ * 2 > hash->capacity) hash_expand(hash, hash->capacity * 2); entry = _hash_entry_new(hash->dup_fn, hash->free_fn, key, value); _hash_insert_entry_nocopy(hash, entry); } /* * Returns a pointer to a pointer to the value in with key , or * NULL if no such entry exists. */ void ** hash_get(hash_t *hash, const char *key) { unsigned int h, i, slot; hash_entry_t *e; assert(hash); assert(hash->data); h = hash_fn(key); slot = h % hash->capacity; if (!hash->data[slot]) return NULL; for (i = 0; i < vector_count(hash->data[slot]); i++) { e = (hash_entry_t *)vector_get(hash->data[slot], i); if ( e->hash == h && ( (e->key == key) || (e->key && key && !strcmp(e->key, key)) ) ) return &e->value; } return NULL; } /* * Deeply frees . */ void hash_free(hash_t *hash) { unsigned int i; assert(hash); assert(hash->data); for (i = 0; i < hash->capacity; i++) if (hash->data[i]) vector_free(hash->data[i]); FREE(hash->data); FREE(hash); } /* * Returns a new iterator on . */ hash_iter_t hash_iter(hash_t *hash) { unsigned int i; hash_iter_struct_t *iter; assert(hash); assert(hash->data); for (i = 0; i < hash->capacity; i++) if (hash->data[i]) { iter = MALLOC(1, hash_iter_struct_t); iter->base = &hash->data[i]; iter->end = &hash->data[hash->capacity]; iter->i = 0; return iter; } return NULL; } /* * Advances and returns the iterator . */ hash_iter_t hash_next(hash_iter_t iter) { assert(iter); if (++iter->i < vector_count(*iter->base)) return iter; while (++iter->base != iter->end) if (*iter->base) { iter->i = 0; return iter; } FREE(iter); return NULL; } blame-1.4-20240206/src/parser.h0000644000000000000000000000651410527553345014304 0ustar rootroot/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { NUM = 258, ID = 259, SYM = 260, STR = 261, STR_FINAL = 262, HEAD = 263, BRANCH = 264, ACCESS = 265, SYMBOLS = 266, LOCKS = 267, STRICT = 268, COMMENT = 269, EXPAND = 270, DATE = 271, AUTHOR = 272, STATE = 273, BRANCHES = 274, NEXT = 275, DESC = 276, LOG = 277, TEXT = 278 }; #endif /* Tokens. */ #define NUM 258 #define ID 259 #define SYM 260 #define STR 261 #define STR_FINAL 262 #define HEAD 263 #define BRANCH 264 #define ACCESS 265 #define SYMBOLS 266 #define LOCKS 267 #define STRICT 268 #define COMMENT 269 #define EXPAND 270 #define DATE 271 #define AUTHOR 272 #define STATE 273 #define BRANCHES 274 #define NEXT 275 #define DESC 276 #define LOG 277 #define TEXT 278 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE #line 43 "parser.y" { char *s; unsigned int i; time_t date; hash_t *hash; vector_t *vector; lines_t *lines; delta_t *delta; struct { delta_t *head; hash_t *branches; } trunk; expand_t expand; } /* Line 1529 of yacc.c. */ #line 110 "parser.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE yylval; #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; } YYLTYPE; # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif extern YYLTYPE yylloc; blame-1.4-20240206/src/lexer.l0000644000000000000000000001261414557432775014143 0ustar rootroot%{ /* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * Copyright 2024 Thomas E. Dickey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #define YY_NO_UNPUT typedef struct { unsigned int line; off_t off; off_t next; } loc_t; #define YYLTYPE loc_t #define YY_DECL int yylex (void) extern YY_DECL; #include #include #include #include #include extern YYSTYPE yylval; extern YYLTYPE yylloc; %} %option noyywrap %option never-interactive /* * Each string returned as STR or STR_FINAL is actually just a single line. * STR is returned when a newline is read; STR_FINAL is returned at the * terminate "@". * The SA state is active when the lexer is at the start of a string line. */ %x SA STRING ([^@\n]*@@)*[^@\n]* %% head { yylloc.off = yylloc.next; yylloc.next += 4; return HEAD; } branch { yylloc.off = yylloc.next; yylloc.next += 6; return BRANCH; } access { yylloc.off = yylloc.next; yylloc.next += 6; return ACCESS; } symbols { yylloc.off = yylloc.next; yylloc.next += 7; return SYMBOLS; } locks { yylloc.off = yylloc.next; yylloc.next += 5; return LOCKS; } strict { yylloc.off = yylloc.next; yylloc.next += 6; return STRICT; } comment { yylloc.off = yylloc.next; yylloc.next += 7; return COMMENT; } expand { yylloc.off = yylloc.next; yylloc.next += 6; return EXPAND; } date { yylloc.off = yylloc.next; yylloc.next += 4; return DATE; } author { yylloc.off = yylloc.next; yylloc.next += 6; return AUTHOR; } state { yylloc.off = yylloc.next; yylloc.next += 5; return STATE; } branches { yylloc.off = yylloc.next; yylloc.next += 8; return BRANCHES; } next { yylloc.off = yylloc.next; yylloc.next += 4; return NEXT; } desc { yylloc.off = yylloc.next; yylloc.next += 4; return DESC; } log { yylloc.off = yylloc.next; yylloc.next += 3; return LOG; } text { yylloc.off = yylloc.next; yylloc.next += 4; return TEXT; } [^@[:space:];:]+ { char *temp; unsigned int count; int dot = 0, idchar = 0; yylloc.off = yylloc.next; yylloc.next += yyleng; yylval.i = count = (unsigned) yyleng; for (temp = yytext; count--; temp++) { switch (*temp) { case '.': dot = 1; break; case '$': case ',': case ':': case ';': case '@': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; default: idchar = 1; break; } } return (idchar ? (dot ? ID : SYM) : NUM); } @{STRING}\n { BEGIN(SA); yylloc.line++; yylloc.off = yylloc.next + 1; yylloc.next += yyleng; yylval.i = (unsigned) (yyleng - 1); return STR; } @{STRING}@ { yylloc.off = yylloc.next + 1; yylloc.next += yyleng; yylval.i = (unsigned) (yyleng - 2); return STR_FINAL; } @{STRING} { /* Has to be at EOF */ yylloc.line++; yylloc.off = yylloc.next + 1; yylloc.next += yyleng; yylval.i = (unsigned) (yyleng - 1); return STR_FINAL; } {STRING}\n { yylloc.line++; yylloc.off = yylloc.next; yylloc.next += yyleng; yylval.i = (unsigned) yyleng; return STR; } {STRING}@ { BEGIN(INITIAL); yylloc.line++; yylloc.off = yylloc.next; yylloc.next += yyleng; yylval.i = (unsigned) (yyleng - 1); return STR_FINAL; } {STRING} { /* Has to be at EOF */ BEGIN(INITIAL); yylloc.line++; yylloc.off = yylloc.next; yylloc.next += yyleng; yylval.i = (unsigned) yyleng; return STR_FINAL; } [;:] { yylloc.off = yylloc.next; yylloc.next++; return yytext[0]; } [ \f\r\t\v]*\n { yylloc.line++; yylloc.next += yyleng; } [ \f\r\t\v]* { yylloc.next += yyleng; } blame-1.4-20240206/src/lexer.c0000644000000000000000000012727314557433000014120 0ustar rootroot/* * A lexical scanner generated by flex * vile:lexmode * * Scanner skeleton version: * @Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp @ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_LOWER_VERSION 4 #define YY_FLEX_PATCH_VERSION 20230523 #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define YY_USE_CONST #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart(yyin) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if (condition_holds) * yyless(5); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while (0) #define unput(c) yyunput(c, yytext_ptr) #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #define YY_SIZE_T size_t #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ #ifndef YY_SIZE_T #define YY_SIZE_T unsigned #endif typedef YY_SIZE_T yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart(FILE *input_file); void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer); void yy_load_buffer_state(void); YY_BUFFER_STATE yy_create_buffer(FILE *file, int size); void yy_delete_buffer(YY_BUFFER_STATE b); void yy_init_buffer(YY_BUFFER_STATE b, FILE *file); void yy_flush_buffer(YY_BUFFER_STATE b); #define YY_FLUSH_BUFFER yy_flush_buffer(yy_current_buffer) YY_BUFFER_STATE yy_scan_buffer(char *bbase, yy_size_t size); YY_BUFFER_STATE yy_scan_string(yyconst char *yy_str); YY_BUFFER_STATE yy_scan_bytes(yyconst char *bytes, int len); static void *yy_flex_alloc(yy_size_t); static void *yy_flex_realloc(void *, yy_size_t); static void yy_flex_free(void *); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if (!yy_current_buffer) \ yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if (!yy_current_buffer) \ yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) #define yywrap() 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state(void); static yy_state_type yy_try_NUL_trans(yy_state_type current_state); static int yy_get_next_buffer(void); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 27 #define YY_END_OF_BUFFER 28 /* *INDENT-OFF* */ static yyconst short int yy_accept[98] = { 0, 26, 26, 23, 23, 28, 17, 26, 25, 24, 20, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 23, 21, 22, 17, 26, 25, 20, 18, 19, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 23, 21, 22, 23, 20, 17, 17, 17, 17, 17, 17, 17, 17, 17, 15, 17, 17, 17, 17, 17, 17, 17, 17, 17, 9, 14, 17, 1, 17, 13, 17, 17, 17, 16, 17, 17, 17, 17, 17, 5, 11, 17, 17, 3, 10, 2, 17, 8, 6, 17, 17, 7, 4, 12, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 7, 8, 9, 10, 1, 11, 12, 13, 1, 14, 15, 16, 17, 18, 19, 1, 20, 21, 22, 23, 1, 1, 24, 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[26] = { 0, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst short int yy_base[102] = { 0, 0, 0, 23, 24, 118, 0, 28, 119, 119, 29, 25, 97, 98, 29, 91, 104, 95, 102, 15, 101, 33, 119, 105, 0, 39, 119, 40, 119, 104, 100, 85, 100, 89, 82, 82, 83, 95, 36, 76, 40, 83, 74, 46, 119, 92, 47, 50, 86, 83, 77, 77, 82, 83, 84, 80, 74, 0, 65, 64, 72, 77, 61, 61, 63, 72, 69, 0, 0, 61, 0, 56, 0, 66, 67, 56, 0, 52, 52, 59, 53, 60, 0, 0, 46, 52, 0, 0, 49, 36, 0, 0, 36, 35, 0, 0, 0, 119, 60, 53, 62, 64 } ; static yyconst short int yy_def[102] = { 0, 97, 1, 98, 98, 97, 99, 97, 97, 97, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 101, 97, 97, 99, 97, 97, 100, 97, 97, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 101, 97, 97, 101, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 0, 97, 97, 97, 97 } ; static yyconst short int yy_nxt[145] = { 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 6, 16, 6, 6, 17, 6, 18, 6, 6, 6, 19, 20, 6, 6, 6, 22, 22, 23, 23, 25, 26, 28, 30, 29, 34, 44, 40, 45, 35, 41, 25, 26, 28, 56, 29, 59, 57, 31, 44, 44, 45, 45, 28, 24, 29, 96, 95, 94, 93, 60, 21, 21, 27, 27, 43, 43, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 46, 62, 61, 58, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 42, 39, 38, 37, 36, 33, 32, 97, 5, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97 } ; static yyconst short int yy_chk[145] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 3, 4, 7, 7, 10, 11, 10, 14, 21, 19, 21, 14, 19, 25, 25, 27, 38, 27, 40, 38, 11, 43, 46, 43, 46, 47, 99, 47, 93, 92, 89, 88, 40, 98, 98, 100, 100, 101, 101, 85, 84, 81, 80, 79, 78, 77, 75, 74, 73, 71, 69, 66, 65, 64, 63, 62, 61, 60, 59, 58, 56, 55, 54, 53, 52, 51, 50, 49, 48, 45, 42, 41, 39, 37, 36, 35, 34, 33, 32, 31, 30, 29, 23, 20, 18, 17, 16, 15, 13, 12, 5, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97 } ; /* *INDENT-ON* */ static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "lexer.l" #define INITIAL 0 #line 2 "lexer.l" /* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * Copyright 2024 Thomas E. Dickey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #define YY_NO_UNPUT typedef struct { unsigned int line; off_t off; off_t next; } loc_t; #define YYLTYPE loc_t #define YY_DECL int yylex (void) extern YY_DECL; #include #include #include #include #include extern YYSTYPE yylval; extern YYLTYPE yylloc; #define YY_NEVER_INTERACTIVE 1 /* * Each string returned as STR or STR_FINAL is actually just a single line. * STR is returned when a newline is read; STR_FINAL is returned at the * terminate "@". * The SA state is active when the lexer is at the start of a string line. */ #define SA 1 #line 479 "lexer.c" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_NO_UNISTD_H /* * Non-POSIX systems may lack unistd.h, or provide a useless stub. * Let the user decide how to deal with it. */ #include #endif static int yy_init_globals (void); int yylex_destroy(void); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap(); #else extern int yywrap(void); #endif #endif #ifndef YY_NO_UNPUT static void yyunput(int c, char *buf_ptr); #endif #ifndef yytext_ptr static void yy_flex_strncpy(char *, yyconst char *, int); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen(yyconst char *); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput(); #else static int input(void); #endif #endif #ifndef YY_STACK_USED #define YY_STACK_USED 0 #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state(int new_state); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state(void); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state(void); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* workaround for defective implementation of gcc attribute warn_unused_result */ #if defined(__GNUC__) && defined(_FORTIFY_SOURCE) #define YY_IGNORE_RC(func) do { if (func != 0) {} } while(0) #else #define YY_IGNORE_RC(func) (void) func #endif /* gcc workaround */ /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO YY_IGNORE_RC(fwrite(yytext, (size_t) yyleng, (size_t) 1, yyout)) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if (yy_current_buffer->yy_is_interactive) \ { \ int c = '*', n; \ for (n = 0; n < (int) max_size && \ (c = getc(yyin)) != EOF && c != '\n'; ++n) \ buf[n] = (char) c; \ if (c == '\n') \ buf[n++] = (char) c; \ if (c == EOF && ferror(yyin)) \ YY_FATAL_ERROR("input in flex scanner failed"); \ result = n; \ } \ else \ { \ size_t readresult; \ if (((readresult = fread(buf, (size_t) 1, (size_t) max_size, yyin)) == 0) \ && ferror(yyin)) \ { \ YY_FATAL_ERROR("input in flex scanner failed"); \ } \ result = (int) readresult; \ } #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR /* if the macro is defined, this function is unused */ static void yy_fatal_error(yyconst char msg[]) { (void) fprintf(stderr, "%s\n", msg); exit(YY_EXIT_FAILURE); } #define YY_FATAL_ERROR(msg) yy_fatal_error(msg) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex (void) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; #line 55 "lexer.l" #line 659 "lexer.c" if (yy_init) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if (!yy_start) yy_start = 1; /* first start state */ if (!yyin) yyin = stdin; if (!yyout) yyout = stdout; if (!yy_current_buffer) yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE); yy_load_buffer_state(); } while (1) { /* loops until end-of-file is reached */ yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { YY_CHAR yy_c = (YY_CHAR) yy_ec[YY_SC_TO_UI(*yy_cp)]; if (yy_accept[yy_current_state]) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { yy_current_state = (int) yy_def[yy_current_state]; if (yy_current_state >= 98) yy_c = (YY_CHAR) yy_meta[(unsigned int) yy_c]; } yy_current_state = (yy_state_type) yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while (yy_base[yy_current_state] != 119); yy_find_action: yy_act = (int) yy_accept[yy_current_state]; if (yy_act == 0) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = (int) yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch (yy_act) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 57 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 4; return HEAD; } YY_BREAK case 2: YY_RULE_SETUP #line 58 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 6; return BRANCH; } YY_BREAK case 3: YY_RULE_SETUP #line 59 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 6; return ACCESS; } YY_BREAK case 4: YY_RULE_SETUP #line 60 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 7; return SYMBOLS; } YY_BREAK case 5: YY_RULE_SETUP #line 61 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 5; return LOCKS; } YY_BREAK case 6: YY_RULE_SETUP #line 62 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 6; return STRICT; } YY_BREAK case 7: YY_RULE_SETUP #line 63 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 7; return COMMENT; } YY_BREAK case 8: YY_RULE_SETUP #line 64 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 6; return EXPAND; } YY_BREAK case 9: YY_RULE_SETUP #line 65 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 4; return DATE; } YY_BREAK case 10: YY_RULE_SETUP #line 66 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 6; return AUTHOR; } YY_BREAK case 11: YY_RULE_SETUP #line 67 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 5; return STATE; } YY_BREAK case 12: YY_RULE_SETUP #line 68 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 8; return BRANCHES; } YY_BREAK case 13: YY_RULE_SETUP #line 69 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 4; return NEXT; } YY_BREAK case 14: YY_RULE_SETUP #line 70 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 4; return DESC; } YY_BREAK case 15: YY_RULE_SETUP #line 71 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 3; return LOG; } YY_BREAK case 16: YY_RULE_SETUP #line 72 "lexer.l" { yylloc.off = yylloc.next; yylloc.next += 4; return TEXT; } YY_BREAK case 17: YY_RULE_SETUP #line 74 "lexer.l" { char *temp; unsigned int count; int dot = 0, idchar = 0; yylloc.off = yylloc.next; yylloc.next += yyleng; yylval.i = count = (unsigned) yyleng; for (temp = yytext; count--; temp++) { switch (*temp) { case '.': dot = 1; break; case '$': case ',': case ':': case ';': case '@': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; default: idchar = 1; break; } } return (idchar ? (dot ? ID : SYM) : NUM); } YY_BREAK case 18: YY_RULE_SETUP #line 97 "lexer.l" { BEGIN(SA); yylloc.line++; yylloc.off = yylloc.next + 1; yylloc.next += yyleng; yylval.i = (unsigned) (yyleng - 1); return STR; } YY_BREAK case 19: YY_RULE_SETUP #line 105 "lexer.l" { yylloc.off = yylloc.next + 1; yylloc.next += yyleng; yylval.i = (unsigned) (yyleng - 2); return STR_FINAL; } YY_BREAK case 20: YY_RULE_SETUP #line 111 "lexer.l" { /* Has to be at EOF */ yylloc.line++; yylloc.off = yylloc.next + 1; yylloc.next += yyleng; yylval.i = (unsigned) (yyleng - 1); return STR_FINAL; } YY_BREAK case 21: YY_RULE_SETUP #line 119 "lexer.l" { yylloc.line++; yylloc.off = yylloc.next; yylloc.next += yyleng; yylval.i = (unsigned) yyleng; return STR; } YY_BREAK case 22: YY_RULE_SETUP #line 126 "lexer.l" { BEGIN(INITIAL); yylloc.line++; yylloc.off = yylloc.next; yylloc.next += yyleng; yylval.i = (unsigned) (yyleng - 1); return STR_FINAL; } YY_BREAK case 23: YY_RULE_SETUP #line 134 "lexer.l" { /* Has to be at EOF */ BEGIN(INITIAL); yylloc.line++; yylloc.off = yylloc.next; yylloc.next += yyleng; yylval.i = (unsigned) yyleng; return STR_FINAL; } YY_BREAK case 24: YY_RULE_SETUP #line 144 "lexer.l" { yylloc.off = yylloc.next; yylloc.next++; return yytext[0]; } YY_BREAK case 25: YY_RULE_SETUP #line 150 "lexer.l" { yylloc.line++; yylloc.next += yyleng; } YY_BREAK case 26: YY_RULE_SETUP #line 154 "lexer.l" { yylloc.next += yyleng; } YY_BREAK case 27: YY_RULE_SETUP #line 157 "lexer.l" ECHO; YY_BREAK #line 943 "lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(SA): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if (yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if (yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars]) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans(yy_current_state); yy_bp = yytext_ptr + YY_MORE_ADJ; if (yy_next_state) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else { switch (yy_get_next_buffer()) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if (yywrap()) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if (!yy_did_buffer_switch_on_eof) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } } break; } default: YY_FATAL_ERROR("fatal flex scanner internal error--no action found"); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer(void) { char *dest = yy_current_buffer->yy_ch_buf; char *source = yytext_ptr; int number_to_move, i; int ret_val; if (yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1]) YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed"); if (yy_current_buffer->yy_fill_buffer == 0) { /* Don't try to fill the buffer, so this is an EOF. */ if (yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for (i = 0; i < number_to_move; ++i) *(dest++) = *(source++); if (yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = (int) ((long) yy_current_buffer->yy_buf_size - (long) number_to_move - 1); while (num_to_read <= 0) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR("input buffer overflow, can't enlarge buffer because scanner uses REJECT"); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if (b->yy_is_our_buffer) { int new_size = (int) (b->yy_buf_size * 2); if (new_size <= 0) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc((void *) b->yy_ch_buf, b->yy_buf_size + 2); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if (!b->yy_ch_buf) YY_FATAL_ERROR("fatal error - scanner input buffer overflow"); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = (int) ((long) yy_current_buffer->yy_buf_size - (long) number_to_move - 1); #endif } if (num_to_read > YY_READ_BUF_SIZE) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT((&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read); yy_current_buffer->yy_n_chars = yy_n_chars; } if (yy_n_chars == 0) { if (number_to_move == YY_MORE_ADJ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart(yyin); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state(void) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = yy_start; for (yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp) { YY_CHAR yy_c = (YY_CHAR) (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if (yy_accept[yy_current_state]) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { yy_current_state = (int) yy_def[yy_current_state]; if (yy_current_state >= 98) yy_c = (YY_CHAR) yy_meta[(unsigned int) yy_c]; } yy_current_state = (yy_state_type) yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans(current_state); */ static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state) { int yy_is_jam; char *yy_cp = yy_c_buf_p; YY_CHAR yy_c = (YY_CHAR) 1; if (yy_accept[yy_current_state]) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { yy_current_state = (int) yy_def[yy_current_state]; if (yy_current_state >= 98) yy_c = (YY_CHAR) yy_meta[(unsigned int) yy_c]; } yy_current_state = (yy_state_type) yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 97); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT static void yyunput(int c, char *yy_bp) { char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if (yy_cp < yy_current_buffer->yy_ch_buf + 2) { /* need to shift things up to make room */ /* +2 for EOB chars. */ int number_to_move = yy_n_chars + 2; char *dest = &(yy_current_buffer->yy_ch_buf [yy_current_buffer->yy_buf_size + 2]); char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while (source > yy_current_buffer->yy_ch_buf) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = (int) yy_current_buffer->yy_buf_size; if (yy_cp < yy_current_buffer->yy_ch_buf + 2) YY_FATAL_ERROR("flex scanner push-back overflow"); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput() #else static int input(void) #endif { int c; *yy_c_buf_p = yy_hold_char; if (*yy_c_buf_p == YY_END_OF_BUFFER_CHAR) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if (yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars]) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = (int) (yy_c_buf_p - yytext_ptr); ++yy_c_buf_p; switch (yy_get_next_buffer()) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart(yyin); /* fall through */ case EOB_ACT_END_OF_FILE: { if (yywrap()) return EOF; if (!yy_did_buffer_switch_on_eof) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #endif /* ifndef YY_NO_INPUT */ void yyrestart(FILE *input_file) { if (!yy_current_buffer) yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE); yy_init_buffer(yy_current_buffer, input_file); yy_load_buffer_state(); } void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer) { if (yy_current_buffer == new_buffer) return; if (yy_current_buffer) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } void yy_load_buffer_state(void) { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } YY_BUFFER_STATE yy_create_buffer(FILE *file, int size) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc(sizeof(struct yy_buffer_state)); if (!b) YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); b->yy_buf_size = (yy_size_t) size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc(b->yy_buf_size + 2); if (!b->yy_ch_buf) YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); b->yy_is_our_buffer = 1; yy_init_buffer(b, file); return b; } void yy_delete_buffer(YY_BUFFER_STATE b) { if (!b) return; if (b == yy_current_buffer) yy_current_buffer = (YY_BUFFER_STATE) 0; if (b->yy_is_our_buffer) yy_flex_free((void *) b->yy_ch_buf); yy_flex_free((void *) b); } void yy_init_buffer(YY_BUFFER_STATE b, FILE *file) { yy_flush_buffer(b); b->yy_input_file = file; b->yy_fill_buffer = 1; #ifndef YY_ALWAYS_INTERACTIVE #define YY_ALWAYS_INTERACTIVE 0 #endif #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #ifndef YY_NEVER_INTERACTIVE #define YY_NEVER_INTERACTIVE 0 #endif #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0; #endif #endif } void yy_flush_buffer(YY_BUFFER_STATE b) { if (!b) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if (b == yy_current_buffer) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER YY_BUFFER_STATE yy_scan_buffer(char *bbase, yy_size_t size) { YY_BUFFER_STATE b; if (size < 2 || bbase[size - 2] != YY_END_OF_BUFFER_CHAR || bbase[size - 1] != YY_END_OF_BUFFER_CHAR) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc(sizeof(struct yy_buffer_state)); if (!b) YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()"); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = bbase; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = (int) b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer(b); return b; } #endif #ifndef YY_NO_SCAN_STRING YY_BUFFER_STATE yy_scan_string(yyconst char *yy_str) { int len; for (len = 0; yy_str[len]; ++len) { ; } return yy_scan_bytes(yy_str, len); } #endif #ifndef YY_NO_SCAN_BYTES YY_BUFFER_STATE yy_scan_bytes(yyconst char *bytes, int len) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (len + 2); buf = (char *) yy_flex_alloc(n); if (!buf) YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()"); for (i = 0; i < len; ++i) buf[i] = bytes[i]; buf[len] = buf[len + 1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer(buf, n); if (!b) YY_FATAL_ERROR("bad buffer in yy_scan_bytes()"); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE static void yy_push_state(int new_state) { if (yy_start_stack_ptr >= yy_start_stack_depth) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = (yy_size_t) yy_start_stack_depth * sizeof(int); if (!yy_start_stack) yy_start_stack = (int *) yy_flex_alloc(new_size); else yy_start_stack = (int *) yy_flex_realloc((void *) yy_start_stack, new_size); if (!yy_start_stack) YY_FATAL_ERROR("out of memory expanding start-condition stack"); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state(void) { if (--yy_start_stack_ptr < 0) YY_FATAL_ERROR("start-condition stack underflow"); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state(void) { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while (0) static int yy_init_globals(void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ yy_current_buffer = 0; yy_c_buf_p = (char *) 0; yy_init = 1; yy_start = 0; yyin = (FILE *) 0; yyout = (FILE *) 0; return 0; } int yylex_destroy(void) { if (YY_CURRENT_BUFFER) { yy_delete_buffer(YY_CURRENT_BUFFER); YY_CURRENT_BUFFER = NULL; } /* Reset the globals. This is important in a non-reentrant scanner so * the next time yylex() is called, initialization will occur. */ yy_init_globals(); return 0; } /* Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy(char *s1, yyconst char *s2, int n) { int i; for (i = 0; i < n; ++i) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen(yyconst char *s) { int n; for (n = 0; s[n]; ++n) { ; } return n; } #endif static void * yy_flex_alloc(yy_size_t size) { return (void *) malloc(size); } static void * yy_flex_realloc(void *ptr, yy_size_t size) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc((char *) ptr, size); } static void yy_flex_free(void *ptr) { free(ptr); } #ifndef YY_MAIN #define YY_MAIN 0 #endif #if YY_MAIN int main(void) { yylex(); return 0; } #endif #line 157 "lexer.l" blame-1.4-20240206/src/rcs.c0000644000000000000000000003146414557463410013574 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004, 2005 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include typedef unsigned int yy_size_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyparse (const char *, rcs_t *); extern void yy_switch_to_buffer (YY_BUFFER_STATE); extern void yy_delete_buffer (YY_BUFFER_STATE); extern YY_BUFFER_STATE yy_scan_bytes (char *, yy_size_t); #define YY_CURRENT_BUFFER yy_current_buffer /* * Parses and returns the RCS file specified by . */ rcs_t * rcs_parse(const char *rcs_filename) { rcs_t *rcs; FILE *stream; struct stat stat_buf; YY_BUFFER_STATE current_buffer; assert(rcs_filename); stream = fopen(rcs_filename, "r"); if (!stream) { error(0, errno, "%s", rcs_filename); return NULL; } rcs = CALLOC(1, rcs_t); rcs->filename = strdup(rcs_filename); rcs->full_filename = canonicalize_file_name(rcs_filename); if (!rcs->full_filename) { FREE(rcs->filename); FREE(rcs); error(0, errno, "%s", rcs_filename); return NULL; } rcs->short_filename = base_name(rcs_filename); if (fstat(fileno(stream), &stat_buf)) { FREE(rcs->full_filename); FREE(rcs->filename); FREE(rcs); error(0, errno, "Could not stat %s", rcs_filename); return NULL; } rcs->length = (size_t) stat_buf.st_size; rcs->start = (char *)mmap( NULL, rcs->length, PROT_WRITE | PROT_READ, MAP_PRIVATE, fileno(stream), 0 ); if (!rcs->start) { FREE(rcs->full_filename); FREE(rcs->filename); FREE(rcs); error(0, errno, "Could not mmap %s", rcs_filename); return NULL; } current_buffer = yy_scan_bytes(rcs->start, (yy_size_t)rcs->length); yy_switch_to_buffer(current_buffer); if (yyparse(rcs_filename, rcs)) { if (fclose(stream)) error(0, errno, "%s", rcs_filename); rcs_free(rcs); return NULL; } yy_delete_buffer(current_buffer); if (fclose(stream)) error(0, errno, "%s", rcs_filename); if (!rcs->head) return rcs; return rcs; } /* * Deeply frees . */ void rcs_free(rcs_t *rcs) { assert(rcs); assert(rcs->filename); assert(rcs->full_filename); assert(rcs->short_filename); FREE(rcs->filename); FREE(rcs->short_filename); FREE(rcs->full_filename); if (rcs->head) delta_ref_free(rcs->head); if (rcs->branch) FREE(rcs->branch); if (rcs->branches) hash_free(rcs->branches); if (rcs->access) vector_free(rcs->access); if (rcs->symbols) hash_free(rcs->symbols); if (rcs->locks) hash_free(rcs->locks); if (rcs->delta_list) hash_free(rcs->delta_list); munmap(rcs->start, rcs->length); FREE(rcs); } /* * Returns true iff is a valid RCS ID character. */ static inline int _isidchar(char c) { return ISGRAPH(c) && !ISDIGIT(c) && (c != '$') && (c != ',') && (c != '.') && (c != ':') && (c != ';') && (c != '@'); } /* * Returns true iff is a valid RCS revision. */ int rcs_rev_is_valid(const char *rev) { unsigned int dots; const char *c; assert(rev); dots = 0; for (c = rev; *c; c++) if (*c == '.') dots++; else if (!ISDIGIT(*c)) return 0; return dots % 2; } /* * Returns true iff is a valid RCS branch. */ int rcs_branch_is_valid(const char *branch) { unsigned int dots; const char *c; assert(branch); dots = 0; for (c = branch; *c; c++) if (*c == '.') dots++; else if (!ISDIGIT(*c)) return 0; return !(dots % 2); } /* * Returns the branch on which revision is found. */ char * rcs_rev_to_branch(const char *rev) { char *branch; assert(rev && rcs_rev_is_valid(rev)); branch = strdup(rev); *(strrchr(branch, '.')) = '\0'; return branch; } /* * Returns the base of branch in RCS file . */ static const delta_t * _rcs_get_base(const rcs_t *rcs, const char *branch) { char *rev, *dot; const delta_t *result; assert(rcs); assert(branch && rcs_branch_is_valid(branch)); result = NULL; rev = strdup(branch); dot = strrchr(rev, '.'); if (dot) { const delta_t *from, **base; *dot = '\0'; from = rcs_get_delta(rcs, rev); if (!from) { error(0, 0, "%s: revision %s absent", rcs->filename, rev); FREE(rev); return NULL; } FREE(rev); if (from->branches) { base = (const delta_t **)hash_get(from->branches, branch); if (base) result = *base; } } else { const delta_t **base; FREE(rev); base = (const delta_t **)hash_get( rcs->branches, branch ); if (base) result = *base; } if (!result) error(0, 0, "%s: branch %s absent", rcs->filename, branch); return result; } /* * Returns the earliest revision on branch in RCS file that has * date equal or after (if it is not -1), author (if it is not * NULL), and state (if it is not NULL). Returns NULL if no such * revision is found. */ static char * _rcs_find_rev( const rcs_t *rcs, const char *branch, time_t date, const char *author, const char *state, long zone_offset ) { const delta_t *delta, *result; int trunk; char *cond; size_t len; assert(rcs && rcs->delta_list); assert(branch && rcs_branch_is_valid(branch)); /* The trunk is in reverse. */ trunk = (strchr(branch, '.') == NULL); delta = _rcs_get_base(rcs, branch); if (!delta) return NULL; result = NULL; while (delta && (!trunk || !result)) { int ok = ((date == -1) || (delta_get_date(delta) <= date)); ok = ok && (!author || !strcmp(delta_get_author(delta), author)); ok = ok && (!state || !strcmp(delta_get_state(delta), state)); if (ok) result = delta; delta = delta_get_next(delta); } if (result) return strdup(delta_get_revision(result)); cond = SALLOC(1); len = 0; if ((date >= 0) || author || state) { len += 5; cond = SREALLOC(cond, len); strcat(cond, " has"); } if (date >= 0) { char *date_str = date_sprintf(date, zone_offset); len += 15 + strlen(date_str); cond = SREALLOC(cond, len); strcat(cond, " a date before "); strcat(cond, date_str); FREE(date_str); } if (author) { if (date >= 0) len += 4; len += 8 + strlen(author); cond = SREALLOC(cond, len); if (date >= 0) strcat(cond, " and"); strcat(cond, " author "); strcat(cond, author); } if (state) { if ((date >= 0) || author) len += 4; len += 7 + strlen(state); cond = SREALLOC(cond, len); if ((date >= 0) || author) strcat(cond, " and"); strcat(cond, " state "); strcat(cond, state); } error(0, 0, "%s: no revision on branch %s%s", rcs->filename, branch, cond); FREE(cond); return NULL; } /* * Compares revision numbers and . */ static inline int _revcmp(const char *a, const char *b) { long int d = 0; while (a && b && !(d = (long) (strtoul(a, NULL, 0) - strtoul(b, NULL, 0))) ) { a = strchr(a, '.'); if (a) a++; b = strchr(b, '.'); if (b) b++; } return (int) d; } /* * Returns the latest revision on or before in RCS file . */ static const delta_t * _rcs_find_rev_before(const rcs_t *rcs, const char *rev) { char *branch; const delta_t *delta, *result; int trunk; assert(rcs && rcs->delta_list); assert(rev && rcs_rev_is_valid(rev)); branch = rcs_rev_to_branch(rev); /* The trunk is in reverse. */ trunk = (strchr(branch, '.') == NULL); delta = _rcs_get_base(rcs, branch); FREE(branch); if (!delta) return NULL; result = NULL; while (delta && (!trunk || !result)) { const char *r, *dot; r = delta_get_revision(delta); dot = strrchr(r, '.'); assert(dot); if (strncmp(rev, r, (size_t) (dot - r + 1))) break; if (_revcmp(r, rev) <= 0) result = delta; delta = delta_get_next(delta); } if (!result) error(0, 0, "%s: revision %s is too low", rcs->filename, rev); return result; } /* * Returns if it is not a valid symbol in RCS file , or the * corresponding revision if it is. In the last case it also checks that * consists only of valid RCS ID characters. */ static const char * _rcs_resolve_symbol(const rcs_t *rcs, const char *symbol) { const char *rev, *c; assert(rcs); assert(rcs->symbols); assert(symbol); rev = rcs_get_symbol(rcs, symbol); if (rev) return rev; for (c = symbol; *c && !_isidchar(*c); c++) ; if (*c) return NULL; return symbol; } /* * Appends the resolved value of symbol to , updating length * *. RCS file is used to look up the . Returns -1 on error, * otherwise 0. */ static int _rcs_append_component( const rcs_t *rcs, const char *symbol, char **rev, size_t *len ) { const char *r; assert(rcs); assert(symbol); assert(rev && *rev); assert(len); r = _rcs_resolve_symbol(rcs, symbol); if (!r) return -1; *len += strlen(r) + ((*rev)[0] ? 1 : 0); *rev = REALLOC(*rev, *len + 1, char); if ((*rev)[0]) strcat(*rev, "."); strcat(*rev, r); return 0; } /* * Returns the locker of revision for RCS file , or NULL if that * revision is not locked. */ const char * rcs_get_locker(const rcs_t *rcs, const char *rev) { hash_iter_t iter; assert(rcs); assert(rev && rcs_rev_is_valid(rev)); for (iter = hash_iter(rcs->locks); iter; iter = hash_next(iter)) if ( !strcmp(rev, delta_get_revision((const delta_t *)hash_get_value(iter))) ) { const char *locker = hash_get_key(iter); hash_iter_free(iter); return locker; } hash_iter_free(iter); return NULL; } /* * Returns a resolved version of RCS revision for RCS file , given * additional restrictions , and , or NULL on error. */ char * rcs_resolve_tag( const rcs_t *rcs, const char *tag, time_t date, long zone_offset, const char *author, const char *state ) { char *rev; int is_branch; assert(rcs); is_branch = 0; if (!tag || !*tag) { /* If tag wasn't specified, choose the default branch. */ rev = strdup(rcs->branch); is_branch = 1; } else { char *copy, *dot, *start, *end; size_t len; if (tag[0] == '.') { /* Start with the default branch. */ rev = strdup(rcs->branch); len = strlen(rev); tag++; } else { /* Start with nothing. */ rev = strdup(""); len = 0; } /* * We're going to inch our way along tag, marking off each * component in turn. */ start = copy = strdup(tag); end = copy + strlen(copy); for (start = copy; (dot = strchr(start, '.')); start = dot + 1) { *dot = '\0'; if (_rcs_append_component(rcs, start, &rev, &len)) { error(0, 0, "%s: could not resolve symbol %s", rcs->filename, start); FREE(copy); FREE(rev); return NULL; } } /* * We're at the last component. If it's not empty, resolve * it, then extract the branch. */ if (start != end) { if (_rcs_append_component(rcs, start, &rev, &len)) { error(0, 0, "%s: could not resolve symbol %s", rcs->filename, start); FREE(copy); FREE(rev); return NULL; } is_branch = rcs_branch_is_valid(rev); } else { /* * Otherwise, we have any empty final component. The rev * is only valid if we have collected a branch so far. */ if (!rcs_branch_is_valid(rev)) { error(0, 0, "%s: %s is not a valid branch", rcs->filename, rev); FREE(copy); FREE(rev); return NULL; } is_branch = 1; } FREE(copy); } /* * If it's a branch, find the appropriate rev. */ if (is_branch) { char *result = _rcs_find_rev(rcs, rev, date, author, state, zone_offset); FREE(rev); return result; } else { const delta_t *delta; delta = rcs_get_delta(rcs, rev); if (!delta) { delta = _rcs_find_rev_before(rcs, rev); if (!delta) { FREE(rev); return NULL; } } if ((date >= 0) && (delta_get_date(delta) > date)) { char *date_str = date_sprintf(delta_get_date(delta), zone_offset); error( 0, 0, "%s: revision %s has date %s", rcs->filename, rev, date_str ); FREE(date_str); FREE(rev); return NULL; } if (author && strcmp(delta_get_author(delta), author)) { error( 0, 0, "%s: revision %s has author %s", rcs->filename, rev, delta_get_author(delta) ); FREE(rev); return NULL; } if (state && strcmp(delta_get_state(delta), state)) { error( 0, 0, "%s: revision %s has state %s", rcs->filename, rev, delta_get_state(delta) ); FREE(rev); return NULL; } FREE(rev); return strdup(delta_get_revision(delta)); } } blame-1.4-20240206/src/blame.c0000644000000000000000000005036114560275307014062 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004, 2005 Michael Chapman * Copyright 2024 Thomas E. Dickey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #if HAVE_LOCALE_H # include #endif /* HAVE_LOCALE_H */ #include #include #include #include #include #include #include #include #include #include /* * Program name for errors. */ extern const char *program_name; /* * Package name/bug address for argp */ const char *argp_program_version = PACKAGE_STRING " (" PACKAGE_DATE "); emulating RCS version 5"; const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">"; /* * A slash-separated list of RCS suffixes. * If NULL, the macro SUFFIXES will be used instead. */ char *suffixes; /* * The version of RCS to emulate. */ unsigned int rcs_emulation; /* * A global obstack for lines read in from RCS files. */ obstack_t blame_lines_obstack; /* * The time zone to use for date parsing and printing. * If NULL, use localtime. */ static char *zone; static vector_t *filenames; /* Non-option arguments */ static char *tag_arg; /* Argument to -r, --rev */ static char *date_arg; /* Argument to -d, --date */ static char *author_arg; /* Argument to -w, --author */ static char *state_arg; /* Argument to -s, --state */ static expand_t expand; /* Argument to -k, --expand */ static char *symbol; /* Argument to -r, --rev (only if it was a single symbol) */ static time_t date; /* Parsed value of date_arg */ static long zone_offset; /* Parsed value of zone */ static int failures; /* True iff a failure occurred */ static int parsing_rcsinit; /* True iff argument parsing is not strict */ /* * Whether we should free everything at the end. */ static int cleanup; /* * Annotate revision of (with working filename ). * Returns -1 on error, 0 otherwise. */ static int annotate_revision(const char *filename, const rcs_t *rcs, const char *rev) { char *copy, *dot; size_t length, total_length; const delta_t *delta, *save, *target; lines_t *lines, *spare, *dup; unsigned int i; expand_t rcs_expand; int result; result = -1; assert(rcs); assert(rev && rcs_rev_is_valid(rev)); rcs_expand = expand; if (rcs_expand == EXPAND_UNDEFINED) rcs_expand = rcs_get_expand(rcs); if (rcs_expand == EXPAND_UNDEFINED) rcs_expand = EXPAND_KEY_VALUE; /* * Print the banner immediately after parsing the RCS file. * TODO: Add a -q, --quiet option? */ fprintf(stderr, "\nAnnotations for %s\n***************\n", filename); total_length = strlen(rev); copy = strdup(rev); /* * Find the second dot (or end-of-string). All deltas with a single dot * are on the trunk. */ dot = strchr(copy, '.'); assert(dot); /* since rcs_rev_is_valid(rev) */ dot = strchrnul(dot + 1, '.'); *dot = '\0'; length = (size_t) (dot - copy); /* * Start from the head revision. */ delta = rcs_get_head(rcs); lines = lines_dup(delta->text, rcs->lines); spare = lines_new_with_capacity(rcs->lines); target = rcs_get_delta(rcs, copy); while (delta != target) { lines_t *temp; const delta_t *next = delta_get_next(delta); assert(next); /* since rev exists and is reachable */ if (lines_apply(lines, spare, delta, next, 1)) { error( 0, 0, "%s: could not apply diff between revisions %s and %s", rcs_get_filename(rcs), delta_get_revision(delta), delta_get_revision(next) ); goto fail; } temp = lines; lines = spare; spare = temp; delta = next; } /* * We've found the branch point. Duplicate the line buffer, and continue * on the trunk until we hit the end. This will update the original line * buffer with ownership info for each line. */ dup = lines_dup(lines, rcs->lines); save = delta; while (delta) { const delta_t *next = delta_get_next(delta); if (next) { lines_t *temp; if (lines_apply(dup, spare, delta, next, 1)) { error( 0, 0, "%s: could not apply diff between revisions %s and %s", rcs_get_filename(rcs), delta_get_revision(delta), delta_get_revision(next) ); lines_free(dup); goto fail; } temp = dup; dup = spare; spare = temp; } else lines_finalize(dup, delta); delta = next; } lines_free(dup); delta = save; /* * Back to the branch point. */ while (length != total_length) { lines_t *temp; const delta_t *next; *dot = '.'; dot = strchr(dot + 1, '.'); assert(dot); /* since rcs_rev_is_valid(rev) */ /* * Look up the branch. */ *dot = '\0'; next = delta_get_branch(delta, copy); assert(next); /* since rev exists and is reachable */ if (lines_apply(lines, spare, delta, next, 0)) { error( 0, 0, "%s: could not apply diff between revisions %s and %s", rcs_get_filename(rcs), delta_get_revision(delta), delta_get_revision(next) ); goto fail; } temp = lines; lines = spare; spare = temp; delta = next; *dot = '.'; dot = strchrnul(dot + 1, '.'); *dot = '\0'; length = (size_t) (dot - copy); /* * Continue along this branch until we find the correct revision or another * branch point. */ target = rcs_get_delta(rcs, copy); while (delta != target) { next = delta_get_next(delta); if (lines_apply(lines, spare, delta, next, 0)) { error( 0, 0, "%s: could not apply diff between revisions %s and %s", rcs_get_filename(rcs), delta_get_revision(delta), delta_get_revision(next) ); goto fail; } temp = lines; lines = spare; spare = temp; delta = next; } } /* * OK, should have ownership info for each line in the selected revision. * For each line, we print out the owner's revision, author and date, * followed by an expanded version of the line. */ for (i = 0; i < lines_count(lines); i++) { const line_t *line = lines_get(lines, i); /* * If the final line is empty, don't print anything. */ if ((i + 1 == lines_count(lines)) && !line->len) break; keyword_annotate(line, rcs, rcs_expand, symbol, zone_offset); } result = 0; fail: if (cleanup) { lines_free(lines); lines_free(spare); FREE(copy); } return result; } /* * Annotate / (one of which must be specified). * Returns -1 on error, 0 otherwise. */ static int annotate(const char *working_filename, const char *rcs_filename) { rcs_t *rcs; char *working_filename2, *rcs_filename2; char *tag, *rev; int result; OINIT(&blame_lines_obstack); result = -1; assert(working_filename || rcs_filename); rcs = NULL; working_filename2 = rcs_filename2 = NULL; tag = rev = NULL; /* * Resolve a missing working_filename or rcs_filename. */ if (!rcs_filename) rcs_filename2 = find_matching_rcs_filename(working_filename); else rcs_filename2 = strdup(rcs_filename); if (!rcs_filename2) goto fail; if (!working_filename) working_filename2 = find_matching_working_filename(rcs_filename); else working_filename2 = strdup(working_filename); assert(is_rcs_filename(rcs_filename2)); assert(!is_rcs_filename(working_filename2)); /* * If a tag is specified, extract it from the working file if it is "$". * The value in the working file can have symbols in it, but it can't * contain "..". */ tag = NULL; if (tag_arg) { if (!strcmp(tag_arg, "$")) { tag = working_extract_revision(working_filename2); if (!tag) goto fail; if (!rcs_rev_is_valid(tag)) { error(0, 0, "%s: %s is not a revision number", working_filename2, tag); goto fail; } } else tag = strdup(tag_arg); } /* * Read in the RCS file. If this succeeds, the delta tree is guaranteed to * be valid (no loops, all deltas reachable, branches on appropriate * deltas, etc.). */ rcs = rcs_parse(rcs_filename2); if (!rcs) goto fail; /* * If there's no head revision, the RCS file is empty (created with * "rcs -i"). No point in going any further. */ if (!rcs_get_head(rcs)) { error(0, 0, "%s: no revisions present", working_filename2); goto fail; } /* * Try to resolve the specified tag. */ rev = rcs_resolve_tag(rcs, tag, date, zone_offset, author_arg, state_arg); if (!rev) goto fail; /* * Save the tag if it was a single symbol. We need this in case we expand * any Symbol keywords. */ if (tag && rcs_get_symbol(rcs, tag)) symbol = tag; else symbol = NULL; /* * We know the numerical revision we want, and we know it's somewhere in * delta tree. Annotate it. */ result = annotate_revision(working_filename2, rcs, rev); fail: if (cleanup) { if (rcs) rcs_free(rcs); if (working_filename2) FREE(working_filename2); if (rcs_filename2) FREE(rcs_filename2); if (tag) FREE(tag); if (rev) FREE(rev); OFREEALL(&blame_lines_obstack); } return result; } /* * Parse command line option , with argument . Current parser state * is in . */ static error_t parse_options(int key, char *arg, struct argp_state *state) { static const char *working_filename; static const char *rcs_filename; switch (key) { case '?': argp_state_help(state, state->out_stream, ARGP_HELP_STD_HELP); break; case 0x80: argp_state_help(state, state->out_stream, ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK); break; case 'V': if (arg) { switch (*arg) { case '3': case '4': case '5': if (!*(arg + 1)) { rcs_emulation = (unsigned) (*arg - '0'); break; } /* FALLTHRU */ default: argp_failure( state, EXIT_FAILURE, 0, "invalid RCS emulation version %s", arg ); assert(parsing_rcsinit); break; } } else { fprintf(state->out_stream, "%s\n", argp_program_version); if (!(state->flags & ARGP_NO_EXIT)) exit(EXIT_SUCCESS); } break; case 'r': /* --rev */ if (tag_arg) { argp_failure( state, EXIT_FAILURE, 0, "multiple revision options may not be specified" ); assert(parsing_rcsinit); FREE(tag_arg); } tag_arg = (arg ? strdup(arg) : strdup("")); break; case 'd': /* --date */ assert(arg); /* argument is mandatory */ if (date_arg) { argp_failure( state, EXIT_FAILURE, 0, "multiple date options may not be specified" ); assert(parsing_rcsinit); FREE(date_arg); } date_arg = strdup(arg); break; case 'w': /* --author */ if (author_arg) { argp_failure( state, EXIT_FAILURE, 0, "multiple author options may not be specified" ); assert(parsing_rcsinit); FREE(author_arg); author_arg = NULL; } if (arg) author_arg = strdup(arg); else { struct passwd *pw; /* * Use the user's username. */ pw = getpwuid(getuid()); if (!pw) { /* They've probably disappeared out of /etc/passwd. */ argp_failure(state, EXIT_FAILURE, 0, "could not determine username"); break; } author_arg = strdup(pw->pw_name); } break; case 's': /* --state */ assert(arg); /* argument is mandatory */ if (state_arg) { argp_failure( state, EXIT_FAILURE, 0, "multiple state options may not be specified" ); assert(parsing_rcsinit); FREE(state_arg); } state_arg = strdup(arg); break; case 'x': /* --suffixes */ assert(arg); /* argument is mandatory */ if (suffixes) { argp_failure( state, EXIT_FAILURE, 0, "multiple suffixes options may not be specified" ); assert(parsing_rcsinit); FREE(suffixes); } suffixes = strdup(arg); break; case 'z': /* --zone */ assert(arg); /* argument is mandatory */ if (zone) { argp_failure( state, EXIT_FAILURE, 0, "multiple default time zone options may not be specified" ); assert(parsing_rcsinit); FREE(zone); } zone = strdup(arg); break; case 'k': /* --expand */ assert(arg); /* argument is mandatory */ if (expand != EXPAND_UNDEFINED) { argp_failure( state, EXIT_FAILURE, 0, "multiple keyword substitution types may not be specified" ); assert(parsing_rcsinit); } if (!strcmp(arg, "kv")) { expand = EXPAND_KEY_VALUE; break; } else if (!strcmp(arg, "kvl")) { expand = EXPAND_KEY_VALUE_LOCKER; break; } else if (!strcmp(arg, "k")) { expand = EXPAND_KEY_ONLY; break; } else if (!strcmp(arg, "o")) { expand = EXPAND_OLD_STRING; break; } else if (!strcmp(arg, "b")) { expand = EXPAND_BINARY_STRING; break; } else if (!strcmp(arg, "v")) { expand = EXPAND_VALUE_ONLY; break; } else { argp_failure( state, EXIT_FAILURE, 0, "invalid keyword substitution type %s", arg ); break; } case ARGP_KEY_ARG: assert(arg); /* argument is mandatory */ vector_append(filenames, arg); break; case ARGP_KEY_END: if (!parsing_rcsinit) { unsigned int i; if (!vector_count(filenames)) { argp_failure(state, EXIT_FAILURE, 0, "no files specified"); assert(0); } /* * Resolve the zone, if it was specified. */ zone_offset = TM_UNDEFINED_ZONE; if (zone && !date_parse_zone(zone, &zone_offset)) { argp_failure(state, EXIT_FAILURE, 0, "invalid time zone: %s", zone); break; } /* * Check the tag doesn't contain "..", if it was specified. */ if (tag_arg) { if (strstr(tag_arg, "..")) { argp_failure( state, EXIT_FAILURE, 0, "missing tag component: %s", tag_arg ); break; } } /* * Resolve the date, if it was specified. */ if (date_arg) { date = date_parse(date_arg, !!zone, zone_offset); if (date < 0) { argp_failure(state, EXIT_FAILURE, 0, "invalid date: %s", date_arg); break; } } /* * If a matching working filename and RCS filename are beside each * other on the command line, we pair them together. */ for (i = 0; i < vector_count(filenames); i++) { const char *filename; filename = (const char *)vector_get(filenames, i); assert(filename); if (is_rcs_filename(filename)) { if (rcs_filename) failures |= annotate(NULL, rcs_filename); rcs_filename = filename; if (working_filename) { if ( does_working_filename_match_rcs_filename( working_filename, rcs_filename ) ) { #if FASTEXIT if (i == vector_count(filenames) - 1) cleanup = 0; #endif /* FASTEXIT */ failures |= annotate(working_filename, rcs_filename); working_filename = rcs_filename = NULL; } else { failures |= annotate(working_filename, NULL); working_filename = NULL; } } } else { if (working_filename) failures |= annotate(working_filename, NULL); working_filename = filename; if (rcs_filename) { if ( does_working_filename_match_rcs_filename( working_filename, rcs_filename ) ) { #if FASTEXIT if (i == vector_count(filenames) - 1) cleanup = 0; #endif /* FASTEXIT */ failures |= annotate(working_filename, rcs_filename); working_filename = rcs_filename = NULL; } else { failures |= annotate(NULL, rcs_filename); rcs_filename = NULL; } } } /* * If we had both working_filename and rcs_filename we should * have processed at least one of them. */ assert(!working_filename || !rcs_filename); } /* * Handle any remaining working filename or RCS filename. */ #if FASTEXIT cleanup = 0; #endif /* FASTEXIT */ if (working_filename) failures |= annotate(working_filename, NULL); if (rcs_filename) failures |= annotate(NULL, rcs_filename); } break; default: return ARGP_ERR_UNKNOWN; } return 0; } int main(int argc, char **argv) { char *rcsinit; struct argp_option options[] = { { NULL, 0, NULL, 0, "Revision specification options:", 0 }, { "revision", 'r', "REV", OPTION_ARG_OPTIONAL, "Revision to annotate", 0 }, { "rev", 0, NULL, OPTION_HIDDEN | OPTION_ALIAS, NULL, 0 }, { "date", 'd', "DATE", 0, "Date of revision to annotate", 0 }, { "author", 'w', "LOGIN", OPTION_ARG_OPTIONAL, "Author of revision to annotate", 0 }, { "state", 's', "STATE", 0, "State of revision to annotate", 0 }, { NULL, 0, NULL, 0, "Keyword substitution options:", 0 }, { "expand", 'k', "SUBST", 0, "Substitutions performed (kv, kvl, k, o, b, v)", 0 }, { NULL, 0, NULL, 0, "Other options:", 0 }, { "suffixes", 'x', "SUFFIXES", 0, SSLASH "-separated list of RCS suffixes (default: '" SUFFIXES "')", 0 }, { "zone", 'z', "ZONE", 0, "Default time zone (default: 'UTC')", 0 }, { NULL, 0, NULL, 0, "Help options:", -1 }, { "help", '?', NULL, 0, "Give this help list", -1 }, { "usage", 0x80, NULL, 0, "Give a short usage message", -1 }, { "version", 'V', "VER", OPTION_ARG_OPTIONAL, "Print program version; or\n" "Emulate RCS version (default: 5)", -1 }, { NULL, '\0', NULL, 0, NULL, 0 } }; struct argp parser = { NULL, parse_options, "FILE ...", "Annotate RCS files with the last revision where each line was modified.", NULL, NULL, NULL }; parser.options = options; #if HAVE_LOCALE_H && HAVE_SETLOCALE /* * Use the environment's locale, not "C". */ setlocale(LC_ALL, ""); #endif /* HAVE_LOCALE_H && HAVE_SETLOCALE */ set_program_name(argv[0]); argp_err_exit_status = EXIT_FAILURE; failures = 0; rcs_emulation = 5; filenames = vector_new((dup_fn_t)string_dup, (free_fn_t)string_free); tag_arg = date_arg = author_arg = state_arg = NULL; expand = EXPAND_UNDEFINED; suffixes = zone = NULL; date = (time_t)(-1); cleanup = 1; /* * Parse RCSINIT environment variable first, if it exists. * We try to ignore arguments we don't expect. */ parsing_rcsinit = 1; if ( (rcsinit = getenv("RCSINIT")) ) { char *copy, **rcsinit_argv; char *a, *b, *c; int escape, rcsinit_argc; unsigned int spaces = 0; copy = strdup(rcsinit); /* Count spaces */ for (c = copy; *c; c++) if (ISSPACE(*c)) spaces++; rcsinit_argv = MALLOC(spaces + 2, char *); rcsinit_argv[0] = argv[0]; rcsinit_argc = 1; escape = 0; a = b = c = copy; while (1) { if (!*b) { if (a != c) rcsinit_argv[rcsinit_argc++] = c; *a = '\0'; break; } else if (!escape && ISSPACE(*b)) { if (a != c) rcsinit_argv[rcsinit_argc++] = c; *a++ = '\0'; c = a; } else if (!escape && *b == '\\') { escape = 1; } else { escape = 0; *a++ = *b; } b++; } argp_parse( &parser, rcsinit_argc, rcsinit_argv, ARGP_NO_HELP | ARGP_NO_EXIT, /* Warn but don't exit on argp_failure */ NULL, NULL ); /* ignore errors */ FREE(rcsinit_argv); FREE(copy); } parsing_rcsinit = 0; /* * Annotations occur in the parser function's ARGP_KEY_END state. */ failures |= argp_parse(&parser, argc, argv, ARGP_NO_HELP, NULL, NULL); if (cleanup) { vector_free(filenames); if (suffixes) FREE(suffixes); if (zone) FREE(zone); if (tag_arg) FREE(tag_arg); if (date_arg) FREE(date_arg); if (author_arg) FREE(author_arg); if (state_arg) FREE(state_arg); } return (failures ? EXIT_FAILURE : EXIT_SUCCESS); } blame-1.4-20240206/src/keyword.c0000644000000000000000000003550014560262723014462 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004, 2005 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include extern unsigned int rcs_emulation; /* * Returns a newly allocated string containing unescaped. */ static char * _keyword_unescape(const char *s) { const char *end, *escape; char *output; assert(s); end = s + strlen(s); output = SALLOC((size_t)(end - s)); while ( (escape = strchr(s, '\\')) ) { strncat(output, s, (size_t) (escape - s)); switch (escape[1]) { case 't': strcat(output, "\t"); s = escape + 2; break; case 'n': strcat(output, "\n"); s = escape + 2; break; case '\\': strcat(output, "\\"); s = escape + 2; break; case '0': if ( (escape + 3 < end) && (escape[2] == '4') && (escape[3] == '0') ) { strcat(output, " "); s = escape + 4; } else if ( (escape + 3 < end) && (escape[2] == '4') && (escape[3] == '4') ) { strcat(output, "$"); s = escape + 4; } break; } } strcat(output, s); return output; } /* * Returns a newly allocated string containing escaped. */ static char * _keyword_escape(const char *s) { const char *magic; char *output; size_t capacity, len; assert(s); capacity = strlen(s); output = SALLOC(capacity); len = 0; while ( (magic = strpbrk(s, (rcs_emulation >= 5 ? "\t\n $\\" : "\t\n $"))) ) { len += (size_t) (magic - s); switch (*magic) { case '\t': len += 2; if (len > capacity) { capacity = len + 16; output = REALLOC(output, capacity + 1, char); } strncat(output, s, (size_t) (magic - s)); strcat(output, "\\t"); break; case '\n': len += 2; if (len > capacity) { capacity = len + 16; output = REALLOC(output, capacity + 1, char); } strncat(output, s, (size_t) (magic - s)); strcat(output, "\\n"); break; case ' ': len += 4; if (len > capacity) { capacity = len + 16; output = REALLOC(output, capacity + 1, char); } strncat(output, s, (size_t) (magic - s)); strcat(output, "\\040"); break; case '$': len += 4; if (len > capacity) { capacity = len + 16; output = REALLOC(output, capacity + 1, char); } strncat(output, s, (size_t) (magic - s)); strcat(output, "\\044"); break; case '\\': len += 2; if (len > capacity) { capacity = len + 16; output = REALLOC(output, capacity + 1, char); } strncat(output, s, (size_t) (magic - s)); strcat(output, "\\\\"); break; } s = magic + 1; } len += strlen(s); if (len > capacity) { capacity = len + 16; output = REALLOC(output, capacity + 1, char); } strcat(output, s); return output; } /* * Looks for a revision in of length . Returns a newly allocated * string, or NULL if no revision was found. */ char * keyword_extract_revision(const char *line, size_t len) { const char *end, *dollar; char *buffer, *rev; assert(line); end = line + len; rev = NULL; buffer = ALLOCA(256, char); while ( !rev && line && (dollar = (const char *)memchr(line, '$', (size_t) (end - line))) ) { if (sscanf(dollar, "$Id: %*s %255s %*s %*s %*s $", buffer) == 1) rev = _keyword_unescape(buffer); else if (sscanf(dollar, "$Id: %*s %255s %*s %*s %*s %*s $", buffer) == 1) rev = _keyword_unescape(buffer); else if (sscanf(dollar, "$Header: %*s %255s %*s %*s %*s $", buffer) == 1) rev = _keyword_unescape(buffer); else if ( sscanf(dollar, "$Header: %*s %255s %*s %*s %*s %*s $", buffer) == 1 ) rev = _keyword_unescape(buffer); else if (sscanf(dollar, "$Revision: %255s $", buffer) == 1) rev = _keyword_unescape(buffer); else if (sscanf(dollar, "$Name: %255s $", buffer) == 1) rev = _keyword_unescape(buffer); dollar = (const char *)memchr(dollar + 1, '$', (size_t) (end - dollar - 1)); if (dollar) dollar++; line = dollar; } return rev; } /* * Outputs , of length , to stdout, replacing each occurrence of * @@ with @. */ static inline void _keyword_shrink_output(const void *data, size_t len) { assert(data); while (len) { char *at = memchr(data, '@', len); if (!at) break; fwrite(data, (size_t) VOIDP_DIFF(at, data) + 1, 1, stdout); if (*(const char *)VOIDP_OFFSET(at, 1) == '@') { len -= (size_t) VOIDP_DIFF(at, data) + 2; data = VOIDP_OFFSET(at, 2); } else { len -= (size_t) VOIDP_DIFF(at, data) + 1; data = VOIDP_OFFSET(at, 1); } } if (len) fwrite(data, len, 1, stdout); } /* * Annotates and outputs it to stdout. */ void keyword_annotate( const line_t *line, const struct rcs *rcs, expand_t expand, const char *symbol, long zone_offset ) { const void *current, *end, *log_start, *log_end; size_t len; char prefix[36]; int do_prefix; assert(line); assert(rcs); sprintf(prefix, "%-12s (%-8.8s ", delta_get_revision(line->delta), delta_get_author(line->delta) ); date_sprintf_prefix(delta_get_date(line->delta), prefix + 23, 10); strcat(prefix, "): "); current = line->text; len = line->len; end = VOIDP_OFFSET(current, len); do_prefix = 1; if (rcs_emulation >= 5) { log_start = current; log_end = NULL; } else { log_start = rcs_get_comment(rcs); log_end = VOIDP_OFFSET(log_start, strlen((const char *)log_start)); } while (current < end) { size_t chunk_len; const void *delim, *delim2, *next; if (do_prefix) { fputs(prefix, stdout); do_prefix = 0; } chunk_len = strcspn(current, ( expand == EXPAND_OLD_STRING || expand == EXPAND_BINARY_STRING ? "@\n" : "$@\n" )); delim = VOIDP_OFFSET(current, chunk_len); switch (*(const char *)delim) { case '$': fwrite(current, chunk_len, 1, stdout); delim2 = memchr(VOIDP_OFFSET(delim, 1), '$', (size_t) (VOIDP_DIFF(end, delim) - 1)); if (!delim2) { putchar('$'); current = VOIDP_OFFSET(delim, 1); break; } if (!memcmp(delim, "$Author", 7)) { if (expand != EXPAND_VALUE_ONLY) fputs("$Author", stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) fputs(": ", stdout); if (expand != EXPAND_KEY_ONLY) fputs(delta_get_author(line->delta), stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) putchar(' '); if (expand != EXPAND_VALUE_ONLY) putchar('$'); } else if (!memcmp(delim, "$Date", 5)) { if (expand != EXPAND_VALUE_ONLY) fputs("$Date", stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) fputs(": ", stdout); if (expand != EXPAND_KEY_ONLY) { char *t = date_sprintf(delta_get_date(line->delta), zone_offset); fputs(t, stdout); FREE(t); } if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) putchar(' '); if (expand != EXPAND_VALUE_ONLY) putchar('$'); } else if (!memcmp(delim, "$Header", 7) || !memcmp(delim, "$Id", 3)) { if (expand != EXPAND_VALUE_ONLY) { if (*(const char *)VOIDP_OFFSET(delim, 1) == 'H') fputs("$Header", stdout); else fputs("$Id", stdout); } if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) fputs(": ", stdout); if (expand != EXPAND_KEY_ONLY) { char *t1 = _keyword_escape( (*(const char *)VOIDP_OFFSET(delim, 1) == 'H') && (rcs_emulation >= 4) ? rcs_get_full_filename(rcs) : rcs_get_short_filename(rcs) ); char *t2 = date_sprintf(delta_get_date(line->delta), zone_offset); const char *t3; printf( "%s %s %s %s ", t1, delta_get_revision(line->delta), t2, delta_get_author(line->delta) ); FREE(t1); FREE(t2); switch (rcs_emulation) { case 3: if (rcs_get_locker(rcs, delta_get_revision(line->delta))) fputs("Locked", stdout); break; case 4: fputs(delta_get_state(line->delta), stdout); if ( (t3 = rcs_get_locker(rcs, delta_get_revision(line->delta))) ) printf(" Locker: %s", t3); break; default: fputs(delta_get_state(line->delta), stdout); if ( expand == EXPAND_KEY_VALUE_LOCKER && (t3 = rcs_get_locker(rcs, delta_get_revision(line->delta))) ) printf(" %s", t3); break; } } if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) putchar(' '); if (expand != EXPAND_VALUE_ONLY) putchar('$'); } else if (!memcmp(delim, "$Locker", 7)) { if (expand != EXPAND_VALUE_ONLY) fputs("$Locker", stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) fputs(": ", stdout); if (rcs_emulation <= 4 || expand == EXPAND_KEY_VALUE_LOCKER) { const char *t = rcs_get_locker(rcs, delta_get_revision(line->delta)); if (t) fputs(t, stdout); } if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) putchar(' '); if (expand != EXPAND_VALUE_ONLY) putchar('$'); } else if (!memcmp(delim, "$Log", 4)) { char *t; const char *log, *n; int local_log_prefix = 0; if (expand != EXPAND_VALUE_ONLY) fputs("$Log", stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) { if (rcs_emulation >= 5) fputs(": ", stdout); else fputs(":\t", stdout); } if (expand != EXPAND_KEY_ONLY) { t = _keyword_escape(rcs_get_short_filename(rcs)); fputs(t, stdout); FREE(t); } if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) putchar(' '); if (expand != EXPAND_VALUE_ONLY) putchar('$'); /* Strangely, rcs outputs the log even with if -kk is specified... */ if (rcs_emulation >= 5) { const void *t2; log_end = delim; for (t2 = log_start; t2 < log_end; t2 = VOIDP_OFFSET(t2, 1)) if (!ISSPACE(*(const char *)t2)) break; if ( (const char *)t2 < ((const char *)(log_end) - 2) && (*(const char *)t2 == '/' || *(const char *)t2 == '(') && *(const char *)VOIDP_OFFSET(t2, 1) == '*' ) { void *t3; local_log_prefix = 1; t3 = MALLOC((size_t)((const char *)log_end - (const char *)log_start), char); memcpy(t3, log_start, (size_t)((const char *)log_end - (const char *)log_start)); *CHARP_OFFSET(t3, ((const char *)t2 - (const char *)log_start)) = ' '; log_end = VOIDP_OFFSET(t3, (size_t)((const char *)log_end - (const char *)log_start)); log_start = t3; } } printf("\n%s", prefix); _keyword_shrink_output(log_start, (size_t) VOIDP_DIFF(log_end, log_start)); printf("Revision %s ", delta_get_revision(line->delta)); t = date_sprintf(delta_get_date(line->delta), zone_offset); if (rcs_emulation >= 5) { fputs(t, stdout); } else { char *t2 = strchrnul(t, ' '); if (*t2) *t2++ = '\0'; printf("%s %s", t, t2); } FREE(t); printf(" %s\n%s", delta_get_author(line->delta), prefix); log = delta_get_log(line->delta); while ( (n = strchr(log, '\n')) ) { _keyword_shrink_output(log_start, (size_t) VOIDP_DIFF(log_end, log_start)); _keyword_shrink_output(log, (size_t) (n - log + 1)); fputs(prefix, stdout); log = n + 1; } _keyword_shrink_output(log_start, (size_t) VOIDP_DIFF(log_end, log_start)); fputs(log, stdout); if (rcs_emulation >= 5) { if (local_log_prefix) { void *alias = (void *)log_start; FREE(alias); } current = delim2; do { current = VOIDP_OFFSET(current, 1); } while ( *(const char *)current && ISSPACE(*(const char *)current) && *(const char *)current != '\n' ); continue; } } else if (!memcmp(delim, "$Name", 5)) { if (expand != EXPAND_VALUE_ONLY) fputs("$Name", stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) fputs(": ", stdout); if (expand != EXPAND_KEY_ONLY && symbol) fputs(symbol, stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) putchar(' '); if (expand != EXPAND_VALUE_ONLY) putchar('$'); } else if (!memcmp(delim, "$RCSfile", 8)) { if (expand != EXPAND_VALUE_ONLY) fputs("$RCSfile", stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) fputs(": ", stdout); if (expand != EXPAND_KEY_ONLY) { char *t = _keyword_escape(rcs_get_short_filename(rcs)); fputs(t, stdout); FREE(t); } if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) putchar(' '); if (expand != EXPAND_VALUE_ONLY) putchar('$'); } else if (!memcmp(delim, "$Revision", 9)) { if (expand != EXPAND_VALUE_ONLY) fputs("$Revision", stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) fputs(": ", stdout); if (expand != EXPAND_KEY_ONLY) fputs(delta_get_revision(line->delta), stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) putchar(' '); if (expand != EXPAND_VALUE_ONLY) putchar('$'); } else if (!memcmp(delim, "$Source", 7)) { if (expand != EXPAND_VALUE_ONLY) fputs("$Source", stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) fputs(": ", stdout); if (expand != EXPAND_KEY_ONLY) { char *t = _keyword_escape(rcs_get_full_filename(rcs)); fputs(t, stdout); FREE(t); } if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) putchar(' '); if (expand != EXPAND_VALUE_ONLY) putchar('$'); } else if (!memcmp(delim, "$State", 6)) { if (expand != EXPAND_VALUE_ONLY) fputs("$State", stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) fputs(": ", stdout); if (expand != EXPAND_KEY_ONLY) fputs(delta_get_state(line->delta), stdout); if (expand != EXPAND_KEY_ONLY && expand != EXPAND_VALUE_ONLY) putchar(' '); if (expand != EXPAND_VALUE_ONLY) putchar('$'); } else { putchar('$'); delim2 = delim; } current = VOIDP_OFFSET(delim2, 1); break; case '@': if (delim >= end) { fwrite(current, chunk_len, 1, stdout); return; } next = VOIDP_OFFSET(delim, 1); fwrite(current, (size_t) VOIDP_DIFF(next, current), 1, stdout); current = (*(const char *)next == '@' ? VOIDP_OFFSET(next, 1) : next); break; case '\n': fwrite(current, chunk_len + 1, 1, stdout); current = VOIDP_OFFSET(delim, 1); do_prefix = 1; break; case '\0': fwrite(current, chunk_len + 1, 1, stdout); current = VOIDP_OFFSET(delim, 1); break; } } } blame-1.4-20240206/src/Makefile.in0000644000000000000000000000651514560274663014711 0ustar rootroot# $Id: Makefile.in,v 1.10 2024/02/06 00:13:39 tom Exp $ # Copyright 2022,2024 Thomas E. Dickey # makefile-template for autoconf @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ datarootdir = @datarootdir@ datadir = @datadir@ THIS = blame ACTUAL = `echo $(THIS) | sed '$(transform)'` transform = @program_transform_name@ top_builddir = .. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ OBJEXT = @OBJEXT@ EXEEXT = @EXEEXT@ PROGRAMS = $(THIS)$(EXEEXT) OBJECTS = \ blame.$(OBJEXT) \ date.$(OBJEXT) \ delta.$(OBJEXT) \ hash.$(OBJEXT) \ keyword.$(OBJEXT) \ lexer.$(OBJEXT) \ lines.$(OBJEXT) \ parser.$(OBJEXT) \ rcs.$(OBJEXT) \ util.$(OBJEXT) \ vector.$(OBJEXT) \ working.$(OBJEXT) PACKAGE_STRING = "@PACKAGE_STRING@" PACKAGE_DATE = "@PACKAGE_DATE@" PACKAGE_BUGREPORT = "@PACKAGE_BUGREPORT@" CC = @CC@ CPP = @CPP@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ CFLAGS = @CFLAGS@ $(EXTRA_CFLAGS) EXTRA_CPPFLAGS = @EXTRA_CPPFLAGS@ \ -DPACKAGE_STRING=\"$(PACKAGE_STRING)\" \ -DPACKAGE_DATE=\"$(PACKAGE_DATE)\" \ -DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" CPPFLAGS = @DEFS@ @CPPFLAGS@ -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/lib CYGPATH_W = @CYGPATH_W@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ COMPILE = $(CC) $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CFLAGS) LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LEXCOMPILE = $(LEX) $(LFLAGS) YACC = @YACC@ YACCCOMPILE = $(YACC) $(YFLAGS) SOURCES = \ blame.c \ data.h \ date.c date.h \ delta.c delta.h \ hash.c hash.h \ keyword.c keyword.h \ lexer.l \ lines.c lines.h \ parser.y \ rcs.c rcs.h \ system.h \ util.c util.h \ vector.c vector.h \ working.c working.h MY_LIBS = $(top_builddir)/lib/libmisc.a BUILT_SOURCES = parser.h all: $(BUILT_SOURCES) $(PROGRAMS) .SUFFIXES: .SUFFIXES: .c .i .l .o .obj .y $(DESTDIR)$(bindir): mkdir -p $@ install: $(PROGRAMS) $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) "$(THIS)$(EXEEXT)" "$(DESTDIR)$(bindir)/$(ACTUAL)$(EXEEXT)" uninstall: rm -f "$(DESTDIR)$(bindir)/$(ACTUAL)$(EXEEXT)" parser.h: parser.c @if test ! -f $@; then \ rm -f parser.c; \ $(MAKE) parser.c; \ else :; fi $(THIS)$(EXEEXT): $(OBJECTS) $(MY_LIBS) -@rm -f $@ @ECHO_LD@$(LINK) $(LDFLAGS) $(OBJECTS) $(MY_LIBS) $(LIBS) .c.o: @RULE_CC@ @ECHO_CC@$(COMPILE) -c $< .c.i: @RULE_CC@ @ECHO_CC@$(CPP) $(CPPFLAGS) -C $< >$@ .c.obj: @RULE_CC@ @ECHO_CC@$(COMPILE) -c `$(CYGPATH_W) '$<'` .l.c: $(LEXCOMPILE) $< sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@ rm -f $(LEX_OUTPUT_ROOT).c .y.c: $(YACCCOMPILE) $< if test -f y.tab.h; then \ to=`echo "$*_H" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|$*.h|" \ y.tab.h >$*.ht; \ rm -f y.tab.h; \ if cmp -s $*.ht $*.h; then \ rm -f $*.ht ;\ else \ mv $*.ht $*.h; \ fi; \ fi if test -f y.output; then \ mv y.output $*.output; \ fi sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@ rm -f y.tab.c check: clean: -rm -f *.tab.c -rm -f *.$(OBJEXT) *.i -rm -f $(THIS)$(EXEEXT) distclean: clean -rm -f Makefile .PHONY: all check clean distclean install uninstall blame-1.4-20240206/src/util.h0000644000000000000000000000213014557463444013762 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _UTIL_H #define _UTIL_H #include int does_working_filename_match_rcs_filename (const char *, const char *); int is_rcs_filename (const char *); char * find_matching_rcs_filename (const char *); char * find_matching_working_filename (const char *); extern char *suffixes; #endif /* _UTIL_H */ blame-1.4-20240206/src/date.c0000644000000000000000000006621614557310662013725 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004, 2005 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * I've taken this from RCS v5.7, cleaned it up (a bit), bugfixed it (a bit) * and simplified it (a bit). Still don't fully understood though. * * Original copyright: * Copyright 1993, 1994, 1995 Paul Eggert * Distributed under license by the Free Software Foundation, Inc. */ #include #if HAVE_LANGINFO_H # include #endif /* HAVE_LANGINFO_H */ #include #include #include #define TM_UNDEFINED (-1) #define TM_DEFINED(x) (0 <= (x)) #define TM_YEAR_ORIGIN 1900 extern unsigned int rcs_emulation; struct parse_state { struct tm tm; int ymodulus; int yweek; long zone; }; struct time_zone { const char *name; int offset; }; /* Taken from PostgreSQL docs, merged with original RCS list. */ static const struct time_zone zones[] = { { "NZDT", +1300 }, { "IDLE", +1200 }, { "NZST", +1200 }, { "NZT", +1200 }, { "AESST", +1100 }, { "ACSST", +1030 }, { "CADT", +1030 }, { "SADT", +1030 }, { "AEST", +1000 }, { "EAST", +1000 }, { "GST", +1000 }, { "LIGT", +1000 }, { "JDT", +1000 }, { "KDT", +900 }, { "SAST", +930 }, { "CAST", +930 }, { "AWSST", +900 }, { "JST", +900 }, { "KST", +900 }, { "MHT", +900 }, { "WDT", +900 }, { "MT", +830 }, { "AWST", +800 }, { "CCT", +800 }, { "WADT", +800 }, { "WST", +800 }, { "JT", +730 }, { "ALMST", +700 }, { "WAST", +700 }, { "CXT", +700 }, { "MMT", +630 }, { "ALMT", +600 }, { "MAWT", +600 }, { "IOT", +500 }, { "MVT", +500 }, { "TFT", +500 }, { "AFT", +430 }, { "EAST", +400 }, { "MUT", +400 }, { "RET", +400 }, { "SCT", +400 }, { "IRT", +330 }, { "IT", +330 }, { "EAT", +300 }, { "BT", +300 }, { "HMT", +300 }, { "BDST", +200 }, { "CEST", +200 }, { "EET", +200 }, { "FWT", +200 }, { "IST", +200 }, { "MEST", +200 }, { "SST", +200 }, { "BST", +100 }, { "CET", +100 }, { "DNT", +100 }, { "FST", +100 }, { "MET", +100 }, { "MEWT", +100 }, { "MEZ", +100 }, { "NOR", +100 }, { "SET", +100 }, { "SWT", +100 }, { "BST", 000 }, { "GMT", 000 }, { "UT", 000 }, { "UTC", 000 }, { "CUT", 000 }, { "Z", 000 }, { "ZULU", 000 }, { "WET", 000 }, { "WAT", -100 }, { "FNST", -100 }, { "FNT", -200 }, { "BRST", -200 }, { "NDT", -230 }, { "ADT", -300 }, { "AWT", -300 }, { "BRT", -300 }, { "NFT", -330 }, { "NST", -330 }, { "AST", -400 }, { "ACST", -400 }, { "EDT", -400 }, { "ACT", -500 }, { "CDT", -500 }, { "EST", -500 }, { "CST", -600 }, { "MDT", -600 }, { "MST", -700 }, { "PDT", -700 }, { "AKDT", -800 }, { "PST", -800 }, { "YDT", -800 }, { "AKST", -900 }, { "HDT", -900 }, { "HADT", -900 }, { "YST", -900 }, { "MART", -930 }, { "AHST", -1000 }, { "HST", -1000 }, { "HAST", -1000 }, { "CAT", -1000 }, { "NT", -1100 }, { "IDLW", -1200 }, { "LT", 1 }, { NULL, 0 } }; #if ! HAVE_NL_LANGINFO static const char * const standard_months[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", 0 }; static const char * const standard_ab_months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", 0 }; static const char * const standard_days[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", 0 }; static const char * const standard_ab_days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", 0 }; #endif /* ! HAVE_NL_LANGINFO */ /* * Array of patterns to look for in a date string. * Order is important: we look for the first matching pattern * whose values do not contradict values that we already know about. * See `parse_pattern_letter' below for the meaning of the pattern codes. */ static const char * const patterns[] = { /* * These traditional patterns must come first, * to prevent an ISO 8601 format from misinterpreting their prefixes. */ "E_n_y", "x", /* RFC 822 */ "E_n", "n_E", "n", "t:m:s_A", "t:m_A", "t_A", /* traditional */ "y/N/D$", /* traditional RCS */ /* ISO 8601:1988 formats, generalized a bit. */ "y-N-D$", "4ND$", "Y-N$", "RND$", "-R=N$", "-R$", "--N=D$", "N=DT", "--N$", "---D$", "DT", "Y-d$", "4d$", "R=d$", "-d$", "dT", "y-W-X", "yWX", "y=W", "-r-W-X", "r-W-XT", "-rWX", "rWXT", "-W=X", "W=XT", "-W", "-w-X", "w-XT", "---X$", "XT", "4$", "T", "h:m:s$", "hms$", "h:m$", "hm$", "h$", "-m:s$", "-ms$", "-m$", "--s$", "Y", "Z", NULL }; /* * Parse an initial prefix of S of length DIGITS; it must be a number. * Store the parsed number into *RES. * Return the first character after the prefix, or 0 if it couldn't be parsed. */ static const char * _date_parse_fixed(const char *s, int digits, int *res) { int n; char const *lim; assert(s); assert(res); n = 0; lim = s + digits; while (s < lim) { unsigned int d = (unsigned) (*s++ - '0'); if (9 < d) return 0; n = 10 * n + (int) d; } *res = n; return s; } /* * Parse an initial prefix of S of length DIGITS; * it must be a number in the range LO through HI. * Store the parsed number into *RES. * Return the first character after the prefix, or 0 if it couldn't be parsed. */ static const char * _date_parse_ranged(const char *s, int digits, int lo, int hi, int *res) { assert(s); assert(res); s = _date_parse_fixed(s, digits, res); return (s && lo <= *res && *res <= hi) ? s : 0; } /* * Parse an initial prefix of S of length DIGITS; * it must be a number in the range LO through HI * and it may be followed by a fraction that is to be computed using RESOLUTION. * Store the parsed number into *RES; store the fraction times RESOLUTION, * rounded to the nearest integer, into *FRES. * Return the first character after the prefix, or 0 if it couldn't be parsed. */ static const char * _date_parse_decimal( const char *s, int digits, int lo, int hi, int resolution, int *res, int *fres ) { const char *dp; size_t dpl; assert(s); assert(res); assert(fres); #if HAVE_NL_LANGINFO # ifdef NL_LANGINFO_DP dp = nl_langinfo(NL_LANGINFO_DP); # else /* ! defined(NL_LANGINFO_DP) */ dp = "."; # endif /* ! defined(NL_LANGINFO_DP) */ #else /* ! HAVE_NL_LANGINFO */ dp = "."; #endif /* ! HAVE_NL_LANGINFO */ dpl = strlen(dp); s = _date_parse_fixed(s, digits, res); if (s && lo <= *res && *res <= hi) { int f = 0; if (*dp && !strncasecmp(s, dp, dpl) && ISDIGIT(s[dpl])) { const char *s1 = s + dpl; int num10 = 0, denom10 = 10, product; s = s1; while (ISDIGIT(*++s)) denom10 *= 10; s = _date_parse_fixed(s1, (int) (s - s1), &num10); product = num10 * resolution; f = (product + (denom10 >> 1)) / denom10; f -= f & (product % denom10 == denom10 >> 1); /* round to even */ if (f < 0 || product / resolution != num10) return 0; /* overflow */ } *fres = f; return s; } return 0; } /* * Parse an initial prefix of S; it must denote a time zone. * Set *ZONE to the number of seconds east of GMT, * or to TM_LOCAL_ZONE if it is the local time zone. * Return the first character after the prefix, or 0 if it couldn't be parsed. */ const char * date_parse_zone(const char *s, long *zone) { char sign; int hh, mm, ss; int minutesEastOfUTC; long offset, z; const struct time_zone *tz; assert(s); assert(zone); /* * The formats are LT, n, n DST, nDST, no, o * where n is a time zone name * and o is a time zone offset of the form [-+]hh[:mm[:ss]]. */ switch (*s) { case '-': case '+': z = 0; break; default: minutesEastOfUTC = -1; for (tz = zones; tz->name; tz++) { if (!strncasecmp(s, tz->name, strlen(tz->name))) { s += strlen(tz->name); #define hr60nonnegative(t) ((t) / 100 * 60 + (t)%100) #define hr60(t) ((t) < 0 ? -hr60nonnegative(-(t)) : hr60nonnegative(t)) minutesEastOfUTC = hr60(tz->offset); break; } } if (minutesEastOfUTC == -1) return NULL; /* Don't bother to check rest of spelling. */ while (ISALPHA(*s)) s++; /* Don't modify LT. */ if (minutesEastOfUTC == 1) { *zone = TM_LOCAL_ZONE; return s; } z = minutesEastOfUTC * 60L; /* Look for trailing " DST". */ if ( (s[-1]=='T' || s[-1]=='t') && (s[-2]=='S' || s[-2]=='s') && (s[-3]=='D' || s[-3]=='t') ) goto TRAILING_DST; while (ISSPACE(*s)) s++; if ( (s[0]=='D' || s[0]=='d') && (s[1]=='S' || s[1]=='s') && (s[2]=='T' || s[2]=='t') ) { s += 3; TRAILING_DST: *zone = z + 60*60; return s; } *zone = z; switch (*s) { case '-': case '+': break; default: return s; } } sign = *s++; if (!(s = _date_parse_ranged(s, 2, 0, 23, &hh))) return NULL; mm = ss = 0; if (*s == ':') s++; if (ISDIGIT(*s)) { if (!(s = _date_parse_ranged(s, 2, 0, 59, &mm))) return NULL; if (*s == ':' && s[-3] == ':' && ISDIGIT(s[1])) { if (!(s = _date_parse_ranged(s + 1, 2, 0, 59, &ss))) return NULL; } } if (ISDIGIT(*s)) return NULL; offset = (hh * 60 + mm) * 60L + ss; *zone = z + (sign == '-' ? -offset : offset); /* * ?? Are fractions allowed here? * If so, they're not implemented. */ return s; } #if ! HAVE_NL_LANGINFO # define nl_item int # define MON_1 1 # define MON_12 11 # define ABMON_1 1 # define ABMON_12 11 # define DAY_1 1 # define DAY_7 7 # define ABDAY_1 1 # define ABDAY_7 7 #endif /* ! HAVE_NL_LANGINFO */ static const char * parse_pattern_letter(const char *s, char c, struct parse_state *state) { assert(s); assert(c); assert(state); switch (c) { case '$': /* The next character must be a non-digit. */ if (ISDIGIT(*s)) return NULL; break; case '-': case '/': case ':': /* These characters stand for themselves. */ if (*s++ != c) return NULL; break; case '4': /* 4-digit year */ s = _date_parse_fixed(s, 4, &state->tm.tm_year); break; case '=': /* optional '-' */ s += *s == '-'; break; case 'A': /* AM or PM */ /* * This matches either enough of AM_STR or PM_STR to be unambiguous, * or the whole lot. */ { #if HAVE_NL_LANGINFO const char *am = nl_langinfo(AM_STR); const char *pm = nl_langinfo(PM_STR); #else /* ! HAVE_NL_LANGINFO */ const char *am = NULL; const char *pm = NULL; #endif /* ! HAVE_NL_LANGINFO */ size_t aml, pml, length; if (!am || !*am) am = "AM"; if (!pm || !*pm) pm = "PM"; aml = strlen(am); pml = strlen(pm); /* Find unambiguous length */ for (length = 1; am[length - 1] == pm[length - 1]; length++) ; if (!strncasecmp(s, am, aml)) { if (state->tm.tm_hour == 12) state->tm.tm_hour = 0; s += aml; } else if (!strncasecmp(s, pm, pml)) { if (state->tm.tm_hour < 12) state->tm.tm_hour += 12; s += pml; } else if (!strncasecmp(s, am, length)) { if (state->tm.tm_hour == 12) state->tm.tm_hour = 0; s += length; } else if (!strncasecmp(s, pm, length)) { if (state->tm.tm_hour < 12) state->tm.tm_hour += 12; s += length; } else return NULL; if (ISALNUM(*s)) return NULL; } break; case 'D': /* day of month [01-31] */ s = _date_parse_ranged(s, 2, 1, 31, &state->tm.tm_mday); break; case 'd': /* day of year [001-366] */ s = _date_parse_ranged(s, 3, 1, 366, &state->tm.tm_yday); state->tm.tm_yday--; break; case 'E': /* extended day of month [1-9, 01-31] */ s = _date_parse_ranged(s, ( ISDIGIT(s[0]) && ISDIGIT(s[1]) ) + 1, 1, 31, &state->tm.tm_mday); break; case 'h': /* hour [00-23 followed by optional fraction] */ { int frac; s = _date_parse_decimal(s, 2, 0, 23, 60 * 60, &state->tm.tm_hour, &frac); state->tm.tm_min = frac / 60; state->tm.tm_sec = frac % 60; } break; case 'm': /* minute [00-59 followed by optional fraction] */ s = _date_parse_decimal( s, 2, 0, 59, 60, &state->tm.tm_min, &state->tm.tm_sec ); break; case 'n': /* month name [e.g. "Jan"] */ { nl_item item; int found; found = 0; for (item = MON_1; item <= MON_12; item++) { #if HAVE_NL_LANGINFO const char *month = nl_langinfo(item); #else /* ! HAVE_NL_LANGINFO */ const char *month = standard_months[item - MON_1]; #endif /* ! HAVE_NL_LANGINFO */ if (!*month) continue; if (!strncasecmp(s, month, strlen(month))) { s += strlen(month); state->tm.tm_mon = item - MON_1; found = 1; break; } } if (found) { if (ISALPHA(*s)) return NULL; break; } found = 0; for (item = ABMON_1; item <= ABMON_12; item++) { #if HAVE_NL_LANGINFO const char *month = nl_langinfo(item); #else /* ! HAVE_NL_LANGINFO */ const char *month = standard_ab_months[item - ABMON_1]; #endif /* ! HAVE_NL_LANGINFO */ if (!*month) continue; if (!strncasecmp(s, month, strlen(month))) { s += strlen(month); state->tm.tm_mon = item - ABMON_1; found = 1; break; } } if (found) { if (ISALPHA(*s)) return NULL; break; } return NULL; } assert(0); case 'N': /* month [01-12] */ s = _date_parse_ranged(s, 2, 1, 12, &state->tm.tm_mon); state->tm.tm_mon--; break; case 'r': /* year % 10 (remainder in origin-0 decade) [0-9] */ s = _date_parse_fixed(s, 1, &state->tm.tm_year); state->ymodulus = 10; break; CASE_R: case 'R': /* year % 100 (remainder in origin-0 century) [00-99] */ s = _date_parse_fixed(s, 2, &state->tm.tm_year); state->ymodulus = 100; break; case 's': /* second [00-60 followed by optional fraction] */ { int frac; s = _date_parse_decimal(s, 2, 0, 60, 1, &state->tm.tm_sec, &frac); state->tm.tm_sec += frac; } break; case 'T': /* 'T' or 't' */ switch (*s++) { case 'T': case 't': break; default: return NULL; } break; case 't': /* traditional hour [1-9 or 01-12] */ s = _date_parse_ranged(s, ( ISDIGIT(s[0]) && ISDIGIT(s[1]) ) + 1, 1, 12, &state->tm.tm_hour); break; case 'w': /* 'W' or 'w' only (stands for current week) */ switch (*s++) { case 'W': case 'w': break; default: return NULL; } break; case 'W': /* 'W' or 'w', followed by a week of year [00-53] */ switch (*s++) { case 'W': case 'w': break; default: return NULL; } s = _date_parse_ranged(s, 2, 0, 53, &state->yweek); break; case 'X': /* weekday (1=Mon ... 7=Sun) [1-7] */ s = _date_parse_ranged(s, 1, 1, 7, &state->tm.tm_wday); state->tm.tm_wday--; break; case 'x': /* weekday name [e.g. "Sun"] */ { nl_item item; int found; found = 0; for (item = DAY_1; item <= DAY_7; item++) { #if HAVE_NL_LANGINFO const char *day = nl_langinfo(item); #else /* ! HAVE_NL_LANGINFO */ const char *day = standard_days[item - DAY_1]; #endif /* ! HAVE_NL_LANGINFO */ if (!*day) continue; if (!strncasecmp(s, day, strlen(day))) { s += strlen(day); state->tm.tm_wday = item - DAY_1; found = 1; break; } } if (found) { if (ISALPHA(*s)) return NULL; break; } found = 0; for (item = ABDAY_1; item <= ABDAY_7; item++) { #if HAVE_NL_LANGINFO const char *day = nl_langinfo(item); #else /* ! HAVE_NL_LANGINFO */ const char *day = standard_ab_days[item - ABDAY_1]; #endif /* ! HAVE_NL_LANGINFO */ if (!*day) continue; if (!strncasecmp(s, day, strlen(day))) { s += strlen(day); state->tm.tm_wday = item - ABDAY_1; found = 1; break; } } if (found) { if (ISALPHA(*s)) return NULL; break; } return NULL; } assert(0); case 'y': /* either R or Y */ if ( ISDIGIT(s[0]) && ISDIGIT(s[1]) && !ISDIGIT(s[2]) ) goto CASE_R; /* fall through */ case 'Y': /* year in full [4 or more digits] */ { int len = 0; while (ISDIGIT(s[len])) len++; if (len < 4) return NULL; s = _date_parse_fixed(s, len, &state->tm.tm_year); } break; case 'Z': /* time zone */ s = date_parse_zone(s, &state->zone); break; case '_': /* possibly empty sequence of non-alphanumerics */ while (!ISALNUM(*s) && *s) s++; break; default: /* bad pattern */ return NULL; } return s; } static inline void undefine(struct parse_state *state) { state->tm.tm_sec = state->tm.tm_min = state->tm.tm_hour = state->tm.tm_mday = state->tm.tm_mon = state->tm.tm_year = state->tm.tm_wday = state->tm.tm_yday = state->ymodulus = state->yweek = state->tm.tm_isdst = TM_UNDEFINED; state->zone = TM_UNDEFINED_ZONE; } static int const month_yday[] = { /* days in year before start of months 0-12 */ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; static int isleap(int y) { return (y & 3) == 0 && (y % 100 != 0 || y % 400 == 0); } /* * Convert UNIXTIME to struct tm form. * Use gmtime if available and if !LOCALZONE, localtime otherwise. */ static struct tm * time2tm(time_t unixtime, int localzone) { struct tm *tm; if (localzone || !(tm = gmtime(&unixtime))) tm = localtime(&unixtime); return tm; } /* Yield A - B, measured in seconds. */ static time_t difftm(const struct tm *a, const struct tm *b) { int ay = a->tm_year + (TM_YEAR_ORIGIN - 1); int by = b->tm_year + (TM_YEAR_ORIGIN - 1); int difference_in_day_of_year = a->tm_yday - b->tm_yday; int intervening_leap_days = ( ((ay >> 2) - (by >> 2)) - (ay / 100 - by / 100) + ((ay / 100 >> 2) - (by / 100 >> 2)) ); time_t difference_in_years = ay - by; time_t difference_in_days = ( difference_in_years * 365 + (intervening_leap_days + difference_in_day_of_year) ); return ( ( 24 * difference_in_days + (a->tm_hour - b->tm_hour) ) * 60 + (a->tm_min - b->tm_min) ) * 60 + (a->tm_sec - b->tm_sec); } /* * Convert TM to time_t, using localtime if LOCALZONE and gmtime otherwise. * Use only TM's year, mon, mday, hour, min, and sec members. * Ignore TM's old tm_yday and tm_wday, but fill in their correct values. * Yield -1 on failure (e.g. a member out of range). * Posix 1003.1-1990 doesn't allow leap seconds, but some implementations * have them anyway, so allow them if localtime/gmtime does. */ static time_t tm2time(struct tm *tm, int localzone) { /* Cache the most recent t,tm pairs; 1 for gmtime, 1 for localtime. */ static time_t t_cache[2]; static struct tm tm_cache[2]; time_t d, gt; const struct tm *gtm; /* * The maximum number of iterations should be enough to handle any * combinations of leap seconds, time zone rule changes, and solar time. * 4 is probably enough; we use a bigger number just to be safe. */ int remaining_tries = 8; /* Avoid subscript errors. */ if (12 <= (unsigned int)tm->tm_mon) return -1; tm->tm_yday = month_yday[tm->tm_mon] + tm->tm_mday - (tm->tm_mon < 2 || !isleap(tm->tm_year + TM_YEAR_ORIGIN)); /* Make a first guess. */ gt = t_cache[localzone]; gtm = gt ? &tm_cache[localzone] : time2tm(gt, localzone); /* Repeatedly use the error from the guess to improve the guess. */ while ((d = difftm(tm, gtm)) != 0) { if (--remaining_tries == 0) return -1; gt += d; gtm = time2tm(gt,localzone); } t_cache[localzone] = gt; tm_cache[localzone] = *gtm; /* * Check that the guess actually matches; * overflow can cause difftm to yield 0 even on differing times, * or tm may have members out of range (e.g. bad leap seconds). */ if ((tm->tm_year ^ gtm->tm_year) | (tm->tm_mon ^ gtm->tm_mon) | (tm->tm_mday ^ gtm->tm_mday) | (tm->tm_hour ^ gtm->tm_hour) | (tm->tm_min ^ gtm->tm_min) | (tm->tm_sec ^ gtm->tm_sec)) return -1; tm->tm_wday = gtm->tm_wday; return gt; } /* Yield the number of days in TM's month. */ static int month_days(const struct tm *tm) { int m = tm->tm_mon; return month_yday[m+1] - month_yday[m] + (m == 1 && isleap(tm->tm_year + TM_YEAR_ORIGIN)); } /* * Adjust time T by adding SECONDS. SECONDS must be at most 24 hours' worth. * Adjust only T's year, mon, mday, hour, min and sec members; * plus adjust wday if it is defined. */ static void adjzone(register struct tm *t, long seconds) { /* * This code can be off by a second if SECONDS is not a multiple of 60, * if T is local time, and if a leap second happens during this minute. * But this bug has never occurred, and most likely will not ever occur. * Liberia, the last country for which SECONDS % 60 was nonzero, * switched to UTC in May 1972; the first leap second was in June 1972. */ int leap_second = t->tm_sec == 60; long sec = seconds + (t->tm_sec - leap_second); if (sec < 0) { if ((t->tm_min -= (int) ((59 - sec) / 60)) < 0) { if ((t->tm_hour -= (59 - t->tm_min) / 60) < 0) { t->tm_hour += 24; if (TM_DEFINED(t->tm_wday) && --t->tm_wday < 0) t->tm_wday = 6; if (--t->tm_mday <= 0) { if (--t->tm_mon < 0) { --t->tm_year; t->tm_mon = 11; } t->tm_mday = month_days(t); } } t->tm_min += 24 * 60; } sec += 24L * 60 * 60; } else if (60 <= (t->tm_min += (int) (sec / 60))) if (24 <= (t->tm_hour += t->tm_min / 60)) { t->tm_hour -= 24; if (TM_DEFINED(t->tm_wday) && ++t->tm_wday == 7) t->tm_wday = 0; if (month_days(t) < ++t->tm_mday) { if (11 < ++t->tm_mon) { ++t->tm_year; t->tm_mon = 0; } t->tm_mday = 1; } } t->tm_min %= 60; t->tm_sec = (int)(sec % 60) + leap_second; } time_t date_parse(const char *s, int use_zone_offset, long zone_offset) { struct parse_state state; struct tm tm, *tm0; int localzone, wday; time_t r; assert(s); if (!use_zone_offset) zone_offset = (rcs_emulation < 5 ? TM_LOCAL_ZONE : 0); memset(&state, '\0', sizeof(state)); undefine(&state); while (*s) { char c; const char * const *pattern; for (; !ISALNUM(c = *s) && c && c != '-' && c != '+'; s++) ; if (!c) break; /* Find first pattern that can merge successfully */ for (pattern = patterns; *pattern; pattern++) { struct parse_state temp; const char *s2, *c2; s2 = s; undefine(&temp); for (c2 = *pattern; s2 && *c2; c2++) s2 = parse_pattern_letter(s2, *c2, &temp); if (s2) { /* The pattern was fully matched */ #define conflict(a,b) ((a) != (b) && TM_DEFINED(a) && TM_DEFINED(b)) #define merge(a,b) do { if (TM_DEFINED(b)) (a) = (b); } while (0) if ( !conflict(state.tm.tm_sec, temp.tm.tm_sec) && !conflict(state.tm.tm_min, temp.tm.tm_min) && !conflict(state.tm.tm_hour, temp.tm.tm_hour) && !conflict(state.tm.tm_mday, temp.tm.tm_mday) && !conflict(state.tm.tm_mon, temp.tm.tm_mon) && !conflict(state.tm.tm_year, temp.tm.tm_year) && !conflict(state.tm.tm_wday, temp.tm.tm_wday) && !conflict(state.tm.tm_yday, temp.tm.tm_yday) && !conflict(state.ymodulus, temp.ymodulus) && !conflict(state.yweek, temp.yweek) && !( state.zone != temp.zone && state.zone != TM_UNDEFINED_ZONE && temp.zone != TM_UNDEFINED_ZONE ) ) { /* The pattern does not conflict */ s = s2; merge(state.tm.tm_sec, temp.tm.tm_sec); merge(state.tm.tm_min, temp.tm.tm_min); merge(state.tm.tm_hour, temp.tm.tm_hour); merge(state.tm.tm_mday, temp.tm.tm_mday); merge(state.tm.tm_mon, temp.tm.tm_mon); merge(state.tm.tm_year, temp.tm.tm_year); merge(state.tm.tm_wday, temp.tm.tm_wday); merge(state.tm.tm_yday, temp.tm.tm_yday); merge(state.ymodulus, temp.ymodulus); merge(state.yweek, temp.yweek); if (temp.zone != TM_UNDEFINED_ZONE) state.zone = temp.zone; goto OUTER; } } #undef conflict #undef merge } return -1; OUTER: ; } if (state.zone == TM_UNDEFINED_ZONE) state.zone = zone_offset; tm0 = NULL; localzone = state.zone == TM_LOCAL_ZONE; tm = state.tm; if (TM_DEFINED(state.ymodulus) || !TM_DEFINED(tm.tm_year)) { /* Get tm corresponding to current time. */ tm0 = time2tm(time(NULL), localzone); if (!localzone) adjzone(tm0, state.zone); } if (TM_DEFINED(state.ymodulus)) tm.tm_year += (tm0->tm_year + TM_YEAR_ORIGIN) / state.ymodulus * state.ymodulus; else if (!TM_DEFINED(tm.tm_year)) { /* Set default year, month, day from current time. */ tm.tm_year = tm0->tm_year + TM_YEAR_ORIGIN; if (!TM_DEFINED(tm.tm_mon)) { tm.tm_mon = tm0->tm_mon; if (!TM_DEFINED(tm.tm_mday)) tm.tm_mday = tm0->tm_mday; } } /* Convert from partime year (Gregorian) to Posix year. */ tm.tm_year -= TM_YEAR_ORIGIN; /* Set remaining default fields to be their minimum values. */ if (!TM_DEFINED(tm.tm_mon)) tm.tm_mon = 0; if (!TM_DEFINED(tm.tm_mday)) tm.tm_mday = 1; if (!TM_DEFINED(tm.tm_hour)) tm.tm_hour = 0; if (!TM_DEFINED(tm.tm_min)) tm.tm_min = 0; if (!TM_DEFINED(tm.tm_sec)) tm.tm_sec = 0; if (!localzone) adjzone(&tm, -state.zone); wday = tm.tm_wday; /* Convert and fill in the rest of the tm. */ r = tm2time(&tm, localzone); /* Check weekday. */ if (r != -1 && TM_DEFINED(wday) && wday != tm.tm_wday) return -1; return r; } time_t date_parse_rev(const char *rev) { struct tm tm; assert(rev); if ( sscanf(rev, "%d.%d.%d.%d.%d.%d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec ) == 6 ) { char *tz; time_t result; /* Dates can be on the form "99.12.15.08.09.04" before year 2000, * only subtract 1900 years if year >= 1900 */ if (tm.tm_year >= 1900) { tm.tm_year -= 1900; } tm.tm_mon--; tm.tm_wday = tm.tm_yday = tm.tm_isdst = 0; tz = getenv("TZ"); if (setenv("TZ", "UTC", 1)) return -1; tzset(); result = mktime(&tm); if (tz) setenv("TZ", tz, 1); else unsetenv("TZ"); return result; } else return -1; } char * date_format(time_t date) { struct tm *tm; char *result; assert(date >= 0); tm = gmtime(&date); /* if RCS version < 5 then localtime ? */ result = MALLOC(20, char); sprintf(result, "%04u.%02u.%02u.%02u.%02u.%02u", (tm->tm_year + 1900) % 10000, (tm->tm_mon % 12) + 1, (tm->tm_mday % 31), (tm->tm_hour % 24), (tm->tm_min % 60), (tm->tm_sec > 60 ? 60 : tm->tm_sec) ); return result; } char * date_sprintf(time_t date, long zone) { struct tm tm; char *result; size_t len; assert(date >= 0); result = MALLOC(40, char); switch (zone) { case TM_UNDEFINED_ZONE: /* if RCS version < 5 then localtime ? */ strftime(result, 40, "%Y/%m/%d %H:%M:%S", gmtime(&date)); break; case TM_LOCAL_ZONE: #if HAVE_TM_GMTOFF memcpy(&tm, localtime(&date), sizeof(struct tm)); zone = tm.tm_gmtoff; goto format_time; #else /* ! HAVE_TM_GMTOFF */ zone = -timezone; /* Huh? timezone is seconds west of UTC! */ #endif /* ! HAVE_TM_GMTOFF */ /* Fall through */ default: memcpy(&tm, gmtime(&date), sizeof(struct tm)); adjzone(&tm, zone); format_time: _UNUSED_LABEL len = strftime(result, 40, "%Y-%m-%d %H:%M:%S", &tm); if (zone >= 0) len += (size_t) sprintf(result + len, "+%02ld", zone / 3600); else { zone = -zone; len += (size_t) sprintf(result + len, "-%02ld", zone / 3600); } zone %= 3600; if (zone) { len += (size_t) sprintf(result + len, ":%02ld", zone / 60); zone %= 60; } if (zone) len += (size_t) sprintf(result + len, ":%02ld", zone); break; } return result; } size_t date_sprintf_prefix(time_t date, char *buffer, size_t len) { assert(date >= 0); /* if RCS version < 5 then localtime ? */ return strftime(buffer, len, "%d-%b-%y", gmtime(&date)); } blame-1.4-20240206/src/parser.y0000644000000000000000000002325714557463356014341 0ustar rootroot%{ /* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include extern int yylex (void); static void yyerror (const char *, rcs_t *, char const *); static int _parser_count_deltalist (const rcs_t *, const delta_t *, hash_t *); typedef struct { unsigned int line; off_t off; off_t next; } loc_t; #define YYLTYPE loc_t #define YYLLOC_DEFAULT(Current, Rhs, N) \ ((Current).line = (Rhs)[1].line, \ (Current).off = (Rhs)[1].off, \ (Current).next = (Rhs)[N].next) static unsigned int lines; %} %union { char *s; unsigned int i; time_t date; hash_t *hash; vector_t *vector; lines_t *lines; delta_t *delta; struct { delta_t *head; hash_t *branches; } trunk; expand_t expand; } %locations %error-verbose %parse-param {const char *filename} %parse-param {rcs_t *rcs} %token NUM %token ID %token SYM %token STR %token STR_FINAL %token HEAD %token BRANCH %token ACCESS %token SYMBOLS %token LOCKS %token STRICT %token COMMENT %token EXPAND %token DATE %token AUTHOR %token STATE %token BRANCHES %token NEXT %token DESC %token LOG %token TEXT %type admin_head admin_branch admin_comment %type delta_author delta_state deltatext_log id_or_sym %type admin_strict deltatext_log_bit %type delta_date %type admin_access id_list %type deltatext_text deltatext_text_string %type admin_symbols admin_locks delta_branches %type num_list id_num_list sym_num_list %type delta delta_next %type admin_expand %% rcstext: { yylloc.line = 1; yylloc.off = yylloc.next = 0; lines = 0; rcs->delta_list = hash_new((dup_fn_t)delta_dup, (free_fn_t)delta_free); } admin_head admin_branch admin_access admin_symbols admin_locks admin_strict admin_comment admin_expand newphrase_list delta_list { if ($2) { int count; $$.head = (delta_t *)rcs_get_delta(rcs, $2); if (!$$.head) { yyerror(filename, rcs, "head revision is missing"); YYERROR; } $$.branches = hash_new(NULL, NULL); count = _parser_count_deltalist(rcs, $$.head, $$.branches); if (count < 0) { yyerror(filename, rcs, "delta tree is malformed"); YYERROR; } if ((unsigned)count != hash_count(rcs->delta_list)) { yyerror(filename, rcs, "unreachable deltas exist"); YYERROR; } } else { $$.head = NULL; $$.branches = NULL; } } desc deltatext_list { rcs->head = $12.head; rcs->branch = ($3 ? strdup($3) : ($2 ? rcs_rev_to_branch($2) : NULL)); rcs->branches = $12.branches; rcs->access = $4; rcs->symbols = $5; rcs->locks = $6; rcs->strict = $7; rcs->comment = $8; rcs->expand = $9; rcs->lines = lines; } ; admin_head: HEAD NUM ';' { $$ = rcs->start + @2.off; *($$ + $2) = '\0'; } | HEAD ';' { $$ = NULL; } ; admin_branch: /* empty */ { $$ = NULL; } | BRANCH NUM ';' { $$ = rcs->start + @2.off; *($$ + $2) = '\0'; } | BRANCH ';' { $$ = NULL; } ; admin_access: ACCESS id_list ';' { $$ = $2; } ; admin_symbols: SYMBOLS sym_num_list ';' { $$ = $2; } ; admin_locks: LOCKS id_num_list ';' { $$ = $2; } ; admin_strict: /* empty */ { $$ = 0; } | STRICT ';' { $$ = 1; } ; admin_comment: /* empty */ { $$ = NULL; } | COMMENT STR_FINAL ';' { $$ = rcs->start + @2.off; *($$ + $2) = '\0'; } | COMMENT ';' { $$ = NULL; } ; admin_expand: /* empty */ { $$ = EXPAND_UNDEFINED; } | EXPAND STR_FINAL ';' { if (!strncmp(rcs->start + @2.off, "kv", $2)) $$ = EXPAND_KEY_VALUE; else if (!strncmp(rcs->start + @2.off, "kvl", $2)) $$ = EXPAND_KEY_VALUE_LOCKER; else if (!strncmp(rcs->start + @2.off, "k", $2)) $$ = EXPAND_KEY_ONLY; else if (!strncmp(rcs->start + @2.off, "o", $2)) $$ = EXPAND_OLD_STRING; else if (!strncmp(rcs->start + @2.off, "b", $2)) $$ = EXPAND_BINARY_STRING; else if (!strncmp(rcs->start + @2.off, "v", $2)) $$ = EXPAND_VALUE_ONLY; else { yyerror(filename, rcs, "invalid keyword expansion type"); YYERROR; } } | EXPAND ';' { $$ = EXPAND_UNDEFINED; } ; delta_list: /* empty */ | delta_list delta ; delta: NUM delta_date delta_author delta_state delta_branches delta_next newphrase_list { char *num = rcs->start + @1.off; *(num + $1) = '\0'; $$ = rcs_get_delta_template(rcs, num); if (!delta_is_template($$)) { yyerror(filename, rcs, "delta is multiply defined"); YYERROR; } delta_complete_template_nocopy($$, $2, $3, $4, $5, $6); } ; delta_date: DATE NUM ';' { char *num = rcs->start + @2.off; *(num + $2) = '\0'; $$ = date_parse_rev(num); if ($$ < 0) { yyerror(filename, rcs, "invalid date"); YYERROR; } } ; delta_author: AUTHOR id_or_sym ';' { $$ = $2; } ; delta_state: STATE id_or_sym ';' { $$ = $2; } | STATE ';' { $$ = NULL; } ; delta_branches: BRANCHES num_list ';' { $$ = $2; } | BRANCHES ';' { $$ = NULL; } ; delta_next: NEXT NUM ';' { char *num = rcs->start + @2.off; *(num + $2) = '\0'; $$ = rcs_get_delta_template(rcs, num); } | NEXT ';' { $$ = NULL; } ; desc: DESC gobble_string ; deltatext_list: /* empty */ | deltatext_list deltatext ; deltatext: NUM { const delta_t *delta; char *num = rcs->start + @1.off; *(num + $1) = '\0'; delta = rcs_get_delta(rcs, num); if (delta && !delta_is_template(delta)) $$ = (delta_t *)delta; else { yyerror(filename, rcs, "invalid delta revision"); YYERROR; } } deltatext_log newphrase_list deltatext_text { delta_complete_text_nocopy($2, $3, $5); } ; deltatext_log: LOG deltatext_log_bit STR_FINAL { /* Sigh... Can't rely on @2 because the empty rule below * screws up the location stack. */ rcs->start[@3.off + $3] = '\0'; $$ = rcs->start + @3.off - $2; } ; deltatext_log_bit: /* empty */ { $$ = 0; } | deltatext_log_bit STR { $$ = $1 + $2; } ; deltatext_text: TEXT deltatext_text_string STR_FINAL { $$ = $2; lines_append_nocopy($$, rcs->start + @3.off, $3); lines++; } ; deltatext_text_string: /* empty */ { $$ = lines_new(); } | deltatext_text_string STR { lines_append_nocopy($$, rcs->start + @2.off, $2); lines++; } ; id_list: /* empty */ { $$ = vector_new(NULL, NULL); } | id_list id_or_sym { vector_append_nocopy($$, $2); } ; num_list: NUM { char *branch, *num; $$ = hash_new(NULL, NULL); num = rcs->start + @1.off; *(num + $1) = '\0'; branch = rcs_rev_to_branch(num); hash_insert_nocopy($$, branch, rcs_get_delta_template(rcs, num)); FREE(branch); } | num_list NUM { char *branch, *num; num = rcs->start + @2.off; *(num + $2) = '\0'; if (!rcs_rev_is_valid(num)) { yyerror(filename, rcs, "branch revision is malformed"); YYERROR; } branch = rcs_rev_to_branch(num); hash_insert_nocopy($$, branch, rcs_get_delta_template(rcs, num)); FREE(branch); } ; id_num_list: /* empty */ { $$ = hash_new(NULL, NULL); } | id_num_list id_or_sym ':' NUM { char *num = rcs->start + @4.off; *(num + $4) = '\0'; hash_insert_nocopy($$, $2, rcs_get_delta_template(rcs, num)); } ; sym_num_list: /* empty */ { $$ = hash_new(NULL, NULL); } | sym_num_list SYM ':' NUM { char *sym, *num; sym = rcs->start + @2.off; *(sym + $2) = '\0'; num = rcs->start + @4.off; *(num + $4) = '\0'; hash_insert_nocopy($$, sym, num); } ; newphrase_list: /* empty */ | id_or_sym word_list ';' ; word_list: /* empty */ | word_list word ; word: ID | NUM | gobble_string | ':' ; id_or_sym: ID { $$ = rcs->start + @1.off; *($$ + $1) = '\0'; } | SYM { $$ = rcs->start + @1.off; *($$ + $1) = '\0'; } ; gobble_string: gobble_string_bit STR_FINAL ; gobble_string_bit: /* empty */ | gobble_string_bit STR ; %% static void yyerror( const char *filename, __attribute__((unused)) rcs_t *rcs, char const *err ) { assert(filename); assert(rcs); assert(err); error(0, 0, "%s: %s at line %u", filename, err, yylloc.line); } /* * Returns the number of reachable revisions from in . * If a loop is detected, -1 is returned. */ static int _parser_count_deltalist(const rcs_t *rcs, const delta_t *delta, hash_t *branches) { int count; const char *prev; if (delta_is_template(delta)) return -1; prev = NULL; count = 0; while (delta) { const delta_t *base; hash_iter_t iter; count++; if (branches) { const char *rev, *dot; rev = delta_get_revision(delta); dot = strrchr(rev, '.'); assert(dot); if (!prev || strncmp(prev, rev, dot - rev + 1)) { char *copy = strndup(rev, dot - rev); hash_insert(branches, copy, delta); FREE(copy); prev = rev; } } for_each_branch_base(base, delta, iter) { int c; assert(base); if ((c = _parser_count_deltalist(rcs, base, NULL)) < 0) { hash_iter_free(iter); return -1; } count += c; } hash_iter_free(iter); delta = delta_get_next(delta); } return count; } blame-1.4-20240206/src/system.h0000644000000000000000000000756214557012177014340 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004, 2005 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SYSTEM_H #define _SYSTEM_H #if HAVE_CONFIG_H # include #endif /* HAVE_CONFIG_H */ /* * These headers should exist. Even gnulib assumes they do... */ #include #include #include #include #ifndef errno extern int errno; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #if TM_IN_SYS_TIME # if TIME_WITH_SYS_TIME # include # include # else /* ! TIME_WITH_SYS_TIME */ # if HAVE_SYS_TIME_H # include # else /* ! HAVE_SYS_TIME_H */ # include # endif /* ! HAVE_SYS_TIME_H */ # endif /* ! HAVE_SYS_TIME_H */ #else /* ! TIME_WITH_SYS_TIME */ # include #endif /* ! TM_IN_SYS_TIME */ #if HAVE_UNISTD_H # include #endif /* ! HAVE_UNISTD_H */ #define ALLOCA(C, T) ((T *)alloca((C) * sizeof(T))) #define MALLOC(C, T) ((T *)malloc((C) * sizeof(T))) #define MALLOC_VOIDP(C) ((void *)malloc(C)) #define CALLOC(C, T) ((T *)calloc((C), sizeof(T))) #define REALLOC(P, C, T) ((T *)realloc((P), (C) * sizeof(T))) static inline char * SALLOC(size_t c) { char *p; assert(c); p = MALLOC(c + 1, char); *p = *(p + c) = '\0'; return p; } static inline char * SREALLOC(char *p, size_t c) { assert(c); p = REALLOC(p, c + 1, char); *(p + c) = '\0'; return p; } #define obstack_chunk_alloc malloc #define obstack_chunk_free free typedef struct obstack obstack_t; #define OINIT(O) obstack_init(O) static inline void * _OALLOC(obstack_t *o, size_t s) { assert(o); return obstack_alloc(o, s); } #define OALLOC(O, C, T) ((T *)_OALLOC((O), (C) * sizeof(T))) #ifdef NDEBUG #define xfree(P) free(P) #else /* ! NDEBUG */ #define xfree(P) do { assert(P); free(P); (P) = NULL; } while (0) #endif /* ! NDEBUG */ #define FREE(P) xfree(P) #define OFREEALL(O) obstack_free((O), NULL) #define VOIDP_DIFF(P, Q) ((ptrdiff_t)((const char *)(P) - (const char *)(Q))) #define VOIDP_OFFSET(P, O) ((const void *)((const char *)(P) + (ptrdiff_t)(O))) #define CHARP_OFFSET(P, O) ((char *)((char *)(P) + (ptrdiff_t)(O))) /* No, we don't handle EOF. */ #define ISALNUM(C) isalnum((unsigned char)(C)) #define ISALPHA(C) isalpha((unsigned char)(C)) #define ISDIGIT(C) isdigit((unsigned char)(C)) #define ISGRAPH(C) isgraph((unsigned char)(C)) #define ISSPACE(C) isspace((unsigned char)(C)) #if defined __GNUC__ && defined __GNUC_MINOR__ # define __GNUC_PREREQ(maj, min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) #else # define __GNUC_PREREQ(maj, min) 0 #endif #if __GNUC_PREREQ(2, 4) && !defined(__STRICTANSI__) # define _UNUSED __attribute__((unused)) #else /* !__GNUC_PREREQ(2, 4) || defined(__STRICTANSI__) */ # define _UNUSED #endif /* !__GNUC_PREREQ(2, 4) || defined(__STRICTANSI__) */ #if __GNUC_PREREQ(3, 0) /* I think */ # define _UNUSED_LABEL __attribute__((unused)) #else /* ! __GNUC_PREREQ(3, 0) */ # define _UNUSED_LABEL #endif /* ! __GNUC_PREREQ(3, 0) */ #endif /* _SYSTEM_H */ blame-1.4-20240206/src/data.h0000644000000000000000000000361610135203412013677 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DATA_H #define _DATA_H #include /* * Dup and free operators for data stored in data structures. * * Either: * - The dup operator returns a deep duplication of the specified pointer. * - The free operator deeply frees the given pointer. * Or: * - The dup operator returns a duplication of the specified pointer. * - The free operator frees the given pointer. * Or (if dup and free operators are both NULL): * - The dup operator returns a copy of the specified pointer. * - The free operator does nothing. * * This lets data structures correctly manage memory. In the first case * the entry is completely owned by the data structure. In the second, only * the pointer is owned by the data structure. Otherwise the data structure * owns nothing. */ typedef void * (*dup_fn_t)(const void *); typedef void (*free_fn_t)(void *); /* * A dup function to duplicate strings or NULL. */ static inline char * string_dup(const char *p) { return p ? strdup(p) : NULL; } /* * A free function to free strings or NULL. */ static inline void string_free(char *p) { if (p) FREE(p); } #endif /* _DATA_H */ blame-1.4-20240206/src/delta.c0000644000000000000000000000340510135157617014065 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include /* * Returns a deep duplicate of . */ delta_t * delta_dup(const delta_t *delta) { delta_t *result; assert(delta); result = MALLOC(1, delta_t); result->template = delta->template; result->revision = delta->revision; if (!delta->template) { result->date = delta->date; result->author = delta->author; result->state = delta->state; result->branches = (delta->branches ? hash_dup(delta->branches) : NULL); result->log = delta->log; result->text = (delta->text ? lines_dup(delta->text, delta->text->capacity) : NULL); result->next = (delta->next ? delta_ref_dup(delta->next) : NULL); } return result; } /* * Deeply free . */ void delta_free(delta_t *delta) { assert(delta); assert(delta->revision); if (!delta->template) { if (delta->branches) hash_free(delta->branches); if (delta->text) lines_free(delta->text); if (delta->next) delta_ref_free(delta->next); } FREE(delta); } blame-1.4-20240206/src/hash.h0000644000000000000000000000627614560263042013731 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _HASH_H #define _HASH_H #include #include #include /* * A hash table entry. */ typedef struct { /* Local copies of the hash table's dup and free functions. */ dup_fn_t dup_fn; free_fn_t free_fn; char *key; /* The (immutable) key for this entry. */ unsigned int hash; /* The key's hash value. */ void *value; /* The entry's value. */ } hash_entry_t; /* * A hash table. * * Each slot in the hash table consists of a linked list. */ typedef struct { dup_fn_t dup_fn; free_fn_t free_fn; unsigned int capacity; /* Number of slots in hash table. */ unsigned int count; /* Number of entries in hash table. */ vector_t **data; /* The slot array. */ } hash_t; hash_t * hash_new (dup_fn_t, free_fn_t); hash_t * hash_dup (const hash_t *); void hash_expand (hash_t *, unsigned int); void hash_insert_nocopy (hash_t *, const char *, void *); /* * Maps to in the hash table . and are * both duplicated. */ static inline void hash_insert(hash_t *hash, const char *key, const void *value) { assert(hash); if (hash->dup_fn) hash_insert_nocopy(hash, key, (hash->dup_fn)(value)); else hash_insert_nocopy(hash, key, (void *)value); } void ** hash_get(hash_t *, const char *); void hash_free(hash_t *); /* * Returns the number of entries in . */ static inline unsigned int hash_count(const hash_t *hash) { assert(hash); return hash->count; } /* * A hash table iterator. * * This points to the current slot, the end of the slot array, and the * current element in the current slot. */ typedef struct { vector_t **base; vector_t **end; unsigned int i; } hash_iter_struct_t; typedef hash_iter_struct_t *hash_iter_t; hash_iter_t hash_iter (hash_t *); /* * Returns the key of the hash table element pointed to by . */ static inline const char * hash_get_key(hash_iter_t iter) { assert(iter); return ((hash_entry_t *)vector_get(*iter->base, iter->i))->key; } /* * Returns the value of the hash table element pointed to by . */ static inline void * hash_get_value(hash_iter_t iter) { assert(iter); return ((hash_entry_t *)vector_get(*iter->base, iter->i))->value; } hash_iter_t hash_next(hash_iter_t); /* * Frees (for use when the last element may or may not have been * reached through hash_next). */ static inline void hash_iter_free(hash_iter_t iter) { if (iter) FREE(iter); } #endif /* _HASH_H */ blame-1.4-20240206/src/vector.h0000644000000000000000000000373314557463476014326 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _VECTOR_H #define _VECTOR_H #include #include /* * A vector. */ typedef struct { dup_fn_t dup_fn; free_fn_t free_fn; unsigned int capacity; /* Number of slots in vector. */ unsigned int count; /* Number of entries in vector. */ void **data; /* The slot array. */ } vector_t; vector_t * vector_new (dup_fn_t, free_fn_t); vector_t * vector_dup (const vector_t *); void vector_expand (vector_t *, unsigned int); void vector_append_nocopy (vector_t *, void *); /* * Appends a duplication of to . */ static inline void vector_append(vector_t *vector, const void *x) { assert(vector); if (vector->dup_fn) vector_append_nocopy(vector, (vector->dup_fn)(x)); else vector_append_nocopy(vector, (void *)x); } void vector_free (vector_t *); void vector_free_nofree (vector_t *); /* * Returns the number of entries in . */ static inline unsigned int vector_count(const vector_t *vector) { assert(vector); return vector->count; } /* * Returns the -th vector entry in . */ static inline void * vector_get(vector_t *vector, unsigned int i) { assert(vector); return vector->data[i]; } #endif /* _VECTOR_H */ blame-1.4-20240206/src/lines.h0000644000000000000000000000352614557463424014127 0ustar rootroot/* * Blame - An RCS file annotator * Copyright (C) 2004 Michael Chapman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _LINES_H #define _LINES_H #include /* * A line in a line buffer. */ typedef struct { const struct _delta_t *delta; /* The delta that owns this line. */ const char *text; /* The text on this line. */ size_t len; /* The length of the line. */ } line_t; /* * A line buffer is a vector. The standard vector_t type isn't used * since we don't need (or want) any fancy memory management business. */ typedef struct { unsigned int capacity; unsigned int count; line_t **lines; /* The line pointers in the buffer. */ } lines_t; lines_t * lines_new (void); lines_t * lines_new_with_capacity (unsigned int); lines_t * lines_dup (const lines_t *, unsigned int); void lines_free (lines_t *); void lines_append_nocopy (lines_t *, const char *, size_t); int lines_apply (const lines_t *, lines_t *, const struct _delta_t *, const struct _delta_t *, int); void lines_finalize (lines_t *, const struct _delta_t *); #define lines_count(L) ((L)->count) #define lines_get(L, X) ((line_t *)((L)->lines[X])) #endif /* _LINES_H */ blame-1.4-20240206/COPYING0000644000000000000000000004313314560374630013100 0ustar rootroot GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. 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) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 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. blame-1.4-20240206/INSTALL0000644000000000000000000002203010125542443013057 0ustar rootrootCopyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. 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 only 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. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. 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. 4. Type `make install' to install the programs and any data files and documentation. 5. 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. 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=c89 CFLAGS=-O2 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 must use a version of `make' that supports the `VPATH' variable, such as 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 `..'. If you have to use a `make' that does not support the `VPATH' variable, you have 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. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' 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. 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'. Optional Features ================= 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. 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 `--target=TYPE' option 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 will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--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. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. blame-1.4-20240206/tests/0000755000000000000000000000000014560305704013177 5ustar rootrootblame-1.4-20240206/tests/testsuite.at0000644000000000000000000000127210527572337015567 0ustar rootroot# Process this file with autom4te to create testsuite. AT_INIT AT_TESTED([blame]) m4_defun([MAC_CHECK_STDERR], [ dnl Catch Valgrind errors if grep -q '^==[[0-9]][[0-9]]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi dnl Make sure stderr isn't empty if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi ]) m4_include([argv.at]) m4_include([pairing.at]) m4_include([rcs.at]) m4_include([rev.at]) m4_include([branch.at]) m4_include([working.at]) m4_include([date.at]) m4_include([state.at]) m4_include([author.at]) m4_include([expand.at]) m4_include([version.at]) m4_include([suffixes.at]) m4_include([mixed.at]) m4_include([log.at]) m4_include([rcsinit.at]) blame-1.4-20240206/tests/testdata/0000755000000000000000000000000010432275252015006 5ustar rootrootblame-1.4-20240206/tests/testdata/simple-1.2.expout0000644000000000000000000000023610125542443020042 0ustar rootroot1.2 (somebody 02-Feb-02): TEST TEST TEST TEST 1.1 (username 01-Jan-01): Example file 1.2 (somebody 02-Feb-02): TEST TEST TEST TEST blame-1.4-20240206/tests/testdata/complex-1.2.1.3.expout0000644000000000000000000000026510125542443020522 0ustar rootroot1.2.1.1 (user1 01-Jan-01): On branch 1.2.1: 1.2.1.1 (user1 01-Jan-01): Line 1 1.2.1.2 (user2 01-Jan-01): Line 2 1.2.1.3 (user3 01-Jan-01): Line 3 blame-1.4-20240206/tests/testdata/RCS/0000755000000000000000000000000010432275252015435 5ustar rootrootblame-1.4-20240206/tests/testdata/RCS/file3-bar0000644000000000000000000000060310125542443017121 0ustar rootroothead 1.2; access; symbols foo:1 bar:1.2; locks; strict; comment @# @; 1.2 date 2002.02.02.02.02.02; author somebody; state Stab; branches; next 1.1; 1.1 date 2001.01.01.01.01.01; author username; state Exp; branches; next ; desc @@ 1.2 log @*** empty log message *** @ text @TEST TEST TEST TEST Example file TEST TEST TEST TEST @ 1.1 log @Initial revision @ text @d1 1 d3 1 @ blame-1.4-20240206/tests/testdata/RCS/file10000644000000000000000000000060310125542443016355 0ustar rootroothead 1.2; access; symbols foo:1 bar:1.2; locks; strict; comment @# @; 1.2 date 2002.02.02.02.02.02; author somebody; state Stab; branches; next 1.1; 1.1 date 2001.01.01.01.01.01; author username; state Exp; branches; next ; desc @@ 1.2 log @*** empty log message *** @ text @TEST TEST TEST TEST Example file TEST TEST TEST TEST @ 1.1 log @Initial revision @ text @d1 1 d3 1 @ blame-1.4-20240206/tests/testdata/RCS/CVS/0000755000000000000000000000000010432275252016070 5ustar rootrootblame-1.4-20240206/tests/testdata/RCS/CVS/Root0000644000000000000000000000006510432275252016737 0ustar rootroot:ext:foonly@blame.cvs.sourceforge.net:/cvsroot/blame blame-1.4-20240206/tests/testdata/RCS/CVS/Repository0000644000000000000000000000003110125542720020160 0ustar rootrootblame/tests/testdata/RCS blame-1.4-20240206/tests/testdata/RCS/CVS/Entries0000644000000000000000000000013210125542720017414 0ustar rootroot/file1/1.1.1.1/Sun Sep 26 13:33:23 2004// /file3-bar/1.1.1.1/Sun Sep 26 13:33:23 2004// D blame-1.4-20240206/tests/testdata/log-v5-1.1.expout0000644000000000000000000000264210260373433017665 0ustar rootroot1.1 (username 01-Jan-01): === $Log: log,v $ 1.1 (username 01-Jan-01): === Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): === Initial revision 1.1 (username 01-Jan-01): === === 1.1 (username 01-Jan-01): 1.1 (username 01-Jan-01): # $Log: log,v $ 1.1 (username 01-Jan-01): # Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): # Initial revision 1.1 (username 01-Jan-01): # 1.1 (username 01-Jan-01): 1.1 (username 01-Jan-01): /* 1.1 (username 01-Jan-01): * $Log: log,v $ 1.1 (username 01-Jan-01): * Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): * Initial revision 1.1 (username 01-Jan-01): * 1.1 (username 01-Jan-01): */ 1.1 (username 01-Jan-01): 1.1 (username 01-Jan-01): /* $Log: log,v $ 1.1 (username 01-Jan-01): * Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): * Initial revision 1.1 (username 01-Jan-01): * 1.1 (username 01-Jan-01): */ 1.1 (username 01-Jan-01): 1.1 (username 01-Jan-01): (* $Log: log,v $ 1.1 (username 01-Jan-01): * Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): * Initial revision 1.1 (username 01-Jan-01): * 1.1 (username 01-Jan-01): *) blame-1.4-20240206/tests/testdata/file2-foo0000644000000000000000000000060310125542443016510 0ustar rootroothead 1.2; access; symbols foo:1 bar:1.2; locks; strict; comment @# @; 1.2 date 2002.02.02.02.02.02; author somebody; state Stab; branches; next 1.1; 1.1 date 2001.01.01.01.01.01; author username; state Exp; branches; next ; desc @@ 1.2 log @*** empty log message *** @ text @TEST TEST TEST TEST Example file TEST TEST TEST TEST @ 1.1 log @Initial revision @ text @d1 1 d3 1 @ blame-1.4-20240206/tests/testdata/simple.experr0000644000000000000000000000005010125542443017517 0ustar rootroot Annotations for simple *************** blame-1.4-20240206/tests/testdata/log,v0000644000000000000000000000165610260447074015766 0ustar rootroothead 1.2; access; symbols; locks; strict; comment @+@@+@; 1.2 date 2002.02.02.02.02.02; author username; state Exp; branches; next 1.1; 1.1 date 2001.01.01.01.01.01; author username; state Stab; branches; next ; desc @@ 1.2 log @This log line contains an @@ symbol... @ text @Text at top. Three ats: @@@@@@ === $Log: log,v $ === Revision 1.1 2001/01/01 01:01:01 username === Initial revision === === # $Log: log,v $ # Revision 1.1 2001/01/01 01:01:01 username # Initial revision # /* * $Log: log,v $ * Revision 1.1 2001/01/01 01:01:01 username * Initial revision * */ /* $Log: log,v $ * Revision 1.1 2001/01/01 01:01:01 username * Initial revision * */ (* $Log: log,v $ * Revision 1.1 2001/01/01 01:01:01 username * Initial revision * *) Text at bottom. @ 1.1 log @Initial revision @ text @d1 1 a1 1 === $Log$ === d3 9 a11 1 # $Log$ d14 4 a17 1 * $Log$ d20 4 a23 1 /* $Log$ d26 4 a29 1 (* $Log$ d31 2 @ blame-1.4-20240206/tests/testdata/binary.experr0000644000000000000000000000005010260151154017505 0ustar rootroot Annotations for binary *************** blame-1.4-20240206/tests/testdata/complex-1.2.1.1.1.1.expout0000644000000000000000000000043110125542443021011 0ustar rootroot1.1 (user3 01-Jan-01): Line 1 1.2 (user2 01-Jan-01): Line 2 1.2.1.1 (user1 01-Jan-01): On branch 1.2.1: 1.2.1.1 (user1 01-Jan-01): Line 1 1.2.1.1.1.1 (user1 01-Jan-01): On branch 1.2.1.1.1.1 1.2.1.1.1.1 (user1 01-Jan-01): Line 1 blame-1.4-20240206/tests/testdata/complex.experr0000644000000000000000000000005110125542443017676 0ustar rootroot Annotations for complex *************** blame-1.4-20240206/tests/testdata/keywords,v0000644000000000000000000000043510144371037017042 0ustar rootroothead 1.1; access; symbols; locks username:1.1; strict; comment @# @; 1.1 date 2001.01.01.01.01.01; author username; state Exp; branches; next ; desc @@ 1.1 log @Initial revision @ text @$Author$ $Date$ $Header$ $Id$ $Locker$ $Log$ $Name$ $RCSfile$ $Revision$ $Source$ $State$ @ blame-1.4-20240206/tests/testdata/complex-3.8.expout0000644000000000000000000000025010135174000020213 0ustar rootroot1.4 (user3 01-Jan-01): Line 0 1.1 (user3 01-Jan-01): Line 1 1.4 (user3 01-Jan-01): Line 4 1.5 (user2 01-Jan-01): Line 5 blame-1.4-20240206/tests/testdata/complex-2.2.expout0000644000000000000000000000040610125542443020220 0ustar rootroot1.4 (user3 01-Jan-01): Line 0 1.1 (user3 01-Jan-01): Line 1 1.4 (user3 01-Jan-01): Line 4 1.5 (user2 01-Jan-01): Line 5 2.1 (user1 01-Jan-01): Bump to branch 2 2.2 (user3 01-Jan-01): Line 6 blame-1.4-20240206/tests/testdata/complex-1.4.expout0000644000000000000000000000032210125542443020216 0ustar rootroot1.4 (user3 01-Jan-01): Line 0 1.1 (user3 01-Jan-01): Line 1 1.2 (user2 01-Jan-01): Line 2 1.3 (user1 01-Jan-01): Line 3 1.4 (user3 01-Jan-01): Line 4 blame-1.4-20240206/tests/testdata/complex,v0000644000000000000000000000555610125542443016653 0ustar rootroothead 3.8; branch 1; access; symbols fred:2.1 plugh:1 xyzzy:1.1.1 quux:2.1.1.1.1 baz:1.2.1.3 bar:1.2.1 foo:1.2; locks; strict; comment @# @; 3.8 date 2001.01.01.03.08.00; author username; state Exp; branches; next 3.7; 3.7 date 2001.01.01.03.07.00; author username; state Exp; branches; next 3.6; 3.6 date 2001.01.01.03.06.00; author username; state Exp; branches; next 3.5; 3.5 date 2001.01.01.03.05.00; author username; state Exp; branches; next 3.4; 3.4 date 2001.01.01.03.04.00; author user1; state A; branches; next 3.3; 3.3 date 2001.01.01.03.03.00; author user2; state B; branches; next 2.2; 2.2 date 2001.01.01.02.02.00; author user3; state C; branches; next 2.1; 2.1 date 2001.01.01.02.01.00; author user1; state D; branches; next 1.5; 1.5 date 2001.01.01.01.05.00; author user2; state A; branches; next 1.4; 1.4 date 2001.01.01.01.04.00; author user3; state B; branches; next 1.3; 1.3 date 2001.01.01.01.03.00; author user1; state C; branches; next 1.2; 1.2 date 2001.01.01.01.02.00; author user2; state D; branches 1.2.1.1 1.2.2.1; next 1.1; 1.1 date 2001.01.01.01.01.00; author user3; state A; branches; next ; 1.2.1.1 date 2001.01.01.01.02.10; author user1; state B; branches 1.2.1.1.1.1; next 1.2.1.2; 1.2.1.2 date 2001.01.01.01.02.20; author user2; state C; branches; next 1.2.1.3; 1.2.1.3 date 2001.01.01.01.02.30; author user3; state D; branches; next ; 1.2.1.1.1.1 date 2001.01.01.01.02.12; author user1; state A; branches; next 1.2.1.1.1.2; 1.2.1.1.1.2 date 2001.01.01.01.02.14; author user2; state B; branches; next ; 1.2.2.1 date 2001.01.01.01.02.40; author user3; state C; branches; next 1.2.2.2; 1.2.2.2 date 2001.01.01.01.02.50; author user1; state D; branches; next ; desc @@ 3.8 log @Header -> Name @ text @$Name$ @ 3.7 log @Id -> Header @ text @d1 1 a1 1 $Header$ @ 3.6 log @Revision -> Id @ text @d1 1 a1 1 $Id$ @ 3.5 log @Add Revision @ text @d1 1 a1 1 $Revision$ @ 3.4 log @Added Line 7 @ text @d1 1 a1 8 Line 0 Line 1 Line 4 Line 5 Bump to branch 2 Line 6 Bump to branch 3 Line 7 @ 3.3 log @Bump to branch 3 (revision 3.3) @ text @d8 1 @ 2.2 log @Added Line 6 @ text @d7 1 @ 2.1 log @Bump to branch 2 @ text @d6 1 @ 1.5 log @Removed Line 2 and Line 3 Added Line 5 @ text @d5 1 @ 1.4 log @Added Line 0 and Line 4 @ text @a2 2 Line 2 Line 3 d4 1 @ 1.3 log @Added Line 3 @ text @d1 1 d5 1 @ 1.2 log @Added Line 2 @ text @d3 1 @ 1.2.2.1 log @Another branch @ text @a2 2 On branch 1.2.2: Line 1 @ 1.2.2.2 log @Added Line 2 @ text @a4 1 Line 2 @ 1.2.1.1 log @Added branch @ text @a2 2 On branch 1.2.1: Line 1 @ 1.2.1.1.1.1 log @Added another branch @ text @a4 2 On branch 1.2.1.1.1.1 Line 1 @ 1.2.1.1.1.2 log @Removed all lines @ text @d1 6 @ 1.2.1.2 log @Added Line 2 @ text @a4 1 Line 2 @ 1.2.1.3 log @Removed original Line 1 and Line 2; Added Line 3 @ text @d1 2 a5 1 Line 3 @ 1.1 log @Initial revision @ text @d2 1 @ blame-1.4-20240206/tests/testdata/log-1.2.expout0000644000000000000000000000506110260373433017334 0ustar rootroot1.2 (username 02-Feb-02): Text at top. Three ats: @@@ 1.1 (username 01-Jan-01): 1.2 (username 02-Feb-02): === $Log: log,v $ 1.2 (username 02-Feb-02): === Revision 1.2 2002/02/02 02:02:02 username 1.2 (username 02-Feb-02): === This log line contains an @ symbol... 1.2 (username 02-Feb-02): === 1.2 (username 02-Feb-02): === Revision 1.1 2001/01/01 01:01:01 username 1.2 (username 02-Feb-02): === Initial revision 1.2 (username 02-Feb-02): === === 1.2 (username 02-Feb-02): 1.2 (username 02-Feb-02): # $Log: log,v $ 1.2 (username 02-Feb-02): # Revision 1.2 2002/02/02 02:02:02 username 1.2 (username 02-Feb-02): # This log line contains an @ symbol... 1.2 (username 02-Feb-02): # 1.2 (username 02-Feb-02): # Revision 1.1 2001/01/01 01:01:01 username 1.2 (username 02-Feb-02): # Initial revision 1.2 (username 02-Feb-02): # 1.1 (username 01-Jan-01): 1.1 (username 01-Jan-01): /* 1.2 (username 02-Feb-02): * $Log: log,v $ 1.2 (username 02-Feb-02): * Revision 1.2 2002/02/02 02:02:02 username 1.2 (username 02-Feb-02): * This log line contains an @ symbol... 1.2 (username 02-Feb-02): * 1.2 (username 02-Feb-02): * Revision 1.1 2001/01/01 01:01:01 username 1.2 (username 02-Feb-02): * Initial revision 1.2 (username 02-Feb-02): * 1.1 (username 01-Jan-01): */ 1.1 (username 01-Jan-01): 1.2 (username 02-Feb-02): /* $Log: log,v $ 1.2 (username 02-Feb-02): * Revision 1.2 2002/02/02 02:02:02 username 1.2 (username 02-Feb-02): * This log line contains an @ symbol... 1.2 (username 02-Feb-02): * 1.2 (username 02-Feb-02): * Revision 1.1 2001/01/01 01:01:01 username 1.2 (username 02-Feb-02): * Initial revision 1.2 (username 02-Feb-02): * 1.1 (username 01-Jan-01): */ 1.1 (username 01-Jan-01): 1.2 (username 02-Feb-02): (* $Log: log,v $ 1.2 (username 02-Feb-02): * Revision 1.2 2002/02/02 02:02:02 username 1.2 (username 02-Feb-02): * This log line contains an @ symbol... 1.2 (username 02-Feb-02): * 1.2 (username 02-Feb-02): * Revision 1.1 2001/01/01 01:01:01 username 1.2 (username 02-Feb-02): * Initial revision 1.2 (username 02-Feb-02): * 1.1 (username 01-Jan-01): *) 1.2 (username 02-Feb-02): 1.2 (username 02-Feb-02): Text at bottom. blame-1.4-20240206/tests/testdata/empty,v0000644000000000000000000000011310126243134016316 0ustar rootroothead ; access; symbols; locks; strict; comment @# @; desc @Empty file @ blame-1.4-20240206/tests/testdata/simple-1.1.expout0000644000000000000000000000006010125542443020034 0ustar rootroot1.1 (username 01-Jan-01): Example file blame-1.4-20240206/tests/testdata/complex-1.2.1.2.expout0000644000000000000000000000033610125542443020520 0ustar rootroot1.1 (user3 01-Jan-01): Line 1 1.2 (user2 01-Jan-01): Line 2 1.2.1.1 (user1 01-Jan-01): On branch 1.2.1: 1.2.1.1 (user1 01-Jan-01): Line 1 1.2.1.2 (user2 01-Jan-01): Line 2 blame-1.4-20240206/tests/testdata/keywords.experr0000644000000000000000000000005210125542443020077 0ustar rootroot Annotations for keywords *************** blame-1.4-20240206/tests/testdata/compat-1.2.expout0000644000000000000000000000007710260260251020031 0ustar rootroot1.2 (username 01-Jan-01): No line at end of delta textblame-1.4-20240206/tests/testdata/compat-1.1.expout0000644000000000000000000000007410126243134020027 0ustar rootroot1.1 (username 31-Dec-99): Two-digit years in date. blame-1.4-20240206/tests/testdata/compat.experr0000644000000000000000000000005010126243134017505 0ustar rootroot Annotations for compat *************** blame-1.4-20240206/tests/testdata/compat,v0000644000000000000000000000105510145577562016471 0ustar rootroothead 1.3; access; symbols; locks; strict; comment @# @; 1.3 date 2001.01.01.01.01.02; author username; state Exp; branches; next 1.2; 1.2 date 2001.01.01.01.01.01; author username; state Exp; branches; next 1.1; 1.1 date 99.12.31.23.59.59; author username; state Exp; branches; next ; desc @This RCS file is to test compatibility issues. @ 1.3 log @*** empty log message *** @ text @. . . @ 1.2 log @*** empty log message *** @ text @d1 3 a3 1 No line at end of delta text@ 1.1 log @Initial revision @ text @d1 1 a1 1 Two-digit years in date. @ blame-1.4-20240206/tests/testdata/complex-1.2.1.1.expout0000644000000000000000000000026310125542443020516 0ustar rootroot1.1 (user3 01-Jan-01): Line 1 1.2 (user2 01-Jan-01): Line 2 1.2.1.1 (user1 01-Jan-01): On branch 1.2.1: 1.2.1.1 (user1 01-Jan-01): Line 1 blame-1.4-20240206/tests/testdata/escape.experr0000644000000000000000000000005010135177316017472 0ustar rootroot Annotations for escape *************** blame-1.4-20240206/tests/testdata/CVS/0000755000000000000000000000000010432275252015441 5ustar rootrootblame-1.4-20240206/tests/testdata/CVS/Root0000644000000000000000000000006510432275252016310 0ustar rootroot:ext:foonly@blame.cvs.sourceforge.net:/cvsroot/blame blame-1.4-20240206/tests/testdata/CVS/Repository0000644000000000000000000000002510125542720017534 0ustar rootrootblame/tests/testdata blame-1.4-20240206/tests/testdata/CVS/Entries0000644000000000000000000000334010337302611016767 0ustar rootroot/.cvsignore/1.1.1.1/Sun Sep 26 13:33:23 2004// /complex-1.1.expout/1.1.1.1/Sun Sep 26 13:33:23 2004// /complex-1.2.1.1.1.1.expout/1.1.1.1/Sun Sep 26 13:33:23 2004// /complex-1.2.1.1.expout/1.1.1.1/Sun Sep 26 13:33:23 2004// /complex-1.2.1.2.expout/1.1.1.1/Sun Sep 26 13:33:23 2004// /complex-1.2.1.3.expout/1.1.1.1/Sun Sep 26 13:33:23 2004// /complex-1.4.expout/1.1.1.1/Sun Sep 26 13:33:23 2004// /complex-2.2.expout/1.1.1.1/Sun Sep 26 13:33:23 2004// /complex-3.4.expout/1.1.1.1/Sun Sep 26 13:33:23 2004// /complex.experr/1.1.1.1/Sun Sep 26 13:33:23 2004// /file2-foo/1.1.1.1/Sun Sep 26 13:33:23 2004// /keywords.experr/1.1.1.1/Sun Sep 26 13:33:23 2004// /simple,v/1.1.1.1/Sun Sep 26 13:33:23 2004// /simple-1.1.expout/1.1.1.1/Sun Sep 26 13:33:23 2004// /simple-1.2.expout/1.1.1.1/Sun Sep 26 13:33:23 2004// /simple.experr/1.1.1.1/Sun Sep 26 13:33:23 2004// D/RCS//// /compat-1.1.expout/1.1/Tue Sep 28 11:09:16 2004// /compat.experr/1.1/Tue Sep 28 11:09:16 2004// /complex,v/1.1.1.1/Sun Sep 26 13:33:23 2004/-ko/ /empty,v/1.1/Tue Sep 28 11:09:16 2004// /complex-3.8.expout/1.1/Tue Oct 19 11:18:24 2004// /escape.experr/1.1/Tue Oct 19 11:47:26 2004// /keywords,v/1.1.1.1/Wed Nov 10 10:49:03 2004/-ko/ /log.experr/1.1/Wed Nov 10 10:58:56 2004// /compat,v/1.2/Sun Nov 14 06:47:14 2004// /binary,v/1.1/Tue Jun 28 04:30:36 2005// /binary.experr/1.1/Tue Jun 28 04:30:36 2005// /binary-1.2.expout/1.3/Tue Jun 28 14:40:20 2005// /compat-1.2.expout/1.2/Tue Jun 28 14:37:29 2005// /log,v/1.3/Wed Jun 29 07:31:08 2005/-ko/ /log-1.2.expout/1.1/Wed Jun 29 01:19:23 2005/-ko/ /log-v3-1.1.expout/1.2/Wed Jun 29 06:29:27 2005/-ko/ /log-v5-1.1.expout/1.1/Wed Jun 29 01:19:23 2005/-ko/ /escape,v/1.2/Fri Nov 18 07:40:57 2005// /escape-1.2.expout/1.1/Fri Nov 18 07:40:10 2005// blame-1.4-20240206/tests/testdata/log-v3-1.1.expout0000644000000000000000000000265010260437707017667 0ustar rootroot1.1 (username 01-Jan-01): === $Log: log,v $ 1.1 (username 01-Jan-01): +@+Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): +@+Initial revision 1.1 (username 01-Jan-01): +@+ === 1.1 (username 01-Jan-01): 1.1 (username 01-Jan-01): # $Log: log,v $ 1.1 (username 01-Jan-01): +@+Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): +@+Initial revision 1.1 (username 01-Jan-01): +@+ 1.1 (username 01-Jan-01): 1.1 (username 01-Jan-01): /* 1.1 (username 01-Jan-01): * $Log: log,v $ 1.1 (username 01-Jan-01): +@+Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): +@+Initial revision 1.1 (username 01-Jan-01): +@+ 1.1 (username 01-Jan-01): */ 1.1 (username 01-Jan-01): 1.1 (username 01-Jan-01): /* $Log: log,v $ 1.1 (username 01-Jan-01): +@+Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): +@+Initial revision 1.1 (username 01-Jan-01): +@+ 1.1 (username 01-Jan-01): */ 1.1 (username 01-Jan-01): 1.1 (username 01-Jan-01): (* $Log: log,v $ 1.1 (username 01-Jan-01): +@+Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): +@+Initial revision 1.1 (username 01-Jan-01): +@+ 1.1 (username 01-Jan-01): *) blame-1.4-20240206/tests/testdata/simple,v0000644000000000000000000000060310125542443016461 0ustar rootroothead 1.2; access; symbols foo:1 bar:1.2; locks; strict; comment @# @; 1.2 date 2002.02.02.02.02.02; author somebody; state Stab; branches; next 1.1; 1.1 date 2001.01.01.01.01.01; author username; state Exp; branches; next ; desc @@ 1.2 log @*** empty log message *** @ text @TEST TEST TEST TEST Example file TEST TEST TEST TEST @ 1.1 log @Initial revision @ text @d1 1 d3 1 @ blame-1.4-20240206/tests/testdata/log.experr0000644000000000000000000000004510144372160017011 0ustar rootroot Annotations for log *************** blame-1.4-20240206/tests/testdata/binary-1.2.expout0000644000000000000000000000050610260260524020032 0ustar rootroot1.2 (username 02-Feb-02): ÿþýüûúùø÷öõôóòñðïîíìëêéèçæåäãâáàßÞÝÜÛÚÙØ×ÖÕÔÓÒÑÐÏÎÍÌËÊÉÈÇÆÅÄÃÂÁÀ¿¾½¼»º¹¸·¶µ´³²±°¯®­¬«ª©¨§¦¥¤£¢¡ Ÿžœ›š™˜—–•”“’‘ŽŒ‹Š‰ˆ‡†…„ƒ‚€~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!  1.2 (username 02-Feb-02): blame-1.4-20240206/tests/testdata/complex-3.4.expout0000644000000000000000000000054410125542443020226 0ustar rootroot1.4 (user3 01-Jan-01): Line 0 1.1 (user3 01-Jan-01): Line 1 1.4 (user3 01-Jan-01): Line 4 1.5 (user2 01-Jan-01): Line 5 2.1 (user1 01-Jan-01): Bump to branch 2 2.2 (user3 01-Jan-01): Line 6 3.3 (user2 01-Jan-01): Bump to branch 3 3.4 (user1 01-Jan-01): Line 7 blame-1.4-20240206/tests/testdata/escape,v0000644000000000000000000001230510337302611016426 0ustar rootroothead 1.2; access; symbols; locks; strict; comment @# @; 1.2 date 2001.01.01.01.01.02; author username; state Exp; branches; next 1.1; 1.1 date 2001.01.01.01.01.01; author username; state Exp; branches; next ; desc @@ 1.2 log @ @ text @ $ : @@ @@ : $ $ : @@ $ : @@ $ : @@ $ @@ : $ : @@ $ : @@ $ : @@ $ : @@ $ : @@ $ @@ : $ : @@ $ @@ : $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ : $ @@ $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ : @@ $ $ : @@ @@ $ : $ : @@ @@ : $ $ : @@ @@ $ : $ : @@ @@ $ : $ : @@ @@ : $ $ : @@ @@ : $ $ : @@ $ @@ : $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ @@ $ : @@ : $ $ : @@ @@ : $ $ @@ : @@ : $ $ : @@ @@ : $ $ : @@ @@ : $ $ @@ : @@ : $ $ @@ : @@ : $ : $ @@ @@ : $ : @@ $ @@ : $ : $ @@ @@ : $ : $ @@ @@ : $ : @@ $ @@ : $ : @@ $ @@ : $ @@ $ : @@ : $ @@ : $ @@ : $ @@ $ : @@ : $ @@ $ : @@ : $ @@ : $ @@ : $ @@ : $ @@ : $ $ @@ : @@ : $ : $ @@ @@ : $ : @@ $ @@ : $ @@ $ : $ : @@ $ @@ : $ : @@ $ : @@ $ : @@ $ : @@ $ : @@ $ @@ : $ : @@ $ @@ : $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ : $ @@ $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ : @@ $ $ : @@ @@ $ : $ : @@ @@ : $ $ : @@ @@ $ : $ : @@ @@ $ : $ : @@ @@ : $ $ : @@ @@ : $ $ : @@ $ @@ : $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ @@ $ : $ @@ : $ : @@ $ @@ : $ : @@ $ @@ : $ @@ : $ @@ : $ @@ : $ @@ : : $ @@ $ @@ : : @@ $ $ @@ : : $ @@ $ @@ : : $ @@ $ @@ : : @@ $ $ @@ : : @@ $ $ @@ : @@ $ : $ @@ : @@ : $ $ @@ : @@ $ : $ @@ : @@ $ : $ @@ : @@ : $ $ @@ : @@ : $ $ @@ : $ @@ : $ @@ : : $ @@ $ @@ : : @@ $ $ @@ : @@ $ : $ : @@ $ : @@ $ : @@ $ @@ : $ : @@ $ @@ : $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ : $ @@ $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ : @@ $ $ : @@ @@ $ : $ : @@ @@ : $ $ : @@ @@ $ : $ : @@ @@ $ : $ : @@ @@ : $ $ : @@ @@ : $ $ : @@ $ @@ : $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ @@ $ : $ : @@ $ @@ : $ : @@ $ @@ : $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ : $ @@ $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ : @@ $ $ : @@ @@ $ : $ : @@ @@ : $ $ : @@ @@ $ : $ : @@ @@ $ : $ : @@ @@ : $ $ : @@ @@ : $ $ : @@ $ @@ : $ : @@ : $ @@ $ : @@ : @@ $ $ : @@ @@ $ : $ @@ : $ @@ : $ @@ : : $ @@ $ @@ : : @@ $ $ @@ : : $ @@ $ @@ : : $ @@ $ @@ : : @@ $ $ @@ : : @@ $ $ @@ : @@ $ : $ @@ : @@ : $ $ @@ : @@ $ : $ @@ : @@ $ : $ @@ : @@ : $ $ @@ : @@ : $ $ @@ : $ @@ : $ @@ : : $ @@ $ @@ : : @@ $ $ @@ : @@ $ : $ @@ : : $ @@ $ @@ : : @@ $ $ @@ : : $ @@ $ @@ : : $ @@ $ @@ : : @@ $ $ @@ : : @@ $ $ @@ : @@ $ : $ @@ : @@ : $ $ @@ : @@ $ : $ @@ : @@ $ : $ @@ : @@ : $ $ @@ : @@ : $ $ @@ : $ @@ : $ @@ : : $ @@ $ @@ : : @@ $ $ @@ : @@ $ : : $ @@ : @@ $ : $ @@ : $ @@ : $ @@ : $ @@ : $ @@ : @@ $ : $ @@ : @@ $ : $ @@ @@ $ : : $ @@ @@ : $ : $ @@ @@ $ : : $ @@ @@ $ : : $ @@ @@ : $ : $ @@ @@ : $ : $ @@ $ @@ : : $ @@ : $ @@ : $ @@ : @@ $ : $ @@ @@ $ : : @@ $ : $ @@ : @@ $ : $ @@ : @@ $ : @@ $ : @@ $ : @@ $ : @@ $ @@ $ : : @@ $ @@ : $ : @@ $ @@ $ : : @@ $ @@ $ : : @@ $ @@ : $ : @@ $ @@ : $ : @@ $ $ @@ : : @@ $ : $ @@ : @@ $ : @@ $ : @@ $ @@ $ : : $ @@ : $ @@ : $ @@ : @@ $ : $ @@ : @@ $ : $ @@ @@ $ : : $ @@ @@ : $ : $ @@ @@ $ : : $ @@ @@ $ : : $ @@ @@ : $ : $ @@ @@ : $ : $ @@ $ @@ : : $ @@ : $ @@ : $ @@ : @@ $ : $ @@ @@ $ : : $ @@ : @@ $ : $ @@ : @@ $ : $ @@ @@ $ : : $ @@ @@ : $ : $ @@ @@ $ : : $ @@ @@ $ : : $ @@ @@ : $ : $ @@ @@ : $ : $ @@ $ @@ : : $ @@ : $ @@ : $ @@ : @@ $ : $ @@ @@ $ : : @@ $ : @@ $ : @@ $ @@ $ : : @@ $ @@ : $ : @@ $ @@ $ : : @@ $ @@ $ : : @@ $ @@ : $ : @@ $ @@ : $ : @@ $ $ @@ : : @@ $ : $ @@ : @@ $ : @@ $ : @@ $ @@ $ : : @@ $ @@ $ : : @@ $ @@ : $ : @@ $ @@ $ : : @@ $ @@ $ : : @@ $ @@ : $ : @@ $ @@ : $ : @@ $ $ @@ : : @@ $ : $ @@ : @@ $ : @@ $ : @@ $ @@ $ : @@ $ : @@ : $ @@ $ : @@ $ : @@ $ : @@ $ : @@ $ : @@ : $ @@ $ : @@ : $ @@ $ : $ @@ : @@ $ : : $ @@ @@ $ : : @@ $ @@ $ : @@ $ : @@ : $ @@ $ : @@ : $ @@ $ : @@ : $ @@ : $ @@ : $ @@ : $ @@ : $ $ @@ : @@ : $ : $ @@ @@ : $ : @@ $ @@ : $ @@ $ : @@ $ : @@ $ : @@ $ : @@ : $ @@ $ : @@ : $ @@ $ : $ @@ : @@ $ : : $ @@ @@ $ : : @@ $ @@ $ : @@ $ : @@ $ : @@ : $ @@ $ : @@ : $ @@ $ : $ @@ : @@ $ : : $ @@ @@ $ : : @@ $ @@ $ : @@ $ : @@ : $ @@ : $ @@ : $ $ @@ : @@ : $ : $ @@ @@ : $ : @@ $ @@ : $ @@ $ : @@ : $ $ @@ : @@ : $ : $ @@ @@ : $ : @@ $ @@ : $ @@ $ : $ @@ : : $ @@ $ @@ : : @@ $ $ @@ : @@ $ : : $ @@ : @@ $ : $ @@ @@ $ : : @@ $ @@ $ : @ 1.1 log @Initial revision @ text @d1 276 a276 1 $Id: escape,v,v 1.2 2005/11/18 07:40:10 foonly Exp $ @ blame-1.4-20240206/tests/testdata/binary,v0000644000000000000000000000154310260151154016453 0ustar rootroothead 1.2; access; symbols; locks; strict; comment @# @; 1.2 date 2002.02.02.02.02.02; author username; state Exp; branches; next 1.1; 1.1 date 2001.01.01.01.01.01; author username; state Exp; branches; next ; desc @This RCS file contains binary data. @ 1.2 log @*** empty log message *** @ text @ÿþýüûúùø÷öõôóòñðïîíìëêéèçæåäãâáàßÞÝÜÛÚÙØ×ÖÕÔÓÒÑÐÏÎÍÌËÊÉÈÇÆÅÄÃÂÁÀ¿¾½¼»º¹¸·¶µ´³²±°¯®­¬«ª©¨§¦¥¤£¢¡ Ÿžœ›š™˜—–•”“’‘ŽŒ‹Š‰ˆ‡†…„ƒ‚€~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@@?>=<;:9876543210/.-,+*)('&%$#"!  @ 1.1 log @Initial revision @ text @d1 2 a2 2   !"#$%&'()*+,-./0123456789:;<=>?@@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ@ blame-1.4-20240206/tests/testdata/complex-1.1.expout0000644000000000000000000000005210125542443020213 0ustar rootroot1.1 (user3 01-Jan-01): Line 1 blame-1.4-20240206/tests/testdata/escape-1.2.expout0000644000000000000000000003337410337302532020020 0ustar rootroot1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ $ : @ 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ $ : @ 1.2 (username 01-Jan-01): $ : @ $ : @ 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): @ : $ $ : @ 1.2 (username 01-Jan-01): @ : $ $ @ : 1.2 (username 01-Jan-01): @ : $ $ : @ 1.2 (username 01-Jan-01): @ : $ $ : @ 1.2 (username 01-Jan-01): @ : $ $ @ : 1.2 (username 01-Jan-01): @ : $ $ @ : 1.2 (username 01-Jan-01): @ : $ : $ @ 1.2 (username 01-Jan-01): @ : $ : @ $ 1.2 (username 01-Jan-01): @ : $ : $ @ 1.2 (username 01-Jan-01): @ : $ : $ @ 1.2 (username 01-Jan-01): @ : $ : @ $ 1.2 (username 01-Jan-01): @ : $ : @ $ 1.2 (username 01-Jan-01): @ : $ @ $ : 1.2 (username 01-Jan-01): @ : $ @ : $ 1.2 (username 01-Jan-01): @ : $ @ $ : 1.2 (username 01-Jan-01): @ : $ @ $ : 1.2 (username 01-Jan-01): @ : $ @ : $ 1.2 (username 01-Jan-01): @ : $ @ : $ 1.2 (username 01-Jan-01): @ : $ $ @ : 1.2 (username 01-Jan-01): @ : $ : $ @ 1.2 (username 01-Jan-01): @ : $ : @ $ 1.2 (username 01-Jan-01): @ : $ @ $ : 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ $ : @ 1.2 (username 01-Jan-01): $ : @ $ : @ 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ @ : $ : @ 1.2 (username 01-Jan-01): $ @ : $ : @ 1.2 (username 01-Jan-01): $ @ : $ @ : 1.2 (username 01-Jan-01): $ @ : $ @ : 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ @ : @ : $ 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ @ : @ : $ 1.2 (username 01-Jan-01): $ @ : @ : $ 1.2 (username 01-Jan-01): $ @ : $ @ : 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ : @ $ : @ 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ @ : $ 1.2 (username 01-Jan-01): $ : @ $ @ : 1.2 (username 01-Jan-01): $ : @ : $ @ 1.2 (username 01-Jan-01): $ : @ : @ $ 1.2 (username 01-Jan-01): $ : @ @ $ : 1.2 (username 01-Jan-01): $ @ : $ @ : 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ @ : @ : $ 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ @ : @ : $ 1.2 (username 01-Jan-01): $ @ : @ : $ 1.2 (username 01-Jan-01): $ @ : $ @ : 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ @ : @ : $ 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): $ @ : @ : $ 1.2 (username 01-Jan-01): $ @ : @ : $ 1.2 (username 01-Jan-01): $ @ : $ @ : 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ : $ @ 1.2 (username 01-Jan-01): : $ @ : $ @ 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : $ @ @ : $ 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : $ @ @ : $ 1.2 (username 01-Jan-01): : $ @ @ : $ 1.2 (username 01-Jan-01): : $ @ $ @ : 1.2 (username 01-Jan-01): : $ @ : $ @ 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : @ $ : $ @ 1.2 (username 01-Jan-01): : @ $ : $ @ 1.2 (username 01-Jan-01): : @ $ : @ $ 1.2 (username 01-Jan-01): : @ $ : @ $ 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : @ $ @ : $ 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : @ $ @ : $ 1.2 (username 01-Jan-01): : @ $ @ : $ 1.2 (username 01-Jan-01): : @ $ $ @ : 1.2 (username 01-Jan-01): : @ $ : $ @ 1.2 (username 01-Jan-01): : @ $ : @ $ 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : $ @ : $ @ 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : $ @ @ : $ 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : $ @ @ : $ 1.2 (username 01-Jan-01): : $ @ @ : $ 1.2 (username 01-Jan-01): : $ @ $ @ : 1.2 (username 01-Jan-01): : $ @ : $ @ 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : $ @ @ : $ 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : $ @ @ : $ 1.2 (username 01-Jan-01): : $ @ @ : $ 1.2 (username 01-Jan-01): : $ @ $ @ : 1.2 (username 01-Jan-01): : $ @ : $ @ 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : @ $ : @ $ 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : @ $ @ : $ 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : @ $ @ : $ 1.2 (username 01-Jan-01): : @ $ @ : $ 1.2 (username 01-Jan-01): : @ $ $ @ : 1.2 (username 01-Jan-01): : @ $ : $ @ 1.2 (username 01-Jan-01): : @ $ : @ $ 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : @ $ @ : $ 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): : @ $ @ : $ 1.2 (username 01-Jan-01): : @ $ @ : $ 1.2 (username 01-Jan-01): : @ $ $ @ : 1.2 (username 01-Jan-01): : @ $ : $ @ 1.2 (username 01-Jan-01): : @ $ : @ $ 1.2 (username 01-Jan-01): : @ $ @ $ : 1.2 (username 01-Jan-01): @ $ : @ : $ 1.2 (username 01-Jan-01): @ $ : @ $ : 1.2 (username 01-Jan-01): @ $ : @ $ : 1.2 (username 01-Jan-01): @ $ : @ : $ 1.2 (username 01-Jan-01): @ $ : @ : $ 1.2 (username 01-Jan-01): @ $ : $ @ : 1.2 (username 01-Jan-01): @ $ : : $ @ 1.2 (username 01-Jan-01): @ $ : : @ $ 1.2 (username 01-Jan-01): @ $ : @ $ : 1.2 (username 01-Jan-01): @ : $ @ $ : 1.2 (username 01-Jan-01): @ : $ @ $ : 1.2 (username 01-Jan-01): @ : $ @ : $ 1.2 (username 01-Jan-01): @ : $ @ : $ 1.2 (username 01-Jan-01): @ : $ $ @ : 1.2 (username 01-Jan-01): @ : $ : $ @ 1.2 (username 01-Jan-01): @ : $ : @ $ 1.2 (username 01-Jan-01): @ : $ @ $ : 1.2 (username 01-Jan-01): @ $ : @ $ : 1.2 (username 01-Jan-01): @ $ : @ : $ 1.2 (username 01-Jan-01): @ $ : @ : $ 1.2 (username 01-Jan-01): @ $ : $ @ : 1.2 (username 01-Jan-01): @ $ : : $ @ 1.2 (username 01-Jan-01): @ $ : : @ $ 1.2 (username 01-Jan-01): @ $ : @ $ : 1.2 (username 01-Jan-01): @ $ : @ : $ 1.2 (username 01-Jan-01): @ $ : @ : $ 1.2 (username 01-Jan-01): @ $ : $ @ : 1.2 (username 01-Jan-01): @ $ : : $ @ 1.2 (username 01-Jan-01): @ $ : : @ $ 1.2 (username 01-Jan-01): @ $ : @ $ : 1.2 (username 01-Jan-01): @ : $ @ : $ 1.2 (username 01-Jan-01): @ : $ $ @ : 1.2 (username 01-Jan-01): @ : $ : $ @ 1.2 (username 01-Jan-01): @ : $ : @ $ 1.2 (username 01-Jan-01): @ : $ @ $ : 1.2 (username 01-Jan-01): @ : $ $ @ : 1.2 (username 01-Jan-01): @ : $ : $ @ 1.2 (username 01-Jan-01): @ : $ : @ $ 1.2 (username 01-Jan-01): @ : $ @ $ : 1.2 (username 01-Jan-01): $ @ : : $ @ 1.2 (username 01-Jan-01): $ @ : : @ $ 1.2 (username 01-Jan-01): $ @ : @ $ : 1.2 (username 01-Jan-01): : $ @ : @ $ 1.2 (username 01-Jan-01): : $ @ @ $ : 1.2 (username 01-Jan-01): : @ $ @ $ : blame-1.4-20240206/tests/date.at0000644000000000000000000001076314560262764014461 0ustar rootrootAT_BANNER([[-d and --date options.]]) AT_SETUP([Missing date argument]) AT_KEYWORDS([date]) AT_KEYWORDS([errors]) AT_CHECK([[blame $testdir/simple,v -d]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Date after all revisions]) AT_KEYWORDS([date]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -d'2002-02-03 UTC' $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame --date='2002-02-03 UTC' $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Date just after a revision]) AT_KEYWORDS([date]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -d'2002-02-02 02:02:03 UTC' $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Date on a revision]) AT_KEYWORDS([date]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -d'2002-02-02 02:02:02 UTC' $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Date just before a revision]) AT_KEYWORDS([date]) cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -d'2002-02-02 02:02:01 UTC' $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Date between revisions]) AT_KEYWORDS([date]) cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -d'2001-01-02 UTC' $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Date before all revisions]) AT_KEYWORDS([date]) AT_KEYWORDS([errors]) AT_CHECK([[blame -d'2000-01-01 UTC' $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Unparsable date]) AT_KEYWORDS([date]) AT_KEYWORDS([errors]) AT_CHECK([[blame -d'floopy' $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Unknown timezone]) AT_KEYWORDS([date]) AT_KEYWORDS([errors]) AT_KEYWORDS([zone]) AT_CHECK([[blame -d'2000-01-01 FLOOPY' $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([No timezone]) AT_KEYWORDS([date]) AT_KEYWORDS([zone]) cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout AT_CHECK([[blame -d'2002-02-02 02:02:03' $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame -d'2002-02-02 02:02:02' $testdir/simple,v]], 0, expout, experr) rm -f expout cp $testdir/simple-1.1.expout expout AT_CHECK([[blame -d'2002-02-02 02:02:01' $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([dd-Mon-yyyy hh:mm:ss]) AT_KEYWORDS([date]) cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout AT_CHECK([[blame -d'02-Feb-2002 02:02:03 UTC' $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame -d'02-Feb-2002 02:02:02 UTC' $testdir/simple,v]], 0, expout, experr) rm -f expout cp $testdir/simple-1.1.expout expout AT_CHECK([[blame -d'02-Feb-2002 02:02:01 UTC' $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([h:mm:ss AM yyyymmdd]) AT_KEYWORDS([date]) cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout AT_CHECK([[blame -d'2:02:03 am 02-Feb-2002 UTC' $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame -d'2:02:02 am 02-Feb-2002 UTC' $testdir/simple,v]], 0, expout, experr) rm -f expout cp $testdir/simple-1.1.expout expout AT_CHECK([[blame -d'2:02:01 am 02-Feb-2002 UTC' $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Unusual timezone]) AT_KEYWORDS([date]) AT_KEYWORDS([zone]) cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout AT_CHECK([[blame -d'11:02:03 am 02-Feb-2002 AWSST' $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame -d'04:02:02 am 02-Feb-2002 FWT' $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame -d'09:32:02 pm 01-Feb-2002 -04:30' $testdir/simple,v]], 0, expout, experr) rm -f expout cp $testdir/simple-1.1.expout expout AT_CHECK([[blame -d'09:32:01 pm 01-Feb-2002 -04:30' $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([With -z or --zone option]) AT_KEYWORDS([date]) AT_KEYWORDS([zone]) cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout AT_CHECK([[blame -d'11:02:03 am 02-Feb-2002' -z AWSST $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame -d'04:02:02 am 02-Feb-2002' -z FWT $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame -d'09:32:02 pm 01-Feb-2002' -z -04:30 $testdir/simple,v]], 0, expout, experr) rm -f expout cp $testdir/simple-1.1.expout expout AT_CHECK([[blame -z -04:30 -d'09:32:01 pm 01-Feb-2002' $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Multiple dates]) AT_KEYWORDS([date]) AT_KEYWORDS([errors]) AT_CHECK([[blame -d'2001-01-01 01:01:01 UTC' -d'2002-02-02 02:02:02 UTC' $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP blame-1.4-20240206/tests/atlocal.in0000644000000000000000000000100514560275132015143 0ustar rootroottestdir=`(cd "./testdata"; exec pwd)` username=`whoami 2>/dev/null` space=" " if test "@FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR@" = 1; then slash="\\" else slash="/" fi package_string="@PACKAGE_STRING@" package_date="@PACKAGE_DATE@" PRELOAD= BLAME=$abs_top_builddir/src/blame if test "$VALGRIND" = 1; then if test "@FASTEXIT@" = 1; then PRELOAD="valgrind -q --tool=memcheck --error-exitcode=42" else PRELOAD="valgrind -q --tool=memcheck --error-exitcode=42 --leak-check=yes" fi fi export PRELOAD BLAME blame-1.4-20240206/tests/argv.at0000644000000000000000000000243014560275100014457 0ustar rootrootAT_BANNER([[Command line argument parsing.]]) AT_SETUP([No arguments]) AT_KEYWORDS([argv]) AT_KEYWORDS([errors]) AT_CHECK([[blame]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Invalid argument]) AT_KEYWORDS([argv]) AT_KEYWORDS([errors]) AT_CHECK([[blame --footle]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([-? and --help]) AT_KEYWORDS([argv]) AT_CHECK([[blame -?]], 0, ignore, ) AT_CHECK([[blame --help]], 0, ignore, ) AT_CLEANUP AT_SETUP([-V and --version]) AT_KEYWORDS([argv]) cat < expout $package_string ($package_date); emulating RCS version 5 EOF AT_CHECK([[blame -V]], 0, expout, ) AT_CHECK([[blame --version]], 0, stdout, ) AT_CLEANUP AT_SETUP([Non-existent working file]) AT_KEYWORDS([argv]) AT_KEYWORDS([errors]) AT_CHECK([[blame /nonexistent]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Non-existent RCS file]) AT_KEYWORDS([argv]) AT_KEYWORDS([errors]) AT_CHECK([[blame /nonexistent,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Filenames only]) AT_KEYWORDS([argv]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame $testdir/simple,v]], 0, expout, experr) rm -f experr cat $testdir/simple.experr | sed "s,simple,$testdir/simple,g" > experr AT_CHECK([[blame $testdir/simple]], 0, expout, experr) AT_CLEANUP blame-1.4-20240206/tests/blame0000755000000000000000000000012710150573442014202 0ustar rootroot#! /bin/sh case $# in 0) exec $PRELOAD $BLAME ;; *) exec $PRELOAD $BLAME "$@" ;; esac blame-1.4-20240206/tests/branch.at0000644000000000000000000001345610261001154014755 0ustar rootrootAT_BANNER([[Resolving revisions on branches.]]) AT_SETUP([Revision on branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) cp $testdir/complex-1.2.1.2.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r1.2.1.2 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Revision on deep branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) cp $testdir/complex-1.2.1.1.1.1.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r1.2.1.1.1.1 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Valid branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) cp $testdir/complex.experr experr AT_CHECK([[blame -r1.2.1.1.1 $testdir/complex,v]], 0, , experr) AT_CLEANUP AT_SETUP([Invalid branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) AT_CHECK([[blame -r1.2.1.3.1 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid branch and dot]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) cp $testdir/complex.experr experr AT_CHECK([[blame -r1.2.1.1.1. $testdir/complex,v]], 0, , experr) AT_CLEANUP AT_SETUP([Invalid branch and dot]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) AT_CHECK([[blame -r1.2.1.3.1. $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Dot and revision on branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) cp $testdir/complex-1.2.1.2.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r.2.1.2 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Dot and late revision on branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r.2.1.10 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Dot and early revision on branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([errors]) AT_KEYWORDS([rev]) AT_CHECK([[blame -r.2.1.0 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Dot and branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r.2.1 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Dot, branch and dot]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r.2.1. $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -rbar $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic branch and dot]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -rbar. $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic branch and revision]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.2.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -rbar.2 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic branch and late revision]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -rbar.10 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic branch and early revision]) AT_KEYWORDS([branch]) AT_KEYWORDS([errors]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) AT_CHECK([[blame -rbar.0 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Symbolic revision on branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -rbaz $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Dot and symbolic revision on branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.1.1.1.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r.quux $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Dot and symbolic branch]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r.fred $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Dot, symbolic branch and dot]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r.fred. $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic branch and symbolic revision]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.1.1.1.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -rplugh.quux $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Number, symbol and symbol]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.1.1.1.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r1.fred.xyzzy $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbol, number and symbol]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.1.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -rfoo.1.plugh $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbol, symbol and number]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.1.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -rfoo.plugh.1 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Number, symbol and number]) AT_KEYWORDS([branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/complex-1.2.1.1.1.1.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r1.2.xyzzy.1 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP blame-1.4-20240206/tests/rcs.at0000644000000000000000000000142510260233067014311 0ustar rootrootAT_BANNER([[RCS file parsing.]]) AT_SETUP([No revisions present]) AT_KEYWORDS([rcs]) AT_KEYWORDS([errors]) AT_CHECK([[blame $testdir/empty,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Two-digit year before 2000]) AT_KEYWORDS([rcs]) cp $testdir/compat-1.1.expout expout cp $testdir/compat.experr experr AT_CHECK([[blame -r1.1 $testdir/compat,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Missing empty line after delta text]) AT_KEYWORDS([rcs]) cp $testdir/compat-1.2.expout expout cp $testdir/compat.experr experr AT_CHECK([[blame -r1.2 $testdir/compat,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Binary data]) AT_KEYWORDS([rcs]) cp $testdir/binary-1.2.expout expout cp $testdir/binary.experr experr AT_CHECK([[blame -r1.2 $testdir/binary,v]], 0, expout, experr) AT_CLEANUP blame-1.4-20240206/tests/expand.at0000644000000000000000000002001410144371756015005 0ustar rootrootAT_BANNER([[-k and --expand options.]]) AT_SETUP([Default substitutions]) AT_KEYWORDS([expand]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Locker: \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr AT_CHECK([[blame $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Default substitutions, with timezone]) AT_KEYWORDS([expand]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2000-12-31 20:01:01-05 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2000-12-31 20:01:01-05 username Exp \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2000-12-31 20:01:01-05 username Exp \$ 1.1 (username 01-Jan-01): \$Locker: \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): Revision 1.1 2000-12-31 20:01:01-05 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr AT_CHECK([[blame -zEST $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Missing keyword substitution argument]) AT_KEYWORDS([expand]) AT_KEYWORDS([errors]) AT_CHECK([[blame $testdir/keywords,v -k]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Keys and values (-kkv)]) AT_KEYWORDS([expand]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Locker: \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr AT_CHECK([[blame -kkv $testdir/keywords,v]], 0, expout, experr) AT_CHECK([[blame --expand=kv $testdir/keywords,v]], 0, expout, experr) AT_CHECK([[blame --expand kv $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Keys, values and locker (-kkvl)]) AT_KEYWORDS([expand]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp username \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp username \$ 1.1 (username 01-Jan-01): \$Locker: username \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr AT_CHECK([[blame -kkvl $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Keys only (-kk)]) AT_KEYWORDS([expand]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): \$Author\$ 1.1 (username 01-Jan-01): \$Date\$ 1.1 (username 01-Jan-01): \$Header\$ 1.1 (username 01-Jan-01): \$Id\$ 1.1 (username 01-Jan-01): \$Locker\$ 1.1 (username 01-Jan-01): \$Log\$ 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name\$ 1.1 (username 01-Jan-01): \$RCSfile\$ 1.1 (username 01-Jan-01): \$Revision\$ 1.1 (username 01-Jan-01): \$Source\$ 1.1 (username 01-Jan-01): \$State\$ EOF cp $testdir/keywords.experr experr AT_CHECK([[blame -kk $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Old keywords strings (-ko)]) AT_KEYWORDS([expand]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): \$Author\$ 1.1 (username 01-Jan-01): \$Date\$ 1.1 (username 01-Jan-01): \$Header\$ 1.1 (username 01-Jan-01): \$Id\$ 1.1 (username 01-Jan-01): \$Locker\$ 1.1 (username 01-Jan-01): \$Log\$ 1.1 (username 01-Jan-01): \$Name\$ 1.1 (username 01-Jan-01): \$RCSfile\$ 1.1 (username 01-Jan-01): \$Revision\$ 1.1 (username 01-Jan-01): \$Source\$ 1.1 (username 01-Jan-01): \$State\$ EOF cp $testdir/keywords.experr experr AT_CHECK([[blame -ko $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Binary image of old keywords strings (-kb)]) AT_KEYWORDS([expand]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): \$Author\$ 1.1 (username 01-Jan-01): \$Date\$ 1.1 (username 01-Jan-01): \$Header\$ 1.1 (username 01-Jan-01): \$Id\$ 1.1 (username 01-Jan-01): \$Locker\$ 1.1 (username 01-Jan-01): \$Log\$ 1.1 (username 01-Jan-01): \$Name\$ 1.1 (username 01-Jan-01): \$RCSfile\$ 1.1 (username 01-Jan-01): \$Revision\$ 1.1 (username 01-Jan-01): \$Source\$ 1.1 (username 01-Jan-01): \$State\$ EOF cp $testdir/keywords.experr experr AT_CHECK([[blame -kb $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Values only (-kv)]) AT_KEYWORDS([expand]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): username 1.1 (username 01-Jan-01): 2001/01/01 01:01:01 1.1 (username 01-Jan-01): $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp 1.1 (username 01-Jan-01): keywords,v 1.1 2001/01/01 01:01:01 username Exp 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): keywords,v 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): keywords,v 1.1 (username 01-Jan-01): 1.1 1.1 (username 01-Jan-01): $testdir/keywords,v 1.1 (username 01-Jan-01): Exp EOF cp $testdir/keywords.experr experr AT_CHECK([[blame -kv $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Multiple substitution types]) AT_KEYWORDS([expand]) AT_KEYWORDS([errors]) AT_CHECK([[blame -ko -kkvl $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP blame-1.4-20240206/tests/package.m40000644000000000000000000000050114560304314015024 0ustar rootroot# Signature of the current package. m4_define([AT_PACKAGE_NAME], [blame]) m4_define([AT_PACKAGE_TARNAME], [blame]) m4_define([AT_PACKAGE_VERSION], [1.4]) m4_define([AT_PACKAGE_STRING], [blame 1.4]) m4_define([AT_PACKAGE_DATE], [20240206]) m4_define([AT_PACKAGE_BUGREPORT], [dickey@invisible-island.net]) blame-1.4-20240206/tests/pairing.at0000644000000000000000000000355710135214010015147 0ustar rootrootAT_BANNER([[Filename pairing.]]) AT_SETUP([Working file, then corresponding RCS file]) AT_KEYWORDS([pairing]) cp $testdir/simple-1.2.expout expout cat $testdir/simple.experr | sed "s,simple,$testdir/simple,g" > experr AT_CHECK([[blame $testdir/simple $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Working file, then independent working file]) AT_KEYWORDS([pairing]) cat $testdir/simple-1.2.expout $testdir/complex-3.8.expout > expout ( cat $testdir/simple.experr | sed "s,simple,$testdir/simple,g" cat $testdir/complex.experr | sed "s,complex,$testdir/complex,g" ) > experr AT_CHECK([[blame $testdir/simple $testdir/complex]], 0, expout, experr) AT_CLEANUP AT_SETUP([Working file, then independent RCS file]) AT_KEYWORDS([pairing]) cat $testdir/simple-1.2.expout $testdir/complex-3.8.expout > expout ( cat $testdir/simple.experr | sed "s,simple,$testdir/simple,g" cat $testdir/complex.experr ) > experr AT_CHECK([[blame $testdir/simple $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([RCS file, then corresponding working file]) AT_KEYWORDS([pairing]) cp $testdir/simple-1.2.expout expout cat $testdir/simple.experr | sed "s,simple,$testdir/simple,g" > experr AT_CHECK([[blame $testdir/simple,v $testdir/simple]], 0, expout, experr) AT_CLEANUP AT_SETUP([RCS file, then independent working file]) AT_KEYWORDS([pairing]) cat $testdir/simple-1.2.expout $testdir/complex-3.8.expout > expout ( cat $testdir/simple.experr cat $testdir/complex.experr | sed "s,complex,$testdir/complex,g" ) > experr AT_CHECK([[blame $testdir/simple,v $testdir/complex]], 0, expout, experr) AT_CLEANUP AT_SETUP([RCS file, then independent RCS file]) AT_KEYWORDS([pairing]) cat $testdir/simple-1.2.expout $testdir/complex-3.8.expout > expout cat $testdir/simple.experr $testdir/complex.experr > experr AT_CHECK([[blame $testdir/simple,v $testdir/complex,v]], 0, expout, experr) AT_CLEANUP blame-1.4-20240206/tests/mixed.at0000644000000000000000000001577110125542443014642 0ustar rootrootAT_BANNER([[Mixing -r, -d, -s and -w options.]]) AT_SETUP([Valid -r and -d combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([rev]) AT_KEYWORDS([date]) cp $testdir/complex-3.4.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r3.4 -d'2001/01/01 03:04:01' $testdir/complex,v]], 0, expout, experr) AT_CHECK([[blame -r3.4 -d'2001/01/01 03:04:00' $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -r and -d combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([rev]) AT_KEYWORDS([date]) AT_CHECK([[blame -r3.4 -d'2001/01/01 03:03:59' $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid -r and -s combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([rev]) AT_KEYWORDS([state]) cp $testdir/complex-3.4.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r3.4 -sA $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -r and -s combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([rev]) AT_KEYWORDS([state]) AT_CHECK([[blame -r3.4 -sB $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid -r and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([rev]) AT_KEYWORDS([author]) cp $testdir/complex-3.4.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r3.4 -wuser1 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -r and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([rev]) AT_KEYWORDS([author]) AT_CHECK([[blame -r3.4 -wuser2 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid -d and -s combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([date]) AT_KEYWORDS([state]) cp $testdir/complex-1.1.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -d'2001/01/01 01:01:00' -sA $testdir/complex,v]], 0, expout, experr) AT_CHECK([[blame -d'2001/01/01 01:01:30' -sA $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -d and -s combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([date]) AT_KEYWORDS([state]) AT_CHECK([[blame -d'2001/01/01 01:01:30' -sB $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid -d and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([date]) AT_KEYWORDS([author]) cp $testdir/complex-1.1.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -d'2001/01/01 01:01:00' -wuser3 $testdir/complex,v]], 0, expout, experr) AT_CHECK([[blame -d'2001/01/01 01:01:30' -wuser3 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -d and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([date]) AT_KEYWORDS([author]) AT_CHECK([[blame -d'2001/01/01 01:01:30' -wuser2 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid -s and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([state]) AT_KEYWORDS([author]) cp $testdir/complex-1.1.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -sA -wuser3 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -s and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([state]) AT_KEYWORDS([author]) AT_CHECK([[blame -sC -wuser2 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid -r, -d and -s combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([rev]) AT_KEYWORDS([date]) AT_KEYWORDS([state]) cp $testdir/complex-2.2.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r2.2 -d'2001/01/01 03:10:00' -sC $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -r, -d and -s combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([rev]) AT_KEYWORDS([date]) AT_KEYWORDS([state]) AT_CHECK([[blame -r2.1 -d'2001/01/01 03:10:00' -sC $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r2.2 -d'2001/01/01 01:10:00' -sC $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r2.2 -d'2001/01/01 03:10:00' -sA $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid -r, -d and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([rev]) AT_KEYWORDS([date]) AT_KEYWORDS([author]) cp $testdir/complex-2.2.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r2.2 -d'2001/01/01 03:10:00' -wuser3 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -r, -d and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([rev]) AT_KEYWORDS([date]) AT_KEYWORDS([author]) AT_CHECK([[blame -r2.1 -d'2001/01/01 03:10:00' -wuser3 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r2.2 -d'2001/01/01 01:10:00' -wuser3 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r2.2 -d'2001/01/01 03:10:00' -wuser2 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid -r, -s and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([rev]) AT_KEYWORDS([state]) AT_KEYWORDS([author]) cp $testdir/complex-2.2.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r2.2 -sC -wuser3 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -r, -s and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([rev]) AT_KEYWORDS([state]) AT_KEYWORDS([author]) AT_CHECK([[blame -r2.1 -sC -wuser3 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r2.2 -sA -wuser3 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r2.2 -sC -wuser2 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid -d, -s and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([date]) AT_KEYWORDS([state]) AT_KEYWORDS([author]) cp $testdir/complex-1.4.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -d'2001/01/01 01:10:00' -sB -wuser3 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -d, -s and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([date]) AT_KEYWORDS([state]) AT_KEYWORDS([author]) AT_CHECK([[blame -d'2001/01/01 01:02:30' -sB -wuser3 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -d'2001/01/01 01:10:00' -sC -wuser3 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -d'2001/01/01 01:10:00' -sB -wuser2 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid -r, -d, -s and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([rev]) AT_KEYWORDS([date]) AT_KEYWORDS([state]) AT_KEYWORDS([author]) cp $testdir/complex-1.4.expout expout cp $testdir/complex.experr experr AT_CHECK([[blame -r1.4 -d'2001/01/01 01:10:00' -sB -wuser3 $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid -r, -d, -s and -w combo]) AT_KEYWORDS([mixed]) AT_KEYWORDS([errors]) AT_KEYWORDS([rev]) AT_KEYWORDS([date]) AT_KEYWORDS([state]) AT_KEYWORDS([author]) AT_CHECK([[blame -r1.3 -d'2001/01/01 01:10:00' -sB -wuser3 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r1.4 -d'2001/01/01 01:02:30' -sB -wuser3 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r1.4 -d'2001/01/01 01:10:00' -sC -wuser3 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r1.4 -d'2001/01/01 01:10:00' -sB -wuser2 $testdir/complex,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP blame-1.4-20240206/tests/testsuite0000755000000000000000000072062514560304445015173 0ustar rootroot#! /bin/sh # Generated from testsuite.at by GNU Autoconf 2.69. # # Copyright (C) 2009-2012 Free Software Foundation, Inc. # # This test suite 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 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 # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (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 # 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. as_myself= 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 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="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_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { 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_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error 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 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'` if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi # 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_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # 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; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # 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 } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac 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 -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' 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='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # 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'" SHELL=${CONFIG_SHELL-/bin/sh} # How were we run? at_cli_args="$@" # Not all shells have the 'times' builtin; the subshell is needed to make # sure we discard the 'times: not found' message from the shell. at_times_p=false (times) >/dev/null 2>&1 && at_times_p=: # CLI Arguments to pass to the debugging scripts. at_debug_args= # -e sets to true at_errexit_p=false # Shall we be verbose? ':' means no, empty means yes. at_verbose=: at_quiet= # Running several jobs in parallel, 0 means as many as test groups. at_jobs=1 at_traceon=: at_trace_echo=: at_check_filter_trace=: # Shall we keep the debug scripts? Must be `:' when the suite is # run by a debug script, so that the script doesn't remove itself. at_debug_p=false # Display help message? at_help_p=false # Display the version message? at_version_p=false # List test groups? at_list_p=false # --clean at_clean=false # Test groups to run at_groups= # Whether to rerun failed tests. at_recheck= # Whether a write failure occurred at_write_fail=0 # The directory we run the suite in. Default to . if no -C option. at_dir=`pwd` # An absolute reference to this testsuite script. case $as_myself in [\\/]* | ?:[\\/]* ) at_myself=$as_myself ;; * ) at_myself=$at_dir/$as_myself ;; esac # Whether -C is in effect. at_change_dir=false # Whether to enable colored test results. at_color=no # List of the tested programs. at_tested='blame' # As many question marks as there are digits in the last test group number. # Used to normalize the test group numbers so that `ls' lists them in # numerical order. at_format='???' # Description of all the test groups. at_help_all="1;argv.at:3;No arguments;argv errors; 2;argv.at:10;Invalid argument;argv errors; 3;argv.at:17;-? and --help;argv; 4;argv.at:23;-V and --version;argv; 5;argv.at:32;Non-existent working file;argv errors; 6;argv.at:39;Non-existent RCS file;argv errors; 7;argv.at:46;Filenames only;argv; 8;pairing.at:3;Working file, then corresponding RCS file;pairing; 9;pairing.at:10;Working file, then independent working file;pairing; 10;pairing.at:20;Working file, then independent RCS file;pairing; 11;pairing.at:30;RCS file, then corresponding working file;pairing; 12;pairing.at:37;RCS file, then independent working file;pairing; 13;pairing.at:47;RCS file, then independent RCS file;pairing; 14;rcs.at:3;No revisions present;rcs errors; 15;rcs.at:10;Two-digit year before 2000;rcs; 16;rcs.at:17;Missing empty line after delta text;rcs; 17;rcs.at:24;Binary data;rcs; 18;rev.at:3;No revision;rev; 19;rev.at:11;Multiple revisions;rev errors; 20;rev.at:18;Single dot;rev; 21;rev.at:26;Valid trunk branch;rev; 22;rev.at:33;Invalid trunk branch;rev errors; 23;rev.at:40;Valid trunk branch and dot;rev; 24;rev.at:47;Invalid trunk branch and dot;rev errors; 25;rev.at:54;Dot and revision;rev; 26;rev.at:61;Dot and late revision;rev; 27;rev.at:68;Dot and early revision;rev errors; 28;rev.at:75;Symbolic trunk branch;rev symbol; 29;rev.at:83;Symbolic trunk branch and dot;rev symbol; 30;rev.at:91;Symbolic trunk branch and revision;rev symbol; 31;rev.at:99;Symbolic trunk branch and late revision;rev symbol; 32;rev.at:107;Symbolic trunk branch and early revision;rev errors symbol; 33;rev.at:115;Symbolic revision;rev symbol; 34;rev.at:123;Dot and symbolic revision;rev symbol; 35;rev.at:131;Symbolic trunk branch and symbolic revision;rev symbol; 36;rev.at:139;Invalid symbol;rev errors symbol; 37;branch.at:3;Revision on branch;branch rev; 38;branch.at:11;Revision on deep branch;branch rev; 39;branch.at:19;Valid branch;branch rev; 40;branch.at:26;Invalid branch;branch rev errors; 41;branch.at:34;Valid branch and dot;branch rev; 42;branch.at:41;Invalid branch and dot;branch rev errors; 43;branch.at:49;Dot and revision on branch;branch rev; 44;branch.at:57;Dot and late revision on branch;branch rev; 45;branch.at:65;Dot and early revision on branch;branch errors rev; 46;branch.at:73;Dot and branch;branch rev; 47;branch.at:81;Dot, branch and dot;branch rev; 48;branch.at:89;Symbolic branch;branch rev symbol; 49;branch.at:98;Symbolic branch and dot;branch rev symbol; 50;branch.at:107;Symbolic branch and revision;branch rev symbol; 51;branch.at:116;Symbolic branch and late revision;branch rev symbol; 52;branch.at:125;Symbolic branch and early revision;branch errors rev symbol; 53;branch.at:134;Symbolic revision on branch;branch rev symbol; 54;branch.at:143;Dot and symbolic revision on branch;branch rev symbol; 55;branch.at:152;Dot and symbolic branch;branch rev; 56;branch.at:160;Dot, symbolic branch and dot;branch rev; 57;branch.at:168;Symbolic branch and symbolic revision;branch rev symbol; 58;branch.at:177;Number, symbol and symbol;branch rev symbol; 59;branch.at:186;Symbol, number and symbol;branch rev symbol; 60;branch.at:195;Symbol, symbol and number;branch rev symbol; 61;branch.at:204;Number, symbol and number;branch rev symbol; 62;working.at:3;Valid revision;working rev; 63;working.at:21;Early revision;working rev errors; 64;working.at:42;Late revision;working rev; 65;working.at:60;Branch;working rev errors; 66;working.at:81;Other non-revision;working rev errors; 67;working.at:102;Parsing escape sequences;working rev; 68;working.at:112;Producing escape sequences;working; 69;working.at:122;Mixing escape characters;working; 70;date.at:3;Missing date argument;date errors; 71;date.at:10;Date after all revisions;date; 72;date.at:18;Date just after a revision;date; 73;date.at:25;Date on a revision;date; 74;date.at:32;Date just before a revision;date; 75;date.at:39;Date between revisions;date; 76;date.at:46;Date before all revisions;date errors; 77;date.at:53;Unparsable date;date errors; 78;date.at:60;Unknown timezone;date errors zone; 79;date.at:68;No timezone;date zone; 80;date.at:80;dd-Mon-yyyy hh:mm:ss;date; 81;date.at:91;h:mm:ss AM yyyymmdd;date; 82;date.at:102;Unusual timezone;date zone; 83;date.at:115;With -z or --zone option;date zone; 84;date.at:128;Multiple dates;date errors; 85;state.at:3;Missing state argument;state errors; 86;state.at:10;Known state;state; 87;state.at:22;Unknown state;state errors; 88;state.at:29;Multiple states;state errors; 89;author.at:3;No author;author; 90;author.at:17;Known author;author; 91;author.at:28;Unknown author;author errors; 92;author.at:35;Multiple authors;author errors; 93;expand.at:3;Default substitutions;expand log; 94;expand.at:26;Default substitutions, with timezone;expand log; 95;expand.at:49;Missing keyword substitution argument;expand errors; 96;expand.at:56;Keys and values (-kkv);expand log; 97;expand.at:81;Keys, values and locker (-kkvl);expand log; 98;expand.at:104;Keys only (-kk);expand log; 99;expand.at:127;Old keywords strings (-ko);expand log; 100;expand.at:147;Binary image of old keywords strings (-kb);expand log; 101;expand.at:167;Values only (-kv);expand log; 102;expand.at:190;Multiple substitution types;expand errors; 103;version.at:3;Invalid version argument;version errors; 104;version.at:12;Emulating RCS version 3;version log; 105;version.at:36;Emulating RCS version 4;version log; 106;version.at:60;Emulating RCS version 5;version log; 107;suffixes.at:3;Default suffixes;suffixes; 108;suffixes.at:9;Nonstandard suffixes;suffixes; 109;suffixes.at:17;Multiple suffixes specifications;suffixes errors; 110;mixed.at:3;Valid -r and -d combo;mixed rev date; 111;mixed.at:13;Invalid -r and -d combo;mixed errors rev date; 112;mixed.at:22;Valid -r and -s combo;mixed rev state; 113;mixed.at:31;Invalid -r and -s combo;mixed errors rev state; 114;mixed.at:40;Valid -r and -w combo;mixed rev author; 115;mixed.at:49;Invalid -r and -w combo;mixed errors rev author; 116;mixed.at:58;Valid -d and -s combo;mixed date state; 117;mixed.at:68;Invalid -d and -s combo;mixed errors date state; 118;mixed.at:77;Valid -d and -w combo;mixed date author; 119;mixed.at:87;Invalid -d and -w combo;mixed errors date author; 120;mixed.at:96;Valid -s and -w combo;mixed state author; 121;mixed.at:105;Invalid -s and -w combo;mixed errors state author; 122;mixed.at:114;Valid -r, -d and -s combo;mixed rev date state; 123;mixed.at:124;Invalid -r, -d and -s combo;mixed errors rev date state; 124;mixed.at:138;Valid -r, -d and -w combo;mixed rev date author; 125;mixed.at:148;Invalid -r, -d and -w combo;mixed errors rev date author; 126;mixed.at:162;Valid -r, -s and -w combo;mixed rev state author; 127;mixed.at:172;Invalid -r, -s and -w combo;mixed errors rev state author; 128;mixed.at:186;Valid -d, -s and -w combo;mixed date state author; 129;mixed.at:196;Invalid -d, -s and -w combo;mixed errors date state author; 130;mixed.at:210;Valid -r, -d, -s and -w combo;mixed rev date state author; 131;mixed.at:221;Invalid -r, -d, -s and -w combo;mixed errors rev date state author; 132;log.at:3;Old log expansion format;log version; 133;log.at:11;New log expansion format;log; 134;log.at:18;Logs for multiple revisions;log; 135;rcsinit.at:3;Empty RCSINIT;rcsinit rev state; 136;rcsinit.at:12;RCSINIT with options;rcsinit rev state; 137;rcsinit.at:21;RCSINIT with invalid options;rcsinit errors; 138;rcsinit.at:28;RCSINIT with a filename;rcsinit; " # List of the all the test groups. at_groups_all=`$as_echo "$at_help_all" | sed 's/;.*//'` # at_fn_validate_ranges NAME... # ----------------------------- # Validate and normalize the test group number contained in each variable # NAME. Leading zeroes are treated as decimal. at_fn_validate_ranges () { for at_grp do eval at_value=\$$at_grp if test $at_value -lt 1 || test $at_value -gt 138; then $as_echo "invalid test group: $at_value" >&2 exit 1 fi case $at_value in 0*) # We want to treat leading 0 as decimal, like expr and test, but # AS_VAR_ARITH treats it as octal if it uses $(( )). # With XSI shells, ${at_value#${at_value%%[1-9]*}} avoids the # expr fork, but it is not worth the effort to determine if the # shell supports XSI when the user can just avoid leading 0. eval $at_grp='`expr $at_value + 0`' ;; esac done } at_prev= for at_option do # If the previous option needs an argument, assign it. if test -n "$at_prev"; then at_option=$at_prev=$at_option at_prev= fi case $at_option in *=?*) at_optarg=`expr "X$at_option" : '[^=]*=\(.*\)'` ;; *) at_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $at_option in --help | -h ) at_help_p=: ;; --list | -l ) at_list_p=: ;; --version | -V ) at_version_p=: ;; --clean | -c ) at_clean=: ;; --color ) at_color=always ;; --color=* ) case $at_optarg in no | never | none) at_color=never ;; auto | tty | if-tty) at_color=auto ;; always | yes | force) at_color=always ;; *) at_optname=`echo " $at_option" | sed 's/^ //; s/=.*//'` as_fn_error $? "unrecognized argument to $at_optname: $at_optarg" ;; esac ;; --debug | -d ) at_debug_p=: ;; --errexit | -e ) at_debug_p=: at_errexit_p=: ;; --verbose | -v ) at_verbose=; at_quiet=: ;; --trace | -x ) at_traceon='set -x' at_trace_echo=echo at_check_filter_trace=at_fn_filter_trace ;; [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]) at_fn_validate_ranges at_option as_fn_append at_groups "$at_option$as_nl" ;; # Ranges [0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-) at_range_start=`echo $at_option |tr -d X-` at_fn_validate_ranges at_range_start at_range=`$as_echo "$at_groups_all" | \ sed -ne '/^'$at_range_start'$/,$p'` as_fn_append at_groups "$at_range$as_nl" ;; -[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]) at_range_end=`echo $at_option |tr -d X-` at_fn_validate_ranges at_range_end at_range=`$as_echo "$at_groups_all" | \ sed -ne '1,/^'$at_range_end'$/p'` as_fn_append at_groups "$at_range$as_nl" ;; [0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \ [0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \ [0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \ [0-9][0-9][0-9]-[0-9][0-9][0-9] | \ [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \ [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] ) at_range_start=`expr $at_option : '\(.*\)-'` at_range_end=`expr $at_option : '.*-\(.*\)'` if test $at_range_start -gt $at_range_end; then at_tmp=$at_range_end at_range_end=$at_range_start at_range_start=$at_tmp fi at_fn_validate_ranges at_range_start at_range_end at_range=`$as_echo "$at_groups_all" | \ sed -ne '/^'$at_range_start'$/,/^'$at_range_end'$/p'` as_fn_append at_groups "$at_range$as_nl" ;; # Directory selection. --directory | -C ) at_prev=--directory ;; --directory=* ) at_change_dir=: at_dir=$at_optarg if test x- = "x$at_dir" ; then at_dir=./- fi ;; # Parallel execution. --jobs | -j ) at_jobs=0 ;; --jobs=* | -j[0-9]* ) if test -n "$at_optarg"; then at_jobs=$at_optarg else at_jobs=`expr X$at_option : 'X-j\(.*\)'` fi case $at_jobs in *[!0-9]*) at_optname=`echo " $at_option" | sed 's/^ //; s/[0-9=].*//'` as_fn_error $? "non-numeric argument to $at_optname: $at_jobs" ;; esac ;; # Keywords. --keywords | -k ) at_prev=--keywords ;; --keywords=* ) at_groups_selected=$at_help_all at_save_IFS=$IFS IFS=, set X $at_optarg shift IFS=$at_save_IFS for at_keyword do at_invert= case $at_keyword in '!'*) at_invert="-v" at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'` ;; esac # It is on purpose that we match the test group titles too. at_groups_selected=`$as_echo "$at_groups_selected" | grep -i $at_invert "^[1-9][^;]*;.*[; ]$at_keyword[ ;]"` done # Smash the keywords. at_groups_selected=`$as_echo "$at_groups_selected" | sed 's/;.*//'` as_fn_append at_groups "$at_groups_selected$as_nl" ;; --recheck) at_recheck=: ;; *=*) at_envvar=`expr "x$at_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $at_envvar in '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$at_envvar'" ;; esac at_value=`$as_echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"` # Export now, but save eval for later and for debug scripts. export $at_envvar as_fn_append at_debug_args " $at_envvar='$at_value'" ;; *) $as_echo "$as_me: invalid option: $at_option" >&2 $as_echo "Try \`$0 --help' for more information." >&2 exit 1 ;; esac done # Verify our last option didn't require an argument if test -n "$at_prev"; then : as_fn_error $? "\`$at_prev' requires an argument" fi # The file containing the suite. at_suite_log=$at_dir/$as_me.log # Selected test groups. if test -z "$at_groups$at_recheck"; then at_groups=$at_groups_all else if test -n "$at_recheck" && test -r "$at_suite_log"; then at_oldfails=`sed -n ' /^Failed tests:$/,/^Skipped tests:$/{ s/^[ ]*\([1-9][0-9]*\):.*/\1/p } /^Unexpected passes:$/,/^## Detailed failed tests/{ s/^[ ]*\([1-9][0-9]*\):.*/\1/p } /^## Detailed failed tests/q ' "$at_suite_log"` as_fn_append at_groups "$at_oldfails$as_nl" fi # Sort the tests, removing duplicates. at_groups=`$as_echo "$at_groups" | sort -nu | sed '/^$/d'` fi if test x"$at_color" = xalways \ || { test x"$at_color" = xauto && test -t 1; }; then at_red=`printf '\033[0;31m'` at_grn=`printf '\033[0;32m'` at_lgn=`printf '\033[1;32m'` at_blu=`printf '\033[1;34m'` at_std=`printf '\033[m'` else at_red= at_grn= at_lgn= at_blu= at_std= fi # Help message. if $at_help_p; then cat <<_ATEOF || at_write_fail=1 Usage: $0 [OPTION]... [VARIABLE=VALUE]... [TESTS] Run all the tests, or the selected TESTS, given by numeric ranges, and save a detailed log file. Upon failure, create debugging scripts. Do not change environment variables directly. Instead, set them via command line arguments. Set \`AUTOTEST_PATH' to select the executables to exercise. Each relative directory is expanded as build and source directories relative to the top level of this distribution. E.g., from within the build directory /tmp/foo-1.0, invoking this: $ $0 AUTOTEST_PATH=bin is equivalent to the following, assuming the source directory is /src/foo-1.0: PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH $0 _ATEOF cat <<_ATEOF || at_write_fail=1 Operation modes: -h, --help print the help message, then exit -V, --version print version number, then exit -c, --clean remove all the files this test suite might create and exit -l, --list describes all the tests, or the selected TESTS _ATEOF cat <<_ATEOF || at_write_fail=1 Execution tuning: -C, --directory=DIR change to directory DIR before starting --color[=never|auto|always] enable colored test results on terminal, or always -j, --jobs[=N] Allow N jobs at once; infinite jobs with no arg (default 1) -k, --keywords=KEYWORDS select the tests matching all the comma-separated KEYWORDS multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD --recheck select all tests that failed or passed unexpectedly last time -e, --errexit abort as soon as a test fails; implies --debug -v, --verbose force more detailed output default for debugging scripts -d, --debug inhibit clean up and top-level logging default for debugging scripts -x, --trace enable tests shell tracing _ATEOF cat <<_ATEOF || at_write_fail=1 Report bugs to . _ATEOF exit $at_write_fail fi # List of tests. if $at_list_p; then cat <<_ATEOF || at_write_fail=1 blame 1.4 test suite test groups: NUM: FILE-NAME:LINE TEST-GROUP-NAME KEYWORDS _ATEOF # Pass an empty line as separator between selected groups and help. $as_echo "$at_groups$as_nl$as_nl$at_help_all" | awk 'NF == 1 && FS != ";" { selected[$ 1] = 1 next } /^$/ { FS = ";" } NF > 0 { if (selected[$ 1]) { printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3 if ($ 4) { lmax = 79 indent = " " line = indent len = length (line) n = split ($ 4, a, " ") for (i = 1; i <= n; i++) { l = length (a[i]) + 1 if (i > 1 && len + l > lmax) { print line line = indent " " a[i] len = length (line) } else { line = line " " a[i] len += l } } if (n) print line } } }' || at_write_fail=1 exit $at_write_fail fi if $at_version_p; then $as_echo "$as_me (blame 1.4)" && cat <<\_ATEOF || at_write_fail=1 Copyright (C) 2012 Free Software Foundation, Inc. This test suite is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ATEOF exit $at_write_fail fi # Should we print banners? Yes if more than one test is run. case $at_groups in #( *$as_nl* ) at_print_banners=: ;; #( * ) at_print_banners=false ;; esac # Text for banner N, set to a single space once printed. # Banner 1. argv.at:1 # Category starts at test group 1. at_banner_text_1="Command line argument parsing." # Banner 2. pairing.at:1 # Category starts at test group 8. at_banner_text_2="Filename pairing." # Banner 3. rcs.at:1 # Category starts at test group 14. at_banner_text_3="RCS file parsing." # Banner 4. rev.at:1 # Category starts at test group 18. at_banner_text_4="-r and --revision options." # Banner 5. branch.at:1 # Category starts at test group 37. at_banner_text_5="Resolving revisions on branches." # Banner 6. working.at:1 # Category starts at test group 62. at_banner_text_6="Handling RCS tags in working files." # Banner 7. date.at:1 # Category starts at test group 70. at_banner_text_7="-d and --date options." # Banner 8. state.at:1 # Category starts at test group 85. at_banner_text_8="-s and --state options." # Banner 9. author.at:1 # Category starts at test group 89. at_banner_text_9="-w and --author options." # Banner 10. expand.at:1 # Category starts at test group 93. at_banner_text_10="-k and --expand options." # Banner 11. version.at:1 # Category starts at test group 103. at_banner_text_11="-V and --version options." # Banner 12. suffixes.at:1 # Category starts at test group 107. at_banner_text_12="-x and --suffixes options." # Banner 13. mixed.at:1 # Category starts at test group 110. at_banner_text_13="Mixing -r, -d, -s and -w options." # Banner 14. log.at:1 # Category starts at test group 132. at_banner_text_14="Expanding Log keywords." # Banner 15. rcsinit.at:1 # Category starts at test group 135. at_banner_text_15="RCSINIT environment variable support." # Take any -C into account. if $at_change_dir ; then test x != "x$at_dir" && cd "$at_dir" \ || as_fn_error $? "unable to change directory" at_dir=`pwd` fi # Load the config files for any default variable assignments. for at_file in atconfig atlocal do test -r $at_file || continue . ./$at_file || as_fn_error $? "invalid content: $at_file" done # Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix: : "${at_top_build_prefix=$at_top_builddir}" # Perform any assignments requested during argument parsing. eval "$at_debug_args" # atconfig delivers names relative to the directory the test suite is # in, but the groups themselves are run in testsuite-dir/group-dir. if test -n "$at_top_srcdir"; then builddir=../.. for at_dir_var in srcdir top_srcdir top_build_prefix do eval at_val=\$at_$at_dir_var case $at_val in [\\/$]* | ?:[\\/]* ) at_prefix= ;; *) at_prefix=../../ ;; esac eval "$at_dir_var=\$at_prefix\$at_val" done fi ## -------------------- ## ## Directory structure. ## ## -------------------- ## # This is the set of directories and files used by this script # (non-literals are capitalized): # # TESTSUITE - the testsuite # TESTSUITE.log - summarizes the complete testsuite run # TESTSUITE.dir/ - created during a run, remains after -d or failed test # + at-groups/ - during a run: status of all groups in run # | + NNN/ - during a run: meta-data about test group NNN # | | + check-line - location (source file and line) of current AT_CHECK # | | + status - exit status of current AT_CHECK # | | + stdout - stdout of current AT_CHECK # | | + stder1 - stderr, including trace # | | + stderr - stderr, with trace filtered out # | | + test-source - portion of testsuite that defines group # | | + times - timestamps for computing duration # | | + pass - created if group passed # | | + xpass - created if group xpassed # | | + fail - created if group failed # | | + xfail - created if group xfailed # | | + skip - created if group skipped # + at-stop - during a run: end the run if this file exists # + at-source-lines - during a run: cache of TESTSUITE line numbers for extraction # + 0..NNN/ - created for each group NNN, remains after -d or failed test # | + TESTSUITE.log - summarizes the group results # | + ... - files created during the group # The directory the whole suite works in. # Should be absolute to let the user `cd' at will. at_suite_dir=$at_dir/$as_me.dir # The file containing the suite ($at_dir might have changed since earlier). at_suite_log=$at_dir/$as_me.log # The directory containing helper files per test group. at_helper_dir=$at_suite_dir/at-groups # Stop file: if it exists, do not start new jobs. at_stop_file=$at_suite_dir/at-stop # The fifo used for the job dispatcher. at_job_fifo=$at_suite_dir/at-job-fifo if $at_clean; then test -d "$at_suite_dir" && find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; rm -f -r "$at_suite_dir" "$at_suite_log" exit $? fi # Don't take risks: use only absolute directories in PATH. # # For stand-alone test suites (ie. atconfig was not found), # AUTOTEST_PATH is relative to `.'. # # For embedded test suites, AUTOTEST_PATH is relative to the top level # of the package. Then expand it into build/src parts, since users # may create executables in both places. AUTOTEST_PATH=`$as_echo "$AUTOTEST_PATH" | sed "s|:|$PATH_SEPARATOR|g"` at_path= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $AUTOTEST_PATH $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -n "$at_path" && as_fn_append at_path $PATH_SEPARATOR case $as_dir in [\\/]* | ?:[\\/]* ) as_fn_append at_path "$as_dir" ;; * ) if test -z "$at_top_build_prefix"; then # Stand-alone test suite. as_fn_append at_path "$as_dir" else # Embedded test suite. as_fn_append at_path "$at_top_build_prefix$as_dir$PATH_SEPARATOR" as_fn_append at_path "$at_top_srcdir/$as_dir" fi ;; esac done IFS=$as_save_IFS # Now build and simplify PATH. # # There might be directories that don't exist, but don't redirect # builtins' (eg., cd) stderr directly: Ultrix's sh hates that. at_new_path= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $at_path do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -d "$as_dir" || continue case $as_dir in [\\/]* | ?:[\\/]* ) ;; * ) as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` ;; esac case $PATH_SEPARATOR$at_new_path$PATH_SEPARATOR in *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR*) ;; $PATH_SEPARATOR$PATH_SEPARATOR) at_new_path=$as_dir ;; *) as_fn_append at_new_path "$PATH_SEPARATOR$as_dir" ;; esac done IFS=$as_save_IFS PATH=$at_new_path export PATH # Setting up the FDs. # 5 is the log file. Not to be overwritten if `-d'. if $at_debug_p; then at_suite_log=/dev/null else : >"$at_suite_log" fi exec 5>>"$at_suite_log" # Banners and logs. $as_echo "## --------------------- ## ## blame 1.4 test suite. ## ## --------------------- ##" { $as_echo "## --------------------- ## ## blame 1.4 test suite. ## ## --------------------- ##" echo $as_echo "$as_me: command line was:" $as_echo " \$ $0 $at_cli_args" echo # If ChangeLog exists, list a few lines in case it might help determining # the exact version. if test -n "$at_top_srcdir" && test -f "$at_top_srcdir/ChangeLog"; then $as_echo "## ---------- ## ## ChangeLog. ## ## ---------- ##" echo sed 's/^/| /;10q' "$at_top_srcdir/ChangeLog" echo fi { 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 } echo # Contents of the config files. for at_file in atconfig atlocal do test -r $at_file || continue $as_echo "$as_me: $at_file:" sed 's/^/| /' $at_file echo done } >&5 ## ------------------------- ## ## Autotest shell functions. ## ## ------------------------- ## # at_fn_banner NUMBER # ------------------- # Output banner NUMBER, provided the testsuite is running multiple groups and # this particular banner has not yet been printed. at_fn_banner () { $at_print_banners || return 0 eval at_banner_text=\$at_banner_text_$1 test "x$at_banner_text" = "x " && return 0 eval "at_banner_text_$1=\" \"" if test -z "$at_banner_text"; then $at_first || echo else $as_echo "$as_nl$at_banner_text$as_nl" fi } # at_fn_banner # at_fn_check_prepare_notrace REASON LINE # --------------------------------------- # Perform AT_CHECK preparations for the command at LINE for an untraceable # command; REASON is the reason for disabling tracing. at_fn_check_prepare_notrace () { $at_trace_echo "Not enabling shell tracing (command contains $1)" $as_echo "$2" >"$at_check_line_file" at_check_trace=: at_check_filter=: : >"$at_stdout"; : >"$at_stderr" } # at_fn_check_prepare_trace LINE # ------------------------------ # Perform AT_CHECK preparations for the command at LINE for a traceable # command. at_fn_check_prepare_trace () { $as_echo "$1" >"$at_check_line_file" at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace : >"$at_stdout"; : >"$at_stderr" } # at_fn_check_prepare_dynamic COMMAND LINE # ---------------------------------------- # Decide if COMMAND at LINE is traceable at runtime, and call the appropriate # preparation function. at_fn_check_prepare_dynamic () { case $1 in *$as_nl*) at_fn_check_prepare_notrace 'an embedded newline' "$2" ;; *) at_fn_check_prepare_trace "$2" ;; esac } # at_fn_filter_trace # ------------------ # Remove the lines in the file "$at_stderr" generated by "set -x" and print # them to stderr. at_fn_filter_trace () { mv "$at_stderr" "$at_stder1" grep '^ *+' "$at_stder1" >&2 grep -v '^ *+' "$at_stder1" >"$at_stderr" } # at_fn_log_failure FILE-LIST # --------------------------- # Copy the files in the list on stdout with a "> " prefix, and exit the shell # with a failure exit code. at_fn_log_failure () { for file do $as_echo "$file:"; sed 's/^/> /' "$file"; done echo 1 > "$at_status_file" exit 1 } # at_fn_check_skip EXIT-CODE LINE # ------------------------------- # Check whether EXIT-CODE is a special exit code (77 or 99), and if so exit # the test group subshell with that same exit code. Use LINE in any report # about test failure. at_fn_check_skip () { case $1 in 99) echo 99 > "$at_status_file"; at_failed=: $as_echo "$2: hard failure"; exit 99;; 77) echo 77 > "$at_status_file"; exit 77;; esac } # at_fn_check_status EXPECTED EXIT-CODE LINE # ------------------------------------------ # Check whether EXIT-CODE is the EXPECTED exit code, and if so do nothing. # Otherwise, if it is 77 or 99, exit the test group subshell with that same # exit code; if it is anything else print an error message referring to LINE, # and fail the test. at_fn_check_status () { case $2 in $1 ) ;; 77) echo 77 > "$at_status_file"; exit 77;; 99) echo 99 > "$at_status_file"; at_failed=: $as_echo "$3: hard failure"; exit 99;; *) $as_echo "$3: exit code was $2, expected $1" at_failed=:;; esac } # at_fn_diff_devnull FILE # ----------------------- # Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless diff # invocations. at_fn_diff_devnull () { test -s "$1" || return 0 $at_diff "$at_devnull" "$1" } # at_fn_test NUMBER # ----------------- # Parse out test NUMBER from the tail of this file. at_fn_test () { eval at_sed=\$at_sed$1 sed "$at_sed" "$at_myself" > "$at_test_source" } # at_fn_create_debugging_script # ----------------------------- # Create the debugging script $at_group_dir/run which will reproduce the # current test group. at_fn_create_debugging_script () { { echo "#! /bin/sh" && echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$@"}'\''='\''"$@"'\''' && $as_echo "cd '$at_dir'" && $as_echo "exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d $at_debug_args $at_group \${1+\"\$@\"}" && echo 'exit 1' } >"$at_group_dir/run" && chmod +x "$at_group_dir/run" } ## -------------------------------- ## ## End of autotest shell functions. ## ## -------------------------------- ## { $as_echo "## ---------------- ## ## Tested programs. ## ## ---------------- ##" echo } >&5 # Report what programs are being tested. for at_program in : $at_tested do test "$at_program" = : && continue case $at_program in [\\/]* | ?:[\\/]* ) $at_program_=$at_program ;; * ) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -f "$as_dir/$at_program" && break done IFS=$as_save_IFS at_program_=$as_dir/$at_program ;; esac if test -f "$at_program_"; then { $as_echo "$at_srcdir/testsuite.at:3: $at_program_ --version" "$at_program_" --version &5 2>&1 else as_fn_error $? "cannot find $at_program" "$LINENO" 5 fi done { $as_echo "## ------------------ ## ## Running the tests. ## ## ------------------ ##" } >&5 at_start_date=`date` at_start_time=`date +%s 2>/dev/null` $as_echo "$as_me: starting at: $at_start_date" >&5 # Create the master directory if it doesn't already exist. as_dir="$at_suite_dir"; as_fn_mkdir_p || as_fn_error $? "cannot create \`$at_suite_dir'" "$LINENO" 5 # Can we diff with `/dev/null'? DU 5.0 refuses. if diff /dev/null /dev/null >/dev/null 2>&1; then at_devnull=/dev/null else at_devnull=$at_suite_dir/devnull >"$at_devnull" fi # Use `diff -u' when possible. if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff" then at_diff='diff -u' else at_diff=diff fi # Get the last needed group. for at_group in : $at_groups; do :; done # Extract the start and end lines of each test group at the tail # of this file awk ' BEGIN { FS="" } /^#AT_START_/ { start = NR } /^#AT_STOP_/ { test = substr ($ 0, 10) print "at_sed" test "=\"1," start "d;" (NR-1) "q\"" if (test == "'"$at_group"'") exit }' "$at_myself" > "$at_suite_dir/at-source-lines" && . "$at_suite_dir/at-source-lines" || as_fn_error $? "cannot create test line number cache" "$LINENO" 5 rm -f "$at_suite_dir/at-source-lines" # Set number of jobs for `-j'; avoid more jobs than test groups. set X $at_groups; shift; at_max_jobs=$# if test $at_max_jobs -eq 0; then at_jobs=1 fi if test $at_jobs -ne 1 && { test $at_jobs -eq 0 || test $at_jobs -gt $at_max_jobs; }; then at_jobs=$at_max_jobs fi # If parallel mode, don't output banners, don't split summary lines. if test $at_jobs -ne 1; then at_print_banners=false at_quiet=: fi # Set up helper dirs. rm -rf "$at_helper_dir" && mkdir "$at_helper_dir" && cd "$at_helper_dir" && { test -z "$at_groups" || mkdir $at_groups; } || as_fn_error $? "testsuite directory setup failed" "$LINENO" 5 # Functions for running a test group. We leave the actual # test group execution outside of a shell function in order # to avoid hitting zsh 4.x exit status bugs. # at_fn_group_prepare # ------------------- # Prepare for running a test group. at_fn_group_prepare () { # The directory for additional per-group helper files. at_job_dir=$at_helper_dir/$at_group # The file containing the location of the last AT_CHECK. at_check_line_file=$at_job_dir/check-line # The file containing the exit status of the last command. at_status_file=$at_job_dir/status # The files containing the output of the tested commands. at_stdout=$at_job_dir/stdout at_stder1=$at_job_dir/stder1 at_stderr=$at_job_dir/stderr # The file containing the code for a test group. at_test_source=$at_job_dir/test-source # The file containing dates. at_times_file=$at_job_dir/times # Be sure to come back to the top test directory. cd "$at_suite_dir" # Clearly separate the test groups when verbose. $at_first || $at_verbose echo at_group_normalized=$at_group eval 'while :; do case $at_group_normalized in #( '"$at_format"'*) break;; esac at_group_normalized=0$at_group_normalized done' # Create a fresh directory for the next test group, and enter. # If one already exists, the user may have invoked ./run from # within that directory; we remove the contents, but not the # directory itself, so that we aren't pulling the rug out from # under the shell's notion of the current directory. at_group_dir=$at_suite_dir/$at_group_normalized at_group_log=$at_group_dir/$as_me.log if test -d "$at_group_dir"; then find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx {} \; rm -fr "$at_group_dir"/* "$at_group_dir"/.[!.] "$at_group_dir"/.??* fi || { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test directory for $at_group_normalized could not be cleaned" >&5 $as_echo "$as_me: WARNING: test directory for $at_group_normalized could not be cleaned" >&2;} # Be tolerant if the above `rm' was not able to remove the directory. as_dir="$at_group_dir"; as_fn_mkdir_p echo 0 > "$at_status_file" # In verbose mode, append to the log file *and* show on # the standard output; in quiet mode only write to the log. if test -z "$at_verbose"; then at_tee_pipe='tee -a "$at_group_log"' else at_tee_pipe='cat >> "$at_group_log"' fi } # at_fn_group_banner ORDINAL LINE DESC PAD [BANNER] # ------------------------------------------------- # Declare the test group ORDINAL, located at LINE with group description DESC, # and residing under BANNER. Use PAD to align the status column. at_fn_group_banner () { at_setup_line="$2" test -n "$5" && at_fn_banner $5 at_desc="$3" case $1 in [0-9]) at_desc_line=" $1: ";; [0-9][0-9]) at_desc_line=" $1: " ;; *) at_desc_line="$1: " ;; esac as_fn_append at_desc_line "$3$4" $at_quiet $as_echo_n "$at_desc_line" echo "# -*- compilation -*-" >> "$at_group_log" } # at_fn_group_postprocess # ----------------------- # Perform cleanup after running a test group. at_fn_group_postprocess () { # Be sure to come back to the suite directory, in particular # since below we might `rm' the group directory we are in currently. cd "$at_suite_dir" if test ! -f "$at_check_line_file"; then sed "s/^ */$as_me: WARNING: /" <<_ATEOF A failure happened in a test group before any test could be run. This means that test suite is improperly designed. Please report this failure to . _ATEOF $as_echo "$at_setup_line" >"$at_check_line_file" at_status=99 fi $at_verbose $as_echo_n "$at_group. $at_setup_line: " $as_echo_n "$at_group. $at_setup_line: " >> "$at_group_log" case $at_xfail:$at_status in yes:0) at_msg="UNEXPECTED PASS" at_res=xpass at_errexit=$at_errexit_p at_color=$at_red ;; no:0) at_msg="ok" at_res=pass at_errexit=false at_color=$at_grn ;; *:77) at_msg='skipped ('`cat "$at_check_line_file"`')' at_res=skip at_errexit=false at_color=$at_blu ;; no:* | *:99) at_msg='FAILED ('`cat "$at_check_line_file"`')' at_res=fail at_errexit=$at_errexit_p at_color=$at_red ;; yes:*) at_msg='expected failure ('`cat "$at_check_line_file"`')' at_res=xfail at_errexit=false at_color=$at_lgn ;; esac echo "$at_res" > "$at_job_dir/$at_res" # In parallel mode, output the summary line only afterwards. if test $at_jobs -ne 1 && test -n "$at_verbose"; then $as_echo "$at_desc_line $at_color$at_msg$at_std" else # Make sure there is a separator even with long titles. $as_echo " $at_color$at_msg$at_std" fi at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg" case $at_status in 0|77) # $at_times_file is only available if the group succeeded. # We're not including the group log, so the success message # is written in the global log separately. But we also # write to the group log in case they're using -d. if test -f "$at_times_file"; then at_log_msg="$at_log_msg ("`sed 1d "$at_times_file"`')' rm -f "$at_times_file" fi $as_echo "$at_log_msg" >> "$at_group_log" $as_echo "$at_log_msg" >&5 # Cleanup the group directory, unless the user wants the files # or the success was unexpected. if $at_debug_p || test $at_res = xpass; then at_fn_create_debugging_script if test $at_res = xpass && $at_errexit; then echo stop > "$at_stop_file" fi else if test -d "$at_group_dir"; then find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; rm -fr "$at_group_dir" fi rm -f "$at_test_source" fi ;; *) # Upon failure, include the log into the testsuite's global # log. The failure message is written in the group log. It # is later included in the global log. $as_echo "$at_log_msg" >> "$at_group_log" # Upon failure, keep the group directory for autopsy, and create # the debugging script. With -e, do not start any further tests. at_fn_create_debugging_script if $at_errexit; then echo stop > "$at_stop_file" fi ;; esac } ## ------------ ## ## Driver loop. ## ## ------------ ## if (set -m && set +m && set +b) >/dev/null 2>&1; then set +b at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=- else at_job_control_on=: at_job_control_off=: at_job_group= fi for at_signal in 1 2 15; do trap 'set +x; set +e $at_job_control_off at_signal='"$at_signal"' echo stop > "$at_stop_file" trap "" $at_signal at_pgids= for at_pgid in `jobs -p 2>/dev/null`; do at_pgids="$at_pgids $at_job_group$at_pgid" done test -z "$at_pgids" || kill -$at_signal $at_pgids 2>/dev/null wait if test "$at_jobs" -eq 1 || test -z "$at_verbose"; then echo >&2 fi at_signame=`kill -l $at_signal 2>&1 || echo $at_signal` set x $at_signame test 0 -gt 2 && at_signame=$at_signal { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: caught signal $at_signame, bailing out" >&5 $as_echo "$as_me: WARNING: caught signal $at_signame, bailing out" >&2;} as_fn_arith 128 + $at_signal && exit_status=$as_val as_fn_exit $exit_status' $at_signal done rm -f "$at_stop_file" at_first=: if test $at_jobs -ne 1 && rm -f "$at_job_fifo" && test -n "$at_job_group" && ( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null then # FIFO job dispatcher. trap 'at_pids= for at_pid in `jobs -p`; do at_pids="$at_pids $at_job_group$at_pid" done if test -n "$at_pids"; then at_sig=TSTP test "${TMOUT+set}" = set && at_sig=STOP kill -$at_sig $at_pids 2>/dev/null fi kill -STOP $$ test -z "$at_pids" || kill -CONT $at_pids 2>/dev/null' TSTP echo # Turn jobs into a list of numbers, starting from 1. at_joblist=`$as_echo "$at_groups" | sed -n 1,${at_jobs}p` set X $at_joblist shift for at_group in $at_groups; do $at_job_control_on 2>/dev/null ( # Start one test group. $at_job_control_off if $at_first; then exec 7>"$at_job_fifo" else exec 6<&- fi trap 'set +x; set +e trap "" PIPE echo stop > "$at_stop_file" echo >&7 as_fn_exit 141' PIPE at_fn_group_prepare if cd "$at_group_dir" && at_fn_test $at_group && . "$at_test_source" then :; else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5 $as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;} at_failed=: fi at_fn_group_postprocess echo >&7 ) & $at_job_control_off if $at_first; then at_first=false exec 6<"$at_job_fifo" 7>"$at_job_fifo" fi shift # Consume one token. if test $# -gt 0; then :; else read at_token <&6 || break set x $* fi test -f "$at_stop_file" && break done exec 7>&- # Read back the remaining ($at_jobs - 1) tokens. set X $at_joblist shift if test $# -gt 0; then shift for at_job do read at_token done <&6 fi exec 6<&- wait else # Run serially, avoid forks and other potential surprises. for at_group in $at_groups; do at_fn_group_prepare if cd "$at_group_dir" && at_fn_test $at_group && . "$at_test_source"; then :; else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5 $as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;} at_failed=: fi at_fn_group_postprocess test -f "$at_stop_file" && break at_first=false done fi # Wrap up the test suite with summary statistics. cd "$at_helper_dir" # Use ?..???? when the list must remain sorted, the faster * otherwise. at_pass_list=`for f in */pass; do echo $f; done | sed '/\*/d; s,/pass,,'` at_skip_list=`for f in */skip; do echo $f; done | sed '/\*/d; s,/skip,,'` at_xfail_list=`for f in */xfail; do echo $f; done | sed '/\*/d; s,/xfail,,'` at_xpass_list=`for f in ?/xpass ??/xpass ???/xpass ????/xpass; do echo $f; done | sed '/?/d; s,/xpass,,'` at_fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do echo $f; done | sed '/?/d; s,/fail,,'` set X $at_pass_list $at_xpass_list $at_xfail_list $at_fail_list $at_skip_list shift; at_group_count=$# set X $at_xpass_list; shift; at_xpass_count=$#; at_xpass_list=$* set X $at_xfail_list; shift; at_xfail_count=$# set X $at_fail_list; shift; at_fail_count=$#; at_fail_list=$* set X $at_skip_list; shift; at_skip_count=$# as_fn_arith $at_group_count - $at_skip_count && at_run_count=$as_val as_fn_arith $at_xpass_count + $at_fail_count && at_unexpected_count=$as_val as_fn_arith $at_xfail_count + $at_fail_count && at_total_fail_count=$as_val # Back to the top directory. cd "$at_dir" rm -rf "$at_helper_dir" # Compute the duration of the suite. at_stop_date=`date` at_stop_time=`date +%s 2>/dev/null` $as_echo "$as_me: ending at: $at_stop_date" >&5 case $at_start_time,$at_stop_time in [0-9]*,[0-9]*) as_fn_arith $at_stop_time - $at_start_time && at_duration_s=$as_val as_fn_arith $at_duration_s / 60 && at_duration_m=$as_val as_fn_arith $at_duration_m / 60 && at_duration_h=$as_val as_fn_arith $at_duration_s % 60 && at_duration_s=$as_val as_fn_arith $at_duration_m % 60 && at_duration_m=$as_val at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s" $as_echo "$as_me: test suite duration: $at_duration" >&5 ;; esac echo $as_echo "## ------------- ## ## Test results. ## ## ------------- ##" echo { echo $as_echo "## ------------- ## ## Test results. ## ## ------------- ##" echo } >&5 if test $at_run_count = 1; then at_result="1 test" at_were=was else at_result="$at_run_count tests" at_were=were fi if $at_errexit_p && test $at_unexpected_count != 0; then if test $at_xpass_count = 1; then at_result="$at_result $at_were run, one passed" else at_result="$at_result $at_were run, one failed" fi at_result="$at_result unexpectedly and inhibited subsequent tests." at_color=$at_red else # Don't you just love exponential explosion of the number of cases? at_color=$at_red case $at_xpass_count:$at_fail_count:$at_xfail_count in # So far, so good. 0:0:0) at_result="$at_result $at_were successful." at_color=$at_grn ;; 0:0:*) at_result="$at_result behaved as expected." at_color=$at_lgn ;; # Some unexpected failures 0:*:0) at_result="$at_result $at_were run, $at_fail_count failed unexpectedly." ;; # Some failures, both expected and unexpected 0:*:1) at_result="$at_result $at_were run, $at_total_fail_count failed ($at_xfail_count expected failure)." ;; 0:*:*) at_result="$at_result $at_were run, $at_total_fail_count failed ($at_xfail_count expected failures)." ;; # No unexpected failures, but some xpasses *:0:*) at_result="$at_result $at_were run, $at_xpass_count passed unexpectedly." ;; # No expected failures, but failures and xpasses *:1:0) at_result="$at_result $at_were run, $at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;; *:*:0) at_result="$at_result $at_were run, $at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;; # All of them. *:*:1) at_result="$at_result $at_were run, $at_xpass_count passed unexpectedly, $at_total_fail_count failed ($at_xfail_count expected failure)." ;; *:*:*) at_result="$at_result $at_were run, $at_xpass_count passed unexpectedly, $at_total_fail_count failed ($at_xfail_count expected failures)." ;; esac if test $at_skip_count = 0 && test $at_run_count -gt 1; then at_result="All $at_result" fi fi # Now put skips in the mix. case $at_skip_count in 0) ;; 1) at_result="$at_result 1 test was skipped." ;; *) at_result="$at_result $at_skip_count tests were skipped." ;; esac if test $at_unexpected_count = 0; then echo "$at_color$at_result$at_std" echo "$at_result" >&5 else echo "${at_color}ERROR: $at_result$at_std" >&2 echo "ERROR: $at_result" >&5 { echo $as_echo "## ------------------------ ## ## Summary of the failures. ## ## ------------------------ ##" # Summary of failed and skipped tests. if test $at_fail_count != 0; then echo "Failed tests:" $SHELL "$at_myself" $at_fail_list --list echo fi if test $at_skip_count != 0; then echo "Skipped tests:" $SHELL "$at_myself" $at_skip_list --list echo fi if test $at_xpass_count != 0; then echo "Unexpected passes:" $SHELL "$at_myself" $at_xpass_list --list echo fi if test $at_fail_count != 0; then $as_echo "## ---------------------- ## ## Detailed failed tests. ## ## ---------------------- ##" echo for at_group in $at_fail_list do at_group_normalized=$at_group eval 'while :; do case $at_group_normalized in #( '"$at_format"'*) break;; esac at_group_normalized=0$at_group_normalized done' cat "$at_suite_dir/$at_group_normalized/$as_me.log" echo done echo fi if test -n "$at_top_srcdir"; then sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## ${at_top_build_prefix}config.log ## _ASBOX sed 's/^/| /' ${at_top_build_prefix}config.log echo fi } >&5 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## $as_me.log was created. ## _ASBOX echo if $at_debug_p; then at_msg='per-test log files' else at_msg="\`${at_testdir+${at_testdir}/}$as_me.log'" fi $as_echo "Please send $at_msg and all information you think might help: To: Subject: [blame 1.4] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly} You may investigate any problem if you feel able to do so, in which case the test suite provides a good starting point. Its output may be found below \`${at_testdir+${at_testdir}/}$as_me.dir'. " exit 1 fi exit 0 ## ------------- ## ## Actual tests. ## ## ------------- ## #AT_START_1 at_fn_group_banner 1 'argv.at:3' \ "No arguments" " " 1 at_xfail=no ( $as_echo "1. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/argv.at:6: blame" at_fn_check_prepare_trace "argv.at:6" ( $at_check_trace; blame ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/argv.at:6" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_1 #AT_START_2 at_fn_group_banner 2 'argv.at:10' \ "Invalid argument" " " 1 at_xfail=no ( $as_echo "2. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/argv.at:13: blame --footle" at_fn_check_prepare_trace "argv.at:13" ( $at_check_trace; blame --footle ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/argv.at:13" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_2 #AT_START_3 at_fn_group_banner 3 'argv.at:17' \ "-? and --help" " " 1 at_xfail=no ( $as_echo "3. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/argv.at:19: blame -?" at_fn_check_prepare_trace "argv.at:19" ( $at_check_trace; blame -? ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/argv.at:19" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/argv.at:20: blame --help" at_fn_check_prepare_trace "argv.at:20" ( $at_check_trace; blame --help ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/argv.at:20" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_3 #AT_START_4 at_fn_group_banner 4 'argv.at:23' \ "-V and --version" " " 1 at_xfail=no ( $as_echo "4. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout $package_string ($package_date); emulating RCS version 5 EOF { set +x $as_echo "$at_srcdir/argv.at:28: blame -V" at_fn_check_prepare_trace "argv.at:28" ( $at_check_trace; blame -V ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/argv.at:28" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/argv.at:29: blame --version" at_fn_check_prepare_trace "argv.at:29" ( $at_check_trace; blame --version ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/argv.at:29" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_4 #AT_START_5 at_fn_group_banner 5 'argv.at:32' \ "Non-existent working file" " " 1 at_xfail=no ( $as_echo "5. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/argv.at:35: blame /nonexistent" at_fn_check_prepare_trace "argv.at:35" ( $at_check_trace; blame /nonexistent ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/argv.at:35" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_5 #AT_START_6 at_fn_group_banner 6 'argv.at:39' \ "Non-existent RCS file" " " 1 at_xfail=no ( $as_echo "6. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/argv.at:42: blame /nonexistent,v" at_fn_check_prepare_trace "argv.at:42" ( $at_check_trace; blame /nonexistent,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/argv.at:42" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_6 #AT_START_7 at_fn_group_banner 7 'argv.at:46' \ "Filenames only" " " 1 at_xfail=no ( $as_echo "7. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/argv.at:50: blame \$testdir/simple,v" at_fn_check_prepare_dynamic "blame $testdir/simple,v" "argv.at:50" ( $at_check_trace; blame $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/argv.at:50" $at_failed && at_fn_log_failure $at_traceon; } rm -f experr cat $testdir/simple.experr | sed "s,simple,$testdir/simple,g" > experr { set +x $as_echo "$at_srcdir/argv.at:53: blame \$testdir/simple" at_fn_check_prepare_dynamic "blame $testdir/simple" "argv.at:53" ( $at_check_trace; blame $testdir/simple ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/argv.at:53" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_7 #AT_START_8 at_fn_group_banner 8 'pairing.at:3' \ "Working file, then corresponding RCS file" " " 2 at_xfail=no ( $as_echo "8. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cat $testdir/simple.experr | sed "s,simple,$testdir/simple,g" > experr { set +x $as_echo "$at_srcdir/pairing.at:7: blame \$testdir/simple \$testdir/simple,v" at_fn_check_prepare_dynamic "blame $testdir/simple $testdir/simple,v" "pairing.at:7" ( $at_check_trace; blame $testdir/simple $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/pairing.at:7" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_8 #AT_START_9 at_fn_group_banner 9 'pairing.at:10' \ "Working file, then independent working file" " " 2 at_xfail=no ( $as_echo "9. $at_setup_line: testing $at_desc ..." $at_traceon cat $testdir/simple-1.2.expout $testdir/complex-3.8.expout > expout ( cat $testdir/simple.experr | sed "s,simple,$testdir/simple,g" cat $testdir/complex.experr | sed "s,complex,$testdir/complex,g" ) > experr { set +x $as_echo "$at_srcdir/pairing.at:17: blame \$testdir/simple \$testdir/complex" at_fn_check_prepare_dynamic "blame $testdir/simple $testdir/complex" "pairing.at:17" ( $at_check_trace; blame $testdir/simple $testdir/complex ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/pairing.at:17" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_9 #AT_START_10 at_fn_group_banner 10 'pairing.at:20' \ "Working file, then independent RCS file" " " 2 at_xfail=no ( $as_echo "10. $at_setup_line: testing $at_desc ..." $at_traceon cat $testdir/simple-1.2.expout $testdir/complex-3.8.expout > expout ( cat $testdir/simple.experr | sed "s,simple,$testdir/simple,g" cat $testdir/complex.experr ) > experr { set +x $as_echo "$at_srcdir/pairing.at:27: blame \$testdir/simple \$testdir/complex,v" at_fn_check_prepare_dynamic "blame $testdir/simple $testdir/complex,v" "pairing.at:27" ( $at_check_trace; blame $testdir/simple $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/pairing.at:27" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_10 #AT_START_11 at_fn_group_banner 11 'pairing.at:30' \ "RCS file, then corresponding working file" " " 2 at_xfail=no ( $as_echo "11. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cat $testdir/simple.experr | sed "s,simple,$testdir/simple,g" > experr { set +x $as_echo "$at_srcdir/pairing.at:34: blame \$testdir/simple,v \$testdir/simple" at_fn_check_prepare_dynamic "blame $testdir/simple,v $testdir/simple" "pairing.at:34" ( $at_check_trace; blame $testdir/simple,v $testdir/simple ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/pairing.at:34" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_11 #AT_START_12 at_fn_group_banner 12 'pairing.at:37' \ "RCS file, then independent working file" " " 2 at_xfail=no ( $as_echo "12. $at_setup_line: testing $at_desc ..." $at_traceon cat $testdir/simple-1.2.expout $testdir/complex-3.8.expout > expout ( cat $testdir/simple.experr cat $testdir/complex.experr | sed "s,complex,$testdir/complex,g" ) > experr { set +x $as_echo "$at_srcdir/pairing.at:44: blame \$testdir/simple,v \$testdir/complex" at_fn_check_prepare_dynamic "blame $testdir/simple,v $testdir/complex" "pairing.at:44" ( $at_check_trace; blame $testdir/simple,v $testdir/complex ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/pairing.at:44" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_12 #AT_START_13 at_fn_group_banner 13 'pairing.at:47' \ "RCS file, then independent RCS file" " " 2 at_xfail=no ( $as_echo "13. $at_setup_line: testing $at_desc ..." $at_traceon cat $testdir/simple-1.2.expout $testdir/complex-3.8.expout > expout cat $testdir/simple.experr $testdir/complex.experr > experr { set +x $as_echo "$at_srcdir/pairing.at:51: blame \$testdir/simple,v \$testdir/complex,v" at_fn_check_prepare_dynamic "blame $testdir/simple,v $testdir/complex,v" "pairing.at:51" ( $at_check_trace; blame $testdir/simple,v $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/pairing.at:51" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_13 #AT_START_14 at_fn_group_banner 14 'rcs.at:3' \ "No revisions present" " " 3 at_xfail=no ( $as_echo "14. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/rcs.at:6: blame \$testdir/empty,v" at_fn_check_prepare_dynamic "blame $testdir/empty,v" "rcs.at:6" ( $at_check_trace; blame $testdir/empty,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rcs.at:6" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_14 #AT_START_15 at_fn_group_banner 15 'rcs.at:10' \ "Two-digit year before 2000" " " 3 at_xfail=no ( $as_echo "15. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/compat-1.1.expout expout cp $testdir/compat.experr experr { set +x $as_echo "$at_srcdir/rcs.at:14: blame -r1.1 \$testdir/compat,v" at_fn_check_prepare_dynamic "blame -r1.1 $testdir/compat,v" "rcs.at:14" ( $at_check_trace; blame -r1.1 $testdir/compat,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rcs.at:14" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_15 #AT_START_16 at_fn_group_banner 16 'rcs.at:17' \ "Missing empty line after delta text" " " 3 at_xfail=no ( $as_echo "16. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/compat-1.2.expout expout cp $testdir/compat.experr experr { set +x $as_echo "$at_srcdir/rcs.at:21: blame -r1.2 \$testdir/compat,v" at_fn_check_prepare_dynamic "blame -r1.2 $testdir/compat,v" "rcs.at:21" ( $at_check_trace; blame -r1.2 $testdir/compat,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rcs.at:21" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_16 #AT_START_17 at_fn_group_banner 17 'rcs.at:24' \ "Binary data" " " 3 at_xfail=no ( $as_echo "17. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/binary-1.2.expout expout cp $testdir/binary.experr experr { set +x $as_echo "$at_srcdir/rcs.at:28: blame -r1.2 \$testdir/binary,v" at_fn_check_prepare_dynamic "blame -r1.2 $testdir/binary,v" "rcs.at:28" ( $at_check_trace; blame -r1.2 $testdir/binary,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rcs.at:28" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_17 #AT_START_18 at_fn_group_banner 18 'rev.at:3' \ "No revision" " " 4 at_xfail=no ( $as_echo "18. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:7: blame -r -- \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r -- $testdir/simple,v" "rev.at:7" ( $at_check_trace; blame -r -- $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:7" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/rev.at:8: blame --revision -- \$testdir/simple,v" at_fn_check_prepare_dynamic "blame --revision -- $testdir/simple,v" "rev.at:8" ( $at_check_trace; blame --revision -- $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:8" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_18 #AT_START_19 at_fn_group_banner 19 'rev.at:11' \ "Multiple revisions" " " 4 at_xfail=no ( $as_echo "19. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/rev.at:14: blame -r1.1 -r1.2 \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r1.1 -r1.2 $testdir/simple,v" "rev.at:14" ( $at_check_trace; blame -r1.1 -r1.2 $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rev.at:14" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_19 #AT_START_20 at_fn_group_banner 20 'rev.at:18' \ "Single dot" " " 4 at_xfail=no ( $as_echo "20. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:22: blame -r. \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r. $testdir/simple,v" "rev.at:22" ( $at_check_trace; blame -r. $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:22" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/rev.at:23: blame --revision=. \$testdir/simple,v" at_fn_check_prepare_dynamic "blame --revision=. $testdir/simple,v" "rev.at:23" ( $at_check_trace; blame --revision=. $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:23" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_20 #AT_START_21 at_fn_group_banner 21 'rev.at:26' \ "Valid trunk branch" " " 4 at_xfail=no ( $as_echo "21. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:30: blame -r1 \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r1 $testdir/simple,v" "rev.at:30" ( $at_check_trace; blame -r1 $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:30" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_21 #AT_START_22 at_fn_group_banner 22 'rev.at:33' \ "Invalid trunk branch" " " 4 at_xfail=no ( $as_echo "22. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/rev.at:36: blame -r4 \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r4 $testdir/simple,v" "rev.at:36" ( $at_check_trace; blame -r4 $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rev.at:36" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_22 #AT_START_23 at_fn_group_banner 23 'rev.at:40' \ "Valid trunk branch and dot" " " 4 at_xfail=no ( $as_echo "23. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:44: blame -r1. \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r1. $testdir/simple,v" "rev.at:44" ( $at_check_trace; blame -r1. $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:44" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_23 #AT_START_24 at_fn_group_banner 24 'rev.at:47' \ "Invalid trunk branch and dot" " " 4 at_xfail=no ( $as_echo "24. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/rev.at:50: blame -r4. \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r4. $testdir/simple,v" "rev.at:50" ( $at_check_trace; blame -r4. $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rev.at:50" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_24 #AT_START_25 at_fn_group_banner 25 'rev.at:54' \ "Dot and revision" " " 4 at_xfail=no ( $as_echo "25. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:58: blame -r.1 \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r.1 $testdir/simple,v" "rev.at:58" ( $at_check_trace; blame -r.1 $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:58" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_25 #AT_START_26 at_fn_group_banner 26 'rev.at:61' \ "Dot and late revision" " " 4 at_xfail=no ( $as_echo "26. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:65: blame -r.10 \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r.10 $testdir/simple,v" "rev.at:65" ( $at_check_trace; blame -r.10 $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:65" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_26 #AT_START_27 at_fn_group_banner 27 'rev.at:68' \ "Dot and early revision" " " 4 at_xfail=no ( $as_echo "27. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/rev.at:71: blame -r.0 \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r.0 $testdir/simple,v" "rev.at:71" ( $at_check_trace; blame -r.0 $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rev.at:71" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_27 #AT_START_28 at_fn_group_banner 28 'rev.at:75' \ "Symbolic trunk branch" " " 4 at_xfail=no ( $as_echo "28. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:80: blame -rfoo \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -rfoo $testdir/simple,v" "rev.at:80" ( $at_check_trace; blame -rfoo $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:80" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_28 #AT_START_29 at_fn_group_banner 29 'rev.at:83' \ "Symbolic trunk branch and dot" " " 4 at_xfail=no ( $as_echo "29. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:88: blame -rfoo. \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -rfoo. $testdir/simple,v" "rev.at:88" ( $at_check_trace; blame -rfoo. $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:88" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_29 #AT_START_30 at_fn_group_banner 30 'rev.at:91' \ "Symbolic trunk branch and revision" " " 4 at_xfail=no ( $as_echo "30. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:96: blame -rfoo.1 \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -rfoo.1 $testdir/simple,v" "rev.at:96" ( $at_check_trace; blame -rfoo.1 $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:96" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_30 #AT_START_31 at_fn_group_banner 31 'rev.at:99' \ "Symbolic trunk branch and late revision" " " 4 at_xfail=no ( $as_echo "31. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:104: blame -rfoo.10 \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -rfoo.10 $testdir/simple,v" "rev.at:104" ( $at_check_trace; blame -rfoo.10 $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:104" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_31 #AT_START_32 at_fn_group_banner 32 'rev.at:107' \ "Symbolic trunk branch and early revision" " " 4 at_xfail=no ( $as_echo "32. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/rev.at:111: blame -rfoo.0 \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -rfoo.0 $testdir/simple,v" "rev.at:111" ( $at_check_trace; blame -rfoo.0 $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rev.at:111" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_32 #AT_START_33 at_fn_group_banner 33 'rev.at:115' \ "Symbolic revision" " " 4 at_xfail=no ( $as_echo "33. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:120: blame -rbar \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -rbar $testdir/simple,v" "rev.at:120" ( $at_check_trace; blame -rbar $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:120" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_33 #AT_START_34 at_fn_group_banner 34 'rev.at:123' \ "Dot and symbolic revision" " " 4 at_xfail=no ( $as_echo "34. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:128: blame -r.foo \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r.foo $testdir/simple,v" "rev.at:128" ( $at_check_trace; blame -r.foo $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:128" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_34 #AT_START_35 at_fn_group_banner 35 'rev.at:131' \ "Symbolic trunk branch and symbolic revision" " " 4 at_xfail=no ( $as_echo "35. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/rev.at:136: blame -rfoo.foo \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -rfoo.foo $testdir/simple,v" "rev.at:136" ( $at_check_trace; blame -rfoo.foo $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rev.at:136" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_35 #AT_START_36 at_fn_group_banner 36 'rev.at:139' \ "Invalid symbol" " " 4 at_xfail=no ( $as_echo "36. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/rev.at:143: blame -rbaz \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -rbaz $testdir/simple,v" "rev.at:143" ( $at_check_trace; blame -rbaz $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rev.at:143" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/rev.at:145: blame -r.baz \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r.baz $testdir/simple,v" "rev.at:145" ( $at_check_trace; blame -r.baz $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rev.at:145" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/rev.at:147: blame -rbaz. \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -rbaz. $testdir/simple,v" "rev.at:147" ( $at_check_trace; blame -rbaz. $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rev.at:147" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/rev.at:149: blame -r1.baz \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -r1.baz $testdir/simple,v" "rev.at:149" ( $at_check_trace; blame -r1.baz $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rev.at:149" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_36 #AT_START_37 at_fn_group_banner 37 'branch.at:3' \ "Revision on branch" " " 5 at_xfail=no ( $as_echo "37. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.2.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:8: blame -r1.2.1.2 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.2.1.2 $testdir/complex,v" "branch.at:8" ( $at_check_trace; blame -r1.2.1.2 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:8" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_37 #AT_START_38 at_fn_group_banner 38 'branch.at:11' \ "Revision on deep branch" " " 5 at_xfail=no ( $as_echo "38. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.1.1.1.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:16: blame -r1.2.1.1.1.1 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.2.1.1.1.1 $testdir/complex,v" "branch.at:16" ( $at_check_trace; blame -r1.2.1.1.1.1 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:16" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_38 #AT_START_39 at_fn_group_banner 39 'branch.at:19' \ "Valid branch" " " 5 at_xfail=no ( $as_echo "39. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:23: blame -r1.2.1.1.1 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.2.1.1.1 $testdir/complex,v" "branch.at:23" ( $at_check_trace; blame -r1.2.1.1.1 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:23" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_39 #AT_START_40 at_fn_group_banner 40 'branch.at:26' \ "Invalid branch" " " 5 at_xfail=no ( $as_echo "40. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/branch.at:30: blame -r1.2.1.3.1 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.2.1.3.1 $testdir/complex,v" "branch.at:30" ( $at_check_trace; blame -r1.2.1.3.1 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/branch.at:30" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_40 #AT_START_41 at_fn_group_banner 41 'branch.at:34' \ "Valid branch and dot" " " 5 at_xfail=no ( $as_echo "41. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:38: blame -r1.2.1.1.1. \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.2.1.1.1. $testdir/complex,v" "branch.at:38" ( $at_check_trace; blame -r1.2.1.1.1. $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:38" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_41 #AT_START_42 at_fn_group_banner 42 'branch.at:41' \ "Invalid branch and dot" " " 5 at_xfail=no ( $as_echo "42. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/branch.at:45: blame -r1.2.1.3.1. \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.2.1.3.1. $testdir/complex,v" "branch.at:45" ( $at_check_trace; blame -r1.2.1.3.1. $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/branch.at:45" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_42 #AT_START_43 at_fn_group_banner 43 'branch.at:49' \ "Dot and revision on branch" " " 5 at_xfail=no ( $as_echo "43. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.2.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:54: blame -r.2.1.2 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r.2.1.2 $testdir/complex,v" "branch.at:54" ( $at_check_trace; blame -r.2.1.2 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:54" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_43 #AT_START_44 at_fn_group_banner 44 'branch.at:57' \ "Dot and late revision on branch" " " 5 at_xfail=no ( $as_echo "44. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:62: blame -r.2.1.10 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r.2.1.10 $testdir/complex,v" "branch.at:62" ( $at_check_trace; blame -r.2.1.10 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:62" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_44 #AT_START_45 at_fn_group_banner 45 'branch.at:65' \ "Dot and early revision on branch" " " 5 at_xfail=no ( $as_echo "45. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/branch.at:69: blame -r.2.1.0 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r.2.1.0 $testdir/complex,v" "branch.at:69" ( $at_check_trace; blame -r.2.1.0 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/branch.at:69" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_45 #AT_START_46 at_fn_group_banner 46 'branch.at:73' \ "Dot and branch" " " 5 at_xfail=no ( $as_echo "46. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:78: blame -r.2.1 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r.2.1 $testdir/complex,v" "branch.at:78" ( $at_check_trace; blame -r.2.1 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:78" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_46 #AT_START_47 at_fn_group_banner 47 'branch.at:81' \ "Dot, branch and dot" " " 5 at_xfail=no ( $as_echo "47. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:86: blame -r.2.1. \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r.2.1. $testdir/complex,v" "branch.at:86" ( $at_check_trace; blame -r.2.1. $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:86" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_47 #AT_START_48 at_fn_group_banner 48 'branch.at:89' \ "Symbolic branch" " " 5 at_xfail=no ( $as_echo "48. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:95: blame -rbar \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -rbar $testdir/complex,v" "branch.at:95" ( $at_check_trace; blame -rbar $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:95" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_48 #AT_START_49 at_fn_group_banner 49 'branch.at:98' \ "Symbolic branch and dot" " " 5 at_xfail=no ( $as_echo "49. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:104: blame -rbar. \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -rbar. $testdir/complex,v" "branch.at:104" ( $at_check_trace; blame -rbar. $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:104" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_49 #AT_START_50 at_fn_group_banner 50 'branch.at:107' \ "Symbolic branch and revision" " " 5 at_xfail=no ( $as_echo "50. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.2.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:113: blame -rbar.2 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -rbar.2 $testdir/complex,v" "branch.at:113" ( $at_check_trace; blame -rbar.2 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:113" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_50 #AT_START_51 at_fn_group_banner 51 'branch.at:116' \ "Symbolic branch and late revision" " " 5 at_xfail=no ( $as_echo "51. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:122: blame -rbar.10 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -rbar.10 $testdir/complex,v" "branch.at:122" ( $at_check_trace; blame -rbar.10 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:122" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_51 #AT_START_52 at_fn_group_banner 52 'branch.at:125' \ "Symbolic branch and early revision" " " 5 at_xfail=no ( $as_echo "52. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/branch.at:130: blame -rbar.0 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -rbar.0 $testdir/complex,v" "branch.at:130" ( $at_check_trace; blame -rbar.0 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/branch.at:130" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_52 #AT_START_53 at_fn_group_banner 53 'branch.at:134' \ "Symbolic revision on branch" " " 5 at_xfail=no ( $as_echo "53. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:140: blame -rbaz \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -rbaz $testdir/complex,v" "branch.at:140" ( $at_check_trace; blame -rbaz $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:140" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_53 #AT_START_54 at_fn_group_banner 54 'branch.at:143' \ "Dot and symbolic revision on branch" " " 5 at_xfail=no ( $as_echo "54. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.1.1.1.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:149: blame -r.quux \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r.quux $testdir/complex,v" "branch.at:149" ( $at_check_trace; blame -r.quux $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:149" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_54 #AT_START_55 at_fn_group_banner 55 'branch.at:152' \ "Dot and symbolic branch" " " 5 at_xfail=no ( $as_echo "55. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:157: blame -r.fred \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r.fred $testdir/complex,v" "branch.at:157" ( $at_check_trace; blame -r.fred $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:157" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_55 #AT_START_56 at_fn_group_banner 56 'branch.at:160' \ "Dot, symbolic branch and dot" " " 5 at_xfail=no ( $as_echo "56. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.3.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:165: blame -r.fred. \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r.fred. $testdir/complex,v" "branch.at:165" ( $at_check_trace; blame -r.fred. $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:165" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_56 #AT_START_57 at_fn_group_banner 57 'branch.at:168' \ "Symbolic branch and symbolic revision" " " 5 at_xfail=no ( $as_echo "57. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.1.1.1.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:174: blame -rplugh.quux \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -rplugh.quux $testdir/complex,v" "branch.at:174" ( $at_check_trace; blame -rplugh.quux $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:174" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_57 #AT_START_58 at_fn_group_banner 58 'branch.at:177' \ "Number, symbol and symbol" " " 5 at_xfail=no ( $as_echo "58. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.1.1.1.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:183: blame -r1.fred.xyzzy \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.fred.xyzzy $testdir/complex,v" "branch.at:183" ( $at_check_trace; blame -r1.fred.xyzzy $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:183" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_58 #AT_START_59 at_fn_group_banner 59 'branch.at:186' \ "Symbol, number and symbol" " " 5 at_xfail=no ( $as_echo "59. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.1.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:192: blame -rfoo.1.plugh \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -rfoo.1.plugh $testdir/complex,v" "branch.at:192" ( $at_check_trace; blame -rfoo.1.plugh $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:192" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_59 #AT_START_60 at_fn_group_banner 60 'branch.at:195' \ "Symbol, symbol and number" " " 5 at_xfail=no ( $as_echo "60. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.1.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:201: blame -rfoo.plugh.1 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -rfoo.plugh.1 $testdir/complex,v" "branch.at:201" ( $at_check_trace; blame -rfoo.plugh.1 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:201" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_60 #AT_START_61 at_fn_group_banner 61 'branch.at:204' \ "Number, symbol and number" " " 5 at_xfail=no ( $as_echo "61. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.2.1.1.1.1.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/branch.at:210: blame -r1.2.xyzzy.1 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.2.xyzzy.1 $testdir/complex,v" "branch.at:210" ( $at_check_trace; blame -r1.2.xyzzy.1 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/branch.at:210" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_61 #AT_START_62 at_fn_group_banner 62 'working.at:3' \ "Valid revision" " " 6 at_xfail=no ( $as_echo "62. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/keywords.experr experr cat < keywords \$Revision: 1.1 \$ EOF { set +x $as_echo "$at_srcdir/working.at:10: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:10" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/working.at:10" $at_failed && at_fn_log_failure $at_traceon; } cat < keywords \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:14: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:14" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/working.at:14" $at_failed && at_fn_log_failure $at_traceon; } cat < keywords \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:18: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:18" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/working.at:18" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_62 #AT_START_63 at_fn_group_banner 63 'working.at:21' \ "Early revision" " " 6 at_xfail=no ( $as_echo "63. $at_setup_line: testing $at_desc ..." $at_traceon cat < keywords \$Revision: 1.0 \$ EOF { set +x $as_echo "$at_srcdir/working.at:28: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:28" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/working.at:28" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi cat < keywords \$Id: keywords,v 1.0 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:33: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:33" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/working.at:33" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi cat < keywords \$Header: $testdir/keywords,v 1.0 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:38: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:38" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/working.at:38" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_63 #AT_START_64 at_fn_group_banner 64 'working.at:42' \ "Late revision" " " 6 at_xfail=no ( $as_echo "64. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/keywords.experr experr cat < keywords \$Revision: 1.2 \$ EOF { set +x $as_echo "$at_srcdir/working.at:49: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:49" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/working.at:49" $at_failed && at_fn_log_failure $at_traceon; } cat < keywords \$Id: keywords,v 1.2 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:53: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:53" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/working.at:53" $at_failed && at_fn_log_failure $at_traceon; } cat < keywords \$Header: $testdir/keywords,v 1.2 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:57: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:57" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/working.at:57" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_64 #AT_START_65 at_fn_group_banner 65 'working.at:60' \ "Branch" " " 6 at_xfail=no ( $as_echo "65. $at_setup_line: testing $at_desc ..." $at_traceon cat < keywords \$Revision: 1 \$ EOF { set +x $as_echo "$at_srcdir/working.at:67: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:67" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/working.at:67" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi cat < keywords \$Id: keywords,v 1 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:72: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:72" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/working.at:72" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi cat < keywords \$Header: $testdir/keywords,v 1 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:77: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:77" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/working.at:77" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_65 #AT_START_66 at_fn_group_banner 66 'working.at:81' \ "Other non-revision" " " 6 at_xfail=no ( $as_echo "66. $at_setup_line: testing $at_desc ..." $at_traceon cat < keywords \$Revision: bar \$ EOF { set +x $as_echo "$at_srcdir/working.at:88: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:88" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/working.at:88" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi cat < keywords \$Id: keywords,v bar 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:93: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:93" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/working.at:93" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi cat < keywords \$Header: $testdir/keywords,v bar 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:98: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:98" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/working.at:98" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_66 #AT_START_67 at_fn_group_banner 67 'working.at:102' \ "Parsing escape sequences" " " 6 at_xfail=no ( $as_echo "67. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/keywords.experr experr cat < keywords \$Id: file\twith\nweird\\symbols\040in\044it,v 1.1 2001/01/01 01:01:01 username Exp \$ EOF { set +x $as_echo "$at_srcdir/working.at:109: blame -r'\$' \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -r'$' $testdir/keywords,v" "working.at:109" ( $at_check_trace; blame -r'$' $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/working.at:109" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_67 #AT_START_68 at_fn_group_banner 68 'working.at:112' \ "Producing escape sequences" " " 6 at_xfail=no ( $as_echo "68. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/escape,v 'x$ x,v' cat < 'x$ x' \$Id: x\044\040x,v 1.1 2001/01/01 01:01:01 username Exp \$ EOF cat $testdir/escape.experr | sed 's,escape,x$ x,g' > experr { set +x $as_echo "$at_srcdir/working.at:119: blame -r1.1 'x\$ x'" at_fn_check_prepare_dynamic "blame -r1.1 'x$ x'" "working.at:119" ( $at_check_trace; blame -r1.1 'x$ x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/working.at:119" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_68 #AT_START_69 at_fn_group_banner 69 'working.at:122' \ "Mixing escape characters" " " 6 at_xfail=no ( $as_echo "69. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/escape-1.2.expout expout cp $testdir/escape.experr experr { set +x $as_echo "$at_srcdir/working.at:126: blame -r1.2 \$testdir/escape,v" at_fn_check_prepare_dynamic "blame -r1.2 $testdir/escape,v" "working.at:126" ( $at_check_trace; blame -r1.2 $testdir/escape,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/working.at:126" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_69 #AT_START_70 at_fn_group_banner 70 'date.at:3' \ "Missing date argument" " " 7 at_xfail=no ( $as_echo "70. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/date.at:6: blame \$testdir/simple,v -d" at_fn_check_prepare_dynamic "blame $testdir/simple,v -d" "date.at:6" ( $at_check_trace; blame $testdir/simple,v -d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/date.at:6" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_70 #AT_START_71 at_fn_group_banner 71 'date.at:10' \ "Date after all revisions" " " 7 at_xfail=no ( $as_echo "71. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/date.at:14: blame -d'2002-02-03 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2002-02-03 UTC' $testdir/simple,v" "date.at:14" ( $at_check_trace; blame -d'2002-02-03 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:14" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/date.at:15: blame --date='2002-02-03 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame --date='2002-02-03 UTC' $testdir/simple,v" "date.at:15" ( $at_check_trace; blame --date='2002-02-03 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:15" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_71 #AT_START_72 at_fn_group_banner 72 'date.at:18' \ "Date just after a revision" " " 7 at_xfail=no ( $as_echo "72. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/date.at:22: blame -d'2002-02-02 02:02:03 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2002-02-02 02:02:03 UTC' $testdir/simple,v" "date.at:22" ( $at_check_trace; blame -d'2002-02-02 02:02:03 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:22" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_72 #AT_START_73 at_fn_group_banner 73 'date.at:25' \ "Date on a revision" " " 7 at_xfail=no ( $as_echo "73. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/date.at:29: blame -d'2002-02-02 02:02:02 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2002-02-02 02:02:02 UTC' $testdir/simple,v" "date.at:29" ( $at_check_trace; blame -d'2002-02-02 02:02:02 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:29" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_73 #AT_START_74 at_fn_group_banner 74 'date.at:32' \ "Date just before a revision" " " 7 at_xfail=no ( $as_echo "74. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/date.at:36: blame -d'2002-02-02 02:02:01 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2002-02-02 02:02:01 UTC' $testdir/simple,v" "date.at:36" ( $at_check_trace; blame -d'2002-02-02 02:02:01 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:36" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_74 #AT_START_75 at_fn_group_banner 75 'date.at:39' \ "Date between revisions" " " 7 at_xfail=no ( $as_echo "75. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr { set +x $as_echo "$at_srcdir/date.at:43: blame -d'2001-01-02 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2001-01-02 UTC' $testdir/simple,v" "date.at:43" ( $at_check_trace; blame -d'2001-01-02 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:43" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_75 #AT_START_76 at_fn_group_banner 76 'date.at:46' \ "Date before all revisions" " " 7 at_xfail=no ( $as_echo "76. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/date.at:49: blame -d'2000-01-01 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2000-01-01 UTC' $testdir/simple,v" "date.at:49" ( $at_check_trace; blame -d'2000-01-01 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/date.at:49" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_76 #AT_START_77 at_fn_group_banner 77 'date.at:53' \ "Unparsable date" " " 7 at_xfail=no ( $as_echo "77. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/date.at:56: blame -d'floopy' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'floopy' $testdir/simple,v" "date.at:56" ( $at_check_trace; blame -d'floopy' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/date.at:56" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_77 #AT_START_78 at_fn_group_banner 78 'date.at:60' \ "Unknown timezone" " " 7 at_xfail=no ( $as_echo "78. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/date.at:64: blame -d'2000-01-01 FLOOPY' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2000-01-01 FLOOPY' $testdir/simple,v" "date.at:64" ( $at_check_trace; blame -d'2000-01-01 FLOOPY' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/date.at:64" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_78 #AT_START_79 at_fn_group_banner 79 'date.at:68' \ "No timezone" " " 7 at_xfail=no ( $as_echo "79. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout { set +x $as_echo "$at_srcdir/date.at:73: blame -d'2002-02-02 02:02:03' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2002-02-02 02:02:03' $testdir/simple,v" "date.at:73" ( $at_check_trace; blame -d'2002-02-02 02:02:03' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:73" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/date.at:74: blame -d'2002-02-02 02:02:02' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2002-02-02 02:02:02' $testdir/simple,v" "date.at:74" ( $at_check_trace; blame -d'2002-02-02 02:02:02' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:74" $at_failed && at_fn_log_failure $at_traceon; } rm -f expout cp $testdir/simple-1.1.expout expout { set +x $as_echo "$at_srcdir/date.at:77: blame -d'2002-02-02 02:02:01' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2002-02-02 02:02:01' $testdir/simple,v" "date.at:77" ( $at_check_trace; blame -d'2002-02-02 02:02:01' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:77" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_79 #AT_START_80 at_fn_group_banner 80 'date.at:80' \ "dd-Mon-yyyy hh:mm:ss" " " 7 at_xfail=no ( $as_echo "80. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout { set +x $as_echo "$at_srcdir/date.at:84: blame -d'02-Feb-2002 02:02:03 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'02-Feb-2002 02:02:03 UTC' $testdir/simple,v" "date.at:84" ( $at_check_trace; blame -d'02-Feb-2002 02:02:03 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:84" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/date.at:85: blame -d'02-Feb-2002 02:02:02 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'02-Feb-2002 02:02:02 UTC' $testdir/simple,v" "date.at:85" ( $at_check_trace; blame -d'02-Feb-2002 02:02:02 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:85" $at_failed && at_fn_log_failure $at_traceon; } rm -f expout cp $testdir/simple-1.1.expout expout { set +x $as_echo "$at_srcdir/date.at:88: blame -d'02-Feb-2002 02:02:01 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'02-Feb-2002 02:02:01 UTC' $testdir/simple,v" "date.at:88" ( $at_check_trace; blame -d'02-Feb-2002 02:02:01 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:88" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_80 #AT_START_81 at_fn_group_banner 81 'date.at:91' \ "h:mm:ss AM yyyymmdd" " " 7 at_xfail=no ( $as_echo "81. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout { set +x $as_echo "$at_srcdir/date.at:95: blame -d'2:02:03 am 02-Feb-2002 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2:02:03 am 02-Feb-2002 UTC' $testdir/simple,v" "date.at:95" ( $at_check_trace; blame -d'2:02:03 am 02-Feb-2002 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:95" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/date.at:96: blame -d'2:02:02 am 02-Feb-2002 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2:02:02 am 02-Feb-2002 UTC' $testdir/simple,v" "date.at:96" ( $at_check_trace; blame -d'2:02:02 am 02-Feb-2002 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:96" $at_failed && at_fn_log_failure $at_traceon; } rm -f expout cp $testdir/simple-1.1.expout expout { set +x $as_echo "$at_srcdir/date.at:99: blame -d'2:02:01 am 02-Feb-2002 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2:02:01 am 02-Feb-2002 UTC' $testdir/simple,v" "date.at:99" ( $at_check_trace; blame -d'2:02:01 am 02-Feb-2002 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:99" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_81 #AT_START_82 at_fn_group_banner 82 'date.at:102' \ "Unusual timezone" " " 7 at_xfail=no ( $as_echo "82. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout { set +x $as_echo "$at_srcdir/date.at:107: blame -d'11:02:03 am 02-Feb-2002 AWSST' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'11:02:03 am 02-Feb-2002 AWSST' $testdir/simple,v" "date.at:107" ( $at_check_trace; blame -d'11:02:03 am 02-Feb-2002 AWSST' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:107" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/date.at:108: blame -d'04:02:02 am 02-Feb-2002 FWT' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'04:02:02 am 02-Feb-2002 FWT' $testdir/simple,v" "date.at:108" ( $at_check_trace; blame -d'04:02:02 am 02-Feb-2002 FWT' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:108" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/date.at:109: blame -d'09:32:02 pm 01-Feb-2002 -04:30' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'09:32:02 pm 01-Feb-2002 -04:30' $testdir/simple,v" "date.at:109" ( $at_check_trace; blame -d'09:32:02 pm 01-Feb-2002 -04:30' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:109" $at_failed && at_fn_log_failure $at_traceon; } rm -f expout cp $testdir/simple-1.1.expout expout { set +x $as_echo "$at_srcdir/date.at:112: blame -d'09:32:01 pm 01-Feb-2002 -04:30' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'09:32:01 pm 01-Feb-2002 -04:30' $testdir/simple,v" "date.at:112" ( $at_check_trace; blame -d'09:32:01 pm 01-Feb-2002 -04:30' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:112" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_82 #AT_START_83 at_fn_group_banner 83 'date.at:115' \ "With -z or --zone option" " " 7 at_xfail=no ( $as_echo "83. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout { set +x $as_echo "$at_srcdir/date.at:120: blame -d'11:02:03 am 02-Feb-2002' -z AWSST \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'11:02:03 am 02-Feb-2002' -z AWSST $testdir/simple,v" "date.at:120" ( $at_check_trace; blame -d'11:02:03 am 02-Feb-2002' -z AWSST $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:120" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/date.at:121: blame -d'04:02:02 am 02-Feb-2002' -z FWT \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'04:02:02 am 02-Feb-2002' -z FWT $testdir/simple,v" "date.at:121" ( $at_check_trace; blame -d'04:02:02 am 02-Feb-2002' -z FWT $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:121" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/date.at:122: blame -d'09:32:02 pm 01-Feb-2002' -z -04:30 \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'09:32:02 pm 01-Feb-2002' -z -04:30 $testdir/simple,v" "date.at:122" ( $at_check_trace; blame -d'09:32:02 pm 01-Feb-2002' -z -04:30 $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:122" $at_failed && at_fn_log_failure $at_traceon; } rm -f expout cp $testdir/simple-1.1.expout expout { set +x $as_echo "$at_srcdir/date.at:125: blame -z -04:30 -d'09:32:01 pm 01-Feb-2002' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -z -04:30 -d'09:32:01 pm 01-Feb-2002' $testdir/simple,v" "date.at:125" ( $at_check_trace; blame -z -04:30 -d'09:32:01 pm 01-Feb-2002' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/date.at:125" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_83 #AT_START_84 at_fn_group_banner 84 'date.at:128' \ "Multiple dates" " " 7 at_xfail=no ( $as_echo "84. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/date.at:131: blame -d'2001-01-01 01:01:01 UTC' -d'2002-02-02 02:02:02 UTC' \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -d'2001-01-01 01:01:01 UTC' -d'2002-02-02 02:02:02 UTC' $testdir/simple,v" "date.at:131" ( $at_check_trace; blame -d'2001-01-01 01:01:01 UTC' -d'2002-02-02 02:02:02 UTC' $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/date.at:131" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_84 #AT_START_85 at_fn_group_banner 85 'state.at:3' \ "Missing state argument" " " 8 at_xfail=no ( $as_echo "85. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/state.at:6: blame \$testdir/simple,v -s" at_fn_check_prepare_dynamic "blame $testdir/simple,v -s" "state.at:6" ( $at_check_trace; blame $testdir/simple,v -s ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/state.at:6" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_85 #AT_START_86 at_fn_group_banner 86 'state.at:10' \ "Known state" " " 8 at_xfail=no ( $as_echo "86. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple.experr experr cp $testdir/simple-1.1.expout expout { set +x $as_echo "$at_srcdir/state.at:14: blame -sExp \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -sExp $testdir/simple,v" "state.at:14" ( $at_check_trace; blame -sExp $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/state.at:14" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/state.at:15: blame --state=Exp \$testdir/simple,v" at_fn_check_prepare_dynamic "blame --state=Exp $testdir/simple,v" "state.at:15" ( $at_check_trace; blame --state=Exp $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/state.at:15" $at_failed && at_fn_log_failure $at_traceon; } rm -f expout cp $testdir/simple-1.2.expout expout { set +x $as_echo "$at_srcdir/state.at:18: blame -sStab \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -sStab $testdir/simple,v" "state.at:18" ( $at_check_trace; blame -sStab $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/state.at:18" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/state.at:19: blame --state Stab \$testdir/simple,v" at_fn_check_prepare_dynamic "blame --state Stab $testdir/simple,v" "state.at:19" ( $at_check_trace; blame --state Stab $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/state.at:19" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_86 #AT_START_87 at_fn_group_banner 87 'state.at:22' \ "Unknown state" " " 8 at_xfail=no ( $as_echo "87. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/state.at:25: blame -sFloopy \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -sFloopy $testdir/simple,v" "state.at:25" ( $at_check_trace; blame -sFloopy $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/state.at:25" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_87 #AT_START_88 at_fn_group_banner 88 'state.at:29' \ "Multiple states" " " 8 at_xfail=no ( $as_echo "88. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/state.at:32: blame -sStab -sExp \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -sStab -sExp $testdir/simple,v" "state.at:32" ( $at_check_trace; blame -sStab -sExp $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/state.at:32" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_88 #AT_START_89 at_fn_group_banner 89 'author.at:3' \ "No author" " " 9 at_xfail=no test -z "$username" && at_xfail=yes test "$username" = username && at_xfail=yes test "$username" = somebody && at_xfail=yes ( $as_echo "89. $at_setup_line: testing $at_desc ..." $at_traceon replace="`echo $username | sed 's/$/ /;s/^\(.\{8\}\).*/\1/'`" { set +x $as_echo "$at_srcdir/author.at:9: blame -w -- \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -w -- $testdir/simple,v" "author.at:9" ( $at_check_trace; blame -w -- $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/author.at:9" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi cat $testdir/simple,v | sed "s/somebody/$username/g" > input,v cat $testdir/simple-1.2.expout | sed "s/somebody/$replace/g" > expout cat $testdir/simple.experr | sed "s/simple/input/g" > experr { set +x $as_echo "$at_srcdir/author.at:14: blame -w -- input,v" at_fn_check_prepare_trace "author.at:14" ( $at_check_trace; blame -w -- input,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/author.at:14" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_89 #AT_START_90 at_fn_group_banner 90 'author.at:17' \ "Known author" " " 9 at_xfail=no ( $as_echo "90. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout { set +x $as_echo "$at_srcdir/author.at:21: blame -wsomebody \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -wsomebody $testdir/simple,v" "author.at:21" ( $at_check_trace; blame -wsomebody $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/author.at:21" $at_failed && at_fn_log_failure $at_traceon; } rm -f expout cp $testdir/simple-1.1.expout expout { set +x $as_echo "$at_srcdir/author.at:24: blame -wusername \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -wusername $testdir/simple,v" "author.at:24" ( $at_check_trace; blame -wusername $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/author.at:24" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/author.at:25: blame --author=username \$testdir/simple,v" at_fn_check_prepare_dynamic "blame --author=username $testdir/simple,v" "author.at:25" ( $at_check_trace; blame --author=username $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/author.at:25" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_90 #AT_START_91 at_fn_group_banner 91 'author.at:28' \ "Unknown author" " " 9 at_xfail=no ( $as_echo "91. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/author.at:31: blame -wfloopy \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -wfloopy $testdir/simple,v" "author.at:31" ( $at_check_trace; blame -wfloopy $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/author.at:31" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_91 #AT_START_92 at_fn_group_banner 92 'author.at:35' \ "Multiple authors" " " 9 at_xfail=no ( $as_echo "92. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/author.at:38: blame -wusername -wsomebody \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -wusername -wsomebody $testdir/simple,v" "author.at:38" ( $at_check_trace; blame -wusername -wsomebody $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/author.at:38" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_92 #AT_START_93 at_fn_group_banner 93 'expand.at:3' \ "Default substitutions" " " 10 at_xfail=no ( $as_echo "93. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Locker: \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/expand.at:23: blame \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame $testdir/keywords,v" "expand.at:23" ( $at_check_trace; blame $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/expand.at:23" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_93 #AT_START_94 at_fn_group_banner 94 'expand.at:26' \ "Default substitutions, with timezone" " " 10 at_xfail=no ( $as_echo "94. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2000-12-31 20:01:01-05 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2000-12-31 20:01:01-05 username Exp \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2000-12-31 20:01:01-05 username Exp \$ 1.1 (username 01-Jan-01): \$Locker: \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): Revision 1.1 2000-12-31 20:01:01-05 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/expand.at:46: blame -zEST \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -zEST $testdir/keywords,v" "expand.at:46" ( $at_check_trace; blame -zEST $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/expand.at:46" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_94 #AT_START_95 at_fn_group_banner 95 'expand.at:49' \ "Missing keyword substitution argument" " " 10 at_xfail=no ( $as_echo "95. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/expand.at:52: blame \$testdir/keywords,v -k" at_fn_check_prepare_dynamic "blame $testdir/keywords,v -k" "expand.at:52" ( $at_check_trace; blame $testdir/keywords,v -k ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/expand.at:52" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_95 #AT_START_96 at_fn_group_banner 96 'expand.at:56' \ "Keys and values (-kkv)" " " 10 at_xfail=no ( $as_echo "96. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Locker: \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/expand.at:76: blame -kkv \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -kkv $testdir/keywords,v" "expand.at:76" ( $at_check_trace; blame -kkv $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/expand.at:76" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/expand.at:77: blame --expand=kv \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame --expand=kv $testdir/keywords,v" "expand.at:77" ( $at_check_trace; blame --expand=kv $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/expand.at:77" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/expand.at:78: blame --expand kv \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame --expand kv $testdir/keywords,v" "expand.at:78" ( $at_check_trace; blame --expand kv $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/expand.at:78" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_96 #AT_START_97 at_fn_group_banner 97 'expand.at:81' \ "Keys, values and locker (-kkvl)" " " 10 at_xfail=no ( $as_echo "97. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp username \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp username \$ 1.1 (username 01-Jan-01): \$Locker: username \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/expand.at:101: blame -kkvl \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -kkvl $testdir/keywords,v" "expand.at:101" ( $at_check_trace; blame -kkvl $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/expand.at:101" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_97 #AT_START_98 at_fn_group_banner 98 'expand.at:104' \ "Keys only (-kk)" " " 10 at_xfail=no ( $as_echo "98. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): \$Author\$ 1.1 (username 01-Jan-01): \$Date\$ 1.1 (username 01-Jan-01): \$Header\$ 1.1 (username 01-Jan-01): \$Id\$ 1.1 (username 01-Jan-01): \$Locker\$ 1.1 (username 01-Jan-01): \$Log\$ 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name\$ 1.1 (username 01-Jan-01): \$RCSfile\$ 1.1 (username 01-Jan-01): \$Revision\$ 1.1 (username 01-Jan-01): \$Source\$ 1.1 (username 01-Jan-01): \$State\$ EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/expand.at:124: blame -kk \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -kk $testdir/keywords,v" "expand.at:124" ( $at_check_trace; blame -kk $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/expand.at:124" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_98 #AT_START_99 at_fn_group_banner 99 'expand.at:127' \ "Old keywords strings (-ko)" " " 10 at_xfail=no ( $as_echo "99. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): \$Author\$ 1.1 (username 01-Jan-01): \$Date\$ 1.1 (username 01-Jan-01): \$Header\$ 1.1 (username 01-Jan-01): \$Id\$ 1.1 (username 01-Jan-01): \$Locker\$ 1.1 (username 01-Jan-01): \$Log\$ 1.1 (username 01-Jan-01): \$Name\$ 1.1 (username 01-Jan-01): \$RCSfile\$ 1.1 (username 01-Jan-01): \$Revision\$ 1.1 (username 01-Jan-01): \$Source\$ 1.1 (username 01-Jan-01): \$State\$ EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/expand.at:144: blame -ko \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -ko $testdir/keywords,v" "expand.at:144" ( $at_check_trace; blame -ko $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/expand.at:144" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_99 #AT_START_100 at_fn_group_banner 100 'expand.at:147' \ "Binary image of old keywords strings (-kb)" " " 10 at_xfail=no ( $as_echo "100. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): \$Author\$ 1.1 (username 01-Jan-01): \$Date\$ 1.1 (username 01-Jan-01): \$Header\$ 1.1 (username 01-Jan-01): \$Id\$ 1.1 (username 01-Jan-01): \$Locker\$ 1.1 (username 01-Jan-01): \$Log\$ 1.1 (username 01-Jan-01): \$Name\$ 1.1 (username 01-Jan-01): \$RCSfile\$ 1.1 (username 01-Jan-01): \$Revision\$ 1.1 (username 01-Jan-01): \$Source\$ 1.1 (username 01-Jan-01): \$State\$ EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/expand.at:164: blame -kb \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -kb $testdir/keywords,v" "expand.at:164" ( $at_check_trace; blame -kb $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/expand.at:164" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_100 #AT_START_101 at_fn_group_banner 101 'expand.at:167' \ "Values only (-kv)" " " 10 at_xfail=no ( $as_echo "101. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): username 1.1 (username 01-Jan-01): 2001/01/01 01:01:01 1.1 (username 01-Jan-01): $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp 1.1 (username 01-Jan-01): keywords,v 1.1 2001/01/01 01:01:01 username Exp 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): keywords,v 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): keywords,v 1.1 (username 01-Jan-01): 1.1 1.1 (username 01-Jan-01): $testdir/keywords,v 1.1 (username 01-Jan-01): Exp EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/expand.at:187: blame -kv \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -kv $testdir/keywords,v" "expand.at:187" ( $at_check_trace; blame -kv $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/expand.at:187" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_101 #AT_START_102 at_fn_group_banner 102 'expand.at:190' \ "Multiple substitution types" " " 10 at_xfail=no ( $as_echo "102. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/expand.at:193: blame -ko -kkvl \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -ko -kkvl $testdir/simple,v" "expand.at:193" ( $at_check_trace; blame -ko -kkvl $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/expand.at:193" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_102 #AT_START_103 at_fn_group_banner 103 'version.at:3' \ "Invalid version argument" " " 11 at_xfail=no ( $as_echo "103. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/version.at:6: blame -V1 \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -V1 $testdir/keywords,v" "version.at:6" ( $at_check_trace; blame -V1 $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/version.at:6" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/version.at:8: blame --version=foo \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame --version=foo $testdir/keywords,v" "version.at:8" ( $at_check_trace; blame --version=foo $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/version.at:8" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_103 #AT_START_104 at_fn_group_banner 104 'version.at:12' \ "Emulating RCS version 3" " " 11 at_xfail=no ( $as_echo "104. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: keywords,v 1.1 2001/01/01 01:01:01 username Locked \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Locked \$ 1.1 (username 01-Jan-01): \$Locker: username \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): # Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): # Initial revision 1.1 (username 01-Jan-01): #$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/version.at:32: blame -V3 \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -V3 $testdir/keywords,v" "version.at:32" ( $at_check_trace; blame -V3 $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/version.at:32" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/version.at:33: blame --version=3 \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame --version=3 $testdir/keywords,v" "version.at:33" ( $at_check_trace; blame --version=3 $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/version.at:33" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_104 #AT_START_105 at_fn_group_banner 105 'version.at:36' \ "Emulating RCS version 4" " " 11 at_xfail=no ( $as_echo "105. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp Locker: username \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp Locker: username \$ 1.1 (username 01-Jan-01): \$Locker: username \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): # Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): # Initial revision 1.1 (username 01-Jan-01): #$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/version.at:56: blame -V4 \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -V4 $testdir/keywords,v" "version.at:56" ( $at_check_trace; blame -V4 $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/version.at:56" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/version.at:57: blame --version=4 \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame --version=4 $testdir/keywords,v" "version.at:57" ( $at_check_trace; blame --version=4 $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/version.at:57" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_105 #AT_START_106 at_fn_group_banner 106 'version.at:60' \ "Emulating RCS version 5" " " 11 at_xfail=no ( $as_echo "106. $at_setup_line: testing $at_desc ..." $at_traceon cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Locker: \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr { set +x $as_echo "$at_srcdir/version.at:80: blame -V5 \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame -V5 $testdir/keywords,v" "version.at:80" ( $at_check_trace; blame -V5 $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/version.at:80" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/version.at:81: blame --version=5 \$testdir/keywords,v" at_fn_check_prepare_dynamic "blame --version=5 $testdir/keywords,v" "version.at:81" ( $at_check_trace; blame --version=5 $testdir/keywords,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/version.at:81" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_106 #AT_START_107 at_fn_group_banner 107 'suffixes.at:3' \ "Default suffixes" " " 12 at_xfail=no ( $as_echo "107. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout { set +x $as_echo "$at_srcdir/suffixes.at:6: blame \$testdir/file1" at_fn_check_prepare_dynamic "blame $testdir/file1" "suffixes.at:6" ( $at_check_trace; blame $testdir/file1 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/suffixes.at:6" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_107 #AT_START_108 at_fn_group_banner 108 'suffixes.at:9' \ "Nonstandard suffixes" " " 12 at_xfail=no ( $as_echo "108. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/simple-1.2.expout expout { set +x $as_echo "$at_srcdir/suffixes.at:12: blame -x\$slash-foo\$slash-bar \$testdir/file2" at_fn_check_prepare_dynamic "blame -x$slash-foo$slash-bar $testdir/file2" "suffixes.at:12" ( $at_check_trace; blame -x$slash-foo$slash-bar $testdir/file2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/suffixes.at:12" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/suffixes.at:13: blame --suffixes=\$slash-foo\$slash-bar \$testdir/file3" at_fn_check_prepare_dynamic "blame --suffixes=$slash-foo$slash-bar $testdir/file3" "suffixes.at:13" ( $at_check_trace; blame --suffixes=$slash-foo$slash-bar $testdir/file3 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/suffixes.at:13" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/suffixes.at:14: blame --suffixes \$slash-foo\$slash-bar \$testdir/file3" at_fn_check_prepare_dynamic "blame --suffixes $slash-foo$slash-bar $testdir/file3" "suffixes.at:14" ( $at_check_trace; blame --suffixes $slash-foo$slash-bar $testdir/file3 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/suffixes.at:14" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_108 #AT_START_109 at_fn_group_banner 109 'suffixes.at:17' \ "Multiple suffixes specifications" " " 12 at_xfail=no ( $as_echo "109. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/suffixes.at:20: blame -x\$slash-foo\$slash-bar -x\$slash-bar\$slash-foo \$testdir/simple,v" at_fn_check_prepare_dynamic "blame -x$slash-foo$slash-bar -x$slash-bar$slash-foo $testdir/simple,v" "suffixes.at:20" ( $at_check_trace; blame -x$slash-foo$slash-bar -x$slash-bar$slash-foo $testdir/simple,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/suffixes.at:20" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_109 #AT_START_110 at_fn_group_banner 110 'mixed.at:3' \ "Valid -r and -d combo" " " 13 at_xfail=no ( $as_echo "110. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-3.4.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:9: blame -r3.4 -d'2001/01/01 03:04:01' \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r3.4 -d'2001/01/01 03:04:01' $testdir/complex,v" "mixed.at:9" ( $at_check_trace; blame -r3.4 -d'2001/01/01 03:04:01' $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:9" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/mixed.at:10: blame -r3.4 -d'2001/01/01 03:04:00' \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r3.4 -d'2001/01/01 03:04:00' $testdir/complex,v" "mixed.at:10" ( $at_check_trace; blame -r3.4 -d'2001/01/01 03:04:00' $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:10" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_110 #AT_START_111 at_fn_group_banner 111 'mixed.at:13' \ "Invalid -r and -d combo" " " 13 at_xfail=no ( $as_echo "111. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:18: blame -r3.4 -d'2001/01/01 03:03:59' \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r3.4 -d'2001/01/01 03:03:59' $testdir/complex,v" "mixed.at:18" ( $at_check_trace; blame -r3.4 -d'2001/01/01 03:03:59' $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:18" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_111 #AT_START_112 at_fn_group_banner 112 'mixed.at:22' \ "Valid -r and -s combo" " " 13 at_xfail=no ( $as_echo "112. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-3.4.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:28: blame -r3.4 -sA \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r3.4 -sA $testdir/complex,v" "mixed.at:28" ( $at_check_trace; blame -r3.4 -sA $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:28" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_112 #AT_START_113 at_fn_group_banner 113 'mixed.at:31' \ "Invalid -r and -s combo" " " 13 at_xfail=no ( $as_echo "113. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:36: blame -r3.4 -sB \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r3.4 -sB $testdir/complex,v" "mixed.at:36" ( $at_check_trace; blame -r3.4 -sB $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:36" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_113 #AT_START_114 at_fn_group_banner 114 'mixed.at:40' \ "Valid -r and -w combo" " " 13 at_xfail=no ( $as_echo "114. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-3.4.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:46: blame -r3.4 -wuser1 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r3.4 -wuser1 $testdir/complex,v" "mixed.at:46" ( $at_check_trace; blame -r3.4 -wuser1 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:46" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_114 #AT_START_115 at_fn_group_banner 115 'mixed.at:49' \ "Invalid -r and -w combo" " " 13 at_xfail=no ( $as_echo "115. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:54: blame -r3.4 -wuser2 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r3.4 -wuser2 $testdir/complex,v" "mixed.at:54" ( $at_check_trace; blame -r3.4 -wuser2 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:54" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_115 #AT_START_116 at_fn_group_banner 116 'mixed.at:58' \ "Valid -d and -s combo" " " 13 at_xfail=no ( $as_echo "116. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.1.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:64: blame -d'2001/01/01 01:01:00' -sA \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -d'2001/01/01 01:01:00' -sA $testdir/complex,v" "mixed.at:64" ( $at_check_trace; blame -d'2001/01/01 01:01:00' -sA $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:64" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/mixed.at:65: blame -d'2001/01/01 01:01:30' -sA \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -d'2001/01/01 01:01:30' -sA $testdir/complex,v" "mixed.at:65" ( $at_check_trace; blame -d'2001/01/01 01:01:30' -sA $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:65" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_116 #AT_START_117 at_fn_group_banner 117 'mixed.at:68' \ "Invalid -d and -s combo" " " 13 at_xfail=no ( $as_echo "117. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:73: blame -d'2001/01/01 01:01:30' -sB \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -d'2001/01/01 01:01:30' -sB $testdir/complex,v" "mixed.at:73" ( $at_check_trace; blame -d'2001/01/01 01:01:30' -sB $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:73" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_117 #AT_START_118 at_fn_group_banner 118 'mixed.at:77' \ "Valid -d and -w combo" " " 13 at_xfail=no ( $as_echo "118. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.1.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:83: blame -d'2001/01/01 01:01:00' -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -d'2001/01/01 01:01:00' -wuser3 $testdir/complex,v" "mixed.at:83" ( $at_check_trace; blame -d'2001/01/01 01:01:00' -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:83" $at_failed && at_fn_log_failure $at_traceon; } { set +x $as_echo "$at_srcdir/mixed.at:84: blame -d'2001/01/01 01:01:30' -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -d'2001/01/01 01:01:30' -wuser3 $testdir/complex,v" "mixed.at:84" ( $at_check_trace; blame -d'2001/01/01 01:01:30' -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:84" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_118 #AT_START_119 at_fn_group_banner 119 'mixed.at:87' \ "Invalid -d and -w combo" " " 13 at_xfail=no ( $as_echo "119. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:92: blame -d'2001/01/01 01:01:30' -wuser2 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -d'2001/01/01 01:01:30' -wuser2 $testdir/complex,v" "mixed.at:92" ( $at_check_trace; blame -d'2001/01/01 01:01:30' -wuser2 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:92" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_119 #AT_START_120 at_fn_group_banner 120 'mixed.at:96' \ "Valid -s and -w combo" " " 13 at_xfail=no ( $as_echo "120. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.1.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:102: blame -sA -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -sA -wuser3 $testdir/complex,v" "mixed.at:102" ( $at_check_trace; blame -sA -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:102" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_120 #AT_START_121 at_fn_group_banner 121 'mixed.at:105' \ "Invalid -s and -w combo" " " 13 at_xfail=no ( $as_echo "121. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:110: blame -sC -wuser2 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -sC -wuser2 $testdir/complex,v" "mixed.at:110" ( $at_check_trace; blame -sC -wuser2 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:110" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_121 #AT_START_122 at_fn_group_banner 122 'mixed.at:114' \ "Valid -r, -d and -s combo" " " 13 at_xfail=no ( $as_echo "122. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-2.2.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:121: blame -r2.2 -d'2001/01/01 03:10:00' -sC \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.2 -d'2001/01/01 03:10:00' -sC $testdir/complex,v" "mixed.at:121" ( $at_check_trace; blame -r2.2 -d'2001/01/01 03:10:00' -sC $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:121" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_122 #AT_START_123 at_fn_group_banner 123 'mixed.at:124' \ "Invalid -r, -d and -s combo" " " 13 at_xfail=no ( $as_echo "123. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:130: blame -r2.1 -d'2001/01/01 03:10:00' -sC \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.1 -d'2001/01/01 03:10:00' -sC $testdir/complex,v" "mixed.at:130" ( $at_check_trace; blame -r2.1 -d'2001/01/01 03:10:00' -sC $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:130" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:132: blame -r2.2 -d'2001/01/01 01:10:00' -sC \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.2 -d'2001/01/01 01:10:00' -sC $testdir/complex,v" "mixed.at:132" ( $at_check_trace; blame -r2.2 -d'2001/01/01 01:10:00' -sC $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:132" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:134: blame -r2.2 -d'2001/01/01 03:10:00' -sA \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.2 -d'2001/01/01 03:10:00' -sA $testdir/complex,v" "mixed.at:134" ( $at_check_trace; blame -r2.2 -d'2001/01/01 03:10:00' -sA $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:134" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_123 #AT_START_124 at_fn_group_banner 124 'mixed.at:138' \ "Valid -r, -d and -w combo" " " 13 at_xfail=no ( $as_echo "124. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-2.2.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:145: blame -r2.2 -d'2001/01/01 03:10:00' -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.2 -d'2001/01/01 03:10:00' -wuser3 $testdir/complex,v" "mixed.at:145" ( $at_check_trace; blame -r2.2 -d'2001/01/01 03:10:00' -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:145" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_124 #AT_START_125 at_fn_group_banner 125 'mixed.at:148' \ "Invalid -r, -d and -w combo" " " 13 at_xfail=no ( $as_echo "125. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:154: blame -r2.1 -d'2001/01/01 03:10:00' -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.1 -d'2001/01/01 03:10:00' -wuser3 $testdir/complex,v" "mixed.at:154" ( $at_check_trace; blame -r2.1 -d'2001/01/01 03:10:00' -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:154" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:156: blame -r2.2 -d'2001/01/01 01:10:00' -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.2 -d'2001/01/01 01:10:00' -wuser3 $testdir/complex,v" "mixed.at:156" ( $at_check_trace; blame -r2.2 -d'2001/01/01 01:10:00' -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:156" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:158: blame -r2.2 -d'2001/01/01 03:10:00' -wuser2 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.2 -d'2001/01/01 03:10:00' -wuser2 $testdir/complex,v" "mixed.at:158" ( $at_check_trace; blame -r2.2 -d'2001/01/01 03:10:00' -wuser2 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:158" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_125 #AT_START_126 at_fn_group_banner 126 'mixed.at:162' \ "Valid -r, -s and -w combo" " " 13 at_xfail=no ( $as_echo "126. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-2.2.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:169: blame -r2.2 -sC -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.2 -sC -wuser3 $testdir/complex,v" "mixed.at:169" ( $at_check_trace; blame -r2.2 -sC -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:169" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_126 #AT_START_127 at_fn_group_banner 127 'mixed.at:172' \ "Invalid -r, -s and -w combo" " " 13 at_xfail=no ( $as_echo "127. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:178: blame -r2.1 -sC -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.1 -sC -wuser3 $testdir/complex,v" "mixed.at:178" ( $at_check_trace; blame -r2.1 -sC -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:178" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:180: blame -r2.2 -sA -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.2 -sA -wuser3 $testdir/complex,v" "mixed.at:180" ( $at_check_trace; blame -r2.2 -sA -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:180" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:182: blame -r2.2 -sC -wuser2 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r2.2 -sC -wuser2 $testdir/complex,v" "mixed.at:182" ( $at_check_trace; blame -r2.2 -sC -wuser2 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:182" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_127 #AT_START_128 at_fn_group_banner 128 'mixed.at:186' \ "Valid -d, -s and -w combo" " " 13 at_xfail=no ( $as_echo "128. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.4.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:193: blame -d'2001/01/01 01:10:00' -sB -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -d'2001/01/01 01:10:00' -sB -wuser3 $testdir/complex,v" "mixed.at:193" ( $at_check_trace; blame -d'2001/01/01 01:10:00' -sB -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:193" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_128 #AT_START_129 at_fn_group_banner 129 'mixed.at:196' \ "Invalid -d, -s and -w combo" " " 13 at_xfail=no ( $as_echo "129. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:202: blame -d'2001/01/01 01:02:30' -sB -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -d'2001/01/01 01:02:30' -sB -wuser3 $testdir/complex,v" "mixed.at:202" ( $at_check_trace; blame -d'2001/01/01 01:02:30' -sB -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:202" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:204: blame -d'2001/01/01 01:10:00' -sC -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -d'2001/01/01 01:10:00' -sC -wuser3 $testdir/complex,v" "mixed.at:204" ( $at_check_trace; blame -d'2001/01/01 01:10:00' -sC -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:204" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:206: blame -d'2001/01/01 01:10:00' -sB -wuser2 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -d'2001/01/01 01:10:00' -sB -wuser2 $testdir/complex,v" "mixed.at:206" ( $at_check_trace; blame -d'2001/01/01 01:10:00' -sB -wuser2 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:206" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_129 #AT_START_130 at_fn_group_banner 130 'mixed.at:210' \ "Valid -r, -d, -s and -w combo" " " 13 at_xfail=no ( $as_echo "130. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-1.4.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/mixed.at:218: blame -r1.4 -d'2001/01/01 01:10:00' -sB -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.4 -d'2001/01/01 01:10:00' -sB -wuser3 $testdir/complex,v" "mixed.at:218" ( $at_check_trace; blame -r1.4 -d'2001/01/01 01:10:00' -sB -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/mixed.at:218" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_130 #AT_START_131 at_fn_group_banner 131 'mixed.at:221' \ "Invalid -r, -d, -s and -w combo" " " 13 at_xfail=no ( $as_echo "131. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/mixed.at:228: blame -r1.3 -d'2001/01/01 01:10:00' -sB -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.3 -d'2001/01/01 01:10:00' -sB -wuser3 $testdir/complex,v" "mixed.at:228" ( $at_check_trace; blame -r1.3 -d'2001/01/01 01:10:00' -sB -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:228" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:230: blame -r1.4 -d'2001/01/01 01:02:30' -sB -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.4 -d'2001/01/01 01:02:30' -sB -wuser3 $testdir/complex,v" "mixed.at:230" ( $at_check_trace; blame -r1.4 -d'2001/01/01 01:02:30' -sB -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:230" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:232: blame -r1.4 -d'2001/01/01 01:10:00' -sC -wuser3 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.4 -d'2001/01/01 01:10:00' -sC -wuser3 $testdir/complex,v" "mixed.at:232" ( $at_check_trace; blame -r1.4 -d'2001/01/01 01:10:00' -sC -wuser3 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:232" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi { set +x $as_echo "$at_srcdir/mixed.at:234: blame -r1.4 -d'2001/01/01 01:10:00' -sB -wuser2 \$testdir/complex,v" at_fn_check_prepare_dynamic "blame -r1.4 -d'2001/01/01 01:10:00' -sB -wuser2 $testdir/complex,v" "mixed.at:234" ( $at_check_trace; blame -r1.4 -d'2001/01/01 01:10:00' -sB -wuser2 $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/mixed.at:234" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_131 #AT_START_132 at_fn_group_banner 132 'log.at:3' \ "Old log expansion format" " " 14 at_xfail=no ( $as_echo "132. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/log-v3-1.1.expout expout cp $testdir/log.experr experr { set +x $as_echo "$at_srcdir/log.at:8: blame -r1.1 -V3 \$testdir/log,v" at_fn_check_prepare_dynamic "blame -r1.1 -V3 $testdir/log,v" "log.at:8" ( $at_check_trace; blame -r1.1 -V3 $testdir/log,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/log.at:8" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_132 #AT_START_133 at_fn_group_banner 133 'log.at:11' \ "New log expansion format" " " 14 at_xfail=no ( $as_echo "133. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/log-v5-1.1.expout expout cp $testdir/log.experr experr { set +x $as_echo "$at_srcdir/log.at:15: blame -r1.1 \$testdir/log,v" at_fn_check_prepare_dynamic "blame -r1.1 $testdir/log,v" "log.at:15" ( $at_check_trace; blame -r1.1 $testdir/log,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/log.at:15" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_133 #AT_START_134 at_fn_group_banner 134 'log.at:18' \ "Logs for multiple revisions" " " 14 at_xfail=no ( $as_echo "134. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/log-1.2.expout expout cp $testdir/log.experr experr { set +x $as_echo "$at_srcdir/log.at:22: blame -r1.2 \$testdir/log,v" at_fn_check_prepare_dynamic "blame -r1.2 $testdir/log,v" "log.at:22" ( $at_check_trace; blame -r1.2 $testdir/log,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/log.at:22" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_134 #AT_START_135 at_fn_group_banner 135 'rcsinit.at:3' \ "Empty RCSINIT" " " 15 at_xfail=no ( $as_echo "135. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-3.4.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/rcsinit.at:9: RCSINIT= blame -r3.4 -sA \$testdir/complex,v" at_fn_check_prepare_dynamic "RCSINIT= blame -r3.4 -sA $testdir/complex,v" "rcsinit.at:9" ( $at_check_trace; RCSINIT= blame -r3.4 -sA $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rcsinit.at:9" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_135 #AT_START_136 at_fn_group_banner 136 'rcsinit.at:12' \ "RCSINIT with options" " " 15 at_xfail=no ( $as_echo "136. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-3.4.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/rcsinit.at:18: RCSINIT='-r3.4 -sA' blame \$testdir/complex,v" at_fn_check_prepare_dynamic "RCSINIT='-r3.4 -sA' blame $testdir/complex,v" "rcsinit.at:18" ( $at_check_trace; RCSINIT='-r3.4 -sA' blame $testdir/complex,v ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rcsinit.at:18" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_136 #AT_START_137 at_fn_group_banner 137 'rcsinit.at:21' \ "RCSINIT with invalid options" " " 15 at_xfail=no ( $as_echo "137. $at_setup_line: testing $at_desc ..." $at_traceon { set +x $as_echo "$at_srcdir/rcsinit.at:24: RCSINIT='--foo' blame" at_fn_check_prepare_trace "rcsinit.at:24" ( $at_check_trace; RCSINIT='--foo' blame ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/rcsinit.at:24" $at_failed && at_fn_log_failure $at_traceon; } if grep -q '^==[0-9][0-9]*==' $at_stderr; then echo 42 > $at_status_file exit 42 fi if $at_diff $at_devnull $at_stderr; then echo 1 > $at_status_file exit 1 fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_137 #AT_START_138 at_fn_group_banner 138 'rcsinit.at:28' \ "RCSINIT with a filename" " " 15 at_xfail=no ( $as_echo "138. $at_setup_line: testing $at_desc ..." $at_traceon cp $testdir/complex-3.8.expout expout cp $testdir/complex.experr experr { set +x $as_echo "$at_srcdir/rcsinit.at:32: RCSINIT=\"\$testdir/complex,v\" blame" at_fn_check_prepare_dynamic "RCSINIT=\"$testdir/complex,v\" blame" "rcsinit.at:32" ( $at_check_trace; RCSINIT="$testdir/complex,v" blame ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/rcsinit.at:32" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_138 blame-1.4-20240206/tests/Makefile.in0000644000000000000000000000302414560305704015243 0ustar rootroot# Copyright 2022, Thomas E. Dickey # makefile-template for autoconf @SET_MAKE@ SHELL = @SHELL@ VPATH = @srcdir@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = .. EXEEXT = @EXEEXT@ prefix = @prefix@ TESTSUITE = $(srcdir)/testsuite TESTSUITE_AT = \ testsuite.at \ argv.at \ rev.at \ date.at \ state.at \ author.at \ expand.at \ suffixes.at \ mixed.at \ branch.at \ rcs.at \ working.at \ pairing.at \ rcsinit.at \ version.at \ log.at AUTOM4TE = $(SHELL) $(top_srcdir)/missing --run autom4te AUTOTEST = $(AUTOM4TE) --language=autotest all: .SUFFIXES: install: uninstall: clean: if [ -x $(TESTSUITE) ]; then $(SHELL) $(TESTSUITE) --clean; fi distclean: clean -rm -f atconfig atlocal -rm -f Makefile $(srcdir)/package.m4: $(top_srcdir)/configure.ac @{ \ echo '# Signature of the current package.'; \ echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ echo 'm4_define([AT_PACKAGE_DATE], [@PACKAGE_DATE@])'; \ echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ } >$(srcdir)/package.m4 $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp mv $@.tmp $@ check: atconfig atlocal $(top_builddir)/src/blame$(EXEEXT) $(SHELL) -c "unset RCS_DIR; PATH=$(top_builddir)/src:$$PATH $(TESTSUITE)" .PHONY: all check clean distclean install uninstall blame-1.4-20240206/tests/version.at0000644000000000000000000000736710144373546015232 0ustar rootrootAT_BANNER([[-V and --version options.]]) AT_SETUP([Invalid version argument]) AT_KEYWORDS([version]) AT_KEYWORDS([errors]) AT_CHECK([[blame -V1 $testdir/keywords,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame --version=foo $testdir/keywords,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Emulating RCS version 3]) AT_KEYWORDS([version]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: keywords,v 1.1 2001/01/01 01:01:01 username Locked \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Locked \$ 1.1 (username 01-Jan-01): \$Locker: username \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): # Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): # Initial revision 1.1 (username 01-Jan-01): #$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr AT_CHECK([[blame -V3 $testdir/keywords,v]], 0, expout, experr) AT_CHECK([[blame --version=3 $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Emulating RCS version 4]) AT_KEYWORDS([version]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp Locker: username \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp Locker: username \$ 1.1 (username 01-Jan-01): \$Locker: username \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): # Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): # Initial revision 1.1 (username 01-Jan-01): #$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr AT_CHECK([[blame -V4 $testdir/keywords,v]], 0, expout, experr) AT_CHECK([[blame --version=4 $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Emulating RCS version 5]) AT_KEYWORDS([version]) AT_KEYWORDS([log]) cat < expout 1.1 (username 01-Jan-01): \$Author: username \$ 1.1 (username 01-Jan-01): \$Date: 2001/01/01 01:01:01 \$ 1.1 (username 01-Jan-01): \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ 1.1 (username 01-Jan-01): \$Locker: \$ 1.1 (username 01-Jan-01): \$Log: keywords,v \$ 1.1 (username 01-Jan-01): Revision 1.1 2001/01/01 01:01:01 username 1.1 (username 01-Jan-01): Initial revision 1.1 (username 01-Jan-01):$space 1.1 (username 01-Jan-01): \$Name: \$ 1.1 (username 01-Jan-01): \$RCSfile: keywords,v \$ 1.1 (username 01-Jan-01): \$Revision: 1.1 \$ 1.1 (username 01-Jan-01): \$Source: $testdir/keywords,v \$ 1.1 (username 01-Jan-01): \$State: Exp \$ EOF cp $testdir/keywords.experr experr AT_CHECK([[blame -V5 $testdir/keywords,v]], 0, expout, experr) AT_CHECK([[blame --version=5 $testdir/keywords,v]], 0, expout, experr) AT_CLEANUP blame-1.4-20240206/tests/rev.at0000644000000000000000000001016110135160766014321 0ustar rootrootAT_BANNER([[-r and --revision options.]]) AT_SETUP([No revision]) AT_KEYWORDS([rev]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -r -- $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame --revision -- $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Multiple revisions]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) AT_CHECK([[blame -r1.1 -r1.2 $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Single dot]) AT_KEYWORDS([rev]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -r. $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame --revision=. $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Valid trunk branch]) AT_KEYWORDS([rev]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -r1 $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid trunk branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) AT_CHECK([[blame -r4 $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Valid trunk branch and dot]) AT_KEYWORDS([rev]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -r1. $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid trunk branch and dot]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) AT_CHECK([[blame -r4. $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Dot and revision]) AT_KEYWORDS([rev]) cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -r.1 $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Dot and late revision]) AT_KEYWORDS([rev]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -r.10 $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Dot and early revision]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) AT_CHECK([[blame -r.0 $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Symbolic trunk branch]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -rfoo $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic trunk branch and dot]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -rfoo. $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic trunk branch and revision]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -rfoo.1 $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic trunk branch and late revision]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -rfoo.10 $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic trunk branch and early revision]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) AT_KEYWORDS([symbol]) AT_CHECK([[blame -rfoo.0 $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Symbolic revision]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/simple-1.2.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -rbar $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Dot and symbolic revision]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -r.foo $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Symbolic trunk branch and symbolic revision]) AT_KEYWORDS([rev]) AT_KEYWORDS([symbol]) cp $testdir/simple-1.1.expout expout cp $testdir/simple.experr experr AT_CHECK([[blame -rfoo.foo $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Invalid symbol]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) AT_KEYWORDS([symbol]) AT_CHECK([[blame -rbaz $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r.baz $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -rbaz. $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CHECK([[blame -r1.baz $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP blame-1.4-20240206/tests/rcsinit.at0000644000000000000000000000165010144372724015202 0ustar rootrootAT_BANNER([[RCSINIT environment variable support.]]) AT_SETUP([Empty RCSINIT]) AT_KEYWORDS([rcsinit]) AT_KEYWORDS([rev]) AT_KEYWORDS([state]) cp $testdir/complex-3.4.expout expout cp $testdir/complex.experr experr AT_CHECK([[RCSINIT= blame -r3.4 -sA $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([RCSINIT with options]) AT_KEYWORDS([rcsinit]) AT_KEYWORDS([rev]) AT_KEYWORDS([state]) cp $testdir/complex-3.4.expout expout cp $testdir/complex.experr experr AT_CHECK([[RCSINIT='-r3.4 -sA' blame $testdir/complex,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([RCSINIT with invalid options]) AT_KEYWORDS([rcsinit]) AT_KEYWORDS([errors]) AT_CHECK([[RCSINIT='--foo' blame]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([RCSINIT with a filename]) AT_KEYWORDS([rcsinit]) cp $testdir/complex-3.8.expout expout cp $testdir/complex.experr experr AT_CHECK([[RCSINIT="$testdir/complex,v" blame]], 0, expout, experr) AT_CLEANUP blame-1.4-20240206/tests/author.at0000644000000000000000000000246410530062137015026 0ustar rootrootAT_BANNER([[-w and --author options.]]) AT_SETUP([No author]) AT_KEYWORDS([author]) AT_XFAIL_IF([test -z "$username"]) AT_XFAIL_IF([test "$username" = username]) AT_XFAIL_IF([test "$username" = somebody]) replace="`echo $username | sed 's/$/ /;s/^\(.\{8\}\).*/\1/'`" AT_CHECK([[blame -w -- $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR cat $testdir/simple,v | sed "s/somebody/$username/g" > input,v cat $testdir/simple-1.2.expout | sed "s/somebody/$replace/g" > expout cat $testdir/simple.experr | sed "s/simple/input/g" > experr AT_CHECK([[blame -w -- input,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Known author]) AT_KEYWORDS([author]) cp $testdir/simple.experr experr cp $testdir/simple-1.2.expout expout AT_CHECK([[blame -wsomebody $testdir/simple,v]], 0, expout, experr) rm -f expout cp $testdir/simple-1.1.expout expout AT_CHECK([[blame -wusername $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame --author=username $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Unknown author]) AT_KEYWORDS([author]) AT_KEYWORDS([errors]) AT_CHECK([[blame -wfloopy $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Multiple authors]) AT_KEYWORDS([author]) AT_KEYWORDS([errors]) AT_CHECK([[blame -wusername -wsomebody $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP blame-1.4-20240206/tests/log.at0000644000000000000000000000121310260447073014302 0ustar rootrootAT_BANNER([[Expanding Log keywords.]]) AT_SETUP([Old log expansion format]) AT_KEYWORDS([log]) AT_KEYWORDS([version]) cp $testdir/log-v3-1.1.expout expout cp $testdir/log.experr experr AT_CHECK([[blame -r1.1 -V3 $testdir/log,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([New log expansion format]) AT_KEYWORDS([log]) cp $testdir/log-v5-1.1.expout expout cp $testdir/log.experr experr AT_CHECK([[blame -r1.1 $testdir/log,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Logs for multiple revisions]) AT_KEYWORDS([log]) cp $testdir/log-1.2.expout expout cp $testdir/log.experr experr AT_CHECK([[blame -r1.2 $testdir/log,v]], 0, expout, experr) AT_CLEANUP blame-1.4-20240206/tests/suffixes.at0000644000000000000000000000140210125542443015352 0ustar rootrootAT_BANNER([[-x and --suffixes options.]]) AT_SETUP([Default suffixes]) AT_KEYWORDS([suffixes]) cp $testdir/simple-1.2.expout expout AT_CHECK([[blame $testdir/file1]], 0, expout, ignore) AT_CLEANUP AT_SETUP([Nonstandard suffixes]) AT_KEYWORDS([suffixes]) cp $testdir/simple-1.2.expout expout AT_CHECK([[blame -x$slash-foo$slash-bar $testdir/file2]], 0, expout, ignore) AT_CHECK([[blame --suffixes=$slash-foo$slash-bar $testdir/file3]], 0, expout, ignore) AT_CHECK([[blame --suffixes $slash-foo$slash-bar $testdir/file3]], 0, expout, ignore) AT_CLEANUP AT_SETUP([Multiple suffixes specifications]) AT_KEYWORDS([suffixes]) AT_KEYWORDS([errors]) AT_CHECK([[blame -x$slash-foo$slash-bar -x$slash-bar$slash-foo $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP blame-1.4-20240206/tests/working.at0000644000000000000000000000675610530053344015214 0ustar rootrootAT_BANNER([[Handling RCS tags in working files.]]) AT_SETUP([Valid revision]) AT_KEYWORDS([working]) AT_KEYWORDS([rev]) cp $testdir/keywords.experr experr cat < keywords \$Revision: 1.1 \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 0, ignore, experr) cat < keywords \$Id: keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 0, ignore, experr) cat < keywords \$Header: $testdir/keywords,v 1.1 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 0, ignore, experr) AT_CLEANUP AT_SETUP([Early revision]) AT_KEYWORDS([working]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) cat < keywords \$Revision: 1.0 \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 1, , ignore) MAC_CHECK_STDERR cat < keywords \$Id: keywords,v 1.0 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 1, , ignore) MAC_CHECK_STDERR cat < keywords \$Header: $testdir/keywords,v 1.0 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 1, , ignore) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Late revision]) AT_KEYWORDS([working]) AT_KEYWORDS([rev]) cp $testdir/keywords.experr experr cat < keywords \$Revision: 1.2 \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 0, ignore, experr) cat < keywords \$Id: keywords,v 1.2 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 0, ignore, experr) cat < keywords \$Header: $testdir/keywords,v 1.2 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 0, ignore, experr) AT_CLEANUP AT_SETUP([Branch]) AT_KEYWORDS([working]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) cat < keywords \$Revision: 1 \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 1, , ignore) MAC_CHECK_STDERR cat < keywords \$Id: keywords,v 1 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 1, , ignore) MAC_CHECK_STDERR cat < keywords \$Header: $testdir/keywords,v 1 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 1, , ignore) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Other non-revision]) AT_KEYWORDS([working]) AT_KEYWORDS([rev]) AT_KEYWORDS([errors]) cat < keywords \$Revision: bar \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 1, , ignore) MAC_CHECK_STDERR cat < keywords \$Id: keywords,v bar 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 1, , ignore) MAC_CHECK_STDERR cat < keywords \$Header: $testdir/keywords,v bar 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 1, , ignore) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Parsing escape sequences]) AT_KEYWORDS([working]) AT_KEYWORDS([rev]) cp $testdir/keywords.experr experr cat < keywords \$Id: file\twith\nweird\\symbols\040in\044it,v 1.1 2001/01/01 01:01:01 username Exp \$ EOF AT_CHECK([[blame -r'$' $testdir/keywords,v]], 0, ignore, experr) AT_CLEANUP AT_SETUP([Producing escape sequences]) AT_KEYWORDS([working]) cp $testdir/escape,v 'x$ x,v' cat < 'x$ x' \$Id: x\044\040x,v 1.1 2001/01/01 01:01:01 username Exp \$ EOF cat $testdir/escape.experr | sed 's,escape,x$ x,g' > experr AT_CHECK([[blame -r1.1 'x$ x']], 0, ignore, experr) AT_CLEANUP AT_SETUP([Mixing escape characters]) AT_KEYWORDS([working]) cp $testdir/escape-1.2.expout expout cp $testdir/escape.experr experr AT_CHECK([[blame -r1.2 $testdir/escape,v]], 0, expout, experr) AT_CLEANUP blame-1.4-20240206/tests/state.at0000644000000000000000000000170510125542443014644 0ustar rootrootAT_BANNER([[-s and --state options.]]) AT_SETUP([Missing state argument]) AT_KEYWORDS([state]) AT_KEYWORDS([errors]) AT_CHECK([[blame $testdir/simple,v -s]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Known state]) AT_KEYWORDS([state]) cp $testdir/simple.experr experr cp $testdir/simple-1.1.expout expout AT_CHECK([[blame -sExp $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame --state=Exp $testdir/simple,v]], 0, expout, experr) rm -f expout cp $testdir/simple-1.2.expout expout AT_CHECK([[blame -sStab $testdir/simple,v]], 0, expout, experr) AT_CHECK([[blame --state Stab $testdir/simple,v]], 0, expout, experr) AT_CLEANUP AT_SETUP([Unknown state]) AT_KEYWORDS([state]) AT_KEYWORDS([errors]) AT_CHECK([[blame -sFloopy $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP AT_SETUP([Multiple states]) AT_KEYWORDS([state]) AT_KEYWORDS([errors]) AT_CHECK([[blame -sStab -sExp $testdir/simple,v]], 1, , stderr) MAC_CHECK_STDERR AT_CLEANUP blame-1.4-20240206/aclocal.m40000644000000000000000000015211314560016721013676 0ustar rootrootdnl $Id: aclocal.m4,v 1.15 2024/02/04 23:29:21 tom Exp $ dnl --------------------------------------------------------------------------- dnl dnl Copyright 2022-2023,2024 by Thomas E. Dickey dnl dnl All Rights Reserved dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the dnl "Software"), to deal in the Software without restriction, including dnl without limitation the rights to use, copy, modify, merge, publish, dnl distribute, sublicense, and/or sell copies of the Software, and to dnl permit persons to whom the Software is furnished to do so, subject to dnl the following conditions: dnl dnl The above copyright notice and this permission notice shall be included dnl in all copies or substantial portions of the Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. dnl IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY dnl CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, dnl TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE dnl SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. dnl dnl Except as contained in this notice, the name(s) of the above copyright dnl holders shall not be used in advertising or otherwise to promote the dnl sale, use or other dealings in this Software without prior written dnl authorization. dnl dnl --------------------------------------------------------------------------- dnl rcs-blame's local definitions for autoconf. dnl dnl See dnl https://invisible-island.net/autoconf/autoconf.html dnl https://invisible-island.net/autoconf/my-autoconf.html dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl AC_GNU_SOURCE version: 1 updated: 2022/11/13 14:26:50 dnl ------------- AC_DEFUN([AC_GNU_SOURCE], [ CF_XOPEN_SOURCE dnl AC_MSG_WARN([use CF_XOPEN_SOURCE]) dnl CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE" ] ) dnl --------------------------------------------------------------------------- dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 dnl ------------------ dnl Conditionally generate script according to whether we're using a given autoconf. dnl dnl $1 = version to compare against dnl $2 = code to use if AC_ACVERSION is at least as high as $1. dnl $3 = code to use if AC_ACVERSION is older than $1. define([CF_ACVERSION_CHECK], [ ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl ifdef([m4_version_compare], [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], [CF_ACVERSION_COMPARE( AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl dnl --------------------------------------------------------------------------- dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 dnl ------------------ dnl Conditionally generate script according to whether we're using a given autoconf. dnl dnl $1 = version to compare against dnl $2 = code to use if AC_ACVERSION is at least as high as $1. dnl $3 = code to use if AC_ACVERSION is older than $1. define([CF_ACVERSION_CHECK], [ ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl ifdef([m4_version_compare], [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], [CF_ACVERSION_COMPARE( AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl dnl --------------------------------------------------------------------------- dnl CF_ADD_CFLAGS version: 15 updated: 2020/12/31 10:54:15 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS dnl $1 = flags to add dnl $2 = if given makes this macro verbose. dnl dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily dnl confused by the quotes (which require backslashes to keep them usable). AC_DEFUN([CF_ADD_CFLAGS], [ cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $1 do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) continue elif test "${cf_tst_cflags}" = "\"'" ; then CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) ;; esac CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) ;; esac ;; (*) CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) ;; esac ;; (yes) CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[[^"]]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) fi if test -n "$cf_new_cppflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags) fi if test -n "$cf_new_extra_cppflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) fi AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54 dnl --------------- dnl For programs that must use an ANSI compiler, obtain compiler options that dnl will make it recognize prototypes. We'll do preprocessor checks in other dnl macros, since tools such as unproto can fake prototypes, but only part of dnl the preprocessor. AC_DEFUN([CF_ANSI_CC_REQD], [AC_REQUIRE([CF_ANSI_CC_CHECK]) if test "$cf_cv_ansi_cc" = "no"; then AC_MSG_ERROR( [Your compiler does not appear to recognize prototypes. You have the following choices: a. adjust your compiler options b. get an up-to-date compiler c. use a wrapper such as unproto]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_APPEND_CFLAGS version: 3 updated: 2021/09/05 17:25:40 dnl ---------------- dnl Use CF_ADD_CFLAGS after first checking for potential redefinitions. dnl $1 = flags to add dnl $2 = if given makes this macro verbose. define([CF_APPEND_CFLAGS], [ for cf_add_cflags in $1 do case "x$cf_add_cflags" in (x-[[DU]]*) CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2]) CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2]) ;; esac CF_ADD_CFLAGS([$cf_add_cflags],[$2]) done ])dnl dnl --------------------------------------------------------------------------- dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 dnl -------------- dnl use this macro for appending text without introducing an extra blank at dnl the beginning define([CF_APPEND_TEXT], [ test -n "[$]$1" && $1="[$]$1 " $1="[$]{$1}$2" ])dnl dnl --------------------------------------------------------------------------- dnl CF_AR_FLAGS version: 9 updated: 2021/01/01 13:31:04 dnl ----------- dnl Check for suitable "ar" (archiver) options for updating an archive. dnl dnl In particular, handle some obsolete cases where the "-" might be omitted, dnl as well as a workaround for breakage of make's archive rules by the GNU dnl binutils "ar" program. AC_DEFUN([CF_AR_FLAGS],[ AC_REQUIRE([CF_PROG_AR]) AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[ case "$cf_cv_system_name" in (*-msvc*) cf_cv_ar_flags='' cat >mk_static_lib.sh <<-EOF #!$SHELL MSVC_BIN="[$]AR" out="\[$]1" shift exec \[$]MSVC_BIN -out:"\[$]out" \[$]@ EOF chmod +x mk_static_lib.sh AR=`pwd`/mk_static_lib.sh ;; (*) cf_cv_ar_flags=unknown for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv do # check if $ARFLAGS already contains this choice if test "x$ARFLAGS" != "x" ; then cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then cf_cv_ar_flags= break fi fi rm -f "conftest.$ac_cv_objext" rm -f conftest.a cat >"conftest.$ac_ext" <&AC_FD_CC $AR $ARFLAGS "$cf_ar_flags" conftest.a "conftest.$ac_cv_objext" 2>&AC_FD_CC 1>/dev/null if test -f conftest.a ; then cf_cv_ar_flags="$cf_ar_flags" break fi else CF_VERBOSE(cannot compile test-program) break fi done rm -f conftest.a "conftest.$ac_ext" "conftest.$ac_cv_objext" ;; esac ]) if test -n "$ARFLAGS" ; then if test -n "$cf_cv_ar_flags" ; then ARFLAGS="$ARFLAGS $cf_cv_ar_flags" fi else ARFLAGS=$cf_cv_ar_flags fi AC_SUBST(ARFLAGS) ]) dnl --------------------------------------------------------------------------- dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 dnl -------------- dnl Allow user to disable a normally-on option. AC_DEFUN([CF_ARG_DISABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 dnl ------------- dnl Allow user to enable a normally-off option. AC_DEFUN([CF_ARG_ENABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 dnl ------------- dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus dnl values. dnl dnl Parameters: dnl $1 = option name dnl $2 = help-string dnl $3 = action to perform if option is not default dnl $4 = action if perform if option is default dnl $5 = default option value (either 'yes' or 'no') AC_DEFUN([CF_ARG_OPTION], [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) if test "$enableval" != "$5" ; then ifelse([$3],,[ :]dnl ,[ $3]) ifelse([$4],,,[ else $4]) fi],[enableval=$5 ifelse([$4],,,[ $4 ])dnl ])])dnl dnl --------------------------------------------------------------------------- dnl CF_C11_NORETURN version: 4 updated: 2023/02/18 17:41:25 dnl --------------- AC_DEFUN([CF_C11_NORETURN], [ AC_MSG_CHECKING(if you want to use C11 _Noreturn feature) CF_ARG_ENABLE(stdnoreturn, [ --enable-stdnoreturn enable C11 _Noreturn feature for diagnostics], [enable_stdnoreturn=yes], [enable_stdnoreturn=no]) AC_MSG_RESULT($enable_stdnoreturn) if test $enable_stdnoreturn = yes; then AC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn, [AC_TRY_COMPILE([ $ac_includes_default #include static _Noreturn void giveup(void) { exit(0); } ], [if (feof(stdin)) giveup()], cf_cv_c11_noreturn=yes, cf_cv_c11_noreturn=no) ]) else cf_cv_c11_noreturn=no, fi if test "$cf_cv_c11_noreturn" = yes; then AC_DEFINE(HAVE_STDNORETURN_H, 1,[Define if header is available and working]) AC_DEFINE_UNQUOTED(STDC_NORETURN,_Noreturn,[Define if C11 _Noreturn keyword is supported]) HAVE_STDNORETURN_H=1 else HAVE_STDNORETURN_H=0 fi AC_SUBST(HAVE_STDNORETURN_H) AC_SUBST(STDC_NORETURN) ])dnl dnl --------------------------------------------------------------------------- dnl CF_CC_ENV_FLAGS version: 11 updated: 2023/02/20 11:15:46 dnl --------------- dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content dnl into CC. This will not help with broken scripts that wrap the compiler dnl with options, but eliminates a more common category of user confusion. dnl dnl In particular, it addresses the problem of being able to run the C dnl preprocessor in a consistent manner. dnl dnl Caveat: this also disallows blanks in the pathname for the compiler, but dnl the nuisance of having inconsistent settings for compiler and preprocessor dnl outweighs that limitation. AC_DEFUN([CF_CC_ENV_FLAGS], [ # This should have been defined by AC_PROG_CC : "${CC:=cc}" AC_MSG_CHECKING(\$CFLAGS variable) case "x$CFLAGS" in (*-[[IUD]]*) AC_MSG_RESULT(broken) AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) cf_flags="$CFLAGS" CFLAGS= for cf_arg in $cf_flags do CF_ADD_CFLAGS($cf_arg) done ;; (*) AC_MSG_RESULT(ok) ;; esac AC_MSG_CHECKING(\$CC variable) case "$CC" in (*[[\ \ ]]-*) AC_MSG_RESULT(broken) AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) # humor him... cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` cf_flags=`echo "$CC" | sed -e "s%^$cf_prog%%"` CC="$cf_prog" for cf_arg in $cf_flags do case "x$cf_arg" in (x-[[IUDfgOW]]*) CF_ADD_CFLAGS($cf_arg) ;; (*) CC="$CC $cf_arg" ;; esac done CF_VERBOSE(resulting CC: '$CC') CF_VERBOSE(resulting CFLAGS: '$CFLAGS') CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') ;; (*) AC_MSG_RESULT(ok) ;; esac ])dnl dnl CF_CHECK_SIZEOF version: 4 updated: 2021/01/02 09:31:20 dnl --------------- dnl Improve on AC_CHECK_SIZEOF for cases when the build-environment is dnl deficient, e.g., if someone tries to build in busybox. Use the second dnl parameter as the fallback value. dnl dnl By the way, 2.13/2.52 differ in AC_CHECK_SIZEOF regarding the types they dnl can detect; the former includes only stdio.h for types while the latter dnl includes several header files. AC_DEFUN([CF_CHECK_SIZEOF],[ AC_CHECK_SIZEOF([$1],[$2]) if test "${ac_cv_type_$1+set}" = set; then cf_cv_sizeof="$ac_cv_sizeof_$1" if test "${ac_cv_sizeof_$1+set}" != set; then AC_MSG_WARN(using $2 for sizeof $1) ac_cv_sizeof_$1=$2 elif test "x${ac_cv_sizeof_$1}" = x0; then AC_MSG_WARN([sizeof $1 not found, using $2]) ac_cv_sizeof_$1=$2 fi if test "x$ac_cv_sizeof_$1" != "x$cf_cv_sizeof" then CF_UPPER(cf_cv_type,sizeof_$1) sed -e "s/\\([[ ]]${cf_cv_type}[[ ]]\\).*/\\1$ac_cv_sizeof_$1/" confdefs.h >conftest.val mv conftest.val confdefs.h fi fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_CLANG_COMPILER version: 9 updated: 2023/02/18 17:41:25 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does dnl not ignore some gcc options. dnl dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from dnl the wrappers for gcc and g++ warnings. dnl dnl $1 = GCC (default) or GXX dnl $2 = CLANG_COMPILER (default) dnl $3 = CFLAGS (default) or CXXFLAGS AC_DEFUN([CF_CLANG_COMPILER],[ ifelse([$2],,CLANG_COMPILER,[$2])=no if test "$ifelse([$1],,[$1],GCC)" = yes ; then AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" AC_TRY_COMPILE([],[ #ifdef __clang__ #else #error __clang__ is not defined #endif ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) fi CLANG_VERSION=none if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then case "$CC" in (c[[1-9]][[0-9]]|*/c[[1-9]][[0-9]]) AC_MSG_WARN(replacing broken compiler alias $CC) CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" CC=clang ;; esac AC_MSG_CHECKING(version of $CC) CLANG_VERSION="`$CC --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(CLANG[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$CLANG_VERSION" && CLANG_VERSION=unknown AC_MSG_RESULT($CLANG_VERSION) for cf_clang_opt in \ -Qunused-arguments \ -Wno-error=implicit-function-declaration do AC_MSG_CHECKING(if option $cf_clang_opt works) cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cf_clang_opt" AC_TRY_LINK([ #include ],[ printf("hello!\\n");],[ cf_clang_optok=yes],[ cf_clang_optok=no]) AC_MSG_RESULT($cf_clang_optok) CFLAGS="$cf_save_CFLAGS" if test "$cf_clang_optok" = yes; then CF_VERBOSE(adding option $cf_clang_opt) CF_APPEND_TEXT(CFLAGS,$cf_clang_opt) fi done fi ]) dnl --------------------------------------------------------------------------- dnl CF_CONST_X_STRING version: 8 updated: 2023/12/01 17:22:50 dnl ----------------- dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most dnl character-strings. dnl dnl It is ambiguous because the specification accommodated the pre-ANSI dnl compilers bundled by more than one vendor in lieu of providing a standard C dnl compiler other than by costly add-ons. Because of this, the specification dnl did not take into account the use of const for telling the compiler that dnl string literals would be in readonly memory. dnl dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to dnl let the compiler decide how to represent Xt's strings which were #define'd. dnl That does not solve the problem of using the block of Xt's strings which dnl are compiled into the library (and is less efficient than one might want). dnl dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both dnl when compiling the library and compiling using the library, to tell the dnl compiler that String is const. AC_DEFUN([CF_CONST_X_STRING], [ AC_REQUIRE([AC_PATH_XTRA]) CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING]) AC_TRY_COMPILE( [ #include #include ], [String foo = malloc(1); free((void*)foo)],[ AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ AC_TRY_COMPILE( [ #undef _CONST_X_STRING #define _CONST_X_STRING /* X11R7.8 (perhaps) */ #undef XTSTRINGDEFINES /* X11R5 and later */ #include #include ],[String foo = malloc(1); *foo = 0],[ cf_cv_const_x_string=no ],[ cf_cv_const_x_string=yes ]) ]) CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING]) case "$cf_cv_const_x_string" in (no) CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES) ;; (*) CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING) ;; esac ]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_CYGPATH_W version: 1 updated: 2022/11/13 14:26:50 dnl ------------ dnl test whether we have cygpath AC_DEFUN([CF_CYGPATH_W],[ 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) ]) dnl --------------------------------------------------------------------------- dnl CF_DISABLE_ECHO version: 14 updated: 2021/09/04 06:35:04 dnl --------------- dnl You can always use "make -n" to see the actual options, but it is hard to dnl pick out/analyze warning messages when the compile-line is long. dnl dnl Sets: dnl ECHO_LT - symbol to control if libtool is verbose dnl ECHO_LD - symbol to prefix "cc -o" lines dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) dnl SHOW_CC - symbol to put before explicit "cc -c" lines dnl ECHO_CC - symbol to put before any "cc" line dnl AC_DEFUN([CF_DISABLE_ECHO],[ AC_MSG_CHECKING(if you want to see long compiling messages) CF_ARG_DISABLE(echo, [ --disable-echo do not display "compiling" commands], [ ECHO_LT='--silent' ECHO_LD='@echo linking [$]@;' RULE_CC='@echo compiling [$]<' SHOW_CC='@echo compiling [$]@' ECHO_CC='@' ],[ ECHO_LT='' ECHO_LD='' RULE_CC='' SHOW_CC='' ECHO_CC='' ]) AC_MSG_RESULT($enableval) AC_SUBST(ECHO_LT) AC_SUBST(ECHO_LD) AC_SUBST(RULE_CC) AC_SUBST(SHOW_CC) AC_SUBST(ECHO_CC) ])dnl dnl --------------------------------------------------------------------------- dnl CF_ENABLE_WARNINGS version: 9 updated: 2021/01/05 19:40:50 dnl ------------------ dnl Configure-option to enable gcc warnings dnl dnl $1 = extra options to add, if supported dnl $2 = option for checking attributes. By default, this is done when dnl warnings are enabled. For other values: dnl yes: always do this, e.g., to use in generated library-headers dnl no: never do this AC_DEFUN([CF_ENABLE_WARNINGS],[ if test "$GCC" = yes || test "$GXX" = yes then CF_FIX_WARNINGS(CFLAGS) CF_FIX_WARNINGS(CPPFLAGS) CF_FIX_WARNINGS(LDFLAGS) AC_MSG_CHECKING(if you want to turn on gcc warnings) CF_ARG_ENABLE(warnings, [ --enable-warnings test: turn on gcc compiler warnings], [enable_warnings=yes], [enable_warnings=no]) AC_MSG_RESULT($enable_warnings) if test "$enable_warnings" = "yes" then ifelse($2,,[CF_GCC_ATTRIBUTES]) CF_GCC_WARNINGS($1) fi ifelse($2,yes,[CF_GCC_ATTRIBUTES]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_FIX_WARNINGS version: 4 updated: 2021/12/16 18:22:31 dnl --------------- dnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's dnl "-Werror" flags can interfere with configure-checks. Those go into dnl EXTRA_CFLAGS. dnl dnl $1 = variable name to repair define([CF_FIX_WARNINGS],[ if test "$GCC" = yes || test "$GXX" = yes then case [$]$1 in (*-Werror=*) cf_temp_flags= for cf_temp_scan in [$]$1 do case "x$cf_temp_scan" in (x-Werror=format*) CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) ;; (x-Werror=*) CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan) ;; (*) CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) ;; esac done if test "x[$]$1" != "x$cf_temp_flags" then CF_VERBOSE(repairing $1: [$]$1) $1="$cf_temp_flags" CF_VERBOSE(... fixed [$]$1) CF_VERBOSE(... extra $EXTRA_CFLAGS) fi ;; esac fi AC_SUBST(EXTRA_CFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_ATTRIBUTES version: 24 updated: 2021/03/20 12:00:25 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary dnl to documentation, unrecognized directives cause older compilers to barf. AC_DEFUN([CF_GCC_ATTRIBUTES], [AC_REQUIRE([AC_PROG_FGREP])dnl AC_REQUIRE([CF_C11_NORETURN])dnl if test "$GCC" = yes || test "$GXX" = yes then cat > conftest.i < "conftest.$ac_ext" < #include "confdefs.h" #include "conftest.h" #include "conftest.i" #if GCC_PRINTF #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) #else #define GCC_PRINTFLIKE(fmt,var) /*nothing*/ #endif #if GCC_SCANF #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) #else #define GCC_SCANFLIKE(fmt,var) /*nothing*/ #endif extern void wow(char *,...) GCC_SCANFLIKE(1,2); extern GCC_NORETURN void oops(char *,...) GCC_PRINTFLIKE(1,2); extern GCC_NORETURN void foo(void); int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { (void)argc; (void)argv; return 0; } EOF cf_printf_attribute=no cf_scanf_attribute=no for cf_attribute in scanf printf unused noreturn do CF_UPPER(cf_ATTRIBUTE,$cf_attribute) cf_directive="__attribute__(($cf_attribute))" echo "checking for $CC $cf_directive" 1>&AC_FD_CC case "$cf_attribute" in (printf) cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <>confdefs.h case "$cf_attribute" in (noreturn) AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) ;; (printf) cf_value='/* nothing */' if test "$cf_printf_attribute" != no ; then cf_value='__attribute__((format(printf,fmt,var)))' AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) fi AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) ;; (scanf) cf_value='/* nothing */' if test "$cf_scanf_attribute" != no ; then cf_value='__attribute__((format(scanf,fmt,var)))' AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) fi AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) ;; (unused) AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) ;; esac fi done else ${FGREP-fgrep} define conftest.i >>confdefs.h fi rm -rf ./conftest* fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_VERSION version: 9 updated: 2023/03/05 14:30:13 dnl -------------- dnl Find version of gcc, and (because icc/clang pretend to be gcc without being dnl compatible), attempt to determine if icc/clang is actually used. AC_DEFUN([CF_GCC_VERSION],[ AC_REQUIRE([AC_PROG_CC]) GCC_VERSION=none if test "$GCC" = yes ; then AC_MSG_CHECKING(version of $CC) GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^[[^(]]*([[^)]][[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown AC_MSG_RESULT($GCC_VERSION) fi CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59 dnl --------------- dnl Check if the compiler supports useful warning options. There's a few that dnl we don't use, simply because they're too noisy: dnl dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) dnl -Winline (usually not worthwhile) dnl -Wredundant-decls (system headers make this too noisy) dnl -Wtraditional (combines too many unrelated messages, only a few useful) dnl -Wwrite-strings (too noisy, but should review occasionally). This dnl is enabled for ncurses using "--enable-const". dnl -pedantic dnl dnl Parameter: dnl $1 is an optional list of gcc warning flags that a particular dnl application might want to use, e.g., "no-unused" for dnl -Wno-unused dnl Special: dnl If $with_ext_const is "yes", add a check for -Wwrite-strings dnl AC_DEFUN([CF_GCC_WARNINGS], [ AC_REQUIRE([CF_GCC_VERSION]) if test "x$have_x" = xyes; then CF_CONST_X_STRING fi cat > "conftest.$ac_ext" <],[ #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 return 0; #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 return 0; #else # error not GNU C library #endif], [cf_cv_gnu_library=yes], [cf_cv_gnu_library=no]) ]) if test x$cf_cv_gnu_library = xyes; then # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE # was changed to help a little. newlib incorporated the change about 4 # years later. AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ cf_save="$CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) AC_TRY_COMPILE([#include ],[ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) return 0; #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) return 0; #else # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old #endif], [cf_cv_gnu_library_219=yes], [cf_cv_gnu_library_219=no]) CPPFLAGS="$cf_save" ]) if test "x$cf_cv_gnu_library_219" = xyes; then cf_save="$CPPFLAGS" AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) AC_TRY_COMPILE([ #include #include ],[ #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) return 0; #else # error GNU C library is too old #endif], [cf_cv_gnu_dftsrc_219=yes], [cf_cv_gnu_dftsrc_219=no]) ]) test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" else cf_cv_gnu_dftsrc_219=maybe fi if test "x$cf_cv_gnu_dftsrc_219" != xyes; then AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ AC_TRY_COMPILE([#include ],[ #ifndef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be defined #endif], [cf_cv_gnu_source=no], [cf_save="$CPPFLAGS" CF_ADD_CFLAGS(-D_GNU_SOURCE) AC_TRY_COMPILE([#include ],[ #ifdef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be undefined #endif], [cf_cv_gnu_source=no], [cf_cv_gnu_source=yes]) CPPFLAGS="$cf_save" ]) ]) if test "$cf_cv_gnu_source" = yes then AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) AC_TRY_COMPILE([#include ],[ #ifdef _DEFAULT_SOURCE #error expected _DEFAULT_SOURCE to be undefined #endif], [cf_cv_default_source=no], [cf_cv_default_source=yes]) ]) if test "$cf_cv_default_source" = yes then CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) fi fi fi fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_INTEL_COMPILER version: 9 updated: 2023/02/18 17:41:25 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It dnl tries to imitate gcc, but does not return an error when it finds a mismatch dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. dnl dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from dnl the wrappers for gcc and g++ warnings. dnl dnl $1 = GCC (default) or GXX dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS dnl $3 = CFLAGS (default) or CXXFLAGS AC_DEFUN([CF_INTEL_COMPILER],[ AC_REQUIRE([AC_CANONICAL_HOST]) ifelse([$2],,INTEL_COMPILER,[$2])=no if test "$ifelse([$1],,[$1],GCC)" = yes ; then case "$host_os" in (linux*|gnu*) AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" AC_TRY_COMPILE([],[ #ifdef __INTEL_COMPILER #else #error __INTEL_COMPILER is not defined #endif ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) ;; esac fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_LARGEFILE version: 13 updated: 2023/12/03 19:09:59 dnl ------------ dnl Add checks for large file support. AC_DEFUN([CF_LARGEFILE],[ ifdef([AC_FUNC_FSEEKO],[ AC_SYS_LARGEFILE if test "$enable_largefile" != no ; then AC_FUNC_FSEEKO # Normally we would collect these definitions in the config.h, # but (like _XOPEN_SOURCE), some environments rely on having these # defined before any of the system headers are included. Another # case comes up with C++, e.g., on AIX the compiler compiles the # header files by themselves before looking at the body files it is # told to compile. For ncurses, those header files do not include # the config.h if test "$ac_cv_sys_large_files" != no then CF_APPEND_TEXT(CPPFLAGS,-D_LARGE_FILES) fi if test "$ac_cv_sys_largefile_source" != no then CF_APPEND_TEXT(CPPFLAGS,-D_LARGEFILE_SOURCE) fi if test "$ac_cv_sys_file_offset_bits" != no then CF_APPEND_TEXT(CPPFLAGS,-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits) fi AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[ AC_TRY_COMPILE([ #pragma GCC diagnostic error "-Wincompatible-pointer-types" #include #include #ifndef __REDIRECT /* if transitional largefile support is setup, this is true */ extern struct dirent64 * readdir(DIR *); #endif ],[ DIR *dp = opendir("."); struct dirent64 *x = readdir(dp); struct dirent *y = readdir(dp); int z = x - y; (void)z; ], [cf_cv_struct_dirent64=yes], [cf_cv_struct_dirent64=no]) ]) test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64]) fi ]) ]) dnl --------------------------------------------------------------------------- dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 dnl ---------- dnl Write a debug message to config.log, along with the line number in the dnl configure script. AC_DEFUN([CF_MSG_LOG],[ echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC ])dnl dnl --------------------------------------------------------------------------- dnl CF_POSIX_C_SOURCE version: 12 updated: 2023/02/18 17:41:25 dnl ----------------- dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. dnl dnl POSIX.1-1990 _POSIX_SOURCE dnl POSIX.1-1990 and _POSIX_SOURCE and dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 dnl Bindings Option dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L dnl X/Open 2000 _POSIX_C_SOURCE=200112L dnl dnl Parameters: dnl $1 is the nominal value for _POSIX_C_SOURCE AC_DEFUN([CF_POSIX_C_SOURCE], [AC_REQUIRE([CF_POSIX_VISIBLE])dnl if test "$cf_cv_posix_visible" = no; then cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ CF_MSG_LOG(if the symbol is already defined go no further) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined #endif], [cf_cv_posix_c_source=no], [cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in (.[[12]]??*) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; (.2) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" cf_want_posix_source=yes ;; (.*) cf_want_posix_source=yes ;; esac if test "$cf_want_posix_source" = yes ; then AC_TRY_COMPILE([#include ],[ #ifdef _POSIX_SOURCE #error _POSIX_SOURCE is defined #endif],[], cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") fi CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) CF_MSG_LOG(if the second compile does not leave our definition intact error) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined #endif],, [cf_cv_posix_c_source=no]) CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" ]) ]) if test "$cf_cv_posix_c_source" != no ; then CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" CF_ADD_CFLAGS($cf_cv_posix_c_source) fi fi # cf_cv_posix_visible ])dnl dnl --------------------------------------------------------------------------- dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 dnl ---------------- dnl POSIX documents test-macros which an application may set before any system dnl headers are included to make features available. dnl dnl Some BSD platforms (originally FreeBSD, but copied by a few others) dnl diverged from POSIX in 2002 by setting symbols which make all of the most dnl recent features visible in the system header files unless the application dnl overrides the corresponding test-macros. Doing that introduces portability dnl problems. dnl dnl This macro makes a special check for the symbols used for this, to avoid a dnl conflicting definition. AC_DEFUN([CF_POSIX_VISIBLE], [ AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ AC_TRY_COMPILE([#include ],[ #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) #error conflicting symbols found #endif ],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) ]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22 dnl ---------- dnl Check for archiver "ar". AC_DEFUN([CF_PROG_AR],[ AC_CHECK_TOOL(AR, ar, ar) ]) dnl --------------------------------------------------------------------------- dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54 dnl ---------- dnl standard check for CC, plus followup sanity checks dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name AC_DEFUN([CF_PROG_CC],[ CF_ACVERSION_CHECK(2.53, [AC_MSG_WARN(this will incorrectly handle gnatgcc choice) AC_REQUIRE([AC_PROG_CC])], []) ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) CF_GCC_VERSION CF_ACVERSION_CHECK(2.52, [AC_PROG_CC_STDC], [CF_ANSI_CC_REQD]) CF_CC_ENV_FLAGS ])dnl dnl --------------------------------------------------------------------------- dnl CF_REMOVE_CFLAGS version: 3 updated: 2021/09/05 17:25:40 dnl ---------------- dnl Remove a given option from CFLAGS/CPPFLAGS dnl $1 = option to remove dnl $2 = variable to update dnl $3 = nonempty to allow verbose message define([CF_REMOVE_CFLAGS], [ cf_tmp_cflag=`echo "x$1" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x[$]$2" | sed -e 's/^.//' -e 's/[[ ]][[ ]]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[[^ ]][[^ ]]*\\)\?%%" -e 's/^[[ ]]*//' -e 's%[[ ]][[ ]]*-D% -D%g' -e 's%[[ ]][[ ]]*-I% -I%g'` test "[$]$2" != "$cf_old_cflag" || break ifelse([$3],,,[CF_VERBOSE(removing old option $1 from $2)]) $2="$cf_old_cflag" done ])dnl dnl --------------------------------------------------------------------------- dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 dnl ---------------- dnl Remove all -U and -D options that refer to the given symbol from a list dnl of C compiler options. This works around the problem that not all dnl compilers process -U and -D options from left-to-right, so a -U option dnl cannot be used to cancel the effect of a preceding -D option. dnl dnl $1 = target (which could be the same as the source variable) dnl $2 = source (including '$') dnl $3 = symbol to remove define([CF_REMOVE_DEFINE], [ $1=`echo "$2" | \ sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` ])dnl dnl --------------------------------------------------------------------------- dnl CF_RESTORE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:47:45 dnl --------------------- dnl Restore flags saved in CF_SAVE_XTRA_FLAGS dnl $1 = name of current macro define([CF_RESTORE_XTRA_FLAGS], [ LIBS="$cf_save_LIBS_$1" CFLAGS="$cf_save_CFLAGS_$1" CPPFLAGS="$cf_save_CPPFLAGS_$1" ])dnl dnl --------------------------------------------------------------------------- dnl CF_SAVE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:46:44 dnl ------------------ dnl Use this macro to save CFLAGS/CPPFLAGS/LIBS before checks against X headers dnl and libraries which do not update those variables. dnl dnl $1 = name of current macro define([CF_SAVE_XTRA_FLAGS], [ cf_save_LIBS_$1="$LIBS" cf_save_CFLAGS_$1="$CFLAGS" cf_save_CPPFLAGS_$1="$CPPFLAGS" LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" for cf_X_CFLAGS in $X_CFLAGS do case "x$cf_X_CFLAGS" in x-[[IUD]]*) CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" ;; *) CFLAGS="$CFLAGS $cf_X_CFLAGS" ;; esac done ])dnl dnl --------------------------------------------------------------------------- dnl For "recent" (as of 2024) GNU libc, defining _TIME_BITS is a way to select dnl a 64-bit time_t. Report the size of time_t to show systems which might be dnl converted. AC_DEFUN([CF_SIZEOF_TIME_T],[ dnl AC_REQUIRE([CF_LARGEFILE]) dnl CF_VERBOSE(defining _TIME_BITS to 64) dnl CF_APPEND_TEXT(CPPFLAGS,-D_TIME_BITS=64) cf_save_includes="$ac_includes_default" ac_includes_default="$ac_includes_default #include " CF_CHECK_SIZEOF(time_t,4) ac_includes_default="$cf_save_includes" ])dnl dnl --------------------------------------------------------------------------- dnl CF_TRY_XOPEN_SOURCE version: 4 updated: 2022/09/10 15:16:16 dnl ------------------- dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we dnl can define it successfully. AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, [cf_cv_xopen_source=no], [cf_save="$CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, [cf_cv_xopen_source=no], [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) CPPFLAGS="$cf_save" ]) ]) if test "$cf_cv_xopen_source" != no ; then CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" CF_APPEND_CFLAGS($cf_temp_xopen_source) fi ]) dnl --------------------------------------------------------------------------- dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 dnl -------- dnl Make an uppercase version of a variable dnl $1=uppercase($2) AC_DEFUN([CF_UPPER], [ $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` ])dnl dnl --------------------------------------------------------------------------- dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 dnl ---------- dnl Use AC_VERBOSE w/o the warnings AC_DEFUN([CF_VERBOSE], [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG CF_MSG_LOG([$1]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITHOUT_X version: 3 updated: 2021/01/13 16:51:52 dnl ------------ dnl Use this to cancel the check for X headers/libraries which would be pulled dnl in via CF_GCC_WARNINGS. define([CF_WITHOUT_X], AC_DEFUN([AC_PATH_XTRA],[]) AC_DEFUN([CF_SAVE_XTRA_FLAGS],[]) AC_DEFUN([CF_RESTORE_XTRA_FLAGS],[]) AC_DEFUN([CF_CONST_X_STRING],[echo "skipping X-const check";])dnl AC_SUBST(X_CFLAGS) AC_SUBST(X_LIBS) [])dnl dnl --------------------------------------------------------------------------- dnl CF_XOPEN_SOURCE version: 67 updated: 2023/09/06 18:55:27 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, dnl without losing the common non-POSIX features. dnl dnl Parameters: dnl $1 is the nominal value for _XOPEN_SOURCE dnl $2 is the nominal value for _POSIX_C_SOURCE dnl dnl The default case prefers _XOPEN_SOURCE over _POSIX_C_SOURCE if the dnl implementation predefines it, because X/Open and most implementations agree dnl that the latter is a legacy or "aligned" value. dnl dnl Because _XOPEN_SOURCE is preferred, if defining _POSIX_C_SOURCE turns dnl that off, then refrain from setting _POSIX_C_SOURCE explicitly. dnl dnl References: dnl https://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html dnl https://docs.oracle.com/cd/E19253-01/816-5175/standards-5/index.html dnl https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html AC_DEFUN([CF_XOPEN_SOURCE],[ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([CF_POSIX_VISIBLE]) if test "$cf_cv_posix_visible" = no; then cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) cf_xopen_source= case "$host_os" in (aix[[4-7]]*) cf_xopen_source="-D_ALL_SOURCE" ;; (darwin[[0-8]].*) cf_xopen_source="-D_APPLE_C_SOURCE" ;; (darwin*) cf_xopen_source="-D_DARWIN_C_SOURCE" cf_XOPEN_SOURCE= ;; (freebsd*|dragonfly*|midnightbsd*) # 5.x headers associate # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L cf_POSIX_C_SOURCE=200112L cf_XOPEN_SOURCE=600 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" ;; (hpux11*) cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" ;; (hpux*) cf_xopen_source="-D_HPUX_SOURCE" ;; (irix[[56]].*) cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; (linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc) CF_GNU_SOURCE($cf_XOPEN_SOURCE) ;; (minix*) cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... ;; (mirbsd*) # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types cf_XOPEN_SOURCE= CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) ;; (netbsd*) cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw ;; (openbsd[[6-9]]*) # OpenBSD 6.x has broken locale support, both compile-time and runtime. # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html # Abusing the conformance level is a workaround. AC_MSG_WARN(this system does not provide usable locale support) cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=700 ;; (openbsd[[4-5]]*) # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=600 ;; (openbsd*) # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; (osf[[45]]*) cf_xopen_source="-D_OSF_SOURCE" ;; (nto-qnx*) cf_xopen_source="-D_QNX_SOURCE" ;; (sco*) # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; (solaris2.*) cf_xopen_source="-D__EXTENSIONS__" cf_cv_xopen_source=broken ;; (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) cf_XOPEN_SOURCE= cf_POSIX_C_SOURCE= ;; (*) CF_TRY_XOPEN_SOURCE cf_save_xopen_cppflags="$CPPFLAGS" CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) # Some of these niche implementations use copy/paste, double-check... if test "$cf_cv_xopen_source" = no ; then CF_VERBOSE(checking if _POSIX_C_SOURCE interferes with _XOPEN_SOURCE) AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,,[ AC_MSG_WARN(_POSIX_C_SOURCE definition is not usable) CPPFLAGS="$cf_save_xopen_cppflags"]) fi ;; esac if test -n "$cf_xopen_source" ; then CF_APPEND_CFLAGS($cf_xopen_source,true) fi dnl In anything but the default case, we may have system-specific setting dnl which is still not guaranteed to provide all of the entrypoints that dnl _XOPEN_SOURCE would yield. if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) AC_TRY_COMPILE([#include ],[ #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif], [cf_XOPEN_SOURCE_set=yes], [cf_XOPEN_SOURCE_set=no]) AC_MSG_RESULT($cf_XOPEN_SOURCE_set) if test "$cf_XOPEN_SOURCE_set" = yes then AC_TRY_COMPILE([#include ],[ #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE #error (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE #endif], [cf_XOPEN_SOURCE_set_ok=yes], [cf_XOPEN_SOURCE_set_ok=no]) if test "$cf_XOPEN_SOURCE_set_ok" = no then AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) fi else CF_TRY_XOPEN_SOURCE fi fi fi # cf_cv_posix_visible ]) dnl --------------------------------------------------------------------------- dnl CF__XOPEN_SOURCE_BODY version: 2 updated: 2023/02/18 17:41:25 dnl --------------------- dnl body of test when test-compiling for _XOPEN_SOURCE check define([CF__XOPEN_SOURCE_BODY], [ #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ]) dnl --------------------------------------------------------------------------- dnl CF__XOPEN_SOURCE_HEAD version: 2 updated: 2023/02/18 17:41:25 dnl --------------------- dnl headers to include when test-compiling for _XOPEN_SOURCE check define([CF__XOPEN_SOURCE_HEAD], [ $ac_includes_default ]) dnl --------------------------------------------------------------------------- m4_include([m4/alloca.m4]) m4_include([m4/allocsa.m4]) m4_include([m4/argp.m4]) m4_include([m4/calloc.m4]) m4_include([m4/canonicalize.m4]) m4_include([m4/cycle-check.m4]) m4_include([m4/d-ino.m4]) m4_include([m4/dirname.m4]) m4_include([m4/dos.m4]) m4_include([m4/double-slash-root.m4]) m4_include([m4/eealloc.m4]) m4_include([m4/eoverflow.m4]) m4_include([m4/error.m4]) m4_include([m4/exitfail.m4]) m4_include([m4/extensions.m4]) m4_include([m4/filenamecat.m4]) m4_include([m4/free.m4]) m4_include([m4/getcwd-abort-bug.m4]) m4_include([m4/getcwd-path-max.m4]) m4_include([m4/getcwd.m4]) m4_include([m4/getdelim.m4]) m4_include([m4/getline.m4]) m4_include([m4/getopt.m4]) m4_include([m4/gettimeofday.m4]) m4_include([m4/gnulib-comp.m4]) m4_include([m4/inline.m4]) m4_include([m4/intmax_t.m4]) m4_include([m4/inttypes_h.m4]) m4_include([m4/langinfo.m4]) m4_include([m4/longdouble.m4]) m4_include([m4/longlong.m4]) m4_include([m4/lstat.m4]) m4_include([m4/mbchar.m4]) m4_include([m4/mbiter.m4]) m4_include([m4/mbrtowc.m4]) m4_include([m4/mbstate_t.m4]) m4_include([m4/memchr.m4]) m4_include([m4/memcmp.m4]) m4_include([m4/memcpy.m4]) m4_include([m4/memmove.m4]) m4_include([m4/mempcpy.m4]) m4_include([m4/memset.m4]) m4_include([m4/minmax.m4]) m4_include([m4/mktime.m4]) m4_include([m4/pathmax.m4]) m4_include([m4/readlink.m4]) m4_include([m4/setenv.m4]) m4_include([m4/size_max.m4]) m4_include([m4/ssize_t.m4]) m4_include([m4/stdbool.m4]) m4_include([m4/strcase.m4]) m4_include([m4/strchrnul.m4]) m4_include([m4/strdup.m4]) m4_include([m4/strftime.m4]) m4_include([m4/strndup.m4]) m4_include([m4/strnlen.m4]) m4_include([m4/strpbrk.m4]) m4_include([m4/strstr.m4]) m4_include([m4/strtol.m4]) m4_include([m4/strtoul.m4]) m4_include([m4/sysexits.m4]) m4_include([m4/time_r.m4]) m4_include([m4/tm_gmtoff.m4]) m4_include([m4/tzset.m4]) m4_include([m4/ulonglong.m4]) m4_include([m4/unlocked-io.m4]) m4_include([m4/vsnprintf.m4]) m4_include([m4/wchar_t.m4]) m4_include([m4/wcwidth.m4]) m4_include([m4/wint_t.m4]) m4_include([m4/xalloc.m4]) m4_include([m4/xgetcwd.m4]) m4_include([m4/xreadlink.m4]) m4_include([m4/xsize.m4]) m4_include([m4/xstrndup.m4]) blame-1.4-20240206/configure0000755000000000000000000126325614560124240013755 0ustar rootroot#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20231210 for blame 1.4. # # Report bugs to . # # Copyright 2003-2022,2023 Thomas E. Dickey # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # 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 # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr="expr" else as_expr="false" fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln' else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset="unset" else as_unset="false" fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : "${ac_max_here_lines=38}" ac_unique_file="src/blame.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${datarootdir}/info' mandir='${datarootdir}/man' # Identity of this package. PACKAGE_NAME='blame' PACKAGE_TARNAME='blame' PACKAGE_VERSION='1.4' PACKAGE_STRING='blame 1.4' PACKAGE_BUGREPORT='dickey@invisible-island.net' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -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_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo "$ac_feature" | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo "$ac_feature" | sed 's/-/_/g'` case "$ac_option" in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst \ | --runs | --run | --ru) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* \ | --runs=* | --run=* | --ru=*) runstatedir=$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) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo "$ac_package" | sed 's/-/_/g'` case "$ac_option" in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo "$ac_package" | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export "$ac_envvar" ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option}" "${host_alias=$ac_option}" "${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo "$ac_prev" | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo "$ac_var"` case "$ac_val" in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo "$ac_var"` case "$ac_val" in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. build=$build_alias host=$host_alias target=$target_alias # FIXME: should be removed in autoconf 3.0. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat < if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . EOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue cd "$ac_subdir" # A "../" for each directory in /$ac_subdir. ac_dots=`echo "$ac_subdir" | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` case "$srcdir" in .) # No --srcdir option. We are building in place. ac_sub_srcdir="$srcdir" ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_sub_srcdir="$srcdir/$ac_subdir" ;; *) # Relative path. ac_sub_srcdir="$ac_dots$srcdir/$ac_subdir" ;; esac # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_sub_srcdir/configure.gnu"; then echo $SHELL "$ac_sub_srcdir/configure.gnu" --help=recursive elif test -f "$ac_sub_srcdir/configure"; then echo $SHELL "$ac_sub_srcdir/configure" --help=recursive elif test -f "$ac_sub_srcdir/configure.ac" || test -f "$ac_sub_srcdir/configure.in"; then echo "$ac_configure" --help else echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if "$ac_init_version"; then cat <<\EOF blame configure 1.4 generated by GNU Autoconf 2.52.20231210 Copyright 2003-2022,2023 Thomas E. Dickey Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. EOF exit 0 fi exec 5>config.log cat >&5 </dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` PATH = $PATH _ASUNAME } >&5 cat >&5 <\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" ac_sep=" " ;; *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" ac_sep=" " ;; esac # Get rid of the leading space. done # 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. trap 'exit_status=$? # Save into config.log some information that might help in debugging. echo >&5 echo "## ----------------- ##" >&5 echo "## Cache variables. ##" >&5 echo "## ----------------- ##" >&5 echo >&5 # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } >&5 sed "/^$/d" confdefs.h >conftest.log if test -s conftest.log; then echo >&5 echo "## ------------ ##" >&5 echo "## confdefs.h. ##" >&5 echo "## ------------ ##" >&5 echo >&5 cat conftest.log >&5 fi (echo; echo) >&5 test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" >&5 echo "$as_me: exit $exit_status" >&5 rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' "$ac_signal" done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:900: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:911: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:919: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case "$ac_old_set,$ac_new_set" in set,) { echo "$as_me:935: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:939: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:945: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:947: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:949: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. It doesn't matter if # we pass some twice (in addition to the command line arguments). if test "$ac_new_set" = set; then case "$ac_new_val" in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" ;; esac fi done if "$ac_cache_corrupted"; then { echo "$as_me:968: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:970: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS "conftest.$ac_ext" >&5' ac_link='$CC -o "conftest$ac_exeext" $CFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return="return" case `echo "testing\c" 2>/dev/null; echo 1,2,3`,`echo -n testing 2>/dev/null; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C= # newlines do not sed ;-) only broken shells would use this case anyway ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh if { (echo "$as_me:999: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? echo "$as_me:1002: \$? = $ac_status" >&5 (exit "$ac_status"); }; then ac_path_separator=';' else ac_path_separator=: fi PATH_SEPARATOR="$ac_path_separator" rm -f conftest.sh ac_config_headers="$ac_config_headers config.h" CHECK_VERSION=`sed -e 's/[ ].*//' $srcdir/VERSION` test "$CHECK_VERSION" = "$PACKAGE_VERSION" || { { echo "$as_me:1014: error: inconsistent VERSION" >&5 echo "$as_me: error: inconsistent VERSION" >&2;} { (exit 1); exit 1; }; } PACKAGE_DATE=`sed -e 's/^[^ ]*[ ]*//' $srcdir/VERSION` echo "configuring $PACKAGE_NAME ($PACKAGE_VERSION $PACKAGE_DATE)" for ac_prog in ggrep grep do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:1026: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GREP"; then ac_cv_prog_GREP="$GREP" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_GREP="$ac_prog" echo "$as_me:1041: found $ac_dir/$ac_word" >&5 break done fi fi GREP=$ac_cv_prog_GREP if test -n "$GREP"; then echo "$as_me:1049: result: $GREP" >&5 echo "${ECHO_T}$GREP" >&6 else echo "$as_me:1052: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$GREP" && break done test -n "$GREP" || GREP=": " echo "$as_me:1060: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else for ac_prog in gegrep egrep do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:1072: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_EGREP="$EGREP" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_EGREP="$ac_dir/$ac_word" echo "$as_me:1089: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi EGREP=$ac_cv_path_EGREP if test -n "$EGREP"; then echo "$as_me:1100: result: $EGREP" >&5 echo "${ECHO_T}$EGREP" >&6 else echo "$as_me:1103: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$EGREP" && break done test -n "$EGREP" || EGREP=": " test "x$ac_cv_path_EGREP" = "x:" && { { echo "$as_me:1111: error: cannot find workable egrep" >&5 echo "$as_me: error: cannot find workable egrep" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:1116: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6 EGREP="$ac_cv_path_EGREP" 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_main_return="return" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:1129: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:1144: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1152: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1155: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:1164: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:1179: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1187: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1190: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:1203: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:1218: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1226: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1229: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1238: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" echo "$as_me:1253: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1261: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1264: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1277: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:1297: found $ac_dir/$ac_word" >&5 break done if test "$ac_prog_rejected" = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1319: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1322: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:1333: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:1348: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1356: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1359: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:1372: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:1387: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1395: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1398: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:1410: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:1415:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo "$2"` { (eval echo "$as_me:1418: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:1421: \$? = $ac_status" >&5 (exit "$ac_status"); } { (eval echo "$as_me:1423: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:1426: \$? = $ac_status" >&5 (exit "$ac_status"); } { (eval echo "$as_me:1428: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:1431: \$? = $ac_status" >&5 (exit "$ac_status"); } cat >"conftest.$ac_ext" <<_ACEOF #line 1435 "configure" #include "confdefs.h" int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:1451: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *"conftest[^"]*"//'` if { (eval echo "$as_me:1454: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:1457: \$? = $ac_status" >&5 (exit "$ac_status"); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. for ac_file in `ls a.exe conftest.exe 2>/dev/null; ls a.out conftest 2>/dev/null; ls a.* conftest.* 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; a.out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 { { echo "$as_me:1480: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:1486: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1491: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:1497: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1500: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:1507: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:1515: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe "conftest$ac_cv_exeext" ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1522: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:1524: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:1527: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 if { (eval echo "$as_me:1529: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1532: \$? = $ac_status" >&5 (exit "$ac_status"); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:1548: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f "conftest$ac_cv_exeext" echo "$as_me:1554: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f "conftest.$ac_ext" EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:1560: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 1566 "configure" #include "confdefs.h" int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:1578: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1581: \$? = $ac_status" >&5 (exit "$ac_status"); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 { { echo "$as_me:1593: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f "conftest.$ac_cv_objext" "conftest.$ac_ext" fi echo "$as_me:1600: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:1604: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 1610 "configure" #include "confdefs.h" int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1625: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1628: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1631: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1634: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_compiler_gnu=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:1646: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:1652: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 1658 "configure" #include "confdefs.h" int main (void) { ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1670: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1673: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1676: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1679: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_prog_cc_g=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:1689: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >"conftest.$ac_ext" <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1716: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1719: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1722: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1725: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >"conftest.$ac_ext" <<_ACEOF #line 1737 "configure" #include "confdefs.h" #include $ac_declaration int main (void) { exit (42); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1750: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1753: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1756: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1759: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 continue fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" cat >"conftest.$ac_ext" <<_ACEOF #line 1769 "configure" #include "confdefs.h" $ac_declaration int main (void) { exit (42); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1781: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1784: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1787: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1790: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then break else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" done rm -rf conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo "$ac_declaration" >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS "conftest.$ac_ext" >&5' ac_link='$CC -o "conftest$ac_exeext" $CFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return="return" 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_main_return="return" echo "$as_me:1824: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >"conftest.$ac_ext" <<_ACEOF #line 1845 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:1850: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1856: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 # Broken: fails on valid input. continue fi rm -f conftest.err "conftest.$ac_ext" # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >"conftest.$ac_ext" <<_ACEOF #line 1879 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:1883: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1889: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err "conftest.$ac_ext" done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err "conftest.$ac_ext" if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:1926: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >"conftest.$ac_ext" <<_ACEOF #line 1936 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:1941: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1947: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 # Broken: fails on valid input. continue fi rm -f conftest.err "conftest.$ac_ext" # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >"conftest.$ac_ext" <<_ACEOF #line 1970 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:1974: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1980: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err "conftest.$ac_ext" done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err "conftest.$ac_ext" if $ac_preproc_ok; then : else { { echo "$as_me:2008: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&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_main_return="return" echo "$as_me:2020: checking for AIX" >&5 echo $ECHO_N "checking for AIX... $ECHO_C" >&6 cat >"conftest.$ac_ext" <<_ACEOF #line 2023 "configure" #include "confdefs.h" #ifdef _AIX yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then echo "$as_me:2032: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\EOF #define _ALL_SOURCE 1 EOF else echo "$as_me:2039: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -rf conftest* echo "$as_me:2044: checking for minix/config.h" >&5 echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6 if test "${ac_cv_header_minix_config_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 2050 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:2054: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2060: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_cv_header_minix_config_h=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_header_minix_config_h=no fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:2079: result: $ac_cv_header_minix_config_h" >&5 echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6 if test "$ac_cv_header_minix_config_h" = yes; then MINIX=yes else MINIX= fi if test "$MINIX" = yes; then cat >>confdefs.h <<\EOF #define _POSIX_SOURCE 1 EOF cat >>confdefs.h <<\EOF #define _POSIX_1_SOURCE 2 EOF cat >>confdefs.h <<\EOF #define _MINIX 1 EOF fi # Checks for programs. ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:2121: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:2131: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:2135: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:2144: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub "$ac_cv_build_alias"` || { { echo "$as_me:2148: error: $ac_config_sub $ac_cv_build_alias failed." >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:2153: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo "$ac_cv_build" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo "$ac_cv_build" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo "$ac_cv_build" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:2160: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub "$ac_cv_host_alias"` || { { echo "$as_me:2169: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:2174: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo "$ac_cv_host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$ac_cv_host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$ac_cv_host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` 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_main_return="return" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:2190: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:2205: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:2213: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:2216: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:2225: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:2240: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:2248: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:2251: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:2264: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:2279: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:2287: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:2290: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:2299: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" echo "$as_me:2314: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:2322: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:2325: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:2338: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:2358: found $ac_dir/$ac_word" >&5 break done if test "$ac_prog_rejected" = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:2380: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:2383: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:2394: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:2409: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:2417: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:2420: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:2433: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:2448: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:2456: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:2459: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:2471: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:2476:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo "$2"` { (eval echo "$as_me:2479: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:2482: \$? = $ac_status" >&5 (exit "$ac_status"); } { (eval echo "$as_me:2484: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:2487: \$? = $ac_status" >&5 (exit "$ac_status"); } { (eval echo "$as_me:2489: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:2492: \$? = $ac_status" >&5 (exit "$ac_status"); } echo "$as_me:2495: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 2501 "configure" #include "confdefs.h" int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:2516: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2519: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2522: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2525: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_compiler_gnu=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:2537: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:2543: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 2549 "configure" #include "confdefs.h" int main (void) { ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:2561: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2564: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2567: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2570: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_prog_cc_g=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:2580: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >"conftest.$ac_ext" <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:2607: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2610: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2613: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2616: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >"conftest.$ac_ext" <<_ACEOF #line 2628 "configure" #include "confdefs.h" #include $ac_declaration int main (void) { exit (42); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:2641: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2644: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2647: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2650: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 continue fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" cat >"conftest.$ac_ext" <<_ACEOF #line 2660 "configure" #include "confdefs.h" $ac_declaration int main (void) { exit (42); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:2672: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2675: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2678: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2681: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then break else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" done rm -rf conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo "$ac_declaration" >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS "conftest.$ac_ext" >&5' ac_link='$CC -o "conftest$ac_exeext" $CFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return="return" GCC_VERSION=none if test "$GCC" = yes ; then echo "$as_me:2711: checking version of $CC" >&5 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^[^(]*([^)][^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown echo "$as_me:2715: result: $GCC_VERSION" >&5 echo "${ECHO_T}$GCC_VERSION" >&6 fi INTEL_COMPILER=no if test "$GCC" = yes ; then case "$host_os" in (linux*|gnu*) echo "$as_me:2724: checking if this is really Intel C compiler" >&5 echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -no-gcc" cat >"conftest.$ac_ext" <<_ACEOF #line 2729 "configure" #include "confdefs.h" int main (void) { #ifdef __INTEL_COMPILER #else #error __INTEL_COMPILER is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:2746: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2749: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2752: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2755: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CFLAGS="$cf_save_CFLAGS" echo "$as_me:2766: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac fi CLANG_COMPILER=no if test "$GCC" = yes ; then echo "$as_me:2775: checking if this is really Clang C compiler" >&5 echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" cat >"conftest.$ac_ext" <<_ACEOF #line 2779 "configure" #include "confdefs.h" int main (void) { #ifdef __clang__ #else #error __clang__ is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:2796: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2799: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2802: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2805: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then CLANG_COMPILER=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CFLAGS="$cf_save_CFLAGS" echo "$as_me:2815: result: $CLANG_COMPILER" >&5 echo "${ECHO_T}$CLANG_COMPILER" >&6 fi CLANG_VERSION=none if test "x$CLANG_COMPILER" = "xyes" ; then case "$CC" in (c[1-9][0-9]|*/c[1-9][0-9]) { echo "$as_me:2824: WARNING: replacing broken compiler alias $CC" >&5 echo "$as_me: WARNING: replacing broken compiler alias $CC" >&2;} CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" CC=clang ;; esac echo "$as_me:2831: checking version of $CC" >&5 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 CLANG_VERSION="`$CC --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(CLANG[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$CLANG_VERSION" && CLANG_VERSION=unknown echo "$as_me:2835: result: $CLANG_VERSION" >&5 echo "${ECHO_T}$CLANG_VERSION" >&6 for cf_clang_opt in \ -Qunused-arguments \ -Wno-error=implicit-function-declaration do echo "$as_me:2842: checking if option $cf_clang_opt works" >&5 echo $ECHO_N "checking if option $cf_clang_opt works... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cf_clang_opt" cat >"conftest.$ac_ext" <<_ACEOF #line 2847 "configure" #include "confdefs.h" #include int main (void) { printf("hello!\\n"); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:2861: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2864: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:2867: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2870: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_clang_optok=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_clang_optok=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" echo "$as_me:2881: result: $cf_clang_optok" >&5 echo "${ECHO_T}$cf_clang_optok" >&6 CFLAGS="$cf_save_CFLAGS" if test "$cf_clang_optok" = yes; then test -n "$verbose" && echo " adding option $cf_clang_opt" 1>&6 echo "${as_me:-configure}:2887: testing adding option $cf_clang_opt ..." 1>&5 test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_clang_opt" fi done fi echo "$as_me:2896: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >"conftest.$ac_ext" <<_ACEOF #line 2904 "configure" #include "confdefs.h" #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (char **p, int i) { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main (void) { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f "conftest.$ac_objext" if { (eval echo "$as_me:2951: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2954: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2957: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2960: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" done rm -f "conftest.$ac_ext" "conftest.$ac_objext" CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:2977: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:2980: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # This should have been defined by AC_PROG_CC : "${CC:=cc}" echo "$as_me:2988: checking \$CFLAGS variable" >&5 echo $ECHO_N "checking \$CFLAGS variable... $ECHO_C" >&6 case "x$CFLAGS" in (*-[IUD]*) echo "$as_me:2992: result: broken" >&5 echo "${ECHO_T}broken" >&6 { echo "$as_me:2994: WARNING: your environment uses the CFLAGS variable to hold CPPFLAGS options" >&5 echo "$as_me: WARNING: your environment uses the CFLAGS variable to hold CPPFLAGS options" >&2;} cf_flags="$CFLAGS" CFLAGS= for cf_arg in $cf_flags do cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_arg do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done ;; (*) echo "$as_me:3102: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac echo "$as_me:3107: checking \$CC variable" >&5 echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 case "$CC" in (*[\ \ ]-*) echo "$as_me:3111: result: broken" >&5 echo "${ECHO_T}broken" >&6 { echo "$as_me:3113: WARNING: your environment uses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 echo "$as_me: WARNING: your environment uses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} # humor him... cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[ ]* / /g' -e 's/[ ]*[ ]-[^ ].*//'` cf_flags=`echo "$CC" | sed -e "s%^$cf_prog%%"` CC="$cf_prog" for cf_arg in $cf_flags do case "x$cf_arg" in (x-[IUDfgOW]*) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_arg do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi ;; (*) CC="$CC $cf_arg" ;; esac done test -n "$verbose" && echo " resulting CC: '$CC'" 1>&6 echo "${as_me:-configure}:3230: testing resulting CC: '$CC' ..." 1>&5 test -n "$verbose" && echo " resulting CFLAGS: '$CFLAGS'" 1>&6 echo "${as_me:-configure}:3234: testing resulting CFLAGS: '$CFLAGS' ..." 1>&5 test -n "$verbose" && echo " resulting CPPFLAGS: '$CPPFLAGS'" 1>&6 echo "${as_me:-configure}:3238: testing resulting CPPFLAGS: '$CPPFLAGS' ..." 1>&5 ;; (*) echo "$as_me:3242: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac for ac_prog in reflex flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:3251: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LEX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_LEX="$ac_prog" echo "$as_me:3266: found $ac_dir/$ac_word" >&5 break done fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then echo "$as_me:3274: result: $LEX" >&5 echo "${ECHO_T}$LEX" >&6 else echo "$as_me:3277: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test -z "$LEXLIB" then echo "$as_me:3287: checking for yywrap in -lfl" >&5 echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 if test "${ac_cv_lib_fl_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfl $LIBS" cat >"conftest.$ac_ext" <<_ACEOF #line 3295 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (void); int main (void) { yywrap (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:3314: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:3317: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:3320: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3323: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_lib_fl_yywrap=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_lib_fl_yywrap=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:3334: result: $ac_cv_lib_fl_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 if test "$ac_cv_lib_fl_yywrap" = yes; then LEXLIB="-lfl" else echo "$as_me:3339: checking for yywrap in -ll" >&5 echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 if test "${ac_cv_lib_l_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ll $LIBS" cat >"conftest.$ac_ext" <<_ACEOF #line 3347 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (void); int main (void) { yywrap (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:3366: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:3369: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:3372: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3375: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_lib_l_yywrap=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_lib_l_yywrap=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:3386: result: $ac_cv_lib_l_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 if test "$ac_cv_lib_l_yywrap" = yes; then LEXLIB="-ll" fi fi fi if test "x$LEX" != "x:"; then echo "$as_me:3397: checking lex output file root" >&5 echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 if test "${ac_cv_prog_lex_root+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # The minimal lex program is just a single line: %%. But some broken lexes # (Solaris, I think it was) want two %% lines, so accommodate them. echo '%% %%' | $LEX if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else { { echo "$as_me:3411: error: cannot find output from $LEX; giving up" >&5 echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:3416: result: $ac_cv_prog_lex_root" >&5 echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo "$as_me:3420: checking whether yytext is a pointer" >&5 echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS=$LIBS LIBS="$LIBS $LEXLIB" cat >"conftest.$ac_ext" <<_ACEOF `cat $LEX_OUTPUT_ROOT.c` _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:3436: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:3439: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:3442: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3445: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_prog_lex_yytext_pointer=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" LIBS=$ac_save_LIBS rm -f "${LEX_OUTPUT_ROOT}.c" fi echo "$as_me:3457: result: $ac_cv_prog_lex_yytext_pointer" >&5 echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 if test $ac_cv_prog_lex_yytext_pointer = yes; then cat >>confdefs.h <<\EOF #define YYTEXT_POINTER 1 EOF fi fi for ac_prog in byacc 'bison -y' do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:3472: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_YACC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_YACC="$ac_prog" echo "$as_me:3487: found $ac_dir/$ac_word" >&5 break done fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then echo "$as_me:3495: result: $YACC" >&5 echo "${ECHO_T}$YACC" >&6 else echo "$as_me:3498: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:3509: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:3524: found $ac_dir/$ac_word" >&5 break done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:3532: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:3535: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:3544: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:3559: found $ac_dir/$ac_word" >&5 break done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:3568: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:3571: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi # 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" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:3592: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_IFS=$IFS; IFS=$ac_path_separator for ac_dir in $PATH; do IFS=$ac_save_IFS # Account for people who put trailing slashes in PATH elements. case $ac_dir/ in / | ./ | .// | /cC/* \ | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ | /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 if $as_executable_p "$ac_dir/$ac_prog"; then if test $ac_prog = install && grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done 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. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:3641: result: $INSTALL" >&5 echo "${ECHO_T}$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' echo "$as_me:3652: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:3672: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:3676: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi for ac_prog in mawk gawk 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 echo "$as_me:3685: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_AWK="$ac_prog" echo "$as_me:3700: found $ac_dir/$ac_word" >&5 break done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:3708: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:3711: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo "$as_me:3721: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:3736: found $ac_dir/$ac_word" >&5 break done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:3744: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:3747: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:3756: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_AR="ar" echo "$as_me:3771: found $ac_dir/$ac_word" >&5 break done test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="ar" fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then echo "$as_me:3780: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6 else echo "$as_me:3783: result: no" >&5 echo "${ECHO_T}no" >&6 fi AR=$ac_ct_AR else AR="$ac_cv_prog_AR" fi echo "$as_me:3792: checking for options to update archives" >&5 echo $ECHO_N "checking for options to update archives... $ECHO_C" >&6 if test "${cf_cv_ar_flags+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$cf_cv_system_name" in (*-msvc*) cf_cv_ar_flags='' cat >mk_static_lib.sh <<-EOF #!$SHELL MSVC_BIN="$AR" out="\$1" shift exec \$MSVC_BIN -out:"\$out" \$@ EOF chmod +x mk_static_lib.sh AR=`pwd`/mk_static_lib.sh ;; (*) cf_cv_ar_flags=unknown for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv do # check if $ARFLAGS already contains this choice if test "x$ARFLAGS" != "x" ; then cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then cf_cv_ar_flags= break fi fi rm -f "conftest.$ac_cv_objext" rm -f conftest.a cat >"conftest.$ac_ext" <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3835: \$? = $ac_status" >&5 (exit "$ac_status"); } ; then echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&5 $AR $ARFLAGS "$cf_ar_flags" conftest.a "conftest.$ac_cv_objext" 2>&5 1>/dev/null if test -f conftest.a ; then cf_cv_ar_flags="$cf_ar_flags" break fi else test -n "$verbose" && echo " cannot compile test-program" 1>&6 echo "${as_me:-configure}:3846: testing cannot compile test-program ..." 1>&5 break fi done rm -f conftest.a "conftest.$ac_ext" "conftest.$ac_cv_objext" ;; esac fi echo "$as_me:3856: result: $cf_cv_ar_flags" >&5 echo "${ECHO_T}$cf_cv_ar_flags" >&6 if test -n "$ARFLAGS" ; then if test -n "$cf_cv_ar_flags" ; then ARFLAGS="$ARFLAGS $cf_cv_ar_flags" fi else ARFLAGS=$cf_cv_ar_flags fi 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 # Checks for libraries. # Checks for header files. echo "$as_me:3879: checking if the POSIX test-macros are already defined" >&5 echo $ECHO_N "checking if the POSIX test-macros are already defined... $ECHO_C" >&6 if test "${cf_cv_posix_visible+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 3886 "configure" #include "confdefs.h" #include int main (void) { #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) #error conflicting symbols found #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3905: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3908: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3911: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3914: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_posix_visible=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_visible=yes fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:3925: result: $cf_cv_posix_visible" >&5 echo "${ECHO_T}$cf_cv_posix_visible" >&6 if test "$cf_cv_posix_visible" = no; then cf_XOPEN_SOURCE=500 cf_POSIX_C_SOURCE=199506L cf_xopen_source= case "$host_os" in (aix[4-7]*) cf_xopen_source="-D_ALL_SOURCE" ;; (darwin[0-8].*) cf_xopen_source="-D_APPLE_C_SOURCE" ;; (darwin*) cf_xopen_source="-D_DARWIN_C_SOURCE" cf_XOPEN_SOURCE= ;; (freebsd*|dragonfly*|midnightbsd*) # 5.x headers associate # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L cf_POSIX_C_SOURCE=200112L cf_XOPEN_SOURCE=600 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" ;; (hpux11*) cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" ;; (hpux*) cf_xopen_source="-D_HPUX_SOURCE" ;; (irix[56].*) cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; (linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc) cf_gnu_xopen_source=$cf_XOPEN_SOURCE echo "$as_me:3967: checking if this is the GNU C library" >&5 echo $ECHO_N "checking if this is the GNU C library... $ECHO_C" >&6 if test "${cf_cv_gnu_library+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 3974 "configure" #include "confdefs.h" #include int main (void) { #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 return 0; #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 return 0; #else # error not GNU C library #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3993: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3996: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3999: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4002: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_library=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_library=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4013: result: $cf_cv_gnu_library" >&5 echo "${ECHO_T}$cf_cv_gnu_library" >&6 if test x$cf_cv_gnu_library = xyes; then # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE # was changed to help a little. newlib incorporated the change about 4 # years later. echo "$as_me:4021: checking if _DEFAULT_SOURCE can be used as a basis" >&5 echo $ECHO_N "checking if _DEFAULT_SOURCE can be used as a basis... $ECHO_C" >&6 if test "${cf_cv_gnu_library_219+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cf_save="$CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_DEFAULT_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 4033 "configure" #include "confdefs.h" #include int main (void) { #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) return 0; #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) return 0; #else # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4052: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4055: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4058: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4061: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_library_219=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_library_219=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CPPFLAGS="$cf_save" fi echo "$as_me:4073: result: $cf_cv_gnu_library_219" >&5 echo "${ECHO_T}$cf_cv_gnu_library_219" >&6 if test "x$cf_cv_gnu_library_219" = xyes; then cf_save="$CPPFLAGS" echo "$as_me:4078: checking if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE" >&5 echo $ECHO_N "checking if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE... $ECHO_C" >&6 if test "${cf_cv_gnu_dftsrc_219+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi cat >"conftest.$ac_ext" <<_ACEOF #line 4183 "configure" #include "confdefs.h" #include #include int main (void) { #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) return 0; #else # error GNU C library is too old #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4203: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4206: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4209: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4212: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_dftsrc_219=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_dftsrc_219=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4223: result: $cf_cv_gnu_dftsrc_219" >&5 echo "${ECHO_T}$cf_cv_gnu_dftsrc_219" >&6 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" else cf_cv_gnu_dftsrc_219=maybe fi if test "x$cf_cv_gnu_dftsrc_219" != xyes; then echo "$as_me:4232: checking if we must define _GNU_SOURCE" >&5 echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 if test "${cf_cv_gnu_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 4239 "configure" #include "confdefs.h" #include int main (void) { #ifndef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4254: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4257: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4260: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4263: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_save="$CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -D_GNU_SOURCE do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi cat >"conftest.$ac_ext" <<_ACEOF #line 4370 "configure" #include "confdefs.h" #include int main (void) { #ifdef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be undefined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4385: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4388: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4391: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4394: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_source=yes fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CPPFLAGS="$cf_save" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4409: result: $cf_cv_gnu_source" >&5 echo "${ECHO_T}$cf_cv_gnu_source" >&6 if test "$cf_cv_gnu_source" = yes then echo "$as_me:4414: checking if we should also define _DEFAULT_SOURCE" >&5 echo $ECHO_N "checking if we should also define _DEFAULT_SOURCE... $ECHO_C" >&6 if test "${cf_cv_default_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_GNU_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 4424 "configure" #include "confdefs.h" #include int main (void) { #ifdef _DEFAULT_SOURCE #error expected _DEFAULT_SOURCE to be undefined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4439: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4442: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4445: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4448: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_default_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_default_source=yes fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4459: result: $cf_cv_default_source" >&5 echo "${ECHO_T}$cf_cv_default_source" >&6 if test "$cf_cv_default_source" = yes then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_DEFAULT_SOURCE" fi fi fi fi ;; (minix*) cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... ;; (mirbsd*) # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types cf_XOPEN_SOURCE= if test "$cf_cv_posix_visible" = no; then cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` echo "$as_me:4496: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo "${as_me:-configure}:4502: testing if the symbol is already defined go no further ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 4505 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4520: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4523: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4526: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4529: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_posix_c_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in (.[12]??*) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; (.2) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" cf_want_posix_source=yes ;; (.*) cf_want_posix_source=yes ;; esac if test "$cf_want_posix_source" = yes ; then cat >"conftest.$ac_ext" <<_ACEOF #line 4550 "configure" #include "confdefs.h" #include int main (void) { #ifdef _POSIX_SOURCE #error _POSIX_SOURCE is defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4565: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4568: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4571: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4574: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "${as_me:-configure}:4585: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_cv_posix_c_source" echo "${as_me:-configure}:4593: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 4596 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4611: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4614: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4617: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4620: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_c_source=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4636: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_cv_posix_c_source do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi fi fi # cf_cv_posix_visible ;; (netbsd*) cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw ;; (openbsd[6-9]*) # OpenBSD 6.x has broken locale support, both compile-time and runtime. # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html # Abusing the conformance level is a workaround. { echo "$as_me:4753: WARNING: this system does not provide usable locale support" >&5 echo "$as_me: WARNING: this system does not provide usable locale support" >&2;} cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=700 ;; (openbsd[4-5]*) # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=600 ;; (openbsd*) # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; (osf[45]*) cf_xopen_source="-D_OSF_SOURCE" ;; (nto-qnx*) cf_xopen_source="-D_QNX_SOURCE" ;; (sco*) # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; (solaris2.*) cf_xopen_source="-D__EXTENSIONS__" cf_cv_xopen_source=broken ;; (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) cf_XOPEN_SOURCE= cf_POSIX_C_SOURCE= ;; (*) echo "$as_me:4785: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 4792 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4810: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4813: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4816: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4819: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_save="$CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 4831 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4849: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4852: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4855: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4858: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_xopen_source=$cf_XOPEN_SOURCE fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CPPFLAGS="$cf_save" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4873: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then CFLAGS=`echo "$CFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" for cf_add_cflags in $cf_temp_xopen_source do case "x$cf_add_cflags" in (x-[DU]*) cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CFLAGS" != "$cf_old_cflag" || break CFLAGS="$cf_old_cflag" done cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CPPFLAGS" != "$cf_old_cflag" || break CPPFLAGS="$cf_old_cflag" done ;; esac cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_add_cflags do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done fi cf_save_xopen_cppflags="$CPPFLAGS" if test "$cf_cv_posix_visible" = no; then cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` echo "$as_me:5033: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo "${as_me:-configure}:5039: testing if the symbol is already defined go no further ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 5042 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5057: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5060: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5063: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5066: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_posix_c_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in (.[12]??*) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; (.2) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" cf_want_posix_source=yes ;; (.*) cf_want_posix_source=yes ;; esac if test "$cf_want_posix_source" = yes ; then cat >"conftest.$ac_ext" <<_ACEOF #line 5087 "configure" #include "confdefs.h" #include int main (void) { #ifdef _POSIX_SOURCE #error _POSIX_SOURCE is defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5102: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5105: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5108: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5111: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "${as_me:-configure}:5122: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_cv_posix_c_source" echo "${as_me:-configure}:5130: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 5133 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5148: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5151: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5154: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5157: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_c_source=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:5173: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_cv_posix_c_source do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi fi fi # cf_cv_posix_visible # Some of these niche implementations use copy/paste, double-check... if test "$cf_cv_xopen_source" = no ; then test -n "$verbose" && echo " checking if _POSIX_C_SOURCE interferes with _XOPEN_SOURCE" 1>&6 echo "${as_me:-configure}:5286: testing checking if _POSIX_C_SOURCE interferes with _XOPEN_SOURCE ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 5289 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5307: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5310: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5313: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5316: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 { echo "$as_me:5323: WARNING: _POSIX_C_SOURCE definition is not usable" >&5 echo "$as_me: WARNING: _POSIX_C_SOURCE definition is not usable" >&2;} CPPFLAGS="$cf_save_xopen_cppflags" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi ;; esac if test -n "$cf_xopen_source" ; then for cf_add_cflags in $cf_xopen_source do case "x$cf_add_cflags" in (x-[DU]*) cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CFLAGS" != "$cf_old_cflag" || break test -n "$verbose" && echo " removing old option $cf_add_cflags from CFLAGS" 1>&6 echo "${as_me:-configure}:5346: testing removing old option $cf_add_cflags from CFLAGS ..." 1>&5 CFLAGS="$cf_old_cflag" done cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CPPFLAGS" != "$cf_old_cflag" || break test -n "$verbose" && echo " removing old option $cf_add_cflags from CPPFLAGS" 1>&6 echo "${as_me:-configure}:5358: testing removing old option $cf_add_cflags from CPPFLAGS ..." 1>&5 CPPFLAGS="$cf_old_cflag" done ;; esac cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_add_cflags do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 echo "${as_me:-configure}:5446: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 echo "${as_me:-configure}:5456: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 echo "${as_me:-configure}:5466: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done fi if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then echo "$as_me:5478: checking if _XOPEN_SOURCE really is set" >&5 echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 cat >"conftest.$ac_ext" <<_ACEOF #line 5481 "configure" #include "confdefs.h" #include int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5496: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5499: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5502: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5505: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_XOPEN_SOURCE_set=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_XOPEN_SOURCE_set=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" echo "$as_me:5514: result: $cf_XOPEN_SOURCE_set" >&5 echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 if test "$cf_XOPEN_SOURCE_set" = yes then cat >"conftest.$ac_ext" <<_ACEOF #line 5519 "configure" #include "confdefs.h" #include int main (void) { #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE #error (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5534: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5537: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5540: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5543: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_XOPEN_SOURCE_set_ok=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_XOPEN_SOURCE_set_ok=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" if test "$cf_XOPEN_SOURCE_set_ok" = no then { echo "$as_me:5554: WARNING: _XOPEN_SOURCE is lower than requested" >&5 echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} fi else echo "$as_me:5559: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 5566 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5584: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5587: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5590: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5593: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_save="$CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 5605 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5623: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5626: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5629: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5632: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_xopen_source=$cf_XOPEN_SOURCE fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CPPFLAGS="$cf_save" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:5647: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then CFLAGS=`echo "$CFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" for cf_add_cflags in $cf_temp_xopen_source do case "x$cf_add_cflags" in (x-[DU]*) cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CFLAGS" != "$cf_old_cflag" || break CFLAGS="$cf_old_cflag" done cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CPPFLAGS" != "$cf_old_cflag" || break CPPFLAGS="$cf_old_cflag" done ;; esac cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_add_cflags do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done fi fi fi fi # cf_cv_posix_visible echo "$as_me:5794: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 5800 "configure" #include "confdefs.h" #include #include #include #include _ACEOF if { (eval echo "$as_me:5808: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:5814: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_header_stdc=no fi rm -f conftest.err "conftest.$ac_ext" if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >"conftest.$ac_ext" <<_ACEOF #line 5836 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -rf conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >"conftest.$ac_ext" <<_ACEOF #line 5854 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -rf conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >"conftest.$ac_ext" <<_ACEOF #line 5875 "configure" #include "confdefs.h" #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main (void) { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) $ac_main_return(2); $ac_main_return (0); } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:5901: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5904: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:5906: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5909: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_header_stdc=no fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi fi echo "$as_me:5922: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi for ac_header in libintl.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:5935: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 5941 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:5945: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:5951: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:5970: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 5992 "configure" #include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5998: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6001: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6004: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6007: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6017: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6 if test "${ac_cv_header_stdbool_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6033 "configure" #include "confdefs.h" #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; bool e = &s; char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; #if defined __xlc__ || defined __GNUC__ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 reported by James Lemley on 2005-10-05; see http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html This test is not quite right, since xlc is allowed to reject this program, as the initializer for xlcbug is not one of the forms that C requires support for. However, doing the test right would require a run-time test, and that would make cross-compilation harder. Let us hope that IBM fixes the xlc bug, and also adds support for this kind of constant expression. In the meantime, this test will reject xlc, which is OK, since our stdbool.h substitute should suffice. We also test this with GCC, where it should work, to detect more quickly whether someone messes up the test in the future. */ char digs[] = "0123456789"; int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); #endif /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main (void) { *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6112: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6115: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6118: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6121: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_header_stdbool_h=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_header_stdbool_h=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6131: result: $ac_cv_header_stdbool_h" >&5 echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6 echo "$as_me:6133: checking for _Bool" >&5 echo $ECHO_N "checking for _Bool... $ECHO_C" >&6 if test "${ac_cv_type__Bool+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6139 "configure" #include "confdefs.h" $ac_includes_default int main (void) { if ((_Bool *) 0) return 0; if (sizeof (_Bool)) return 0; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6154: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6157: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6160: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6163: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_type__Bool=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_type__Bool=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6173: result: $ac_cv_type__Bool" >&5 echo "${ECHO_T}$ac_cv_type__Bool" >&6 if test "$ac_cv_type__Bool" = yes; then cat >>confdefs.h <>confdefs.h <<\EOF #define HAVE_STDBOOL_H 1 EOF fi # Define two additional variables used in the Makefile substitution. if test "$ac_cv_header_stdbool_h" = yes; then STDBOOL_H='' else STDBOOL_H='stdbool.h' fi if test "$ac_cv_type__Bool" = yes; then HAVE__BOOL=1 else HAVE__BOOL=0 fi echo "$as_me:6202: checking if you want to see long compiling messages" >&5 echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 # Check whether --enable-echo or --disable-echo was given. if test "${enable_echo+set}" = set; then enableval="$enable_echo" test "$enableval" != no && enableval=yes if test "$enableval" != "yes" ; then ECHO_LT='--silent' ECHO_LD='@echo linking $@;' RULE_CC='@echo compiling $<' SHOW_CC='@echo compiling $@' ECHO_CC='@' else ECHO_LT='' ECHO_LD='' RULE_CC='' SHOW_CC='' ECHO_CC='' fi else enableval=yes ECHO_LT='' ECHO_LD='' RULE_CC='' SHOW_CC='' ECHO_CC='' fi; echo "$as_me:6236: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 echo "$as_me:6239: checking for fgrep" >&5 echo $ECHO_N "checking for fgrep... $ECHO_C" >&6 if test "${ac_cv_path_FGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else for ac_prog in gfgrep fgrep do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:6251: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_FGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $FGREP in [\\/]* | ?:[\\/]*) ac_cv_path_FGREP="$FGREP" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_FGREP="$ac_dir/$ac_word" echo "$as_me:6268: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi FGREP=$ac_cv_path_FGREP if test -n "$FGREP"; then echo "$as_me:6279: result: $FGREP" >&5 echo "${ECHO_T}$FGREP" >&6 else echo "$as_me:6282: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$FGREP" && break done test -n "$FGREP" || FGREP=": " test "x$ac_cv_path_FGREP" = "x:" && { { echo "$as_me:6290: error: cannot find workable fgrep" >&5 echo "$as_me: error: cannot find workable fgrep" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:6295: result: $ac_cv_path_FGREP" >&5 echo "${ECHO_T}$ac_cv_path_FGREP" >&6 FGREP="$ac_cv_path_FGREP" echo "$as_me:6299: checking if you want to use C11 _Noreturn feature" >&5 echo $ECHO_N "checking if you want to use C11 _Noreturn feature... $ECHO_C" >&6 # Check whether --enable-stdnoreturn or --disable-stdnoreturn was given. if test "${enable_stdnoreturn+set}" = set; then enableval="$enable_stdnoreturn" test "$enableval" != yes && enableval=no if test "$enableval" != "no" ; then enable_stdnoreturn=yes else enable_stdnoreturn=no fi else enableval=no enable_stdnoreturn=no fi; echo "$as_me:6316: result: $enable_stdnoreturn" >&5 echo "${ECHO_T}$enable_stdnoreturn" >&6 if test $enable_stdnoreturn = yes; then echo "$as_me:6320: checking for C11 _Noreturn feature" >&5 echo $ECHO_N "checking for C11 _Noreturn feature... $ECHO_C" >&6 if test "${cf_cv_c11_noreturn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6326 "configure" #include "confdefs.h" $ac_includes_default #include static _Noreturn void giveup(void) { exit(0); } int main (void) { if (feof(stdin)) giveup() ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6342: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6345: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6348: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6351: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_c11_noreturn=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_c11_noreturn=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6362: result: $cf_cv_c11_noreturn" >&5 echo "${ECHO_T}$cf_cv_c11_noreturn" >&6 else cf_cv_c11_noreturn=no, fi if test "$cf_cv_c11_noreturn" = yes; then cat >>confdefs.h <<\EOF #define HAVE_STDNORETURN_H 1 EOF cat >>confdefs.h <&6 echo "${as_me:-configure}:6418: testing repairing CFLAGS: $CFLAGS ..." 1>&5 CFLAGS="$cf_temp_flags" test -n "$verbose" && echo " ... fixed $CFLAGS" 1>&6 echo "${as_me:-configure}:6423: testing ... fixed $CFLAGS ..." 1>&5 test -n "$verbose" && echo " ... extra $EXTRA_CFLAGS" 1>&6 echo "${as_me:-configure}:6427: testing ... extra $EXTRA_CFLAGS ..." 1>&5 fi ;; esac fi if test "$GCC" = yes || test "$GXX" = yes then case $CPPFLAGS in (*-Werror=*) cf_temp_flags= for cf_temp_scan in $CPPFLAGS do case "x$cf_temp_scan" in (x-Werror=format*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; (x-Werror=*) test -n "$EXTRA_CFLAGS" && EXTRA_CFLAGS="$EXTRA_CFLAGS " EXTRA_CFLAGS="${EXTRA_CFLAGS}$cf_temp_scan" ;; (*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; esac done if test "x$CPPFLAGS" != "x$cf_temp_flags" then test -n "$verbose" && echo " repairing CPPFLAGS: $CPPFLAGS" 1>&6 echo "${as_me:-configure}:6466: testing repairing CPPFLAGS: $CPPFLAGS ..." 1>&5 CPPFLAGS="$cf_temp_flags" test -n "$verbose" && echo " ... fixed $CPPFLAGS" 1>&6 echo "${as_me:-configure}:6471: testing ... fixed $CPPFLAGS ..." 1>&5 test -n "$verbose" && echo " ... extra $EXTRA_CFLAGS" 1>&6 echo "${as_me:-configure}:6475: testing ... extra $EXTRA_CFLAGS ..." 1>&5 fi ;; esac fi if test "$GCC" = yes || test "$GXX" = yes then case $LDFLAGS in (*-Werror=*) cf_temp_flags= for cf_temp_scan in $LDFLAGS do case "x$cf_temp_scan" in (x-Werror=format*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; (x-Werror=*) test -n "$EXTRA_CFLAGS" && EXTRA_CFLAGS="$EXTRA_CFLAGS " EXTRA_CFLAGS="${EXTRA_CFLAGS}$cf_temp_scan" ;; (*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; esac done if test "x$LDFLAGS" != "x$cf_temp_flags" then test -n "$verbose" && echo " repairing LDFLAGS: $LDFLAGS" 1>&6 echo "${as_me:-configure}:6514: testing repairing LDFLAGS: $LDFLAGS ..." 1>&5 LDFLAGS="$cf_temp_flags" test -n "$verbose" && echo " ... fixed $LDFLAGS" 1>&6 echo "${as_me:-configure}:6519: testing ... fixed $LDFLAGS ..." 1>&5 test -n "$verbose" && echo " ... extra $EXTRA_CFLAGS" 1>&6 echo "${as_me:-configure}:6523: testing ... extra $EXTRA_CFLAGS ..." 1>&5 fi ;; esac fi echo "$as_me:6530: checking if you want to turn on gcc warnings" >&5 echo $ECHO_N "checking if you want to turn on gcc warnings... $ECHO_C" >&6 # Check whether --enable-warnings or --disable-warnings was given. if test "${enable_warnings+set}" = set; then enableval="$enable_warnings" test "$enableval" != yes && enableval=no if test "$enableval" != "no" ; then enable_warnings=yes else enable_warnings=no fi else enableval=no enable_warnings=no fi; echo "$as_me:6547: result: $enable_warnings" >&5 echo "${ECHO_T}$enable_warnings" >&6 if test "$enable_warnings" = "yes" then if test "$GCC" = yes || test "$GXX" = yes then cat > conftest.i <&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > "conftest.$ac_ext" < #include "confdefs.h" #include "conftest.h" #include "conftest.i" #if GCC_PRINTF #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) #else #define GCC_PRINTFLIKE(fmt,var) /*nothing*/ #endif #if GCC_SCANF #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) #else #define GCC_SCANFLIKE(fmt,var) /*nothing*/ #endif extern void wow(char *,...) GCC_SCANFLIKE(1,2); extern GCC_NORETURN void oops(char *,...) GCC_PRINTFLIKE(1,2); extern GCC_NORETURN void foo(void); int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { (void)argc; (void)argv; return 0; } EOF cf_printf_attribute=no cf_scanf_attribute=no for cf_attribute in scanf printf unused noreturn do cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cf_directive="__attribute__(($cf_attribute))" echo "checking for $CC $cf_directive" 1>&5 case "$cf_attribute" in (printf) cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6626: \$? = $ac_status" >&5 (exit "$ac_status"); }; then test -n "$verbose" && echo "$as_me:6628: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case "$cf_attribute" in (noreturn) cat >>confdefs.h <>confdefs.h <<\EOF #define GCC_PRINTF 1 EOF fi cat >>confdefs.h <>confdefs.h <<\EOF #define GCC_SCANF 1 EOF fi cat >>confdefs.h <>confdefs.h <>confdefs.h fi rm -rf ./conftest* fi if test "x$have_x" = xyes; then echo "skipping X-const check"; fi cat > "conftest.$ac_ext" <&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" for cf_opt in \ wd1419 \ wd1683 \ wd1684 \ wd193 \ wd593 \ wd279 \ wd810 \ wd869 \ wd981 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if { (eval echo "$as_me:6721: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6724: \$? = $ac_status" >&5 (exit "$ac_status"); }; then test -n "$verbose" && echo "$as_me:6726: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done CFLAGS="$cf_save_CFLAGS" elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown" then { echo "$as_me:6734: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" cf_warn_CONST="" test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= for cf_opt in W Wall \ Wbad-function-cast \ Wcast-align \ Wcast-qual \ Wdeclaration-after-statement \ Wextra \ Winline \ Wmissing-declarations \ Wmissing-prototypes \ Wnested-externs \ Wpointer-arith \ Wshadow \ Wstrict-prototypes \ Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST Wno-undef do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if { (eval echo "$as_me:6757: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6760: \$? = $ac_status" >&5 (exit "$ac_status"); }; then test -n "$verbose" && echo "$as_me:6762: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case "$cf_opt" in (Winline) case "$GCC_VERSION" in ([34].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 echo "${as_me:-configure}:6770: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac ;; (Wpointer-arith) case "$GCC_VERSION" in ([12].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 echo "${as_me:-configure}:6780: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac ;; esac EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done CFLAGS="$cf_save_CFLAGS" fi rm -rf ./conftest* fi fi # Checks for typedefs, structures, and compiler characteristics. cf_save_includes="$ac_includes_default" ac_includes_default="$ac_includes_default #include " echo "$as_me:6804: checking for time_t" >&5 echo $ECHO_N "checking for time_t... $ECHO_C" >&6 if test "${ac_cv_type_time_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6810 "configure" #include "confdefs.h" $ac_includes_default int main (void) { if ((time_t *) 0) return 0; if (sizeof (time_t)) return 0; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6825: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6828: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6831: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6834: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_type_time_t=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_type_time_t=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6844: result: $ac_cv_type_time_t" >&5 echo "${ECHO_T}$ac_cv_type_time_t" >&6 echo "$as_me:6847: checking size of time_t" >&5 echo $ECHO_N "checking size of time_t... $ECHO_C" >&6 if test "${ac_cv_sizeof_time_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_time_t" = yes; then if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >"conftest.$ac_ext" <<_ACEOF #line 6856 "configure" #include "confdefs.h" $ac_includes_default int main (void) { int _array_ [1 - 2 * !((sizeof (time_t)) >= 0)] ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6868: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6871: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6874: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6877: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_lo=0 ac_mid=0 while :; do cat >"conftest.$ac_ext" <<_ACEOF #line 6882 "configure" #include "confdefs.h" $ac_includes_default int main (void) { int _array_ [1 - 2 * !((sizeof (time_t)) <= $ac_mid)] ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6894: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6897: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6900: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6903: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_lo=`expr "$ac_mid" + 1`; ac_mid=`expr 2 '*' "$ac_mid" + 1` fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" done else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_hi=-1 ac_mid=-1 while :; do cat >"conftest.$ac_ext" <<_ACEOF #line 6919 "configure" #include "confdefs.h" $ac_includes_default int main (void) { int _array_ [1 - 2 * !((sizeof (time_t)) >= $ac_mid)] ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6931: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6934: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6937: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6940: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_hi=`expr "$ac_mid" - 1`; ac_mid=`expr 2 '*' "$ac_mid"` fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" done fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' "$ac_hi" - "$ac_lo" ')' / 2 + "$ac_lo"` cat >"conftest.$ac_ext" <<_ACEOF #line 6956 "configure" #include "confdefs.h" $ac_includes_default int main (void) { int _array_ [1 - 2 * !((sizeof (time_t)) <= $ac_mid)] ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6968: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6971: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6974: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6977: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_lo=`expr "$ac_mid" + 1` fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" done ac_cv_sizeof_time_t=$ac_lo else if test "$cross_compiling" = yes; then { { echo "$as_me:6990: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >"conftest.$ac_ext" <<_ACEOF #line 6995 "configure" #include "confdefs.h" $ac_includes_default int main (void) { FILE *f = fopen ("conftest.val", "w"); if (!f) $ac_main_return (1); fprintf (f, "%ld", (long)(sizeof (time_t))); fclose (f); ; return 0; } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:7011: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7014: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:7016: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7019: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_sizeof_time_t=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi rm -f conftest.val else ac_cv_sizeof_time_t=0 fi fi echo "$as_me:7035: result: $ac_cv_sizeof_time_t" >&5 echo "${ECHO_T}$ac_cv_sizeof_time_t" >&6 cat >>confdefs.h <&5 echo "$as_me: WARNING: using 4 for sizeof time_t" >&2;} ac_cv_sizeof_time_t=4 elif test "x${ac_cv_sizeof_time_t}" = x0; then { echo "$as_me:7048: WARNING: sizeof time_t not found, using 4" >&5 echo "$as_me: WARNING: sizeof time_t not found, using 4" >&2;} ac_cv_sizeof_time_t=4 fi if test "x$ac_cv_sizeof_time_t" != "x$cf_cv_sizeof" then cf_cv_type=`echo "sizeof_time_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` sed -e "s/\\([ ]${cf_cv_type}[ ]\\).*/\\1$ac_cv_sizeof_time_t/" confdefs.h >conftest.val mv conftest.val confdefs.h fi fi ac_includes_default="$cf_save_includes" echo "$as_me:7064: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7070 "configure" #include "confdefs.h" int main (void) { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; (void)x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; (void)zero; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; (void)s; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; (void)foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; (void)p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; (void)foo; } #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:7132: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:7135: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:7138: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7141: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_c_const=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:7151: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\EOF #define const EOF fi echo "$as_me:7161: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6 if test "${ac_cv_c_inline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >"conftest.$ac_ext" <<_ACEOF #line 7169 "configure" #include "confdefs.h" #ifndef __cplusplus static $ac_kw int static_foo (void) {return 0; } $ac_kw int foo (void) {return 0; } #endif _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:7178: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:7181: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:7184: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7187: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_c_inline=$ac_kw; break else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" done fi echo "$as_me:7198: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6 case $ac_cv_c_inline in inline | yes) ;; no) cat >>confdefs.h <<\EOF #define inline EOF ;; *) cat >>confdefs.h <&5 echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6 if test "$ac_cv_prog_cc_stdc" != no; then echo "$as_me:7216: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\EOF #define PROTOTYPES 1 EOF else echo "$as_me:7224: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:7228: checking whether the compiler generally respects inline" >&5 echo $ECHO_N "checking whether the compiler generally respects inline... $ECHO_C" >&6 if test "${gl_cv_c_inline_effective+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test $ac_cv_c_inline = no; then gl_cv_c_inline_effective=no else cat >"conftest.$ac_ext" <<_ACEOF #line 7237 "configure" #include "confdefs.h" int main (void) { #ifdef __NO_INLINE__ #error "inline is not effective" #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:7251: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:7254: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:7257: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7260: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then gl_cv_c_inline_effective=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 gl_cv_c_inline_effective=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:7272: result: $gl_cv_c_inline_effective" >&5 echo "${ECHO_T}$gl_cv_c_inline_effective" >&6 if test $gl_cv_c_inline_effective = yes; then cat >>confdefs.h <<\EOF #define HAVE_INLINE 1 EOF fi echo "$as_me:7282: checking for preprocessor stringizing operator" >&5 echo $ECHO_N "checking for preprocessor stringizing operator... $ECHO_C" >&6 if test "${ac_cv_c_stringize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7288 "configure" #include "confdefs.h" #define x(y) #y char *s = x(teststring); _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "#teststring" >/dev/null 2>&1; then ac_cv_c_stringize=no else ac_cv_c_stringize=yes fi rm -rf conftest* fi echo "$as_me:7303: result: $ac_cv_c_stringize" >&5 echo "${ECHO_T}$ac_cv_c_stringize" >&6 if test $ac_cv_c_stringize = yes; then cat >>confdefs.h <<\EOF #define HAVE_STRINGIZE 1 EOF fi echo "$as_me:7313: checking for working volatile" >&5 echo $ECHO_N "checking for working volatile... $ECHO_C" >&6 if test "${ac_cv_c_volatile+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7319 "configure" #include "confdefs.h" int main (void) { volatile int x; int * volatile y; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:7333: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:7336: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:7339: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7342: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_c_volatile=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_c_volatile=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:7352: result: $ac_cv_c_volatile" >&5 echo "${ECHO_T}$ac_cv_c_volatile" >&6 if test $ac_cv_c_volatile = no; then cat >>confdefs.h <<\EOF #define volatile EOF fi echo "$as_me:7362: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7368 "configure" #include "confdefs.h" $ac_includes_default int main (void) { if ((size_t *) 0) return 0; if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:7383: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:7386: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:7389: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7392: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_type_size_t=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:7402: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 if test "$ac_cv_type_size_t" = yes; then : else cat >>confdefs.h <&5 echo $ECHO_N "checking for off_t... $ECHO_C" >&6 if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7420 "configure" #include "confdefs.h" $ac_includes_default int main (void) { if ((off_t *) 0) return 0; if (sizeof (off_t)) return 0; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:7435: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:7438: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:7441: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7444: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_type_off_t=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:7454: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6 if test "$ac_cv_type_off_t" = yes; then : else cat >>confdefs.h <&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7472 "configure" #include "confdefs.h" #include #include #include int main (void) { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:7488: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:7491: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:7494: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7497: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_header_time=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:7507: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\EOF #define TIME_WITH_SYS_TIME 1 EOF fi for ac_header in sys/time.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:7520: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7526 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:7530: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:7536: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:7555: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7574 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:7605: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7608: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:7611: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7614: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:7624: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for working mktime... $ECHO_C" >&6 if test "${ac_cv_func_working_mktime+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_working_mktime=no else cat >"conftest.$ac_ext" <<_ACEOF #line 7643 "configure" #include "confdefs.h" /* Test program from Paul Eggert and Tony Leneis. */ #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #include #ifdef HAVE_UNISTD_H # include #endif #ifndef HAVE_ALARM # define alarm(X) /* empty */ #endif /* Work around redefinition to rpl_putenv by other config tests. */ #undef putenv static time_t time_t_max; static time_t time_t_min; /* Values we'll use to set the TZ environment variable. */ static char *tz_strings[] = { (char *) 0, "TZ=GMT0", "TZ=JST-9", "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" }; #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) /* Return 0 if mktime fails to convert a date in the spring-forward gap. Based on a problem report from Andreas Jaeger. */ static int spring_forward_gap (void) { /* glibc (up to about 1998-10-07) failed this test. */ struct tm tm; /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); tm.tm_year = 98; tm.tm_mon = 3; tm.tm_mday = 5; tm.tm_hour = 2; tm.tm_min = 0; tm.tm_sec = 0; tm.tm_isdst = -1; return mktime (&tm) != (time_t) -1; } static int mktime_test1 (time_t now) { struct tm *lt; return ! (lt = localtime (&now)) || mktime (lt) == now; } static int mktime_test (time_t now) { return (mktime_test1 (now) && mktime_test1 ((time_t) (time_t_max - now)) && mktime_test1 ((time_t) (time_t_min + now))); } static int irix_6_4_bug (void) { /* Based on code from Ariel Faigon. */ struct tm tm; tm.tm_year = 96; tm.tm_mon = 3; tm.tm_mday = 0; tm.tm_hour = 0; tm.tm_min = 0; tm.tm_sec = 0; tm.tm_isdst = -1; mktime (&tm); return tm.tm_mon == 2 && tm.tm_mday == 31; } static int bigtime_test (int j) { struct tm tm; time_t now; tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j; now = mktime (&tm); if (now != (time_t) -1) { struct tm *lt = localtime (&now); if (! (lt && lt->tm_year == tm.tm_year && lt->tm_mon == tm.tm_mon && lt->tm_mday == tm.tm_mday && lt->tm_hour == tm.tm_hour && lt->tm_min == tm.tm_min && lt->tm_sec == tm.tm_sec && lt->tm_yday == tm.tm_yday && lt->tm_wday == tm.tm_wday && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) return 0; } return 1; } static int year_2050_test (void) { /* The correct answer for 2050-02-01 00:00:00 in Pacific time, ignoring leap seconds. */ unsigned long int answer = 2527315200UL; struct tm tm; time_t t; tm.tm_year = 2050 - 1900; tm.tm_mon = 2 - 1; tm.tm_mday = 1; tm.tm_hour = tm.tm_min = tm.tm_sec = 0; tm.tm_isdst = -1; /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); t = mktime (&tm); /* Check that the result is either a failure, or close enough to the correct answer that we can assume the discrepancy is due to leap seconds. */ return (t == (time_t) -1 || (0 < t && answer - 120 <= t && t <= answer + 120)); } int main (void) { time_t t, delta; int i, j; /* This test makes some buggy mktime implementations loop. Give up after a few seconds; a mktime slower than that isn't worth using anyway. */ alarm (3); for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) continue; time_t_max--; if ((time_t) -1 < 0) for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2) continue; delta = time_t_max / 997; /* a suitable prime number */ for (i = 0; i < N_STRINGS; i++) { if (tz_strings[i]) putenv (tz_strings[i]); for (t = 0; t <= time_t_max - delta; t += delta) if (! mktime_test (t)) return 1; if (! (mktime_test ((time_t) 1) && mktime_test ((time_t) (60 * 60)) && mktime_test ((time_t) (60 * 60 * 24)))) return 1; for (j = 1; 0 < j; j *= 2) if (! bigtime_test (j)) return 1; if (! bigtime_test (j - 1)) return 1; } return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:7832: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7835: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:7837: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7840: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_func_working_mktime=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_func_working_mktime=no fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:7852: result: $ac_cv_func_working_mktime" >&5 echo "${ECHO_T}$ac_cv_func_working_mktime" >&6 if test $ac_cv_func_working_mktime = no; then LIBOBJS="$LIBOBJS mktime.$ac_objext" fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo "$as_me:7860: checking for working alloca.h" >&5 echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 if test "${ac_cv_working_alloca_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7866 "configure" #include "confdefs.h" #include int main (void) { char *p = (char *) alloca (2 * sizeof (int)); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:7878: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7881: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:7884: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7887: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_working_alloca_h=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_working_alloca_h=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:7897: result: $ac_cv_working_alloca_h" >&5 echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 if test $ac_cv_working_alloca_h = yes; then cat >>confdefs.h <<\EOF #define HAVE_ALLOCA_H 1 EOF fi echo "$as_me:7907: checking for alloca" >&5 echo $ECHO_N "checking for alloca... $ECHO_C" >&6 if test "${ac_cv_func_alloca_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7913 "configure" #include "confdefs.h" #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif # endif #endif int main (void) { char *p = (char *) alloca (1); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:7945: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7948: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:7951: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7954: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_func_alloca_works=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_func_alloca_works=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:7964: result: $ac_cv_func_alloca_works" >&5 echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 if test $ac_cv_func_alloca_works = yes; then cat >>confdefs.h <<\EOF #define HAVE_ALLOCA 1 EOF else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA="alloca.$ac_objext" cat >>confdefs.h <<\EOF #define C_ALLOCA 1 EOF echo "$as_me:7985: checking whether \`alloca.c' needs Cray hooks" >&5 echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 if test "${ac_cv_os_cray+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 7991 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -rf conftest* fi echo "$as_me:8009: result: $ac_cv_os_cray" >&5 echo "${ECHO_T}$ac_cv_os_cray" >&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:8014: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8020 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:8051: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:8054: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:8057: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8060: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:8070: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 if test "${ac_cv_c_stack_direction+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else cat >"conftest.$ac_ext" <<_ACEOF #line 8093 "configure" #include "confdefs.h" int find_stack_direction (void) { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main (void) { $ac_main_return (find_stack_direction () < 0); } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:8116: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:8119: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:8121: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8124: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_c_stack_direction=1 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_c_stack_direction=-1 fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:8136: result: $ac_cv_c_stack_direction" >&5 echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 cat >>confdefs.h <&5 echo $ECHO_N "checking for alloca as a compiler built-in... $ECHO_C" >&6 if test "${gl_cv_rpl_alloca+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8158 "configure" #include "confdefs.h" #if defined __GNUC__ || defined _AIX || defined _MSC_VER Need own alloca #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Need own alloca" >/dev/null 2>&1; then gl_cv_rpl_alloca=yes else gl_cv_rpl_alloca=no fi rm -rf conftest* fi echo "$as_me:8175: result: $gl_cv_rpl_alloca" >&5 echo "${ECHO_T}$gl_cv_rpl_alloca" >&6 if test $gl_cv_rpl_alloca = yes; then cat >>confdefs.h <<\EOF #define HAVE_ALLOCA 1 EOF ALLOCA_H=alloca.h else ALLOCA_H= fi else ALLOCA_H=alloca.h fi cat >>confdefs.h <<\EOF #define HAVE_ALLOCA_H 1 EOF if test -z "$GETOPT_H"; then for ac_header in getopt.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:8200: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8206 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:8210: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:8216: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:8235: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8260 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:8291: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:8294: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:8297: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8300: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:8310: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking whether optreset is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_optreset+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8331 "configure" #include "confdefs.h" #include int main (void) { #ifndef optreset (void) optreset; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8347: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8350: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8353: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8356: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_optreset=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_optreset=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:8366: result: $ac_cv_have_decl_optreset" >&5 echo "${ECHO_T}$ac_cv_have_decl_optreset" >&6 if test "$ac_cv_have_decl_optreset" = yes; then GETOPT_H=getopt.h fi fi if test -z "$GETOPT_H"; then echo "$as_me:8375: checking for working GNU getopt function" >&5 echo $ECHO_N "checking for working GNU getopt function... $ECHO_C" >&6 if test "${gl_cv_func_gnu_getopt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then echo "$as_me:8381: checking whether getopt_clip is declared" >&5 echo $ECHO_N "checking whether getopt_clip is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_getopt_clip+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8387 "configure" #include "confdefs.h" #include int main (void) { #ifndef getopt_clip (void) getopt_clip; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8403: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8406: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8409: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8412: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_getopt_clip=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_getopt_clip=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:8422: result: $ac_cv_have_decl_getopt_clip" >&5 echo "${ECHO_T}$ac_cv_have_decl_getopt_clip" >&6 if test "$ac_cv_have_decl_getopt_clip" = yes; then gl_cv_func_gnu_getopt=no else gl_cv_func_gnu_getopt=yes fi else cat >"conftest.$ac_ext" <<_ACEOF #line 8432 "configure" #include "confdefs.h" #include int main (void) { char *myargv[3]; myargv[0] = "conftest"; myargv[1] = "-+"; myargv[2] = 0; return getopt (2, myargv, "+a") != '?'; ; return 0; } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:8450: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:8453: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:8455: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8458: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then gl_cv_func_gnu_getopt=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 gl_cv_func_gnu_getopt=no fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:8470: result: $gl_cv_func_gnu_getopt" >&5 echo "${ECHO_T}$gl_cv_func_gnu_getopt" >&6 if test "$gl_cv_func_gnu_getopt" = "no"; then GETOPT_H=getopt.h fi fi LIBOBJS="$LIBOBJS getopt.$ac_objext" LIBOBJS="$LIBOBJS getopt1.$ac_objext" if test -n "$GETOPT_H" then : else GETOPT_H=getopt.h cat >>confdefs.h <<\EOF #define __GETOPT_PREFIX rpl_ EOF fi echo "$as_me:8490: checking whether getenv is declared" >&5 echo $ECHO_N "checking whether getenv is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_getenv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8496 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef getenv (void) getenv; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8511: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8514: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8517: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8520: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_getenv=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_getenv=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:8530: result: $ac_cv_have_decl_getenv" >&5 echo "${ECHO_T}$ac_cv_have_decl_getenv" >&6 if test "$ac_cv_have_decl_getenv" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether program_invocation_name is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_program_invocation_name+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8551 "configure" #include "confdefs.h" #include int main (void) { #ifndef program_invocation_name (void) program_invocation_name; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8567: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8570: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8573: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8576: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_program_invocation_name=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_program_invocation_name=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:8586: result: $ac_cv_have_decl_program_invocation_name" >&5 echo "${ECHO_T}$ac_cv_have_decl_program_invocation_name" >&6 if test "$ac_cv_have_decl_program_invocation_name" = yes; then cat >>confdefs.h <<\EOF #define HAVE_DECL_PROGRAM_INVOCATION_NAME 1 EOF else cat >>confdefs.h <<\EOF #define GNULIB_PROGRAM_INVOCATION_NAME 1 EOF fi echo "$as_me:8602: checking whether program_invocation_short_name is declared" >&5 echo $ECHO_N "checking whether program_invocation_short_name is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_program_invocation_short_name+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8608 "configure" #include "confdefs.h" #include int main (void) { #ifndef program_invocation_short_name (void) program_invocation_short_name; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8624: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8627: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8630: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8633: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_program_invocation_short_name=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_program_invocation_short_name=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:8643: result: $ac_cv_have_decl_program_invocation_short_name" >&5 echo "${ECHO_T}$ac_cv_have_decl_program_invocation_short_name" >&6 if test "$ac_cv_have_decl_program_invocation_short_name" = yes; then cat >>confdefs.h <<\EOF #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1 EOF else cat >>confdefs.h <<\EOF #define GNULIB_PROGRAM_INVOCATION_SHORT_NAME 1 EOF fi # Check if program_invocation_name and program_invocation_short_name # are defined elsewhere. It is improbable that only one of them will # be defined and other not, I prefer to stay on the safe side and to # test each one separately. echo "$as_me:8663: checking whether program_invocation_name is defined" >&5 echo $ECHO_N "checking whether program_invocation_name is defined... $ECHO_C" >&6 cat >"conftest.$ac_ext" <<_ACEOF #line 8666 "configure" #include "confdefs.h" #include int main (void) { program_invocation_name = "test"; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8678: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8681: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8684: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8687: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cat >>confdefs.h <<\EOF #define HAVE_PROGRAM_INVOCATION_NAME 1 EOF echo "$as_me:8694: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 echo "$as_me:8699: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" echo "$as_me:8704: checking whether program_invocation_short_name is defined" >&5 echo $ECHO_N "checking whether program_invocation_short_name is defined... $ECHO_C" >&6 cat >"conftest.$ac_ext" <<_ACEOF #line 8707 "configure" #include "confdefs.h" #include int main (void) { program_invocation_short_name = "test"; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8719: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8722: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8725: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8728: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cat >>confdefs.h <<\EOF #define HAVE_PROGRAM_INVOCATION_SHORT_NAME 1 EOF echo "$as_me:8735: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 echo "$as_me:8740: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" echo "$as_me:8745: checking whether clearerr_unlocked is declared" >&5 echo $ECHO_N "checking whether clearerr_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_clearerr_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8751 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef clearerr_unlocked (void) clearerr_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8766: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8769: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8772: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8775: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_clearerr_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_clearerr_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:8785: result: $ac_cv_have_decl_clearerr_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_clearerr_unlocked" >&6 if test "$ac_cv_have_decl_clearerr_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether feof_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_feof_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8806 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef feof_unlocked (void) feof_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8821: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8824: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8827: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8830: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_feof_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_feof_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:8840: result: $ac_cv_have_decl_feof_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_feof_unlocked" >&6 if test "$ac_cv_have_decl_feof_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether ferror_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_ferror_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8861 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef ferror_unlocked (void) ferror_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8876: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8879: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8882: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8885: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_ferror_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_ferror_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:8895: result: $ac_cv_have_decl_ferror_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_ferror_unlocked" >&6 if test "$ac_cv_have_decl_ferror_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether fflush_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_fflush_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8916 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef fflush_unlocked (void) fflush_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8931: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8934: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8937: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8940: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_fflush_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_fflush_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:8950: result: $ac_cv_have_decl_fflush_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_fflush_unlocked" >&6 if test "$ac_cv_have_decl_fflush_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether fgets_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_fgets_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 8971 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef fgets_unlocked (void) fgets_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:8986: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:8989: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:8992: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8995: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_fgets_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_fgets_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9005: result: $ac_cv_have_decl_fgets_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_fgets_unlocked" >&6 if test "$ac_cv_have_decl_fgets_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether fputc_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_fputc_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9026 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef fputc_unlocked (void) fputc_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9041: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9044: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9047: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9050: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_fputc_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_fputc_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9060: result: $ac_cv_have_decl_fputc_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_fputc_unlocked" >&6 if test "$ac_cv_have_decl_fputc_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether fputs_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_fputs_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9081 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef fputs_unlocked (void) fputs_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9096: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9099: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9102: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9105: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_fputs_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_fputs_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9115: result: $ac_cv_have_decl_fputs_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_fputs_unlocked" >&6 if test "$ac_cv_have_decl_fputs_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether fread_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_fread_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9136 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef fread_unlocked (void) fread_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9151: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9154: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9157: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9160: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_fread_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_fread_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9170: result: $ac_cv_have_decl_fread_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_fread_unlocked" >&6 if test "$ac_cv_have_decl_fread_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether fwrite_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_fwrite_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9191 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef fwrite_unlocked (void) fwrite_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9206: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9209: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9212: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9215: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_fwrite_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_fwrite_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9225: result: $ac_cv_have_decl_fwrite_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_fwrite_unlocked" >&6 if test "$ac_cv_have_decl_fwrite_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether getc_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9246 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef getc_unlocked (void) getc_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9261: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9264: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9267: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9270: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_getc_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_getc_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9280: result: $ac_cv_have_decl_getc_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_getc_unlocked" >&6 if test "$ac_cv_have_decl_getc_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether getchar_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_getchar_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9301 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef getchar_unlocked (void) getchar_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9316: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9319: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9322: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9325: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_getchar_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_getchar_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9335: result: $ac_cv_have_decl_getchar_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_getchar_unlocked" >&6 if test "$ac_cv_have_decl_getchar_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether putc_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_putc_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9356 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef putc_unlocked (void) putc_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9371: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9374: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9377: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9380: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_putc_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_putc_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9390: result: $ac_cv_have_decl_putc_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_putc_unlocked" >&6 if test "$ac_cv_have_decl_putc_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether putchar_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_putchar_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9411 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef putchar_unlocked (void) putchar_unlocked; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9426: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9429: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9432: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9435: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_putchar_unlocked=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_putchar_unlocked=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9445: result: $ac_cv_have_decl_putchar_unlocked" >&5 echo "${ECHO_T}$ac_cv_have_decl_putchar_unlocked" >&6 if test "$ac_cv_have_decl_putchar_unlocked" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9469 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:9500: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:9503: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:9506: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9509: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:9519: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9538 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:9542: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:9548: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:9567: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for d_ino member in directory struct... $ECHO_C" >&6 if test "${jm_cv_struct_dirent_d_ino+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9583 "configure" #include "confdefs.h" #include #include int main (void) { struct dirent dp; dp.d_ino = 0; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:9598: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:9601: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:9604: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9607: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then jm_cv_struct_dirent_d_ino=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 jm_cv_struct_dirent_d_ino=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:9618: result: $jm_cv_struct_dirent_d_ino" >&5 echo "${ECHO_T}$jm_cv_struct_dirent_d_ino" >&6 if test $jm_cv_struct_dirent_d_ino = yes; then cat >>confdefs.h <<\EOF #define D_INO_IN_DIRENT 1 EOF fi echo "$as_me:9628: checking whether localtime_r is compatible with its POSIX signature" >&5 echo $ECHO_N "checking whether localtime_r is compatible with its POSIX signature... $ECHO_C" >&6 if test "${gl_cv_time_r_posix+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9634 "configure" #include "confdefs.h" #include int main (void) { /* We don't need to append 'restrict's to the argument types, even though the POSIX signature has the 'restrict's, since C99 says they can't affect type compatibility. */ struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r; if (ptr) return 0; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9650: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9653: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9656: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9659: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then gl_cv_time_r_posix=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 gl_cv_time_r_posix=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9669: result: $gl_cv_time_r_posix" >&5 echo "${ECHO_T}$gl_cv_time_r_posix" >&6 if test $gl_cv_time_r_posix = yes; then cat >>confdefs.h <<\EOF #define HAVE_TIME_R_POSIX 1 EOF else LIBOBJS="$LIBOBJS time_r.$ac_objext" fi echo "$as_me:9681: checking for struct tm.tm_gmtoff" >&5 echo $ECHO_N "checking for struct tm.tm_gmtoff... $ECHO_C" >&6 if test "${ac_cv_member_struct_tm_tm_gmtoff+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9687 "configure" #include "confdefs.h" #include int main (void) { static struct tm ac_aggr; if (ac_aggr.tm_gmtoff) return 0; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9702: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9705: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9708: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9711: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_member_struct_tm_tm_gmtoff=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_member_struct_tm_tm_gmtoff=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9721: result: $ac_cv_member_struct_tm_tm_gmtoff" >&5 echo "${ECHO_T}$ac_cv_member_struct_tm_tm_gmtoff" >&6 if test "$ac_cv_member_struct_tm_tm_gmtoff" = yes; then cat >>confdefs.h <<\EOF #define HAVE_TM_GMTOFF 1 EOF fi for ac_header in sysexits.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:9734: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9740 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:9744: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:9750: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:9769: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6 if test "${gt_cv_c_wchar_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9787 "configure" #include "confdefs.h" #include wchar_t foo = (wchar_t)'\0'; int main (void) { ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9800: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9803: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9806: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9809: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then gt_cv_c_wchar_t=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 gt_cv_c_wchar_t=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:9819: result: $gt_cv_c_wchar_t" >&5 echo "${ECHO_T}$gt_cv_c_wchar_t" >&6 if test $gt_cv_c_wchar_t = yes; then cat >>confdefs.h <<\EOF #define HAVE_WCHAR_T 1 EOF fi echo "$as_me:9829: checking for long long int" >&5 echo $ECHO_N "checking for long long int... $ECHO_C" >&6 if test "${ac_cv_type_long_long_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 9835 "configure" #include "confdefs.h" long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) ? 1 : -1)]; int i = 63; int main (void) { long long int llmax = 9223372036854775807ll; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) | (llmax / ll) | (llmax % ll)); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:9854: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:9857: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:9860: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9863: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then if test "$cross_compiling" = yes; then ac_cv_type_long_long_int=yes else cat >"conftest.$ac_ext" <<_ACEOF #line 9869 "configure" #include "confdefs.h" #include #ifndef LLONG_MAX # define HALF \ (1LL << (sizeof (long long int) * CHAR_BIT - 2)) # define LLONG_MAX (HALF - 1 + HALF) #endif int main (void) { long long int n = 1; int i; for (i = 0; ; i++) { long long int m = n << i; if (m >> i != n) return 1; if (LLONG_MAX / 2 < m) break; } return 0; ; return 0; } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:9896: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:9899: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:9901: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9904: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_type_long_long_int=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_type_long_long_int=no fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_type_long_long_int=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:9922: result: $ac_cv_type_long_long_int" >&5 echo "${ECHO_T}$ac_cv_type_long_long_int" >&6 if test $ac_cv_type_long_long_int = yes; then cat >>confdefs.h <<\EOF #define HAVE_LONG_LONG_INT 1 EOF fi ac_cv_type_long_long=$ac_cv_type_long_long_int if test $ac_cv_type_long_long = yes; then cat >>confdefs.h <<\EOF #define HAVE_LONG_LONG 1 EOF fi echo "$as_me:9941: checking for long double" >&5 echo $ECHO_N "checking for long double... $ECHO_C" >&6 if test "${gt_cv_c_long_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$GCC" = yes; then gt_cv_c_long_double=yes else cat >"conftest.$ac_ext" <<_ACEOF #line 9950 "configure" #include "confdefs.h" /* The Stardent Vistra knows sizeof(long double), but does not support it. */ long double foo = 0.0; /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ int array [2*(sizeof(long double) >= sizeof(double)) - 1]; int main (void) { ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:9967: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9970: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:9973: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:9976: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then gt_cv_c_long_double=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 gt_cv_c_long_double=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:9987: result: $gt_cv_c_long_double" >&5 echo "${ECHO_T}$gt_cv_c_long_double" >&6 if test $gt_cv_c_long_double = yes; then cat >>confdefs.h <<\EOF #define HAVE_LONG_DOUBLE 1 EOF fi LIBOBJS="$LIBOBJS cycle-check.$ac_objext" for ac_func in getdelim do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:10002: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 10008 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:10039: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:10042: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:10045: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10048: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:10058: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking whether getdelim is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_getdelim+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 10076 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef getdelim (void) getdelim; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:10091: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:10094: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:10097: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10100: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_getdelim=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_getdelim=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:10110: result: $ac_cv_have_decl_getdelim" >&5 echo "${ECHO_T}$ac_cv_have_decl_getdelim" >&6 if test "$ac_cv_have_decl_getdelim" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 10136 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:10167: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:10170: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:10173: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10176: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:10186: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking whether getline is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_getline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 10204 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef getline (void) getline; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:10219: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:10222: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:10225: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10228: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_getline=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_getline=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:10238: result: $ac_cv_have_decl_getline" >&5 echo "${ECHO_T}$ac_cv_have_decl_getline" >&6 if test "$ac_cv_have_decl_getline" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking for getline... $ECHO_C" >&6 if test "${ac_cv_func_getline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 10260 "configure" #include "confdefs.h" #define getline autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef getline #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getline (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_getline) || defined (__stub___getline) #error found stub for getline #endif return getline (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:10291: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:10294: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:10297: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10300: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_func_getline=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_func_getline=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:10310: result: $ac_cv_func_getline" >&5 echo "${ECHO_T}$ac_cv_func_getline" >&6 if test "$ac_cv_func_getline" = yes; then gl_getline_needs_run_time_check=yes else am_cv_func_working_getline=no fi if test $gl_getline_needs_run_time_check = yes; then echo "$as_me:10319: checking for working getline function" >&5 echo $ECHO_N "checking for working getline function... $ECHO_C" >&6 if test "${am_cv_func_working_getline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo fooN |tr -d '\012'|tr N '\012' > conftest.data if test "$cross_compiling" = yes; then cat >"conftest.$ac_ext" <<_ACEOF #line 10327 "configure" #include "confdefs.h" #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ >= 2) Lucky GNU user #endif #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky GNU user" >/dev/null 2>&1; then am_cv_func_working_getline=yes else am_cv_func_working_getline=no fi rm -rf conftest* else cat >"conftest.$ac_ext" <<_ACEOF #line 10348 "configure" #include "confdefs.h" # include # include # include int main () { /* Based on a test program from Karl Heuer. */ char *line = NULL; size_t siz = 0; int len; FILE *in = fopen ("./conftest.data", "r"); if (!in) return 1; len = getline (&line, &siz, in); exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1); } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:10368: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:10371: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:10373: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10376: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then am_cv_func_working_getline=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 am_cv_func_working_getline=no fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:10388: result: $am_cv_func_working_getline" >&5 echo "${ECHO_T}$am_cv_func_working_getline" >&6 fi if test $am_cv_func_working_getline = no; then cat >>confdefs.h <<\EOF #define getline gnu_getline EOF LIBOBJS="$LIBOBJS getline.$ac_objext" for ac_func in getdelim do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:10403: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 10409 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:10440: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:10443: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:10446: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10449: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:10459: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking whether getdelim is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_getdelim+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 10477 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef getdelim (void) getdelim; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:10492: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:10495: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:10498: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10501: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_getdelim=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_getdelim=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:10511: result: $ac_cv_have_decl_getdelim" >&5 echo "${ECHO_T}$ac_cv_have_decl_getdelim" >&6 if test "$ac_cv_have_decl_getdelim" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 10537 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:10568: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:10571: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:10574: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10577: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:10587: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&6 echo "${as_me:-configure}:10603: testing add replacement for filenamecat ..." 1>&5 LIBOBJS="$LIBOBJS filenamecat.$ac_objext" test -n "$verbose" && echo " add replacement for strchrnul" 1>&6 echo "${as_me:-configure}:10609: testing add replacement for strchrnul ..." 1>&5 LIBOBJS="$LIBOBJS strchrnul.$ac_objext" test -n "$verbose" && echo " add replacement for mempcpy" 1>&6 echo "${as_me:-configure}:10615: testing add replacement for mempcpy ..." 1>&5 LIBOBJS="$LIBOBJS mempcpy.$ac_objext" test -n "$verbose" && echo " add replacement for strnlen" 1>&6 echo "${as_me:-configure}:10621: testing add replacement for strnlen ..." 1>&5 LIBOBJS="$LIBOBJS strnlen.$ac_objext" LIBOBJS="$LIBOBJS xmalloc.$ac_objext" : : echo "$as_me:10631: checking whether getcwd (NULL, 0) allocates memory for result" >&5 echo $ECHO_N "checking whether getcwd (NULL, 0) allocates memory for result... $ECHO_C" >&6 if test "${gl_cv_func_getcwd_null+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then gl_cv_func_getcwd_null=no else cat >"conftest.$ac_ext" <<_ACEOF #line 10640 "configure" #include "confdefs.h" # include # include # ifndef getcwd char *getcwd (); # endif int main () { if (chdir ("/") != 0) exit (1); else { char *f = getcwd (NULL, 0); exit (! (f && f[0] == '/' && !f[1])); } } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:10661: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:10664: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:10666: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10669: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then gl_cv_func_getcwd_null=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 gl_cv_func_getcwd_null=no fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:10681: result: $gl_cv_func_getcwd_null" >&5 echo "${ECHO_T}$gl_cv_func_getcwd_null" >&6 gl_abort_bug=no case $gl_cv_func_getcwd_null in yes) echo "$as_me:10688: checking whether getcwd is declared" >&5 echo $ECHO_N "checking whether getcwd is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_getcwd+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 10694 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef getcwd (void) getcwd; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:10709: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:10712: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:10715: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10718: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_getcwd=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_getcwd=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:10728: result: $ac_cv_have_decl_getcwd" >&5 echo "${ECHO_T}$ac_cv_have_decl_getcwd" >&6 if test "$ac_cv_have_decl_getcwd" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking whether getcwd handles long file names properly... $ECHO_C" >&6 if test "${gl_cv_func_getcwd_path_max+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Arrange for deletion of the temporary directory this test creates. ac_clean_files="$ac_clean_files confdir3" if test "$cross_compiling" = yes; then gl_cv_func_getcwd_path_max=no else cat >"conftest.$ac_ext" <<_ACEOF #line 10754 "configure" #include "confdefs.h" #include #include #include #include #include #include #include #include #ifndef AT_FDCWD # define AT_FDCWD 0 #endif #ifdef ENAMETOOLONG # define is_ENAMETOOLONG(x) ((x) == ENAMETOOLONG) #else # define is_ENAMETOOLONG(x) 0 #endif /* Don't get link errors because mkdir is redefined to rpl_mkdir. */ #undef mkdir #ifndef S_IRWXU # define S_IRWXU 0700 #endif /* The length of this name must be 8. */ #define DIR_NAME "confdir3" #define DIR_NAME_LEN 8 #define DIR_NAME_SIZE (DIR_NAME_LEN + 1) /* The length of "../". */ #define DOTDOTSLASH_LEN 3 /* Leftover bytes in the buffer, to work around library or OS bugs. */ #define BUF_SLOP 20 int main () { #ifndef PATH_MAX /* The Hurd doesn't define this, so getcwd can't exhibit the bug -- at least not on a local file system. And if we were to start worrying about remote file systems, we'd have to enable the wrapper function all of the time, just to be safe. That's not worth the cost. */ exit (0); #elif ((INT_MAX / (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) \ - DIR_NAME_SIZE - BUF_SLOP) \ <= PATH_MAX) /* FIXME: Assuming there's a system for which this is true, this should be done in a compile test. */ exit (0); #else char buf[PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) + DIR_NAME_SIZE + BUF_SLOP]; char *cwd = getcwd (buf, PATH_MAX); size_t initial_cwd_len; size_t cwd_len; int fail = 0; size_t n_chdirs = 0; if (cwd == NULL) exit (1); cwd_len = initial_cwd_len = strlen (cwd); while (1) { size_t dotdot_max = PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN); char *c = NULL; cwd_len += DIR_NAME_SIZE; /* If mkdir or chdir fails, it could be that this system cannot create any file with an absolute name longer than PATH_MAX, such as cygwin. If so, leave fail as 0, because the current working directory can't be too long for getcwd if it can't even be created. For other errors, be pessimistic and consider that as a failure, too. */ if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0) { if (! (errno == ERANGE || is_ENAMETOOLONG (errno))) fail = 2; break; } if (PATH_MAX <= cwd_len && cwd_len < PATH_MAX + DIR_NAME_SIZE) { c = getcwd (buf, PATH_MAX); if (!c && errno == ENOENT) { fail = 1; break; } if (c || ! (errno == ERANGE || is_ENAMETOOLONG (errno))) { fail = 2; break; } } if (dotdot_max <= cwd_len - initial_cwd_len) { if (dotdot_max + DIR_NAME_SIZE < cwd_len - initial_cwd_len) break; c = getcwd (buf, cwd_len + 1); if (!c) { if (! (errno == ERANGE || errno == ENOENT || is_ENAMETOOLONG (errno))) { fail = 2; break; } if (AT_FDCWD || errno == ERANGE || errno == ENOENT) { fail = 1; break; } } } if (c && strlen (c) != cwd_len) { fail = 2; break; } ++n_chdirs; } /* Leaving behind such a deep directory is not polite. So clean up here, right away, even though the driving shell script would also clean up. */ { size_t i; /* Try rmdir first, in case the chdir failed. */ rmdir (DIR_NAME); for (i = 0; i <= n_chdirs; i++) { if (chdir ("..") < 0) break; rmdir (DIR_NAME); } } exit (fail); #endif } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:10906: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:10909: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:10911: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10914: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then gl_cv_func_getcwd_path_max=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 case $? in 1) gl_cv_func_getcwd_path_max='no, but it is partly working';; *) gl_cv_func_getcwd_path_max=no;; esac fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:10930: result: $gl_cv_func_getcwd_path_max" >&5 echo "${ECHO_T}$gl_cv_func_getcwd_path_max" >&6 case $gl_cv_func_getcwd_path_max in no,*) cat >>confdefs.h <<\EOF #define HAVE_PARTLY_WORKING_GETCWD 1 EOF ;; esac echo "$as_me:10941: checking whether getcwd is declared" >&5 echo $ECHO_N "checking whether getcwd is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_getcwd+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 10947 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef getcwd (void) getcwd; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:10962: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:10965: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:10968: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:10971: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_getcwd=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_getcwd=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:10981: result: $ac_cv_have_decl_getcwd" >&5 echo "${ECHO_T}$ac_cv_have_decl_getcwd" >&6 if test "$ac_cv_have_decl_getcwd" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 11005 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:11036: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:11039: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:11042: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11045: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:11055: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking whether getcwd aborts when 4k < cwd_length < 16k... $ECHO_C" >&6 if test "${gl_cv_func_getcwd_abort_bug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Remove any remnants of a previous test. rm -rf confdir-14B--- # Arrange for deletion of the temporary directory this test creates. ac_clean_files="$ac_clean_files confdir-14B---" if test "$cross_compiling" = yes; then gl_cv_func_getcwd_abort_bug=yes else cat >"conftest.$ac_ext" <<_ACEOF #line 11078 "configure" #include "confdefs.h" #include #include #include #include #include /* Don't get link errors because mkdir is redefined to rpl_mkdir. */ #undef mkdir #ifndef S_IRWXU # define S_IRWXU 0700 #endif /* FIXME: skip the run-test altogether on systems without getpagesize. */ #if ! HAVE_GETPAGESIZE # define getpagesize() 0 #endif /* This size is chosen to be larger than PATH_MAX (4k), yet smaller than the 16kB pagesize on ia64 linux. Those conditions make the code below trigger a bug in glibc's getcwd implementation before 2.4.90-10. */ #define TARGET_LEN (5 * 1024) int main () { char const *dir_name = "confdir-14B---"; char *cwd; size_t initial_cwd_len; int fail = 0; size_t desired_depth; size_t d; /* The bug is triggered when PATH_MAX < getpagesize (), so skip this relative expensive and invasive test if that's not true. */ if (getpagesize () <= PATH_MAX) return 0; cwd = getcwd (NULL, 0); if (cwd == NULL) return 0; initial_cwd_len = strlen (cwd); free (cwd); desired_depth = ((TARGET_LEN - 1 - initial_cwd_len) / (1 + strlen (dir_name))); for (d = 0; d < desired_depth; d++) { if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0) { fail = 3; /* Unable to construct deep hierarchy. */ break; } } /* If libc has the bug in question, this invocation of getcwd results in a failed assertion. */ cwd = getcwd (NULL, 0); if (cwd == NULL) fail = 4; /* getcwd failed. This is ok, and expected. */ free (cwd); /* Call rmdir first, in case the above chdir failed. */ rmdir (dir_name); while (0 < d--) { if (chdir ("..") < 0) break; rmdir (dir_name); } return 0; } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:11157: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:11160: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:11162: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11165: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then gl_cv_func_getcwd_abort_bug=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 gl_cv_func_getcwd_abort_bug=yes fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:11178: result: $gl_cv_func_getcwd_abort_bug" >&5 echo "${ECHO_T}$gl_cv_func_getcwd_abort_bug" >&6 if test $gl_cv_func_getcwd_abort_bug = yes; then gl_abort_bug=yes fi ;; esac case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_path_max,$gl_abort_bug in yes,yes,no) ;; *) LIBOBJS="$LIBOBJS getcwd.$ac_objext" cat >>confdefs.h <<\EOF #define __GETCWD_PREFIX rpl_ EOF : ;; esac LIBOBJS="$LIBOBJS xgetcwd.$ac_objext" echo "$as_me:11202: checking for ssize_t" >&5 echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6 if test "${gt_cv_ssize_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 11208 "configure" #include "confdefs.h" #include int main (void) { int x = sizeof (ssize_t *) + sizeof (ssize_t); return !x; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:11221: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:11224: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:11227: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11230: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then gt_cv_ssize_t=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 gt_cv_ssize_t=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:11240: result: $gt_cv_ssize_t" >&5 echo "${ECHO_T}$gt_cv_ssize_t" >&6 if test $gt_cv_ssize_t = no; then cat >>confdefs.h <<\EOF #define ssize_t int EOF fi LIBOBJS="$LIBOBJS xreadlink.$ac_objext" LIBOBJS="$LIBOBJS canonicalize.$ac_objext" for ac_header in sys/param.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:11257: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 11263 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:11267: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:11273: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:11292: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking whether canonicalize_file_name is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_canonicalize_file_name+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 11308 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef canonicalize_file_name (void) canonicalize_file_name; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:11323: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:11326: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:11329: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11332: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_canonicalize_file_name=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_canonicalize_file_name=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:11342: result: $ac_cv_have_decl_canonicalize_file_name" >&5 echo "${ECHO_T}$ac_cv_have_decl_canonicalize_file_name" >&6 if test "$ac_cv_have_decl_canonicalize_file_name" = yes; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 11366 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:11397: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:11400: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:11403: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11406: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:11416: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <>confdefs.h <<\EOF #define PROVIDE_CANONICALIZE_FILENAME_MODE 1 EOF echo "$as_me:11430: checking for error module" >&5 echo $ECHO_N "checking for error module... $ECHO_C" >&6 cat >"conftest.$ac_ext" <<_ACEOF #line 11433 "configure" #include "confdefs.h" $ac_includes_default #include int main (void) { error (0, 1, "testing: %d", 2); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:11448: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:11451: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:11454: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11457: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_have_func_error=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_have_func_error=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" echo "$as_me:11466: result: $cf_have_func_error" >&5 echo "${ECHO_T}$cf_have_func_error" >&6 if test "$cf_have_func_error" = no; then LIBOBJS="$LIBOBJS error.$ac_objext" fi echo "$as_me:11472: checking for obstack module" >&5 echo $ECHO_N "checking for obstack module... $ECHO_C" >&6 cat >"conftest.$ac_ext" <<_ACEOF #line 11475 "configure" #include "confdefs.h" $ac_includes_default #include int main (void) { struct obstack *data = 0; __obstack_free(data, 0); (void) data; ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:11492: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:11495: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:11498: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11501: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_have_func_obstack=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_have_func_obstack=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" echo "$as_me:11510: result: $cf_have_func_obstack" >&5 echo "${ECHO_T}$cf_have_func_obstack" >&6 if test "$cf_have_func_obstack" = no; then LIBOBJS="$LIBOBJS obstack.$ac_objext" fi # Checks for library functions. for ac_header in langinfo.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:11521: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 11527 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:11531: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:11537: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:11556: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for nl_langinfo in langinfo.h... $ECHO_C" >&6 if test "${mac_cv_have_nl_langinfo+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 11574 "configure" #include "confdefs.h" #include int main (void) { char* am = nl_langinfo(AM_STR); char* pm = nl_langinfo(PM_STR); char* m1 = nl_langinfo(MON_1); char* am1 = nl_langinfo(ABMON_1); char* d1 = nl_langinfo(DAY_1); char* ad1 = nl_langinfo(ABDAY_1); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:11595: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:11598: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:11601: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11604: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then mac_cv_have_nl_langinfo=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 mac_cv_have_nl_langinfo=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:11616: result: $mac_cv_have_nl_langinfo" >&5 echo "${ECHO_T}$mac_cv_have_nl_langinfo" >&6 if test "$mac_cv_have_nl_langinfo" = yes; then echo "$as_me:11619: checking for decimal point constant for nl_langinfo" >&5 echo $ECHO_N "checking for decimal point constant for nl_langinfo... $ECHO_C" >&6 if test "${mac_cv_nl_langinfo_dp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 11626 "configure" #include "confdefs.h" #include int main (void) { char* dp = nl_langinfo(DECIMAL_POINT); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:11642: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:11645: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:11648: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11651: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then mac_cv_nl_langinfo_dp=DECIMAL_POINT else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cat >"conftest.$ac_ext" <<_ACEOF #line 11658 "configure" #include "confdefs.h" #include int main (void) { char* dp = nl_langinfo(RADIXCHAR); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:11674: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:11677: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:11680: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11683: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then mac_cv_nl_langinfo_dp=RADIXCHAR else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 mac_cv_have_nl_langinfo=unknown fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:11697: result: $mac_cv_nl_langinfo_dp" >&5 echo "${ECHO_T}$mac_cv_nl_langinfo_dp" >&6 else mac_cv_nl_langinfo_dp=unknown fi if test "$mac_cv_have_nl_langinfo" != no; then cat >>confdefs.h <<\EOF #define HAVE_NL_LANGINFO 1 EOF fi if test "$mac_cv_nl_langinfo_dp" != unknown; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 11727 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:11731: \"$ac_cpp "conftest.$ac_ext"\"") >&5 (eval $ac_cpp "conftest.$ac_ext") 2>conftest.er1 ac_status=$? $EGREP -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:11737: \$? = $ac_status" >&5 (exit "$ac_status"); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_Header=no" fi rm -f conftest.err "conftest.$ac_ext" fi echo "$as_me:11756: result: `eval echo '${'"$as_ac_Header"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_Header"'}'`" >&6 if test "`eval echo '${'"$as_ac_Header"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 11775 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (void); int main (void) { /* The GNU C library defines stubs for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:11806: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:11809: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:11812: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11815: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 eval "$as_ac_var=no" fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:11825: result: `eval echo '${'"$as_ac_var"'}'`" >&5 echo "${ECHO_T}`eval echo '${'"$as_ac_var"'}'`" >&6 if test "`eval echo '${'"$as_ac_var"'}'`" = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else cat >"conftest.$ac_ext" <<_ACEOF #line 11844 "configure" #include "confdefs.h" $ac_includes_default /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !STDC_HEADERS && !HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #if !HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ # if !HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # if HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main (void) { char *data, *data2, *data3; int i, pagesize; int fd; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) $ac_main_return (1); for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) $ac_main_return (1); if (write (fd, data, pagesize) != pagesize) $ac_main_return (1); close (fd); /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) $ac_main_return (1); data2 = (char *) malloc (2 * pagesize); if (!data2) $ac_main_return (1); data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) $ac_main_return (1); for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) $ac_main_return (1); /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) $ac_main_return (1); if (read (fd, data3, pagesize) != pagesize) $ac_main_return (1); for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) $ac_main_return (1); close (fd); $ac_main_return (0); } _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:11971: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:11974: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:11976: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:11979: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_func_mmap_fixed_mapped=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_func_mmap_fixed_mapped=no fi rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" "conftest.$ac_ext" fi fi echo "$as_me:11991: result: $ac_cv_func_mmap_fixed_mapped" >&5 echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 if test $ac_cv_func_mmap_fixed_mapped = yes; then cat >>confdefs.h <<\EOF #define HAVE_MMAP 1 EOF fi rm -f conftest.mmap echo "$as_me:12002: checking for long file names" >&5 echo $ECHO_N "checking for long file names... $ECHO_C" >&6 if test "${ac_cv_sys_long_file_names+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_sys_long_file_names=yes # Test for long file names in all the places we know might matter: # . the current directory, where building will happen # $prefix/lib where we will be installing things # $exec_prefix/lib likewise # eval it to expand exec_prefix. # $TMPDIR if set, where it might want to write temporary files # if $TMPDIR is not set: # /tmp where it might want to write temporary files # /var/tmp likewise # /usr/tmp likewise if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then ac_tmpdirs=$TMPDIR else ac_tmpdirs='/tmp /var/tmp /usr/tmp' fi for ac_dir in . $ac_tmpdirs `eval echo "$prefix/lib" "$exec_prefix/lib"` ; do test -d "$ac_dir" || continue test -w "$ac_dir" || continue # It is less confusing to not echo anything here. ac_xdir=$ac_dir/cf$$ (umask 077 && mkdir "$ac_xdir" 2>/dev/null) || continue ac_tf1=$ac_xdir/conftest9012345 ac_tf2=$ac_xdir/conftest9012346 (echo 1 >"$ac_tf1") 2>/dev/null (echo 2 >"$ac_tf2") 2>/dev/null ac_val=`cat "$ac_tf1" 2>/dev/null` if test ! -f "$ac_tf1" || test "$ac_val" != 1; then ac_cv_sys_long_file_names=no rm -rf "$ac_xdir" 2>/dev/null break fi rm -rf "$ac_xdir" 2>/dev/null done fi echo "$as_me:12041: result: $ac_cv_sys_long_file_names" >&5 echo "${ECHO_T}$ac_cv_sys_long_file_names" >&6 if test "$ac_cv_sys_long_file_names" = yes; then cat >>confdefs.h <<\EOF #define HAVE_LONG_FILE_NAMES 1 EOF fi FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR=$ac_fs_backslash_is_file_name_separator # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" fi; case "$enable_debug" in no|"") cat >>confdefs.h <<\EOF #define NDEBUG 1 EOF ;; *) ;; esac # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" fi; case "$enable_profile" in no|"") ;; *) if test "$GCC" != "yes"; then { { echo "$as_me:12080: error: I can only use profiling on GCC" >&5 echo "$as_me: error: I can only use profiling on GCC" >&2;} { (exit 1); exit 1; }; } fi CFLAGS=`echo $CFLAGS -pg -fprofile-arcs -ftest-coverage | sed -e s,-O2,-O0,` LDFLAGS="$LDFLAGS -pg -fprofile-arcs -ftest-coverage" ;; esac # Check whether --enable-fastexit or --disable-fastexit was given. if test "${enable_fastexit+set}" = set; then enableval="$enable_fastexit" fi; case "$enable_fastexit" in yes|"") cat >>confdefs.h <<\EOF #define FASTEXIT 1 EOF FASTEXIT=1 ;; *) FASTEXIT=0 ;; esac CFLAGS=`echo $CFLAGS | sed -e s,-O2,-O3,` NEWS=NEWS ac_config_files="$ac_config_files Makefile doc/Makefile lib/Makefile src/Makefile tests/Makefile tests/atlocal" echo "creating tests/atconfig" cat >tests/atconfig <confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H : "${CONFIG_STATUS=./config.status}" ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:12211: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >"$CONFIG_STATUS" <<_ACEOF #! $SHELL # Generated automatically by configure. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. me=\`echo "\$0" | sed -e 's,.*\\/,,'\` debug=false SHELL=\${CONFIG_SHELL-$SHELL} ac_cs_invocation="\$0 \$@" CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS _ACEOF cat >>"$CONFIG_STATUS" <<\_ACEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr="expr" else as_expr="false" fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln' else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset="unset" else as_unset="false" fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } exec 6>&1 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>"$CONFIG_STATUS" fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>"$CONFIG_STATUS" fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>"$CONFIG_STATUS" fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>"$CONFIG_STATUS" fi cat >>"$CONFIG_STATUS" <<\EOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -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 --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." EOF cat >>"$CONFIG_STATUS" <>"$CONFIG_STATUS" <<\EOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` shift set dummy "$ac_option" "$ac_optarg" ${1+"$@"} shift ;; -*);; *) # This is not an option, so the user has probably given explicit # arguments. ac_need_defaults=false;; esac case $1 in # Handling of the options. EOF cat >>"$CONFIG_STATUS" <>"$CONFIG_STATUS" <<\EOF --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:12389: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) shift CONFIG_FILES="$CONFIG_FILES $1" ac_need_defaults=false;; --header | --heade | --head | --hea ) shift CONFIG_HEADERS="$CONFIG_HEADERS $1" ac_need_defaults=false;; # This is an error. -*) { { echo "$as_me:12408: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done exec 5>>config.log cat >&5 << _ACEOF ## ----------------------- ## ## Running config.status. ## ## ----------------------- ## This file was extended by $as_me (blame 1.4) 2.52.20231210, executed with CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS > "$ac_cs_invocation" on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF EOF cat >>"$CONFIG_STATUS" <<\EOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "tests/atlocal" ) CONFIG_FILES="$CONFIG_FILES tests/atlocal" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:12450: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if "$ac_need_defaults"; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. : "${TMPDIR=/tmp}" { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=$TMPDIR/cs$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } EOF cat >>"$CONFIG_STATUS" <"\$tmp"/subs.sed <<\\CEOF s,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_LIBS@,$X_LIBS,;t t s,@SHELL@,$SHELL,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datarootdir@,$datarootdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@runstatedir@,$runstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@DEFS@,$DEFS,;t t s,@LIBS@,$LIBS,;t t s,@PACKAGE_DATE@,$PACKAGE_DATE,;t t s,@GREP@,$GREP,;t t s,@EGREP@,$EGREP,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t s,@LEX@,$LEX,;t t s,@LEXLIB@,$LEXLIB,;t t s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t s,@YACC@,$YACC,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@AWK@,$AWK,;t t s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t s,@ARFLAGS@,$ARFLAGS,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@STDBOOL_H@,$STDBOOL_H,;t t s,@HAVE__BOOL@,$HAVE__BOOL,;t t s,@ECHO_LT@,$ECHO_LT,;t t s,@ECHO_LD@,$ECHO_LD,;t t s,@RULE_CC@,$RULE_CC,;t t s,@SHOW_CC@,$SHOW_CC,;t t s,@ECHO_CC@,$ECHO_CC,;t t s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t s,@FGREP@,$FGREP,;t t s,@HAVE_STDNORETURN_H@,$HAVE_STDNORETURN_H,;t t s,@STDC_NORETURN@,$STDC_NORETURN,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@ALLOCA@,$ALLOCA,;t t s,@ALLOCA_H@,$ALLOCA_H,;t t s,@GETOPT_H@,$GETOPT_H,;t t s,@SYSEXITS_H@,$SYSEXITS_H,;t t s,@FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR@,$FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR,;t t s,@FASTEXIT@,$FASTEXIT,;t t /@NEWS@/r $NEWS s,@NEWS@,,;t t CEOF EOF cat >>"$CONFIG_STATUS" <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while "$ac_more_lines"; do if test "$ac_beg" -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" "$tmp"/subs.sed >"$tmp"/subs.frag else sed "${ac_end}q" "$tmp"/subs.sed >"$tmp"/subs.frag fi if test ! -s "$tmp"/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat "$tmp"/subs.frag) >"$tmp"/subs-$ac_sed_frag.sed # It is possible to make a multiline substitution using escaped newlines. # Ensure that we do not split the substitution between script fragments. ac_BEG=$ac_end ac_END=`expr "$ac_end" + "$ac_max_sed_lines"` sed "1,${ac_BEG}d; ${ac_END}p; q" "$tmp"/subs.sed >"$tmp"/subs.next if test -s "$tmp"/subs.next; then grep '^s,@[^@,][^@,]*@,.*\\$' "$tmp"/subs.next >"$tmp"/subs.edit if test ! -s "$tmp"/subs.edit; then grep "^s,@[^@,][^@,]*@,.*,;t t$" "$tmp"/subs.next >"$tmp"/subs.edit if test ! -s "$tmp"/subs.edit; then if test "$ac_beg" -gt 1; then ac_end=`expr "$ac_end" - 1` continue fi fi fi fi if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f \"$tmp\"/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f \"$tmp\"/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr "$ac_sed_frag" + 1` ac_beg=$ac_end ac_end=`expr "$ac_end" + "$ac_max_sed_lines"` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds="cat" fi fi # test -n "$CONFIG_FILES" EOF cat >>"$CONFIG_STATUS" <<\EOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - | *:- | *:-:* ) # input from stdin cat >"$tmp"/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } ac_dir_suffix="/`echo "$ac_dir"|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` else ac_dir_suffix= ac_dots= fi case "$srcdir" in .) ac_srcdir=. if test -z "$ac_dots"; then ac_top_srcdir=. else ac_top_srcdir=`echo "$ac_dots" | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) ac_srcdir="$srcdir$ac_dir_suffix"; ac_top_srcdir="$srcdir" ;; *) # Relative path. ac_srcdir="$ac_dots$srcdir$ac_dir_suffix" ac_top_srcdir="$ac_dots$srcdir" ;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_dots$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:12722: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated automatically by config.status. */ configure_input="Generated automatically from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo "$tmp"/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:12740: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:12753: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } EOF cat >>"$CONFIG_STATUS" <<\EOF ac_warn_datarootdir=no if test x"$ac_file" != x-; then for ac_item in $ac_file_inputs do ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' "$ac_item"` if test -n "$ac_seen"; then ac_used=`grep '@datarootdir@' "$ac_item"` if test -z "$ac_used"; then { echo "$as_me:12769: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&2;} ac_warn_datarootdir=yes fi fi ac_seen=`grep '${datarootdir}' "$ac_item"` if test -n "$ac_seen"; then { echo "$as_me:12778: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&2;} ac_warn_datarootdir=yes fi done fi if test "x$ac_warn_datarootdir" = xyes; then ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" fi EOF cat >>"$CONFIG_STATUS" <>"$CONFIG_STATUS" <<\EOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >"$tmp"/out rm -f "$tmp"/stdin EOF test -n "${FGREP}" || FGREP="grep -F" test -n "${EGREP}" || EGREP="grep -E" cat >>"$CONFIG_STATUS" <>"$CONFIG_STATUS" <<\EOF if test x"$ac_file" != x-; then cp "$tmp/out" "$ac_file" for ac_name in prefix exec_prefix datarootdir do ac_seen=`$FGREP -n '${'$ac_name'[:=].*}' "$ac_file"` if test -n "$ac_seen"; then ac_init=`$EGREP '[ ]*'$ac_name'[ ]*=' "$ac_file"` if test -z "$ac_init"; then ac_seen=`echo "$ac_seen" |sed -e 's,^,'"$ac_file"':,'` { echo "$as_me:12823: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&5 echo "$as_me: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&2;} fi fi done $EGREP -n '@[a-z_][a-z_0-9]+@' "$ac_file" >"$tmp"/out $EGREP -n '@[A-Z_][A-Z_0-9]+@' "$ac_file" >>"$tmp"/out if test -s "$tmp"/out; then ac_seen=`sed -e 's,^,'"$ac_file"':,' < "$tmp"/out` { echo "$as_me:12834: WARNING: Some variables may not be substituted: $ac_seen" >&5 echo "$as_me: WARNING: Some variables may not be substituted: $ac_seen" >&2;} fi else cat "$tmp"/out fi rm -f "$tmp"/out done EOF cat >>"$CONFIG_STATUS" <<\EOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_i turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_iA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_iB='\([ ]\),\1#\2define\3' ac_iC=' ' ac_iD='\4,;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - | *:- | *:-:* ) # input from stdin cat >"$tmp"/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:12883: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo "$tmp"/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:12894: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:12907: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >"$tmp"/in EOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\EOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end EOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs sed 's/ac_d/ac_i/g' conftest.defines >>conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\EOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, EOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>"$CONFIG_STATUS" echo ' test -n "${EGREP}" || EGREP="grep -E"' >>"$CONFIG_STATUS" echo ' if ${EGREP} "^[ ]*#[ ]*define" "$tmp"/in >/dev/null; then' >>"$CONFIG_STATUS" echo ' # If there are no defines, we may have an empty if/fi' >>"$CONFIG_STATUS" echo ' :' >>"$CONFIG_STATUS" rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to "$tmp"/defines.sed. echo ' cat >"$tmp"/defines.sed <>"$CONFIG_STATUS" # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>"$CONFIG_STATUS" # Work around the forget-to-reset-the-flag bug. echo 't clr' >>"$CONFIG_STATUS" echo ': clr' >>"$CONFIG_STATUS" sed "${ac_max_here_lines}q" conftest.defines >>"$CONFIG_STATUS" echo 'CEOF sed -f "$tmp"/defines.sed "$tmp"/in >"$tmp"/out rm -f "$tmp"/in mv "$tmp"/out "$tmp"/in ' >>"$CONFIG_STATUS" sed "1,${ac_max_here_lines}d" conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>"$CONFIG_STATUS" echo >>"$CONFIG_STATUS" # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>"$CONFIG_STATUS" rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to "$tmp"/undefs.sed. echo ' cat >"$tmp"/undefs.sed <>"$CONFIG_STATUS" # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>"$CONFIG_STATUS" # Work around the forget-to-reset-the-flag bug. echo 't clr' >>"$CONFIG_STATUS" echo ': clr' >>"$CONFIG_STATUS" sed "${ac_max_here_lines}q" conftest.undefs >>"$CONFIG_STATUS" echo 'CEOF sed -f "$tmp"/undefs.sed "$tmp"/in >"$tmp"/out rm -f "$tmp"/in mv "$tmp"/out "$tmp"/in ' >>"$CONFIG_STATUS" sed "1,${ac_max_here_lines}d" conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>"$CONFIG_STATUS" <<\EOF # 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 automatically by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated automatically by configure. */" >"$tmp"/config.h else echo "/* $ac_file. Generated automatically by configure. */" >"$tmp"/config.h fi cat "$tmp"/in >>"$tmp"/config.h rm -f "$tmp"/in if test x"$ac_file" != x-; then if cmp -s "$ac_file" "$tmp/config.h" 2>/dev/null; then { echo "$as_me:13026: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } fi rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" fi else cat "$tmp"/config.h rm -f "$tmp"/config.h fi done EOF cat >>"$CONFIG_STATUS" <<\EOF { (exit 0); exit 0; } EOF chmod +x "$CONFIG_STATUS" ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: exec 5>/dev/null $SHELL "$CONFIG_STATUS" || 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