Browse Source

Use estream for beter portability and future use of the complete estream
library in case we want to funopen stuff.
Build systems updates.

Werner Koch 16 years ago
parent
commit
d106a03b8c
21 changed files with 3274 additions and 897 deletions
  1. 26 0
      ChangeLog
  2. 1 1
      Makefile.am
  3. 3 2
      README
  4. 2 0
      TODO
  5. 236 285
      config.guess
  6. 48 154
      config.sub
  7. 12 5
      configure.ac
  8. 638 111
      ltmain.sh
  9. 2 0
      m4/Makefile.am
  10. 48 0
      m4/estream.m4
  11. 2 1
      src/Makefile.am
  12. 1 1
      src/agent.c
  13. 2110 0
      src/estream-printf.c
  14. 110 0
      src/estream-printf.h
  15. 0 45
      src/realloc.c
  16. 14 7
      src/slots.c
  17. 0 47
      src/stpcpy.c
  18. 0 41
      src/stpcpy.h
  19. 19 3
      src/support.h
  20. 0 192
      src/vasprintf.c
  21. 2 2
      src/versioninfo.rc.in

+ 26 - 0
ChangeLog

@@ -14,6 +14,32 @@
 	(LTRCCOMPILE): Use it here.
 	(.rc.lo): Add quoting.
 
+2009-06-19  Werner Koch  <wk@g10code.com>
+
+	* src/estream-printf.c, src/estream-printf.h: New.
+	* src/Makefile.am (sources): Add them.
+	* Makefile.am (SUBDIRS): Add m4/.
+	* m4/Makefile.am: New.
+	* m4/estream.m4: New.
+	* configure.ac (AC_REPLACE_FUNCS): Remove.
+	(estream_PRINTF_INIT): Add.
+	(AH_BOTTOM):  Prefix estream fucntions.
+	(AC_FUNC_REALLOC) Remove because it uses AC_LIBOBJ which as
+	problems with the current libtool.  The GNU guarantees for realloc
+	don't seem to be needed.
+
+	* src/realloc.c:  Remove
+	* src/vasprintf.c, src/stpcpy.c, src/stpcpy.h: Remove.
+	* src/support.h: Do not include stpcpy.h but define it inline.
+	Include estream-printf.h.
+	(vasprintf, asprintf, snprintf): Redefine to estream functions
+	
+	* src/agent.c (scute_agent_sign): s/sprintf/vsnprintf/.
+
+2009-06-18  Werner Koch  <wk@g10code.com>
+
+	* src/slots.c (slot_token_manufacturer): Update list.
+
 2009-04-23  Werner Koch  <wk@g10code.com>
 
 	* src/error-mapping.c (scute_gpg_err_to_ck): Add mappings to

+ 1 - 1
Makefile.am

@@ -39,4 +39,4 @@ else
 tests = 
 endif
 
-SUBDIRS = src ${tests} doc
+SUBDIRS = m4 src ${tests} doc

+ 3 - 2
README

@@ -58,8 +58,9 @@ visiting the preferences dialog in the "advanced" category, under
 installed path, e.g. "/usr/lib/libscute.so".
 
 Note that for the module load to complete successfully, the GPG Agent
-must be running and available.  This means that Mozilla needs to have
-the GPG_AGENT_INFO variable set correctly in its environment.
+must be running and available.  On Unix systems this means that
+Mozilla needs to have the GPG_AGENT_INFO variable set correctly in its
+environment.
 
 
 Client Authentication

+ 2 - 0
TODO

@@ -1,3 +1,5 @@
+# Emacs, please get me into -*- org -*- mode.
+
 * Manual:
 ** Some FIXME's which need attention.
 ** The pictures in PDF output are blurry.

File diff suppressed because it is too large
+ 236 - 285
config.guess


+ 48 - 154
config.sub

@@ -1,10 +1,9 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-#   Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
-timestamp='2008-01-16'
+timestamp='2004-06-24'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -22,15 +21,14 @@ timestamp='2008-01-16'
 #
 # 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.
-#
+# 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.
 
-
 # Please send patches to <config-patches@gnu.org>.  Submit a context
 # diff and a properly formatted ChangeLog entry.
 #
@@ -72,8 +70,8 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+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."
@@ -85,11 +83,11 @@ Try \`$me --help' for more information."
 while test $# -gt 0 ; do
   case $1 in
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
+       echo "$timestamp" ; exit 0 ;;
     --version | -v )
-       echo "$version" ; exit ;;
+       echo "$version" ; exit 0 ;;
     --help | --h* | -h )
-       echo "$usage"; exit ;;
+       echo "$usage"; exit 0 ;;
     -- )     # Stop option processing
        shift; break ;;
     - )	# Use stdin as input.
@@ -101,7 +99,7 @@ while test $# -gt 0 ; do
     *local*)
        # First pass through any local machine types.
        echo $1
-       exit ;;
+       exit 0;;
 
     * )
        break ;;
@@ -120,9 +118,8 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
-  storm-chaos* | os2-emx* | rtmk-nova*)
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -173,10 +170,6 @@ case $os in
 	-hiux*)
 		os=-hiuxwe2
 		;;
-	-sco6)
-		os=-sco5v6
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
 	-sco5)
 		os=-sco3.2v5
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -193,10 +186,6 @@ case $os in
 		# Don't forget version if it is 3.2v4 or newer.
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
-	-sco5v6*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
 	-sco*)
 		os=-sco3.2v2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -241,16 +230,14 @@ case $basic_machine in
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
-	| bfin \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| fido | fr30 | frv \
+	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
-	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore | mep \
+	| m32r | m32rle | m68000 | m68k | m88k | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -259,7 +246,6 @@ case $basic_machine in
 	| mips64vr4100 | mips64vr4100el \
 	| mips64vr4300 | mips64vr4300el \
 	| mips64vr5000 | mips64vr5000el \
-	| mips64vr5900 | mips64vr5900el \
 	| mipsisa32 | mipsisa32el \
 	| mipsisa32r2 | mipsisa32r2el \
 	| mipsisa64 | mipsisa64el \
@@ -268,24 +254,20 @@ case $basic_machine in
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
-	| mt \
 	| msp430 \
-	| nios | nios2 \
 	| ns16k | ns32k \
-	| or32 \
+	| openrisc | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| score \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
-	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
-	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu | strongarm \
+	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
+	| strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
 	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xscale | xstormy16 | xtensa \
 	| z8k)
 		basic_machine=$basic_machine-unknown
 		;;
@@ -296,9 +278,6 @@ case $basic_machine in
 		;;
 	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
 		;;
-	ms1)
-		basic_machine=mt-unknown
-		;;
 
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
@@ -318,20 +297,20 @@ case $basic_machine in
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-	| avr-* | avr32-* \
-	| bfin-* | bs2000-* \
+	| avr-* \
+	| bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
-	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
-	| m32c-* | m32r-* | m32rle-* \
+	| m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| m88110-* | m88k-* | mcore-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -340,7 +319,6 @@ case $basic_machine in
 	| mips64vr4100-* | mips64vr4100el-* \
 	| mips64vr4300-* | mips64vr4300el-* \
 	| mips64vr5000-* | mips64vr5000el-* \
-	| mips64vr5900-* | mips64vr5900el-* \
 	| mipsisa32-* | mipsisa32el-* \
 	| mipsisa32r2-* | mipsisa32r2el-* \
 	| mipsisa64-* | mipsisa64el-* \
@@ -349,34 +327,27 @@ case $basic_machine in
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
 	| mipstx39-* | mipstx39el-* \
 	| mmix-* \
-	| mt-* \
 	| msp430-* \
-	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
-	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tron-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa*-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+	| xtensa-* \
 	| ymp-* \
 	| z8k-*)
 		;;
-	# Recognize the basic CPU types without company name, with glob match.
-	xtensa*)
-		basic_machine=$basic_machine-unknown
-		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
@@ -447,14 +418,6 @@ case $basic_machine in
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
-	blackfin)
-		basic_machine=bfin-unknown
-		os=-linux
-		;;
-	blackfin-*)
-		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
@@ -487,16 +450,13 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16)
-		basic_machine=cr16-unknown
+	cr16c)
+		basic_machine=cr16c-unknown
 		os=-elf
 		;;
 	crds | unos)
 		basic_machine=m68k-crds
 		;;
-	crisv32 | crisv32-* | etraxfs*)
-		basic_machine=crisv32-axis
-		;;
 	cris | cris-* | etrax*)
 		basic_machine=cris-axis
 		;;
@@ -526,10 +486,6 @@ case $basic_machine in
 		basic_machine=m88k-motorola
 		os=-sysv3
 		;;
-	djgpp)
-		basic_machine=i586-pc
-		os=-msdosdjgpp
-		;;
 	dpx20 | dpx20-*)
 		basic_machine=rs6000-bull
 		os=-bosx
@@ -680,14 +636,6 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
-	m68knommu)
-		basic_machine=m68k-unknown
-		os=-linux
-		;;
-	m68knommu-*)
-		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
 	m88k-omron*)
 		basic_machine=m88k-omron
 		;;
@@ -703,10 +651,6 @@ case $basic_machine in
 		basic_machine=i386-pc
 		os=-mingw32
 		;;
-	mingw32ce)
-		basic_machine=arm-unknown
-		os=-mingw32ce
-		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
@@ -732,9 +676,6 @@ case $basic_machine in
 		basic_machine=i386-pc
 		os=-msdos
 		;;
-	ms1-*)
-		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
-		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
@@ -810,8 +751,9 @@ case $basic_machine in
 		basic_machine=hppa1.1-oki
 		os=-proelf
 		;;
-	openrisc | openrisc-*)
+	or32 | or32-*)
 		basic_machine=or32-unknown
+		os=-coff
 		;;
 	os400)
 		basic_machine=powerpc-ibm
@@ -833,14 +775,6 @@ case $basic_machine in
 		basic_machine=i860-intel
 		os=-osf
 		;;
-	parisc)
-		basic_machine=hppa-unknown
-		os=-linux
-		;;
-	parisc-*)
-		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
 	pbd)
 		basic_machine=sparc-tti
 		;;
@@ -850,12 +784,6 @@ case $basic_machine in
 	pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
-	pc98)
-		basic_machine=i386-pc
-		;;
-	pc98-*)
-		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
 	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
 		;;
@@ -912,10 +840,6 @@ case $basic_machine in
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
-	rdos)
-		basic_machine=i386-pc
-		os=-rdos
-		;;
 	rom68k)
 		basic_machine=m68k-rom68k
 		os=-coff
@@ -942,10 +866,6 @@ case $basic_machine in
 	sb1el)
 		basic_machine=mipsisa64sb1el-unknown
 		;;
-	sde)
-		basic_machine=mipsisa32-sde
-		os=-elf
-		;;
 	sei)
 		basic_machine=mips-sei
 		os=-seiux
@@ -957,9 +877,6 @@ case $basic_machine in
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
-	sh5el)
-		basic_machine=sh5le-unknown
-		;;
 	sh64)
 		basic_machine=sh64-unknown
 		;;
@@ -1049,10 +966,6 @@ case $basic_machine in
 		basic_machine=tic6x-unknown
 		os=-coff
 		;;
-	tile*)
-		basic_machine=tile-unknown
-		os=-linux-gnu
-		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -1113,10 +1026,6 @@ case $basic_machine in
 		basic_machine=hppa1.1-winbond
 		os=-proelf
 		;;
-	xbox)
-		basic_machine=i686-pc
-		os=-mingw32
-		;;
 	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
@@ -1166,10 +1075,13 @@ case $basic_machine in
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b)
 		basic_machine=sparc-sun
 		;;
 	cydra)
@@ -1242,23 +1154,20 @@ case $os in
 	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -openbsd* | -solidbsd* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
-	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1276,7 +1185,7 @@ case $os in
 		os=`echo $os | sed -e 's|nto|nto-qnx|'`
 		;;
 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
 	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
 		;;
 	-mac*)
@@ -1385,9 +1294,6 @@ case $os in
 	-kaos*)
 		os=-kaos
 		;;
-	-zvmoe)
-		os=-zvmoe
-		;;
 	-none)
 		;;
 	*)
@@ -1410,12 +1316,6 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
-        score-*)
-		os=-elf
-		;;
-        spu-*)
-		os=-elf
-		;;
 	*-acorn)
 		os=-riscix1.2
 		;;
@@ -1425,9 +1325,9 @@ case $basic_machine in
 	arm*-semi)
 		os=-aout
 		;;
-        c4x-* | tic4x-*)
-        	os=-coff
-		;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
 	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
@@ -1453,9 +1353,6 @@ case $basic_machine in
 	m68*-cisco)
 		os=-aout
 		;;
-        mep-*)
-		os=-elf
-		;;
 	mips*-cisco)
 		os=-elf
 		;;
@@ -1474,9 +1371,6 @@ case $basic_machine in
 	*-be)
 		os=-beos
 		;;
-	*-haiku)
-		os=-haiku
-		;;
 	*-ibm)
 		os=-aix
 		;;
@@ -1648,7 +1542,7 @@ case $basic_machine in
 esac
 
 echo $basic_machine$os
-exit
+exit 0
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)

+ 12 - 5
configure.ac

@@ -82,8 +82,7 @@ VERSION=$PACKAGE_VERSION
 
 AC_CONFIG_SRCDIR([src/cryptoki.h])
 AC_CONFIG_HEADER([config.h])
-
-AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_MACRO_DIR(m4)
 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
 AM_MAINTAINER_MODE
 AC_CANONICAL_HOST
@@ -184,8 +183,10 @@ AC_SUBST(BUILD_FILEVERSION)
 
 # Checks for libraries.
 
-AC_CHECK_FUNCS([ttyname localtime_r timegm])
-AC_REPLACE_FUNCS([vasprintf stpcpy])
+AC_CHECK_FUNCS([ttyname localtime_r timegm stpcpy])
+
+# Run the checks needed for estream-printf.c
+estream_PRINTF_INIT
 
 # The error code library.  Error codes are sent over the IPC layer and
 # have to be interpreted.
@@ -334,7 +335,6 @@ AC_HEADER_STDBOOL
 AC_C_INLINE
 
 # Checks for library functions.
-AC_FUNC_REALLOC
 
 # Check for programs needed for the manual.
 AC_CHECK_PROG(CONVERT, convert, convert)
@@ -345,6 +345,12 @@ ok=yes
 AM_CONDITIONAL(RUN_TESTS, test "$ok" = "yes")
 
 
+AH_BOTTOM([
+/* Prefix all estream functions.  */
+#define _ESTREAM_EXT_SYM_PREFIX _scute_
+])
+
+
 # Print errors here so that they are visible all
 # together and the user can acquire them all together.
 
@@ -379,6 +385,7 @@ if test "$die" = "yes"; then
 fi
 
 AC_CONFIG_FILES([Makefile
+                 m4/Makefile
                  src/Makefile
                  tests/Makefile
 		 doc/manual/Makefile

File diff suppressed because it is too large
+ 638 - 111
ltmain.sh


+ 2 - 0
m4/Makefile.am

@@ -0,0 +1,2 @@
+EXTRA_DIST = estream.m4 autobuild.m4 gpg-error.m4 libassuan.m4 libtool.m4 \
+             ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4

+ 48 - 0
m4/estream.m4

@@ -0,0 +1,48 @@
+dnl Autoconf macros for libestream
+dnl       Copyright (C) 2007 g10 Code GmbH
+dnl
+dnl This file is free software; as a special exception the author gives
+dnl unlimited permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+dnl This file is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+
+dnl estream_PRINTF_INIT
+dnl Prepare build of source included estream-printf.c
+dnl
+AC_DEFUN([estream_PRINTF_INIT],
+[ 
+  AC_MSG_NOTICE([checking system features for estream-printf])
+  AC_TYPE_LONG_LONG_INT  
+  AC_TYPE_LONG_DOUBLE  
+  AC_TYPE_INTMAX_T
+  AC_TYPE_UINTMAX_T
+  AC_CHECK_TYPES([ptrdiff_t])
+  AC_CHECK_SIZEOF([unsigned long])
+  AC_CHECK_SIZEOF([void *])
+  AC_CACHE_CHECK([for nl_langinfo and THOUSANDS_SEP],
+                  estream_cv_langinfo_thousands_sep,
+      [AC_TRY_LINK([#include <langinfo.h>],
+        [char* cs = nl_langinfo(THOUSANDS_SEP); return !cs;],
+        estream_cv_langinfo_thousands_sep=yes,
+        estream_cv_langinfo_thousands_sep=no)
+      ])
+  if test $estream_cv_langinfo_thousands_sep = yes; then
+    AC_DEFINE(HAVE_LANGINFO_THOUSANDS_SEP, 1,
+      [Define if you have <langinfo.h> and nl_langinfo(THOUSANDS_SEP).])
+  fi
+])
+
+
+dnl estream_INIT
+dnl Prepare build of source included estream.c
+dnl
+AC_DEFUN([estream_INIT],
+[ 
+  AC_REQUIRE([estream_PRINTF_INIT])
+  AC_MSG_NOTICE([checking system features for estream])
+
+])

+ 2 - 1
src/Makefile.am

@@ -29,11 +29,12 @@
 
 ## Process this file with automake to produce Makefile.in
 
-EXTRA_DIST = libscute.vers scute.def versioninfo.rc.in stpcpy.h
+EXTRA_DIST = libscute.vers scute.def versioninfo.rc.in
 
 sources = cryptoki.h pkcs11.h debug.c debug.h settings.h support.h	\
 	locking.h locking.c error-mapping.h error-mapping.c		\
 	get-path.c agent.h agent.c					\
+	estream-printf.c estream-printf.h                               \
 	slots.h slots.c table.h table.c					\
 	cert.h cert-gpgsm.c cert-object.c gpgsm.h gpgsm.c		\
 	p11-cancelfunction.c p11-closeallsessions.c p11-closesession.c	\

+ 1 - 1
src/agent.c

@@ -922,7 +922,7 @@ scute_agent_sign (char *grip, unsigned char *data, int len,
     return err;
 
   for (i = 0; i < len; i++)
-    sprintf (&pretty_data[2 * i], "%02X", data[i]);
+    snprintf (&pretty_data[2 * i], 3, "%02X", data[i]);
   pretty_data[2 * len] = '\0';
 
   snprintf (cmd, sizeof (cmd), "sethash --hash=tls-md5sha1 %s", pretty_data);

+ 2110 - 0
src/estream-printf.c

@@ -0,0 +1,2110 @@
+/* estream-printf.c - Versatile C-99 compliant printf formatting
+ * Copyright (C) 2007, 2008 g10 Code GmbH
+ *
+ * This file is part of Libestream.
+ *
+ * Libestream is free software; you can redistribute 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.
+ *
+ * Libestream is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Libestream; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*  Required autoconf tests:
+
+    AC_TYPE_LONG_LONG_INT            defines HAVE_LONG_LONG_INT
+    AC_TYPE_LONG_DOUBLE              defines HAVE_LONG_DOUBLE
+    AC_TYPE_INTMAX_T                 defines HAVE_INTMAX_T
+    AC_TYPE_UINTMAX_T                defines HAVE_UINTMAX_T
+    AC_CHECK_TYPES([ptrdiff_t])      defines HAVE_PTRDIFF_T
+    AC_CHECK_SIZEOF([unsigned long]) defines SIZEOF_UNSIGNED_LONG
+    AC_CHECK_SIZEOF([void *])        defines SIZEOF_VOID_P
+                                             HAVE_LANGINFO_THOUSANDS_SEP
+
+    Note that the file estream.m4 provides the autoconf macro
+    ESTREAM_PRINTF_INIT which runs all required checks.
+    See estream-printf.h for ways to tune this code.
+
+  Missing stuff:  wchar and wint_t
+                  thousands_sep in pr_float.
+*/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <stddef.h>
+#include <assert.h>
+#if defined(HAVE_INTMAX_T) || defined(HAVE_UINTMAX_T)
+# include <stdint.h>
+#endif
+#ifdef HAVE_LANGINFO_THOUSANDS_SEP
+#include <langinfo.h>
+#endif
+#ifdef TEST
+# include <locale.h>
+#else
+# ifdef _ESTREAM_PRINTF_EXTRA_INCLUDE
+#  include _ESTREAM_PRINTF_EXTRA_INCLUDE
+# endif
+#endif
+#include "estream-printf.h"
+
+/* Allow redefinition of asprintf used malloc functions.  */
+#if defined(_ESTREAM_PRINTF_MALLOC) && !defined(TEST)
+#define my_printf_malloc(a) _ESTREAM_PRINTF_MALLOC((a))  
+#else
+#define my_printf_malloc(a) malloc((a))
+#endif
+#if defined(_ESTREAM_PRINTF_FREE) && !defined(TEST)
+#define my_printf_free(a)   _ESTREAM_PRINTF_FREE((a))  
+#else
+#define my_printf_free(a)   free((a))
+#endif
+
+
+/* Calculate array dimension.  */
+#ifndef DIM
+#define DIM(array) (sizeof (array) / sizeof (*array))
+#endif
+
+
+/* We allow for that many args without requiring malloced memory. */
+#define DEFAULT_MAX_ARGSPECS  5
+
+/* We allow for that many values without requiring malloced memory. */
+#define DEFAULT_MAX_VALUES  8
+
+/* We allocate this many new array argspec elements each time.  */
+#define ARGSPECS_BUMP_VALUE   10
+
+/* Special values for the field width and the precision.  */
+#define NO_FIELD_VALUE   (-1)
+#define STAR_FIELD_VALUE (-2)
+
+/* Bit valuues used for the conversion flags. */
+#define FLAG_GROUPING   1
+#define FLAG_LEFT_JUST  2
+#define FLAG_PLUS_SIGN  4
+#define FLAG_SPACE_PLUS 8
+#define FLAG_ALT_CONV   16
+#define FLAG_ZERO_PAD   32
+
+/* Constants used the length modifiers.  */
+typedef enum
+  {
+    LENMOD_NONE = 0,
+    LENMOD_CHAR,     /* "hh" */
+    LENMOD_SHORT,    /* "h"  */
+    LENMOD_LONG,     /* "l"  */
+    LENMOD_LONGLONG, /* "ll" */
+    LENMOD_INTMAX,   /* "j"  */
+    LENMOD_SIZET,    /* "z"  */
+    LENMOD_PTRDIFF,  /* "t"  */
+    LENMOD_LONGDBL   /* "L"  */
+  } lenmod_t;
+
+/* All the conversion specifiers.  */
+typedef enum
+  {
+    CONSPEC_UNKNOWN = 0,
+    CONSPEC_DECIMAL,
+    CONSPEC_OCTAL,
+    CONSPEC_UNSIGNED,
+    CONSPEC_HEX,
+    CONSPEC_HEX_UP,
+    CONSPEC_FLOAT,
+    CONSPEC_FLOAT_UP,
+    CONSPEC_EXP,
+    CONSPEC_EXP_UP,
+    CONSPEC_F_OR_G,
+    CONSPEC_F_OR_G_UP,
+    CONSPEC_HEX_EXP,
+    CONSPEC_HEX_EXP_UP,
+    CONSPEC_CHAR,
+    CONSPEC_STRING,
+    CONSPEC_POINTER,
+    CONSPEC_STRERROR,
+    CONSPEC_BYTES_SO_FAR
+  } conspec_t;
+
+
+/* Constants describing all the suppoorted types.  Note that we list
+   all the types we know about even if certain types are not available
+   on this system. */
+typedef enum
+  {
+    VALTYPE_UNSUPPORTED = 0,  /* Artificial type for error detection.  */
+    VALTYPE_CHAR,
+    VALTYPE_SCHAR,
+    VALTYPE_UCHAR,
+    VALTYPE_SHORT,
+    VALTYPE_USHORT,
+    VALTYPE_INT,
+    VALTYPE_UINT,
+    VALTYPE_LONG,
+    VALTYPE_ULONG,
+    VALTYPE_LONGLONG,
+    VALTYPE_ULONGLONG,
+    VALTYPE_DOUBLE,
+    VALTYPE_LONGDOUBLE,
+    VALTYPE_STRING,
+    VALTYPE_INTMAX,
+    VALTYPE_UINTMAX,
+    VALTYPE_SIZE,
+    VALTYPE_PTRDIFF,
+    VALTYPE_POINTER,
+    VALTYPE_CHAR_PTR,
+    VALTYPE_SCHAR_PTR,
+    VALTYPE_SHORT_PTR,
+    VALTYPE_INT_PTR,
+    VALTYPE_LONG_PTR,
+    VALTYPE_LONGLONG_PTR,
+    VALTYPE_INTMAX_PTR,
+    VALTYPE_SIZE_PTR,
+    VALTYPE_PTRDIFF_PTR
+  } valtype_t;
+
+
+/* A union used to store the actual values. */
+typedef union 
+{
+  char a_char;
+  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_long;
+  unsigned long int a_ulong;
+#ifdef HAVE_LONG_LONG_INT
+  long long int a_longlong;
+  unsigned long long int a_ulonglong;
+#endif
+  double a_double;
+#ifdef HAVE_LONG_DOUBLE
+  long double a_longdouble;
+#endif
+  const char *a_string;
+#ifdef HAVE_INTMAX_T
+  intmax_t a_intmax;
+#endif
+#ifdef HAVE_UINTMAX_T
+  intmax_t a_uintmax;
+#endif
+  size_t a_size;
+#ifdef HAVE_PTRDIFF_T
+  ptrdiff_t a_ptrdiff;
+#endif
+  void *a_void_ptr;
+  char *a_char_ptr;
+  signed char *a_schar_ptr;
+  short *a_short_ptr;
+  int  *a_int_ptr;
+  long *a_long_ptr;
+#ifdef HAVE_LONG_LONG_INT
+  long long int *a_longlong_ptr;
+#endif
+#ifdef HAVE_INTMAX_T
+  intmax_t *a_intmax_ptr;
+#endif
+  size_t *a_size_ptr;
+#ifdef HAVE_PTRDIFF_T
+  ptrdiff_t *a_ptrdiff_ptr;
+#endif
+} value_t;
+
+/* An object used to keep track of a format option and arguments. */
+struct argspec_s
+{
+  size_t length;       /* The length of these args including the percent.  */
+  unsigned int flags;  /* The conversion flags (bits defined by FLAG_foo).  */
+  int width;           /* The field width.  */
+  int precision;       /* The precision.  */
+  lenmod_t lenmod;     /* The length modifier.  */
+  conspec_t conspec;   /* The conversion specifier.  */
+  int arg_pos;         /* The position of the argument.  This one may
+                          be -1 to indicate that no value is expected
+                          (e.g. for "%m").  */
+  int width_pos;       /* The position of the argument for a field
+                          width star's value. 0 for not used.  */
+  int precision_pos;   /* The position of the argument for the a
+                          precision star's value.  0 for not used. */
+  valtype_t vt;        /* The type of the corresponding argument.  */
+};
+typedef struct argspec_s *argspec_t;
+
+/* An object to build up a table of values and their types.  */
+struct valueitem_s
+{
+  valtype_t vt;  /* The type of the value.  */
+  value_t value; /* The value.  */
+};
+typedef struct valueitem_s *valueitem_t;
+
+
+#ifdef TEST
+static int verbose; 
+
+static void
+dump_argspecs (argspec_t arg, size_t argcount)
+{
+  int idx;
+
+  for (idx=0; argcount; argcount--, arg++, idx++)
+    fprintf (stderr, 
+             "%2d: len=%u flags=%u width=%d prec=%d mod=%d "
+             "con=%d vt=%d pos=%d-%d-%d\n",
+             idx,
+             (unsigned int)arg->length,
+             arg->flags,
+             arg->width,
+             arg->precision,
+             arg->lenmod,
+             arg->conspec,
+             arg->vt,
+             arg->arg_pos,
+             arg->width_pos,
+             arg->precision_pos);
+}
+#endif /*TEST*/
+
+
+/* Set the vt field for ARG.  */
+static void
+compute_type (argspec_t arg)
+{
+  switch (arg->conspec)
+    {
+    case CONSPEC_UNKNOWN: 
+      arg->vt = VALTYPE_UNSUPPORTED; 
+      break;
+
+    case CONSPEC_DECIMAL:
+      switch (arg->lenmod)
+        {
+        case LENMOD_CHAR: arg->vt = VALTYPE_SCHAR; break;
+        case LENMOD_SHORT: arg->vt = VALTYPE_SHORT; break;
+        case LENMOD_LONG: arg->vt = VALTYPE_LONG; break;
+        case LENMOD_LONGLONG: arg->vt = VALTYPE_LONGLONG; break;
+        case LENMOD_INTMAX: arg->vt = VALTYPE_INTMAX; break;
+        case LENMOD_SIZET: arg->vt = VALTYPE_SIZE; break;   
+        case LENMOD_PTRDIFF: arg->vt = VALTYPE_PTRDIFF; break;
+        default: arg->vt = VALTYPE_INT; break;
+        }
+      break;
+
+    case CONSPEC_OCTAL:
+    case CONSPEC_UNSIGNED:
+    case CONSPEC_HEX:
+    case CONSPEC_HEX_UP:
+      switch (arg->lenmod)
+        {
+        case LENMOD_CHAR: arg->vt = VALTYPE_UCHAR; break;
+        case LENMOD_SHORT: arg->vt = VALTYPE_USHORT; break;
+        case LENMOD_LONG: arg->vt = VALTYPE_ULONG; break;
+        case LENMOD_LONGLONG: arg->vt = VALTYPE_ULONGLONG; break;
+        case LENMOD_INTMAX: arg->vt = VALTYPE_UINTMAX; break;
+        case LENMOD_SIZET: arg->vt = VALTYPE_SIZE; break;   
+        case LENMOD_PTRDIFF: arg->vt = VALTYPE_PTRDIFF; break;
+        default: arg->vt = VALTYPE_UINT; break;
+        }
+      break;
+      
+    case CONSPEC_FLOAT:
+    case CONSPEC_FLOAT_UP:
+    case CONSPEC_EXP:
+    case CONSPEC_EXP_UP:
+    case CONSPEC_F_OR_G:
+    case CONSPEC_F_OR_G_UP:
+    case CONSPEC_HEX_EXP:
+    case CONSPEC_HEX_EXP_UP:
+      switch (arg->lenmod)
+        {
+        case LENMOD_LONGDBL: arg->vt = VALTYPE_LONGDOUBLE; break;
+        case LENMOD_LONG: arg->vt = VALTYPE_DOUBLE; break;
+        default: arg->vt = VALTYPE_DOUBLE; break;
+        }
+      break;
+      
+    case CONSPEC_CHAR:
+      arg->vt = VALTYPE_INT; 
+      break;
+
+    case CONSPEC_STRING:
+      arg->vt = VALTYPE_STRING;
+      break;
+
+    case CONSPEC_POINTER:
+      arg->vt = VALTYPE_POINTER;
+      break;
+
+    case CONSPEC_STRERROR:
+      arg->vt = VALTYPE_STRING;
+      break;
+
+    case CONSPEC_BYTES_SO_FAR:
+      switch (arg->lenmod)
+        {
+        case LENMOD_CHAR: arg->vt = VALTYPE_SCHAR_PTR; break;
+        case LENMOD_SHORT: arg->vt = VALTYPE_SHORT_PTR; break;
+        case LENMOD_LONG: arg->vt = VALTYPE_LONG_PTR; break;
+        case LENMOD_LONGLONG: arg->vt = VALTYPE_LONGLONG_PTR; break;
+        case LENMOD_INTMAX: arg->vt = VALTYPE_INTMAX_PTR; break;
+        case LENMOD_SIZET: arg->vt = VALTYPE_SIZE_PTR; break;   
+        case LENMOD_PTRDIFF: arg->vt = VALTYPE_PTRDIFF_PTR; break;
+        default: arg->vt = VALTYPE_INT_PTR; break;
+        }
+      break;
+      
+    }
+}
+
+
+
+/* Parse the FORMAT string and populate the specification array stored
+   at the address ARGSPECS_ADDR.  The caller has provided enough space
+   to store up to MAX_ARGSPECS in that buffer.  The function may
+   however ignore the provided buffer and malloc a larger one.  On
+   success the addrrss of that larger buffer will be stored at
+   ARGSPECS_ADDR.  The actual number of specifications will be
+   returned at R_ARGSPECS_COUNT. */
+static int
+parse_format (const char *format,
+              argspec_t *argspecs_addr, size_t max_argspecs,
+              size_t *r_argspecs_count)
+{
+  const char *s;
+  argspec_t argspecs = *argspecs_addr;
+  argspec_t arg;
+  size_t argcount = 0;
+
+  if (!format)
+    goto leave_einval;
+      
+  for (; *format; format++)
+    {
+      unsigned int flags;
+      int width, precision;
+      lenmod_t lenmod;
+      conspec_t conspec;
+      int arg_pos, width_pos, precision_pos;
+      
+      if (*format != '%')
+        continue;
+      s = ++format;
+      if (!*s)
+        goto leave_einval;
+      if (*s == '%')
+        continue; /* Just a quoted percent.  */
+
+      /* First check whether there is a positional argument.  */
+      arg_pos = 0; /* No positional argument given.  */
+      if (*s >= '1' && *s <= '9')
+        {
+          const char *save_s = s;
+          
+          arg_pos = (*s++ - '0');
+          for (; *s >= '0' && *s <= '9'; s++)
+            arg_pos = 10*arg_pos + (*s - '0');
+          if (arg_pos < 0)
+            goto leave_einval; /* Overflow during conversion.  */
+          if (*s == '$')
+            s++;
+          else
+            {
+              arg_pos = 0;
+              s = save_s;
+            }
+        }
+         
+      /* Parse the flags.  */
+      flags = 0;
+      for ( ; *s; s++)
+        {
+          switch (*s)
+            {
+            case '\'': flags |= FLAG_GROUPING; break;
+            case '-': flags |= FLAG_LEFT_JUST; break;
+            case '+': flags |= FLAG_PLUS_SIGN; break;
+            case ' ': flags |= FLAG_SPACE_PLUS; break;
+            case '#': flags |= FLAG_ALT_CONV; break;
+            case '0': flags |= FLAG_ZERO_PAD; break;
+            default:
+              goto flags_parsed;
+            }
+        }
+    flags_parsed:
+      
+      /* Parse the field width.  */
+      width_pos = 0;
+      if (*s == '*')
+        {
+          width = STAR_FIELD_VALUE;
+          s++;
+          /* If we have a positional argument, another one might also
+             be used to give the position of the star's value. */
+          if (arg_pos && *s >= '1' && *s <= '9')
+            {
+              width_pos = (*s++ - '0');
+              for (; *s >= '0' && *s <= '9'; s++)
+                width_pos = 10*width_pos + (*s - '0');
+              if (width_pos < 1)
+                goto leave_einval; /* Overflow during conversion.  */
+              if (*s != '$')
+                goto leave_einval; /* Not followed by $.  */
+              s++;
+            }
+        }
+      else if ( *s >= '0' && *s <= '9')
+        {
+          width = (*s++ - '0');
+          for (; *s >= '0' && *s <= '9'; s++)
+            {
+              if (!width && *s == '0')
+                goto leave_einval; /* Leading zeroes are not allowed.
+                                      Fixme: check what other
+                                      implementations do. */
+              width = 10*width + (*s - '0');
+            }
+          if (width < 0)
+            goto leave_einval; /* Overflow during conversion.  */
+        }
+      else
+        width = NO_FIELD_VALUE;
+
+      /* Parse the precision.  */
+      precision_pos = 0;
+      precision = NO_FIELD_VALUE;
+      if (*s == '.')
+        {
+          int ignore_value = (s[1] == '-');
+
+          s++;
+          if (*s == '*')
+            {
+              precision = STAR_FIELD_VALUE;
+              s++;
+              /* If we have a positional argument, another one might also
+                 be used to give the position of the star's value. */
+              if (arg_pos && *s >= '1' && *s <= '9')
+                {
+                  precision_pos = (*s++ - '0');
+                  for (; *s >= '0' && *s <= '9'; s++)
+                    precision_pos = 10*precision_pos + (*s - '0');
+                  if (precision_pos < 1)
+                    goto leave_einval; /* Overflow during conversion.  */
+                  if (*s != '$')
+                    goto leave_einval; /* Not followed by $.  */
+                  s++;
+                }
+            }
+          else if ( *s >= '0' && *s <= '9')
+            {
+              precision = (*s++ - '0');
+              for (; *s >= '0' && *s <= '9'; s++)
+                {
+                  if (!precision && *s == '0')
+                    goto leave_einval; /* Leading zeroes are not allowed.
+                                          Fixme: check what other
+                                          implementations do. */
+                  precision = 10*precision + (*s - '0');
+                }
+              if (precision < 0)
+                goto leave_einval; /* Overflow during conversion.  */
+            }
+          else
+            precision = 0;
+          if (ignore_value)
+            precision = NO_FIELD_VALUE;
+        }
+      
+      /* Parse the length modifiers.  */
+      switch (*s)
+        {
+        case 'h': 
+          if (s[1] == 'h')
+            {
+              lenmod = LENMOD_CHAR;
+              s++;
+            }
+          else
+            lenmod = LENMOD_SHORT;
+          s++;
+          break;
+        case 'l':
+          if (s[1] == 'l')
+            {
+              lenmod = LENMOD_LONGLONG;
+              s++;
+            }
+          else
+            lenmod = LENMOD_LONG;
+          s++;
+          break;
+        case 'j': lenmod = LENMOD_INTMAX; s++; break;
+        case 'z': lenmod = LENMOD_SIZET; s++; break;
+        case 't': lenmod = LENMOD_PTRDIFF; s++; break;
+        case 'L': lenmod = LENMOD_LONGDBL; s++; break;
+        default:  lenmod = LENMOD_NONE; break;
+        }
+      
+      /* Parse the conversion specifier.  */
+      switch (*s)
+        {
+        case 'd':
+        case 'i': conspec = CONSPEC_DECIMAL; break;
+        case 'o': conspec = CONSPEC_OCTAL; break;
+        case 'u': conspec = CONSPEC_UNSIGNED; break;
+        case 'x': conspec = CONSPEC_HEX; break;
+        case 'X': conspec = CONSPEC_HEX_UP; break;
+        case 'f': conspec = CONSPEC_FLOAT; break;
+        case 'F': conspec = CONSPEC_FLOAT_UP; break;
+        case 'e': conspec = CONSPEC_EXP; break;
+        case 'E': conspec = CONSPEC_EXP_UP; break;
+        case 'g': conspec = CONSPEC_F_OR_G; break;
+        case 'G': conspec = CONSPEC_F_OR_G_UP; break;
+        case 'a': conspec = CONSPEC_HEX_EXP; break;
+        case 'A': conspec = CONSPEC_HEX_EXP_UP; break;
+        case 'c': conspec = CONSPEC_CHAR; break;
+        case 's': conspec = CONSPEC_STRING; break;
+        case 'p': conspec = CONSPEC_POINTER; break;
+        case 'n': conspec = CONSPEC_BYTES_SO_FAR; break;
+        case 'C': conspec = CONSPEC_CHAR; lenmod = LENMOD_LONG; break;
+        case 'S': conspec = CONSPEC_STRING; lenmod = LENMOD_LONG; break;
+        case 'm': conspec = CONSPEC_STRERROR; arg_pos = -1; break;
+        default: conspec = CONSPEC_UNKNOWN;
+        }
+
+      /* Save the args. */
+      if (argcount >= max_argspecs)
+        {
+          /* We either need to allocate a new array instead of the
+             caller provided one or realloc the array.  Instead of
+             using realloc we allocate a new one and release the
+             original one then. */
+          size_t n, newmax;
+          argspec_t newarg;
+
+          newmax = max_argspecs + ARGSPECS_BUMP_VALUE;
+          if (newmax <= max_argspecs)
+            goto leave_einval;  /* Too many arguments. */
+          newarg = calloc (newmax, sizeof *newarg);
+          if (!newarg)
+            goto leave;
+          for (n=0; n < argcount; n++)
+            newarg[n] = argspecs[n];
+          if (argspecs != *argspecs_addr)
+            free (argspecs);
+          argspecs = newarg;
+          max_argspecs = newmax;
+        }
+
+      arg = argspecs + argcount;
+      arg->length = s - format + 2;
+      arg->flags = flags;
+      arg->width = width;
+      arg->precision = precision;
+      arg->lenmod = lenmod;
+      arg->conspec = conspec;
+      arg->arg_pos = arg_pos;
+      arg->width_pos = width_pos;
+      arg->precision_pos = precision_pos;
+      compute_type (arg);
+      argcount++;
+      format = s;
+    }
+
+  *argspecs_addr = argspecs;
+  *r_argspecs_count = argcount;
+  return 0; /* Success.  */
+  
+ leave_einval:
+  errno = EINVAL;
+ leave:
+  if (argspecs != *argspecs_addr)
+    free (argspecs);
+  *argspecs_addr = NULL;
+  return -1;
+}
+
+
+/* This function reads all the values as specified by VALUETABLE into
+   VALUETABLE.  The values are expected in VAARGS.  The function
+   returns -1 if a specified type is not supported. */
+static int
+read_values (valueitem_t valuetable, size_t valuetable_len, va_list vaargs)
+{
+  int validx;
+
+  for (validx=0; validx < valuetable_len; validx++)
+    {
+      value_t *value = &valuetable[validx].value;
+      valtype_t vt = valuetable[validx].vt;
+
+      switch (vt)
+        {
+        case VALTYPE_CHAR: value->a_char = va_arg (vaargs, int); break;
+        case VALTYPE_CHAR_PTR:
+          value->a_char_ptr = va_arg (vaargs, char *);
+          break;
+        case VALTYPE_SCHAR: value->a_schar = va_arg (vaargs, int); break;
+        case VALTYPE_SCHAR_PTR: 
+          value->a_schar_ptr = va_arg (vaargs, signed char *); 
+          break;
+        case VALTYPE_UCHAR: value->a_uchar = va_arg (vaargs, int); break;
+        case VALTYPE_SHORT: value->a_short = va_arg (vaargs, int); break;
+        case VALTYPE_USHORT: value->a_ushort = va_arg (vaargs, int); break;
+        case VALTYPE_SHORT_PTR: 
+          value->a_short_ptr = va_arg (vaargs, short *); 
+          break;
+        case VALTYPE_INT:
+          value->a_int = va_arg (vaargs, int);
+          break;
+        case VALTYPE_INT_PTR:
+          value->a_int_ptr = va_arg (vaargs, int *);
+          break;
+        case VALTYPE_UINT:
+          value->a_uint = va_arg (vaargs, unsigned int);
+          break;
+        case VALTYPE_LONG:
+          value->a_long = va_arg (vaargs, long);
+          break;
+        case VALTYPE_ULONG: 
+          value->a_ulong = va_arg (vaargs, unsigned long);
+          break;
+        case VALTYPE_LONG_PTR: 
+          value->a_long_ptr = va_arg (vaargs, long *); 
+          break;
+#ifdef HAVE_LONG_LONG_INT
+        case VALTYPE_LONGLONG:
+          value->a_longlong = va_arg (vaargs, long long int);
+          break;
+        case VALTYPE_ULONGLONG: 
+          value->a_ulonglong = va_arg (vaargs, unsigned long long int); 
+          break;
+        case VALTYPE_LONGLONG_PTR: 
+          value->a_longlong_ptr = va_arg (vaargs, long long *);
+          break;
+#endif
+        case VALTYPE_DOUBLE:
+          value->a_double = va_arg (vaargs, double);
+          break;
+#ifdef HAVE_LONG_DOUBLE
+        case VALTYPE_LONGDOUBLE:
+          value->a_longdouble = va_arg (vaargs, long double);
+          break;
+#endif
+        case VALTYPE_STRING:
+          value->a_string = va_arg (vaargs, const char *);
+          break;
+        case VALTYPE_POINTER: 
+          value->a_void_ptr = va_arg (vaargs, void *);
+          break;
+#ifdef HAVE_INTMAX_T
+        case VALTYPE_INTMAX:
+          value->a_intmax = va_arg (vaargs, intmax_t);
+          break;
+        case VALTYPE_INTMAX_PTR: 
+          value->a_intmax_ptr = va_arg (vaargs, intmax_t *); 
+          break;
+#endif
+#ifdef HAVE_UINTMAX_T
+        case VALTYPE_UINTMAX: 
+          value->a_uintmax = va_arg (vaargs, uintmax_t); 
+          break;
+#endif
+        case VALTYPE_SIZE:
+          value->a_size = va_arg (vaargs, size_t);
+          break;
+        case VALTYPE_SIZE_PTR: 
+          value->a_size_ptr = va_arg (vaargs, size_t *); 
+          break;
+#ifdef HAVE_PTRDIFF_T
+        case VALTYPE_PTRDIFF:
+          value->a_ptrdiff = va_arg (vaargs, ptrdiff_t); 
+          break;
+        case VALTYPE_PTRDIFF_PTR:
+          value->a_ptrdiff_ptr = va_arg (vaargs, ptrdiff_t *);
+          break;
+#endif
+        default: /* Unsupported type.  */
+          return -1;
+        }
+    }
+  return 0;
+}
+
+
+
+/* Output COUNT padding characters PADCHAR and update NBYTES by the
+   number of bytes actually written.  */
+static int
+pad_out (estream_printf_out_t outfnc, void *outfncarg,
+         int padchar, int count, size_t *nbytes)
+{
+  char buf[32];
+  size_t n;
+  int rc;
+
+  while (count > 0)
+    {
+      n = (count <= sizeof buf)? count : sizeof buf;
+      memset (buf, padchar, n);
+      rc = outfnc (outfncarg, buf, n);
+      if (rc)
+        return rc;
+      *nbytes += n;
+      count -= n;
+    }
+  
+  return 0;
+}
+
+
+/* "d,i,o,u,x,X" formatting.  OUTFNC and OUTFNCARG describes the
+   output routine, ARG gives the argument description and VALUE the
+   actual value (its type is available through arg->vt).  */
+static int
+pr_integer (estream_printf_out_t outfnc, void *outfncarg,
+            argspec_t arg, value_t value, size_t *nbytes)
+{
+  int rc;
+#ifdef HAVE_LONG_LONG_INT
+  unsigned long long aulong;
+#else
+  unsigned long aulong;
+#endif
+  char numbuf[100];
+  char *p, *pend;
+  size_t n;
+  char signchar = 0;
+  int n_prec;  /* Number of extra precision digits required.  */
+  int n_extra; /* Extra number of prefix or sign characters.  */
+
+  if (arg->conspec == CONSPEC_DECIMAL)
+    {
+#ifdef HAVE_LONG_LONG_INT
+      long long along;
+#else
+      long along;
+#endif
+
+      switch (arg->vt)
+        {
+        case VALTYPE_SHORT: along = value.a_short; break;
+        case VALTYPE_INT: along = value.a_int; break;
+        case VALTYPE_LONG: along = value.a_long; break;  
+#ifdef HAVE_LONG_LONG_INT
+        case VALTYPE_LONGLONG: along = value.a_longlong; break;  
+        case VALTYPE_SIZE: along = value.a_size; break;  
+# ifdef HAVE_INTMAX_T
+        case VALTYPE_INTMAX: along = value.a_intmax; break;  
+# endif
+# ifdef HAVE_PTRDIFF_T
+        case VALTYPE_PTRDIFF: along = value.a_ptrdiff; break;  
+# endif
+#endif /*HAVE_LONG_LONG_INT*/
+        default: 
+          return -1;
+        }
+      if (along < 0)
+        {
+          aulong = -along;
+          signchar = '-';
+        }
+      else
+        aulong = along;
+    }
+  else
+    {
+      switch (arg->vt)
+        {
+        case VALTYPE_USHORT: aulong = value.a_ushort; break;
+        case VALTYPE_UINT: aulong = value.a_uint; break;
+        case VALTYPE_ULONG: aulong = value.a_ulong; break;  
+#ifdef HAVE_LONG_LONG_INT
+        case VALTYPE_ULONGLONG: aulong = value.a_ulonglong; break;  
+        case VALTYPE_SIZE: aulong = value.a_size; break;  
+# ifdef HAVE_UINTMAX_T
+        case VALTYPE_UINTMAX: aulong = value.a_uintmax; break;  
+# endif
+# ifdef HAVE_PTRDIFF_T
+        case VALTYPE_PTRDIFF: aulong = value.a_ptrdiff; break;  
+# endif
+#endif /*HAVE_LONG_LONG_INT*/
+        default: 
+          return -1;
+        }
+    }
+
+  if (signchar == '-')
+    ;
+  else if ((arg->flags & FLAG_PLUS_SIGN))
+    signchar = '+';
+  else if ((arg->flags & FLAG_SPACE_PLUS))
+    signchar = ' ';
+
+  n_extra = !!signchar;
+
+  /* We build the string up backwards.  */
+  p = pend = numbuf + DIM(numbuf);
+  if ((!aulong && !arg->precision))
+    ;
+  else if (arg->conspec == CONSPEC_DECIMAL
+           || arg->conspec == CONSPEC_UNSIGNED)
+    {
+      int grouping = -1;
+      const char * grouping_string =
+#ifdef HAVE_LANGINFO_THOUSANDS_SEP
+        nl_langinfo(THOUSANDS_SEP);
+#else
+        "'";
+#endif
+
+      do
+        {
+          if ((arg->flags & FLAG_GROUPING) 
+              && (++grouping == 3) && *grouping_string)
+            {
+              *--p = *grouping_string;
+              grouping = 0;
+            }
+          *--p = '0' + (aulong % 10);
+          aulong /= 10;
+        }
+      while (aulong);
+    }
+  else if (arg->conspec == CONSPEC_OCTAL)
+    {
+      do
+        {
+          *--p = '0' + (aulong % 8);
+          aulong /= 8;
+        }
+      while (aulong);
+      if ((arg->flags & FLAG_ALT_CONV) && *p != '0')
+        *--p = '0';
+    }
+  else /* HEX or HEXUP */
+    {
+      const char *digits = ((arg->conspec == CONSPEC_HEX)
+                            ? "0123456789abcdef" : "0123456789ABCDEF");
+      do
+        {
+          *--p = digits[(aulong % 16)];
+          aulong /= 16;
+        }
+      while (aulong);
+      if ((arg->flags & FLAG_ALT_CONV))
+        n_extra += 2;
+    }
+  
+  n = pend - p;
+
+  if ((arg->flags & FLAG_ZERO_PAD)
+      && arg->precision == NO_FIELD_VALUE && !(arg->flags & FLAG_LEFT_JUST)
+      && n && arg->width - n_extra > n )
+    n_prec = arg->width - n_extra - n;
+  else if (arg->precision > 0 && arg->precision > n)
+    n_prec = arg->precision - n;
+  else
+    n_prec = 0;
+
+  if (!(arg->flags & FLAG_LEFT_JUST)
+      && arg->width >= 0 && arg->width - n_extra > n
+      && arg->width - n_extra - n >= n_prec )
+    {
+      rc = pad_out (outfnc, outfncarg, ' ',
+                    arg->width - n_extra - n - n_prec, nbytes);
+      if (rc)
+        return rc;
+    }
+
+  if (signchar)
+    {
+      rc = outfnc (outfncarg, &signchar, 1);
+      if (rc)
+        return rc;
+      *nbytes += 1;
+    }
+
+  if ((arg->flags & FLAG_ALT_CONV)
+      && (arg->conspec == CONSPEC_HEX || arg->conspec == CONSPEC_HEX_UP))
+    {
+      rc = outfnc (outfncarg, arg->conspec == CONSPEC_HEX? "0x": "0X", 2);
+      if (rc)
+        return rc;
+      *nbytes += 2;
+    }
+
+  if (n_prec)
+    {
+      rc = pad_out (outfnc, outfncarg, '0', n_prec, nbytes);
+      if (rc)
+        return rc;
+    }
+      
+  rc = outfnc (outfncarg, p, pend - p);
+  if (rc)
+    return rc;
+  *nbytes += pend - p;
+
+  if ((arg->flags & FLAG_LEFT_JUST)
+      && arg->width >= 0 && arg->width - n_extra - n_prec > n)
+    {
+      rc = pad_out (outfnc, outfncarg, ' ',
+                    arg->width - n_extra - n_prec - n, nbytes);
+      if (rc)
+        return rc;
+    }
+
+  return 0;
+}
+
+
+/* "e,E,f,F,g,G,a,A" formatting.  OUTFNC and OUTFNCARG describes the
+   output routine, ARG gives the argument description and VALUE the
+   actual value (its type is available through arg->vt).  For
+   portability reasons sprintf is used for the actual formatting.
+   This is useful because sprint is the only standard function to
+   convert a floating number into its ascii representation.  To avoid
+   using malloc we just pass the precision to sprintf and do the final
+   formatting with our own code.  */
+static int
+pr_float (estream_printf_out_t outfnc, void *outfncarg,
+          argspec_t arg, value_t value, size_t *nbytes)
+{
+  int rc;
+#ifdef HAVE_LONG_DOUBLE
+  long double adblfloat = 0; /* Just to please gcc.  */
+  int use_dbl = 0;
+#endif
+  double afloat;
+  char numbuf[200];
+  char formatstr[20];
+  char *p, *pend;
+  size_t n;
+  char signchar = 0;
+  int n_extra;  /* Extra number of prefix or sign characters.  */
+
+  switch (arg->vt)
+    {
+    case VALTYPE_DOUBLE: afloat = value.a_double; break;
+#ifdef HAVE_LONG_DOUBLE
+    case VALTYPE_LONGDOUBLE:
+      afloat = 0;  /* Just to please gcc.  */
+      adblfloat = value.a_longdouble;
+      use_dbl=1; break;
+#endif
+    default: 
+      return -1;
+    }
+
+  /* We build the string using sprint.  */
+  p = formatstr + sizeof formatstr;
+  *--p = 0;
+  switch (arg->conspec)
+    {
+    case CONSPEC_FLOAT:      *--p = 'f'; break;
+    case CONSPEC_FLOAT_UP:   *--p = 'F'; break;
+    case CONSPEC_EXP:        *--p = 'e'; break;
+    case CONSPEC_EXP_UP:     *--p = 'E'; break;
+    case CONSPEC_F_OR_G:     *--p = 'g'; break;
+    case CONSPEC_F_OR_G_UP:  *--p = 'G'; break;
+    case CONSPEC_HEX_EXP:    *--p = 'a'; break;
+    case CONSPEC_HEX_EXP_UP: *--p = 'A'; break;
+    default:
+      return -1; /* Actually a bug.  */
+    }
+#ifdef HAVE_LONG_DOUBLE
+  if (use_dbl)
+    *--p = 'L';
+#endif
+  if (arg->precision != NO_FIELD_VALUE)
+    {
+      /* Limit it to a meaningful value so that even a stupid sprintf
+         won't overflow our buffer.  */
+      n = arg->precision <= 100? arg->precision : 100;
+      do
+        {
+          *--p = '0' + (n % 10);
+          n /= 10;
+        }
+      while (n);
+      *--p = '.';
+    }
+  if ((arg->flags & FLAG_ALT_CONV))
+    *--p = '#';
+  *--p = '%';
+#ifdef HAVE_LONG_DOUBLE
+  if (use_dbl)
+    sprintf (numbuf, p, adblfloat);
+  else
+#endif /*HAVE_LONG_DOUBLE*/
+    sprintf (numbuf, p, afloat);
+  p = numbuf;
+  n = strlen (numbuf);
+  pend = p + n;
+
+  if (*p =='-')
+    {
+      signchar = '-';
+      p++;
+      n--;
+    }
+  else if ((arg->flags & FLAG_PLUS_SIGN))
+    signchar = '+';
+  else if ((arg->flags & FLAG_SPACE_PLUS))
+    signchar = ' ';
+
+  n_extra = !!signchar;
+
+  if (!(arg->flags & FLAG_LEFT_JUST)
+      && arg->width >= 0 && arg->width - n_extra > n)
+    {
+      rc = pad_out (outfnc, outfncarg, ' ', arg->width - n_extra - n, nbytes);
+      if (rc)
+        return rc;
+    }
+
+  if (signchar)
+    {
+      rc = outfnc (outfncarg, &signchar, 1);
+      if (rc)
+        return rc;
+      *nbytes += 1;
+    }
+
+  rc = outfnc (outfncarg, p, pend - p);
+  if (rc)
+    return rc;
+  *nbytes += pend - p;
+
+  if ((arg->flags & FLAG_LEFT_JUST)
+      && arg->width >= 0 && arg->width - n_extra > n)
+    {
+      rc = pad_out (outfnc, outfncarg, ' ', arg->width - n_extra - n, nbytes);
+      if (rc)
+        return rc;
+    }
+
+  return 0;
+}
+
+
+/* "c" formatting.  */
+static int
+pr_char (estream_printf_out_t outfnc, void *outfncarg,
+            argspec_t arg, value_t value, size_t *nbytes)
+{
+  int rc;
+  char buf[1];
+
+  if (arg->vt != VALTYPE_INT)
+    return -1;
+  buf[0] = (unsigned int)value.a_int;
+  rc = outfnc (outfncarg, buf, 1);
+  if(rc)
+    return rc;
+  *nbytes += 1;
+  
+  return 0;
+}
+
+
+/* "s" formatting.  */
+static int
+pr_string (estream_printf_out_t outfnc, void *outfncarg,
+            argspec_t arg, value_t value, size_t *nbytes)
+{
+  int rc;
+  size_t n;
+  const char *string, *s;
+
+  if (arg->vt != VALTYPE_STRING)
+    return -1;
+  string = value.a_string;
+  if (!string)
+    string = "(null)";
+  if (arg->precision >= 0)
+    {
+      for (n=0,s=string; *s && n < arg->precision; s++) 
+        n++;
+    }
+  else
+    n = strlen (string);
+
+  if (!(arg->flags & FLAG_LEFT_JUST)
+      && arg->width >= 0 && arg->width > n )
+    {
+      rc = pad_out (outfnc, outfncarg, ' ', arg->width - n, nbytes);
+      if (rc)
+        return rc;
+    }
+
+  rc = outfnc (outfncarg, string, n);
+  if (rc)
+    return rc;
+  *nbytes += n;
+
+  if ((arg->flags & FLAG_LEFT_JUST)
+      && arg->width >= 0 && arg->width > n)
+    {
+      rc = pad_out (outfnc, outfncarg, ' ', arg->width - n, nbytes);
+      if (rc)
+        return rc;
+    }
+  
+  return 0;
+}
+
+
+/* "p" formatting.  */
+static int
+pr_pointer (estream_printf_out_t outfnc, void *outfncarg,
+            argspec_t arg, value_t value, size_t *nbytes)
+{
+  int rc;
+#ifdef HAVE_LONG_LONG_INT
+  unsigned long long aulong;
+#else
+  unsigned long aulong;
+#endif
+  char numbuf[100];
+  char *p, *pend;
+
+  if (arg->vt != VALTYPE_POINTER)
+    return -1;
+  /* We assume that a pointer can be converted to an unsigned long.
+     That is not correct for a 64 bit Windows, but then we assume that
+     long long is supported and usable for storing a pointer.  */
+#if defined(HAVE_LONG_LONG_INT) && (SIZEOF_UNSIGNED_LONG < SIZEOF_VOID_P)
+  aulong = (unsigned long long)value.a_void_ptr;
+#else
+  aulong = (unsigned long)value.a_void_ptr;
+#endif
+
+  p = pend = numbuf + DIM(numbuf);
+  do
+    {
+      *--p = "0123456789abcdefx"[(aulong % 16)];
+      aulong /= 16;
+    }
+  while (aulong);
+  while ((pend-p) < 2*sizeof (aulong))
+    *--p = '0';
+  *--p = 'x';
+  *--p = '0';
+  
+  rc = outfnc (outfncarg, p, pend - p);
+  if (rc)
+    return rc;
+  *nbytes += pend - p;
+
+  return 0;
+}
+
+/* "n" pesudo format operation.  */
+static int
+pr_bytes_so_far (estream_printf_out_t outfnc, void *outfncarg,
+                 argspec_t arg, value_t value, size_t *nbytes)
+{
+  (void)outfnc;
+  (void)outfncarg;
+
+  switch (arg->vt)
+    {
+    case VALTYPE_SCHAR_PTR: 
+      *value.a_schar_ptr = (signed char)(unsigned int)(*nbytes); 
+      break;
+    case VALTYPE_SHORT_PTR:  
+      *value.a_short_ptr = (short)(unsigned int)(*nbytes);
+      break;
+    case VALTYPE_LONG_PTR:     
+      *value.a_long_ptr = (long)(*nbytes); 
+      break;
+#ifdef HAVE_LONG_LONG_INT
+    case VALTYPE_LONGLONG_PTR:
+      *value.a_longlong_ptr = (long long)(*nbytes);
+      break;
+#endif
+#ifdef HAVE_INTMAX_T
+    case VALTYPE_INTMAX_PTR:   
+      *value.a_intmax_ptr = (intmax_t)(*nbytes);
+      break;
+#endif
+    case VALTYPE_SIZE_PTR:
+      *value.a_size_ptr = (*nbytes); 
+      break;
+#ifdef HAVE_PTRDIFF_T
+    case VALTYPE_PTRDIFF_PTR:
+      *value.a_ptrdiff_ptr = (ptrdiff_t)(*nbytes);
+      break;
+#endif
+    case VALTYPE_INT_PTR:
+      *value.a_int_ptr = (int)(*nbytes);
+      break;
+    default:
+      return -1; /* An unsupported type has been used.  */
+    }
+
+  return 0;
+}
+
+
+
+/* Run the actual formatting.  OUTFNC and OUTFNCARG are the output
+   functions.  FORMAT is format string ARGSPECS is the parsed format
+   string, ARGSPECS_LEN the number of items in ARGSPECS.  VALUETABLE
+   holds the values and may be directly addressed using the position
+   arguments given by ARGSPECS.  MYERRNO is used for the "%m"
+   conversion. NBYTES well be updated to reflect the number of bytes
+   send to the output function. */ 
+static int 
+do_format (estream_printf_out_t outfnc, void *outfncarg,
+           const char *format, argspec_t argspecs, size_t argspecs_len,
+           valueitem_t valuetable, int myerrno, size_t *nbytes)
+{
+  int rc = 0;
+  const char *s;
+  argspec_t arg = argspecs;
+  int argidx = 0; /* Only used for assertion.  */
+  size_t n;
+  value_t value;
+
+  s = format;
+  while ( *s )
+    {
+      if (*s != '%')
+        {
+          s++;
+          continue;
+        }
+      if (s != format)
+        {
+          rc = outfnc (outfncarg, format, (n=s-format));
+          if (rc)
+            return rc;
+          *nbytes += n;
+        }
+      if (s[1] == '%')
+        {
+          /* Note that this code ignores one trailing percent escape -
+             this is however okay as the args parser must have
+             detected this already.  */
+          rc = outfnc (outfncarg, s, 1);
+          if (rc)
+            return rc;
+          *nbytes += 1;
+          s += 2;
+          format = s;
+          continue;
+        }
+
+      /* Save the next start.  */
+      s += arg->length;
+      format = s;
+ 
+      assert (argidx < argspecs_len);
+      argidx++;
+
+      /* Apply indirect field width and precision values.  */
+      if (arg->width == STAR_FIELD_VALUE)
+        {
+          assert (valuetable[arg->width_pos-1].vt == VALTYPE_INT);
+          arg->width = valuetable[arg->width_pos-1].value.a_int;
+          if (arg->width < 0)
+            {
+              arg->width = -arg->width;
+              arg->flags |= FLAG_LEFT_JUST;
+            }
+        }
+      if (arg->precision == STAR_FIELD_VALUE)
+        {
+          assert (valuetable[arg->precision_pos-1].vt == VALTYPE_INT);
+          arg->precision = valuetable[arg->precision_pos-1].value.a_int;
+          if (arg->precision < 0)
+            arg->precision = NO_FIELD_VALUE;
+        }
+
+      if (arg->arg_pos == -1 && arg->conspec == CONSPEC_STRERROR)
+        value.a_string = strerror (myerrno);
+      else
+        {
+          assert (arg->vt == valuetable[arg->arg_pos-1].vt);
+          value = valuetable[arg->arg_pos-1].value;
+        }
+
+      switch (arg->conspec)
+        {
+        case CONSPEC_UNKNOWN: assert (!"bug"); break;
+
+        case CONSPEC_DECIMAL:
+        case CONSPEC_UNSIGNED:
+        case CONSPEC_OCTAL:
+        case CONSPEC_HEX:
+        case CONSPEC_HEX_UP:
+          rc = pr_integer (outfnc, outfncarg, arg, value, nbytes);
+          break;
+        case CONSPEC_FLOAT:
+        case CONSPEC_FLOAT_UP:
+        case CONSPEC_EXP:
+        case CONSPEC_EXP_UP:
+        case CONSPEC_F_OR_G:
+        case CONSPEC_F_OR_G_UP:
+        case CONSPEC_HEX_EXP:
+        case CONSPEC_HEX_EXP_UP:
+          rc = pr_float (outfnc, outfncarg, arg, value, nbytes);
+          break;
+        case CONSPEC_CHAR:
+          rc = pr_char (outfnc, outfncarg, arg, value, nbytes);
+          break;
+        case CONSPEC_STRING:
+        case CONSPEC_STRERROR:
+          rc = pr_string (outfnc, outfncarg, arg, value, nbytes);
+          break;
+        case CONSPEC_POINTER:
+          rc = pr_pointer (outfnc, outfncarg, arg, value, nbytes);
+          break;
+        case CONSPEC_BYTES_SO_FAR:
+          rc = pr_bytes_so_far (outfnc, outfncarg, arg, value, nbytes);
+          break;
+        }
+      if (rc)
+        return rc;
+      arg++;    
+    }
+  
+  /* Print out any trailing stuff. */
+  n = s - format;
+  rc = n? outfnc (outfncarg, format, n) : 0;
+  if (!rc)
+    *nbytes += n;
+
+  return rc;
+}
+
+
+
+
+/* The versatile printf formatting routine.  It expects a callback
+   function OUTFNC and an opaque argument OUTFNCARG used for actual
+   output of the formatted stuff.  FORMAT is the format specification
+   and VAARGS a variable argumemt list matching the arguments of
+   FORMAT.  */
+int 
+estream_format (estream_printf_out_t outfnc,
+                void *outfncarg,
+                const char *format, va_list vaargs)
+{
+  /* Buffer to hold the argspecs and a pointer to it.*/
+  struct argspec_s argspecs_buffer[DEFAULT_MAX_ARGSPECS];
+  argspec_t argspecs = argspecs_buffer;
+  size_t argspecs_len;  /* Number of specifications in ARGSPECS.  */
+
+  /* Buffer to hold the description for the values.  */
+  struct valueitem_s valuetable_buffer[DEFAULT_MAX_VALUES];
+  valueitem_t valuetable = valuetable_buffer;
+
+  int rc;     /* Return code. */
+  size_t argidx; /* Used to index the argspecs array.  */
+  size_t validx; /* Used to index the valuetable.  */
+  int max_pos;/* Highest argument position.  */
+
+  size_t nbytes = 0; /* Keep track of the number of bytes passed to
+                        the output function.  */
+
+  int myerrno = errno; /* Save the errno for use with "%m". */
+
+
+  /* Parse the arguments to come up with descriptive list.  We can't
+     do this on the fly because we need to support positional
+     arguments. */
+  rc = parse_format (format, &argspecs, DIM(argspecs_buffer), &argspecs_len);
+  if (rc)
+    goto leave;
+
+  /* Check that all ARG_POS fields are set.  */
+  for (argidx=0,max_pos=0; argidx < argspecs_len; argidx++)
+    {
+      if (argspecs[argidx].arg_pos != -1 
+          && argspecs[argidx].arg_pos > max_pos)
+        max_pos = argspecs[argidx].arg_pos;
+      if (argspecs[argidx].width_pos > max_pos)
+        max_pos = argspecs[argidx].width_pos;
+      if (argspecs[argidx].precision_pos > max_pos)
+        max_pos = argspecs[argidx].precision_pos;
+    }
+  if (!max_pos)
+    {
+      /* Fill in all the positions.  */
+      for (argidx=0; argidx < argspecs_len; argidx++)
+        {
+          if (argspecs[argidx].width == STAR_FIELD_VALUE)
+            argspecs[argidx].width_pos = ++max_pos;
+          if (argspecs[argidx].precision == STAR_FIELD_VALUE)
+            argspecs[argidx].precision_pos = ++max_pos;
+          if (argspecs[argidx].arg_pos != -1 )
+            argspecs[argidx].arg_pos = ++max_pos;
+        }
+    }
+  else
+    {
+      /* Check that they are all filled.   More test are done later.  */
+      for (argidx=0; argidx < argspecs_len; argidx++)
+        {
+          if (!argspecs[argidx].arg_pos
+              || (argspecs[argidx].width == STAR_FIELD_VALUE
+                  && !argspecs[argidx].width_pos)
+              || (argspecs[argidx].precision == STAR_FIELD_VALUE
+                  && !argspecs[argidx].precision_pos))
+            goto leave_einval;
+        }
+    }
+  /* Check that there is no overflow in max_pos and that it has a
+     reasonable length.  There may never be more elements than the
+     number of characters in FORMAT.  */
+  if (max_pos < 0 || max_pos >= strlen (format))
+    goto leave_einval;
+
+#ifdef TEST
+  if (verbose > 1)
+    dump_argspecs (argspecs, argspecs_len);
+#endif
+
+  /* Allocate a table to hold the values.  If it is small enough we
+     use a stack allocated buffer.  */
+  if (max_pos > DIM(valuetable_buffer))
+    {
+      valuetable = calloc (max_pos, sizeof *valuetable);
+      if (!valuetable)
+        goto leave_error;
+    }
+  else
+    {
+      for (validx=0; validx < DIM(valuetable_buffer); validx++)
+        valuetable[validx].vt = VALTYPE_UNSUPPORTED;
+    }
+  for (argidx=0; argidx < argspecs_len; argidx++)
+    {
+      if (argspecs[argidx].arg_pos != - 1)
+        {
+          validx = argspecs[argidx].arg_pos - 1;
+          if (valuetable[validx].vt)
+            goto leave_einval; /* Already defined. */
+          valuetable[validx].vt = argspecs[argidx].vt;
+        }
+      if (argspecs[argidx].width == STAR_FIELD_VALUE)
+        {
+          validx = argspecs[argidx].width_pos - 1;
+          if (valuetable[validx].vt)
+            goto leave_einval; /* Already defined.  */
+          valuetable[validx].vt = VALTYPE_INT;
+        }
+      if (argspecs[argidx].precision == STAR_FIELD_VALUE)
+        {
+          validx = argspecs[argidx].precision_pos - 1;
+          if (valuetable[validx].vt)
+            goto leave_einval; /* Already defined.  */
+          valuetable[validx].vt = VALTYPE_INT;
+        }
+    }
+  
+  /* Read all the arguments.  This will error out for unsupported
+     types and for not given positional arguments. */
+  rc = read_values (valuetable, max_pos, vaargs);
+  if (rc)
+    goto leave_einval;  
+  
+/*   for (validx=0; validx < max_pos; validx++) */
+/*     fprintf (stderr, "%2d: vt=%d\n", validx, valuetable[validx].vt); */
+
+  /* Everything has been collected, go ahead with the formatting.  */
+  rc = do_format (outfnc, outfncarg, format,
+                  argspecs, argspecs_len, valuetable, myerrno, &nbytes);
+
+  goto leave;
+  
+ leave_einval:
+  errno = EINVAL;
+ leave_error:
+  rc = -1;
+ leave:
+  if (valuetable != valuetable_buffer)
+    free (valuetable);
+  if (argspecs != argspecs_buffer)
+    free (argspecs);
+  return rc;
+}
+
+
+
+
+/* A simple output handler utilizing stdio.  */
+static int
+plain_stdio_out (void *outfncarg, const char *buf, size_t buflen)
+{
+  FILE *fp = (FILE*)outfncarg;
+
+  if ( fwrite (buf, buflen, 1, fp) != 1 )
+    return -1;
+  return 0;
+}
+
+
+/* A replacement for printf.  */
+int
+estream_printf (const char *format, ...)
+{
+  int rc;
+  va_list arg_ptr;
+  
+  va_start (arg_ptr, format);
+  rc = estream_format (plain_stdio_out, stderr, format, arg_ptr);
+  va_end (arg_ptr);
+  
+  return rc;
+}
+
+/* A replacement for fprintf.  */
+int
+estream_fprintf (FILE *fp, const char *format, ...)
+{
+  int rc;
+  va_list arg_ptr;
+  
+  va_start (arg_ptr, format);
+  rc = estream_format (plain_stdio_out, fp, format, arg_ptr);
+  va_end (arg_ptr);
+  
+  return rc;
+}
+
+/* A replacement for vfprintf.  */
+int 
+estream_vfprintf (FILE *fp, const char *format, va_list arg_ptr)
+{
+  return estream_format (plain_stdio_out, fp, format, arg_ptr);
+}
+
+
+
+/* Communication object used between estream_snprintf and
+   fixed_buffer_out.  */
+struct fixed_buffer_parm_s
+{
+  size_t size;    /* Size of the buffer.  */
+  size_t count;   /* Number of bytes requested for output.  */
+  size_t used;    /* Used size of the buffer.  */
+  char *buffer;   /* Provided buffer.  */
+};
+
+/* A simple malloced buffer output handler.  */
+static int
+fixed_buffer_out (void *outfncarg, const char *buf, size_t buflen)
+{
+  struct fixed_buffer_parm_s *parm = outfncarg;
+
+  parm->count += buflen;
+
+  if (!parm->buffer)
+    ;
+  else if (parm->used + buflen < parm->size)
+    {
+      /* Handle the common case that everything fits into the buffer
+         separately.  */
+      memcpy (parm->buffer + parm->used, buf, buflen);
+      parm->used += buflen;
+    }
+  else
+    {
+      /* The slow version of above.  */
+      for ( ;buflen && parm->used < parm->size; buflen--)
+        parm->buffer[parm->used++] = *buf++;
+    }
+
+  return 0;
+}
+
+
+/* A replacement for vsnprintf. */
+int 
+estream_vsnprintf (char *buf, size_t bufsize,
+                   const char *format, va_list arg_ptr)
+{
+  struct fixed_buffer_parm_s parm;
+  int rc;
+
+  parm.size = bufsize;
+  parm.count = 0;
+  parm.used = 0;
+  parm.buffer = bufsize?buf:NULL;
+  rc = estream_format (fixed_buffer_out, &parm, format, arg_ptr);
+  if (!rc)
+    rc = fixed_buffer_out (&parm, "", 1); /* Print terminating Nul.  */
+  if (rc == -1)
+    return -1;
+  if (bufsize && buf && parm.size && parm.count >= parm.size)
+    buf[parm.size-1] = 0;
+
+  parm.count--; /* Do not count the trailing nul.  */
+  return (int)parm.count; /* Return number of bytes which would have
+                             been written.  */
+}
+
+/* A replacement for snprintf.  */
+int 
+estream_snprintf (char *buf, size_t bufsize, const char *format, ...)
+{
+  int rc;
+  va_list arg_ptr;
+
+  va_start (arg_ptr, format);
+  rc = estream_vsnprintf (buf, bufsize, format, arg_ptr);
+  va_end (arg_ptr);
+    
+  return rc;
+}
+
+
+
+/* Communication object used between estream_asprintf and
+   dynamic_buffer_out.  */
+struct dynamic_buffer_parm_s
+{
+  int error_flag; /* Internal helper.  */ 
+  size_t alloced; /* Allocated size of the buffer.  */
+  size_t used;    /* Used size of the buffer.  */
+  char *buffer;   /* Malloced buffer.  */
+};
+
+/* A simple malloced buffer output handler.  */
+static int
+dynamic_buffer_out (void *outfncarg, const char *buf, size_t buflen)
+{
+  struct dynamic_buffer_parm_s *parm = outfncarg;
+
+  if (parm->error_flag)
+    {
+      /* Just in case some formatting routine did not checked for an
+         error. */
+      errno = parm->error_flag;
+      return -1;
+    }
+
+  if (parm->used + buflen >= parm->alloced)
+    {
+      char *p;
+      
+      parm->alloced += buflen + 512;
+      p = realloc (parm->buffer, parm->alloced);
+      if (!p)
+        {
+          parm->error_flag = errno ? errno : ENOMEM;
+          /* Wipe out what we already accumulated.  This is useful in
+             case sensitive data is formated.  */
+          memset (parm->buffer, 0, parm->used);
+          return -1;
+        }
+      parm->buffer = p;
+    }
+  memcpy (parm->buffer + parm->used, buf, buflen);
+  parm->used += buflen;
+
+  return 0;
+}
+
+
+/* A replacement for vasprintf.  As with the BSD of vasprintf version -1
+   will be returned on error and NULL stored at BUFP.  On success the
+   number of bytes printed will be returned. */
+int 
+estream_vasprintf (char **bufp, const char *format, va_list arg_ptr)
+{
+  struct dynamic_buffer_parm_s parm;
+  int rc;
+
+  parm.error_flag = 0;
+  parm.alloced = 512;
+  parm.used = 0;
+  parm.buffer = my_printf_malloc (parm.alloced);
+  if (!parm.buffer)
+    {
+      *bufp = NULL;
+      return -1;
+    }
+  
+  rc = estream_format (dynamic_buffer_out, &parm, format, arg_ptr);
+  if (!rc)
+    rc = dynamic_buffer_out (&parm, "", 1); /* Print terminating Nul.  */
+  /* Fixme: Should we shrink the resulting buffer?  */
+  if (rc != -1 && parm.error_flag)
+    {
+      rc = -1;
+      errno = parm.error_flag;
+    }
+  if (rc == -1)
+    {
+      memset (parm.buffer, 0, parm.used);
+      my_printf_free (parm.buffer);
+      *bufp = NULL;
+      return -1;
+    }
+  assert (parm.used);   /* We have at least the terminating Nul.  */
+  *bufp = parm.buffer;
+  return parm.used - 1; /* Do not include that Nul. */
+}
+
+/* A replacement for asprintf.  As with the BSD of asprintf version -1
+   will be returned on error and NULL stored at BUFP.  On success the
+   number of bytes printed will be returned. */
+int 
+estream_asprintf (char **bufp, const char *format, ...)
+{
+  int rc;
+  va_list arg_ptr;
+
+  va_start (arg_ptr, format);
+  rc = estream_vasprintf (bufp, format, arg_ptr);
+  va_end (arg_ptr);
+    
+  return rc;
+}
+
+
+#ifdef TEST
+
+static int
+one_test (const char *format, ...)
+{
+#ifdef _WIN32
+  {
+    static int show;
+
+    if (!show)
+      {
+        /* We do not have a system vasprintf.  */
+        printf ("one-test: disabled under W32\n");
+        show = 1;
+      }
+  }
+#else    
+  int rc1, rc2;
+  va_list arg_ptr;
+  char *buf1, *buf2;
+
+  if (verbose)
+    printf ("format: ->%s<-\n", format);
+
+  va_start (arg_ptr, format);
+  rc1 = vasprintf (&buf1, format, arg_ptr);
+  va_end (arg_ptr);
+  if (rc1 == -1)
+    {
+      printf ("   sys: errno=%d (%s)\n", errno, strerror (errno));
+      buf1 = NULL;
+    }
+  else if (verbose)
+    printf ("   sys: ->%s<-\n", buf1);
+  
+  va_start (arg_ptr, format);
+  rc2 = estream_vasprintf (&buf2, format, arg_ptr);
+  va_end (arg_ptr);
+  if (rc2 == -1)
+    printf ("   our: errno=%d (%s)\n", errno, strerror (errno));
+  else if (verbose)
+    printf ("   our: ->%s<-\n", buf2);
+
+  if (rc1 != -1 && rc2 != -1 && strcmp (buf1, buf2))
+    printf ("error: output does not match\n"
+            "format: ->%s<-\n   sys: ->%s<-\n   our: ->%s<-\n",
+            format, buf1, buf2);
+  else if ( rc1 != rc2 )
+    printf ("error: return codes are different: sys_rc=%d our_rc=%d\n",
+            rc1, rc2);
+
+  free (buf2);
+  free (buf1);
+#endif
+  return 0;
+}
+
+
+static void
+run_tests (void)
+{
+  /*one_test ("%d %% %'d", 17, 19681977);*/
+
+  one_test ("%d %% %d", 17, 768114563);
+  one_test ("%d %% %d", 17, -768114563);
+
+  one_test ("%d", 17);
+  one_test ("%4d", 17);
+  one_test ("%40d", 17);
+  one_test ("%-d", 17);
+  one_test ("%-4d", 17);
+  one_test ("%-140d", 17);
+  one_test ("%d", -17);
+  one_test ("%4d", -17);
+  one_test ("%40d", -17);
+  one_test ("%-d", -17);
+  one_test ("%-4d", -17);
+  one_test ("%-40d", -17);
+
+  one_test ("%+4d", 17);
+  one_test ("%+4d", -17);
+  one_test ("%-+4d", 17);
+  one_test ("%-+4d", -17);
+  one_test ("% 4d", 17);
+  one_test ("% 4d", -17);
+  one_test ("%- +4d", 17);
+  one_test ("%- +4d", -17);
+
+  one_test ("%.4d", 17);
+  one_test ("%.0d", 17);
+  one_test ("%.0d", 0);
+  one_test ("%.4d", -17);
+  one_test ("%.0d", -17);
+  one_test ("%6.4d", 17);
+  one_test ("%6.4d", -17);
+  one_test ("%6.0d", 0);
+  one_test ("%4.6d", 17);
+  one_test ("%4.6d", -17);
+
+  one_test ("% 4.6d", 17);
+  one_test ("% 6.0d", 0);
+
+  one_test ("%.4d", 17);
+  one_test ("%04d", 17);
+  one_test ("%.4d", -17);
+  one_test ("%04d", -17);
+  one_test ("%0.d", 0);
+
+  one_test ("%*d", 7, 42);
+  one_test ("%*d", -7, 42);
+  one_test ("%.*d", 7, 42);
+  one_test ("%.*d", -7, 42);
+  one_test ("%*.*d", 10, 7, 42);
+  one_test ("%*.*d", 10, -7, 42);
+  one_test ("%*.*d", -10, 7, 42);
+  one_test ("%*.*d", -10, -7, 42);
+
+  one_test ("%*x", 7, 42);
+  one_test ("%*x", -7, 42);
+  one_test ("%.*x", 7, 42);
+  one_test ("%.*x", -7, 42);
+  one_test ("%*.*x", 10, 7, 42);
+  one_test ("%*.*x", 10, -7, 42);
+  one_test ("%*.*x", -10, 7, 42);
+  one_test ("%*.*x", -10, -7, 42);
+  one_test ("%#*x", 7, 42);
+  one_test ("%#*x", -7, 42);
+  one_test ("%#.*x", 7, 42);
+  one_test ("%#.*x", -7, 42);
+  one_test ("%#*.*x", 10, 7, 42);
+  one_test ("%#*.*x", 10, -7, 42);
+  one_test ("%#*.*x", -10, 7, 42);
+  one_test ("%#*.*x", -10, -7, 42);
+
+  one_test ("%*X", 7, 42);
+  one_test ("%*X", -7, 42);
+  one_test ("%.*X", 7, 42);
+  one_test ("%.*X", -7, 42);
+  one_test ("%*.*X", 10, 7, 42);
+  one_test ("%*.*X", 10, -7, 42);
+  one_test ("%*.*X", -10, 7, 42);
+  one_test ("%*.*X", -10, -7, 42);
+  one_test ("%#*X", 7, 42);
+  one_test ("%#*X", -7, 42);
+  one_test ("%#.*X", 7, 42);
+  one_test ("%#.*X", -7, 42);
+  one_test ("%#*.*X", 10, 7, 42);
+  one_test ("%#*.*X", 10, -7, 42);
+  one_test ("%#*.*X", -10, 7, 42);
+  one_test ("%#*.*X", -10, -7, 42);
+
+  one_test ("%*o", 7, 42);
+  one_test ("%*o", -7, 42);
+  one_test ("%.*o", 7, 42);
+  one_test ("%.*o", -7, 42);
+  one_test ("%*.*o", 10, 7, 42);
+  one_test ("%*.*o", 10, -7, 42);
+  one_test ("%*.*o", -10, 7, 42);
+  one_test ("%*.*o", -10, -7, 42);
+  one_test ("%#*o", 7, 42);
+  one_test ("%#*o", -7, 42);
+  one_test ("%#.*o", 7, 42);
+  one_test ("%#.*o", -7, 42);
+  one_test ("%#*.*o", 10, 7, 42);
+  one_test ("%#*.*o", 10, -7, 42);
+  one_test ("%#*.*o", -10, 7, 42);
+  one_test ("%#*.*o", -10, -7, 42);
+
+  one_test ("%s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%.0s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%.10s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%.48s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%.49s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%.50s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%.51s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%48s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%49s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%50s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%51s", "the quick brown fox jumps over the lazy dogs back");
+  one_test ("%-51s", "the quick brown fox jumps over the lazy dogs back");
+
+  one_test ("/%s=", "CN");
+
+  one_test ("%f", 3.1415926535);
+  one_test ("%f", -3.1415926535);
+  one_test ("%.10f", 3.1415926535);
+  one_test ("%.2f", 3.1415926535);
+  one_test ("%.1f", 3.1415926535);
+  one_test ("%.0f", 3.1415926535);
+  one_test ("%.20f", 3.1415926535);
+  one_test ("%10.10f", 3.1415926535);
+  one_test ("%10.2f", 3.1415926535);
+  one_test ("%10.1f", 3.1415926535);
+  one_test ("%10.0f", 3.1415926535);
+  one_test ("%30.20f", 3.1415926535);
+  one_test ("%10.10f", -3.1415926535);
+  one_test ("%10.2f", -3.1415926535);
+  one_test ("%10.1f", -3.1415926535);
+  one_test ("%10.0f", -3.1415926535);
+  one_test ("%30.20f", -3.1415926535);
+
+  one_test ("%-10f", 3.1415926535);
+  one_test ("%-10.10f", 3.1415926535);
+  one_test ("%-10.2f", 3.1415926535);
+  one_test ("%-10.1f", 3.1415926535);
+  one_test ("%-10.0f", 3.1415926535);
+  one_test ("%-30.20f", 3.1415926535);
+  one_test ("%-10f", -3.1415926535);
+  one_test ("%-10.10f", -3.1415926535);
+  one_test ("%-10.2f", -3.1415926535);
+  one_test ("%-10.1f", -3.1415926535);
+  one_test ("%-10.0f", -3.1415926535);
+  one_test ("%-30.20f", -3.1415926535);
+
+  one_test ("%#.0f",  3.1415926535);
+  one_test ("%#10.0f",  3.1415926535);
+  one_test ("%#10.0f", -3.1415926535);
+  one_test ("%-#10.0f",  3.1415926535);
+  one_test ("%-#10.0f", -3.1415926535);
+
+  one_test ("%e", 3.1415926535);
+  one_test ("%g", 3.1415926535);
+
+  one_test ("%a", 1);
+  one_test ("%a", -1);
+  one_test ("%a", 3.1415926535);
+
+#ifdef HAVE_LONG_DOUBLE
+  one_test ("%La", 1);
+  one_test ("%La", -1);
+  one_test ("%La", 3.1415926535);
+#endif
+
+#ifdef __GLIBC__
+  /* "%m" is a glibc extension so this _test_ will only work on such a
+     system.  */
+  errno = ENOENT;
+  one_test ("%m");
+  errno = ENOENT;
+  one_test ("%d=%m", 17);
+  errno = ENOENT;
+  one_test ("%2$d:%m:%1$d", 42, 17);
+#endif /*__GLIBC__*/
+
+}
+
+static void
+check_snprintf (void)
+{
+  char buffer[20];
+  int rc, rc2;
+  size_t tmplen, blen, blen2;
+
+  rc = estream_snprintf (buffer, 0, "%*s", 18, "");
+  if (rc != 18)
+    printf ("rc=%d\n", rc );
+  rc = estream_snprintf (buffer, sizeof buffer, "%*s", 18, "");
+  if (rc != 18)
+    printf ("rc=%d, strlen(buffer)=%d\n", rc, (int)strlen (buffer));
+  rc = estream_snprintf (buffer, sizeof buffer, "%*s", 19, "");
+  if (rc != 19)
+    printf ("rc=%d, strlen(buffer)=%d\n", rc, (int)strlen (buffer));
+  rc = estream_snprintf (buffer, sizeof buffer, "%*s", 20, "");
+  if (rc != 20)
+    printf ("rc=%d, strlen(buffer)=%d\n", rc, (int)strlen (buffer));
+  rc = estream_snprintf (buffer, sizeof buffer, "%*s", 21, "");
+  if (rc != 21)
+    printf ("rc=%d, strlen(buffer)=%d\n", rc, (int)strlen (buffer));
+
+  for (tmplen = 0; tmplen <= sizeof buffer; tmplen++)
+    {
+      rc = estream_snprintf (buffer, tmplen, "%04d%02d%02dT%02d%02d%02d",
+                             1998, 9, 7, 16, 56, 05);
+      blen = strlen (buffer);
+      rc2 = snprintf (buffer, tmplen, "%04d%02d%02dT%02d%02d%02d",
+                     1998, 9, 7, 16, 56, 05);
+      blen2 = strlen (buffer);
+      if (rc != rc2 || blen != blen2)
+        printf ("snprintf test with len %u gives %d instead of %d (%d,%d)\n",
+                (unsigned int)tmplen, rc, rc2, blen, blen2);
+    }
+}
+
+
+
+int
+main (int argc, char **argv)
+{
+  int rc;
+
+  if (argc) {argc--; argv++; }
+
+  setlocale (LC_NUMERIC, "");
+
+  while (argc && !strcmp (*argv, "--verbose"))
+    {
+      verbose++;
+      argc--;
+      argv++;
+    }
+
+  if (!argc)
+    {
+      run_tests ();
+      check_snprintf () ;
+    }
+  else
+    {
+      rc = estream_vfprintf (stdout, argv[0], NULL);
+      fflush (stdout);
+      fprintf (stderr, "[estream_vfprintf returns: %d]\n", rc);
+    }
+
+  return 0;
+}
+#endif /*TEST*/
+/*
+Local Variables:
+compile-command: "cc -Wall -O3 -g -I.. -DHAVE_CONFIG_H -DTEST -o estream-printf estream-printf.c"
+End:
+*/

+ 110 - 0
src/estream-printf.h

@@ -0,0 +1,110 @@
+/* estream-printf.h - Versatile C-99 compliant printf formatting.
+ * Copyright (C) 2007 g10 Code GmbH
+ *
+ * This file is part of Libestream.
+ *
+ * Libestream is free software; you can redistribute 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.
+ *
+ * Libestream is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Libestream; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ESTREAM_PRINTF_H
+#define ESTREAM_PRINTF_H
+
+#include <stdarg.h>
+#include <stdio.h>
+
+/* To use this file with libraries the following macro is useful:
+
+     #define _ESTREAM_EXT_SYM_PREFIX _foo_
+   
+       This prefixes all external symbols with "_foo_".
+
+   For the implementation of the code (estream-printf.c) the following
+   macros may be used to tune the implementation for certain systems:
+
+     #define _ESTREAM_PRINTF_MALLOC foo_malloc
+     #define _ESTREAM_PRINTF_FREE   foo_free
+
+       Make estream_asprintf and estream_vasprintf use foo_malloc and
+       foo_free instead of the standard malloc and free functions to
+       allocate the memory returned to the caller.
+
+     #define  _ESTREAM_PRINTF_EXTRA_INCLUDE "foo.h"
+
+       This includes the file "foo.h" which may provide prototypes for
+       the custom memory allocation functions.
+ */
+
+
+#ifdef _ESTREAM_EXT_SYM_PREFIX
+#ifndef _ESTREAM_PREFIX
+#define _ESTREAM_PREFIX1(x,y)  x ## y
+#define _ESTREAM_PREFIX2(x,y) _ESTREAM_PREFIX1(x,y)
+#define _ESTREAM_PREFIX(x)    _ESTREAM_PREFIX2(_ESTREAM_EXT_SYM_PREFIX,x)
+#endif /*_ESTREAM_PREFIX*/
+#define estream_printf_out_t  _ESTREAM_PREFIX(estream_printf_out_t)
+#define estream_format        _ESTREAM_PREFIX(estream_format)
+#define estream_printf        _ESTREAM_PREFIX(estream_printf)
+#define estream_fprintf       _ESTREAM_PREFIX(estream_fprintf)
+#define estream_vfprintf      _ESTREAM_PREFIX(estream_vfprintf)
+#define estream_snprintf      _ESTREAM_PREFIX(estream_snprintf)
+#define estream_vsnprintf     _ESTREAM_PREFIX(estream_vsnprintf)
+#define estream_asprintf      _ESTREAM_PREFIX(estream_asprintf)
+#define estream_vasprintf     _ESTREAM_PREFIX(estream_vasprintf)
+#endif /*_ESTREAM_EXT_SYM_PREFIX*/
+
+#ifndef _ESTREAM_GCC_A_PRINTF
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
+# define _ESTREAM_GCC_A_PRINTF( f, a )  __attribute__ ((format (printf,f,a)))
+#else
+# define _ESTREAM_GCC_A_PRINTF( f, a )
+#endif
+#endif /*_ESTREAM_GCC_A_PRINTF*/
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0
+}
+#endif
+#endif
+
+
+typedef int (*estream_printf_out_t)
+     (void *outfncarg,  const char *buf, size_t buflen);
+
+int estream_format (estream_printf_out_t outfnc, void *outfncarg,
+                    const char *format, va_list vaargs) 
+     _ESTREAM_GCC_A_PRINTF(3,0);
+int estream_printf (const char *format, ...) 
+     _ESTREAM_GCC_A_PRINTF(1,2);
+int estream_fprintf (FILE *fp, const char *format, ... )
+     _ESTREAM_GCC_A_PRINTF(2,3);
+int estream_vfprintf (FILE *fp, const char *format, va_list arg_ptr)
+     _ESTREAM_GCC_A_PRINTF(2,0);
+int estream_snprintf (char *buf, size_t bufsize, const char *format, ...)
+     _ESTREAM_GCC_A_PRINTF(3,4);
+int estream_vsnprintf (char *buf,size_t bufsize, 
+                       const char *format, va_list arg_ptr) 
+     _ESTREAM_GCC_A_PRINTF(3,0);
+int estream_asprintf (char **bufp, const char *format, ...)
+     _ESTREAM_GCC_A_PRINTF(2,3);
+int estream_vasprintf (char **bufp, const char *format, va_list arg_ptr)
+     _ESTREAM_GCC_A_PRINTF(2,0);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*ESTREAM_PRINTF_H*/

+ 0 - 45
src/realloc.c

@@ -1,45 +0,0 @@
-/* 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 <config.h>
-#undef realloc
-
-#include <stdlib.h>
-
-/* 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);
-}

+ 14 - 7
src/slots.c

@@ -546,11 +546,6 @@ slot_token_manufacturer (slot_iterator_t id)
   /* Note:  Make sure that there is no colon or linefeed in the string. */
   switch (uval)
     {
-    case 0:
-      /* Fall-through.  */
-    case 0xffff:
-      return "test card";
-
     case 0x0001:
       return "PPC Card Systems";
 
@@ -560,8 +555,20 @@ slot_token_manufacturer (slot_iterator_t id)
     case 0x0003:
       return "OpenFortress";
 
-    default:
-      return "unknown";
+    case 0x0004:
+      return "Wewid AB";
+
+    case 0x0005:
+      return "ZeitControl";
+
+    case 0x002A:
+      return "Magrathea";
+
+    case 0x0000:
+    case 0xffff:
+      return "test card";
+
+    default: return (uval & 0xff00) == 0xff00? "unmanaged S/N range":"unknown";
     }
 
   /* Not reached.  */

+ 0 - 47
src/stpcpy.c

@@ -1,47 +0,0 @@
-/* stpcpy.c -- copy a string and return pointer to end of new string
-   Copyright (C) 1992, 1995, 1997-1998, 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 <config.h>
-
-#include <string.h>
-
-#undef __stpcpy
-#undef stpcpy
-
-#ifndef weak_alias
-# define __stpcpy stpcpy
-#endif
-
-/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST.  */
-char *
-__stpcpy (char *dest, const char *src)
-{
-  register char *d = dest;
-  register const char *s = src;
-
-  do
-    *d++ = *s;
-  while (*s++ != '\0');
-
-  return d - 1;
-}
-#ifdef weak_alias
-weak_alias (__stpcpy, stpcpy)
-#endif

+ 0 - 41
src/stpcpy.h

@@ -1,41 +0,0 @@
-/* String copying.
-   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.  */
-
-#ifndef _STPCPY_H
-#define _STPCPY_H
-
-#if HAVE_STPCPY
-
-/* Get stpcpy() declaration.  */
-#include <string.h>
-
-#else
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
-extern char *stpcpy (char *dst, const char *src);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif /* _STPCPY_H */

+ 19 - 3
src/support.h

@@ -52,9 +52,13 @@ scute_copy_string (char *dest, char *src, int max_len)
     *(dest++) = ' ';
 }
 
-#ifndef HAVE_STPCPY
-#include "stpcpy.h"
-#endif
+/* Include our own asprintf functions for better portability.  We also
+   replace the standard snprintf with our implementation due to a bug
+   in some mingw32 versions related to the 'l' format modifier.  */
+#include "estream-printf.h"
+#define asprintf  estream_asprintf
+#define vasprintf estream_vasprintf
+#define snprintf  estream_snprintf
 
 /*-- Simple replacement functions. */
 #ifndef HAVE_TTYNAME
@@ -66,6 +70,18 @@ ttyname (int fd)
 }
 #endif /* !HAVE_TTYNAME */
 
+#ifndef HAVE_STPCPY
+static inline char *
+stpcpy (char *a, const char *b)
+{
+    while( *b )
+	*a++ = *b++;
+    *a = 0;
+
+    return (char*)a;
+}
+#endif /* !HAVE_STPCPY */
+
 
 
 const char *get_gpgsm_path (void);

+ 0 - 192
src/vasprintf.c

@@ -1,192 +0,0 @@
-/* Like vsprintf but provides a pointer to malloc'd storage, which must
-   be freed by the caller.
-   Copyright (C) 1994, 2002 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-
-#ifndef va_copy /* According to POSIX, va_copy is a macro. */
-#if defined (__GNUC__) && defined (__PPC__) \
-     && (defined (_CALL_SYSV) || defined (_WIN32))
-#define va_copy(d, s) (*(d) = *(s))
-#elif defined (MUST_COPY_VA_BYVAL)
-#define va_copy(d, s) ((d) = (s))
-#else 
-#define va_copy(d, s) memcpy ((d), (s), sizeof (va_list))
-#endif 
-#endif 
-
-
-#ifdef TEST
-int global_total_width;
-#endif
-
-static int int_vasprintf (char **, const char *, va_list *);
-
-static int
-int_vasprintf (result, format, args)
-     char **result;
-     const char *format;
-     va_list *args;
-{
-  const char *p = format;
-  /* Add one to make sure that it is never zero, which might cause malloc
-     to return NULL.  */
-  int total_width = strlen (format) + 1;
-  va_list ap;
-
-  va_copy (ap, *args);
-
-  while (*p != '\0')
-    {
-      if (*p++ == '%')
-	{
-	  while (strchr ("-+ #0", *p))
-	    ++p;
-	  if (*p == '*')
-	    {
-	      ++p;
-	      total_width += abs (va_arg (ap, int));
-	    }
-	  else
-	    total_width += strtoul (p, (char **) &p, 10);
-	  if (*p == '.')
-	    {
-	      ++p;
-	      if (*p == '*')
-		{
-		  ++p;
-		  total_width += abs (va_arg (ap, int));
-		}
-	      else
-	      total_width += strtoul (p, (char **) &p, 10);
-	    }
-	  while (strchr ("hlL", *p))
-	    ++p;
-	  /* Should be big enough for any format specifier except %s and floats.  */
-	  total_width += 30;
-	  switch (*p)
-	    {
-	    case 'd':
-	    case 'i':
-	    case 'o':
-	    case 'u':
-	    case 'x':
-	    case 'X':
-	    case 'c':
-	      (void) va_arg (ap, int);
-	      break;
-	    case 'f':
-	    case 'e':
-	    case 'E':
-	    case 'g':
-	    case 'G':
-	      (void) va_arg (ap, double);
-	      /* Since an ieee double can have an exponent of 307, we'll
-		 make the buffer wide enough to cover the gross case. */
-	      total_width += 307;
-	      break;
-	    case 's':
-              {
-                char *tmp = va_arg (ap, char *);
-                if (tmp)
-                  total_width += strlen (tmp);
-                else /* in case the vsprintf does prints a text */
-                  total_width += 25; /* e.g. "(null pointer reference)" */
-              }
-	      break;
-	    case 'p':
-	    case 'n':
-	      (void) va_arg (ap, char *);
-	      break;
-	    }
-	  p++;
-	}
-    }
-#ifdef TEST
-  global_total_width = total_width;
-#endif
-  *result = malloc (total_width);
-  if (*result != NULL)
-    return vsprintf (*result, format, *args);
-  else
-    return 0;
-}
-
-int
-vasprintf (result, format, args)
-     char **result;
-     const char *format;
-#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
-     _BSD_VA_LIST_ args;
-#else
-     va_list args;
-#endif
-{
-  return int_vasprintf (result, format, &args);
-}
-
-
-int
-asprintf (char **buf, const char *fmt, ...)
-{
-  int status;
-  va_list ap;
-
-  va_start (ap, fmt);
-  status = vasprintf (buf, fmt, ap);
-  va_end (ap);
-  return status;
-}
-
-
-#ifdef TEST
-void
-checkit (const char* format, ...)
-{
-  va_list args;
-  char *result;
-
-  va_start (args, format);
-  vasprintf (&result, format, args);
-  if (strlen (result) < global_total_width)
-    printf ("PASS: ");
-  else
-    printf ("FAIL: ");
-  printf ("%d %s\n", global_total_width, result);
-}
-
-int
-main (void)
-{
-  checkit ("%d", 0x12345678);
-  checkit ("%200d", 5);
-  checkit ("%.300d", 6);
-  checkit ("%100.150d", 7);
-  checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
-777777777777777777333333333333366666666666622222222222777777777777733333");
-  checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
-}
-#endif /* TEST */

+ 2 - 2
src/versioninfo.rc.in

@@ -36,10 +36,10 @@ BEGIN
         BEGIN
             VALUE "Comments", "Provided under the terms of the GNU Lesser General Public License.\0"
             VALUE "CompanyName", "g10 Code GmbH\0"
-            VALUE "FileDescription", "SCUTE - GnuPG Made Easy\0"
+            VALUE "FileDescription", "SCUTE - The GnuPG PKCS#11 interface\0"
             VALUE "FileVersion", "@LIBSCUTE_LT_CURRENT@.@LIBSCUTE_LT_AGE@.@LIBSCUTE_LT_REVISION@.@BUILD_REVISION@\0"
             VALUE "InternalName", "scute\0"
-            VALUE "LegalCopyright", "Copyright © 2005, 2008 g10 Code GmbH\0"
+            VALUE "LegalCopyright", "Copyright © 2005, 2008, 2009 g10 Code GmbH\0"
             VALUE "LegalTrademarks", "\0"
             VALUE "OriginalFilename", "scute.dll\0"
             VALUE "PrivateBuild", "\0"

Some files were not shown because too many files changed in this diff