- Remove gtk-doc.
[fedora-mingw.git] / gtk-vnc / gtk-vnc-0.3.7-mingw32-gnulib-files.patch
1 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/alloca.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/alloca.in.h
2 --- gtk-vnc-0.3.7.dan3/gnulib/lib/alloca.in.h   1970-01-01 01:00:00.000000000 +0100
3 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/alloca.in.h 2008-10-09 15:24:52.000000000 +0100
4 @@ -0,0 +1,56 @@
5 +/* Memory allocation on the stack.
6 +
7 +   Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software
8 +   Foundation, Inc.
9 +
10 +   This program is free software; you can redistribute it and/or modify it
11 +   under the terms of the GNU Lesser General Public License as published
12 +   by the Free Software Foundation; either version 2.1, or (at your option)
13 +   any later version.
14 +
15 +   This program is distributed in the hope that it will be useful,
16 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 +   General Public License for more details.
19 +
20 +   You should have received a copy of the GNU Lesser General Public
21 +   License along with this program; if not, write to the Free Software
22 +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23 +   USA.  */
24 +
25 +/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
26 +   means there is a real alloca function.  */
27 +#ifndef _GL_ALLOCA_H
28 +#define _GL_ALLOCA_H
29 +
30 +/* alloca (N) returns a pointer to N bytes of memory
31 +   allocated on the stack, which will last until the function returns.
32 +   Use of alloca should be avoided:
33 +     - inside arguments of function calls - undefined behaviour,
34 +     - in inline functions - the allocation may actually last until the
35 +       calling function returns,
36 +     - for huge N (say, N >= 65536) - you never know how large (or small)
37 +       the stack is, and when the stack cannot fulfill the memory allocation
38 +       request, the program just crashes.
39 + */
40 +
41 +#ifndef alloca
42 +# ifdef __GNUC__
43 +#  define alloca __builtin_alloca
44 +# elif defined _AIX
45 +#  define alloca __alloca
46 +# elif defined _MSC_VER
47 +#  include <malloc.h>
48 +#  define alloca _alloca
49 +# elif defined __DECC && defined __VMS
50 +#  define alloca __ALLOCA
51 +# else
52 +#  include <stddef.h>
53 +#  ifdef  __cplusplus
54 +extern "C"
55 +#  endif
56 +void *alloca (size_t);
57 +# endif
58 +#endif
59 +
60 +#endif /* _GL_ALLOCA_H */
61 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/arpa_inet.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/arpa_inet.in.h
62 --- gtk-vnc-0.3.7.dan3/gnulib/lib/arpa_inet.in.h        1970-01-01 01:00:00.000000000 +0100
63 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/arpa_inet.in.h      2008-10-09 15:24:52.000000000 +0100
64 @@ -0,0 +1,80 @@
65 +/* A GNU-like <arpa/inet.h>.
66 +
67 +   Copyright (C) 2005-2006, 2008 Free Software Foundation, Inc.
68 +
69 +   This program is free software; you can redistribute it and/or modify
70 +   it under the terms of the GNU Lesser General Public License as published by
71 +   the Free Software Foundation; either version 2.1, or (at your option)
72 +   any later version.
73 +
74 +   This program is distributed in the hope that it will be useful,
75 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
76 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
77 +   GNU Lesser General Public License for more details.
78 +
79 +   You should have received a copy of the GNU Lesser General Public License
80 +   along with this program; if not, write to the Free Software Foundation,
81 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
82 +
83 +#ifndef _GL_ARPA_INET_H
84 +
85 +/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
86 +   under MinGW. */
87 +#include <sys/socket.h>
88 +
89 +#if @HAVE_ARPA_INET_H@
90 +
91 +@PRAGMA_SYSTEM_HEADER@
92 +
93 +/* The include_next requires a split double-inclusion guard.  */
94 +# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
95 +
96 +#endif
97 +
98 +#ifndef _GL_ARPA_INET_H
99 +#define _GL_ARPA_INET_H
100 +
101 +/* The definition of GL_LINK_WARNING is copied here.  */
102 +
103 +#if @GNULIB_INET_NTOP@
104 +# if !@HAVE_DECL_INET_NTOP@
105 +/* Converts an internet address from internal format to a printable,
106 +   presentable format.
107 +   AF is an internet address family, such as AF_INET or AF_INET6.
108 +   SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
109 +   (for AF_INET6).
110 +   DST points to a buffer having room for CNT bytes.
111 +   The printable representation of the address (in numeric form, not
112 +   surrounded by [...], no reverse DNS is done) is placed in DST, and
113 +   DST is returned.  If an error occurs, the return value is NULL and
114 +   errno is set.  If CNT bytes are not sufficient to hold the result,
115 +   the return value is NULL and errno is set to ENOSPC.  A good value
116 +   for CNT is 46.
117 +
118 +   For more details, see the POSIX:2001 specification
119 +   <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
120 +extern const char *inet_ntop (int af, const void *restrict src,
121 +                             char *restrict dst, socklen_t cnt);
122 +# endif
123 +#elif defined GNULIB_POSIXCHECK
124 +# undef inet_ntop
125 +# define inet_ntop(af,src,dst,cnt) \
126 +    (GL_LINK_WARNING ("inet_ntop is unportable - " \
127 +                      "use gnulib module inet_ntop for portability"), \
128 +     inet_ntop (af, src, dst, cnt))
129 +#endif
130 +
131 +#if @GNULIB_INET_PTON@
132 +# if !@HAVE_DECL_INET_PTON@
133 +extern int inet_pton (int af, const char *restrict src, void *restrict dst);
134 +# endif
135 +#elif defined GNULIB_POSIXCHECK
136 +# undef inet_pton
137 +# define inet_pton(af,src,dst) \
138 +  (GL_LINK_WARNING ("inet_pton is unportable - " \
139 +                   "use gnulib module inet_pton for portability"), \
140 +   inet_pton (af, src, dst))
141 +#endif
142 +
143 +#endif /* _GL_ARPA_INET_H */
144 +#endif /* _GL_ARPA_INET_H */
145 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/asnprintf.c gtk-vnc-0.3.7.gnulib/gnulib/lib/asnprintf.c
146 --- gtk-vnc-0.3.7.dan3/gnulib/lib/asnprintf.c   1970-01-01 01:00:00.000000000 +0100
147 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/asnprintf.c 2008-10-09 15:24:52.000000000 +0100
148 @@ -0,0 +1,35 @@
149 +/* Formatted output to strings.
150 +   Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
151 +
152 +   This program is free software; you can redistribute it and/or modify
153 +   it under the terms of the GNU Lesser General Public License as published by
154 +   the Free Software Foundation; either version 2.1, or (at your option)
155 +   any later version.
156 +
157 +   This program is distributed in the hope that it will be useful,
158 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
159 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
160 +   GNU Lesser General Public License for more details.
161 +
162 +   You should have received a copy of the GNU Lesser General Public License along
163 +   with this program; if not, write to the Free Software Foundation,
164 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
165 +
166 +#include <config.h>
167 +
168 +/* Specification.  */
169 +#include "vasnprintf.h"
170 +
171 +#include <stdarg.h>
172 +
173 +char *
174 +asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
175 +{
176 +  va_list args;
177 +  char *result;
178 +
179 +  va_start (args, format);
180 +  result = vasnprintf (resultbuf, lengthp, format, args);
181 +  va_end (args);
182 +  return result;
183 +}
184 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/dummy.c gtk-vnc-0.3.7.gnulib/gnulib/lib/dummy.c
185 --- gtk-vnc-0.3.7.dan3/gnulib/lib/dummy.c       1970-01-01 01:00:00.000000000 +0100
186 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/dummy.c     2008-10-09 15:24:52.000000000 +0100
187 @@ -0,0 +1,42 @@
188 +/* A dummy file, to prevent empty libraries from breaking builds.
189 +   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
190 +
191 +   This program is free software: you can redistribute it and/or modify
192 +   it under the terms of the GNU Lesser General Public License as published by
193 +   the Free Software Foundation; either version 2.1 of the License, or
194 +   (at your option) any later version.
195 +
196 +   This program is distributed in the hope that it will be useful,
197 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
198 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
199 +   GNU Lesser General Public License for more details.
200 +
201 +   You should have received a copy of the GNU Lesser General Public License
202 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
203 +
204 +/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
205 +   libraries without any object files.  You might get an error like:
206 +
207 +   > ar cru .libs/libgl.a
208 +   > ar: no archive members specified
209 +
210 +   Compiling this file, and adding its object file to the library, will
211 +   prevent the library from being empty.  */
212 +
213 +/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
214 +   that don't export any symbol.  You might get an error like:
215 +
216 +   > cc ... libgnu.a
217 +   > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
218 +
219 +   Compiling this file, and adding its object file to the library, will
220 +   prevent the library from exporting no symbols.  */
221 +
222 +#ifdef __sun
223 +/* This declaration ensures that the library will export at least 1 symbol.  */
224 +int gl_dummy_symbol;
225 +#else
226 +/* This declaration is solely to ensure that after preprocessing
227 +   this file is never empty.  */
228 +typedef int dummy;
229 +#endif
230 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/errno.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/errno.in.h
231 --- gtk-vnc-0.3.7.dan3/gnulib/lib/errno.in.h    1970-01-01 01:00:00.000000000 +0100
232 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/errno.in.h  2008-10-09 15:24:52.000000000 +0100
233 @@ -0,0 +1,153 @@
234 +/* A POSIX-like <errno.h>.
235 +
236 +   Copyright (C) 2008 Free Software Foundation, Inc.
237 +
238 +   This program is free software; you can redistribute it and/or modify
239 +   it under the terms of the GNU Lesser General Public License as published by
240 +   the Free Software Foundation; either version 2.1, or (at your option)
241 +   any later version.
242 +
243 +   This program is distributed in the hope that it will be useful,
244 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
245 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
246 +   GNU Lesser General Public License for more details.
247 +
248 +   You should have received a copy of the GNU Lesser General Public License
249 +   along with this program; if not, write to the Free Software Foundation,
250 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
251 +
252 +#ifndef _GL_ERRNO_H
253 +
254 +@PRAGMA_SYSTEM_HEADER@
255 +
256 +/* The include_next requires a split double-inclusion guard.  */
257 +#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
258 +
259 +#ifndef _GL_ERRNO_H
260 +#define _GL_ERRNO_H
261 +
262 +
263 +/* On native Windows platforms, many macros are not defined.  */
264 +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
265 +
266 +/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value.  */
267 +#  define EWOULDBLOCK     EAGAIN
268 +
269 +/* Values >= 100 seem safe to use.  */
270 +#  define ETXTBSY   100
271 +#  define GNULIB_defined_ETXTBSY 1
272 +
273 +/* These are intentionally the same values as the WSA* error numbers, defined
274 +   in <winsock2.h>.  */
275 +#  define EINPROGRESS     10036
276 +#  define EALREADY        10037
277 +#  define ENOTSOCK        10038
278 +#  define EDESTADDRREQ    10039
279 +#  define EMSGSIZE        10040
280 +#  define EPROTOTYPE      10041
281 +#  define ENOPROTOOPT     10042
282 +#  define EPROTONOSUPPORT 10043
283 +#  define ESOCKTNOSUPPORT 10044  /* not required by POSIX */
284 +#  define EOPNOTSUPP      10045
285 +#  define EPFNOSUPPORT    10046  /* not required by POSIX */
286 +#  define EAFNOSUPPORT    10047
287 +#  define EADDRINUSE      10048
288 +#  define EADDRNOTAVAIL   10049
289 +#  define ENETDOWN        10050
290 +#  define ENETUNREACH     10051
291 +#  define ENETRESET       10052
292 +#  define ECONNABORTED    10053
293 +#  define ECONNRESET      10054
294 +#  define ENOBUFS         10055
295 +#  define EISCONN         10056
296 +#  define ENOTCONN        10057
297 +#  define ESHUTDOWN       10058  /* not required by POSIX */
298 +#  define ETOOMANYREFS    10059  /* not required by POSIX */
299 +#  define ETIMEDOUT       10060
300 +#  define ECONNREFUSED    10061
301 +#  define ELOOP           10062
302 +#  define EHOSTDOWN       10064  /* not required by POSIX */
303 +#  define EHOSTUNREACH    10065
304 +#  define EPROCLIM        10067  /* not required by POSIX */
305 +#  define EUSERS          10068  /* not required by POSIX */
306 +#  define EDQUOT          10069
307 +#  define ESTALE          10070
308 +#  define EREMOTE         10071  /* not required by POSIX */
309 +#  define GNULIB_defined_ESOCK 1
310 +
311 +# endif
312 +
313 +
314 +/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
315 +   EMULTIHOP, ENOLINK, EOVERFLOW are not defined.  */
316 +# if @EMULTIHOP_HIDDEN@
317 +#  define EMULTIHOP @EMULTIHOP_VALUE@
318 +#  define GNULIB_defined_EMULTIHOP 1
319 +# endif
320 +# if @ENOLINK_HIDDEN@
321 +#  define ENOLINK   @ENOLINK_VALUE@
322 +#  define GNULIB_defined_ENOLINK 1
323 +# endif
324 +# if @EOVERFLOW_HIDDEN@
325 +#  define EOVERFLOW @EOVERFLOW_VALUE@
326 +#  define GNULIB_defined_EOVERFLOW 1
327 +# endif
328 +
329 +
330 +/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
331 +   EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
332 +   Define them here.  Values >= 2000 seem safe to use: Solaris ESTALE = 151,
333 +   HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
334 +
335 +   Note: When one of these systems defines some of these macros some day,
336 +   binaries will have to be recompiled so that they recognizes the new
337 +   errno values from the system.  */
338 +
339 +# ifndef ENOMSG
340 +#  define ENOMSG    2000
341 +#  define GNULIB_defined_ENOMSG 1
342 +# endif
343 +
344 +# ifndef EIDRM
345 +#  define EIDRM     2001
346 +#  define GNULIB_defined_EIDRM 1
347 +# endif
348 +
349 +# ifndef ENOLINK
350 +#  define ENOLINK   2002
351 +#  define GNULIB_defined_ENOLINK 1
352 +# endif
353 +
354 +# ifndef EPROTO
355 +#  define EPROTO    2003
356 +#  define GNULIB_defined_EPROTO 1
357 +# endif
358 +
359 +# ifndef EMULTIHOP
360 +#  define EMULTIHOP 2004
361 +#  define GNULIB_defined_EMULTIHOP 1
362 +# endif
363 +
364 +# ifndef EBADMSG
365 +#  define EBADMSG   2005
366 +#  define GNULIB_defined_EBADMSG 1
367 +# endif
368 +
369 +# ifndef EOVERFLOW
370 +#  define EOVERFLOW 2006
371 +#  define GNULIB_defined_EOVERFLOW 1
372 +# endif
373 +
374 +# ifndef ENOTSUP
375 +#  define ENOTSUP   2007
376 +#  define GNULIB_defined_ENOTSUP 1
377 +# endif
378 +
379 +# ifndef ECANCELED
380 +#  define ECANCELED 2008
381 +#  define GNULIB_defined_ECANCELED 1
382 +# endif
383 +
384 +
385 +#endif /* _GL_ERRNO_H */
386 +#endif /* _GL_ERRNO_H */
387 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/float+.h gtk-vnc-0.3.7.gnulib/gnulib/lib/float+.h
388 --- gtk-vnc-0.3.7.dan3/gnulib/lib/float+.h      1970-01-01 01:00:00.000000000 +0100
389 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/float+.h    2008-10-09 15:24:52.000000000 +0100
390 @@ -0,0 +1,148 @@
391 +/* Supplemental information about the floating-point formats.
392 +   Copyright (C) 2007 Free Software Foundation, Inc.
393 +   Written by Bruno Haible <bruno@clisp.org>, 2007.
394 +
395 +   This program is free software; you can redistribute it and/or modify
396 +   it under the terms of the GNU Lesser General Public License as published by
397 +   the Free Software Foundation; either version 2.1, or (at your option)
398 +   any later version.
399 +
400 +   This program is distributed in the hope that it will be useful,
401 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
402 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
403 +   GNU Lesser General Public License for more details.
404 +
405 +   You should have received a copy of the GNU Lesser General Public License
406 +   along with this program; if not, write to the Free Software Foundation,
407 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
408 +
409 +#ifndef _FLOATPLUS_H
410 +#define _FLOATPLUS_H
411 +
412 +#include <float.h>
413 +#include <limits.h>
414 +
415 +/* Number of bits in the mantissa of a floating-point number, including the
416 +   "hidden bit".  */
417 +#if FLT_RADIX == 2
418 +# define FLT_MANT_BIT FLT_MANT_DIG
419 +# define DBL_MANT_BIT DBL_MANT_DIG
420 +# define LDBL_MANT_BIT LDBL_MANT_DIG
421 +#elif FLT_RADIX == 4
422 +# define FLT_MANT_BIT (FLT_MANT_DIG * 2)
423 +# define DBL_MANT_BIT (DBL_MANT_DIG * 2)
424 +# define LDBL_MANT_BIT (LDBL_MANT_DIG * 2)
425 +#elif FLT_RADIX == 16
426 +# define FLT_MANT_BIT (FLT_MANT_DIG * 4)
427 +# define DBL_MANT_BIT (DBL_MANT_DIG * 4)
428 +# define LDBL_MANT_BIT (LDBL_MANT_DIG * 4)
429 +#endif
430 +
431 +/* Bit mask that can be used to mask the exponent, as an unsigned number.  */
432 +#define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7)
433 +#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
434 +#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)
435 +
436 +/* Number of bits used for the exponent of a floating-point number, including
437 +   the exponent's sign.  */
438 +#define FLT_EXP_BIT \
439 +  (FLT_EXP_MASK < 0x100 ? 8 : \
440 +   FLT_EXP_MASK < 0x200 ? 9 : \
441 +   FLT_EXP_MASK < 0x400 ? 10 : \
442 +   FLT_EXP_MASK < 0x800 ? 11 : \
443 +   FLT_EXP_MASK < 0x1000 ? 12 : \
444 +   FLT_EXP_MASK < 0x2000 ? 13 : \
445 +   FLT_EXP_MASK < 0x4000 ? 14 : \
446 +   FLT_EXP_MASK < 0x8000 ? 15 : \
447 +   FLT_EXP_MASK < 0x10000 ? 16 : \
448 +   FLT_EXP_MASK < 0x20000 ? 17 : \
449 +   FLT_EXP_MASK < 0x40000 ? 18 : \
450 +   FLT_EXP_MASK < 0x80000 ? 19 : \
451 +   FLT_EXP_MASK < 0x100000 ? 20 : \
452 +   FLT_EXP_MASK < 0x200000 ? 21 : \
453 +   FLT_EXP_MASK < 0x400000 ? 22 : \
454 +   FLT_EXP_MASK < 0x800000 ? 23 : \
455 +   FLT_EXP_MASK < 0x1000000 ? 24 : \
456 +   FLT_EXP_MASK < 0x2000000 ? 25 : \
457 +   FLT_EXP_MASK < 0x4000000 ? 26 : \
458 +   FLT_EXP_MASK < 0x8000000 ? 27 : \
459 +   FLT_EXP_MASK < 0x10000000 ? 28 : \
460 +   FLT_EXP_MASK < 0x20000000 ? 29 : \
461 +   FLT_EXP_MASK < 0x40000000 ? 30 : \
462 +   FLT_EXP_MASK <= 0x7fffffff ? 31 : \
463 +   32)
464 +#define DBL_EXP_BIT \
465 +  (DBL_EXP_MASK < 0x100 ? 8 : \
466 +   DBL_EXP_MASK < 0x200 ? 9 : \
467 +   DBL_EXP_MASK < 0x400 ? 10 : \
468 +   DBL_EXP_MASK < 0x800 ? 11 : \
469 +   DBL_EXP_MASK < 0x1000 ? 12 : \
470 +   DBL_EXP_MASK < 0x2000 ? 13 : \
471 +   DBL_EXP_MASK < 0x4000 ? 14 : \
472 +   DBL_EXP_MASK < 0x8000 ? 15 : \
473 +   DBL_EXP_MASK < 0x10000 ? 16 : \
474 +   DBL_EXP_MASK < 0x20000 ? 17 : \
475 +   DBL_EXP_MASK < 0x40000 ? 18 : \
476 +   DBL_EXP_MASK < 0x80000 ? 19 : \
477 +   DBL_EXP_MASK < 0x100000 ? 20 : \
478 +   DBL_EXP_MASK < 0x200000 ? 21 : \
479 +   DBL_EXP_MASK < 0x400000 ? 22 : \
480 +   DBL_EXP_MASK < 0x800000 ? 23 : \
481 +   DBL_EXP_MASK < 0x1000000 ? 24 : \
482 +   DBL_EXP_MASK < 0x2000000 ? 25 : \
483 +   DBL_EXP_MASK < 0x4000000 ? 26 : \
484 +   DBL_EXP_MASK < 0x8000000 ? 27 : \
485 +   DBL_EXP_MASK < 0x10000000 ? 28 : \
486 +   DBL_EXP_MASK < 0x20000000 ? 29 : \
487 +   DBL_EXP_MASK < 0x40000000 ? 30 : \
488 +   DBL_EXP_MASK <= 0x7fffffff ? 31 : \
489 +   32)
490 +#define LDBL_EXP_BIT \
491 +  (LDBL_EXP_MASK < 0x100 ? 8 : \
492 +   LDBL_EXP_MASK < 0x200 ? 9 : \
493 +   LDBL_EXP_MASK < 0x400 ? 10 : \
494 +   LDBL_EXP_MASK < 0x800 ? 11 : \
495 +   LDBL_EXP_MASK < 0x1000 ? 12 : \
496 +   LDBL_EXP_MASK < 0x2000 ? 13 : \
497 +   LDBL_EXP_MASK < 0x4000 ? 14 : \
498 +   LDBL_EXP_MASK < 0x8000 ? 15 : \
499 +   LDBL_EXP_MASK < 0x10000 ? 16 : \
500 +   LDBL_EXP_MASK < 0x20000 ? 17 : \
501 +   LDBL_EXP_MASK < 0x40000 ? 18 : \
502 +   LDBL_EXP_MASK < 0x80000 ? 19 : \
503 +   LDBL_EXP_MASK < 0x100000 ? 20 : \
504 +   LDBL_EXP_MASK < 0x200000 ? 21 : \
505 +   LDBL_EXP_MASK < 0x400000 ? 22 : \
506 +   LDBL_EXP_MASK < 0x800000 ? 23 : \
507 +   LDBL_EXP_MASK < 0x1000000 ? 24 : \
508 +   LDBL_EXP_MASK < 0x2000000 ? 25 : \
509 +   LDBL_EXP_MASK < 0x4000000 ? 26 : \
510 +   LDBL_EXP_MASK < 0x8000000 ? 27 : \
511 +   LDBL_EXP_MASK < 0x10000000 ? 28 : \
512 +   LDBL_EXP_MASK < 0x20000000 ? 29 : \
513 +   LDBL_EXP_MASK < 0x40000000 ? 30 : \
514 +   LDBL_EXP_MASK <= 0x7fffffff ? 31 : \
515 +   32)
516 +
517 +/* Number of bits used for a floating-point number: the mantissa (not
518 +   counting the "hidden bit", since it may or may not be explicit), the
519 +   exponent, and the sign.  */
520 +#define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1)
521 +#define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1)
522 +#define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1)
523 +
524 +/* Number of bytes used for a floating-point number.
525 +   This can be smaller than the 'sizeof'.  For example, on i386 systems,
526 +   'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence
527 +   LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but
528 +   sizeof (long double) = 12 or = 16.  */
529 +#define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
530 +#define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
531 +#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
532 +
533 +/* Verify that SIZEOF_FLT <= sizeof (float) etc.  */
534 +typedef int verify_sizeof_flt[2 * (SIZEOF_FLT <= sizeof (float)) - 1];
535 +typedef int verify_sizeof_dbl[2 * (SIZEOF_DBL <= sizeof (double)) - 1];
536 +typedef int verify_sizeof_ldbl[2 * (SIZEOF_LDBL <= sizeof (long double)) - 1];
537 +
538 +#endif /* _FLOATPLUS_H */
539 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/float.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/float.in.h
540 --- gtk-vnc-0.3.7.dan3/gnulib/lib/float.in.h    1970-01-01 01:00:00.000000000 +0100
541 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/float.in.h  2008-10-09 15:24:52.000000000 +0100
542 @@ -0,0 +1,60 @@
543 +/* A correct <float.h>.
544 +
545 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
546 +
547 +   This program is free software: you can redistribute it and/or modify
548 +   it under the terms of the GNU Lesser General Public License as published by
549 +   the Free Software Foundation; either version 2.1 of the License, or
550 +   (at your option) any later version.
551 +
552 +   This program is distributed in the hope that it will be useful,
553 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
554 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
555 +   GNU Lesser General Public License for more details.
556 +
557 +   You should have received a copy of the GNU Lesser General Public License
558 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
559 +
560 +#ifndef _GL_FLOAT_H
561 +
562 +@PRAGMA_SYSTEM_HEADER@
563 +
564 +/* The include_next requires a split double-inclusion guard.  */
565 +#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
566 +
567 +#ifndef _GL_FLOAT_H
568 +#define _GL_FLOAT_H
569 +
570 +/* 'long double' properties.  */
571 +#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
572 +/* Number of mantissa units, in base FLT_RADIX.  */
573 +# undef LDBL_MANT_DIG
574 +# define LDBL_MANT_DIG   64
575 +/* Number of decimal digits that is sufficient for representing a number.  */
576 +# undef LDBL_DIG
577 +# define LDBL_DIG        18
578 +/* x-1 where x is the smallest representable number > 1.  */
579 +# undef LDBL_EPSILON
580 +# define LDBL_EPSILON    1.0842021724855044340E-19L
581 +/* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
582 +# undef LDBL_MIN_EXP
583 +# define LDBL_MIN_EXP    (-16381)
584 +/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
585 +# undef LDBL_MAX_EXP
586 +# define LDBL_MAX_EXP    16384
587 +/* Minimum positive normalized number.  */
588 +# undef LDBL_MIN
589 +# define LDBL_MIN        3.3621031431120935063E-4932L
590 +/* Maximum representable finite number.  */
591 +# undef LDBL_MAX
592 +# define LDBL_MAX        1.1897314953572317650E+4932L
593 +/* Minimum e such that 10^e is in the range of normalized numbers.  */
594 +# undef LDBL_MIN_10_EXP
595 +# define LDBL_MIN_10_EXP (-4931)
596 +/* Maximum e such that 10^e is in the range of representable finite numbers.  */
597 +# undef LDBL_MAX_10_EXP
598 +# define LDBL_MAX_10_EXP 4932
599 +#endif
600 +
601 +#endif /* _GL_FLOAT_H */
602 +#endif /* _GL_FLOAT_H */
603 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/gai_strerror.c gtk-vnc-0.3.7.gnulib/gnulib/lib/gai_strerror.c
604 --- gtk-vnc-0.3.7.dan3/gnulib/lib/gai_strerror.c        1970-01-01 01:00:00.000000000 +0100
605 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/gai_strerror.c      2008-10-09 15:24:52.000000000 +0100
606 @@ -0,0 +1,78 @@
607 +/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
608 +   This file is part of the GNU C Library.
609 +   Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
610 +
611 +   This program is free software; you can redistribute it and/or modify
612 +   it under the terms of the GNU Lesser General Public License as published by
613 +   the Free Software Foundation; either version 2.1, or (at your option)
614 +   any later version.
615 +
616 +   This program is distributed in the hope that it will be useful,
617 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
618 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
619 +   GNU Lesser General Public License for more details.
620 +
621 +   You should have received a copy of the GNU Lesser General Public License
622 +   along with this program; if not, write to the Free Software Foundation,
623 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
624 +
625 +#ifndef _LIBC
626 +# include <config.h>
627 +# include "getaddrinfo.h"
628 +#endif
629 +
630 +#include <stdio.h>
631 +#ifdef HAVE_NETDB_H
632 +# include <netdb.h>
633 +#endif
634 +
635 +#ifdef _LIBC
636 +# include <libintl.h>
637 +#else
638 +# include "gettext.h"
639 +# define _(String) gettext (String)
640 +# define N_(String) String
641 +#endif
642 +
643 +static struct
644 +  {
645 +    int code;
646 +    const char *msg;
647 +  }
648 +values[] =
649 +  {
650 +    { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
651 +    { EAI_AGAIN, N_("Temporary failure in name resolution") },
652 +    { EAI_BADFLAGS, N_("Bad value for ai_flags") },
653 +    { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
654 +    { EAI_FAMILY, N_("ai_family not supported") },
655 +    { EAI_MEMORY, N_("Memory allocation failure") },
656 +    { EAI_NODATA, N_("No address associated with hostname") },
657 +    { EAI_NONAME, N_("Name or service not known") },
658 +    { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
659 +    { EAI_SOCKTYPE, N_("ai_socktype not supported") },
660 +    { EAI_SYSTEM, N_("System error") },
661 +    { EAI_OVERFLOW, N_("Argument buffer too small") },
662 +#ifdef __USE_GNU
663 +    { EAI_INPROGRESS, N_("Processing request in progress") },
664 +    { EAI_CANCELED, N_("Request canceled") },
665 +    { EAI_NOTCANCELED, N_("Request not canceled") },
666 +    { EAI_ALLDONE, N_("All requests done") },
667 +    { EAI_INTR, N_("Interrupted by a signal") },
668 +    { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
669 +#endif
670 +  };
671 +
672 +const char *
673 +gai_strerror (int code)
674 +{
675 +  size_t i;
676 +  for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
677 +    if (values[i].code == code)
678 +      return _(values[i].msg);
679 +
680 +  return _("Unknown error");
681 +}
682 +#ifdef _LIBC
683 +libc_hidden_def (gai_strerror)
684 +#endif
685 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/getaddrinfo.c gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.c
686 --- gtk-vnc-0.3.7.dan3/gnulib/lib/getaddrinfo.c 1970-01-01 01:00:00.000000000 +0100
687 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.c       2008-10-09 15:24:52.000000000 +0100
688 @@ -0,0 +1,419 @@
689 +/* Get address information (partial implementation).
690 +   Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software
691 +   Foundation, Inc.
692 +   Contributed by Simon Josefsson <simon@josefsson.org>.
693 +
694 +   This program is free software; you can redistribute it and/or modify
695 +   it under the terms of the GNU Lesser General Public License as published by
696 +   the Free Software Foundation; either version 2.1, or (at your option)
697 +   any later version.
698 +
699 +   This program is distributed in the hope that it will be useful,
700 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
701 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
702 +   GNU Lesser General Public License for more details.
703 +
704 +   You should have received a copy of the GNU Lesser General Public License
705 +   along with this program; if not, write to the Free Software Foundation,
706 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
707 +
708 +#include <config.h>
709 +
710 +#include "getaddrinfo.h"
711 +
712 +#if HAVE_NETINET_IN_H
713 +# include <netinet/in.h>
714 +#endif
715 +
716 +/* Get inet_ntop.  */
717 +#include <arpa/inet.h>
718 +
719 +/* Get calloc. */
720 +#include <stdlib.h>
721 +
722 +/* Get memcpy, strdup. */
723 +#include <string.h>
724 +
725 +/* Get snprintf. */
726 +#include <stdio.h>
727 +
728 +#include <stdbool.h>
729 +
730 +#include "gettext.h"
731 +#define _(String) gettext (String)
732 +#define N_(String) String
733 +
734 +/* BeOS has AF_INET, but not PF_INET.  */
735 +#ifndef PF_INET
736 +# define PF_INET AF_INET
737 +#endif
738 +/* BeOS also lacks PF_UNSPEC.  */
739 +#ifndef PF_UNSPEC
740 +# define PF_UNSPEC 0
741 +#endif
742 +
743 +#if defined _WIN32 || defined __WIN32__
744 +# define WIN32_NATIVE
745 +#endif
746 +
747 +#ifdef WIN32_NATIVE
748 +typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
749 +                                       const struct addrinfo*,
750 +                                       struct addrinfo**);
751 +typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
752 +typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
753 +                                       socklen_t, char*, DWORD,
754 +                                       char*, DWORD, int);
755 +
756 +static getaddrinfo_func getaddrinfo_ptr = NULL;
757 +static freeaddrinfo_func freeaddrinfo_ptr = NULL;
758 +static getnameinfo_func getnameinfo_ptr = NULL;
759 +
760 +static int
761 +use_win32_p (void)
762 +{
763 +  static int done = 0;
764 +  HMODULE h;
765 +
766 +  if (done)
767 +    return getaddrinfo_ptr ? 1 : 0;
768 +
769 +  done = 1;
770 +
771 +  h = GetModuleHandle ("ws2_32.dll");
772 +
773 +  if (h)
774 +    {
775 +      getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo");
776 +      freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, "freeaddrinfo");
777 +      getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo");
778 +    }
779 +
780 +  /* If either is missing, something is odd. */
781 +  if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr)
782 +    {
783 +      getaddrinfo_ptr = NULL;
784 +      freeaddrinfo_ptr = NULL;
785 +      getnameinfo_ptr = NULL;
786 +      return 0;
787 +    }
788 +
789 +  return 1;
790 +}
791 +#endif
792 +
793 +static inline bool
794 +validate_family (int family)
795 +{
796 +  /* FIXME: Support more families. */
797 +#if HAVE_IPV4
798 +     if (family == PF_INET)
799 +       return true;
800 +#endif
801 +#if HAVE_IPV6
802 +     if (family == PF_INET6)
803 +       return true;
804 +#endif
805 +     if (family == PF_UNSPEC)
806 +       return true;
807 +     return false;
808 +}
809 +
810 +/* Translate name of a service location and/or a service name to set of
811 +   socket addresses. */
812 +int
813 +getaddrinfo (const char *restrict nodename,
814 +            const char *restrict servname,
815 +            const struct addrinfo *restrict hints,
816 +            struct addrinfo **restrict res)
817 +{
818 +  struct addrinfo *tmp;
819 +  int port = 0;
820 +  struct hostent *he;
821 +  void *storage;
822 +  size_t size;
823 +#if HAVE_IPV6
824 +  struct v6_pair {
825 +    struct addrinfo addrinfo;
826 +    struct sockaddr_in6 sockaddr_in6;
827 +  };
828 +#endif
829 +#if HAVE_IPV4
830 +  struct v4_pair {
831 +    struct addrinfo addrinfo;
832 +    struct sockaddr_in sockaddr_in;
833 +  };
834 +#endif
835 +
836 +#ifdef WIN32_NATIVE
837 +  if (use_win32_p ())
838 +    return getaddrinfo_ptr (nodename, servname, hints, res);
839 +#endif
840 +
841 +  if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE)))
842 +    /* FIXME: Support more flags. */
843 +    return EAI_BADFLAGS;
844 +
845 +  if (hints && !validate_family (hints->ai_family))
846 +    return EAI_FAMILY;
847 +
848 +  if (hints &&
849 +      hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM)
850 +    /* FIXME: Support other socktype. */
851 +    return EAI_SOCKTYPE; /* FIXME: Better return code? */
852 +
853 +  if (!nodename)
854 +    {
855 +      if (!(hints->ai_flags & AI_PASSIVE))
856 +       return EAI_NONAME;
857 +
858 +#ifdef HAVE_IPV6
859 +      nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
860 +#else
861 +      nodename = "0.0.0.0";
862 +#endif
863 +    }
864 +
865 +  if (servname)
866 +    {
867 +      struct servent *se = NULL;
868 +      const char *proto =
869 +       (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
870 +
871 +      if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
872 +       /* FIXME: Use getservbyname_r if available. */
873 +       se = getservbyname (servname, proto);
874 +
875 +      if (!se)
876 +       {
877 +         char *c;
878 +         if (!(*servname >= '0' && *servname <= '9'))
879 +           return EAI_NONAME;
880 +         port = strtoul (servname, &c, 10);
881 +         if (*c || port > 0xffff)
882 +           return EAI_NONAME;
883 +         port = htons (port);
884 +       }
885 +      else
886 +       port = se->s_port;
887 +    }
888 +
889 +  /* FIXME: Use gethostbyname_r if available. */
890 +  he = gethostbyname (nodename);
891 +  if (!he || he->h_addr_list[0] == NULL)
892 +    return EAI_NONAME;
893 +
894 +  switch (he->h_addrtype)
895 +    {
896 +#if HAVE_IPV6
897 +    case PF_INET6:
898 +      size = sizeof (struct v6_pair);
899 +      break;
900 +#endif
901 +
902 +#if HAVE_IPV4
903 +    case PF_INET:
904 +      size = sizeof (struct v4_pair);
905 +      break;
906 +#endif
907 +
908 +    default:
909 +      return EAI_NODATA;
910 +    }
911 +
912 +  storage = calloc (1, size);
913 +  if (!storage)
914 +    return EAI_MEMORY;
915 +
916 +  switch (he->h_addrtype)
917 +    {
918 +#if HAVE_IPV6
919 +    case PF_INET6:
920 +      {
921 +       struct v6_pair *p = storage;
922 +       struct sockaddr_in6 *sinp = &p->sockaddr_in6;
923 +       tmp = &p->addrinfo;
924 +
925 +       if (port)
926 +         sinp->sin6_port = port;
927 +
928 +       if (he->h_length != sizeof (sinp->sin6_addr))
929 +         {
930 +           free (storage);
931 +           return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
932 +         }
933 +
934 +       memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
935 +
936 +       tmp->ai_addr = (struct sockaddr *) sinp;
937 +       tmp->ai_addrlen = sizeof *sinp;
938 +      }
939 +      break;
940 +#endif
941 +
942 +#if HAVE_IPV4
943 +    case PF_INET:
944 +      {
945 +       struct v4_pair *p = storage;
946 +       struct sockaddr_in *sinp = &p->sockaddr_in;
947 +       tmp = &p->addrinfo;
948 +
949 +       if (port)
950 +         sinp->sin_port = port;
951 +
952 +       if (he->h_length != sizeof (sinp->sin_addr))
953 +         {
954 +           free (storage);
955 +           return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
956 +         }
957 +
958 +       memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
959 +
960 +       tmp->ai_addr = (struct sockaddr *) sinp;
961 +       tmp->ai_addrlen = sizeof *sinp;
962 +      }
963 +      break;
964 +#endif
965 +
966 +    default:
967 +      free (storage);
968 +      return EAI_NODATA;
969 +    }
970 +
971 +  if (hints && hints->ai_flags & AI_CANONNAME)
972 +    {
973 +      const char *cn;
974 +      if (he->h_name)
975 +       cn = he->h_name;
976 +      else
977 +       cn = nodename;
978 +
979 +      tmp->ai_canonname = strdup (cn);
980 +      if (!tmp->ai_canonname)
981 +       {
982 +         free (storage);
983 +         return EAI_MEMORY;
984 +       }
985 +    }
986 +
987 +  tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
988 +  tmp->ai_socktype = (hints) ? hints->ai_socktype : 0;
989 +  tmp->ai_addr->sa_family = he->h_addrtype;
990 +  tmp->ai_family = he->h_addrtype;
991 +
992 +  /* FIXME: If more than one address, create linked list of addrinfo's. */
993 +
994 +  *res = tmp;
995 +
996 +  return 0;
997 +}
998 +
999 +/* Free `addrinfo' structure AI including associated storage.  */
1000 +void
1001 +freeaddrinfo (struct addrinfo *ai)
1002 +{
1003 +#ifdef WIN32_NATIVE
1004 +  if (use_win32_p ())
1005 +    {
1006 +      freeaddrinfo_ptr (ai);
1007 +      return;
1008 +    }
1009 +#endif
1010 +
1011 +  while (ai)
1012 +    {
1013 +      struct addrinfo *cur;
1014 +
1015 +      cur = ai;
1016 +      ai = ai->ai_next;
1017 +
1018 +      free (cur->ai_canonname);
1019 +      free (cur);
1020 +    }
1021 +}
1022 +
1023 +int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
1024 +               char *restrict node, socklen_t nodelen,
1025 +               char *restrict service, socklen_t servicelen,
1026 +               int flags)
1027 +{
1028 +#ifdef WIN32_NATIVE
1029 +  if (use_win32_p ())
1030 +    return getnameinfo_ptr (sa, salen, node, nodelen,
1031 +                           service, servicelen, flags);
1032 +#endif
1033 +
1034 +  /* FIXME: Support other flags. */
1035 +  if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) ||
1036 +      (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) ||
1037 +      (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV)))
1038 +    return EAI_BADFLAGS;
1039 +
1040 +  if (sa == NULL || salen < sizeof (sa->sa_family))
1041 +    return EAI_FAMILY;
1042 +
1043 +  switch (sa->sa_family)
1044 +    {
1045 +#if HAVE_IPV4
1046 +    case AF_INET:
1047 +      if (salen < sizeof (struct sockaddr_in))
1048 +       return EAI_FAMILY;
1049 +      break;
1050 +#endif
1051 +#if HAVE_IPV6
1052 +    case AF_INET6:
1053 +      if (salen < sizeof (struct sockaddr_in6))
1054 +       return EAI_FAMILY;
1055 +      break;
1056 +#endif
1057 +    default:
1058 +      return EAI_FAMILY;
1059 +    }
1060 +
1061 +  if (node && nodelen > 0 && flags & NI_NUMERICHOST)
1062 +    {
1063 +      switch (sa->sa_family)
1064 +       {
1065 +#if HAVE_IPV4
1066 +       case AF_INET:
1067 +         if (!inet_ntop (AF_INET,
1068 +                         &(((const struct sockaddr_in *) sa)->sin_addr),
1069 +                         node, nodelen))
1070 +           return EAI_SYSTEM;
1071 +         break;
1072 +#endif
1073 +
1074 +#if HAVE_IPV6
1075 +       case AF_INET6:
1076 +         if (!inet_ntop (AF_INET6,
1077 +                         &(((const struct sockaddr_in6 *) sa)->sin6_addr),
1078 +                         node, nodelen))
1079 +           return EAI_SYSTEM;
1080 +         break;
1081 +#endif
1082 +
1083 +       default:
1084 +         return EAI_FAMILY;
1085 +       }
1086 +    }
1087 +
1088 +  if (service && servicelen > 0 && flags & NI_NUMERICSERV)
1089 +    switch (sa->sa_family)
1090 +      {
1091 +#if HAVE_IPV4
1092 +      case AF_INET:
1093 +#endif
1094 +#if HAVE_IPV6
1095 +      case AF_INET6:
1096 +#endif
1097 +       {
1098 +         unsigned short int port
1099 +           = ntohs (((const struct sockaddr_in *) sa)->sin_port);
1100 +         if (servicelen <= snprintf (service, servicelen, "%u", port))
1101 +           return EAI_OVERFLOW;
1102 +       }
1103 +       break;
1104 +      }
1105 +
1106 +  return 0;
1107 +}
1108 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/getaddrinfo.h gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.h
1109 --- gtk-vnc-0.3.7.dan3/gnulib/lib/getaddrinfo.h 1970-01-01 01:00:00.000000000 +0100
1110 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.h       2008-10-09 15:24:52.000000000 +0100
1111 @@ -0,0 +1,163 @@
1112 +/* Get address information.
1113 +   Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2008
1114 +                 Free Software Foundation, Inc.
1115 +   Contributed by Simon Josefsson <simon@josefsson.org>.
1116 +
1117 +   This program is free software; you can redistribute it and/or modify
1118 +   it under the terms of the GNU Lesser General Public License as published by
1119 +   the Free Software Foundation; either version 2.1, or (at your option)
1120 +   any later version.
1121 +
1122 +   This program is distributed in the hope that it will be useful,
1123 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1124 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1125 +   GNU Lesser General Public License for more details.
1126 +
1127 +   You should have received a copy of the GNU Lesser General Public License
1128 +   along with this program; if not, write to the Free Software Foundation,
1129 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
1130 +
1131 +#ifndef GETADDRINFO_H
1132 +#define GETADDRINFO_H
1133 +
1134 +/* sys/socket.h in i386-unknown-freebsd4.10 and
1135 +   powerpc-apple-darwin5.5 require sys/types.h, so include it first.
1136 +   Then we'll also get 'socklen_t' and 'struct sockaddr' which are
1137 +   used below. */
1138 +#include <sys/types.h>
1139 +/* Get all getaddrinfo related declarations, if available.  */
1140 +#include <sys/socket.h>
1141 +#ifdef HAVE_NETDB_H
1142 +# include <netdb.h>
1143 +#endif
1144 +
1145 +#ifndef HAVE_STRUCT_ADDRINFO
1146 +
1147 +/* Structure to contain information about address of a service provider.  */
1148 +struct addrinfo
1149 +{
1150 +  int ai_flags;                        /* Input flags.  */
1151 +  int ai_family;               /* Protocol family for socket.  */
1152 +  int ai_socktype;             /* Socket type.  */
1153 +  int ai_protocol;             /* Protocol for socket.  */
1154 +  socklen_t ai_addrlen;                /* Length of socket address.  */
1155 +  struct sockaddr *ai_addr;    /* Socket address for socket.  */
1156 +  char *ai_canonname;          /* Canonical name for service location.  */
1157 +  struct addrinfo *ai_next;    /* Pointer to next in list.  */
1158 +};
1159 +#endif
1160 +
1161 +/* Possible values for `ai_flags' field in `addrinfo' structure.  */
1162 +#ifndef AI_PASSIVE
1163 +# define AI_PASSIVE    0x0001  /* Socket address is intended for `bind'.  */
1164 +#endif
1165 +#ifndef AI_CANONNAME
1166 +# define AI_CANONNAME  0x0002  /* Request for canonical name.  */
1167 +#endif
1168 +#ifndef AI_NUMERICSERV
1169 +# define AI_NUMERICSERV        0x0400  /* Don't use name resolution.  */
1170 +#endif
1171 +
1172 +#if 0
1173 +/* The commented out definitions below are not yet implemented in the
1174 +   GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact,
1175 +   cause conflicts on systems with a getaddrinfo() function which does not
1176 +   define them.
1177 +
1178 +   If they are restored, be sure to protect the definitions with #ifndef.  */
1179 +#define AI_NUMERICHOST 0x0004  /* Don't use name resolution.  */
1180 +#define AI_V4MAPPED    0x0008  /* IPv4 mapped addresses are acceptable.  */
1181 +#define AI_ALL         0x0010  /* Return IPv4 mapped and IPv6 addresses.  */
1182 +#define AI_ADDRCONFIG  0x0020  /* Use configuration of this host to choose
1183 +                                  returned address type..  */
1184 +#endif /* 0 */
1185 +
1186 +/* Error values for `getaddrinfo' function.  */
1187 +#ifndef EAI_BADFLAGS
1188 +# define EAI_BADFLAGS    -1    /* Invalid value for `ai_flags' field.  */
1189 +# define EAI_NONAME      -2    /* NAME or SERVICE is unknown.  */
1190 +# define EAI_AGAIN       -3    /* Temporary failure in name resolution.  */
1191 +# define EAI_FAIL        -4    /* Non-recoverable failure in name res.  */
1192 +# define EAI_NODATA      -5    /* No address associated with NAME.  */
1193 +# define EAI_FAMILY      -6    /* `ai_family' not supported.  */
1194 +# define EAI_SOCKTYPE    -7    /* `ai_socktype' not supported.  */
1195 +# define EAI_SERVICE     -8    /* SERVICE not supported for `ai_socktype'.  */
1196 +# define EAI_MEMORY      -10   /* Memory allocation failure.  */
1197 +#endif
1198 +
1199 +/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
1200 +   FreeBSD, which does define EAI_BADFLAGS) have removed the definition
1201 +   in favor of EAI_NONAME.  */
1202 +#if !defined EAI_NODATA && defined EAI_NONAME
1203 +# define EAI_NODATA EAI_NONAME
1204 +#endif
1205 +
1206 +#ifndef EAI_OVERFLOW
1207 +/* Not defined on mingw32. */
1208 +# define EAI_OVERFLOW    -12   /* Argument buffer overflow.  */
1209 +#endif
1210 +#ifndef EAI_ADDRFAMILY
1211 +/* Not defined on mingw32. */
1212 +# define EAI_ADDRFAMILY  -9    /* Address family for NAME not supported.  */
1213 +#endif
1214 +#ifndef EAI_SYSTEM
1215 +/* Not defined on mingw32. */
1216 +# define EAI_SYSTEM      -11   /* System error returned in `errno'.  */
1217 +#endif
1218 +
1219 +#ifdef __USE_GNU
1220 +# ifndef EAI_INPROGRESS
1221 +#  define EAI_INPROGRESS       -100    /* Processing request in progress.  */
1222 +#  define EAI_CANCELED         -101    /* Request canceled.  */
1223 +#  define EAI_NOTCANCELED      -102    /* Request not canceled.  */
1224 +#  define EAI_ALLDONE          -103    /* All requests done.  */
1225 +#  define EAI_INTR             -104    /* Interrupted by a signal.  */
1226 +#  define EAI_IDN_ENCODE       -105    /* IDN encoding failed.  */
1227 +# endif
1228 +#endif
1229 +
1230 +#if !HAVE_DECL_GETADDRINFO
1231 +/* Translate name of a service location and/or a service name to set of
1232 +   socket addresses.
1233 +   For more details, see the POSIX:2001 specification
1234 +   <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
1235 +extern int getaddrinfo (const char *restrict nodename,
1236 +                       const char *restrict servname,
1237 +                       const struct addrinfo *restrict hints,
1238 +                       struct addrinfo **restrict res);
1239 +#endif
1240 +
1241 +#if !HAVE_DECL_FREEADDRINFO
1242 +/* Free `addrinfo' structure AI including associated storage.
1243 +   For more details, see the POSIX:2001 specification
1244 +   <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
1245 +extern void freeaddrinfo (struct addrinfo *ai);
1246 +#endif
1247 +
1248 +#if !HAVE_DECL_GAI_STRERROR
1249 +/* Convert error return from getaddrinfo() to a string.
1250 +   For more details, see the POSIX:2001 specification
1251 +   <http://www.opengroup.org/susv3xsh/gai_strerror.html>.  */
1252 +extern const char *gai_strerror (int ecode);
1253 +#endif
1254 +
1255 +#if !HAVE_DECL_GETNAMEINFO
1256 +/* Convert socket address to printable node and service names.
1257 +   For more details, see the POSIX:2001 specification
1258 +   <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
1259 +extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
1260 +                      char *restrict node, socklen_t nodelen,
1261 +                      char *restrict service, socklen_t servicelen,
1262 +                      int flags);
1263 +
1264 +#endif
1265 +
1266 +/* Possible flags for getnameinfo.  */
1267 +#ifndef NI_NUMERICHOST
1268 +# define NI_NUMERICHOST 1
1269 +#endif
1270 +#ifndef NI_NUMERICSERV
1271 +# define NI_NUMERICSERV 2
1272 +#endif
1273 +
1274 +#endif /* GETADDRINFO_H */
1275 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/gettext.h gtk-vnc-0.3.7.gnulib/gnulib/lib/gettext.h
1276 --- gtk-vnc-0.3.7.dan3/gnulib/lib/gettext.h     1970-01-01 01:00:00.000000000 +0100
1277 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/gettext.h   2008-10-09 15:24:52.000000000 +0100
1278 @@ -0,0 +1,270 @@
1279 +/* Convenience header for conditional use of GNU <libintl.h>.
1280 +   Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc.
1281 +
1282 +   This program is free software; you can redistribute it and/or modify
1283 +   it under the terms of the GNU Lesser General Public License as published by
1284 +   the Free Software Foundation; either version 2.1, or (at your option)
1285 +   any later version.
1286 +
1287 +   This program is distributed in the hope that it will be useful,
1288 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1289 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1290 +   GNU Lesser General Public License for more details.
1291 +
1292 +   You should have received a copy of the GNU Lesser General Public License along
1293 +   with this program; if not, write to the Free Software Foundation,
1294 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
1295 +
1296 +#ifndef _LIBGETTEXT_H
1297 +#define _LIBGETTEXT_H 1
1298 +
1299 +/* NLS can be disabled through the configure --disable-nls option.  */
1300 +#if ENABLE_NLS
1301 +
1302 +/* Get declarations of GNU message catalog functions.  */
1303 +# include <libintl.h>
1304 +
1305 +/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
1306 +   the gettext() and ngettext() macros.  This is an alternative to calling
1307 +   textdomain(), and is useful for libraries.  */
1308 +# ifdef DEFAULT_TEXT_DOMAIN
1309 +#  undef gettext
1310 +#  define gettext(Msgid) \
1311 +     dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
1312 +#  undef ngettext
1313 +#  define ngettext(Msgid1, Msgid2, N) \
1314 +     dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
1315 +# endif
1316 +
1317 +#else
1318 +
1319 +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
1320 +   chokes if dcgettext is defined as a macro.  So include it now, to make
1321 +   later inclusions of <locale.h> a NOP.  We don't include <libintl.h>
1322 +   as well because people using "gettext.h" will not include <libintl.h>,
1323 +   and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
1324 +   is OK.  */
1325 +#if defined(__sun)
1326 +# include <locale.h>
1327 +#endif
1328 +
1329 +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
1330 +   <libintl.h>, which chokes if dcgettext is defined as a macro.  So include
1331 +   it now, to make later inclusions of <libintl.h> a NOP.  */
1332 +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
1333 +# include <cstdlib>
1334 +# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
1335 +#  include <libintl.h>
1336 +# endif
1337 +#endif
1338 +
1339 +/* Disabled NLS.
1340 +   The casts to 'const char *' serve the purpose of producing warnings
1341 +   for invalid uses of the value returned from these functions.
1342 +   On pre-ANSI systems without 'const', the config.h file is supposed to
1343 +   contain "#define const".  */
1344 +# define gettext(Msgid) ((const char *) (Msgid))
1345 +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
1346 +# define dcgettext(Domainname, Msgid, Category) \
1347 +    ((void) (Category), dgettext (Domainname, Msgid))
1348 +# define ngettext(Msgid1, Msgid2, N) \
1349 +    ((N) == 1 \
1350 +     ? ((void) (Msgid2), (const char *) (Msgid1)) \
1351 +     : ((void) (Msgid1), (const char *) (Msgid2)))
1352 +# define dngettext(Domainname, Msgid1, Msgid2, N) \
1353 +    ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
1354 +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
1355 +    ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
1356 +# define textdomain(Domainname) ((const char *) (Domainname))
1357 +# define bindtextdomain(Domainname, Dirname) \
1358 +    ((void) (Domainname), (const char *) (Dirname))
1359 +# define bind_textdomain_codeset(Domainname, Codeset) \
1360 +    ((void) (Domainname), (const char *) (Codeset))
1361 +
1362 +#endif
1363 +
1364 +/* A pseudo function call that serves as a marker for the automated
1365 +   extraction of messages, but does not call gettext().  The run-time
1366 +   translation is done at a different place in the code.
1367 +   The argument, String, should be a literal string.  Concatenated strings
1368 +   and other string expressions won't work.
1369 +   The macro's expansion is not parenthesized, so that it is suitable as
1370 +   initializer for static 'char[]' or 'const char[]' variables.  */
1371 +#define gettext_noop(String) String
1372 +
1373 +/* The separator between msgctxt and msgid in a .mo file.  */
1374 +#define GETTEXT_CONTEXT_GLUE "\004"
1375 +
1376 +/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
1377 +   MSGID.  MSGCTXT and MSGID must be string literals.  MSGCTXT should be
1378 +   short and rarely need to change.
1379 +   The letter 'p' stands for 'particular' or 'special'.  */
1380 +#ifdef DEFAULT_TEXT_DOMAIN
1381 +# define pgettext(Msgctxt, Msgid) \
1382 +   pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
1383 +#else
1384 +# define pgettext(Msgctxt, Msgid) \
1385 +   pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
1386 +#endif
1387 +#define dpgettext(Domainname, Msgctxt, Msgid) \
1388 +  pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
1389 +#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
1390 +  pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
1391 +#ifdef DEFAULT_TEXT_DOMAIN
1392 +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
1393 +   npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
1394 +#else
1395 +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
1396 +   npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
1397 +#endif
1398 +#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
1399 +  npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
1400 +#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
1401 +  npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
1402 +
1403 +#ifdef __GNUC__
1404 +__inline
1405 +#else
1406 +#ifdef __cplusplus
1407 +inline
1408 +#endif
1409 +#endif
1410 +static const char *
1411 +pgettext_aux (const char *domain,
1412 +             const char *msg_ctxt_id, const char *msgid,
1413 +             int category)
1414 +{
1415 +  const char *translation = dcgettext (domain, msg_ctxt_id, category);
1416 +  if (translation == msg_ctxt_id)
1417 +    return msgid;
1418 +  else
1419 +    return translation;
1420 +}
1421 +
1422 +#ifdef __GNUC__
1423 +__inline
1424 +#else
1425 +#ifdef __cplusplus
1426 +inline
1427 +#endif
1428 +#endif
1429 +static const char *
1430 +npgettext_aux (const char *domain,
1431 +              const char *msg_ctxt_id, const char *msgid,
1432 +              const char *msgid_plural, unsigned long int n,
1433 +              int category)
1434 +{
1435 +  const char *translation =
1436 +    dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
1437 +  if (translation == msg_ctxt_id || translation == msgid_plural)
1438 +    return (n == 1 ? msgid : msgid_plural);
1439 +  else
1440 +    return translation;
1441 +}
1442 +
1443 +/* The same thing extended for non-constant arguments.  Here MSGCTXT and MSGID
1444 +   can be arbitrary expressions.  But for string literals these macros are
1445 +   less efficient than those above.  */
1446 +
1447 +#include <string.h>
1448 +
1449 +#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
1450 +  (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
1451 +   /* || __STDC_VERSION__ >= 199901L */ )
1452 +
1453 +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
1454 +#include <stdlib.h>
1455 +#endif
1456 +
1457 +#define pgettext_expr(Msgctxt, Msgid) \
1458 +  dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
1459 +#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
1460 +  dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
1461 +
1462 +#ifdef __GNUC__
1463 +__inline
1464 +#else
1465 +#ifdef __cplusplus
1466 +inline
1467 +#endif
1468 +#endif
1469 +static const char *
1470 +dcpgettext_expr (const char *domain,
1471 +                const char *msgctxt, const char *msgid,
1472 +                int category)
1473 +{
1474 +  size_t msgctxt_len = strlen (msgctxt) + 1;
1475 +  size_t msgid_len = strlen (msgid) + 1;
1476 +  const char *translation;
1477 +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
1478 +  char msg_ctxt_id[msgctxt_len + msgid_len];
1479 +#else
1480 +  char buf[1024];
1481 +  char *msg_ctxt_id =
1482 +    (msgctxt_len + msgid_len <= sizeof (buf)
1483 +     ? buf
1484 +     : (char *) malloc (msgctxt_len + msgid_len));
1485 +  if (msg_ctxt_id != NULL)
1486 +#endif
1487 +    {
1488 +      memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
1489 +      msg_ctxt_id[msgctxt_len - 1] = '\004';
1490 +      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
1491 +      translation = dcgettext (domain, msg_ctxt_id, category);
1492 +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
1493 +      if (msg_ctxt_id != buf)
1494 +       free (msg_ctxt_id);
1495 +#endif
1496 +      if (translation != msg_ctxt_id)
1497 +       return translation;
1498 +    }
1499 +  return msgid;
1500 +}
1501 +
1502 +#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
1503 +  dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
1504 +#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
1505 +  dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
1506 +
1507 +#ifdef __GNUC__
1508 +__inline
1509 +#else
1510 +#ifdef __cplusplus
1511 +inline
1512 +#endif
1513 +#endif
1514 +static const char *
1515 +dcnpgettext_expr (const char *domain,
1516 +                 const char *msgctxt, const char *msgid,
1517 +                 const char *msgid_plural, unsigned long int n,
1518 +                 int category)
1519 +{
1520 +  size_t msgctxt_len = strlen (msgctxt) + 1;
1521 +  size_t msgid_len = strlen (msgid) + 1;
1522 +  const char *translation;
1523 +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
1524 +  char msg_ctxt_id[msgctxt_len + msgid_len];
1525 +#else
1526 +  char buf[1024];
1527 +  char *msg_ctxt_id =
1528 +    (msgctxt_len + msgid_len <= sizeof (buf)
1529 +     ? buf
1530 +     : (char *) malloc (msgctxt_len + msgid_len));
1531 +  if (msg_ctxt_id != NULL)
1532 +#endif
1533 +    {
1534 +      memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
1535 +      msg_ctxt_id[msgctxt_len - 1] = '\004';
1536 +      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
1537 +      translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
1538 +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
1539 +      if (msg_ctxt_id != buf)
1540 +       free (msg_ctxt_id);
1541 +#endif
1542 +      if (!(translation == msg_ctxt_id || translation == msgid_plural))
1543 +       return translation;
1544 +    }
1545 +  return (n == 1 ? msgid : msgid_plural);
1546 +}
1547 +
1548 +#endif /* _LIBGETTEXT_H */
1549 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/inet_ntop.c gtk-vnc-0.3.7.gnulib/gnulib/lib/inet_ntop.c
1550 --- gtk-vnc-0.3.7.dan3/gnulib/lib/inet_ntop.c   1970-01-01 01:00:00.000000000 +0100
1551 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/inet_ntop.c 2008-10-09 15:24:52.000000000 +0100
1552 @@ -0,0 +1,238 @@
1553 +/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
1554 +
1555 +   Copyright (C) 2005, 2006, 2008  Free Software Foundation, Inc.
1556 +
1557 +   This program is free software; you can redistribute it and/or modify
1558 +   it under the terms of the GNU Lesser General Public License as published by
1559 +   the Free Software Foundation; either version 2.1, or (at your option)
1560 +   any later version.
1561 +
1562 +   This program is distributed in the hope that it will be useful,
1563 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1564 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1565 +   GNU Lesser General Public License for more details.
1566 +
1567 +   You should have received a copy of the GNU Lesser General Public License
1568 +   along with this program; if not, write to the Free Software Foundation,
1569 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
1570 +
1571 +/*
1572 + * Copyright (c) 1996-1999 by Internet Software Consortium.
1573 + *
1574 + * Permission to use, copy, modify, and distribute this software for any
1575 + * purpose with or without fee is hereby granted, provided that the above
1576 + * copyright notice and this permission notice appear in all copies.
1577 + *
1578 + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
1579 + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
1580 + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
1581 + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
1582 + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
1583 + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
1584 + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1585 + * SOFTWARE.
1586 + */
1587 +
1588 +#include <config.h>
1589 +
1590 +/* Specification.  */
1591 +#include <arpa/inet.h>
1592 +
1593 +#include <stdio.h>
1594 +#include <string.h>
1595 +#include <errno.h>
1596 +
1597 +#ifndef EAFNOSUPPORT
1598 +# define EAFNOSUPPORT EINVAL
1599 +#endif
1600 +
1601 +#define NS_IN6ADDRSZ 16
1602 +#define NS_INT16SZ 2
1603 +
1604 +/*
1605 + * WARNING: Don't even consider trying to compile this on a system where
1606 + * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
1607 + */
1608 +typedef int verify_int_size[2 * sizeof (int) - 7];
1609 +
1610 +static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
1611 +#if HAVE_IPV6
1612 +static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size);
1613 +#endif
1614 +
1615 +
1616 +/* char *
1617 + * inet_ntop(af, src, dst, size)
1618 + *     convert a network format address to presentation format.
1619 + * return:
1620 + *     pointer to presentation format address (`dst'), or NULL (see errno).
1621 + * author:
1622 + *     Paul Vixie, 1996.
1623 + */
1624 +const char *
1625 +inet_ntop (int af, const void *restrict src,
1626 +          char *restrict dst, socklen_t cnt)
1627 +{
1628 +  switch (af)
1629 +    {
1630 +#if HAVE_IPV4
1631 +    case AF_INET:
1632 +      return (inet_ntop4 (src, dst, cnt));
1633 +#endif
1634 +
1635 +#if HAVE_IPV6
1636 +    case AF_INET6:
1637 +      return (inet_ntop6 (src, dst, cnt));
1638 +#endif
1639 +
1640 +    default:
1641 +      errno = EAFNOSUPPORT;
1642 +      return (NULL);
1643 +    }
1644 +  /* NOTREACHED */
1645 +}
1646 +
1647 +/* const char *
1648 + * inet_ntop4(src, dst, size)
1649 + *     format an IPv4 address
1650 + * return:
1651 + *     `dst' (as a const)
1652 + * notes:
1653 + *     (1) uses no statics
1654 + *     (2) takes a u_char* not an in_addr as input
1655 + * author:
1656 + *     Paul Vixie, 1996.
1657 + */
1658 +static const char *
1659 +inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
1660 +{
1661 +  char tmp[sizeof "255.255.255.255"];
1662 +  int len;
1663 +
1664 +  len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]);
1665 +  if (len < 0)
1666 +    return NULL;
1667 +
1668 +  if (len > size)
1669 +    {
1670 +      errno = ENOSPC;
1671 +      return NULL;
1672 +    }
1673 +
1674 +  return strcpy (dst, tmp);
1675 +}
1676 +
1677 +#if HAVE_IPV6
1678 +
1679 +/* const char *
1680 + * inet_ntop6(src, dst, size)
1681 + *     convert IPv6 binary address into presentation (printable) format
1682 + * author:
1683 + *     Paul Vixie, 1996.
1684 + */
1685 +static const char *
1686 +inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
1687 +{
1688 +  /*
1689 +   * Note that int32_t and int16_t need only be "at least" large enough
1690 +   * to contain a value of the specified size.  On some systems, like
1691 +   * Crays, there is no such thing as an integer variable with 16 bits.
1692 +   * Keep this in mind if you think this function should have been coded
1693 +   * to use pointer overlays.  All the world's not a VAX.
1694 +   */
1695 +  char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
1696 +  struct
1697 +  {
1698 +    int base, len;
1699 +  } best, cur;
1700 +  unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
1701 +  int i;
1702 +
1703 +  /*
1704 +   * Preprocess:
1705 +   *      Copy the input (bytewise) array into a wordwise array.
1706 +   *      Find the longest run of 0x00's in src[] for :: shorthanding.
1707 +   */
1708 +  memset (words, '\0', sizeof words);
1709 +  for (i = 0; i < NS_IN6ADDRSZ; i += 2)
1710 +    words[i / 2] = (src[i] << 8) | src[i + 1];
1711 +  best.base = -1;
1712 +  cur.base = -1;
1713 +  for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
1714 +    {
1715 +      if (words[i] == 0)
1716 +       {
1717 +         if (cur.base == -1)
1718 +           cur.base = i, cur.len = 1;
1719 +         else
1720 +           cur.len++;
1721 +       }
1722 +      else
1723 +       {
1724 +         if (cur.base != -1)
1725 +           {
1726 +             if (best.base == -1 || cur.len > best.len)
1727 +               best = cur;
1728 +             cur.base = -1;
1729 +           }
1730 +       }
1731 +    }
1732 +  if (cur.base != -1)
1733 +    {
1734 +      if (best.base == -1 || cur.len > best.len)
1735 +       best = cur;
1736 +    }
1737 +  if (best.base != -1 && best.len < 2)
1738 +    best.base = -1;
1739 +
1740 +  /*
1741 +   * Format the result.
1742 +   */
1743 +  tp = tmp;
1744 +  for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
1745 +    {
1746 +      /* Are we inside the best run of 0x00's? */
1747 +      if (best.base != -1 && i >= best.base && i < (best.base + best.len))
1748 +       {
1749 +         if (i == best.base)
1750 +           *tp++ = ':';
1751 +         continue;
1752 +       }
1753 +      /* Are we following an initial run of 0x00s or any real hex? */
1754 +      if (i != 0)
1755 +       *tp++ = ':';
1756 +      /* Is this address an encapsulated IPv4? */
1757 +      if (i == 6 && best.base == 0 &&
1758 +         (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
1759 +       {
1760 +         if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
1761 +           return (NULL);
1762 +         tp += strlen (tp);
1763 +         break;
1764 +       }
1765 +      {
1766 +       int len = sprintf (tp, "%x", words[i]);
1767 +       if (len < 0)
1768 +         return NULL;
1769 +       tp += len;
1770 +      }
1771 +    }
1772 +  /* Was it a trailing run of 0x00's? */
1773 +  if (best.base != -1 && (best.base + best.len) ==
1774 +      (NS_IN6ADDRSZ / NS_INT16SZ))
1775 +    *tp++ = ':';
1776 +  *tp++ = '\0';
1777 +
1778 +  /*
1779 +   * Check for overflow, copy, and we're done.
1780 +   */
1781 +  if ((socklen_t) (tp - tmp) > size)
1782 +    {
1783 +      errno = ENOSPC;
1784 +      return NULL;
1785 +    }
1786 +
1787 +  return strcpy (dst, tmp);
1788 +}
1789 +
1790 +#endif
1791 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/Makefile.am gtk-vnc-0.3.7.gnulib/gnulib/lib/Makefile.am
1792 --- gtk-vnc-0.3.7.dan3/gnulib/lib/Makefile.am   1970-01-01 01:00:00.000000000 +0100
1793 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/Makefile.am 2008-10-09 15:24:53.000000000 +0100
1794 @@ -0,0 +1,605 @@
1795 +## DO NOT EDIT! GENERATED AUTOMATICALLY!
1796 +## Process this file with automake to produce Makefile.in.
1797 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
1798 +#
1799 +# This file is free software, distributed under the terms of the GNU
1800 +# General Public License.  As a special exception to the GNU General
1801 +# Public License, this file may be distributed as part of a program
1802 +# that contains a configuration script generated by Autoconf, under
1803 +# the same distribution terms as the rest of that program.
1804 +#
1805 +# Generated by gnulib-tool.
1806 +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=. --with-tests --lgpl=2 --libtool --macro-prefix=gl connect getaddrinfo malloc recv send socket vc-list-files
1807 +
1808 +AUTOMAKE_OPTIONS = 1.5 gnits
1809 +
1810 +SUBDIRS =
1811 +noinst_HEADERS =
1812 +noinst_LIBRARIES =
1813 +noinst_LTLIBRARIES =
1814 +EXTRA_DIST =
1815 +BUILT_SOURCES =
1816 +SUFFIXES =
1817 +MOSTLYCLEANFILES = core *.stackdump
1818 +MOSTLYCLEANDIRS =
1819 +CLEANFILES =
1820 +DISTCLEANFILES =
1821 +MAINTAINERCLEANFILES =
1822 +
1823 +AM_CPPFLAGS =
1824 +
1825 +noinst_LTLIBRARIES += libgnu.la
1826 +
1827 +libgnu_la_SOURCES =
1828 +libgnu_la_LIBADD = $(gl_LTLIBOBJS)
1829 +libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
1830 +EXTRA_libgnu_la_SOURCES =
1831 +libgnu_la_LDFLAGS = $(AM_LDFLAGS)
1832 +
1833 +## begin gnulib module alloca-opt
1834 +
1835 +BUILT_SOURCES += $(ALLOCA_H)
1836 +
1837 +# We need the following in order to create <alloca.h> when the system
1838 +# doesn't have one that works with the given compiler.
1839 +alloca.h: alloca.in.h
1840 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
1841 +         cat $(srcdir)/alloca.in.h; \
1842 +       } > $@-t
1843 +       mv -f $@-t $@
1844 +MOSTLYCLEANFILES += alloca.h alloca.h-t
1845 +
1846 +EXTRA_DIST += alloca.in.h
1847 +
1848 +## end   gnulib module alloca-opt
1849 +
1850 +## begin gnulib module arpa_inet
1851 +
1852 +BUILT_SOURCES += $(ARPA_INET_H)
1853 +
1854 +# We need the following in order to create <arpa/inet.h> when the system
1855 +# doesn't have one.
1856 +arpa/inet.h:
1857 +       @MKDIR_P@ arpa
1858 +       rm -f $@-t $@
1859 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
1860 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
1861 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1862 +             -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
1863 +             -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
1864 +             -e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \
1865 +             -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
1866 +             -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
1867 +             -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
1868 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
1869 +             < $(srcdir)/arpa_inet.in.h; \
1870 +       } > $@-t
1871 +       mv $@-t $@
1872 +MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
1873 +MOSTLYCLEANDIRS += arpa
1874 +
1875 +EXTRA_DIST += arpa_inet.in.h
1876 +
1877 +## end   gnulib module arpa_inet
1878 +
1879 +## begin gnulib module connect
1880 +
1881 +
1882 +EXTRA_DIST += winsock.c
1883 +
1884 +EXTRA_libgnu_la_SOURCES += winsock.c
1885 +
1886 +## end   gnulib module connect
1887 +
1888 +## begin gnulib module errno
1889 +
1890 +BUILT_SOURCES += $(ERRNO_H)
1891 +
1892 +# We need the following in order to create <errno.h> when the system
1893 +# doesn't have one that is POSIX compliant.
1894 +errno.h: errno.in.h
1895 +       rm -f $@-t $@
1896 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
1897 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
1898 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1899 +             -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
1900 +             -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
1901 +             -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
1902 +             -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
1903 +             -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
1904 +             -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
1905 +             -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
1906 +             < $(srcdir)/errno.in.h; \
1907 +       } > $@-t
1908 +       mv $@-t $@
1909 +MOSTLYCLEANFILES += errno.h errno.h-t
1910 +
1911 +EXTRA_DIST += errno.in.h
1912 +
1913 +## end   gnulib module errno
1914 +
1915 +## begin gnulib module float
1916 +
1917 +BUILT_SOURCES += $(FLOAT_H)
1918 +
1919 +# We need the following in order to create <float.h> when the system
1920 +# doesn't have one that works with the given compiler.
1921 +float.h: float.in.h
1922 +       rm -f $@-t $@
1923 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
1924 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
1925 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1926 +             -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
1927 +             < $(srcdir)/float.in.h; \
1928 +       } > $@-t
1929 +       mv $@-t $@
1930 +MOSTLYCLEANFILES += float.h float.h-t
1931 +
1932 +EXTRA_DIST += float.in.h
1933 +
1934 +## end   gnulib module float
1935 +
1936 +## begin gnulib module getaddrinfo
1937 +
1938 +
1939 +EXTRA_DIST += gai_strerror.c getaddrinfo.c getaddrinfo.h
1940 +
1941 +EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c
1942 +
1943 +## end   gnulib module getaddrinfo
1944 +
1945 +## begin gnulib module gettext-h
1946 +
1947 +libgnu_la_SOURCES += gettext.h
1948 +
1949 +## end   gnulib module gettext-h
1950 +
1951 +## begin gnulib module inet_ntop
1952 +
1953 +
1954 +EXTRA_DIST += inet_ntop.c
1955 +
1956 +EXTRA_libgnu_la_SOURCES += inet_ntop.c
1957 +
1958 +## end   gnulib module inet_ntop
1959 +
1960 +## begin gnulib module link-warning
1961 +
1962 +LINK_WARNING_H=$(top_srcdir)/./link-warning.h
1963 +
1964 +EXTRA_DIST += $(top_srcdir)/./link-warning.h
1965 +
1966 +## end   gnulib module link-warning
1967 +
1968 +## begin gnulib module malloc
1969 +
1970 +
1971 +EXTRA_DIST += malloc.c
1972 +
1973 +EXTRA_libgnu_la_SOURCES += malloc.c
1974 +
1975 +## end   gnulib module malloc
1976 +
1977 +## begin gnulib module malloc-posix
1978 +
1979 +
1980 +EXTRA_DIST += malloc.c
1981 +
1982 +EXTRA_libgnu_la_SOURCES += malloc.c
1983 +
1984 +## end   gnulib module malloc-posix
1985 +
1986 +## begin gnulib module netinet_in
1987 +
1988 +BUILT_SOURCES += $(NETINET_IN_H)
1989 +
1990 +# We need the following in order to create <netinet/in.h> when the system
1991 +# doesn't have one.
1992 +netinet/in.h: netinet_in.in.h
1993 +       @MKDIR_P@ netinet
1994 +       rm -f $@-t $@
1995 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
1996 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
1997 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1998 +             -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
1999 +             -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
2000 +             < $(srcdir)/netinet_in.in.h; \
2001 +       } > $@-t
2002 +       mv $@-t $@
2003 +MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
2004 +MOSTLYCLEANDIRS += netinet
2005 +
2006 +EXTRA_DIST += netinet_in.in.h
2007 +
2008 +## end   gnulib module netinet_in
2009 +
2010 +## begin gnulib module recv
2011 +
2012 +
2013 +EXTRA_DIST += winsock.c
2014 +
2015 +EXTRA_libgnu_la_SOURCES += winsock.c
2016 +
2017 +## end   gnulib module recv
2018 +
2019 +## begin gnulib module send
2020 +
2021 +
2022 +EXTRA_DIST += winsock.c
2023 +
2024 +EXTRA_libgnu_la_SOURCES += winsock.c
2025 +
2026 +## end   gnulib module send
2027 +
2028 +## begin gnulib module size_max
2029 +
2030 +libgnu_la_SOURCES += size_max.h
2031 +
2032 +## end   gnulib module size_max
2033 +
2034 +## begin gnulib module snprintf
2035 +
2036 +
2037 +EXTRA_DIST += snprintf.c
2038 +
2039 +EXTRA_libgnu_la_SOURCES += snprintf.c
2040 +
2041 +## end   gnulib module snprintf
2042 +
2043 +## begin gnulib module socket
2044 +
2045 +
2046 +EXTRA_DIST += winsock.c
2047 +
2048 +EXTRA_libgnu_la_SOURCES += winsock.c
2049 +
2050 +## end   gnulib module socket
2051 +
2052 +## begin gnulib module stdbool
2053 +
2054 +BUILT_SOURCES += $(STDBOOL_H)
2055 +
2056 +# We need the following in order to create <stdbool.h> when the system
2057 +# doesn't have one that works.
2058 +stdbool.h: stdbool.in.h
2059 +       rm -f $@-t $@
2060 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2061 +         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
2062 +       } > $@-t
2063 +       mv $@-t $@
2064 +MOSTLYCLEANFILES += stdbool.h stdbool.h-t
2065 +
2066 +EXTRA_DIST += stdbool.in.h
2067 +
2068 +## end   gnulib module stdbool
2069 +
2070 +## begin gnulib module stdint
2071 +
2072 +BUILT_SOURCES += $(STDINT_H)
2073 +
2074 +# We need the following in order to create <stdint.h> when the system
2075 +# doesn't have one that works with the given compiler.
2076 +stdint.h: stdint.in.h
2077 +       rm -f $@-t $@
2078 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2079 +         sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
2080 +             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2081 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2082 +             -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
2083 +             -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
2084 +             -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
2085 +             -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
2086 +             -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
2087 +             -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
2088 +             -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
2089 +             -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
2090 +             -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
2091 +             -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
2092 +             -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
2093 +             -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
2094 +             -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
2095 +             -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
2096 +             -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
2097 +             -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
2098 +             -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
2099 +             -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
2100 +             -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
2101 +             -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
2102 +             < $(srcdir)/stdint.in.h; \
2103 +       } > $@-t
2104 +       mv $@-t $@
2105 +MOSTLYCLEANFILES += stdint.h stdint.h-t
2106 +
2107 +EXTRA_DIST += stdint.in.h
2108 +
2109 +## end   gnulib module stdint
2110 +
2111 +## begin gnulib module stdio
2112 +
2113 +BUILT_SOURCES += stdio.h
2114 +
2115 +# We need the following in order to create <stdio.h> when the system
2116 +# doesn't have one that works with the given compiler.
2117 +stdio.h: stdio.in.h
2118 +       rm -f $@-t $@
2119 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
2120 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2121 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2122 +             -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
2123 +             -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \
2124 +             -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
2125 +             -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \
2126 +             -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
2127 +             -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
2128 +             -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
2129 +             -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \
2130 +             -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
2131 +             -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \
2132 +             -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
2133 +             -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
2134 +             -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
2135 +             -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
2136 +             -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
2137 +             -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
2138 +             -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
2139 +             -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
2140 +             -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
2141 +             -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
2142 +             -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
2143 +             -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
2144 +             -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
2145 +             -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
2146 +             -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
2147 +             -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \
2148 +             -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \
2149 +             -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \
2150 +             -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \
2151 +             -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
2152 +             -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
2153 +             -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
2154 +             -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \
2155 +             -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
2156 +             -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
2157 +             -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
2158 +             -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
2159 +             -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
2160 +             -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
2161 +             -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
2162 +             -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
2163 +             -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
2164 +             -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
2165 +             -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
2166 +             -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
2167 +             -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
2168 +             -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
2169 +             -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
2170 +             -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
2171 +             -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
2172 +             -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
2173 +             -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
2174 +             -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
2175 +             -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
2176 +             -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
2177 +             -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
2178 +             -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
2179 +             -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
2180 +             -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
2181 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2182 +             < $(srcdir)/stdio.in.h; \
2183 +       } > $@-t
2184 +       mv $@-t $@
2185 +MOSTLYCLEANFILES += stdio.h stdio.h-t
2186 +
2187 +EXTRA_DIST += stdio-write.c stdio.in.h
2188 +
2189 +EXTRA_libgnu_la_SOURCES += stdio-write.c
2190 +
2191 +## end   gnulib module stdio
2192 +
2193 +## begin gnulib module stdlib
2194 +
2195 +BUILT_SOURCES += stdlib.h
2196 +
2197 +# We need the following in order to create <stdlib.h> when the system
2198 +# doesn't have one that works with the given compiler.
2199 +stdlib.h: stdlib.in.h
2200 +       rm -f $@-t $@
2201 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
2202 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2203 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2204 +             -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
2205 +             -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
2206 +             -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
2207 +             -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
2208 +             -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
2209 +             -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
2210 +             -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
2211 +             -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
2212 +             -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
2213 +             -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
2214 +             -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
2215 +             -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
2216 +             -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
2217 +             -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
2218 +             -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
2219 +             -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
2220 +             -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
2221 +             -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
2222 +             -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
2223 +             -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
2224 +             -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
2225 +             -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
2226 +             -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
2227 +             -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
2228 +             -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
2229 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2230 +             < $(srcdir)/stdlib.in.h; \
2231 +       } > $@-t
2232 +       mv $@-t $@
2233 +MOSTLYCLEANFILES += stdlib.h stdlib.h-t
2234 +
2235 +EXTRA_DIST += stdlib.in.h
2236 +
2237 +## end   gnulib module stdlib
2238 +
2239 +## begin gnulib module sys_socket
2240 +
2241 +BUILT_SOURCES += $(SYS_SOCKET_H)
2242 +
2243 +# We need the following in order to create <sys/socket.h> when the system
2244 +# doesn't have one that works with the given compiler.
2245 +sys/socket.h: sys_socket.in.h
2246 +       @MKDIR_P@ sys
2247 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2248 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2249 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2250 +             -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
2251 +             -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
2252 +             -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \
2253 +             -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \
2254 +             -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \
2255 +             -e 's|@''GNULIB_BIND''@|$(GNULIB_BIND)|g' \
2256 +             -e 's|@''GNULIB_GETPEERNAME''@|$(GNULIB_GETPEERNAME)|g' \
2257 +             -e 's|@''GNULIB_GETSOCKNAME''@|$(GNULIB_GETSOCKNAME)|g' \
2258 +             -e 's|@''GNULIB_GETSOCKOPT''@|$(GNULIB_GETSOCKOPT)|g' \
2259 +             -e 's|@''GNULIB_LISTEN''@|$(GNULIB_LISTEN)|g' \
2260 +             -e 's|@''GNULIB_RECV''@|$(GNULIB_RECV)|g' \
2261 +             -e 's|@''GNULIB_SEND''@|$()GNULIB_SEND|g' \
2262 +             -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \
2263 +             -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \
2264 +             -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \
2265 +             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
2266 +             -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
2267 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2268 +             < $(srcdir)/sys_socket.in.h; \
2269 +       } > $@-t
2270 +       mv -f $@-t $@
2271 +MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
2272 +MOSTLYCLEANDIRS += sys
2273 +
2274 +EXTRA_DIST += sys_socket.in.h winsock.c
2275 +
2276 +EXTRA_libgnu_la_SOURCES += winsock.c
2277 +
2278 +## end   gnulib module sys_socket
2279 +
2280 +## begin gnulib module unistd
2281 +
2282 +BUILT_SOURCES += unistd.h
2283 +
2284 +# We need the following in order to create an empty placeholder for
2285 +# <unistd.h> when the system doesn't have one.
2286 +unistd.h: unistd.in.h
2287 +       rm -f $@-t $@
2288 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2289 +         sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
2290 +             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2291 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2292 +             -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
2293 +             -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
2294 +             -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
2295 +             -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
2296 +             -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
2297 +             -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \
2298 +             -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
2299 +             -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
2300 +             -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
2301 +             -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
2302 +             -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
2303 +             -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
2304 +             -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
2305 +             -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
2306 +             -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
2307 +             -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
2308 +             -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
2309 +             -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
2310 +             -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
2311 +             -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
2312 +             -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
2313 +             -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
2314 +             -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
2315 +             -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
2316 +             -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
2317 +             -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
2318 +             -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
2319 +             -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
2320 +             -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
2321 +             -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
2322 +             -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
2323 +             -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
2324 +             -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
2325 +             -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
2326 +             -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
2327 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2328 +             < $(srcdir)/unistd.in.h; \
2329 +       } > $@-t
2330 +       mv $@-t $@
2331 +MOSTLYCLEANFILES += unistd.h unistd.h-t
2332 +
2333 +EXTRA_DIST += unistd.in.h
2334 +
2335 +## end   gnulib module unistd
2336 +
2337 +## begin gnulib module vasnprintf
2338 +
2339 +
2340 +EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h
2341 +
2342 +EXTRA_libgnu_la_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c
2343 +
2344 +## end   gnulib module vasnprintf
2345 +
2346 +## begin gnulib module vc-list-files
2347 +
2348 +
2349 +EXTRA_DIST += $(top_srcdir)/./vc-list-files
2350 +
2351 +## end   gnulib module vc-list-files
2352 +
2353 +## begin gnulib module wchar
2354 +
2355 +BUILT_SOURCES += $(WCHAR_H)
2356 +
2357 +# We need the following in order to create <wchar.h> when the system
2358 +# version does not work standalone.
2359 +wchar.h: wchar.in.h
2360 +       rm -f $@-t $@
2361 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2362 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2363 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2364 +             -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
2365 +             -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
2366 +             -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
2367 +             -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
2368 +             -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
2369 +             -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
2370 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2371 +           < $(srcdir)/wchar.in.h; \
2372 +       } > $@-t
2373 +       mv $@-t $@
2374 +MOSTLYCLEANFILES += wchar.h wchar.h-t
2375 +
2376 +EXTRA_DIST += wchar.in.h
2377 +
2378 +## end   gnulib module wchar
2379 +
2380 +## begin gnulib module xsize
2381 +
2382 +libgnu_la_SOURCES += xsize.h
2383 +
2384 +## end   gnulib module xsize
2385 +
2386 +## begin gnulib module dummy
2387 +
2388 +libgnu_la_SOURCES += dummy.c
2389 +
2390 +## end   gnulib module dummy
2391 +
2392 +
2393 +mostlyclean-local: mostlyclean-generic
2394 +       @for dir in '' $(MOSTLYCLEANDIRS); do \
2395 +         if test -n "$$dir" && test -d $$dir; then \
2396 +           echo "rmdir $$dir"; rmdir $$dir; \
2397 +         fi; \
2398 +       done; \
2399 +       :
2400 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/malloc.c gtk-vnc-0.3.7.gnulib/gnulib/lib/malloc.c
2401 --- gtk-vnc-0.3.7.dan3/gnulib/lib/malloc.c      1970-01-01 01:00:00.000000000 +0100
2402 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/malloc.c    2008-10-09 15:24:52.000000000 +0100
2403 @@ -0,0 +1,57 @@
2404 +/* malloc() function that is glibc compatible.
2405 +
2406 +   Copyright (C) 1997, 1998, 2006, 2007 Free Software Foundation, Inc.
2407 +
2408 +   This program is free software; you can redistribute it and/or modify
2409 +   it under the terms of the GNU Lesser General Public License as published by
2410 +   the Free Software Foundation; either version 2.1, or (at your option)
2411 +   any later version.
2412 +
2413 +   This program is distributed in the hope that it will be useful,
2414 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2415 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2416 +   GNU Lesser General Public License for more details.
2417 +
2418 +   You should have received a copy of the GNU Lesser General Public License
2419 +   along with this program; if not, write to the Free Software Foundation,
2420 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
2421 +
2422 +/* written by Jim Meyering and Bruno Haible */
2423 +
2424 +#include <config.h>
2425 +/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h.  */
2426 +#ifdef malloc
2427 +# define NEED_MALLOC_GNU
2428 +# undef malloc
2429 +#endif
2430 +
2431 +/* Specification.  */
2432 +#include <stdlib.h>
2433 +
2434 +#include <errno.h>
2435 +
2436 +/* Call the system's malloc below.  */
2437 +#undef malloc
2438 +
2439 +/* Allocate an N-byte block of memory from the heap.
2440 +   If N is zero, allocate a 1-byte block.  */
2441 +
2442 +void *
2443 +rpl_malloc (size_t n)
2444 +{
2445 +  void *result;
2446 +
2447 +#ifdef NEED_MALLOC_GNU
2448 +  if (n == 0)
2449 +    n = 1;
2450 +#endif
2451 +
2452 +  result = malloc (n);
2453 +
2454 +#if !HAVE_MALLOC_POSIX
2455 +  if (result == NULL)
2456 +    errno = ENOMEM;
2457 +#endif
2458 +
2459 +  return result;
2460 +}
2461 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/netinet_in.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/netinet_in.in.h
2462 --- gtk-vnc-0.3.7.dan3/gnulib/lib/netinet_in.in.h       1970-01-01 01:00:00.000000000 +0100
2463 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/netinet_in.in.h     2008-10-09 15:24:52.000000000 +0100
2464 @@ -0,0 +1,45 @@
2465 +/* Substitute for <netinet/in.h>.
2466 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
2467 +
2468 +   This program is free software; you can redistribute it and/or modify
2469 +   it under the terms of the GNU Lesser General Public License as published by
2470 +   the Free Software Foundation; either version 2.1, or (at your option)
2471 +   any later version.
2472 +
2473 +   This program is distributed in the hope that it will be useful,
2474 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2475 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2476 +   GNU Lesser General Public License for more details.
2477 +
2478 +   You should have received a copy of the GNU Lesser General Public License
2479 +   along with this program; if not, write to the Free Software Foundation,
2480 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
2481 +
2482 +#ifndef _GL_NETINET_IN_H
2483 +
2484 +#if @HAVE_NETINET_IN_H@
2485 +
2486 +@PRAGMA_SYSTEM_HEADER@
2487 +
2488 +/* On many platforms, <netinet/in.h> assumes prior inclusion of
2489 +   <sys/types.h>.  */
2490 +# include <sys/types.h>
2491 +
2492 +/* The include_next requires a split double-inclusion guard.  */
2493 +# @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@
2494 +
2495 +#endif
2496 +
2497 +#ifndef _GL_NETINET_IN_H
2498 +#define _GL_NETINET_IN_H
2499 +
2500 +#if !@HAVE_NETINET_IN_H@
2501 +
2502 +/* A platform that lacks <netinet/in.h>.  */
2503 +
2504 +# include <sys/socket.h>
2505 +
2506 +#endif
2507 +
2508 +#endif /* _GL_NETINET_IN_H */
2509 +#endif /* _GL_NETINET_IN_H */
2510 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/printf-args.c gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.c
2511 --- gtk-vnc-0.3.7.dan3/gnulib/lib/printf-args.c 1970-01-01 01:00:00.000000000 +0100
2512 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.c       2008-10-09 15:24:52.000000000 +0100
2513 @@ -0,0 +1,187 @@
2514 +/* Decomposed printf argument list.
2515 +   Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
2516 +
2517 +   This program is free software; you can redistribute it and/or modify
2518 +   it under the terms of the GNU Lesser General Public License as published by
2519 +   the Free Software Foundation; either version 2.1, or (at your option)
2520 +   any later version.
2521 +
2522 +   This program is distributed in the hope that it will be useful,
2523 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2524 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2525 +   GNU Lesser General Public License for more details.
2526 +
2527 +   You should have received a copy of the GNU Lesser General Public License along
2528 +   with this program; if not, write to the Free Software Foundation,
2529 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
2530 +
2531 +/* This file can be parametrized with the following macros:
2532 +     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
2533 +     PRINTF_FETCHARGS   Name of the function to be defined.
2534 +     STATIC             Set to 'static' to declare the function static.  */
2535 +
2536 +#ifndef PRINTF_FETCHARGS
2537 +# include <config.h>
2538 +#endif
2539 +
2540 +/* Specification.  */
2541 +#ifndef PRINTF_FETCHARGS
2542 +# include "printf-args.h"
2543 +#endif
2544 +
2545 +#ifdef STATIC
2546 +STATIC
2547 +#endif
2548 +int
2549 +PRINTF_FETCHARGS (va_list args, arguments *a)
2550 +{
2551 +  size_t i;
2552 +  argument *ap;
2553 +
2554 +  for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
2555 +    switch (ap->type)
2556 +      {
2557 +      case TYPE_SCHAR:
2558 +       ap->a.a_schar = va_arg (args, /*signed char*/ int);
2559 +       break;
2560 +      case TYPE_UCHAR:
2561 +       ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
2562 +       break;
2563 +      case TYPE_SHORT:
2564 +       ap->a.a_short = va_arg (args, /*short*/ int);
2565 +       break;
2566 +      case TYPE_USHORT:
2567 +       ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
2568 +       break;
2569 +      case TYPE_INT:
2570 +       ap->a.a_int = va_arg (args, int);
2571 +       break;
2572 +      case TYPE_UINT:
2573 +       ap->a.a_uint = va_arg (args, unsigned int);
2574 +       break;
2575 +      case TYPE_LONGINT:
2576 +       ap->a.a_longint = va_arg (args, long int);
2577 +       break;
2578 +      case TYPE_ULONGINT:
2579 +       ap->a.a_ulongint = va_arg (args, unsigned long int);
2580 +       break;
2581 +#if HAVE_LONG_LONG_INT
2582 +      case TYPE_LONGLONGINT:
2583 +       ap->a.a_longlongint = va_arg (args, long long int);
2584 +       break;
2585 +      case TYPE_ULONGLONGINT:
2586 +       ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
2587 +       break;
2588 +#endif
2589 +      case TYPE_DOUBLE:
2590 +       ap->a.a_double = va_arg (args, double);
2591 +       break;
2592 +      case TYPE_LONGDOUBLE:
2593 +       ap->a.a_longdouble = va_arg (args, long double);
2594 +       break;
2595 +      case TYPE_CHAR:
2596 +       ap->a.a_char = va_arg (args, int);
2597 +       break;
2598 +#if HAVE_WINT_T
2599 +      case TYPE_WIDE_CHAR:
2600 +       /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
2601 +          default argument promotions", this is not the case in mingw32,
2602 +          where wint_t is 'unsigned short'.  */
2603 +       ap->a.a_wide_char =
2604 +         (sizeof (wint_t) < sizeof (int)
2605 +          ? va_arg (args, int)
2606 +          : va_arg (args, wint_t));
2607 +       break;
2608 +#endif
2609 +      case TYPE_STRING:
2610 +       ap->a.a_string = va_arg (args, const char *);
2611 +       /* A null pointer is an invalid argument for "%s", but in practice
2612 +          it occurs quite frequently in printf statements that produce
2613 +          debug output.  Use a fallback in this case.  */
2614 +       if (ap->a.a_string == NULL)
2615 +         ap->a.a_string = "(NULL)";
2616 +       break;
2617 +#if HAVE_WCHAR_T
2618 +      case TYPE_WIDE_STRING:
2619 +       ap->a.a_wide_string = va_arg (args, const wchar_t *);
2620 +       /* A null pointer is an invalid argument for "%ls", but in practice
2621 +          it occurs quite frequently in printf statements that produce
2622 +          debug output.  Use a fallback in this case.  */
2623 +       if (ap->a.a_wide_string == NULL)
2624 +         {
2625 +           static const wchar_t wide_null_string[] =
2626 +             {
2627 +               (wchar_t)'(',
2628 +               (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
2629 +               (wchar_t)')',
2630 +               (wchar_t)0
2631 +             };
2632 +           ap->a.a_wide_string = wide_null_string;
2633 +         }
2634 +       break;
2635 +#endif
2636 +      case TYPE_POINTER:
2637 +       ap->a.a_pointer = va_arg (args, void *);
2638 +       break;
2639 +      case TYPE_COUNT_SCHAR_POINTER:
2640 +       ap->a.a_count_schar_pointer = va_arg (args, signed char *);
2641 +       break;
2642 +      case TYPE_COUNT_SHORT_POINTER:
2643 +       ap->a.a_count_short_pointer = va_arg (args, short *);
2644 +       break;
2645 +      case TYPE_COUNT_INT_POINTER:
2646 +       ap->a.a_count_int_pointer = va_arg (args, int *);
2647 +       break;
2648 +      case TYPE_COUNT_LONGINT_POINTER:
2649 +       ap->a.a_count_longint_pointer = va_arg (args, long int *);
2650 +       break;
2651 +#if HAVE_LONG_LONG_INT
2652 +      case TYPE_COUNT_LONGLONGINT_POINTER:
2653 +       ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
2654 +       break;
2655 +#endif
2656 +#if ENABLE_UNISTDIO
2657 +      /* The unistdio extensions.  */
2658 +      case TYPE_U8_STRING:
2659 +       ap->a.a_u8_string = va_arg (args, const uint8_t *);
2660 +       /* A null pointer is an invalid argument for "%U", but in practice
2661 +          it occurs quite frequently in printf statements that produce
2662 +          debug output.  Use a fallback in this case.  */
2663 +       if (ap->a.a_u8_string == NULL)
2664 +         {
2665 +           static const uint8_t u8_null_string[] =
2666 +             { '(', 'N', 'U', 'L', 'L', ')', 0 };
2667 +           ap->a.a_u8_string = u8_null_string;
2668 +         }
2669 +       break;
2670 +      case TYPE_U16_STRING:
2671 +       ap->a.a_u16_string = va_arg (args, const uint16_t *);
2672 +       /* A null pointer is an invalid argument for "%lU", but in practice
2673 +          it occurs quite frequently in printf statements that produce
2674 +          debug output.  Use a fallback in this case.  */
2675 +       if (ap->a.a_u16_string == NULL)
2676 +         {
2677 +           static const uint16_t u16_null_string[] =
2678 +             { '(', 'N', 'U', 'L', 'L', ')', 0 };
2679 +           ap->a.a_u16_string = u16_null_string;
2680 +         }
2681 +       break;
2682 +      case TYPE_U32_STRING:
2683 +       ap->a.a_u32_string = va_arg (args, const uint32_t *);
2684 +       /* A null pointer is an invalid argument for "%llU", but in practice
2685 +          it occurs quite frequently in printf statements that produce
2686 +          debug output.  Use a fallback in this case.  */
2687 +       if (ap->a.a_u32_string == NULL)
2688 +         {
2689 +           static const uint32_t u32_null_string[] =
2690 +             { '(', 'N', 'U', 'L', 'L', ')', 0 };
2691 +           ap->a.a_u32_string = u32_null_string;
2692 +         }
2693 +       break;
2694 +#endif
2695 +      default:
2696 +       /* Unknown type.  */
2697 +       return -1;
2698 +      }
2699 +  return 0;
2700 +}
2701 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/printf-args.h gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.h
2702 --- gtk-vnc-0.3.7.dan3/gnulib/lib/printf-args.h 1970-01-01 01:00:00.000000000 +0100
2703 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.h       2008-10-09 15:24:52.000000000 +0100
2704 @@ -0,0 +1,154 @@
2705 +/* Decomposed printf argument list.
2706 +   Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc.
2707 +
2708 +   This program is free software; you can redistribute it and/or modify
2709 +   it under the terms of the GNU Lesser General Public License as published by
2710 +   the Free Software Foundation; either version 2.1, or (at your option)
2711 +   any later version.
2712 +
2713 +   This program is distributed in the hope that it will be useful,
2714 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2715 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2716 +   GNU Lesser General Public License for more details.
2717 +
2718 +   You should have received a copy of the GNU Lesser General Public License along
2719 +   with this program; if not, write to the Free Software Foundation,
2720 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
2721 +
2722 +#ifndef _PRINTF_ARGS_H
2723 +#define _PRINTF_ARGS_H
2724 +
2725 +/* This file can be parametrized with the following macros:
2726 +     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
2727 +     PRINTF_FETCHARGS   Name of the function to be declared.
2728 +     STATIC             Set to 'static' to declare the function static.  */
2729 +
2730 +/* Default parameters.  */
2731 +#ifndef PRINTF_FETCHARGS
2732 +# define PRINTF_FETCHARGS printf_fetchargs
2733 +#endif
2734 +
2735 +/* Get size_t.  */
2736 +#include <stddef.h>
2737 +
2738 +/* Get wchar_t.  */
2739 +#if HAVE_WCHAR_T
2740 +# include <stddef.h>
2741 +#endif
2742 +
2743 +/* Get wint_t.  */
2744 +#if HAVE_WINT_T
2745 +# include <wchar.h>
2746 +#endif
2747 +
2748 +/* Get va_list.  */
2749 +#include <stdarg.h>
2750 +
2751 +
2752 +/* Argument types */
2753 +typedef enum
2754 +{
2755 +  TYPE_NONE,
2756 +  TYPE_SCHAR,
2757 +  TYPE_UCHAR,
2758 +  TYPE_SHORT,
2759 +  TYPE_USHORT,
2760 +  TYPE_INT,
2761 +  TYPE_UINT,
2762 +  TYPE_LONGINT,
2763 +  TYPE_ULONGINT,
2764 +#if HAVE_LONG_LONG_INT
2765 +  TYPE_LONGLONGINT,
2766 +  TYPE_ULONGLONGINT,
2767 +#endif
2768 +  TYPE_DOUBLE,
2769 +  TYPE_LONGDOUBLE,
2770 +  TYPE_CHAR,
2771 +#if HAVE_WINT_T
2772 +  TYPE_WIDE_CHAR,
2773 +#endif
2774 +  TYPE_STRING,
2775 +#if HAVE_WCHAR_T
2776 +  TYPE_WIDE_STRING,
2777 +#endif
2778 +  TYPE_POINTER,
2779 +  TYPE_COUNT_SCHAR_POINTER,
2780 +  TYPE_COUNT_SHORT_POINTER,
2781 +  TYPE_COUNT_INT_POINTER,
2782 +  TYPE_COUNT_LONGINT_POINTER
2783 +#if HAVE_LONG_LONG_INT
2784 +, TYPE_COUNT_LONGLONGINT_POINTER
2785 +#endif
2786 +#if ENABLE_UNISTDIO
2787 +  /* The unistdio extensions.  */
2788 +, TYPE_U8_STRING
2789 +, TYPE_U16_STRING
2790 +, TYPE_U32_STRING
2791 +#endif
2792 +} arg_type;
2793 +
2794 +/* Polymorphic argument */
2795 +typedef struct
2796 +{
2797 +  arg_type type;
2798 +  union
2799 +  {
2800 +    signed char                        a_schar;
2801 +    unsigned char              a_uchar;
2802 +    short                      a_short;
2803 +    unsigned short             a_ushort;
2804 +    int                                a_int;
2805 +    unsigned int               a_uint;
2806 +    long int                   a_longint;
2807 +    unsigned long int          a_ulongint;
2808 +#if HAVE_LONG_LONG_INT
2809 +    long long int              a_longlongint;
2810 +    unsigned long long int     a_ulonglongint;
2811 +#endif
2812 +    float                      a_float;
2813 +    double                     a_double;
2814 +    long double                        a_longdouble;
2815 +    int                                a_char;
2816 +#if HAVE_WINT_T
2817 +    wint_t                     a_wide_char;
2818 +#endif
2819 +    const char*                        a_string;
2820 +#if HAVE_WCHAR_T
2821 +    const wchar_t*             a_wide_string;
2822 +#endif
2823 +    void*                      a_pointer;
2824 +    signed char *              a_count_schar_pointer;
2825 +    short *                    a_count_short_pointer;
2826 +    int *                      a_count_int_pointer;
2827 +    long int *                 a_count_longint_pointer;
2828 +#if HAVE_LONG_LONG_INT
2829 +    long long int *            a_count_longlongint_pointer;
2830 +#endif
2831 +#if ENABLE_UNISTDIO
2832 +    /* The unistdio extensions.  */
2833 +    const uint8_t *            a_u8_string;
2834 +    const uint16_t *           a_u16_string;
2835 +    const uint32_t *           a_u32_string;
2836 +#endif
2837 +  }
2838 +  a;
2839 +}
2840 +argument;
2841 +
2842 +typedef struct
2843 +{
2844 +  size_t count;
2845 +  argument *arg;
2846 +}
2847 +arguments;
2848 +
2849 +
2850 +/* Fetch the arguments, putting them into a. */
2851 +#ifdef STATIC
2852 +STATIC
2853 +#else
2854 +extern
2855 +#endif
2856 +int PRINTF_FETCHARGS (va_list args, arguments *a);
2857 +
2858 +#endif /* _PRINTF_ARGS_H */
2859 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/printf-parse.c gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.c
2860 --- gtk-vnc-0.3.7.dan3/gnulib/lib/printf-parse.c        1970-01-01 01:00:00.000000000 +0100
2861 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.c      2008-10-09 15:24:52.000000000 +0100
2862 @@ -0,0 +1,627 @@
2863 +/* Formatted output to strings.
2864 +   Copyright (C) 1999-2000, 2002-2003, 2006-2008 Free Software Foundation, Inc.
2865 +
2866 +   This program is free software; you can redistribute it and/or modify
2867 +   it under the terms of the GNU Lesser General Public License as published by
2868 +   the Free Software Foundation; either version 2.1, or (at your option)
2869 +   any later version.
2870 +
2871 +   This program is distributed in the hope that it will be useful,
2872 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2873 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2874 +   GNU Lesser General Public License for more details.
2875 +
2876 +   You should have received a copy of the GNU Lesser General Public License along
2877 +   with this program; if not, write to the Free Software Foundation,
2878 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
2879 +
2880 +/* This file can be parametrized with the following macros:
2881 +     CHAR_T             The element type of the format string.
2882 +     CHAR_T_ONLY_ASCII  Set to 1 to enable verification that all characters
2883 +                        in the format string are ASCII.
2884 +     DIRECTIVE          Structure denoting a format directive.
2885 +                        Depends on CHAR_T.
2886 +     DIRECTIVES         Structure denoting the set of format directives of a
2887 +                        format string.  Depends on CHAR_T.
2888 +     PRINTF_PARSE       Function that parses a format string.
2889 +                        Depends on CHAR_T.
2890 +     STATIC             Set to 'static' to declare the function static.
2891 +     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.  */
2892 +
2893 +#ifndef PRINTF_PARSE
2894 +# include <config.h>
2895 +#endif
2896 +
2897 +/* Specification.  */
2898 +#ifndef PRINTF_PARSE
2899 +# include "printf-parse.h"
2900 +#endif
2901 +
2902 +/* Default parameters.  */
2903 +#ifndef PRINTF_PARSE
2904 +# define PRINTF_PARSE printf_parse
2905 +# define CHAR_T char
2906 +# define DIRECTIVE char_directive
2907 +# define DIRECTIVES char_directives
2908 +#endif
2909 +
2910 +/* Get size_t, NULL.  */
2911 +#include <stddef.h>
2912 +
2913 +/* Get intmax_t.  */
2914 +#if defined IN_LIBINTL || defined IN_LIBASPRINTF
2915 +# if HAVE_STDINT_H_WITH_UINTMAX
2916 +#  include <stdint.h>
2917 +# endif
2918 +# if HAVE_INTTYPES_H_WITH_UINTMAX
2919 +#  include <inttypes.h>
2920 +# endif
2921 +#else
2922 +# include <stdint.h>
2923 +#endif
2924 +
2925 +/* malloc(), realloc(), free().  */
2926 +#include <stdlib.h>
2927 +
2928 +/* errno.  */
2929 +#include <errno.h>
2930 +
2931 +/* Checked size_t computations.  */
2932 +#include "xsize.h"
2933 +
2934 +#if CHAR_T_ONLY_ASCII
2935 +/* c_isascii().  */
2936 +# include "c-ctype.h"
2937 +#endif
2938 +
2939 +#ifdef STATIC
2940 +STATIC
2941 +#endif
2942 +int
2943 +PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
2944 +{
2945 +  const CHAR_T *cp = format;           /* pointer into format */
2946 +  size_t arg_posn = 0;         /* number of regular arguments consumed */
2947 +  size_t d_allocated;                  /* allocated elements of d->dir */
2948 +  size_t a_allocated;                  /* allocated elements of a->arg */
2949 +  size_t max_width_length = 0;
2950 +  size_t max_precision_length = 0;
2951 +
2952 +  d->count = 0;
2953 +  d_allocated = 1;
2954 +  d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE));
2955 +  if (d->dir == NULL)
2956 +    /* Out of memory.  */
2957 +    goto out_of_memory_1;
2958 +
2959 +  a->count = 0;
2960 +  a_allocated = 0;
2961 +  a->arg = NULL;
2962 +
2963 +#define REGISTER_ARG(_index_,_type_) \
2964 +  {                                                                    \
2965 +    size_t n = (_index_);                                              \
2966 +    if (n >= a_allocated)                                              \
2967 +      {                                                                        \
2968 +       size_t memory_size;                                             \
2969 +       argument *memory;                                               \
2970 +                                                                       \
2971 +       a_allocated = xtimes (a_allocated, 2);                          \
2972 +       if (a_allocated <= n)                                           \
2973 +         a_allocated = xsum (n, 1);                                    \
2974 +       memory_size = xtimes (a_allocated, sizeof (argument));          \
2975 +       if (size_overflow_p (memory_size))                              \
2976 +         /* Overflow, would lead to out of memory.  */                 \
2977 +         goto out_of_memory;                                           \
2978 +       memory = (argument *) (a->arg                                   \
2979 +                              ? realloc (a->arg, memory_size)          \
2980 +                              : malloc (memory_size));                 \
2981 +       if (memory == NULL)                                             \
2982 +         /* Out of memory.  */                                         \
2983 +         goto out_of_memory;                                           \
2984 +       a->arg = memory;                                                \
2985 +      }                                                                        \
2986 +    while (a->count <= n)                                              \
2987 +      a->arg[a->count++].type = TYPE_NONE;                             \
2988 +    if (a->arg[n].type == TYPE_NONE)                                   \
2989 +      a->arg[n].type = (_type_);                                       \
2990 +    else if (a->arg[n].type != (_type_))                               \
2991 +      /* Ambiguous type for positional argument.  */                   \
2992 +      goto error;                                                      \
2993 +  }
2994 +
2995 +  while (*cp != '\0')
2996 +    {
2997 +      CHAR_T c = *cp++;
2998 +      if (c == '%')
2999 +       {
3000 +         size_t arg_index = ARG_NONE;
3001 +         DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
3002 +
3003 +         /* Initialize the next directive.  */
3004 +         dp->dir_start = cp - 1;
3005 +         dp->flags = 0;
3006 +         dp->width_start = NULL;
3007 +         dp->width_end = NULL;
3008 +         dp->width_arg_index = ARG_NONE;
3009 +         dp->precision_start = NULL;
3010 +         dp->precision_end = NULL;
3011 +         dp->precision_arg_index = ARG_NONE;
3012 +         dp->arg_index = ARG_NONE;
3013 +
3014 +         /* Test for positional argument.  */
3015 +         if (*cp >= '0' && *cp <= '9')
3016 +           {
3017 +             const CHAR_T *np;
3018 +
3019 +             for (np = cp; *np >= '0' && *np <= '9'; np++)
3020 +               ;
3021 +             if (*np == '$')
3022 +               {
3023 +                 size_t n = 0;
3024 +
3025 +                 for (np = cp; *np >= '0' && *np <= '9'; np++)
3026 +                   n = xsum (xtimes (n, 10), *np - '0');
3027 +                 if (n == 0)
3028 +                   /* Positional argument 0.  */
3029 +                   goto error;
3030 +                 if (size_overflow_p (n))
3031 +                   /* n too large, would lead to out of memory later.  */
3032 +                   goto error;
3033 +                 arg_index = n - 1;
3034 +                 cp = np + 1;
3035 +               }
3036 +           }
3037 +
3038 +         /* Read the flags.  */
3039 +         for (;;)
3040 +           {
3041 +             if (*cp == '\'')
3042 +               {
3043 +                 dp->flags |= FLAG_GROUP;
3044 +                 cp++;
3045 +               }
3046 +             else if (*cp == '-')
3047 +               {
3048 +                 dp->flags |= FLAG_LEFT;
3049 +                 cp++;
3050 +               }
3051 +             else if (*cp == '+')
3052 +               {
3053 +                 dp->flags |= FLAG_SHOWSIGN;
3054 +                 cp++;
3055 +               }
3056 +             else if (*cp == ' ')
3057 +               {
3058 +                 dp->flags |= FLAG_SPACE;
3059 +                 cp++;
3060 +               }
3061 +             else if (*cp == '#')
3062 +               {
3063 +                 dp->flags |= FLAG_ALT;
3064 +                 cp++;
3065 +               }
3066 +             else if (*cp == '0')
3067 +               {
3068 +                 dp->flags |= FLAG_ZERO;
3069 +                 cp++;
3070 +               }
3071 +             else
3072 +               break;
3073 +           }
3074 +
3075 +         /* Parse the field width.  */
3076 +         if (*cp == '*')
3077 +           {
3078 +             dp->width_start = cp;
3079 +             cp++;
3080 +             dp->width_end = cp;
3081 +             if (max_width_length < 1)
3082 +               max_width_length = 1;
3083 +
3084 +             /* Test for positional argument.  */
3085 +             if (*cp >= '0' && *cp <= '9')
3086 +               {
3087 +                 const CHAR_T *np;
3088 +
3089 +                 for (np = cp; *np >= '0' && *np <= '9'; np++)
3090 +                   ;
3091 +                 if (*np == '$')
3092 +                   {
3093 +                     size_t n = 0;
3094 +
3095 +                     for (np = cp; *np >= '0' && *np <= '9'; np++)
3096 +                       n = xsum (xtimes (n, 10), *np - '0');
3097 +                     if (n == 0)
3098 +                       /* Positional argument 0.  */
3099 +                       goto error;
3100 +                     if (size_overflow_p (n))
3101 +                       /* n too large, would lead to out of memory later.  */
3102 +                       goto error;
3103 +                     dp->width_arg_index = n - 1;
3104 +                     cp = np + 1;
3105 +                   }
3106 +               }
3107 +             if (dp->width_arg_index == ARG_NONE)
3108 +               {
3109 +                 dp->width_arg_index = arg_posn++;
3110 +                 if (dp->width_arg_index == ARG_NONE)
3111 +                   /* arg_posn wrapped around.  */
3112 +                   goto error;
3113 +               }
3114 +             REGISTER_ARG (dp->width_arg_index, TYPE_INT);
3115 +           }
3116 +         else if (*cp >= '0' && *cp <= '9')
3117 +           {
3118 +             size_t width_length;
3119 +
3120 +             dp->width_start = cp;
3121 +             for (; *cp >= '0' && *cp <= '9'; cp++)
3122 +               ;
3123 +             dp->width_end = cp;
3124 +             width_length = dp->width_end - dp->width_start;
3125 +             if (max_width_length < width_length)
3126 +               max_width_length = width_length;
3127 +           }
3128 +
3129 +         /* Parse the precision.  */
3130 +         if (*cp == '.')
3131 +           {
3132 +             cp++;
3133 +             if (*cp == '*')
3134 +               {
3135 +                 dp->precision_start = cp - 1;
3136 +                 cp++;
3137 +                 dp->precision_end = cp;
3138 +                 if (max_precision_length < 2)
3139 +                   max_precision_length = 2;
3140 +
3141 +                 /* Test for positional argument.  */
3142 +                 if (*cp >= '0' && *cp <= '9')
3143 +                   {
3144 +                     const CHAR_T *np;
3145 +
3146 +                     for (np = cp; *np >= '0' && *np <= '9'; np++)
3147 +                       ;
3148 +                     if (*np == '$')
3149 +                       {
3150 +                         size_t n = 0;
3151 +
3152 +                         for (np = cp; *np >= '0' && *np <= '9'; np++)
3153 +                           n = xsum (xtimes (n, 10), *np - '0');
3154 +                         if (n == 0)
3155 +                           /* Positional argument 0.  */
3156 +                           goto error;
3157 +                         if (size_overflow_p (n))
3158 +                           /* n too large, would lead to out of memory
3159 +                              later.  */
3160 +                           goto error;
3161 +                         dp->precision_arg_index = n - 1;
3162 +                         cp = np + 1;
3163 +                       }
3164 +                   }
3165 +                 if (dp->precision_arg_index == ARG_NONE)
3166 +                   {
3167 +                     dp->precision_arg_index = arg_posn++;
3168 +                     if (dp->precision_arg_index == ARG_NONE)
3169 +                       /* arg_posn wrapped around.  */
3170 +                       goto error;
3171 +                   }
3172 +                 REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
3173 +               }
3174 +             else
3175 +               {
3176 +                 size_t precision_length;
3177 +
3178 +                 dp->precision_start = cp - 1;
3179 +                 for (; *cp >= '0' && *cp <= '9'; cp++)
3180 +                   ;
3181 +                 dp->precision_end = cp;
3182 +                 precision_length = dp->precision_end - dp->precision_start;
3183 +                 if (max_precision_length < precision_length)
3184 +                   max_precision_length = precision_length;
3185 +               }
3186 +           }
3187 +
3188 +         {
3189 +           arg_type type;
3190 +
3191 +           /* Parse argument type/size specifiers.  */
3192 +           {
3193 +             int flags = 0;
3194 +
3195 +             for (;;)
3196 +               {
3197 +                 if (*cp == 'h')
3198 +                   {
3199 +                     flags |= (1 << (flags & 1));
3200 +                     cp++;
3201 +                   }
3202 +                 else if (*cp == 'L')
3203 +                   {
3204 +                     flags |= 4;
3205 +                     cp++;
3206 +                   }
3207 +                 else if (*cp == 'l')
3208 +                   {
3209 +                     flags += 8;
3210 +                     cp++;
3211 +                   }
3212 +                 else if (*cp == 'j')
3213 +                   {
3214 +                     if (sizeof (intmax_t) > sizeof (long))
3215 +                       {
3216 +                         /* intmax_t = long long */
3217 +                         flags += 16;
3218 +                       }
3219 +                     else if (sizeof (intmax_t) > sizeof (int))
3220 +                       {
3221 +                         /* intmax_t = long */
3222 +                         flags += 8;
3223 +                       }
3224 +                     cp++;
3225 +                   }
3226 +                 else if (*cp == 'z' || *cp == 'Z')
3227 +                   {
3228 +                     /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
3229 +                        because the warning facility in gcc-2.95.2 understands
3230 +                        only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784).  */
3231 +                     if (sizeof (size_t) > sizeof (long))
3232 +                       {
3233 +                         /* size_t = long long */
3234 +                         flags += 16;
3235 +                       }
3236 +                     else if (sizeof (size_t) > sizeof (int))
3237 +                       {
3238 +                         /* size_t = long */
3239 +                         flags += 8;
3240 +                       }
3241 +                     cp++;
3242 +                   }
3243 +                 else if (*cp == 't')
3244 +                   {
3245 +                     if (sizeof (ptrdiff_t) > sizeof (long))
3246 +                       {
3247 +                         /* ptrdiff_t = long long */
3248 +                         flags += 16;
3249 +                       }
3250 +                     else if (sizeof (ptrdiff_t) > sizeof (int))
3251 +                       {
3252 +                         /* ptrdiff_t = long */
3253 +                         flags += 8;
3254 +                       }
3255 +                     cp++;
3256 +                   }
3257 +#if defined __APPLE__ && defined __MACH__
3258 +                 /* On MacOS X 10.3, PRIdMAX is defined as "qd".
3259 +                    We cannot change it to "lld" because PRIdMAX must also
3260 +                    be understood by the system's printf routines.  */
3261 +                 else if (*cp == 'q')
3262 +                   {
3263 +                     if (64 / 8 > sizeof (long))
3264 +                       {
3265 +                         /* int64_t = long long */
3266 +                         flags += 16;
3267 +                       }
3268 +                     else
3269 +                       {
3270 +                         /* int64_t = long */
3271 +                         flags += 8;
3272 +                       }
3273 +                     cp++;
3274 +                   }
3275 +#endif
3276 +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
3277 +                 /* On native Win32, PRIdMAX is defined as "I64d".
3278 +                    We cannot change it to "lld" because PRIdMAX must also
3279 +                    be understood by the system's printf routines.  */
3280 +                 else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
3281 +                   {
3282 +                     if (64 / 8 > sizeof (long))
3283 +                       {
3284 +                         /* __int64 = long long */
3285 +                         flags += 16;
3286 +                       }
3287 +                     else
3288 +                       {
3289 +                         /* __int64 = long */
3290 +                         flags += 8;
3291 +                       }
3292 +                     cp += 3;
3293 +                   }
3294 +#endif
3295 +                 else
3296 +                   break;
3297 +               }
3298 +
3299 +             /* Read the conversion character.  */
3300 +             c = *cp++;
3301 +             switch (c)
3302 +               {
3303 +               case 'd': case 'i':
3304 +#if HAVE_LONG_LONG_INT
3305 +                 /* If 'long long' exists and is larger than 'long':  */
3306 +                 if (flags >= 16 || (flags & 4))
3307 +                   type = TYPE_LONGLONGINT;
3308 +                 else
3309 +#endif
3310 +                 /* If 'long long' exists and is the same as 'long', we parse
3311 +                    "lld" into TYPE_LONGINT.  */
3312 +                 if (flags >= 8)
3313 +                   type = TYPE_LONGINT;
3314 +                 else if (flags & 2)
3315 +                   type = TYPE_SCHAR;
3316 +                 else if (flags & 1)
3317 +                   type = TYPE_SHORT;
3318 +                 else
3319 +                   type = TYPE_INT;
3320 +                 break;
3321 +               case 'o': case 'u': case 'x': case 'X':
3322 +#if HAVE_LONG_LONG_INT
3323 +                 /* If 'long long' exists and is larger than 'long':  */
3324 +                 if (flags >= 16 || (flags & 4))
3325 +                   type = TYPE_ULONGLONGINT;
3326 +                 else
3327 +#endif
3328 +                 /* If 'unsigned long long' exists and is the same as
3329 +                    'unsigned long', we parse "llu" into TYPE_ULONGINT.  */
3330 +                 if (flags >= 8)
3331 +                   type = TYPE_ULONGINT;
3332 +                 else if (flags & 2)
3333 +                   type = TYPE_UCHAR;
3334 +                 else if (flags & 1)
3335 +                   type = TYPE_USHORT;
3336 +                 else
3337 +                   type = TYPE_UINT;
3338 +                 break;
3339 +               case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
3340 +               case 'a': case 'A':
3341 +                 if (flags >= 16 || (flags & 4))
3342 +                   type = TYPE_LONGDOUBLE;
3343 +                 else
3344 +                   type = TYPE_DOUBLE;
3345 +                 break;
3346 +               case 'c':
3347 +                 if (flags >= 8)
3348 +#if HAVE_WINT_T
3349 +                   type = TYPE_WIDE_CHAR;
3350 +#else
3351 +                   goto error;
3352 +#endif
3353 +                 else
3354 +                   type = TYPE_CHAR;
3355 +                 break;
3356 +#if HAVE_WINT_T
3357 +               case 'C':
3358 +                 type = TYPE_WIDE_CHAR;
3359 +                 c = 'c';
3360 +                 break;
3361 +#endif
3362 +               case 's':
3363 +                 if (flags >= 8)
3364 +#if HAVE_WCHAR_T
3365 +                   type = TYPE_WIDE_STRING;
3366 +#else
3367 +                   goto error;
3368 +#endif
3369 +                 else
3370 +                   type = TYPE_STRING;
3371 +                 break;
3372 +#if HAVE_WCHAR_T
3373 +               case 'S':
3374 +                 type = TYPE_WIDE_STRING;
3375 +                 c = 's';
3376 +                 break;
3377 +#endif
3378 +               case 'p':
3379 +                 type = TYPE_POINTER;
3380 +                 break;
3381 +               case 'n':
3382 +#if HAVE_LONG_LONG_INT
3383 +                 /* If 'long long' exists and is larger than 'long':  */
3384 +                 if (flags >= 16 || (flags & 4))
3385 +                   type = TYPE_COUNT_LONGLONGINT_POINTER;
3386 +                 else
3387 +#endif
3388 +                 /* If 'long long' exists and is the same as 'long', we parse
3389 +                    "lln" into TYPE_COUNT_LONGINT_POINTER.  */
3390 +                 if (flags >= 8)
3391 +                   type = TYPE_COUNT_LONGINT_POINTER;
3392 +                 else if (flags & 2)
3393 +                   type = TYPE_COUNT_SCHAR_POINTER;
3394 +                 else if (flags & 1)
3395 +                   type = TYPE_COUNT_SHORT_POINTER;
3396 +                 else
3397 +                   type = TYPE_COUNT_INT_POINTER;
3398 +                 break;
3399 +#if ENABLE_UNISTDIO
3400 +               /* The unistdio extensions.  */
3401 +               case 'U':
3402 +                 if (flags >= 16)
3403 +                   type = TYPE_U32_STRING;
3404 +                 else if (flags >= 8)
3405 +                   type = TYPE_U16_STRING;
3406 +                 else
3407 +                   type = TYPE_U8_STRING;
3408 +                 break;
3409 +#endif
3410 +               case '%':
3411 +                 type = TYPE_NONE;
3412 +                 break;
3413 +               default:
3414 +                 /* Unknown conversion character.  */
3415 +                 goto error;
3416 +               }
3417 +           }
3418 +
3419 +           if (type != TYPE_NONE)
3420 +             {
3421 +               dp->arg_index = arg_index;
3422 +               if (dp->arg_index == ARG_NONE)
3423 +                 {
3424 +                   dp->arg_index = arg_posn++;
3425 +                   if (dp->arg_index == ARG_NONE)
3426 +                     /* arg_posn wrapped around.  */
3427 +                     goto error;
3428 +                 }
3429 +               REGISTER_ARG (dp->arg_index, type);
3430 +             }
3431 +           dp->conversion = c;
3432 +           dp->dir_end = cp;
3433 +         }
3434 +
3435 +         d->count++;
3436 +         if (d->count >= d_allocated)
3437 +           {
3438 +             size_t memory_size;
3439 +             DIRECTIVE *memory;
3440 +
3441 +             d_allocated = xtimes (d_allocated, 2);
3442 +             memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
3443 +             if (size_overflow_p (memory_size))
3444 +               /* Overflow, would lead to out of memory.  */
3445 +               goto out_of_memory;
3446 +             memory = (DIRECTIVE *) realloc (d->dir, memory_size);
3447 +             if (memory == NULL)
3448 +               /* Out of memory.  */
3449 +               goto out_of_memory;
3450 +             d->dir = memory;
3451 +           }
3452 +       }
3453 +#if CHAR_T_ONLY_ASCII
3454 +      else if (!c_isascii (c))
3455 +       {
3456 +         /* Non-ASCII character.  Not supported.  */
3457 +         goto error;
3458 +       }
3459 +#endif
3460 +    }
3461 +  d->dir[d->count].dir_start = cp;
3462 +
3463 +  d->max_width_length = max_width_length;
3464 +  d->max_precision_length = max_precision_length;
3465 +  return 0;
3466 +
3467 +error:
3468 +  if (a->arg)
3469 +    free (a->arg);
3470 +  if (d->dir)
3471 +    free (d->dir);
3472 +  errno = EINVAL;
3473 +  return -1;
3474 +
3475 +out_of_memory:
3476 +  if (a->arg)
3477 +    free (a->arg);
3478 +  if (d->dir)
3479 +    free (d->dir);
3480 +out_of_memory_1:
3481 +  errno = ENOMEM;
3482 +  return -1;
3483 +}
3484 +
3485 +#undef PRINTF_PARSE
3486 +#undef DIRECTIVES
3487 +#undef DIRECTIVE
3488 +#undef CHAR_T_ONLY_ASCII
3489 +#undef CHAR_T
3490 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/printf-parse.h gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.h
3491 --- gtk-vnc-0.3.7.dan3/gnulib/lib/printf-parse.h        1970-01-01 01:00:00.000000000 +0100
3492 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.h      2008-10-09 15:24:52.000000000 +0100
3493 @@ -0,0 +1,179 @@
3494 +/* Parse printf format string.
3495 +   Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc.
3496 +
3497 +   This program is free software; you can redistribute it and/or modify
3498 +   it under the terms of the GNU Lesser General Public License as published by
3499 +   the Free Software Foundation; either version 2.1, or (at your option)
3500 +   any later version.
3501 +
3502 +   This program is distributed in the hope that it will be useful,
3503 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3504 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3505 +   GNU Lesser General Public License for more details.
3506 +
3507 +   You should have received a copy of the GNU Lesser General Public License along
3508 +   with this program; if not, write to the Free Software Foundation,
3509 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
3510 +
3511 +#ifndef _PRINTF_PARSE_H
3512 +#define _PRINTF_PARSE_H
3513 +
3514 +/* This file can be parametrized with the following macros:
3515 +     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
3516 +     STATIC             Set to 'static' to declare the function static.  */
3517 +
3518 +#include "printf-args.h"
3519 +
3520 +
3521 +/* Flags */
3522 +#define FLAG_GROUP      1      /* ' flag */
3523 +#define FLAG_LEFT       2      /* - flag */
3524 +#define FLAG_SHOWSIGN   4      /* + flag */
3525 +#define FLAG_SPACE      8      /* space flag */
3526 +#define FLAG_ALT       16      /* # flag */
3527 +#define FLAG_ZERO      32
3528 +
3529 +/* arg_index value indicating that no argument is consumed.  */
3530 +#define ARG_NONE       (~(size_t)0)
3531 +
3532 +/* xxx_directive: A parsed directive.
3533 +   xxx_directives: A parsed format string.  */
3534 +
3535 +/* A parsed directive.  */
3536 +typedef struct
3537 +{
3538 +  const char* dir_start;
3539 +  const char* dir_end;
3540 +  int flags;
3541 +  const char* width_start;
3542 +  const char* width_end;
3543 +  size_t width_arg_index;
3544 +  const char* precision_start;
3545 +  const char* precision_end;
3546 +  size_t precision_arg_index;
3547 +  char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
3548 +  size_t arg_index;
3549 +}
3550 +char_directive;
3551 +
3552 +/* A parsed format string.  */
3553 +typedef struct
3554 +{
3555 +  size_t count;
3556 +  char_directive *dir;
3557 +  size_t max_width_length;
3558 +  size_t max_precision_length;
3559 +}
3560 +char_directives;
3561 +
3562 +#if ENABLE_UNISTDIO
3563 +
3564 +/* A parsed directive.  */
3565 +typedef struct
3566 +{
3567 +  const uint8_t* dir_start;
3568 +  const uint8_t* dir_end;
3569 +  int flags;
3570 +  const uint8_t* width_start;
3571 +  const uint8_t* width_end;
3572 +  size_t width_arg_index;
3573 +  const uint8_t* precision_start;
3574 +  const uint8_t* precision_end;
3575 +  size_t precision_arg_index;
3576 +  uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
3577 +  size_t arg_index;
3578 +}
3579 +u8_directive;
3580 +
3581 +/* A parsed format string.  */
3582 +typedef struct
3583 +{
3584 +  size_t count;
3585 +  u8_directive *dir;
3586 +  size_t max_width_length;
3587 +  size_t max_precision_length;
3588 +}
3589 +u8_directives;
3590 +
3591 +/* A parsed directive.  */
3592 +typedef struct
3593 +{
3594 +  const uint16_t* dir_start;
3595 +  const uint16_t* dir_end;
3596 +  int flags;
3597 +  const uint16_t* width_start;
3598 +  const uint16_t* width_end;
3599 +  size_t width_arg_index;
3600 +  const uint16_t* precision_start;
3601 +  const uint16_t* precision_end;
3602 +  size_t precision_arg_index;
3603 +  uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
3604 +  size_t arg_index;
3605 +}
3606 +u16_directive;
3607 +
3608 +/* A parsed format string.  */
3609 +typedef struct
3610 +{
3611 +  size_t count;
3612 +  u16_directive *dir;
3613 +  size_t max_width_length;
3614 +  size_t max_precision_length;
3615 +}
3616 +u16_directives;
3617 +
3618 +/* A parsed directive.  */
3619 +typedef struct
3620 +{
3621 +  const uint32_t* dir_start;
3622 +  const uint32_t* dir_end;
3623 +  int flags;
3624 +  const uint32_t* width_start;
3625 +  const uint32_t* width_end;
3626 +  size_t width_arg_index;
3627 +  const uint32_t* precision_start;
3628 +  const uint32_t* precision_end;
3629 +  size_t precision_arg_index;
3630 +  uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
3631 +  size_t arg_index;
3632 +}
3633 +u32_directive;
3634 +
3635 +/* A parsed format string.  */
3636 +typedef struct
3637 +{
3638 +  size_t count;
3639 +  u32_directive *dir;
3640 +  size_t max_width_length;
3641 +  size_t max_precision_length;
3642 +}
3643 +u32_directives;
3644 +
3645 +#endif
3646 +
3647 +
3648 +/* Parses the format string.  Fills in the number N of directives, and fills
3649 +   in directives[0], ..., directives[N-1], and sets directives[N].dir_start
3650 +   to the end of the format string.  Also fills in the arg_type fields of the
3651 +   arguments and the needed count of arguments.  */
3652 +#if ENABLE_UNISTDIO
3653 +extern int
3654 +       ulc_printf_parse (const char *format, char_directives *d, arguments *a);
3655 +extern int
3656 +       u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
3657 +extern int
3658 +       u16_printf_parse (const uint16_t *format, u16_directives *d,
3659 +                        arguments *a);
3660 +extern int
3661 +       u32_printf_parse (const uint32_t *format, u32_directives *d,
3662 +                        arguments *a);
3663 +#else
3664 +# ifdef STATIC
3665 +STATIC
3666 +# else
3667 +extern
3668 +# endif
3669 +int printf_parse (const char *format, char_directives *d, arguments *a);
3670 +#endif
3671 +
3672 +#endif /* _PRINTF_PARSE_H */
3673 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/size_max.h gtk-vnc-0.3.7.gnulib/gnulib/lib/size_max.h
3674 --- gtk-vnc-0.3.7.dan3/gnulib/lib/size_max.h    1970-01-01 01:00:00.000000000 +0100
3675 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/size_max.h  2008-10-09 15:24:52.000000000 +0100
3676 @@ -0,0 +1,31 @@
3677 +/* size_max.h -- declare SIZE_MAX through system headers
3678 +   Copyright (C) 2005-2006 Free Software Foundation, Inc.
3679 +   Written by Simon Josefsson.
3680 +
3681 +   This program is free software; you can redistribute it and/or modify
3682 +   it under the terms of the GNU Lesser General Public License as published by
3683 +   the Free Software Foundation; either version 2.1, or (at your option)
3684 +   any later version.
3685 +
3686 +   This program is distributed in the hope that it will be useful,
3687 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3688 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3689 +   GNU Lesser General Public License for more details.
3690 +
3691 +   You should have received a copy of the GNU Lesser General Public License
3692 +   along with this program; if not, write to the Free Software Foundation,
3693 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
3694 +
3695 +#ifndef GNULIB_SIZE_MAX_H
3696 +#define GNULIB_SIZE_MAX_H
3697 +
3698 +/* Get SIZE_MAX declaration on systems like Solaris 7/8/9.  */
3699 +# include <limits.h>
3700 +/* Get SIZE_MAX declaration on systems like glibc 2.  */
3701 +# if HAVE_STDINT_H
3702 +#  include <stdint.h>
3703 +# endif
3704 +/* On systems where these include files don't define it, SIZE_MAX is defined
3705 +   in config.h.  */
3706 +
3707 +#endif /* GNULIB_SIZE_MAX_H */
3708 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/snprintf.c gtk-vnc-0.3.7.gnulib/gnulib/lib/snprintf.c
3709 --- gtk-vnc-0.3.7.dan3/gnulib/lib/snprintf.c    1970-01-01 01:00:00.000000000 +0100
3710 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/snprintf.c  2008-10-09 15:24:52.000000000 +0100
3711 @@ -0,0 +1,72 @@
3712 +/* Formatted output to strings.
3713 +   Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc.
3714 +   Written by Simon Josefsson and Paul Eggert.
3715 +
3716 +   This program is free software; you can redistribute it and/or modify
3717 +   it under the terms of the GNU Lesser General Public License as published by
3718 +   the Free Software Foundation; either version 2.1, or (at your option)
3719 +   any later version.
3720 +
3721 +   This program is distributed in the hope that it will be useful,
3722 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3723 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3724 +   GNU Lesser General Public License for more details.
3725 +
3726 +   You should have received a copy of the GNU Lesser General Public License along
3727 +   with this program; if not, write to the Free Software Foundation,
3728 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
3729 +
3730 +#include <config.h>
3731 +
3732 +/* Specification.  */
3733 +#include <stdio.h>
3734 +
3735 +#include <errno.h>
3736 +#include <limits.h>
3737 +#include <stdarg.h>
3738 +#include <stdlib.h>
3739 +#include <string.h>
3740 +
3741 +#include "vasnprintf.h"
3742 +
3743 +/* Print formatted output to string STR.  Similar to sprintf, but
3744 +   additional length SIZE limit how much is written into STR.  Returns
3745 +   string length of formatted string (which may be larger than SIZE).
3746 +   STR may be NULL, in which case nothing will be written.  On error,
3747 +   return a negative value.  */
3748 +int
3749 +snprintf (char *str, size_t size, const char *format, ...)
3750 +{
3751 +  char *output;
3752 +  size_t len;
3753 +  size_t lenbuf = size;
3754 +  va_list args;
3755 +
3756 +  va_start (args, format);
3757 +  output = vasnprintf (str, &lenbuf, format, args);
3758 +  len = lenbuf;
3759 +  va_end (args);
3760 +
3761 +  if (!output)
3762 +    return -1;
3763 +
3764 +  if (output != str)
3765 +    {
3766 +      if (size)
3767 +       {
3768 +         size_t pruned_len = (len < size ? len : size - 1);
3769 +         memcpy (str, output, pruned_len);
3770 +         str[pruned_len] = '\0';
3771 +       }
3772 +
3773 +      free (output);
3774 +    }
3775 +
3776 +  if (INT_MAX < len)
3777 +    {
3778 +      errno = EOVERFLOW;
3779 +      return -1;
3780 +    }
3781 +
3782 +  return len;
3783 +}
3784 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/stdbool.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/stdbool.in.h
3785 --- gtk-vnc-0.3.7.dan3/gnulib/lib/stdbool.in.h  1970-01-01 01:00:00.000000000 +0100
3786 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdbool.in.h        2008-10-09 15:24:52.000000000 +0100
3787 @@ -0,0 +1,119 @@
3788 +/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc.
3789 +   Written by Bruno Haible <haible@clisp.cons.org>, 2001.
3790 +
3791 +   This program is free software; you can redistribute it and/or modify
3792 +   it under the terms of the GNU Lesser General Public License as published by
3793 +   the Free Software Foundation; either version 2.1, or (at your option)
3794 +   any later version.
3795 +
3796 +   This program is distributed in the hope that it will be useful,
3797 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3798 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3799 +   GNU Lesser General Public License for more details.
3800 +
3801 +   You should have received a copy of the GNU Lesser General Public License
3802 +   along with this program; if not, write to the Free Software Foundation,
3803 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
3804 +
3805 +#ifndef _GL_STDBOOL_H
3806 +#define _GL_STDBOOL_H
3807 +
3808 +/* ISO C 99 <stdbool.h> for platforms that lack it.  */
3809 +
3810 +/* Usage suggestions:
3811 +
3812 +   Programs that use <stdbool.h> should be aware of some limitations
3813 +   and standards compliance issues.
3814 +
3815 +   Standards compliance:
3816 +
3817 +       - <stdbool.h> must be #included before 'bool', 'false', 'true'
3818 +         can be used.
3819 +
3820 +       - You cannot assume that sizeof (bool) == 1.
3821 +
3822 +       - Programs should not undefine the macros bool, true, and false,
3823 +         as C99 lists that as an "obsolescent feature".
3824 +
3825 +   Limitations of this substitute, when used in a C89 environment:
3826 +
3827 +       - <stdbool.h> must be #included before the '_Bool' type can be used.
3828 +
3829 +       - You cannot assume that _Bool is a typedef; it might be a macro.
3830 +
3831 +       - Bit-fields of type 'bool' are not supported.  Portable code
3832 +         should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
3833 +
3834 +       - In C99, casts and automatic conversions to '_Bool' or 'bool' are
3835 +         performed in such a way that every nonzero value gets converted
3836 +         to 'true', and zero gets converted to 'false'.  This doesn't work
3837 +         with this substitute.  With this substitute, only the values 0 and 1
3838 +         give the expected result when converted to _Bool' or 'bool'.
3839 +
3840 +   Also, it is suggested that programs use 'bool' rather than '_Bool';
3841 +   this isn't required, but 'bool' is more common.  */
3842 +
3843 +
3844 +/* 7.16. Boolean type and values */
3845 +
3846 +/* BeOS <sys/socket.h> already #defines false 0, true 1.  We use the same
3847 +   definitions below, but temporarily we have to #undef them.  */
3848 +#if defined __BEOS__ && !defined __HAIKU__
3849 +# include <OS.h> /* defines bool but not _Bool */
3850 +# undef false
3851 +# undef true
3852 +#endif
3853 +
3854 +/* For the sake of symbolic names in gdb, we define true and false as
3855 +   enum constants, not only as macros.
3856 +   It is tempting to write
3857 +      typedef enum { false = 0, true = 1 } _Bool;
3858 +   so that gdb prints values of type 'bool' symbolically. But if we do
3859 +   this, values of type '_Bool' may promote to 'int' or 'unsigned int'
3860 +   (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
3861 +   (see ISO C 99 6.3.1.1.(2)).  So we add a negative value to the
3862 +   enum; this ensures that '_Bool' promotes to 'int'.  */
3863 +#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__)
3864 +  /* A compiler known to have 'bool'.  */
3865 +  /* If the compiler already has both 'bool' and '_Bool', we can assume they
3866 +     are the same types.  */
3867 +# if !@HAVE__BOOL@
3868 +typedef bool _Bool;
3869 +# endif
3870 +#else
3871 +# if !defined __GNUC__
3872 +   /* If @HAVE__BOOL@:
3873 +        Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
3874 +        the built-in _Bool type is used.  See
3875 +          http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
3876 +          http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
3877 +          http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
3878 +        Similar bugs are likely with other compilers as well; this file
3879 +        wouldn't be used if <stdbool.h> was working.
3880 +        So we override the _Bool type.
3881 +      If !@HAVE__BOOL@:
3882 +        Need to define _Bool ourselves. As 'signed char' or as an enum type?
3883 +        Use of a typedef, with SunPRO C, leads to a stupid
3884 +          "warning: _Bool is a keyword in ISO C99".
3885 +        Use of an enum type, with IRIX cc, leads to a stupid
3886 +          "warning(1185): enumerated type mixed with another type".
3887 +        Even the existence of an enum type, without a typedef,
3888 +          "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
3889 +        The only benefit of the enum, debuggability, is not important
3890 +        with these compilers.  So use 'signed char' and no enum.  */
3891 +#  define _Bool signed char
3892 +# else
3893 +   /* With this compiler, trust the _Bool type if the compiler has it.  */
3894 +#  if !@HAVE__BOOL@
3895 +typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
3896 +#  endif
3897 +# endif
3898 +#endif
3899 +#define bool _Bool
3900 +
3901 +/* The other macros must be usable in preprocessor directives.  */
3902 +#define false 0
3903 +#define true 1
3904 +#define __bool_true_false_are_defined 1
3905 +
3906 +#endif /* _GL_STDBOOL_H */
3907 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/stdint.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/stdint.in.h
3908 --- gtk-vnc-0.3.7.dan3/gnulib/lib/stdint.in.h   1970-01-01 01:00:00.000000000 +0100
3909 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdint.in.h 2008-10-09 15:24:52.000000000 +0100
3910 @@ -0,0 +1,523 @@
3911 +/* Copyright (C) 2001-2002, 2004-2008 Free Software Foundation, Inc.
3912 +   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
3913 +   This file is part of gnulib.
3914 +
3915 +   This program is free software; you can redistribute it and/or modify
3916 +   it under the terms of the GNU Lesser General Public License as published by
3917 +   the Free Software Foundation; either version 2.1, or (at your option)
3918 +   any later version.
3919 +
3920 +   This program is distributed in the hope that it will be useful,
3921 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3922 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3923 +   GNU Lesser General Public License for more details.
3924 +
3925 +   You should have received a copy of the GNU Lesser General Public License
3926 +   along with this program; if not, write to the Free Software Foundation,
3927 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
3928 +
3929 +/*
3930 + * ISO C 99 <stdint.h> for platforms that lack it.
3931 + * <http://www.opengroup.org/susv3xbd/stdint.h.html>
3932 + */
3933 +
3934 +#ifndef _GL_STDINT_H
3935 +
3936 +/* When including a system file that in turn includes <inttypes.h>,
3937 +   use the system <inttypes.h>, not our substitute.  This avoids
3938 +   problems with (for example) VMS, whose <sys/bitypes.h> includes
3939 +   <inttypes.h>.  */
3940 +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
3941 +
3942 +/* Get those types that are already defined in other system include
3943 +   files, so that we can "#define int8_t signed char" below without
3944 +   worrying about a later system include file containing a "typedef
3945 +   signed char int8_t;" that will get messed up by our macro.  Our
3946 +   macros should all be consistent with the system versions, except
3947 +   for the "fast" types and macros, which we recommend against using
3948 +   in public interfaces due to compiler differences.  */
3949 +
3950 +#if @HAVE_STDINT_H@
3951 +# if defined __sgi && ! defined __c99
3952 +   /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
3953 +      with "This header file is to be used only for c99 mode compilations"
3954 +      diagnostics.  */
3955 +#  define __STDINT_H__
3956 +# endif
3957 +  /* Other systems may have an incomplete or buggy <stdint.h>.
3958 +     Include it before <inttypes.h>, since any "#include <stdint.h>"
3959 +     in <inttypes.h> would reinclude us, skipping our contents because
3960 +     _GL_STDINT_H is defined.
3961 +     The include_next requires a split double-inclusion guard.  */
3962 +@PRAGMA_SYSTEM_HEADER@
3963 +# @INCLUDE_NEXT@ @NEXT_STDINT_H@
3964 +#endif
3965 +
3966 +#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
3967 +#define _GL_STDINT_H
3968 +
3969 +/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
3970 +   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
3971 +   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
3972 +   MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
3973 +   relies on the system <stdint.h> definitions, so include
3974 +   <sys/types.h> after @NEXT_STDINT_H@.  */
3975 +#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
3976 +# include <sys/types.h>
3977 +#endif
3978 +
3979 +/* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
3980 +#include <limits.h>
3981 +
3982 +#if @HAVE_INTTYPES_H@
3983 +  /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
3984 +     int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
3985 +     <inttypes.h> also defines intptr_t and uintptr_t.  */
3986 +# include <inttypes.h>
3987 +#elif @HAVE_SYS_INTTYPES_H@
3988 +  /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
3989 +     the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
3990 +# include <sys/inttypes.h>
3991 +#endif
3992 +
3993 +#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
3994 +  /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
3995 +     int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
3996 +     included by <sys/types.h>.  */
3997 +# include <sys/bitypes.h>
3998 +#endif
3999 +
4000 +#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
4001 +
4002 +/* Get WCHAR_MIN, WCHAR_MAX.  */
4003 +# if ! (defined WCHAR_MIN && defined WCHAR_MAX)
4004 +#  include <wchar.h>
4005 +# endif
4006 +
4007 +#endif
4008 +
4009 +#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
4010 +
4011 +/* Minimum and maximum values for a integer type under the usual assumption.
4012 +   Return an unspecified value if BITS == 0, adding a check to pacify
4013 +   picky compilers.  */
4014 +
4015 +#define _STDINT_MIN(signed, bits, zero) \
4016 +  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
4017 +
4018 +#define _STDINT_MAX(signed, bits, zero) \
4019 +  ((signed) \
4020 +   ? ~ _STDINT_MIN (signed, bits, zero) \
4021 +   : /* The expression for the unsigned case.  The subtraction of (signed) \
4022 +       is a nop in the unsigned case and avoids "signed integer overflow" \
4023 +       warnings in the signed case.  */ \
4024 +     ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
4025 +
4026 +/* 7.18.1.1. Exact-width integer types */
4027 +
4028 +/* Here we assume a standard architecture where the hardware integer
4029 +   types have 8, 16, 32, optionally 64 bits.  */
4030 +
4031 +#undef int8_t
4032 +#undef uint8_t
4033 +#define int8_t signed char
4034 +#define uint8_t unsigned char
4035 +
4036 +#undef int16_t
4037 +#undef uint16_t
4038 +#define int16_t short int
4039 +#define uint16_t unsigned short int
4040 +
4041 +#undef int32_t
4042 +#undef uint32_t
4043 +#define int32_t int
4044 +#define uint32_t unsigned int
4045 +
4046 +/* Do not undefine int64_t if gnulib is not being used with 64-bit
4047 +   types, since otherwise it breaks platforms like Tandem/NSK.  */
4048 +#if LONG_MAX >> 31 >> 31 == 1
4049 +# undef int64_t
4050 +# define int64_t long int
4051 +# define GL_INT64_T
4052 +#elif defined _MSC_VER
4053 +# undef int64_t
4054 +# define int64_t __int64
4055 +# define GL_INT64_T
4056 +#elif @HAVE_LONG_LONG_INT@
4057 +# undef int64_t
4058 +# define int64_t long long int
4059 +# define GL_INT64_T
4060 +#endif
4061 +
4062 +#if ULONG_MAX >> 31 >> 31 >> 1 == 1
4063 +# undef uint64_t
4064 +# define uint64_t unsigned long int
4065 +# define GL_UINT64_T
4066 +#elif defined _MSC_VER
4067 +# undef uint64_t
4068 +# define uint64_t unsigned __int64
4069 +# define GL_UINT64_T
4070 +#elif @HAVE_UNSIGNED_LONG_LONG_INT@
4071 +# undef uint64_t
4072 +# define uint64_t unsigned long long int
4073 +# define GL_UINT64_T
4074 +#endif
4075 +
4076 +/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
4077 +#define _UINT8_T
4078 +#define _UINT32_T
4079 +#define _UINT64_T
4080 +
4081 +
4082 +/* 7.18.1.2. Minimum-width integer types */
4083 +
4084 +/* Here we assume a standard architecture where the hardware integer
4085 +   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
4086 +   are the same as the corresponding N_t types.  */
4087 +
4088 +#undef int_least8_t
4089 +#undef uint_least8_t
4090 +#undef int_least16_t
4091 +#undef uint_least16_t
4092 +#undef int_least32_t
4093 +#undef uint_least32_t
4094 +#undef int_least64_t
4095 +#undef uint_least64_t
4096 +#define int_least8_t int8_t
4097 +#define uint_least8_t uint8_t
4098 +#define int_least16_t int16_t
4099 +#define uint_least16_t uint16_t
4100 +#define int_least32_t int32_t
4101 +#define uint_least32_t uint32_t
4102 +#ifdef GL_INT64_T
4103 +# define int_least64_t int64_t
4104 +#endif
4105 +#ifdef GL_UINT64_T
4106 +# define uint_least64_t uint64_t
4107 +#endif
4108 +
4109 +/* 7.18.1.3. Fastest minimum-width integer types */
4110 +
4111 +/* Note: Other <stdint.h> substitutes may define these types differently.
4112 +   It is not recommended to use these types in public header files. */
4113 +
4114 +/* Here we assume a standard architecture where the hardware integer
4115 +   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
4116 +   are taken from the same list of types.  Assume that 'long int'
4117 +   is fast enough for all narrower integers.  */
4118 +
4119 +#undef int_fast8_t
4120 +#undef uint_fast8_t
4121 +#undef int_fast16_t
4122 +#undef uint_fast16_t
4123 +#undef int_fast32_t
4124 +#undef uint_fast32_t
4125 +#undef int_fast64_t
4126 +#undef uint_fast64_t
4127 +#define int_fast8_t long int
4128 +#define uint_fast8_t unsigned int_fast8_t
4129 +#define int_fast16_t long int
4130 +#define uint_fast16_t unsigned int_fast16_t
4131 +#define int_fast32_t long int
4132 +#define uint_fast32_t unsigned int_fast32_t
4133 +#ifdef GL_INT64_T
4134 +# define int_fast64_t int64_t
4135 +#endif
4136 +#ifdef GL_UINT64_T
4137 +# define uint_fast64_t uint64_t
4138 +#endif
4139 +
4140 +/* 7.18.1.4. Integer types capable of holding object pointers */
4141 +
4142 +#undef intptr_t
4143 +#undef uintptr_t
4144 +#define intptr_t long int
4145 +#define uintptr_t unsigned long int
4146 +
4147 +/* 7.18.1.5. Greatest-width integer types */
4148 +
4149 +/* Note: These types are compiler dependent. It may be unwise to use them in
4150 +   public header files. */
4151 +
4152 +#undef intmax_t
4153 +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
4154 +# define intmax_t long long int
4155 +#elif defined GL_INT64_T
4156 +# define intmax_t int64_t
4157 +#else
4158 +# define intmax_t long int
4159 +#endif
4160 +
4161 +#undef uintmax_t
4162 +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
4163 +# define uintmax_t unsigned long long int
4164 +#elif defined GL_UINT64_T
4165 +# define uintmax_t uint64_t
4166 +#else
4167 +# define uintmax_t unsigned long int
4168 +#endif
4169 +
4170 +/* Verify that intmax_t and uintmax_t have the same size.  Too much code
4171 +   breaks if this is not the case.  If this check fails, the reason is likely
4172 +   to be found in the autoconf macros.  */
4173 +typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
4174 +
4175 +/* 7.18.2. Limits of specified-width integer types */
4176 +
4177 +#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
4178 +
4179 +/* 7.18.2.1. Limits of exact-width integer types */
4180 +
4181 +/* Here we assume a standard architecture where the hardware integer
4182 +   types have 8, 16, 32, optionally 64 bits.  */
4183 +
4184 +#undef INT8_MIN
4185 +#undef INT8_MAX
4186 +#undef UINT8_MAX
4187 +#define INT8_MIN  (~ INT8_MAX)
4188 +#define INT8_MAX  127
4189 +#define UINT8_MAX  255
4190 +
4191 +#undef INT16_MIN
4192 +#undef INT16_MAX
4193 +#undef UINT16_MAX
4194 +#define INT16_MIN  (~ INT16_MAX)
4195 +#define INT16_MAX  32767
4196 +#define UINT16_MAX  65535
4197 +
4198 +#undef INT32_MIN
4199 +#undef INT32_MAX
4200 +#undef UINT32_MAX
4201 +#define INT32_MIN  (~ INT32_MAX)
4202 +#define INT32_MAX  2147483647
4203 +#define UINT32_MAX  4294967295U
4204 +
4205 +#undef INT64_MIN
4206 +#undef INT64_MAX
4207 +#ifdef GL_INT64_T
4208 +/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
4209 +   evaluates the latter incorrectly in preprocessor expressions.  */
4210 +# define INT64_MIN  (- INTMAX_C (1) << 63)
4211 +# define INT64_MAX  INTMAX_C (9223372036854775807)
4212 +#endif
4213 +
4214 +#undef UINT64_MAX
4215 +#ifdef GL_UINT64_T
4216 +# define UINT64_MAX  UINTMAX_C (18446744073709551615)
4217 +#endif
4218 +
4219 +/* 7.18.2.2. Limits of minimum-width integer types */
4220 +
4221 +/* Here we assume a standard architecture where the hardware integer
4222 +   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
4223 +   are the same as the corresponding N_t types.  */
4224 +
4225 +#undef INT_LEAST8_MIN
4226 +#undef INT_LEAST8_MAX
4227 +#undef UINT_LEAST8_MAX
4228 +#define INT_LEAST8_MIN  INT8_MIN
4229 +#define INT_LEAST8_MAX  INT8_MAX
4230 +#define UINT_LEAST8_MAX  UINT8_MAX
4231 +
4232 +#undef INT_LEAST16_MIN
4233 +#undef INT_LEAST16_MAX
4234 +#undef UINT_LEAST16_MAX
4235 +#define INT_LEAST16_MIN  INT16_MIN
4236 +#define INT_LEAST16_MAX  INT16_MAX
4237 +#define UINT_LEAST16_MAX  UINT16_MAX
4238 +
4239 +#undef INT_LEAST32_MIN
4240 +#undef INT_LEAST32_MAX
4241 +#undef UINT_LEAST32_MAX
4242 +#define INT_LEAST32_MIN  INT32_MIN
4243 +#define INT_LEAST32_MAX  INT32_MAX
4244 +#define UINT_LEAST32_MAX  UINT32_MAX
4245 +
4246 +#undef INT_LEAST64_MIN
4247 +#undef INT_LEAST64_MAX
4248 +#ifdef GL_INT64_T
4249 +# define INT_LEAST64_MIN  INT64_MIN
4250 +# define INT_LEAST64_MAX  INT64_MAX
4251 +#endif
4252 +
4253 +#undef UINT_LEAST64_MAX
4254 +#ifdef GL_UINT64_T
4255 +# define UINT_LEAST64_MAX  UINT64_MAX
4256 +#endif
4257 +
4258 +/* 7.18.2.3. Limits of fastest minimum-width integer types */
4259 +
4260 +/* Here we assume a standard architecture where the hardware integer
4261 +   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
4262 +   are taken from the same list of types.  */
4263 +
4264 +#undef INT_FAST8_MIN
4265 +#undef INT_FAST8_MAX
4266 +#undef UINT_FAST8_MAX
4267 +#define INT_FAST8_MIN  LONG_MIN
4268 +#define INT_FAST8_MAX  LONG_MAX
4269 +#define UINT_FAST8_MAX  ULONG_MAX
4270 +
4271 +#undef INT_FAST16_MIN
4272 +#undef INT_FAST16_MAX
4273 +#undef UINT_FAST16_MAX
4274 +#define INT_FAST16_MIN  LONG_MIN
4275 +#define INT_FAST16_MAX  LONG_MAX
4276 +#define UINT_FAST16_MAX  ULONG_MAX
4277 +
4278 +#undef INT_FAST32_MIN
4279 +#undef INT_FAST32_MAX
4280 +#undef UINT_FAST32_MAX
4281 +#define INT_FAST32_MIN  LONG_MIN
4282 +#define INT_FAST32_MAX  LONG_MAX
4283 +#define UINT_FAST32_MAX  ULONG_MAX
4284 +
4285 +#undef INT_FAST64_MIN
4286 +#undef INT_FAST64_MAX
4287 +#ifdef GL_INT64_T
4288 +# define INT_FAST64_MIN  INT64_MIN
4289 +# define INT_FAST64_MAX  INT64_MAX
4290 +#endif
4291 +
4292 +#undef UINT_FAST64_MAX
4293 +#ifdef GL_UINT64_T
4294 +# define UINT_FAST64_MAX  UINT64_MAX
4295 +#endif
4296 +
4297 +/* 7.18.2.4. Limits of integer types capable of holding object pointers */
4298 +
4299 +#undef INTPTR_MIN
4300 +#undef INTPTR_MAX
4301 +#undef UINTPTR_MAX
4302 +#define INTPTR_MIN  LONG_MIN
4303 +#define INTPTR_MAX  LONG_MAX
4304 +#define UINTPTR_MAX  ULONG_MAX
4305 +
4306 +/* 7.18.2.5. Limits of greatest-width integer types */
4307 +
4308 +#undef INTMAX_MIN
4309 +#undef INTMAX_MAX
4310 +#ifdef INT64_MAX
4311 +# define INTMAX_MIN  INT64_MIN
4312 +# define INTMAX_MAX  INT64_MAX
4313 +#else
4314 +# define INTMAX_MIN  INT32_MIN
4315 +# define INTMAX_MAX  INT32_MAX
4316 +#endif
4317 +
4318 +#undef UINTMAX_MAX
4319 +#ifdef UINT64_MAX
4320 +# define UINTMAX_MAX  UINT64_MAX
4321 +#else
4322 +# define UINTMAX_MAX  UINT32_MAX
4323 +#endif
4324 +
4325 +/* 7.18.3. Limits of other integer types */
4326 +
4327 +/* ptrdiff_t limits */
4328 +#undef PTRDIFF_MIN
4329 +#undef PTRDIFF_MAX
4330 +#define PTRDIFF_MIN  \
4331 +   _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
4332 +#define PTRDIFF_MAX  \
4333 +   _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
4334 +
4335 +/* sig_atomic_t limits */
4336 +#undef SIG_ATOMIC_MIN
4337 +#undef SIG_ATOMIC_MAX
4338 +#define SIG_ATOMIC_MIN  \
4339 +   _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
4340 +               0@SIG_ATOMIC_T_SUFFIX@)
4341 +#define SIG_ATOMIC_MAX  \
4342 +   _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
4343 +               0@SIG_ATOMIC_T_SUFFIX@)
4344 +
4345 +
4346 +/* size_t limit */
4347 +#undef SIZE_MAX
4348 +#define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
4349 +
4350 +/* wchar_t limits */
4351 +#undef WCHAR_MIN
4352 +#undef WCHAR_MAX
4353 +#define WCHAR_MIN  \
4354 +   _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
4355 +#define WCHAR_MAX  \
4356 +   _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
4357 +
4358 +/* wint_t limits */
4359 +#undef WINT_MIN
4360 +#undef WINT_MAX
4361 +#define WINT_MIN  \
4362 +   _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
4363 +#define WINT_MAX  \
4364 +   _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
4365 +
4366 +#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
4367 +
4368 +/* 7.18.4. Macros for integer constants */
4369 +
4370 +#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
4371 +
4372 +/* 7.18.4.1. Macros for minimum-width integer constants */
4373 +/* According to ISO C 99 Technical Corrigendum 1 */
4374 +
4375 +/* Here we assume a standard architecture where the hardware integer
4376 +   types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
4377 +
4378 +#undef INT8_C
4379 +#undef UINT8_C
4380 +#define INT8_C(x) x
4381 +#define UINT8_C(x) x
4382 +
4383 +#undef INT16_C
4384 +#undef UINT16_C
4385 +#define INT16_C(x) x
4386 +#define UINT16_C(x) x
4387 +
4388 +#undef INT32_C
4389 +#undef UINT32_C
4390 +#define INT32_C(x) x
4391 +#define UINT32_C(x) x ## U
4392 +
4393 +#undef INT64_C
4394 +#undef UINT64_C
4395 +#if LONG_MAX >> 31 >> 31 == 1
4396 +# define INT64_C(x) x##L
4397 +#elif defined _MSC_VER
4398 +# define INT64_C(x) x##i64
4399 +#elif @HAVE_LONG_LONG_INT@
4400 +# define INT64_C(x) x##LL
4401 +#endif
4402 +#if ULONG_MAX >> 31 >> 31 >> 1 == 1
4403 +# define UINT64_C(x) x##UL
4404 +#elif defined _MSC_VER
4405 +# define UINT64_C(x) x##ui64
4406 +#elif @HAVE_UNSIGNED_LONG_LONG_INT@
4407 +# define UINT64_C(x) x##ULL
4408 +#endif
4409 +
4410 +/* 7.18.4.2. Macros for greatest-width integer constants */
4411 +
4412 +#undef INTMAX_C
4413 +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
4414 +# define INTMAX_C(x)   x##LL
4415 +#elif defined GL_INT64_T
4416 +# define INTMAX_C(x)   INT64_C(x)
4417 +#else
4418 +# define INTMAX_C(x)   x##L
4419 +#endif
4420 +
4421 +#undef UINTMAX_C
4422 +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
4423 +# define UINTMAX_C(x)  x##ULL
4424 +#elif defined GL_UINT64_T
4425 +# define UINTMAX_C(x)  UINT64_C(x)
4426 +#else
4427 +# define UINTMAX_C(x)  x##UL
4428 +#endif
4429 +
4430 +#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
4431 +
4432 +#endif /* _GL_STDINT_H */
4433 +#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
4434 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/stdio.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio.in.h
4435 --- gtk-vnc-0.3.7.dan3/gnulib/lib/stdio.in.h    1970-01-01 01:00:00.000000000 +0100
4436 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio.in.h  2008-10-09 15:24:52.000000000 +0100
4437 @@ -0,0 +1,475 @@
4438 +/* A GNU-like <stdio.h>.
4439 +
4440 +   Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
4441 +
4442 +   This program is free software; you can redistribute it and/or modify
4443 +   it under the terms of the GNU Lesser General Public License as published by
4444 +   the Free Software Foundation; either version 2.1, or (at your option)
4445 +   any later version.
4446 +
4447 +   This program is distributed in the hope that it will be useful,
4448 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
4449 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4450 +   GNU Lesser General Public License for more details.
4451 +
4452 +   You should have received a copy of the GNU Lesser General Public License
4453 +   along with this program; if not, write to the Free Software Foundation,
4454 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
4455 +
4456 +@PRAGMA_SYSTEM_HEADER@
4457 +
4458 +#if defined __need_FILE || defined __need___FILE
4459 +/* Special invocation convention inside glibc header files.  */
4460 +
4461 +#@INCLUDE_NEXT@ @NEXT_STDIO_H@
4462 +
4463 +#else
4464 +/* Normal invocation convention.  */
4465 +
4466 +#ifndef _GL_STDIO_H
4467 +
4468 +/* The include_next requires a split double-inclusion guard.  */
4469 +#@INCLUDE_NEXT@ @NEXT_STDIO_H@
4470 +
4471 +#ifndef _GL_STDIO_H
4472 +#define _GL_STDIO_H
4473 +
4474 +#include <stdarg.h>
4475 +#include <stddef.h>
4476 +
4477 +#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
4478 +  || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
4479 +  || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
4480 +  || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
4481 +/* Get off_t and ssize_t.  */
4482 +# include <sys/types.h>
4483 +#endif
4484 +
4485 +#ifndef __attribute__
4486 +/* This feature is available in gcc versions 2.5 and later.  */
4487 +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
4488 +#  define __attribute__(Spec) /* empty */
4489 +# endif
4490 +/* The __-protected variants of `format' and `printf' attributes
4491 +   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
4492 +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
4493 +#  define __format__ format
4494 +#  define __printf__ printf
4495 +# endif
4496 +#endif
4497 +
4498 +
4499 +/* The definition of GL_LINK_WARNING is copied here.  */
4500 +
4501 +
4502 +#ifdef __cplusplus
4503 +extern "C" {
4504 +#endif
4505 +
4506 +
4507 +#if @GNULIB_FPRINTF_POSIX@
4508 +# if @REPLACE_FPRINTF@
4509 +#  define fprintf rpl_fprintf
4510 +extern int fprintf (FILE *fp, const char *format, ...)
4511 +       __attribute__ ((__format__ (__printf__, 2, 3)));
4512 +# endif
4513 +#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4514 +# define fprintf rpl_fprintf
4515 +extern int fprintf (FILE *fp, const char *format, ...)
4516 +       __attribute__ ((__format__ (__printf__, 2, 3)));
4517 +#elif defined GNULIB_POSIXCHECK
4518 +# undef fprintf
4519 +# define fprintf \
4520 +    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
4521 +                      "use gnulib module fprintf-posix for portable " \
4522 +                      "POSIX compliance"), \
4523 +     fprintf)
4524 +#endif
4525 +
4526 +#if @GNULIB_VFPRINTF_POSIX@
4527 +# if @REPLACE_VFPRINTF@
4528 +#  define vfprintf rpl_vfprintf
4529 +extern int vfprintf (FILE *fp, const char *format, va_list args)
4530 +       __attribute__ ((__format__ (__printf__, 2, 0)));
4531 +# endif
4532 +#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4533 +# define vfprintf rpl_vfprintf
4534 +extern int vfprintf (FILE *fp, const char *format, va_list args)
4535 +       __attribute__ ((__format__ (__printf__, 2, 0)));
4536 +#elif defined GNULIB_POSIXCHECK
4537 +# undef vfprintf
4538 +# define vfprintf(s,f,a) \
4539 +    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
4540 +                      "use gnulib module vfprintf-posix for portable " \
4541 +                      "POSIX compliance"), \
4542 +     vfprintf (s, f, a))
4543 +#endif
4544 +
4545 +#if @GNULIB_PRINTF_POSIX@
4546 +# if @REPLACE_PRINTF@
4547 +/* Don't break __attribute__((format(printf,M,N))).  */
4548 +#  define printf __printf__
4549 +extern int printf (const char *format, ...)
4550 +       __attribute__ ((__format__ (__printf__, 1, 2)));
4551 +# endif
4552 +#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4553 +/* Don't break __attribute__((format(printf,M,N))).  */
4554 +# define printf __printf__
4555 +extern int printf (const char *format, ...)
4556 +       __attribute__ ((__format__ (__printf__, 1, 2)));
4557 +#elif defined GNULIB_POSIXCHECK
4558 +# undef printf
4559 +# define printf \
4560 +    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
4561 +                      "use gnulib module printf-posix for portable " \
4562 +                      "POSIX compliance"), \
4563 +     printf)
4564 +/* Don't break __attribute__((format(printf,M,N))).  */
4565 +# define format(kind,m,n) format (__##kind##__, m, n)
4566 +# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
4567 +# define ____printf____ __printf__
4568 +# define ____scanf____ __scanf__
4569 +# define ____strftime____ __strftime__
4570 +# define ____strfmon____ __strfmon__
4571 +#endif
4572 +
4573 +#if @GNULIB_VPRINTF_POSIX@
4574 +# if @REPLACE_VPRINTF@
4575 +#  define vprintf rpl_vprintf
4576 +extern int vprintf (const char *format, va_list args)
4577 +       __attribute__ ((__format__ (__printf__, 1, 0)));
4578 +# endif
4579 +#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4580 +# define vprintf rpl_vprintf
4581 +extern int vprintf (const char *format, va_list args)
4582 +       __attribute__ ((__format__ (__printf__, 1, 0)));
4583 +#elif defined GNULIB_POSIXCHECK
4584 +# undef vprintf
4585 +# define vprintf(f,a) \
4586 +    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
4587 +                      "use gnulib module vprintf-posix for portable " \
4588 +                      "POSIX compliance"), \
4589 +     vprintf (f, a))
4590 +#endif
4591 +
4592 +#if @GNULIB_SNPRINTF@
4593 +# if @REPLACE_SNPRINTF@
4594 +#  define snprintf rpl_snprintf
4595 +# endif
4596 +# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
4597 +extern int snprintf (char *str, size_t size, const char *format, ...)
4598 +       __attribute__ ((__format__ (__printf__, 3, 4)));
4599 +# endif
4600 +#elif defined GNULIB_POSIXCHECK
4601 +# undef snprintf
4602 +# define snprintf \
4603 +    (GL_LINK_WARNING ("snprintf is unportable - " \
4604 +                      "use gnulib module snprintf for portability"), \
4605 +     snprintf)
4606 +#endif
4607 +
4608 +#if @GNULIB_VSNPRINTF@
4609 +# if @REPLACE_VSNPRINTF@
4610 +#  define vsnprintf rpl_vsnprintf
4611 +# endif
4612 +# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
4613 +extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
4614 +       __attribute__ ((__format__ (__printf__, 3, 0)));
4615 +# endif
4616 +#elif defined GNULIB_POSIXCHECK
4617 +# undef vsnprintf
4618 +# define vsnprintf(b,s,f,a) \
4619 +    (GL_LINK_WARNING ("vsnprintf is unportable - " \
4620 +                      "use gnulib module vsnprintf for portability"), \
4621 +     vsnprintf (b, s, f, a))
4622 +#endif
4623 +
4624 +#if @GNULIB_SPRINTF_POSIX@
4625 +# if @REPLACE_SPRINTF@
4626 +#  define sprintf rpl_sprintf
4627 +extern int sprintf (char *str, const char *format, ...)
4628 +       __attribute__ ((__format__ (__printf__, 2, 3)));
4629 +# endif
4630 +#elif defined GNULIB_POSIXCHECK
4631 +# undef sprintf
4632 +# define sprintf \
4633 +    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
4634 +                      "use gnulib module sprintf-posix for portable " \
4635 +                      "POSIX compliance"), \
4636 +     sprintf)
4637 +#endif
4638 +
4639 +#if @GNULIB_VSPRINTF_POSIX@
4640 +# if @REPLACE_VSPRINTF@
4641 +#  define vsprintf rpl_vsprintf
4642 +extern int vsprintf (char *str, const char *format, va_list args)
4643 +       __attribute__ ((__format__ (__printf__, 2, 0)));
4644 +# endif
4645 +#elif defined GNULIB_POSIXCHECK
4646 +# undef vsprintf
4647 +# define vsprintf(b,f,a) \
4648 +    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
4649 +                      "use gnulib module vsprintf-posix for portable " \
4650 +                      "POSIX compliance"), \
4651 +     vsprintf (b, f, a))
4652 +#endif
4653 +
4654 +#if @GNULIB_VASPRINTF@
4655 +# if @REPLACE_VASPRINTF@
4656 +#  define asprintf rpl_asprintf
4657 +#  define vasprintf rpl_vasprintf
4658 +# endif
4659 +# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
4660 +  /* Write formatted output to a string dynamically allocated with malloc().
4661 +     If the memory allocation succeeds, store the address of the string in
4662 +     *RESULT and return the number of resulting bytes, excluding the trailing
4663 +     NUL.  Upon memory allocation error, or some other error, return -1.  */
4664 +  extern int asprintf (char **result, const char *format, ...)
4665 +    __attribute__ ((__format__ (__printf__, 2, 3)));
4666 +  extern int vasprintf (char **result, const char *format, va_list args)
4667 +    __attribute__ ((__format__ (__printf__, 2, 0)));
4668 +# endif
4669 +#endif
4670 +
4671 +#if @GNULIB_OBSTACK_PRINTF@
4672 +# if @REPLACE_OBSTACK_PRINTF@
4673 +#  define obstack_printf rpl_osbtack_printf
4674 +#  define obstack_vprintf rpl_obstack_vprintf
4675 +# endif
4676 +# if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
4677 +  struct obstack;
4678 +  /* Grow an obstack with formatted output.  Return the number of
4679 +     bytes added to OBS.  No trailing nul byte is added, and the
4680 +     object should be closed with obstack_finish before use.  Upon
4681 +     memory allocation error, call obstack_alloc_failed_handler.  Upon
4682 +     other error, return -1.  */
4683 +  extern int obstack_printf (struct obstack *obs, const char *format, ...)
4684 +    __attribute__ ((__format__ (__printf__, 2, 3)));
4685 +  extern int obstack_vprintf (struct obstack *obs, const char *format,
4686 +                             va_list args)
4687 +    __attribute__ ((__format__ (__printf__, 2, 0)));
4688 +# endif
4689 +#endif
4690 +
4691 +#if @GNULIB_FOPEN@
4692 +# if @REPLACE_FOPEN@
4693 +#  undef fopen
4694 +#  define fopen rpl_fopen
4695 +extern FILE * fopen (const char *filename, const char *mode);
4696 +# endif
4697 +#elif defined GNULIB_POSIXCHECK
4698 +# undef fopen
4699 +# define fopen(f,m) \
4700 +   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
4701 +                     "use gnulib module fopen for portability"), \
4702 +    fopen (f, m))
4703 +#endif
4704 +
4705 +#if @GNULIB_FREOPEN@
4706 +# if @REPLACE_FREOPEN@
4707 +#  undef freopen
4708 +#  define freopen rpl_freopen
4709 +extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
4710 +# endif
4711 +#elif defined GNULIB_POSIXCHECK
4712 +# undef freopen
4713 +# define freopen(f,m,s) \
4714 +   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
4715 +                     "use gnulib module freopen for portability"), \
4716 +    freopen (f, m, s))
4717 +#endif
4718 +
4719 +#if @GNULIB_FSEEKO@
4720 +# if @REPLACE_FSEEKO@
4721 +/* Provide fseek, fseeko functions that are aware of a preceding
4722 +   fflush(), and which detect pipes.  */
4723 +#  define fseeko rpl_fseeko
4724 +extern int fseeko (FILE *fp, off_t offset, int whence);
4725 +#  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
4726 +# endif
4727 +#elif defined GNULIB_POSIXCHECK
4728 +# undef fseeko
4729 +# define fseeko(f,o,w) \
4730 +   (GL_LINK_WARNING ("fseeko is unportable - " \
4731 +                     "use gnulib module fseeko for portability"), \
4732 +    fseeko (f, o, w))
4733 +#endif
4734 +
4735 +#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
4736 +extern int rpl_fseek (FILE *fp, long offset, int whence);
4737 +# undef fseek
4738 +# if defined GNULIB_POSIXCHECK
4739 +#  define fseek(f,o,w) \
4740 +     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
4741 +                       "on 32-bit platforms - " \
4742 +                       "use fseeko function for handling of large files"), \
4743 +      rpl_fseek (f, o, w))
4744 +# else
4745 +#  define fseek rpl_fseek
4746 +# endif
4747 +#elif defined GNULIB_POSIXCHECK
4748 +# ifndef fseek
4749 +#  define fseek(f,o,w) \
4750 +     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
4751 +                       "on 32-bit platforms - " \
4752 +                       "use fseeko function for handling of large files"), \
4753 +      fseek (f, o, w))
4754 +# endif
4755 +#endif
4756 +
4757 +#if @GNULIB_FTELLO@
4758 +# if @REPLACE_FTELLO@
4759 +#  define ftello rpl_ftello
4760 +extern off_t ftello (FILE *fp);
4761 +#  define ftell(fp) ftello (fp)
4762 +# endif
4763 +#elif defined GNULIB_POSIXCHECK
4764 +# undef ftello
4765 +# define ftello(f) \
4766 +   (GL_LINK_WARNING ("ftello is unportable - " \
4767 +                     "use gnulib module ftello for portability"), \
4768 +    ftello (f))
4769 +#endif
4770 +
4771 +#if @GNULIB_FTELL@ && @REPLACE_FTELL@
4772 +extern long rpl_ftell (FILE *fp);
4773 +# undef ftell
4774 +# if GNULIB_POSIXCHECK
4775 +#  define ftell(f) \
4776 +     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
4777 +                       "on 32-bit platforms - " \
4778 +                       "use ftello function for handling of large files"), \
4779 +      rpl_ftell (f))
4780 +# else
4781 +#  define ftell rpl_ftell
4782 +# endif
4783 +#elif defined GNULIB_POSIXCHECK
4784 +# ifndef ftell
4785 +#  define ftell(f) \
4786 +     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
4787 +                       "on 32-bit platforms - " \
4788 +                       "use ftello function for handling of large files"), \
4789 +      ftell (f))
4790 +# endif
4791 +#endif
4792 +
4793 +#if @GNULIB_FFLUSH@
4794 +# if @REPLACE_FFLUSH@
4795 +#  define fflush rpl_fflush
4796 +  /* Flush all pending data on STREAM according to POSIX rules.  Both
4797 +     output and seekable input streams are supported.
4798 +     Note! LOSS OF DATA can occur if fflush is applied on an input stream
4799 +     that is _not_seekable_ or on an update stream that is _not_seekable_
4800 +     and in which the most recent operation was input.  Seekability can
4801 +     be tested with lseek(fileno(fp),0,SEEK_CUR).  */
4802 +  extern int fflush (FILE *gl_stream);
4803 +# endif
4804 +#elif defined GNULIB_POSIXCHECK
4805 +# undef fflush
4806 +# define fflush(f) \
4807 +   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
4808 +                     "use gnulib module fflush for portable " \
4809 +                     "POSIX compliance"), \
4810 +    fflush (f))
4811 +#endif
4812 +
4813 +#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4814 +# undef fputc
4815 +# define fputc rpl_fputc
4816 +extern int fputc (int c, FILE *stream);
4817 +#endif
4818 +
4819 +#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4820 +# undef putc
4821 +# define putc rpl_fputc
4822 +extern int putc (int c, FILE *stream);
4823 +#endif
4824 +
4825 +#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4826 +# undef putchar
4827 +# define putchar rpl_putchar
4828 +extern int putchar (int c);
4829 +#endif
4830 +
4831 +#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4832 +# undef fputs
4833 +# define fputs rpl_fputs
4834 +extern int fputs (const char *string, FILE *stream);
4835 +#endif
4836 +
4837 +#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4838 +# undef puts
4839 +# define puts rpl_puts
4840 +extern int puts (const char *string);
4841 +#endif
4842 +
4843 +#if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4844 +# undef fwrite
4845 +# define fwrite rpl_fwrite
4846 +extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
4847 +#endif
4848 +
4849 +#if @GNULIB_GETDELIM@
4850 +# if !@HAVE_DECL_GETDELIM@
4851 +/* Read input, up to (and including) the next occurrence of DELIMITER, from
4852 +   STREAM, store it in *LINEPTR (and NUL-terminate it).
4853 +   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
4854 +   bytes of space.  It is realloc'd as necessary.
4855 +   Return the number of bytes read and stored at *LINEPTR (not including the
4856 +   NUL terminator), or -1 on error or EOF.  */
4857 +extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
4858 +                        FILE *stream);
4859 +# endif
4860 +#elif defined GNULIB_POSIXCHECK
4861 +# undef getdelim
4862 +# define getdelim(l, s, d, f)                                      \
4863 +  (GL_LINK_WARNING ("getdelim is unportable - "                            \
4864 +                   "use gnulib module getdelim for portability"),  \
4865 +   getdelim (l, s, d, f))
4866 +#endif
4867 +
4868 +#if @GNULIB_GETLINE@
4869 +# if @REPLACE_GETLINE@
4870 +#  undef getline
4871 +#  define getline rpl_getline
4872 +# endif
4873 +# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
4874 +/* Read a line, up to (and including) the next newline, from STREAM, store it
4875 +   in *LINEPTR (and NUL-terminate it).
4876 +   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
4877 +   bytes of space.  It is realloc'd as necessary.
4878 +   Return the number of bytes read and stored at *LINEPTR (not including the
4879 +   NUL terminator), or -1 on error or EOF.  */
4880 +extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
4881 +# endif
4882 +#elif defined GNULIB_POSIXCHECK
4883 +# undef getline
4884 +# define getline(l, s, f)                                              \
4885 +  (GL_LINK_WARNING ("getline is unportable - "                         \
4886 +                   "use gnulib module getline for portability"),       \
4887 +   getline (l, s, f))
4888 +#endif
4889 +
4890 +#if @GNULIB_PERROR@
4891 +# if @REPLACE_PERROR@
4892 +#  define perror rpl_perror
4893 +/* Print a message to standard error, describing the value of ERRNO,
4894 +   (if STRING is not NULL and not empty) prefixed with STRING and ": ",
4895 +   and terminated with a newline.  */
4896 +extern void perror (const char *string);
4897 +# endif
4898 +#elif defined GNULIB_POSIXCHECK
4899 +# undef perror
4900 +# define perror(s) \
4901 +    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
4902 +                      "use gnulib module perror for portability"), \
4903 +     perror (s))
4904 +#endif
4905 +
4906 +#ifdef __cplusplus
4907 +}
4908 +#endif
4909 +
4910 +#endif /* _GL_STDIO_H */
4911 +#endif /* _GL_STDIO_H */
4912 +#endif
4913 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/stdio-write.c gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio-write.c
4914 --- gtk-vnc-0.3.7.dan3/gnulib/lib/stdio-write.c 1970-01-01 01:00:00.000000000 +0100
4915 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio-write.c       2008-10-09 15:24:52.000000000 +0100
4916 @@ -0,0 +1,148 @@
4917 +/* POSIX compatible FILE stream write function.
4918 +   Copyright (C) 2008 Free Software Foundation, Inc.
4919 +   Written by Bruno Haible <bruno@clisp.org>, 2008.
4920 +
4921 +   This program is free software: you can redistribute it and/or modify
4922 +   it under the terms of the GNU Lesser General Public License as published by
4923 +   the Free Software Foundation; either version 2.1 of the License, or
4924 +   (at your option) any later version.
4925 +
4926 +   This program is distributed in the hope that it will be useful,
4927 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
4928 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4929 +   GNU Lesser General Public License for more details.
4930 +
4931 +   You should have received a copy of the GNU Lesser General Public License
4932 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
4933 +
4934 +#include <config.h>
4935 +
4936 +/* Specification.  */
4937 +#include <stdio.h>
4938 +
4939 +/* Replace these functions only if module 'sigpipe' is requested.  */
4940 +#if GNULIB_SIGPIPE
4941 +
4942 +/* On native Windows platforms, SIGPIPE does not exist.  When write() is
4943 +   called on a pipe with no readers, WriteFile() fails with error
4944 +   GetLastError() = ERROR_NO_DATA, and write() in consequence fails with
4945 +   error EINVAL.  This write() function is at the basis of the function
4946 +   which flushes the buffer of a FILE stream.  */
4947 +
4948 +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
4949 +
4950 +#  include <errno.h>
4951 +#  include <signal.h>
4952 +#  include <io.h>
4953 +
4954 +#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
4955 +#  include <windows.h>
4956 +
4957 +#  define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
4958 +  if (ferror (stream))                                                       \
4959 +    return (EXPRESSION);                                                     \
4960 +  else                                                                       \
4961 +    {                                                                        \
4962 +      RETTYPE ret;                                                           \
4963 +      SetLastError (0);                                                              \
4964 +      ret = (EXPRESSION);                                                    \
4965 +      if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream))      \
4966 +       {                                                                     \
4967 +         int fd = fileno (stream);                                           \
4968 +         if (fd >= 0                                                         \
4969 +             && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
4970 +           {                                                                 \
4971 +             /* Try to raise signal SIGPIPE.  */                             \
4972 +             raise (SIGPIPE);                                                \
4973 +             /* If it is currently blocked or ignored, change errno from     \
4974 +                EINVAL to EPIPE.  */                                         \
4975 +             errno = EPIPE;                                                  \
4976 +           }                                                                 \
4977 +       }                                                                     \
4978 +      return ret;                                                            \
4979 +    }
4980 +
4981 +#  if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */
4982 +int
4983 +printf (const char *format, ...)
4984 +{
4985 +  int retval;
4986 +  va_list args;
4987 +
4988 +  va_start (args, format);
4989 +  retval = vfprintf (stdout, format, args);
4990 +  va_end (args);
4991 +
4992 +  return retval;
4993 +}
4994 +#  endif
4995 +
4996 +#  if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */
4997 +int
4998 +fprintf (FILE *stream, const char *format, ...)
4999 +{
5000 +  int retval;
5001 +  va_list args;
5002 +
5003 +  va_start (args, format);
5004 +  retval = vfprintf (stream, format, args);
5005 +  va_end (args);
5006 +
5007 +  return retval;
5008 +}
5009 +#  endif
5010 +
5011 +#  if !REPLACE_VFPRINTF_POSIX /* avoid collision with vprintf.c */
5012 +int
5013 +vprintf (const char *format, va_list args)
5014 +{
5015 +  return vfprintf (stdout, format, args);
5016 +}
5017 +#  endif
5018 +
5019 +#  if !REPLACE_VPRINTF_POSIX /* avoid collision with vfprintf.c */
5020 +int
5021 +vfprintf (FILE *stream, const char *format, va_list args)
5022 +#undef vfprintf
5023 +{
5024 +  CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF)
5025 +}
5026 +#  endif
5027 +
5028 +int
5029 +putchar (int c)
5030 +{
5031 +  return fputc (c, stdout);
5032 +}
5033 +
5034 +int
5035 +fputc (int c, FILE *stream)
5036 +#undef fputc
5037 +{
5038 +  CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF)
5039 +}
5040 +
5041 +int
5042 +fputs (const char *string, FILE *stream)
5043 +#undef fputs
5044 +{
5045 +  CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF)
5046 +}
5047 +
5048 +int
5049 +puts (const char *string)
5050 +#undef puts
5051 +{
5052 +  FILE *stream = stdout;
5053 +  CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF)
5054 +}
5055 +
5056 +size_t
5057 +fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
5058 +#undef fwrite
5059 +{
5060 +  CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n)
5061 +}
5062 +
5063 +# endif
5064 +#endif
5065 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/stdlib.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/stdlib.in.h
5066 --- gtk-vnc-0.3.7.dan3/gnulib/lib/stdlib.in.h   1970-01-01 01:00:00.000000000 +0100
5067 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdlib.in.h 2008-10-09 15:24:52.000000000 +0100
5068 @@ -0,0 +1,242 @@
5069 +/* A GNU-like <stdlib.h>.
5070 +
5071 +   Copyright (C) 1995, 2001-2004, 2006-2008 Free Software Foundation, Inc.
5072 +
5073 +   This program is free software: you can redistribute it and/or modify
5074 +   it under the terms of the GNU Lesser General Public License as published by
5075 +   the Free Software Foundation; either version 2.1 of the License, or
5076 +   (at your option) any later version.
5077 +
5078 +   This program is distributed in the hope that it will be useful,
5079 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
5080 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5081 +   GNU Lesser General Public License for more details.
5082 +
5083 +   You should have received a copy of the GNU Lesser General Public License
5084 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
5085 +
5086 +@PRAGMA_SYSTEM_HEADER@
5087 +
5088 +#if defined __need_malloc_and_calloc
5089 +/* Special invocation convention inside glibc header files.  */
5090 +
5091 +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
5092 +
5093 +#else
5094 +/* Normal invocation convention.  */
5095 +
5096 +#ifndef _GL_STDLIB_H
5097 +
5098 +/* The include_next requires a split double-inclusion guard.  */
5099 +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
5100 +
5101 +#ifndef _GL_STDLIB_H
5102 +#define _GL_STDLIB_H
5103 +
5104 +
5105 +/* The definition of GL_LINK_WARNING is copied here.  */
5106 +
5107 +
5108 +/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
5109 +#ifndef EXIT_SUCCESS
5110 +# define EXIT_SUCCESS 0
5111 +#endif
5112 +/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
5113 +   with proper operation of xargs.  */
5114 +#ifndef EXIT_FAILURE
5115 +# define EXIT_FAILURE 1
5116 +#elif EXIT_FAILURE != 1
5117 +# undef EXIT_FAILURE
5118 +# define EXIT_FAILURE 1
5119 +#endif
5120 +
5121 +
5122 +#ifdef __cplusplus
5123 +extern "C" {
5124 +#endif
5125 +
5126 +
5127 +#if @GNULIB_MALLOC_POSIX@
5128 +# if !@HAVE_MALLOC_POSIX@
5129 +#  undef malloc
5130 +#  define malloc rpl_malloc
5131 +extern void * malloc (size_t size);
5132 +# endif
5133 +#elif defined GNULIB_POSIXCHECK
5134 +# undef malloc
5135 +# define malloc(s) \
5136 +    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
5137 +                      "use gnulib module malloc-posix for portability"), \
5138 +     malloc (s))
5139 +#endif
5140 +
5141 +
5142 +#if @GNULIB_REALLOC_POSIX@
5143 +# if !@HAVE_REALLOC_POSIX@
5144 +#  undef realloc
5145 +#  define realloc rpl_realloc
5146 +extern void * realloc (void *ptr, size_t size);
5147 +# endif
5148 +#elif defined GNULIB_POSIXCHECK
5149 +# undef realloc
5150 +# define realloc(p,s) \
5151 +    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
5152 +                      "use gnulib module realloc-posix for portability"), \
5153 +     realloc (p, s))
5154 +#endif
5155 +
5156 +
5157 +#if @GNULIB_CALLOC_POSIX@
5158 +# if !@HAVE_CALLOC_POSIX@
5159 +#  undef calloc
5160 +#  define calloc rpl_calloc
5161 +extern void * calloc (size_t nmemb, size_t size);
5162 +# endif
5163 +#elif defined GNULIB_POSIXCHECK
5164 +# undef calloc
5165 +# define calloc(n,s) \
5166 +    (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
5167 +                      "use gnulib module calloc-posix for portability"), \
5168 +     calloc (n, s))
5169 +#endif
5170 +
5171 +
5172 +#if @GNULIB_GETSUBOPT@
5173 +/* Assuming *OPTIONP is a comma separated list of elements of the form
5174 +   "token" or "token=value", getsubopt parses the first of these elements.
5175 +   If the first element refers to a "token" that is member of the given
5176 +   NULL-terminated array of tokens:
5177 +     - It replaces the comma with a NUL byte, updates *OPTIONP to point past
5178 +       the first option and the comma, sets *VALUEP to the value of the
5179 +       element (or NULL if it doesn't contain an "=" sign),
5180 +     - It returns the index of the "token" in the given array of tokens.
5181 +   Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
5182 +   For more details see the POSIX:2001 specification.
5183 +   http://www.opengroup.org/susv3xsh/getsubopt.html */
5184 +# if !@HAVE_GETSUBOPT@
5185 +extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
5186 +# endif
5187 +#elif defined GNULIB_POSIXCHECK
5188 +# undef getsubopt
5189 +# define getsubopt(o,t,v) \
5190 +    (GL_LINK_WARNING ("getsubopt is unportable - " \
5191 +                      "use gnulib module getsubopt for portability"), \
5192 +     getsubopt (o, t, v))
5193 +#endif
5194 +
5195 +
5196 +#if @GNULIB_MKDTEMP@
5197 +# if !@HAVE_MKDTEMP@
5198 +/* Create a unique temporary directory from TEMPLATE.
5199 +   The last six characters of TEMPLATE must be "XXXXXX";
5200 +   they are replaced with a string that makes the directory name unique.
5201 +   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
5202 +   The directory is created mode 700.  */
5203 +extern char * mkdtemp (char * /*template*/);
5204 +# endif
5205 +#elif defined GNULIB_POSIXCHECK
5206 +# undef mkdtemp
5207 +# define mkdtemp(t) \
5208 +    (GL_LINK_WARNING ("mkdtemp is unportable - " \
5209 +                      "use gnulib module mkdtemp for portability"), \
5210 +     mkdtemp (t))
5211 +#endif
5212 +
5213 +
5214 +#if @GNULIB_MKSTEMP@
5215 +# if @REPLACE_MKSTEMP@
5216 +/* Create a unique temporary file from TEMPLATE.
5217 +   The last six characters of TEMPLATE must be "XXXXXX";
5218 +   they are replaced with a string that makes the file name unique.
5219 +   The file is then created, ensuring it didn't exist before.
5220 +   The file is created read-write (mask at least 0600 & ~umask), but it may be
5221 +   world-readable and world-writable (mask 0666 & ~umask), depending on the
5222 +   implementation.
5223 +   Returns the open file descriptor if successful, otherwise -1 and errno
5224 +   set.  */
5225 +#  define mkstemp rpl_mkstemp
5226 +extern int mkstemp (char * /*template*/);
5227 +# else
5228 +/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
5229 +#  include <unistd.h>
5230 +# endif
5231 +#elif defined GNULIB_POSIXCHECK
5232 +# undef mkstemp
5233 +# define mkstemp(t) \
5234 +    (GL_LINK_WARNING ("mkstemp is unportable - " \
5235 +                      "use gnulib module mkstemp for portability"), \
5236 +     mkstemp (t))
5237 +#endif
5238 +
5239 +
5240 +#if @GNULIB_PUTENV@
5241 +# if @REPLACE_PUTENV@
5242 +#  undef putenv
5243 +#  define putenv rpl_putenv
5244 +extern int putenv (char *string);
5245 +# endif
5246 +#endif
5247 +
5248 +
5249 +#if @GNULIB_RPMATCH@
5250 +# if !@HAVE_RPMATCH@
5251 +/* Test a user response to a question.
5252 +   Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
5253 +extern int rpmatch (const char *response);
5254 +# endif
5255 +#elif defined GNULIB_POSIXCHECK
5256 +# undef rpmatch
5257 +# define rpmatch(r) \
5258 +    (GL_LINK_WARNING ("rpmatch is unportable - " \
5259 +                      "use gnulib module rpmatch for portability"), \
5260 +     rpmatch (r))
5261 +#endif
5262 +
5263 +
5264 +#if @GNULIB_SETENV@
5265 +# if !@HAVE_SETENV@
5266 +/* Set NAME to VALUE in the environment.
5267 +   If REPLACE is nonzero, overwrite an existing value.  */
5268 +extern int setenv (const char *name, const char *value, int replace);
5269 +# endif
5270 +#endif
5271 +
5272 +
5273 +#if @GNULIB_UNSETENV@
5274 +# if @HAVE_UNSETENV@
5275 +#  if @VOID_UNSETENV@
5276 +/* On some systems, unsetenv() returns void.
5277 +   This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4.  */
5278 +#   define unsetenv(name) ((unsetenv)(name), 0)
5279 +#  endif
5280 +# else
5281 +/* Remove the variable NAME from the environment.  */
5282 +extern int unsetenv (const char *name);
5283 +# endif
5284 +#endif
5285 +
5286 +
5287 +#if @GNULIB_STRTOD@
5288 +# if @REPLACE_STRTOD@
5289 +#  define strtod rpl_strtod
5290 +# endif
5291 +# if !@HAVE_STRTOD@ || @REPLACE_STRTOD@
5292 + /* Parse a double from STRING, updating ENDP if appropriate.  */
5293 +extern double strtod (const char *str, char **endp);
5294 +# endif
5295 +#elif defined GNULIB_POSIXCHECK
5296 +# undef strtod
5297 +# define strtod(s, e)                           \
5298 +    (GL_LINK_WARNING ("strtod is unportable - " \
5299 +                      "use gnulib module strtod for portability"), \
5300 +     strtod (s, e))
5301 +#endif
5302 +
5303 +
5304 +#ifdef __cplusplus
5305 +}
5306 +#endif
5307 +
5308 +#endif /* _GL_STDLIB_H */
5309 +#endif /* _GL_STDLIB_H */
5310 +#endif
5311 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/sys_socket.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/sys_socket.in.h
5312 --- gtk-vnc-0.3.7.dan3/gnulib/lib/sys_socket.in.h       1970-01-01 01:00:00.000000000 +0100
5313 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/sys_socket.in.h     2008-10-09 15:24:52.000000000 +0100
5314 @@ -0,0 +1,386 @@
5315 +/* Provide a sys/socket header file for systems lacking it (read: MinGW)
5316 +   and for systems where it is incomplete.
5317 +   Copyright (C) 2005-2008 Free Software Foundation, Inc.
5318 +   Written by Simon Josefsson.
5319 +
5320 +   This program is free software; you can redistribute it and/or modify
5321 +   it under the terms of the GNU Lesser General Public License as published by
5322 +   the Free Software Foundation; either version 2.1, or (at your option)
5323 +   any later version.
5324 +
5325 +   This program is distributed in the hope that it will be useful,
5326 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
5327 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5328 +   GNU Lesser General Public License for more details.
5329 +
5330 +   You should have received a copy of the GNU Lesser General Public License
5331 +   along with this program; if not, write to the Free Software Foundation,
5332 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
5333 +
5334 +/* This file is supposed to be used on platforms that lack <sys/socket.h>,
5335 +   on platforms where <sys/socket.h> cannot be included standalone, and on
5336 +   platforms where <sys/socket.h> does not provide all necessary definitions.
5337 +   It is intended to provide definitions and prototypes needed by an
5338 +   application.  */
5339 +
5340 +#ifndef _GL_SYS_SOCKET_H
5341 +
5342 +#if @HAVE_SYS_SOCKET_H@
5343 +
5344 +@PRAGMA_SYSTEM_HEADER@
5345 +
5346 +/* On many platforms, <sys/socket.h> assumes prior inclusion of
5347 +   <sys/types.h>.  */
5348 +# include <sys/types.h>
5349 +
5350 +/* The include_next requires a split double-inclusion guard.  */
5351 +# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
5352 +
5353 +#endif
5354 +
5355 +#ifndef _GL_SYS_SOCKET_H
5356 +#define _GL_SYS_SOCKET_H
5357 +
5358 +#if @HAVE_SYS_SOCKET_H@
5359 +
5360 +/* A platform that has <sys/socket.h>.  */
5361 +
5362 +/* For shutdown().  */
5363 +# if !defined SHUT_RD
5364 +#  define SHUT_RD 0
5365 +# endif
5366 +# if !defined SHUT_WR
5367 +#  define SHUT_WR 1
5368 +# endif
5369 +# if !defined SHUT_RDWR
5370 +#  define SHUT_RDWR 2
5371 +# endif
5372 +
5373 +#else
5374 +
5375 +# ifdef __CYGWIN__
5376 +#  error "Cygwin does have a sys/socket.h, doesn't it?!?"
5377 +# endif
5378 +
5379 +/* A platform that lacks <sys/socket.h>.
5380 +
5381 +   Currently only MinGW is supported.  See the gnulib manual regarding
5382 +   Windows sockets.  MinGW has the header files winsock2.h and
5383 +   ws2tcpip.h that declare the sys/socket.h definitions we need.  Note
5384 +   that you can influence which definitions you get by setting the
5385 +   WINVER symbol before including these two files.  For example,
5386 +   getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
5387 +   symbol is set indiriectly through WINVER).  You can set this by
5388 +   adding AC_DEFINE(WINVER, 0x0501) to configure.ac.  Note that your
5389 +   code may not run on older Windows releases then.  My Windows 2000
5390 +   box was not able to run the code, for example.  The situation is
5391 +   slightly confusing because:
5392 +   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
5393 +   suggests that getaddrinfo should be available on all Windows
5394 +   releases. */
5395 +
5396 +
5397 +# if @HAVE_WINSOCK2_H@
5398 +#  include <winsock2.h>
5399 +# endif
5400 +# if @HAVE_WS2TCPIP_H@
5401 +#  include <ws2tcpip.h>
5402 +# endif
5403 +
5404 +/* For shutdown(). */
5405 +# if !defined SHUT_RD && defined SD_RECEIVE
5406 +#  define SHUT_RD SD_RECEIVE
5407 +# endif
5408 +# if !defined SHUT_WR && defined SD_SEND
5409 +#  define SHUT_WR SD_SEND
5410 +# endif
5411 +# if !defined SHUT_RDWR && defined SD_BOTH
5412 +#  define SHUT_RDWR SD_BOTH
5413 +# endif
5414 +
5415 +/* The definition of GL_LINK_WARNING is copied here.  */
5416 +
5417 +# if @HAVE_WINSOCK2_H@
5418 +/* Include headers needed by the emulation code.  */
5419 +#  include <sys/types.h>
5420 +#  include <io.h>
5421 +
5422 +typedef int socklen_t;
5423 +
5424 +# endif
5425 +
5426 +# ifdef __cplusplus
5427 +extern "C" {
5428 +# endif
5429 +
5430 +# if @HAVE_WINSOCK2_H@
5431 +
5432 +/* Re-define FD_ISSET to avoid a WSA call while we are not using
5433 +   network sockets.  */
5434 +static inline int
5435 +rpl_fd_isset (int fd, fd_set * set)
5436 +{
5437 +  int i;
5438 +  if (set == NULL)
5439 +    return 0;
5440 +
5441 +  for (i = 0; i < set->fd_count; i++)
5442 +    if (set->fd_array[i] == fd)
5443 +      return 1;
5444 +
5445 +  return 0;
5446 +}
5447 +
5448 +#  undef FD_ISSET
5449 +#  define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
5450 +
5451 +# endif
5452 +
5453 +/* Wrap everything else to use libc file descriptors for sockets.  */
5454 +
5455 +# if @HAVE_WINSOCK2_H@
5456 +#  undef close
5457 +#  define close                        rpl_close
5458 +extern int rpl_close(int);
5459 +# endif
5460 +
5461 +# if @GNULIB_SOCKET@
5462 +#  if @HAVE_WINSOCK2_H@
5463 +#   undef socket
5464 +#   define socket              rpl_socket
5465 +extern int rpl_socket (int, int, int protocol);
5466 +#  endif
5467 +# elif @HAVE_WINSOCK2_H@
5468 +#  undef socket
5469 +#  define socket socket_used_without_requesting_gnulib_module_socket
5470 +# elif defined GNULIB_POSIXCHECK
5471 +#  undef socket
5472 +#  define socket(d,t,p) \
5473 +     (GL_LINK_WARNING ("socket is not always POSIX compliant - " \
5474 +                       "use gnulib module socket for portability"), \
5475 +      socket (d, t, p))
5476 +# endif
5477 +
5478 +# if @GNULIB_CONNECT@
5479 +#  if @HAVE_WINSOCK2_H@
5480 +#   undef connect
5481 +#   define connect             rpl_connect
5482 +extern int rpl_connect (int, struct sockaddr *, int);
5483 +#  endif
5484 +# elif @HAVE_WINSOCK2_H@
5485 +#  undef connect
5486 +#  define connect socket_used_without_requesting_gnulib_module_connect
5487 +# elif defined GNULIB_POSIXCHECK
5488 +#  undef connect
5489 +#  define connect(s,a,l) \
5490 +     (GL_LINK_WARNING ("connect is not always POSIX compliant - " \
5491 +                       "use gnulib module connect for portability"), \
5492 +      connect (s, a, l))
5493 +# endif
5494 +
5495 +# if @GNULIB_ACCEPT@
5496 +#  if @HAVE_WINSOCK2_H@
5497 +#   undef accept
5498 +#   define accept              rpl_accept
5499 +extern int rpl_accept (int, struct sockaddr *, int *);
5500 +#  endif
5501 +# elif @HAVE_WINSOCK2_H@
5502 +#  undef accept
5503 +#  define accept accept_used_without_requesting_gnulib_module_accept
5504 +# elif defined GNULIB_POSIXCHECK
5505 +#  undef accept
5506 +#  define accept(s,a,l) \
5507 +     (GL_LINK_WARNING ("accept is not always POSIX compliant - " \
5508 +                       "use gnulib module accept for portability"), \
5509 +      accept (s, a, l))
5510 +# endif
5511 +
5512 +# if @GNULIB_BIND@
5513 +#  if @HAVE_WINSOCK2_H@
5514 +#   undef bind
5515 +#   define bind                        rpl_bind
5516 +extern int rpl_bind (int, struct sockaddr *, int);
5517 +#  endif
5518 +# elif @HAVE_WINSOCK2_H@
5519 +#  undef bind
5520 +#  define bind bind_used_without_requesting_gnulib_module_bind
5521 +# elif defined GNULIB_POSIXCHECK
5522 +#  undef bind
5523 +#  define bind(s,a,l) \
5524 +     (GL_LINK_WARNING ("bind is not always POSIX compliant - " \
5525 +                       "use gnulib module bind for portability"), \
5526 +      bind (s, a, l))
5527 +# endif
5528 +
5529 +# if @GNULIB_GETPEERNAME@
5530 +#  if @HAVE_WINSOCK2_H@
5531 +#   undef getpeername
5532 +#   define getpeername         rpl_getpeername
5533 +extern int rpl_getpeername (int, struct sockaddr *, int *);
5534 +#  endif
5535 +# elif @HAVE_WINSOCK2_H@
5536 +#  undef getpeername
5537 +#  define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
5538 +# elif defined GNULIB_POSIXCHECK
5539 +#  undef getpeername
5540 +#  define getpeername(s,a,l) \
5541 +     (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \
5542 +                       "use gnulib module getpeername for portability"), \
5543 +      getpeername (s, a, l))
5544 +# endif
5545 +
5546 +# if @GNULIB_GETSOCKNAME@
5547 +#  if @HAVE_WINSOCK2_H@
5548 +#   undef getsockname
5549 +#   define getsockname         rpl_getsockname
5550 +extern int rpl_getsockname (int, struct sockaddr *, int *);
5551 +#  endif
5552 +# elif @HAVE_WINSOCK2_H@
5553 +#  undef getsockname
5554 +#  define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
5555 +# elif defined GNULIB_POSIXCHECK
5556 +#  undef getsockname
5557 +#  define getsockname(s,a,l) \
5558 +     (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \
5559 +                       "use gnulib module getsockname for portability"), \
5560 +      getsockname (s, a, l))
5561 +# endif
5562 +
5563 +# if @GNULIB_GETSOCKOPT@
5564 +#  if @HAVE_WINSOCK2_H@
5565 +#   undef getsockopt
5566 +#   define getsockopt          rpl_getsockopt
5567 +extern int rpl_getsockopt (int, int, int, void *, int *);
5568 +#  endif
5569 +# elif @HAVE_WINSOCK2_H@
5570 +#  undef getsockopt
5571 +#  define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
5572 +# elif defined GNULIB_POSIXCHECK
5573 +#  undef getsockopt
5574 +#  define getsockopt(s,lvl,o,v,l) \
5575 +     (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \
5576 +                       "use gnulib module getsockopt for portability"), \
5577 +      getsockopt (s, lvl, o, v, l))
5578 +# endif
5579 +
5580 +# if @GNULIB_LISTEN@
5581 +#  if @HAVE_WINSOCK2_H@
5582 +#   undef listen
5583 +#   define listen              rpl_listen
5584 +extern int rpl_listen (int, int);
5585 +#  endif
5586 +# elif @HAVE_WINSOCK2_H@
5587 +#  undef listen
5588 +#  define listen listen_used_without_requesting_gnulib_module_listen
5589 +# elif defined GNULIB_POSIXCHECK
5590 +#  undef listen
5591 +#  define listen(s,b) \
5592 +     (GL_LINK_WARNING ("listen is not always POSIX compliant - " \
5593 +                       "use gnulib module listen for portability"), \
5594 +      listen (s, b))
5595 +# endif
5596 +
5597 +# if @HAVE_WINSOCK2_H@
5598 +#  undef ioctl
5599 +#  define ioctl                        rpl_ioctl
5600 +extern int rpl_ioctl (int, unsigned long, char *);
5601 +# endif
5602 +
5603 +# if @GNULIB_RECV@
5604 +#  if @HAVE_WINSOCK2_H@
5605 +#   undef recv
5606 +#   define recv                        rpl_recv
5607 +extern int rpl_recv (int, void *, int, int);
5608 +#  endif
5609 +# elif @HAVE_WINSOCK2_H@
5610 +#  undef recv
5611 +#  define recv recv_used_without_requesting_gnulib_module_recv
5612 +# elif defined GNULIB_POSIXCHECK
5613 +#  undef recv
5614 +#  define recv(s,b,n,f) \
5615 +     (GL_LINK_WARNING ("recv is not always POSIX compliant - " \
5616 +                       "use gnulib module recv for portability"), \
5617 +      recv (s, b, n, f))
5618 +# endif
5619 +
5620 +# if @GNULIB_SEND@
5621 +#  if @HAVE_WINSOCK2_H@
5622 +#   undef send
5623 +#   define send                        rpl_send
5624 +extern int rpl_send (int, const void *, int, int);
5625 +#  endif
5626 +# elif @HAVE_WINSOCK2_H@
5627 +#  undef send
5628 +#  define send send_used_without_requesting_gnulib_module_send
5629 +# elif defined GNULIB_POSIXCHECK
5630 +#  undef send
5631 +#  define send(s,b,n,f) \
5632 +     (GL_LINK_WARNING ("send is not always POSIX compliant - " \
5633 +                       "use gnulib module send for portability"), \
5634 +      send (s, b, n, f))
5635 +# endif
5636 +
5637 +# if @GNULIB_RECVFROM@
5638 +#  if @HAVE_WINSOCK2_H@
5639 +#   undef recvfrom
5640 +#   define recvfrom            rpl_recvfrom
5641 +extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *);
5642 +#  endif
5643 +# elif @HAVE_WINSOCK2_H@
5644 +#  undef recvfrom
5645 +#  define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
5646 +# elif defined GNULIB_POSIXCHECK
5647 +#  undef recvfrom
5648 +#  define recvfrom(s,b,n,f,a,l) \
5649 +     (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \
5650 +                       "use gnulib module recvfrom for portability"), \
5651 +      recvfrom (s, b, n, f, a, l))
5652 +# endif
5653 +
5654 +# if @GNULIB_SENDTO@
5655 +#  if @HAVE_WINSOCK2_H@
5656 +#   undef sendto
5657 +#   define sendto              rpl_sendto
5658 +extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int);
5659 +#  endif
5660 +# elif @HAVE_WINSOCK2_H@
5661 +#  undef sendto
5662 +#  define sendto sendto_used_without_requesting_gnulib_module_sendto
5663 +# elif defined GNULIB_POSIXCHECK
5664 +#  undef sendto
5665 +#  define sendto(s,b,n,f,a,l) \
5666 +     (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \
5667 +                       "use gnulib module sendto for portability"), \
5668 +      sendto (s, b, n, f, a, l))
5669 +# endif
5670 +
5671 +# if @GNULIB_SETSOCKOPT@
5672 +#  if @HAVE_WINSOCK2_H@
5673 +#   undef setsockopt
5674 +#   define setsockopt          rpl_setsockopt
5675 +extern int rpl_setsockopt (int, int, int, const void *, int);
5676 +#  endif
5677 +# elif @HAVE_WINSOCK2_H@
5678 +#  undef setsockopt
5679 +#  define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
5680 +# elif defined GNULIB_POSIXCHECK
5681 +#  undef setsockopt
5682 +#  define setsockopt(s,lvl,o,v,l) \
5683 +     (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \
5684 +                       "use gnulib module setsockopt for portability"), \
5685 +      setsockopt (s, lvl, o, v, l))
5686 +# endif
5687 +
5688 +# if @HAVE_WINSOCK2_H@
5689 +#  undef select
5690 +#  define select               select_used_without_including_sys_select_h
5691 +# endif
5692 +
5693 +# ifdef __cplusplus
5694 +}
5695 +# endif
5696 +
5697 +#endif /* HAVE_SYS_SOCKET_H */
5698 +
5699 +#endif /* _GL_SYS_SOCKET_H */
5700 +#endif /* _GL_SYS_SOCKET_H */
5701 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/unistd.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/unistd.in.h
5702 --- gtk-vnc-0.3.7.dan3/gnulib/lib/unistd.in.h   1970-01-01 01:00:00.000000000 +0100
5703 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/unistd.in.h 2008-10-09 15:24:52.000000000 +0100
5704 @@ -0,0 +1,388 @@
5705 +/* Substitute for and wrapper around <unistd.h>.
5706 +   Copyright (C) 2004-2008 Free Software Foundation, Inc.
5707 +
5708 +   This program is free software; you can redistribute it and/or modify
5709 +   it under the terms of the GNU Lesser General Public License as published by
5710 +   the Free Software Foundation; either version 2.1, or (at your option)
5711 +   any later version.
5712 +
5713 +   This program is distributed in the hope that it will be useful,
5714 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
5715 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5716 +   GNU Lesser General Public License for more details.
5717 +
5718 +   You should have received a copy of the GNU Lesser General Public License
5719 +   along with this program; if not, write to the Free Software Foundation,
5720 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
5721 +
5722 +#ifndef _GL_UNISTD_H
5723 +
5724 +@PRAGMA_SYSTEM_HEADER@
5725 +
5726 +/* The include_next requires a split double-inclusion guard.  */
5727 +#if @HAVE_UNISTD_H@
5728 +# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
5729 +#endif
5730 +
5731 +#ifndef _GL_UNISTD_H
5732 +#define _GL_UNISTD_H
5733 +
5734 +/* mingw doesn't define the SEEK_* macros in <unistd.h>.  */
5735 +#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
5736 +# include <stdio.h>
5737 +#endif
5738 +
5739 +/* mingw fails to declare _exit in <unistd.h>.  */
5740 +#include <stdlib.h>
5741 +
5742 +#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
5743 +/* Get ssize_t.  */
5744 +# include <sys/types.h>
5745 +#endif
5746 +
5747 +/* The definition of GL_LINK_WARNING is copied here.  */
5748 +
5749 +
5750 +/* Declare overridden functions.  */
5751 +
5752 +#ifdef __cplusplus
5753 +extern "C" {
5754 +#endif
5755 +
5756 +
5757 +#if @GNULIB_CHOWN@
5758 +# if @REPLACE_CHOWN@
5759 +#  ifndef REPLACE_CHOWN
5760 +#   define REPLACE_CHOWN 1
5761 +#  endif
5762 +#  if REPLACE_CHOWN
5763 +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
5764 +   to GID (if GID is not -1).  Follow symbolic links.
5765 +   Return 0 if successful, otherwise -1 and errno set.
5766 +   See the POSIX:2001 specification
5767 +   <http://www.opengroup.org/susv3xsh/chown.html>.  */
5768 +#   define chown rpl_chown
5769 +extern int chown (const char *file, uid_t uid, gid_t gid);
5770 +#  endif
5771 +# endif
5772 +#elif defined GNULIB_POSIXCHECK
5773 +# undef chown
5774 +# define chown(f,u,g) \
5775 +    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
5776 +                      "doesn't treat a uid or gid of -1 on some systems - " \
5777 +                      "use gnulib module chown for portability"), \
5778 +     chown (f, u, g))
5779 +#endif
5780 +
5781 +
5782 +#if @GNULIB_DUP2@
5783 +# if !@HAVE_DUP2@
5784 +/* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
5785 +   NEWFD = OLDFD, otherwise close NEWFD first if it is open.
5786 +   Return 0 if successful, otherwise -1 and errno set.
5787 +   See the POSIX:2001 specification
5788 +   <http://www.opengroup.org/susv3xsh/dup2.html>.  */
5789 +extern int dup2 (int oldfd, int newfd);
5790 +# endif
5791 +#elif defined GNULIB_POSIXCHECK
5792 +# undef dup2
5793 +# define dup2(o,n) \
5794 +    (GL_LINK_WARNING ("dup2 is unportable - " \
5795 +                      "use gnulib module dup2 for portability"), \
5796 +     dup2 (o, n))
5797 +#endif
5798 +
5799 +
5800 +#if @GNULIB_ENVIRON@
5801 +# if !@HAVE_DECL_ENVIRON@
5802 +/* Set of environment variables and values.  An array of strings of the form
5803 +   "VARIABLE=VALUE", terminated with a NULL.  */
5804 +#  if defined __APPLE__ && defined __MACH__
5805 +#   include <crt_externs.h>
5806 +#   define environ (*_NSGetEnviron ())
5807 +#  else
5808 +extern char **environ;
5809 +#  endif
5810 +# endif
5811 +#elif defined GNULIB_POSIXCHECK
5812 +# undef environ
5813 +# define environ \
5814 +    (GL_LINK_WARNING ("environ is unportable - " \
5815 +                      "use gnulib module environ for portability"), \
5816 +     environ)
5817 +#endif
5818 +
5819 +
5820 +#if @GNULIB_FCHDIR@
5821 +# if @REPLACE_FCHDIR@
5822 +
5823 +/* Change the process' current working directory to the directory on which
5824 +   the given file descriptor is open.
5825 +   Return 0 if successful, otherwise -1 and errno set.
5826 +   See the POSIX:2001 specification
5827 +   <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
5828 +extern int fchdir (int /*fd*/);
5829 +
5830 +#  define close rpl_close
5831 +extern int close (int);
5832 +#  define dup rpl_dup
5833 +extern int dup (int);
5834 +#  define dup2 rpl_dup2
5835 +extern int dup2 (int, int);
5836 +
5837 +# endif
5838 +#elif defined GNULIB_POSIXCHECK
5839 +# undef fchdir
5840 +# define fchdir(f) \
5841 +    (GL_LINK_WARNING ("fchdir is unportable - " \
5842 +                      "use gnulib module fchdir for portability"), \
5843 +     fchdir (f))
5844 +#endif
5845 +
5846 +
5847 +#if @GNULIB_FSYNC@
5848 +/* Synchronize changes to a file.
5849 +   Return 0 if successful, otherwise -1 and errno set.
5850 +   See POSIX:2001 specification
5851 +   <http://www.opengroup.org/susv3xsh/fsync.html>.  */
5852 +# if !@HAVE_FSYNC@
5853 +extern int fsync (int fd);
5854 +# endif
5855 +#elif defined GNULIB_POSIXCHECK
5856 +# undef fsync
5857 +# define fsync(fd) \
5858 +    (GL_LINK_WARNING ("fsync is unportable - " \
5859 +                      "use gnulib module fsync for portability"), \
5860 +     fsync (fd))
5861 +#endif
5862 +
5863 +
5864 +#if @GNULIB_FTRUNCATE@
5865 +# if !@HAVE_FTRUNCATE@
5866 +/* Change the size of the file to which FD is opened to become equal to LENGTH.
5867 +   Return 0 if successful, otherwise -1 and errno set.
5868 +   See the POSIX:2001 specification
5869 +   <http://www.opengroup.org/susv3xsh/ftruncate.html>.  */
5870 +extern int ftruncate (int fd, off_t length);
5871 +# endif
5872 +#elif defined GNULIB_POSIXCHECK
5873 +# undef ftruncate
5874 +# define ftruncate(f,l) \
5875 +    (GL_LINK_WARNING ("ftruncate is unportable - " \
5876 +                      "use gnulib module ftruncate for portability"), \
5877 +     ftruncate (f, l))
5878 +#endif
5879 +
5880 +
5881 +#if @GNULIB_GETCWD@
5882 +/* Include the headers that might declare getcwd so that they will not
5883 +   cause confusion if included after this file.  */
5884 +# include <stdlib.h>
5885 +# if @REPLACE_GETCWD@
5886 +/* Get the name of the current working directory, and put it in SIZE bytes
5887 +   of BUF.
5888 +   Return BUF if successful, or NULL if the directory couldn't be determined
5889 +   or SIZE was too small.
5890 +   See the POSIX:2001 specification
5891 +   <http://www.opengroup.org/susv3xsh/getcwd.html>.
5892 +   Additionally, the gnulib module 'getcwd' guarantees the following GNU
5893 +   extension: If BUF is NULL, an array is allocated with 'malloc'; the array
5894 +   is SIZE bytes long, unless SIZE == 0, in which case it is as big as
5895 +   necessary.  */
5896 +#  define getcwd rpl_getcwd
5897 +extern char * getcwd (char *buf, size_t size);
5898 +# endif
5899 +#elif defined GNULIB_POSIXCHECK
5900 +# undef getcwd
5901 +# define getcwd(b,s) \
5902 +    (GL_LINK_WARNING ("getcwd is unportable - " \
5903 +                      "use gnulib module getcwd for portability"), \
5904 +     getcwd (b, s))
5905 +#endif
5906 +
5907 +
5908 +#if @GNULIB_GETDTABLESIZE@
5909 +# if !@HAVE_GETDTABLESIZE@
5910 +/* Return the maximum number of file descriptors in the current process.  */
5911 +extern int getdtablesize (void);
5912 +# endif
5913 +#elif defined GNULIB_POSIXCHECK
5914 +# undef getdtablesize
5915 +# define getdtablesize() \
5916 +    (GL_LINK_WARNING ("getdtablesize is unportable - " \
5917 +                      "use gnulib module getdtablesize for portability"), \
5918 +     getdtablesize ())
5919 +#endif
5920 +
5921 +
5922 +#if @GNULIB_GETLOGIN_R@
5923 +/* Copies the user's login name to NAME.
5924 +   The array pointed to by NAME has room for SIZE bytes.
5925 +
5926 +   Returns 0 if successful.  Upon error, an error number is returned, or -1 in
5927 +   the case that the login name cannot be found but no specific error is
5928 +   provided (this case is hopefully rare but is left open by the POSIX spec).
5929 +
5930 +   See <http://www.opengroup.org/susv3xsh/getlogin.html>.
5931 + */
5932 +# if !@HAVE_DECL_GETLOGIN_R@
5933 +#  include <stddef.h>
5934 +extern int getlogin_r (char *name, size_t size);
5935 +# endif
5936 +#elif defined GNULIB_POSIXCHECK
5937 +# undef getlogin_r
5938 +# define getlogin_r(n,s) \
5939 +    (GL_LINK_WARNING ("getlogin_r is unportable - " \
5940 +                      "use gnulib module getlogin_r for portability"), \
5941 +     getlogin_r (n, s))
5942 +#endif
5943 +
5944 +
5945 +#if @GNULIB_GETPAGESIZE@
5946 +# if @REPLACE_GETPAGESIZE@
5947 +#  define getpagesize rpl_getpagesize
5948 +extern int getpagesize (void);
5949 +# elif !@HAVE_GETPAGESIZE@
5950 +/* This is for POSIX systems.  */
5951 +#  if !defined getpagesize && defined _SC_PAGESIZE
5952 +#   if ! (defined __VMS && __VMS_VER < 70000000)
5953 +#    define getpagesize() sysconf (_SC_PAGESIZE)
5954 +#   endif
5955 +#  endif
5956 +/* This is for older VMS.  */
5957 +#  if !defined getpagesize && defined __VMS
5958 +#   ifdef __ALPHA
5959 +#    define getpagesize() 8192
5960 +#   else
5961 +#    define getpagesize() 512
5962 +#   endif
5963 +#  endif
5964 +/* This is for BeOS.  */
5965 +#  if !defined getpagesize && @HAVE_OS_H@
5966 +#   include <OS.h>
5967 +#   if defined B_PAGE_SIZE
5968 +#    define getpagesize() B_PAGE_SIZE
5969 +#   endif
5970 +#  endif
5971 +/* This is for AmigaOS4.0.  */
5972 +#  if !defined getpagesize && defined __amigaos4__
5973 +#   define getpagesize() 2048
5974 +#  endif
5975 +/* This is for older Unix systems.  */
5976 +#  if !defined getpagesize && @HAVE_SYS_PARAM_H@
5977 +#   include <sys/param.h>
5978 +#   ifdef EXEC_PAGESIZE
5979 +#    define getpagesize() EXEC_PAGESIZE
5980 +#   else
5981 +#    ifdef NBPG
5982 +#     ifndef CLSIZE
5983 +#      define CLSIZE 1
5984 +#     endif
5985 +#     define getpagesize() (NBPG * CLSIZE)
5986 +#    else
5987 +#     ifdef NBPC
5988 +#      define getpagesize() NBPC
5989 +#     endif
5990 +#    endif
5991 +#   endif
5992 +#  endif
5993 +# endif
5994 +#elif defined GNULIB_POSIXCHECK
5995 +# undef getpagesize
5996 +# define getpagesize() \
5997 +    (GL_LINK_WARNING ("getpagesize is unportable - " \
5998 +                      "use gnulib module getpagesize for portability"), \
5999 +     getpagesize ())
6000 +#endif
6001 +
6002 +
6003 +#if @GNULIB_LCHOWN@
6004 +# if @REPLACE_LCHOWN@
6005 +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
6006 +   to GID (if GID is not -1).  Do not follow symbolic links.
6007 +   Return 0 if successful, otherwise -1 and errno set.
6008 +   See the POSIX:2001 specification
6009 +   <http://www.opengroup.org/susv3xsh/lchown.html>.  */
6010 +#  define lchown rpl_lchown
6011 +extern int lchown (char const *file, uid_t owner, gid_t group);
6012 +# endif
6013 +#elif defined GNULIB_POSIXCHECK
6014 +# undef lchown
6015 +# define lchown(f,u,g) \
6016 +    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
6017 +                      "systems - use gnulib module lchown for portability"), \
6018 +     lchown (f, u, g))
6019 +#endif
6020 +
6021 +
6022 +#if @GNULIB_LSEEK@
6023 +# if @REPLACE_LSEEK@
6024 +/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
6025 +   Return the new offset if successful, otherwise -1 and errno set.
6026 +   See the POSIX:2001 specification
6027 +   <http://www.opengroup.org/susv3xsh/lseek.html>.  */
6028 +#  define lseek rpl_lseek
6029 +   extern off_t lseek (int fd, off_t offset, int whence);
6030 +# endif
6031 +#elif defined GNULIB_POSIXCHECK
6032 +# undef lseek
6033 +# define lseek(f,o,w) \
6034 +    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
6035 +                      "systems - use gnulib module lseek for portability"), \
6036 +     lseek (f, o, w))
6037 +#endif
6038 +
6039 +
6040 +#if @GNULIB_READLINK@
6041 +/* Read the contents of the symbolic link FILE and place the first BUFSIZE
6042 +   bytes of it into BUF.  Return the number of bytes placed into BUF if
6043 +   successful, otherwise -1 and errno set.
6044 +   See the POSIX:2001 specification
6045 +   <http://www.opengroup.org/susv3xsh/readlink.html>.  */
6046 +# if !@HAVE_READLINK@
6047 +#  include <stddef.h>
6048 +extern int readlink (const char *file, char *buf, size_t bufsize);
6049 +# endif
6050 +#elif defined GNULIB_POSIXCHECK
6051 +# undef readlink
6052 +# define readlink(f,b,s) \
6053 +    (GL_LINK_WARNING ("readlink is unportable - " \
6054 +                      "use gnulib module readlink for portability"), \
6055 +     readlink (f, b, s))
6056 +#endif
6057 +
6058 +
6059 +#if @GNULIB_SLEEP@
6060 +/* Pause the execution of the current thread for N seconds.
6061 +   Returns the number of seconds left to sleep.
6062 +   See the POSIX:2001 specification
6063 +   <http://www.opengroup.org/susv3xsh/sleep.html>.  */
6064 +# if !@HAVE_SLEEP@
6065 +extern unsigned int sleep (unsigned int n);
6066 +# endif
6067 +#elif defined GNULIB_POSIXCHECK
6068 +# undef sleep
6069 +# define sleep(n) \
6070 +    (GL_LINK_WARNING ("sleep is unportable - " \
6071 +                      "use gnulib module sleep for portability"), \
6072 +     sleep (n))
6073 +#endif
6074 +
6075 +
6076 +#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
6077 +/* Write up to COUNT bytes starting at BUF to file descriptor FD.
6078 +   See the POSIX:2001 specification
6079 +   <http://www.opengroup.org/susv3xsh/write.html>.  */
6080 +# undef write
6081 +# define write rpl_write
6082 +extern ssize_t write (int fd, const void *buf, size_t count);
6083 +#endif
6084 +
6085 +
6086 +#ifdef __cplusplus
6087 +}
6088 +#endif
6089 +
6090 +
6091 +#endif /* _GL_UNISTD_H */
6092 +#endif /* _GL_UNISTD_H */
6093 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/vasnprintf.c gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.c
6094 --- gtk-vnc-0.3.7.dan3/gnulib/lib/vasnprintf.c  1970-01-01 01:00:00.000000000 +0100
6095 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.c        2008-10-09 15:24:52.000000000 +0100
6096 @@ -0,0 +1,4887 @@
6097 +/* vsprintf with automatic memory allocation.
6098 +   Copyright (C) 1999, 2002-2008 Free Software Foundation, Inc.
6099 +
6100 +   This program is free software; you can redistribute it and/or modify
6101 +   it under the terms of the GNU Lesser General Public License as published by
6102 +   the Free Software Foundation; either version 2.1, or (at your option)
6103 +   any later version.
6104 +
6105 +   This program is distributed in the hope that it will be useful,
6106 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
6107 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6108 +   GNU Lesser General Public License for more details.
6109 +
6110 +   You should have received a copy of the GNU Lesser General Public License along
6111 +   with this program; if not, write to the Free Software Foundation,
6112 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
6113 +
6114 +/* This file can be parametrized with the following macros:
6115 +     VASNPRINTF         The name of the function being defined.
6116 +     FCHAR_T            The element type of the format string.
6117 +     DCHAR_T            The element type of the destination (result) string.
6118 +     FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters
6119 +                        in the format string are ASCII. MUST be set if
6120 +                        FCHAR_T and DCHAR_T are not the same type.
6121 +     DIRECTIVE          Structure denoting a format directive.
6122 +                        Depends on FCHAR_T.
6123 +     DIRECTIVES         Structure denoting the set of format directives of a
6124 +                        format string.  Depends on FCHAR_T.
6125 +     PRINTF_PARSE       Function that parses a format string.
6126 +                        Depends on FCHAR_T.
6127 +     DCHAR_CPY          memcpy like function for DCHAR_T[] arrays.
6128 +     DCHAR_SET          memset like function for DCHAR_T[] arrays.
6129 +     DCHAR_MBSNLEN      mbsnlen like function for DCHAR_T[] arrays.
6130 +     SNPRINTF           The system's snprintf (or similar) function.
6131 +                        This may be either snprintf or swprintf.
6132 +     TCHAR_T            The element type of the argument and result string
6133 +                        of the said SNPRINTF function.  This may be either
6134 +                        char or wchar_t.  The code exploits that
6135 +                        sizeof (TCHAR_T) | sizeof (DCHAR_T) and
6136 +                        alignof (TCHAR_T) <= alignof (DCHAR_T).
6137 +     DCHAR_IS_TCHAR     Set to 1 if DCHAR_T and TCHAR_T are the same type.
6138 +     DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[].
6139 +     DCHAR_IS_UINT8_T   Set to 1 if DCHAR_T is uint8_t.
6140 +     DCHAR_IS_UINT16_T  Set to 1 if DCHAR_T is uint16_t.
6141 +     DCHAR_IS_UINT32_T  Set to 1 if DCHAR_T is uint32_t.  */
6142 +
6143 +/* Tell glibc's <stdio.h> to provide a prototype for snprintf().
6144 +   This must come before <config.h> because <config.h> may include
6145 +   <features.h>, and once <features.h> has been included, it's too late.  */
6146 +#ifndef _GNU_SOURCE
6147 +# define _GNU_SOURCE    1
6148 +#endif
6149 +
6150 +#ifndef VASNPRINTF
6151 +# include <config.h>
6152 +#endif
6153 +#ifndef IN_LIBINTL
6154 +# include <alloca.h>
6155 +#endif
6156 +
6157 +/* Specification.  */
6158 +#ifndef VASNPRINTF
6159 +# if WIDE_CHAR_VERSION
6160 +#  include "vasnwprintf.h"
6161 +# else
6162 +#  include "vasnprintf.h"
6163 +# endif
6164 +#endif
6165 +
6166 +#include <locale.h>    /* localeconv() */
6167 +#include <stdio.h>     /* snprintf(), sprintf() */
6168 +#include <stdlib.h>    /* abort(), malloc(), realloc(), free() */
6169 +#include <string.h>    /* memcpy(), strlen() */
6170 +#include <errno.h>     /* errno */
6171 +#include <limits.h>    /* CHAR_BIT */
6172 +#include <float.h>     /* DBL_MAX_EXP, LDBL_MAX_EXP */
6173 +#if HAVE_NL_LANGINFO
6174 +# include <langinfo.h>
6175 +#endif
6176 +#ifndef VASNPRINTF
6177 +# if WIDE_CHAR_VERSION
6178 +#  include "wprintf-parse.h"
6179 +# else
6180 +#  include "printf-parse.h"
6181 +# endif
6182 +#endif
6183 +
6184 +/* Checked size_t computations.  */
6185 +#include "xsize.h"
6186 +
6187 +#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
6188 +# include <math.h>
6189 +# include "float+.h"
6190 +#endif
6191 +
6192 +#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
6193 +# include <math.h>
6194 +# include "isnand-nolibm.h"
6195 +#endif
6196 +
6197 +#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL
6198 +# include <math.h>
6199 +# include "isnanl-nolibm.h"
6200 +# include "fpucw.h"
6201 +#endif
6202 +
6203 +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
6204 +# include <math.h>
6205 +# include "isnand-nolibm.h"
6206 +# include "printf-frexp.h"
6207 +#endif
6208 +
6209 +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
6210 +# include <math.h>
6211 +# include "isnanl-nolibm.h"
6212 +# include "printf-frexpl.h"
6213 +# include "fpucw.h"
6214 +#endif
6215 +
6216 +#if HAVE_WCHAR_T
6217 +# if HAVE_WCSLEN
6218 +#  define local_wcslen wcslen
6219 +# else
6220 +   /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
6221 +      a dependency towards this library, here is a local substitute.
6222 +      Define this substitute only once, even if this file is included
6223 +      twice in the same compilation unit.  */
6224 +#  ifndef local_wcslen_defined
6225 +#   define local_wcslen_defined 1
6226 +static size_t
6227 +local_wcslen (const wchar_t *s)
6228 +{
6229 +  const wchar_t *ptr;
6230 +
6231 +  for (ptr = s; *ptr != (wchar_t) 0; ptr++)
6232 +    ;
6233 +  return ptr - s;
6234 +}
6235 +#  endif
6236 +# endif
6237 +#endif
6238 +
6239 +/* Default parameters.  */
6240 +#ifndef VASNPRINTF
6241 +# if WIDE_CHAR_VERSION
6242 +#  define VASNPRINTF vasnwprintf
6243 +#  define FCHAR_T wchar_t
6244 +#  define DCHAR_T wchar_t
6245 +#  define TCHAR_T wchar_t
6246 +#  define DCHAR_IS_TCHAR 1
6247 +#  define DIRECTIVE wchar_t_directive
6248 +#  define DIRECTIVES wchar_t_directives
6249 +#  define PRINTF_PARSE wprintf_parse
6250 +#  define DCHAR_CPY wmemcpy
6251 +# else
6252 +#  define VASNPRINTF vasnprintf
6253 +#  define FCHAR_T char
6254 +#  define DCHAR_T char
6255 +#  define TCHAR_T char
6256 +#  define DCHAR_IS_TCHAR 1
6257 +#  define DIRECTIVE char_directive
6258 +#  define DIRECTIVES char_directives
6259 +#  define PRINTF_PARSE printf_parse
6260 +#  define DCHAR_CPY memcpy
6261 +# endif
6262 +#endif
6263 +#if WIDE_CHAR_VERSION
6264 +  /* TCHAR_T is wchar_t.  */
6265 +# define USE_SNPRINTF 1
6266 +# if HAVE_DECL__SNWPRINTF
6267 +   /* On Windows, the function swprintf() has a different signature than
6268 +      on Unix; we use the _snwprintf() function instead.  */
6269 +#  define SNPRINTF _snwprintf
6270 +# else
6271 +   /* Unix.  */
6272 +#  define SNPRINTF swprintf
6273 +# endif
6274 +#else
6275 +  /* TCHAR_T is char.  */
6276 +  /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'.
6277 +     But don't use it on BeOS, since BeOS snprintf produces no output if the
6278 +     size argument is >= 0x3000000.
6279 +     Also don't use it on Linux libc5, since there snprintf with size = 1
6280 +     writes any output without bounds, like sprintf.  */
6281 +# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ && !(__GNU_LIBRARY__ == 1)
6282 +#  define USE_SNPRINTF 1
6283 +# else
6284 +#  define USE_SNPRINTF 0
6285 +# endif
6286 +# if HAVE_DECL__SNPRINTF
6287 +   /* Windows.  */
6288 +#  define SNPRINTF _snprintf
6289 +# else
6290 +   /* Unix.  */
6291 +#  define SNPRINTF snprintf
6292 +   /* Here we need to call the native snprintf, not rpl_snprintf.  */
6293 +#  undef snprintf
6294 +# endif
6295 +#endif
6296 +/* Here we need to call the native sprintf, not rpl_sprintf.  */
6297 +#undef sprintf
6298 +
6299 +/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized"
6300 +   warnings in this file.  Use -Dlint to suppress them.  */
6301 +#ifdef lint
6302 +# define IF_LINT(Code) Code
6303 +#else
6304 +# define IF_LINT(Code) /* empty */
6305 +#endif
6306 +
6307 +/* Avoid some warnings from "gcc -Wshadow".
6308 +   This file doesn't use the exp() and remainder() functions.  */
6309 +#undef exp
6310 +#define exp expo
6311 +#undef remainder
6312 +#define remainder rem
6313 +
6314 +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
6315 +/* Determine the decimal-point character according to the current locale.  */
6316 +# ifndef decimal_point_char_defined
6317 +#  define decimal_point_char_defined 1
6318 +static char
6319 +decimal_point_char ()
6320 +{
6321 +  const char *point;
6322 +  /* Determine it in a multithread-safe way.  We know nl_langinfo is
6323 +     multithread-safe on glibc systems, but is not required to be multithread-
6324 +     safe by POSIX.  sprintf(), however, is multithread-safe.  localeconv()
6325 +     is rarely multithread-safe.  */
6326 +#  if HAVE_NL_LANGINFO && __GLIBC__
6327 +  point = nl_langinfo (RADIXCHAR);
6328 +#  elif 1
6329 +  char pointbuf[5];
6330 +  sprintf (pointbuf, "%#.0f", 1.0);
6331 +  point = &pointbuf[1];
6332 +#  else
6333 +  point = localeconv () -> decimal_point;
6334 +#  endif
6335 +  /* The decimal point is always a single byte: either '.' or ','.  */
6336 +  return (point[0] != '\0' ? point[0] : '.');
6337 +}
6338 +# endif
6339 +#endif
6340 +
6341 +#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL
6342 +
6343 +/* Equivalent to !isfinite(x) || x == 0, but does not require libm.  */
6344 +static int
6345 +is_infinite_or_zero (double x)
6346 +{
6347 +  return isnand (x) || x + x == x;
6348 +}
6349 +
6350 +#endif
6351 +
6352 +#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
6353 +
6354 +/* Equivalent to !isfinite(x) || x == 0, but does not require libm.  */
6355 +static int
6356 +is_infinite_or_zerol (long double x)
6357 +{
6358 +  return isnanl (x) || x + x == x;
6359 +}
6360 +
6361 +#endif
6362 +
6363 +#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
6364 +
6365 +/* Converting 'long double' to decimal without rare rounding bugs requires
6366 +   real bignums.  We use the naming conventions of GNU gmp, but vastly simpler
6367 +   (and slower) algorithms.  */
6368 +
6369 +typedef unsigned int mp_limb_t;
6370 +# define GMP_LIMB_BITS 32
6371 +typedef int mp_limb_verify[2 * (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS) - 1];
6372 +
6373 +typedef unsigned long long mp_twolimb_t;
6374 +# define GMP_TWOLIMB_BITS 64
6375 +typedef int mp_twolimb_verify[2 * (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS) - 1];
6376 +
6377 +/* Representation of a bignum >= 0.  */
6378 +typedef struct
6379 +{
6380 +  size_t nlimbs;
6381 +  mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc().  */
6382 +} mpn_t;
6383 +
6384 +/* Compute the product of two bignums >= 0.
6385 +   Return the allocated memory in case of success, NULL in case of memory
6386 +   allocation failure.  */
6387 +static void *
6388 +multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
6389 +{
6390 +  const mp_limb_t *p1;
6391 +  const mp_limb_t *p2;
6392 +  size_t len1;
6393 +  size_t len2;
6394 +
6395 +  if (src1.nlimbs <= src2.nlimbs)
6396 +    {
6397 +      len1 = src1.nlimbs;
6398 +      p1 = src1.limbs;
6399 +      len2 = src2.nlimbs;
6400 +      p2 = src2.limbs;
6401 +    }
6402 +  else
6403 +    {
6404 +      len1 = src2.nlimbs;
6405 +      p1 = src2.limbs;
6406 +      len2 = src1.nlimbs;
6407 +      p2 = src1.limbs;
6408 +    }
6409 +  /* Now 0 <= len1 <= len2.  */
6410 +  if (len1 == 0)
6411 +    {
6412 +      /* src1 or src2 is zero.  */
6413 +      dest->nlimbs = 0;
6414 +      dest->limbs = (mp_limb_t *) malloc (1);
6415 +    }
6416 +  else
6417 +    {
6418 +      /* Here 1 <= len1 <= len2.  */
6419 +      size_t dlen;
6420 +      mp_limb_t *dp;
6421 +      size_t k, i, j;
6422 +
6423 +      dlen = len1 + len2;
6424 +      dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t));
6425 +      if (dp == NULL)
6426 +       return NULL;
6427 +      for (k = len2; k > 0; )
6428 +       dp[--k] = 0;
6429 +      for (i = 0; i < len1; i++)
6430 +       {
6431 +         mp_limb_t digit1 = p1[i];
6432 +         mp_twolimb_t carry = 0;
6433 +         for (j = 0; j < len2; j++)
6434 +           {
6435 +             mp_limb_t digit2 = p2[j];
6436 +             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
6437 +             carry += dp[i + j];
6438 +             dp[i + j] = (mp_limb_t) carry;
6439 +             carry = carry >> GMP_LIMB_BITS;
6440 +           }
6441 +         dp[i + len2] = (mp_limb_t) carry;
6442 +       }
6443 +      /* Normalise.  */
6444 +      while (dlen > 0 && dp[dlen - 1] == 0)
6445 +       dlen--;
6446 +      dest->nlimbs = dlen;
6447 +      dest->limbs = dp;
6448 +    }
6449 +  return dest->limbs;
6450 +}
6451 +
6452 +/* Compute the quotient of a bignum a >= 0 and a bignum b > 0.
6453 +   a is written as  a = q * b + r  with 0 <= r < b.  q is the quotient, r
6454 +   the remainder.
6455 +   Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd,
6456 +   q is incremented.
6457 +   Return the allocated memory in case of success, NULL in case of memory
6458 +   allocation failure.  */
6459 +static void *
6460 +divide (mpn_t a, mpn_t b, mpn_t *q)
6461 +{
6462 +  /* Algorithm:
6463 +     First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]]
6464 +     with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS).
6465 +     If m<n, then q:=0 and r:=a.
6466 +     If m>=n=1, perform a single-precision division:
6467 +       r:=0, j:=m,
6468 +       while j>0 do
6469 +         {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j =
6470 +               = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r<b[0]<beta}
6471 +         j:=j-1, r:=r*beta+a[j], q[j]:=floor(r/b[0]), r:=r-b[0]*q[j].
6472 +       Normalise [q[m-1],...,q[0]], yields q.
6473 +     If m>=n>1, perform a multiple-precision division:
6474 +       We have a/b < beta^(m-n+1).
6475 +       s:=intDsize-1-(hightest bit in b[n-1]), 0<=s<intDsize.
6476 +       Shift a and b left by s bits, copying them. r:=a.
6477 +       r=[r[m],...,r[0]], b=[b[n-1],...,b[0]] with b[n-1]>=beta/2.
6478 +       For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).}
6479 +         Compute q* :
6480 +           q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]).
6481 +           In case of overflow (q* >= beta) set q* := beta-1.
6482 +           Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2]
6483 +           and c3 := b[n-2] * q*.
6484 +           {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow
6485 +            occurred.  Furthermore 0 <= c3 < beta^2.
6486 +            If there was overflow and
6487 +            r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2,
6488 +            the next test can be skipped.}
6489 +           While c3 > c2, {Here 0 <= c2 < c3 < beta^2}
6490 +             Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2].
6491 +           If q* > 0:
6492 +             Put r := r - b * q* * beta^j. In detail:
6493 +               [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]].
6494 +               hence: u:=0, for i:=0 to n-1 do
6495 +                              u := u + q* * b[i],
6496 +                              r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry),
6497 +                              u:=u div beta (+ 1, if carry in subtraction)
6498 +                      r[n+j]:=r[n+j]-u.
6499 +               {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1
6500 +                               < q* + 1 <= beta,
6501 +                the carry u does not overflow.}
6502 +             If a negative carry occurs, put q* := q* - 1
6503 +               and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]].
6504 +         Set q[j] := q*.
6505 +       Normalise [q[m-n],..,q[0]]; this yields the quotient q.
6506 +       Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the
6507 +       rest r.
6508 +       The room for q[j] can be allocated at the memory location of r[n+j].
6509 +     Finally, round-to-even:
6510 +       Shift r left by 1 bit.
6511 +       If r > b or if r = b and q[0] is odd, q := q+1.
6512 +   */
6513 +  const mp_limb_t *a_ptr = a.limbs;
6514 +  size_t a_len = a.nlimbs;
6515 +  const mp_limb_t *b_ptr = b.limbs;
6516 +  size_t b_len = b.nlimbs;
6517 +  mp_limb_t *roomptr;
6518 +  mp_limb_t *tmp_roomptr = NULL;
6519 +  mp_limb_t *q_ptr;
6520 +  size_t q_len;
6521 +  mp_limb_t *r_ptr;
6522 +  size_t r_len;
6523 +
6524 +  /* Allocate room for a_len+2 digits.
6525 +     (Need a_len+1 digits for the real division and 1 more digit for the
6526 +     final rounding of q.)  */
6527 +  roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t));
6528 +  if (roomptr == NULL)
6529 +    return NULL;
6530 +
6531 +  /* Normalise a.  */
6532 +  while (a_len > 0 && a_ptr[a_len - 1] == 0)
6533 +    a_len--;
6534 +
6535 +  /* Normalise b.  */
6536 +  for (;;)
6537 +    {
6538 +      if (b_len == 0)
6539 +       /* Division by zero.  */
6540 +       abort ();
6541 +      if (b_ptr[b_len - 1] == 0)
6542 +       b_len--;
6543 +      else
6544 +       break;
6545 +    }
6546 +
6547 +  /* Here m = a_len >= 0 and n = b_len > 0.  */
6548 +
6549 +  if (a_len < b_len)
6550 +    {
6551 +      /* m<n: trivial case.  q=0, r := copy of a.  */
6552 +      r_ptr = roomptr;
6553 +      r_len = a_len;
6554 +      memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
6555 +      q_ptr = roomptr + a_len;
6556 +      q_len = 0;
6557 +    }
6558 +  else if (b_len == 1)
6559 +    {
6560 +      /* n=1: single precision division.
6561 +        beta^(m-1) <= a < beta^m  ==>  beta^(m-2) <= a/b < beta^m  */
6562 +      r_ptr = roomptr;
6563 +      q_ptr = roomptr + 1;
6564 +      {
6565 +       mp_limb_t den = b_ptr[0];
6566 +       mp_limb_t remainder = 0;
6567 +       const mp_limb_t *sourceptr = a_ptr + a_len;
6568 +       mp_limb_t *destptr = q_ptr + a_len;
6569 +       size_t count;
6570 +       for (count = a_len; count > 0; count--)
6571 +         {
6572 +           mp_twolimb_t num =
6573 +             ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
6574 +           *--destptr = num / den;
6575 +           remainder = num % den;
6576 +         }
6577 +       /* Normalise and store r.  */
6578 +       if (remainder > 0)
6579 +         {
6580 +           r_ptr[0] = remainder;
6581 +           r_len = 1;
6582 +         }
6583 +       else
6584 +         r_len = 0;
6585 +       /* Normalise q.  */
6586 +       q_len = a_len;
6587 +       if (q_ptr[q_len - 1] == 0)
6588 +         q_len--;
6589 +      }
6590 +    }
6591 +  else
6592 +    {
6593 +      /* n>1: multiple precision division.
6594 +        beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n  ==>
6595 +        beta^(m-n-1) <= a/b < beta^(m-n+1).  */
6596 +      /* Determine s.  */
6597 +      size_t s;
6598 +      {
6599 +       mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
6600 +       s = 31;
6601 +       if (msd >= 0x10000)
6602 +         {
6603 +           msd = msd >> 16;
6604 +           s -= 16;
6605 +         }
6606 +       if (msd >= 0x100)
6607 +         {
6608 +           msd = msd >> 8;
6609 +           s -= 8;
6610 +         }
6611 +       if (msd >= 0x10)
6612 +         {
6613 +           msd = msd >> 4;
6614 +           s -= 4;
6615 +         }
6616 +       if (msd >= 0x4)
6617 +         {
6618 +           msd = msd >> 2;
6619 +           s -= 2;
6620 +         }
6621 +       if (msd >= 0x2)
6622 +         {
6623 +           msd = msd >> 1;
6624 +           s -= 1;
6625 +         }
6626 +      }
6627 +      /* 0 <= s < GMP_LIMB_BITS.
6628 +        Copy b, shifting it left by s bits.  */
6629 +      if (s > 0)
6630 +       {
6631 +         tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
6632 +         if (tmp_roomptr == NULL)
6633 +           {
6634 +             free (roomptr);
6635 +             return NULL;
6636 +           }
6637 +         {
6638 +           const mp_limb_t *sourceptr = b_ptr;
6639 +           mp_limb_t *destptr = tmp_roomptr;
6640 +           mp_twolimb_t accu = 0;
6641 +           size_t count;
6642 +           for (count = b_len; count > 0; count--)
6643 +             {
6644 +               accu += (mp_twolimb_t) *sourceptr++ << s;
6645 +               *destptr++ = (mp_limb_t) accu;
6646 +               accu = accu >> GMP_LIMB_BITS;
6647 +             }
6648 +           /* accu must be zero, since that was how s was determined.  */
6649 +           if (accu != 0)
6650 +             abort ();
6651 +         }
6652 +         b_ptr = tmp_roomptr;
6653 +       }
6654 +      /* Copy a, shifting it left by s bits, yields r.
6655 +        Memory layout:
6656 +        At the beginning: r = roomptr[0..a_len],
6657 +        at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len]  */
6658 +      r_ptr = roomptr;
6659 +      if (s == 0)
6660 +       {
6661 +         memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
6662 +         r_ptr[a_len] = 0;
6663 +       }
6664 +      else
6665 +       {
6666 +         const mp_limb_t *sourceptr = a_ptr;
6667 +         mp_limb_t *destptr = r_ptr;
6668 +         mp_twolimb_t accu = 0;
6669 +         size_t count;
6670 +         for (count = a_len; count > 0; count--)
6671 +           {
6672 +             accu += (mp_twolimb_t) *sourceptr++ << s;
6673 +             *destptr++ = (mp_limb_t) accu;
6674 +             accu = accu >> GMP_LIMB_BITS;
6675 +           }
6676 +         *destptr++ = (mp_limb_t) accu;
6677 +       }
6678 +      q_ptr = roomptr + b_len;
6679 +      q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */
6680 +      {
6681 +       size_t j = a_len - b_len; /* m-n */
6682 +       mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
6683 +       mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
6684 +       mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
6685 +         ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
6686 +       /* Division loop, traversed m-n+1 times.
6687 +          j counts down, b is unchanged, beta/2 <= b[n-1] < beta.  */
6688 +       for (;;)
6689 +         {
6690 +           mp_limb_t q_star;
6691 +           mp_limb_t c1;
6692 +           if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
6693 +             {
6694 +               /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow.  */
6695 +               mp_twolimb_t num =
6696 +                 ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
6697 +                 | r_ptr[j + b_len - 1];
6698 +               q_star = num / b_msd;
6699 +               c1 = num % b_msd;
6700 +             }
6701 +           else
6702 +             {
6703 +               /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1].  */
6704 +               q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
6705 +               /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
6706 +                  <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
6707 +                  <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
6708 +                       {<= beta !}.
6709 +                  If yes, jump directly to the subtraction loop.
6710 +                  (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
6711 +                   <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */
6712 +               if (r_ptr[j + b_len] > b_msd
6713 +                   || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
6714 +                 /* r[j+n] >= b[n-1]+1 or
6715 +                    r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
6716 +                    carry.  */
6717 +                 goto subtract;
6718 +             }
6719 +           /* q_star = q*,
6720 +              c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta).  */
6721 +           {
6722 +             mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
6723 +               ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
6724 +             mp_twolimb_t c3 = /* b[n-2] * q* */
6725 +               (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
6726 +             /* While c2 < c3, increase c2 and decrease c3.
6727 +                Consider c3-c2.  While it is > 0, decrease it by
6728 +                b[n-1]*beta+b[n-2].  Because of b[n-1]*beta+b[n-2] >= beta^2/2
6729 +                this can happen only twice.  */
6730 +             if (c3 > c2)
6731 +               {
6732 +                 q_star = q_star - 1; /* q* := q* - 1 */
6733 +                 if (c3 - c2 > b_msdd)
6734 +                   q_star = q_star - 1; /* q* := q* - 1 */
6735 +               }
6736 +           }
6737 +           if (q_star > 0)
6738 +             subtract:
6739 +             {
6740 +               /* Subtract r := r - b * q* * beta^j.  */
6741 +               mp_limb_t cr;
6742 +               {
6743 +                 const mp_limb_t *sourceptr = b_ptr;
6744 +                 mp_limb_t *destptr = r_ptr + j;
6745 +                 mp_twolimb_t carry = 0;
6746 +                 size_t count;
6747 +                 for (count = b_len; count > 0; count--)
6748 +                   {
6749 +                     /* Here 0 <= carry <= q*.  */
6750 +                     carry =
6751 +                       carry
6752 +                       + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
6753 +                       + (mp_limb_t) ~(*destptr);
6754 +                     /* Here 0 <= carry <= beta*q* + beta-1.  */
6755 +                     *destptr++ = ~(mp_limb_t) carry;
6756 +                     carry = carry >> GMP_LIMB_BITS; /* <= q* */
6757 +                   }
6758 +                 cr = (mp_limb_t) carry;
6759 +               }
6760 +               /* Subtract cr from r_ptr[j + b_len], then forget about
6761 +                  r_ptr[j + b_len].  */
6762 +               if (cr > r_ptr[j + b_len])
6763 +                 {
6764 +                   /* Subtraction gave a carry.  */
6765 +                   q_star = q_star - 1; /* q* := q* - 1 */
6766 +                   /* Add b back.  */
6767 +                   {
6768 +                     const mp_limb_t *sourceptr = b_ptr;
6769 +                     mp_limb_t *destptr = r_ptr + j;
6770 +                     mp_limb_t carry = 0;
6771 +                     size_t count;
6772 +                     for (count = b_len; count > 0; count--)
6773 +                       {
6774 +                         mp_limb_t source1 = *sourceptr++;
6775 +                         mp_limb_t source2 = *destptr;
6776 +                         *destptr++ = source1 + source2 + carry;
6777 +                         carry =
6778 +                           (carry
6779 +                            ? source1 >= (mp_limb_t) ~source2
6780 +                            : source1 > (mp_limb_t) ~source2);
6781 +                       }
6782 +                   }
6783 +                   /* Forget about the carry and about r[j+n].  */
6784 +                 }
6785 +             }
6786 +           /* q* is determined.  Store it as q[j].  */
6787 +           q_ptr[j] = q_star;
6788 +           if (j == 0)
6789 +             break;
6790 +           j--;
6791 +         }
6792 +      }
6793 +      r_len = b_len;
6794 +      /* Normalise q.  */
6795 +      if (q_ptr[q_len - 1] == 0)
6796 +       q_len--;
6797 +# if 0 /* Not needed here, since we need r only to compare it with b/2, and
6798 +         b is shifted left by s bits.  */
6799 +      /* Shift r right by s bits.  */
6800 +      if (s > 0)
6801 +       {
6802 +         mp_limb_t ptr = r_ptr + r_len;
6803 +         mp_twolimb_t accu = 0;
6804 +         size_t count;
6805 +         for (count = r_len; count > 0; count--)
6806 +           {
6807 +             accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
6808 +             accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
6809 +             *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
6810 +           }
6811 +       }
6812 +# endif
6813 +      /* Normalise r.  */
6814 +      while (r_len > 0 && r_ptr[r_len - 1] == 0)
6815 +       r_len--;
6816 +    }
6817 +  /* Compare r << 1 with b.  */
6818 +  if (r_len > b_len)
6819 +    goto increment_q;
6820 +  {
6821 +    size_t i;
6822 +    for (i = b_len;;)
6823 +      {
6824 +       mp_limb_t r_i =
6825 +         (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
6826 +         | (i < r_len ? r_ptr[i] << 1 : 0);
6827 +       mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
6828 +       if (r_i > b_i)
6829 +         goto increment_q;
6830 +       if (r_i < b_i)
6831 +         goto keep_q;
6832 +       if (i == 0)
6833 +         break;
6834 +       i--;
6835 +      }
6836 +  }
6837 +  if (q_len > 0 && ((q_ptr[0] & 1) != 0))
6838 +    /* q is odd.  */
6839 +    increment_q:
6840 +    {
6841 +      size_t i;
6842 +      for (i = 0; i < q_len; i++)
6843 +       if (++(q_ptr[i]) != 0)
6844 +         goto keep_q;
6845 +      q_ptr[q_len++] = 1;
6846 +    }
6847 +  keep_q:
6848 +  if (tmp_roomptr != NULL)
6849 +    free (tmp_roomptr);
6850 +  q->limbs = q_ptr;
6851 +  q->nlimbs = q_len;
6852 +  return roomptr;
6853 +}
6854 +
6855 +/* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal
6856 +   representation.
6857 +   Destroys the contents of a.
6858 +   Return the allocated memory - containing the decimal digits in low-to-high
6859 +   order, terminated with a NUL character - in case of success, NULL in case
6860 +   of memory allocation failure.  */
6861 +static char *
6862 +convert_to_decimal (mpn_t a, size_t extra_zeroes)
6863 +{
6864 +  mp_limb_t *a_ptr = a.limbs;
6865 +  size_t a_len = a.nlimbs;
6866 +  /* 0.03345 is slightly larger than log(2)/(9*log(10)).  */
6867 +  size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1);
6868 +  char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes));
6869 +  if (c_ptr != NULL)
6870 +    {
6871 +      char *d_ptr = c_ptr;
6872 +      for (; extra_zeroes > 0; extra_zeroes--)
6873 +       *d_ptr++ = '0';
6874 +      while (a_len > 0)
6875 +       {
6876 +         /* Divide a by 10^9, in-place.  */
6877 +         mp_limb_t remainder = 0;
6878 +         mp_limb_t *ptr = a_ptr + a_len;
6879 +         size_t count;
6880 +         for (count = a_len; count > 0; count--)
6881 +           {
6882 +             mp_twolimb_t num =
6883 +               ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
6884 +             *ptr = num / 1000000000;
6885 +             remainder = num % 1000000000;
6886 +           }
6887 +         /* Store the remainder as 9 decimal digits.  */
6888 +         for (count = 9; count > 0; count--)
6889 +           {
6890 +             *d_ptr++ = '0' + (remainder % 10);
6891 +             remainder = remainder / 10;
6892 +           }
6893 +         /* Normalize a.  */
6894 +         if (a_ptr[a_len - 1] == 0)
6895 +           a_len--;
6896 +       }
6897 +      /* Remove leading zeroes.  */
6898 +      while (d_ptr > c_ptr && d_ptr[-1] == '0')
6899 +       d_ptr--;
6900 +      /* But keep at least one zero.  */
6901 +      if (d_ptr == c_ptr)
6902 +       *d_ptr++ = '0';
6903 +      /* Terminate the string.  */
6904 +      *d_ptr = '\0';
6905 +    }
6906 +  return c_ptr;
6907 +}
6908 +
6909 +# if NEED_PRINTF_LONG_DOUBLE
6910 +
6911 +/* Assuming x is finite and >= 0:
6912 +   write x as x = 2^e * m, where m is a bignum.
6913 +   Return the allocated memory in case of success, NULL in case of memory
6914 +   allocation failure.  */
6915 +static void *
6916 +decode_long_double (long double x, int *ep, mpn_t *mp)
6917 +{
6918 +  mpn_t m;
6919 +  int exp;
6920 +  long double y;
6921 +  size_t i;
6922 +
6923 +  /* Allocate memory for result.  */
6924 +  m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
6925 +  m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
6926 +  if (m.limbs == NULL)
6927 +    return NULL;
6928 +  /* Split into exponential part and mantissa.  */
6929 +  y = frexpl (x, &exp);
6930 +  if (!(y >= 0.0L && y < 1.0L))
6931 +    abort ();
6932 +  /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * LDBL_MANT_BIT), and the
6933 +     latter is an integer.  */
6934 +  /* Convert the mantissa (y * LDBL_MANT_BIT) to a sequence of limbs.
6935 +     I'm not sure whether it's safe to cast a 'long double' value between
6936 +     2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
6937 +     'long double' values between 0 and 2^16 (to 'unsigned int' or 'int',
6938 +     doesn't matter).  */
6939 +#  if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0
6940 +#   if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
6941 +    {
6942 +      mp_limb_t hi, lo;
6943 +      y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2));
6944 +      hi = (int) y;
6945 +      y -= hi;
6946 +      if (!(y >= 0.0L && y < 1.0L))
6947 +       abort ();
6948 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
6949 +      lo = (int) y;
6950 +      y -= lo;
6951 +      if (!(y >= 0.0L && y < 1.0L))
6952 +       abort ();
6953 +      m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
6954 +    }
6955 +#   else
6956 +    {
6957 +      mp_limb_t d;
6958 +      y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS);
6959 +      d = (int) y;
6960 +      y -= d;
6961 +      if (!(y >= 0.0L && y < 1.0L))
6962 +       abort ();
6963 +      m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d;
6964 +    }
6965 +#   endif
6966 +#  endif
6967 +  for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
6968 +    {
6969 +      mp_limb_t hi, lo;
6970 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
6971 +      hi = (int) y;
6972 +      y -= hi;
6973 +      if (!(y >= 0.0L && y < 1.0L))
6974 +       abort ();
6975 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
6976 +      lo = (int) y;
6977 +      y -= lo;
6978 +      if (!(y >= 0.0L && y < 1.0L))
6979 +       abort ();
6980 +      m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
6981 +    }
6982 +#if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
6983 +         precision.  */
6984 +  if (!(y == 0.0L))
6985 +    abort ();
6986 +#endif
6987 +  /* Normalise.  */
6988 +  while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
6989 +    m.nlimbs--;
6990 +  *mp = m;
6991 +  *ep = exp - LDBL_MANT_BIT;
6992 +  return m.limbs;
6993 +}
6994 +
6995 +# endif
6996 +
6997 +# if NEED_PRINTF_DOUBLE
6998 +
6999 +/* Assuming x is finite and >= 0:
7000 +   write x as x = 2^e * m, where m is a bignum.
7001 +   Return the allocated memory in case of success, NULL in case of memory
7002 +   allocation failure.  */
7003 +static void *
7004 +decode_double (double x, int *ep, mpn_t *mp)
7005 +{
7006 +  mpn_t m;
7007 +  int exp;
7008 +  double y;
7009 +  size_t i;
7010 +
7011 +  /* Allocate memory for result.  */
7012 +  m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
7013 +  m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
7014 +  if (m.limbs == NULL)
7015 +    return NULL;
7016 +  /* Split into exponential part and mantissa.  */
7017 +  y = frexp (x, &exp);
7018 +  if (!(y >= 0.0 && y < 1.0))
7019 +    abort ();
7020 +  /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the
7021 +     latter is an integer.  */
7022 +  /* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs.
7023 +     I'm not sure whether it's safe to cast a 'double' value between
7024 +     2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
7025 +     'double' values between 0 and 2^16 (to 'unsigned int' or 'int',
7026 +     doesn't matter).  */
7027 +#  if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0
7028 +#   if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
7029 +    {
7030 +      mp_limb_t hi, lo;
7031 +      y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2));
7032 +      hi = (int) y;
7033 +      y -= hi;
7034 +      if (!(y >= 0.0 && y < 1.0))
7035 +       abort ();
7036 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
7037 +      lo = (int) y;
7038 +      y -= lo;
7039 +      if (!(y >= 0.0 && y < 1.0))
7040 +       abort ();
7041 +      m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
7042 +    }
7043 +#   else
7044 +    {
7045 +      mp_limb_t d;
7046 +      y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS);
7047 +      d = (int) y;
7048 +      y -= d;
7049 +      if (!(y >= 0.0 && y < 1.0))
7050 +       abort ();
7051 +      m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d;
7052 +    }
7053 +#   endif
7054 +#  endif
7055 +  for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
7056 +    {
7057 +      mp_limb_t hi, lo;
7058 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
7059 +      hi = (int) y;
7060 +      y -= hi;
7061 +      if (!(y >= 0.0 && y < 1.0))
7062 +       abort ();
7063 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
7064 +      lo = (int) y;
7065 +      y -= lo;
7066 +      if (!(y >= 0.0 && y < 1.0))
7067 +       abort ();
7068 +      m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
7069 +    }
7070 +  if (!(y == 0.0))
7071 +    abort ();
7072 +  /* Normalise.  */
7073 +  while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
7074 +    m.nlimbs--;
7075 +  *mp = m;
7076 +  *ep = exp - DBL_MANT_BIT;
7077 +  return m.limbs;
7078 +}
7079 +
7080 +# endif
7081 +
7082 +/* Assuming x = 2^e * m is finite and >= 0, and n is an integer:
7083 +   Returns the decimal representation of round (x * 10^n).
7084 +   Return the allocated memory - containing the decimal digits in low-to-high
7085 +   order, terminated with a NUL character - in case of success, NULL in case
7086 +   of memory allocation failure.  */
7087 +static char *
7088 +scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
7089 +{
7090 +  int s;
7091 +  size_t extra_zeroes;
7092 +  unsigned int abs_n;
7093 +  unsigned int abs_s;
7094 +  mp_limb_t *pow5_ptr;
7095 +  size_t pow5_len;
7096 +  unsigned int s_limbs;
7097 +  unsigned int s_bits;
7098 +  mpn_t pow5;
7099 +  mpn_t z;
7100 +  void *z_memory;
7101 +  char *digits;
7102 +
7103 +  if (memory == NULL)
7104 +    return NULL;
7105 +  /* x = 2^e * m, hence
7106 +     y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m)
7107 +       = round (2^s * 5^n * m).  */
7108 +  s = e + n;
7109 +  extra_zeroes = 0;
7110 +  /* Factor out a common power of 10 if possible.  */
7111 +  if (s > 0 && n > 0)
7112 +    {
7113 +      extra_zeroes = (s < n ? s : n);
7114 +      s -= extra_zeroes;
7115 +      n -= extra_zeroes;
7116 +    }
7117 +  /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes.
7118 +     Before converting to decimal, we need to compute
7119 +     z = round (2^s * 5^n * m).  */
7120 +  /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same
7121 +     sign.  2.322 is slightly larger than log(5)/log(2).  */
7122 +  abs_n = (n >= 0 ? n : -n);
7123 +  abs_s = (s >= 0 ? s : -s);
7124 +  pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1
7125 +                                   + abs_s / GMP_LIMB_BITS + 1)
7126 +                                  * sizeof (mp_limb_t));
7127 +  if (pow5_ptr == NULL)
7128 +    {
7129 +      free (memory);
7130 +      return NULL;
7131 +    }
7132 +  /* Initialize with 1.  */
7133 +  pow5_ptr[0] = 1;
7134 +  pow5_len = 1;
7135 +  /* Multiply with 5^|n|.  */
7136 +  if (abs_n > 0)
7137 +    {
7138 +      static mp_limb_t const small_pow5[13 + 1] =
7139 +       {
7140 +         1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
7141 +         48828125, 244140625, 1220703125
7142 +       };
7143 +      unsigned int n13;
7144 +      for (n13 = 0; n13 <= abs_n; n13 += 13)
7145 +       {
7146 +         mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
7147 +         size_t j;
7148 +         mp_twolimb_t carry = 0;
7149 +         for (j = 0; j < pow5_len; j++)
7150 +           {
7151 +             mp_limb_t digit2 = pow5_ptr[j];
7152 +             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
7153 +             pow5_ptr[j] = (mp_limb_t) carry;
7154 +             carry = carry >> GMP_LIMB_BITS;
7155 +           }
7156 +         if (carry > 0)
7157 +           pow5_ptr[pow5_len++] = (mp_limb_t) carry;
7158 +       }
7159 +    }
7160 +  s_limbs = abs_s / GMP_LIMB_BITS;
7161 +  s_bits = abs_s % GMP_LIMB_BITS;
7162 +  if (n >= 0 ? s >= 0 : s <= 0)
7163 +    {
7164 +      /* Multiply with 2^|s|.  */
7165 +      if (s_bits > 0)
7166 +       {
7167 +         mp_limb_t *ptr = pow5_ptr;
7168 +         mp_twolimb_t accu = 0;
7169 +         size_t count;
7170 +         for (count = pow5_len; count > 0; count--)
7171 +           {
7172 +             accu += (mp_twolimb_t) *ptr << s_bits;
7173 +             *ptr++ = (mp_limb_t) accu;
7174 +             accu = accu >> GMP_LIMB_BITS;
7175 +           }
7176 +         if (accu > 0)
7177 +           {
7178 +             *ptr = (mp_limb_t) accu;
7179 +             pow5_len++;
7180 +           }
7181 +       }
7182 +      if (s_limbs > 0)
7183 +       {
7184 +         size_t count;
7185 +         for (count = pow5_len; count > 0;)
7186 +           {
7187 +             count--;
7188 +             pow5_ptr[s_limbs + count] = pow5_ptr[count];
7189 +           }
7190 +         for (count = s_limbs; count > 0;)
7191 +           {
7192 +             count--;
7193 +             pow5_ptr[count] = 0;
7194 +           }
7195 +         pow5_len += s_limbs;
7196 +       }
7197 +      pow5.limbs = pow5_ptr;
7198 +      pow5.nlimbs = pow5_len;
7199 +      if (n >= 0)
7200 +       {
7201 +         /* Multiply m with pow5.  No division needed.  */
7202 +         z_memory = multiply (m, pow5, &z);
7203 +       }
7204 +      else
7205 +       {
7206 +         /* Divide m by pow5 and round.  */
7207 +         z_memory = divide (m, pow5, &z);
7208 +       }
7209 +    }
7210 +  else
7211 +    {
7212 +      pow5.limbs = pow5_ptr;
7213 +      pow5.nlimbs = pow5_len;
7214 +      if (n >= 0)
7215 +       {
7216 +         /* n >= 0, s < 0.
7217 +            Multiply m with pow5, then divide by 2^|s|.  */
7218 +         mpn_t numerator;
7219 +         mpn_t denominator;
7220 +         void *tmp_memory;
7221 +         tmp_memory = multiply (m, pow5, &numerator);
7222 +         if (tmp_memory == NULL)
7223 +           {
7224 +             free (pow5_ptr);
7225 +             free (memory);
7226 +             return NULL;
7227 +           }
7228 +         /* Construct 2^|s|.  */
7229 +         {
7230 +           mp_limb_t *ptr = pow5_ptr + pow5_len;
7231 +           size_t i;
7232 +           for (i = 0; i < s_limbs; i++)
7233 +             ptr[i] = 0;
7234 +           ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
7235 +           denominator.limbs = ptr;
7236 +           denominator.nlimbs = s_limbs + 1;
7237 +         }
7238 +         z_memory = divide (numerator, denominator, &z);
7239 +         free (tmp_memory);
7240 +       }
7241 +      else
7242 +       {
7243 +         /* n < 0, s > 0.
7244 +            Multiply m with 2^s, then divide by pow5.  */
7245 +         mpn_t numerator;
7246 +         mp_limb_t *num_ptr;
7247 +         num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
7248 +                                         * sizeof (mp_limb_t));
7249 +         if (num_ptr == NULL)
7250 +           {
7251 +             free (pow5_ptr);
7252 +             free (memory);
7253 +             return NULL;
7254 +           }
7255 +         {
7256 +           mp_limb_t *destptr = num_ptr;
7257 +           {
7258 +             size_t i;
7259 +             for (i = 0; i < s_limbs; i++)
7260 +               *destptr++ = 0;
7261 +           }
7262 +           if (s_bits > 0)
7263 +             {
7264 +               const mp_limb_t *sourceptr = m.limbs;
7265 +               mp_twolimb_t accu = 0;
7266 +               size_t count;
7267 +               for (count = m.nlimbs; count > 0; count--)
7268 +                 {
7269 +                   accu += (mp_twolimb_t) *sourceptr++ << s_bits;
7270 +                   *destptr++ = (mp_limb_t) accu;
7271 +                   accu = accu >> GMP_LIMB_BITS;
7272 +                 }
7273 +               if (accu > 0)
7274 +                 *destptr++ = (mp_limb_t) accu;
7275 +             }
7276 +           else
7277 +             {
7278 +               const mp_limb_t *sourceptr = m.limbs;
7279 +               size_t count;
7280 +               for (count = m.nlimbs; count > 0; count--)
7281 +                 *destptr++ = *sourceptr++;
7282 +             }
7283 +           numerator.limbs = num_ptr;
7284 +           numerator.nlimbs = destptr - num_ptr;
7285 +         }
7286 +         z_memory = divide (numerator, pow5, &z);
7287 +         free (num_ptr);
7288 +       }
7289 +    }
7290 +  free (pow5_ptr);
7291 +  free (memory);
7292 +
7293 +  /* Here y = round (x * 10^n) = z * 10^extra_zeroes.  */
7294 +
7295 +  if (z_memory == NULL)
7296 +    return NULL;
7297 +  digits = convert_to_decimal (z, extra_zeroes);
7298 +  free (z_memory);
7299 +  return digits;
7300 +}
7301 +
7302 +# if NEED_PRINTF_LONG_DOUBLE
7303 +
7304 +/* Assuming x is finite and >= 0, and n is an integer:
7305 +   Returns the decimal representation of round (x * 10^n).
7306 +   Return the allocated memory - containing the decimal digits in low-to-high
7307 +   order, terminated with a NUL character - in case of success, NULL in case
7308 +   of memory allocation failure.  */
7309 +static char *
7310 +scale10_round_decimal_long_double (long double x, int n)
7311 +{
7312 +  int e IF_LINT(= 0);
7313 +  mpn_t m;
7314 +  void *memory = decode_long_double (x, &e, &m);
7315 +  return scale10_round_decimal_decoded (e, m, memory, n);
7316 +}
7317 +
7318 +# endif
7319 +
7320 +# if NEED_PRINTF_DOUBLE
7321 +
7322 +/* Assuming x is finite and >= 0, and n is an integer:
7323 +   Returns the decimal representation of round (x * 10^n).
7324 +   Return the allocated memory - containing the decimal digits in low-to-high
7325 +   order, terminated with a NUL character - in case of success, NULL in case
7326 +   of memory allocation failure.  */
7327 +static char *
7328 +scale10_round_decimal_double (double x, int n)
7329 +{
7330 +  int e IF_LINT(= 0);
7331 +  mpn_t m;
7332 +  void *memory = decode_double (x, &e, &m);
7333 +  return scale10_round_decimal_decoded (e, m, memory, n);
7334 +}
7335 +
7336 +# endif
7337 +
7338 +# if NEED_PRINTF_LONG_DOUBLE
7339 +
7340 +/* Assuming x is finite and > 0:
7341 +   Return an approximation for n with 10^n <= x < 10^(n+1).
7342 +   The approximation is usually the right n, but may be off by 1 sometimes.  */
7343 +static int
7344 +floorlog10l (long double x)
7345 +{
7346 +  int exp;
7347 +  long double y;
7348 +  double z;
7349 +  double l;
7350 +
7351 +  /* Split into exponential part and mantissa.  */
7352 +  y = frexpl (x, &exp);
7353 +  if (!(y >= 0.0L && y < 1.0L))
7354 +    abort ();
7355 +  if (y == 0.0L)
7356 +    return INT_MIN;
7357 +  if (y < 0.5L)
7358 +    {
7359 +      while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
7360 +       {
7361 +         y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
7362 +         exp -= GMP_LIMB_BITS;
7363 +       }
7364 +      if (y < (1.0L / (1 << 16)))
7365 +       {
7366 +         y *= 1.0L * (1 << 16);
7367 +         exp -= 16;
7368 +       }
7369 +      if (y < (1.0L / (1 << 8)))
7370 +       {
7371 +         y *= 1.0L * (1 << 8);
7372 +         exp -= 8;
7373 +       }
7374 +      if (y < (1.0L / (1 << 4)))
7375 +       {
7376 +         y *= 1.0L * (1 << 4);
7377 +         exp -= 4;
7378 +       }
7379 +      if (y < (1.0L / (1 << 2)))
7380 +       {
7381 +         y *= 1.0L * (1 << 2);
7382 +         exp -= 2;
7383 +       }
7384 +      if (y < (1.0L / (1 << 1)))
7385 +       {
7386 +         y *= 1.0L * (1 << 1);
7387 +         exp -= 1;
7388 +       }
7389 +    }
7390 +  if (!(y >= 0.5L && y < 1.0L))
7391 +    abort ();
7392 +  /* Compute an approximation for l = log2(x) = exp + log2(y).  */
7393 +  l = exp;
7394 +  z = y;
7395 +  if (z < 0.70710678118654752444)
7396 +    {
7397 +      z *= 1.4142135623730950488;
7398 +      l -= 0.5;
7399 +    }
7400 +  if (z < 0.8408964152537145431)
7401 +    {
7402 +      z *= 1.1892071150027210667;
7403 +      l -= 0.25;
7404 +    }
7405 +  if (z < 0.91700404320467123175)
7406 +    {
7407 +      z *= 1.0905077326652576592;
7408 +      l -= 0.125;
7409 +    }
7410 +  if (z < 0.9576032806985736469)
7411 +    {
7412 +      z *= 1.0442737824274138403;
7413 +      l -= 0.0625;
7414 +    }
7415 +  /* Now 0.95 <= z <= 1.01.  */
7416 +  z = 1 - z;
7417 +  /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...)
7418 +     Four terms are enough to get an approximation with error < 10^-7.  */
7419 +  l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
7420 +  /* Finally multiply with log(2)/log(10), yields an approximation for
7421 +     log10(x).  */
7422 +  l *= 0.30102999566398119523;
7423 +  /* Round down to the next integer.  */
7424 +  return (int) l + (l < 0 ? -1 : 0);
7425 +}
7426 +
7427 +# endif
7428 +
7429 +# if NEED_PRINTF_DOUBLE
7430 +
7431 +/* Assuming x is finite and > 0:
7432 +   Return an approximation for n with 10^n <= x < 10^(n+1).
7433 +   The approximation is usually the right n, but may be off by 1 sometimes.  */
7434 +static int
7435 +floorlog10 (double x)
7436 +{
7437 +  int exp;
7438 +  double y;
7439 +  double z;
7440 +  double l;
7441 +
7442 +  /* Split into exponential part and mantissa.  */
7443 +  y = frexp (x, &exp);
7444 +  if (!(y >= 0.0 && y < 1.0))
7445 +    abort ();
7446 +  if (y == 0.0)
7447 +    return INT_MIN;
7448 +  if (y < 0.5)
7449 +    {
7450 +      while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
7451 +       {
7452 +         y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
7453 +         exp -= GMP_LIMB_BITS;
7454 +       }
7455 +      if (y < (1.0 / (1 << 16)))
7456 +       {
7457 +         y *= 1.0 * (1 << 16);
7458 +         exp -= 16;
7459 +       }
7460 +      if (y < (1.0 / (1 << 8)))
7461 +       {
7462 +         y *= 1.0 * (1 << 8);
7463 +         exp -= 8;
7464 +       }
7465 +      if (y < (1.0 / (1 << 4)))
7466 +       {
7467 +         y *= 1.0 * (1 << 4);
7468 +         exp -= 4;
7469 +       }
7470 +      if (y < (1.0 / (1 << 2)))
7471 +       {
7472 +         y *= 1.0 * (1 << 2);
7473 +         exp -= 2;
7474 +       }
7475 +      if (y < (1.0 / (1 << 1)))
7476 +       {
7477 +         y *= 1.0 * (1 << 1);
7478 +         exp -= 1;
7479 +       }
7480 +    }
7481 +  if (!(y >= 0.5 && y < 1.0))
7482 +    abort ();
7483 +  /* Compute an approximation for l = log2(x) = exp + log2(y).  */
7484 +  l = exp;
7485 +  z = y;
7486 +  if (z < 0.70710678118654752444)
7487 +    {
7488 +      z *= 1.4142135623730950488;
7489 +      l -= 0.5;
7490 +    }
7491 +  if (z < 0.8408964152537145431)
7492 +    {
7493 +      z *= 1.1892071150027210667;
7494 +      l -= 0.25;
7495 +    }
7496 +  if (z < 0.91700404320467123175)
7497 +    {
7498 +      z *= 1.0905077326652576592;
7499 +      l -= 0.125;
7500 +    }
7501 +  if (z < 0.9576032806985736469)
7502 +    {
7503 +      z *= 1.0442737824274138403;
7504 +      l -= 0.0625;
7505 +    }
7506 +  /* Now 0.95 <= z <= 1.01.  */
7507 +  z = 1 - z;
7508 +  /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...)
7509 +     Four terms are enough to get an approximation with error < 10^-7.  */
7510 +  l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
7511 +  /* Finally multiply with log(2)/log(10), yields an approximation for
7512 +     log10(x).  */
7513 +  l *= 0.30102999566398119523;
7514 +  /* Round down to the next integer.  */
7515 +  return (int) l + (l < 0 ? -1 : 0);
7516 +}
7517 +
7518 +# endif
7519 +
7520 +/* Tests whether a string of digits consists of exactly PRECISION zeroes and
7521 +   a single '1' digit.  */
7522 +static int
7523 +is_borderline (const char *digits, size_t precision)
7524 +{
7525 +  for (; precision > 0; precision--, digits++)
7526 +    if (*digits != '0')
7527 +      return 0;
7528 +  if (*digits != '1')
7529 +    return 0;
7530 +  digits++;
7531 +  return *digits == '\0';
7532 +}
7533 +
7534 +#endif
7535 +
7536 +DCHAR_T *
7537 +VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
7538 +           const FCHAR_T *format, va_list args)
7539 +{
7540 +  DIRECTIVES d;
7541 +  arguments a;
7542 +
7543 +  if (PRINTF_PARSE (format, &d, &a) < 0)
7544 +    /* errno is already set.  */
7545 +    return NULL;
7546 +
7547 +#define CLEANUP() \
7548 +  free (d.dir);                                                                \
7549 +  if (a.arg)                                                           \
7550 +    free (a.arg);
7551 +
7552 +  if (PRINTF_FETCHARGS (args, &a) < 0)
7553 +    {
7554 +      CLEANUP ();
7555 +      errno = EINVAL;
7556 +      return NULL;
7557 +    }
7558 +
7559 +  {
7560 +    size_t buf_neededlength;
7561 +    TCHAR_T *buf;
7562 +    TCHAR_T *buf_malloced;
7563 +    const FCHAR_T *cp;
7564 +    size_t i;
7565 +    DIRECTIVE *dp;
7566 +    /* Output string accumulator.  */
7567 +    DCHAR_T *result;
7568 +    size_t allocated;
7569 +    size_t length;
7570 +
7571 +    /* Allocate a small buffer that will hold a directive passed to
7572 +       sprintf or snprintf.  */
7573 +    buf_neededlength =
7574 +      xsum4 (7, d.max_width_length, d.max_precision_length, 6);
7575 +#if HAVE_ALLOCA
7576 +    if (buf_neededlength < 4000 / sizeof (TCHAR_T))
7577 +      {
7578 +       buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
7579 +       buf_malloced = NULL;
7580 +      }
7581 +    else
7582 +#endif
7583 +      {
7584 +       size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
7585 +       if (size_overflow_p (buf_memsize))
7586 +         goto out_of_memory_1;
7587 +       buf = (TCHAR_T *) malloc (buf_memsize);
7588 +       if (buf == NULL)
7589 +         goto out_of_memory_1;
7590 +       buf_malloced = buf;
7591 +      }
7592 +
7593 +    if (resultbuf != NULL)
7594 +      {
7595 +       result = resultbuf;
7596 +       allocated = *lengthp;
7597 +      }
7598 +    else
7599 +      {
7600 +       result = NULL;
7601 +       allocated = 0;
7602 +      }
7603 +    length = 0;
7604 +    /* Invariants:
7605 +       result is either == resultbuf or == NULL or malloc-allocated.
7606 +       If length > 0, then result != NULL.  */
7607 +
7608 +    /* Ensures that allocated >= needed.  Aborts through a jump to
7609 +       out_of_memory if needed is SIZE_MAX or otherwise too big.  */
7610 +#define ENSURE_ALLOCATION(needed) \
7611 +    if ((needed) > allocated)                                               \
7612 +      {                                                                             \
7613 +       size_t memory_size;                                                  \
7614 +       DCHAR_T *memory;                                                     \
7615 +                                                                            \
7616 +       allocated = (allocated > 0 ? xtimes (allocated, 2) : 12);            \
7617 +       if ((needed) > allocated)                                            \
7618 +         allocated = (needed);                                              \
7619 +       memory_size = xtimes (allocated, sizeof (DCHAR_T));                  \
7620 +       if (size_overflow_p (memory_size))                                   \
7621 +         goto out_of_memory;                                                \
7622 +       if (result == resultbuf || result == NULL)                           \
7623 +         memory = (DCHAR_T *) malloc (memory_size);                         \
7624 +       else                                                                 \
7625 +         memory = (DCHAR_T *) realloc (result, memory_size);                \
7626 +       if (memory == NULL)                                                  \
7627 +         goto out_of_memory;                                                \
7628 +       if (result == resultbuf && length > 0)                               \
7629 +         DCHAR_CPY (memory, result, length);                                \
7630 +       result = memory;                                                     \
7631 +      }
7632 +
7633 +    for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
7634 +      {
7635 +       if (cp != dp->dir_start)
7636 +         {
7637 +           size_t n = dp->dir_start - cp;
7638 +           size_t augmented_length = xsum (length, n);
7639 +
7640 +           ENSURE_ALLOCATION (augmented_length);
7641 +           /* This copies a piece of FCHAR_T[] into a DCHAR_T[].  Here we
7642 +              need that the format string contains only ASCII characters
7643 +              if FCHAR_T and DCHAR_T are not the same type.  */
7644 +           if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
7645 +             {
7646 +               DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
7647 +               length = augmented_length;
7648 +             }
7649 +           else
7650 +             {
7651 +               do
7652 +                 result[length++] = (unsigned char) *cp++;
7653 +               while (--n > 0);
7654 +             }
7655 +         }
7656 +       if (i == d.count)
7657 +         break;
7658 +
7659 +       /* Execute a single directive.  */
7660 +       if (dp->conversion == '%')
7661 +         {
7662 +           size_t augmented_length;
7663 +
7664 +           if (!(dp->arg_index == ARG_NONE))
7665 +             abort ();
7666 +           augmented_length = xsum (length, 1);
7667 +           ENSURE_ALLOCATION (augmented_length);
7668 +           result[length] = '%';
7669 +           length = augmented_length;
7670 +         }
7671 +       else
7672 +         {
7673 +           if (!(dp->arg_index != ARG_NONE))
7674 +             abort ();
7675 +
7676 +           if (dp->conversion == 'n')
7677 +             {
7678 +               switch (a.arg[dp->arg_index].type)
7679 +                 {
7680 +                 case TYPE_COUNT_SCHAR_POINTER:
7681 +                   *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
7682 +                   break;
7683 +                 case TYPE_COUNT_SHORT_POINTER:
7684 +                   *a.arg[dp->arg_index].a.a_count_short_pointer = length;
7685 +                   break;
7686 +                 case TYPE_COUNT_INT_POINTER:
7687 +                   *a.arg[dp->arg_index].a.a_count_int_pointer = length;
7688 +                   break;
7689 +                 case TYPE_COUNT_LONGINT_POINTER:
7690 +                   *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
7691 +                   break;
7692 +#if HAVE_LONG_LONG_INT
7693 +                 case TYPE_COUNT_LONGLONGINT_POINTER:
7694 +                   *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
7695 +                   break;
7696 +#endif
7697 +                 default:
7698 +                   abort ();
7699 +                 }
7700 +             }
7701 +#if ENABLE_UNISTDIO
7702 +           /* The unistdio extensions.  */
7703 +           else if (dp->conversion == 'U')
7704 +             {
7705 +               arg_type type = a.arg[dp->arg_index].type;
7706 +               int flags = dp->flags;
7707 +               int has_width;
7708 +               size_t width;
7709 +               int has_precision;
7710 +               size_t precision;
7711 +
7712 +               has_width = 0;
7713 +               width = 0;
7714 +               if (dp->width_start != dp->width_end)
7715 +                 {
7716 +                   if (dp->width_arg_index != ARG_NONE)
7717 +                     {
7718 +                       int arg;
7719 +
7720 +                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
7721 +                         abort ();
7722 +                       arg = a.arg[dp->width_arg_index].a.a_int;
7723 +                       if (arg < 0)
7724 +                         {
7725 +                           /* "A negative field width is taken as a '-' flag
7726 +                               followed by a positive field width."  */
7727 +                           flags |= FLAG_LEFT;
7728 +                           width = (unsigned int) (-arg);
7729 +                         }
7730 +                       else
7731 +                         width = arg;
7732 +                     }
7733 +                   else
7734 +                     {
7735 +                       const FCHAR_T *digitp = dp->width_start;
7736 +
7737 +                       do
7738 +                         width = xsum (xtimes (width, 10), *digitp++ - '0');
7739 +                       while (digitp != dp->width_end);
7740 +                     }
7741 +                   has_width = 1;
7742 +                 }
7743 +
7744 +               has_precision = 0;
7745 +               precision = 0;
7746 +               if (dp->precision_start != dp->precision_end)
7747 +                 {
7748 +                   if (dp->precision_arg_index != ARG_NONE)
7749 +                     {
7750 +                       int arg;
7751 +
7752 +                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
7753 +                         abort ();
7754 +                       arg = a.arg[dp->precision_arg_index].a.a_int;
7755 +                       /* "A negative precision is taken as if the precision
7756 +                           were omitted."  */
7757 +                       if (arg >= 0)
7758 +                         {
7759 +                           precision = arg;
7760 +                           has_precision = 1;
7761 +                         }
7762 +                     }
7763 +                   else
7764 +                     {
7765 +                       const FCHAR_T *digitp = dp->precision_start + 1;
7766 +
7767 +                       precision = 0;
7768 +                       while (digitp != dp->precision_end)
7769 +                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
7770 +                       has_precision = 1;
7771 +                     }
7772 +                 }
7773 +
7774 +               switch (type)
7775 +                 {
7776 +                 case TYPE_U8_STRING:
7777 +                   {
7778 +                     const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
7779 +                     const uint8_t *arg_end;
7780 +                     size_t characters;
7781 +
7782 +                     if (has_precision)
7783 +                       {
7784 +                         /* Use only PRECISION characters, from the left.  */
7785 +                         arg_end = arg;
7786 +                         characters = 0;
7787 +                         for (; precision > 0; precision--)
7788 +                           {
7789 +                             int count = u8_strmblen (arg_end);
7790 +                             if (count == 0)
7791 +                               break;
7792 +                             if (count < 0)
7793 +                               {
7794 +                                 if (!(result == resultbuf || result == NULL))
7795 +                                   free (result);
7796 +                                 if (buf_malloced != NULL)
7797 +                                   free (buf_malloced);
7798 +                                 CLEANUP ();
7799 +                                 errno = EILSEQ;
7800 +                                 return NULL;
7801 +                               }
7802 +                             arg_end += count;
7803 +                             characters++;
7804 +                           }
7805 +                       }
7806 +                     else if (has_width)
7807 +                       {
7808 +                         /* Use the entire string, and count the number of
7809 +                            characters.  */
7810 +                         arg_end = arg;
7811 +                         characters = 0;
7812 +                         for (;;)
7813 +                           {
7814 +                             int count = u8_strmblen (arg_end);
7815 +                             if (count == 0)
7816 +                               break;
7817 +                             if (count < 0)
7818 +                               {
7819 +                                 if (!(result == resultbuf || result == NULL))
7820 +                                   free (result);
7821 +                                 if (buf_malloced != NULL)
7822 +                                   free (buf_malloced);
7823 +                                 CLEANUP ();
7824 +                                 errno = EILSEQ;
7825 +                                 return NULL;
7826 +                               }
7827 +                             arg_end += count;
7828 +                             characters++;
7829 +                           }
7830 +                       }
7831 +                     else
7832 +                       {
7833 +                         /* Use the entire string.  */
7834 +                         arg_end = arg + u8_strlen (arg);
7835 +                         /* The number of characters doesn't matter.  */
7836 +                         characters = 0;
7837 +                       }
7838 +
7839 +                     if (has_width && width > characters
7840 +                         && !(dp->flags & FLAG_LEFT))
7841 +                       {
7842 +                         size_t n = width - characters;
7843 +                         ENSURE_ALLOCATION (xsum (length, n));
7844 +                         DCHAR_SET (result + length, ' ', n);
7845 +                         length += n;
7846 +                       }
7847 +
7848 +# if DCHAR_IS_UINT8_T
7849 +                     {
7850 +                       size_t n = arg_end - arg;
7851 +                       ENSURE_ALLOCATION (xsum (length, n));
7852 +                       DCHAR_CPY (result + length, arg, n);
7853 +                       length += n;
7854 +                     }
7855 +# else
7856 +                     { /* Convert.  */
7857 +                       DCHAR_T *converted = result + length;
7858 +                       size_t converted_len = allocated - length;
7859 +#  if DCHAR_IS_TCHAR
7860 +                       /* Convert from UTF-8 to locale encoding.  */
7861 +                       if (u8_conv_to_encoding (locale_charset (),
7862 +                                                iconveh_question_mark,
7863 +                                                arg, arg_end - arg, NULL,
7864 +                                                &converted, &converted_len)
7865 +                           < 0)
7866 +#  else
7867 +                       /* Convert from UTF-8 to UTF-16/UTF-32.  */
7868 +                       converted =
7869 +                         U8_TO_DCHAR (arg, arg_end - arg,
7870 +                                      converted, &converted_len);
7871 +                       if (converted == NULL)
7872 +#  endif
7873 +                         {
7874 +                           int saved_errno = errno;
7875 +                           if (!(result == resultbuf || result == NULL))
7876 +                             free (result);
7877 +                           if (buf_malloced != NULL)
7878 +                             free (buf_malloced);
7879 +                           CLEANUP ();
7880 +                           errno = saved_errno;
7881 +                           return NULL;
7882 +                         }
7883 +                       if (converted != result + length)
7884 +                         {
7885 +                           ENSURE_ALLOCATION (xsum (length, converted_len));
7886 +                           DCHAR_CPY (result + length, converted, converted_len);
7887 +                           free (converted);
7888 +                         }
7889 +                       length += converted_len;
7890 +                     }
7891 +# endif
7892 +
7893 +                     if (has_width && width > characters
7894 +                         && (dp->flags & FLAG_LEFT))
7895 +                       {
7896 +                         size_t n = width - characters;
7897 +                         ENSURE_ALLOCATION (xsum (length, n));
7898 +                         DCHAR_SET (result + length, ' ', n);
7899 +                         length += n;
7900 +                       }
7901 +                   }
7902 +                   break;
7903 +
7904 +                 case TYPE_U16_STRING:
7905 +                   {
7906 +                     const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string;
7907 +                     const uint16_t *arg_end;
7908 +                     size_t characters;
7909 +
7910 +                     if (has_precision)
7911 +                       {
7912 +                         /* Use only PRECISION characters, from the left.  */
7913 +                         arg_end = arg;
7914 +                         characters = 0;
7915 +                         for (; precision > 0; precision--)
7916 +                           {
7917 +                             int count = u16_strmblen (arg_end);
7918 +                             if (count == 0)
7919 +                               break;
7920 +                             if (count < 0)
7921 +                               {
7922 +                                 if (!(result == resultbuf || result == NULL))
7923 +                                   free (result);
7924 +                                 if (buf_malloced != NULL)
7925 +                                   free (buf_malloced);
7926 +                                 CLEANUP ();
7927 +                                 errno = EILSEQ;
7928 +                                 return NULL;
7929 +                               }
7930 +                             arg_end += count;
7931 +                             characters++;
7932 +                           }
7933 +                       }
7934 +                     else if (has_width)
7935 +                       {
7936 +                         /* Use the entire string, and count the number of
7937 +                            characters.  */
7938 +                         arg_end = arg;
7939 +                         characters = 0;
7940 +                         for (;;)
7941 +                           {
7942 +                             int count = u16_strmblen (arg_end);
7943 +                             if (count == 0)
7944 +                               break;
7945 +                             if (count < 0)
7946 +                               {
7947 +                                 if (!(result == resultbuf || result == NULL))
7948 +                                   free (result);
7949 +                                 if (buf_malloced != NULL)
7950 +                                   free (buf_malloced);
7951 +                                 CLEANUP ();
7952 +                                 errno = EILSEQ;
7953 +                                 return NULL;
7954 +                               }
7955 +                             arg_end += count;
7956 +                             characters++;
7957 +                           }
7958 +                       }
7959 +                     else
7960 +                       {
7961 +                         /* Use the entire string.  */
7962 +                         arg_end = arg + u16_strlen (arg);
7963 +                         /* The number of characters doesn't matter.  */
7964 +                         characters = 0;
7965 +                       }
7966 +
7967 +                     if (has_width && width > characters
7968 +                         && !(dp->flags & FLAG_LEFT))
7969 +                       {
7970 +                         size_t n = width - characters;
7971 +                         ENSURE_ALLOCATION (xsum (length, n));
7972 +                         DCHAR_SET (result + length, ' ', n);
7973 +                         length += n;
7974 +                       }
7975 +
7976 +# if DCHAR_IS_UINT16_T
7977 +                     {
7978 +                       size_t n = arg_end - arg;
7979 +                       ENSURE_ALLOCATION (xsum (length, n));
7980 +                       DCHAR_CPY (result + length, arg, n);
7981 +                       length += n;
7982 +                     }
7983 +# else
7984 +                     { /* Convert.  */
7985 +                       DCHAR_T *converted = result + length;
7986 +                       size_t converted_len = allocated - length;
7987 +#  if DCHAR_IS_TCHAR
7988 +                       /* Convert from UTF-16 to locale encoding.  */
7989 +                       if (u16_conv_to_encoding (locale_charset (),
7990 +                                                 iconveh_question_mark,
7991 +                                                 arg, arg_end - arg, NULL,
7992 +                                                 &converted, &converted_len)
7993 +                           < 0)
7994 +#  else
7995 +                       /* Convert from UTF-16 to UTF-8/UTF-32.  */
7996 +                       converted =
7997 +                         U16_TO_DCHAR (arg, arg_end - arg,
7998 +                                       converted, &converted_len);
7999 +                       if (converted == NULL)
8000 +#  endif
8001 +                         {
8002 +                           int saved_errno = errno;
8003 +                           if (!(result == resultbuf || result == NULL))
8004 +                             free (result);
8005 +                           if (buf_malloced != NULL)
8006 +                             free (buf_malloced);
8007 +                           CLEANUP ();
8008 +                           errno = saved_errno;
8009 +                           return NULL;
8010 +                         }
8011 +                       if (converted != result + length)
8012 +                         {
8013 +                           ENSURE_ALLOCATION (xsum (length, converted_len));
8014 +                           DCHAR_CPY (result + length, converted, converted_len);
8015 +                           free (converted);
8016 +                         }
8017 +                       length += converted_len;
8018 +                     }
8019 +# endif
8020 +
8021 +                     if (has_width && width > characters
8022 +                         && (dp->flags & FLAG_LEFT))
8023 +                       {
8024 +                         size_t n = width - characters;
8025 +                         ENSURE_ALLOCATION (xsum (length, n));
8026 +                         DCHAR_SET (result + length, ' ', n);
8027 +                         length += n;
8028 +                       }
8029 +                   }
8030 +                   break;
8031 +
8032 +                 case TYPE_U32_STRING:
8033 +                   {
8034 +                     const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string;
8035 +                     const uint32_t *arg_end;
8036 +                     size_t characters;
8037 +
8038 +                     if (has_precision)
8039 +                       {
8040 +                         /* Use only PRECISION characters, from the left.  */
8041 +                         arg_end = arg;
8042 +                         characters = 0;
8043 +                         for (; precision > 0; precision--)
8044 +                           {
8045 +                             int count = u32_strmblen (arg_end);
8046 +                             if (count == 0)
8047 +                               break;
8048 +                             if (count < 0)
8049 +                               {
8050 +                                 if (!(result == resultbuf || result == NULL))
8051 +                                   free (result);
8052 +                                 if (buf_malloced != NULL)
8053 +                                   free (buf_malloced);
8054 +                                 CLEANUP ();
8055 +                                 errno = EILSEQ;
8056 +                                 return NULL;
8057 +                               }
8058 +                             arg_end += count;
8059 +                             characters++;
8060 +                           }
8061 +                       }
8062 +                     else if (has_width)
8063 +                       {
8064 +                         /* Use the entire string, and count the number of
8065 +                            characters.  */
8066 +                         arg_end = arg;
8067 +                         characters = 0;
8068 +                         for (;;)
8069 +                           {
8070 +                             int count = u32_strmblen (arg_end);
8071 +                             if (count == 0)
8072 +                               break;
8073 +                             if (count < 0)
8074 +                               {
8075 +                                 if (!(result == resultbuf || result == NULL))
8076 +                                   free (result);
8077 +                                 if (buf_malloced != NULL)
8078 +                                   free (buf_malloced);
8079 +                                 CLEANUP ();
8080 +                                 errno = EILSEQ;
8081 +                                 return NULL;
8082 +                               }
8083 +                             arg_end += count;
8084 +                             characters++;
8085 +                           }
8086 +                       }
8087 +                     else
8088 +                       {
8089 +                         /* Use the entire string.  */
8090 +                         arg_end = arg + u32_strlen (arg);
8091 +                         /* The number of characters doesn't matter.  */
8092 +                         characters = 0;
8093 +                       }
8094 +
8095 +                     if (has_width && width > characters
8096 +                         && !(dp->flags & FLAG_LEFT))
8097 +                       {
8098 +                         size_t n = width - characters;
8099 +                         ENSURE_ALLOCATION (xsum (length, n));
8100 +                         DCHAR_SET (result + length, ' ', n);
8101 +                         length += n;
8102 +                       }
8103 +
8104 +# if DCHAR_IS_UINT32_T
8105 +                     {
8106 +                       size_t n = arg_end - arg;
8107 +                       ENSURE_ALLOCATION (xsum (length, n));
8108 +                       DCHAR_CPY (result + length, arg, n);
8109 +                       length += n;
8110 +                     }
8111 +# else
8112 +                     { /* Convert.  */
8113 +                       DCHAR_T *converted = result + length;
8114 +                       size_t converted_len = allocated - length;
8115 +#  if DCHAR_IS_TCHAR
8116 +                       /* Convert from UTF-32 to locale encoding.  */
8117 +                       if (u32_conv_to_encoding (locale_charset (),
8118 +                                                 iconveh_question_mark,
8119 +                                                 arg, arg_end - arg, NULL,
8120 +                                                 &converted, &converted_len)
8121 +                           < 0)
8122 +#  else
8123 +                       /* Convert from UTF-32 to UTF-8/UTF-16.  */
8124 +                       converted =
8125 +                         U32_TO_DCHAR (arg, arg_end - arg,
8126 +                                       converted, &converted_len);
8127 +                       if (converted == NULL)
8128 +#  endif
8129 +                         {
8130 +                           int saved_errno = errno;
8131 +                           if (!(result == resultbuf || result == NULL))
8132 +                             free (result);
8133 +                           if (buf_malloced != NULL)
8134 +                             free (buf_malloced);
8135 +                           CLEANUP ();
8136 +                           errno = saved_errno;
8137 +                           return NULL;
8138 +                         }
8139 +                       if (converted != result + length)
8140 +                         {
8141 +                           ENSURE_ALLOCATION (xsum (length, converted_len));
8142 +                           DCHAR_CPY (result + length, converted, converted_len);
8143 +                           free (converted);
8144 +                         }
8145 +                       length += converted_len;
8146 +                     }
8147 +# endif
8148 +
8149 +                     if (has_width && width > characters
8150 +                         && (dp->flags & FLAG_LEFT))
8151 +                       {
8152 +                         size_t n = width - characters;
8153 +                         ENSURE_ALLOCATION (xsum (length, n));
8154 +                         DCHAR_SET (result + length, ' ', n);
8155 +                         length += n;
8156 +                       }
8157 +                   }
8158 +                   break;
8159 +
8160 +                 default:
8161 +                   abort ();
8162 +                 }
8163 +             }
8164 +#endif
8165 +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
8166 +           else if ((dp->conversion == 'a' || dp->conversion == 'A')
8167 +# if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE))
8168 +                    && (0
8169 +#  if NEED_PRINTF_DOUBLE
8170 +                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
8171 +#  endif
8172 +#  if NEED_PRINTF_LONG_DOUBLE
8173 +                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
8174 +#  endif
8175 +                       )
8176 +# endif
8177 +                   )
8178 +             {
8179 +               arg_type type = a.arg[dp->arg_index].type;
8180 +               int flags = dp->flags;
8181 +               int has_width;
8182 +               size_t width;
8183 +               int has_precision;
8184 +               size_t precision;
8185 +               size_t tmp_length;
8186 +               DCHAR_T tmpbuf[700];
8187 +               DCHAR_T *tmp;
8188 +               DCHAR_T *pad_ptr;
8189 +               DCHAR_T *p;
8190 +
8191 +               has_width = 0;
8192 +               width = 0;
8193 +               if (dp->width_start != dp->width_end)
8194 +                 {
8195 +                   if (dp->width_arg_index != ARG_NONE)
8196 +                     {
8197 +                       int arg;
8198 +
8199 +                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
8200 +                         abort ();
8201 +                       arg = a.arg[dp->width_arg_index].a.a_int;
8202 +                       if (arg < 0)
8203 +                         {
8204 +                           /* "A negative field width is taken as a '-' flag
8205 +                               followed by a positive field width."  */
8206 +                           flags |= FLAG_LEFT;
8207 +                           width = (unsigned int) (-arg);
8208 +                         }
8209 +                       else
8210 +                         width = arg;
8211 +                     }
8212 +                   else
8213 +                     {
8214 +                       const FCHAR_T *digitp = dp->width_start;
8215 +
8216 +                       do
8217 +                         width = xsum (xtimes (width, 10), *digitp++ - '0');
8218 +                       while (digitp != dp->width_end);
8219 +                     }
8220 +                   has_width = 1;
8221 +                 }
8222 +
8223 +               has_precision = 0;
8224 +               precision = 0;
8225 +               if (dp->precision_start != dp->precision_end)
8226 +                 {
8227 +                   if (dp->precision_arg_index != ARG_NONE)
8228 +                     {
8229 +                       int arg;
8230 +
8231 +                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
8232 +                         abort ();
8233 +                       arg = a.arg[dp->precision_arg_index].a.a_int;
8234 +                       /* "A negative precision is taken as if the precision
8235 +                           were omitted."  */
8236 +                       if (arg >= 0)
8237 +                         {
8238 +                           precision = arg;
8239 +                           has_precision = 1;
8240 +                         }
8241 +                     }
8242 +                   else
8243 +                     {
8244 +                       const FCHAR_T *digitp = dp->precision_start + 1;
8245 +
8246 +                       precision = 0;
8247 +                       while (digitp != dp->precision_end)
8248 +                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
8249 +                       has_precision = 1;
8250 +                     }
8251 +                 }
8252 +
8253 +               /* Allocate a temporary buffer of sufficient size.  */
8254 +               if (type == TYPE_LONGDOUBLE)
8255 +                 tmp_length =
8256 +                   (unsigned int) ((LDBL_DIG + 1)
8257 +                                   * 0.831 /* decimal -> hexadecimal */
8258 +                                  )
8259 +                   + 1; /* turn floor into ceil */
8260 +               else
8261 +                 tmp_length =
8262 +                   (unsigned int) ((DBL_DIG + 1)
8263 +                                   * 0.831 /* decimal -> hexadecimal */
8264 +                                  )
8265 +                   + 1; /* turn floor into ceil */
8266 +               if (tmp_length < precision)
8267 +                 tmp_length = precision;
8268 +               /* Account for sign, decimal point etc. */
8269 +               tmp_length = xsum (tmp_length, 12);
8270 +
8271 +               if (tmp_length < width)
8272 +                 tmp_length = width;
8273 +
8274 +               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
8275 +
8276 +               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
8277 +                 tmp = tmpbuf;
8278 +               else
8279 +                 {
8280 +                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
8281 +
8282 +                   if (size_overflow_p (tmp_memsize))
8283 +                     /* Overflow, would lead to out of memory.  */
8284 +                     goto out_of_memory;
8285 +                   tmp = (DCHAR_T *) malloc (tmp_memsize);
8286 +                   if (tmp == NULL)
8287 +                     /* Out of memory.  */
8288 +                     goto out_of_memory;
8289 +                 }
8290 +
8291 +               pad_ptr = NULL;
8292 +               p = tmp;
8293 +               if (type == TYPE_LONGDOUBLE)
8294 +                 {
8295 +# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE
8296 +                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
8297 +
8298 +                   if (isnanl (arg))
8299 +                     {
8300 +                       if (dp->conversion == 'A')
8301 +                         {
8302 +                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
8303 +                         }
8304 +                       else
8305 +                         {
8306 +                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
8307 +                         }
8308 +                     }
8309 +                   else
8310 +                     {
8311 +                       int sign = 0;
8312 +                       DECL_LONG_DOUBLE_ROUNDING
8313 +
8314 +                       BEGIN_LONG_DOUBLE_ROUNDING ();
8315 +
8316 +                       if (signbit (arg)) /* arg < 0.0L or negative zero */
8317 +                         {
8318 +                           sign = -1;
8319 +                           arg = -arg;
8320 +                         }
8321 +
8322 +                       if (sign < 0)
8323 +                         *p++ = '-';
8324 +                       else if (flags & FLAG_SHOWSIGN)
8325 +                         *p++ = '+';
8326 +                       else if (flags & FLAG_SPACE)
8327 +                         *p++ = ' ';
8328 +
8329 +                       if (arg > 0.0L && arg + arg == arg)
8330 +                         {
8331 +                           if (dp->conversion == 'A')
8332 +                             {
8333 +                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
8334 +                             }
8335 +                           else
8336 +                             {
8337 +                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
8338 +                             }
8339 +                         }
8340 +                       else
8341 +                         {
8342 +                           int exponent;
8343 +                           long double mantissa;
8344 +
8345 +                           if (arg > 0.0L)
8346 +                             mantissa = printf_frexpl (arg, &exponent);
8347 +                           else
8348 +                             {
8349 +                               exponent = 0;
8350 +                               mantissa = 0.0L;
8351 +                             }
8352 +
8353 +                           if (has_precision
8354 +                               && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1)
8355 +                             {
8356 +                               /* Round the mantissa.  */
8357 +                               long double tail = mantissa;
8358 +                               size_t q;
8359 +
8360 +                               for (q = precision; ; q--)
8361 +                                 {
8362 +                                   int digit = (int) tail;
8363 +                                   tail -= digit;
8364 +                                   if (q == 0)
8365 +                                     {
8366 +                                       if (digit & 1 ? tail >= 0.5L : tail > 0.5L)
8367 +                                         tail = 1 - tail;
8368 +                                       else
8369 +                                         tail = - tail;
8370 +                                       break;
8371 +                                     }
8372 +                                   tail *= 16.0L;
8373 +                                 }
8374 +                               if (tail != 0.0L)
8375 +                                 for (q = precision; q > 0; q--)
8376 +                                   tail *= 0.0625L;
8377 +                               mantissa += tail;
8378 +                             }
8379 +
8380 +                           *p++ = '0';
8381 +                           *p++ = dp->conversion - 'A' + 'X';
8382 +                           pad_ptr = p;
8383 +                           {
8384 +                             int digit;
8385 +
8386 +                             digit = (int) mantissa;
8387 +                             mantissa -= digit;
8388 +                             *p++ = '0' + digit;
8389 +                             if ((flags & FLAG_ALT)
8390 +                                 || mantissa > 0.0L || precision > 0)
8391 +                               {
8392 +                                 *p++ = decimal_point_char ();
8393 +                                 /* This loop terminates because we assume
8394 +                                    that FLT_RADIX is a power of 2.  */
8395 +                                 while (mantissa > 0.0L)
8396 +                                   {
8397 +                                     mantissa *= 16.0L;
8398 +                                     digit = (int) mantissa;
8399 +                                     mantissa -= digit;
8400 +                                     *p++ = digit
8401 +                                            + (digit < 10
8402 +                                               ? '0'
8403 +                                               : dp->conversion - 10);
8404 +                                     if (precision > 0)
8405 +                                       precision--;
8406 +                                   }
8407 +                                 while (precision > 0)
8408 +                                   {
8409 +                                     *p++ = '0';
8410 +                                     precision--;
8411 +                                   }
8412 +                               }
8413 +                             }
8414 +                             *p++ = dp->conversion - 'A' + 'P';
8415 +#  if WIDE_CHAR_VERSION
8416 +                             {
8417 +                               static const wchar_t decimal_format[] =
8418 +                                 { '%', '+', 'd', '\0' };
8419 +                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
8420 +                             }
8421 +                             while (*p != '\0')
8422 +                               p++;
8423 +#  else
8424 +                             if (sizeof (DCHAR_T) == 1)
8425 +                               {
8426 +                                 sprintf ((char *) p, "%+d", exponent);
8427 +                                 while (*p != '\0')
8428 +                                   p++;
8429 +                               }
8430 +                             else
8431 +                               {
8432 +                                 char expbuf[6 + 1];
8433 +                                 const char *ep;
8434 +                                 sprintf (expbuf, "%+d", exponent);
8435 +                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
8436 +                                   p++;
8437 +                               }
8438 +#  endif
8439 +                         }
8440 +
8441 +                       END_LONG_DOUBLE_ROUNDING ();
8442 +                     }
8443 +# else
8444 +                   abort ();
8445 +# endif
8446 +                 }
8447 +               else
8448 +                 {
8449 +# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE
8450 +                   double arg = a.arg[dp->arg_index].a.a_double;
8451 +
8452 +                   if (isnand (arg))
8453 +                     {
8454 +                       if (dp->conversion == 'A')
8455 +                         {
8456 +                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
8457 +                         }
8458 +                       else
8459 +                         {
8460 +                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
8461 +                         }
8462 +                     }
8463 +                   else
8464 +                     {
8465 +                       int sign = 0;
8466 +
8467 +                       if (signbit (arg)) /* arg < 0.0 or negative zero */
8468 +                         {
8469 +                           sign = -1;
8470 +                           arg = -arg;
8471 +                         }
8472 +
8473 +                       if (sign < 0)
8474 +                         *p++ = '-';
8475 +                       else if (flags & FLAG_SHOWSIGN)
8476 +                         *p++ = '+';
8477 +                       else if (flags & FLAG_SPACE)
8478 +                         *p++ = ' ';
8479 +
8480 +                       if (arg > 0.0 && arg + arg == arg)
8481 +                         {
8482 +                           if (dp->conversion == 'A')
8483 +                             {
8484 +                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
8485 +                             }
8486 +                           else
8487 +                             {
8488 +                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
8489 +                             }
8490 +                         }
8491 +                       else
8492 +                         {
8493 +                           int exponent;
8494 +                           double mantissa;
8495 +
8496 +                           if (arg > 0.0)
8497 +                             mantissa = printf_frexp (arg, &exponent);
8498 +                           else
8499 +                             {
8500 +                               exponent = 0;
8501 +                               mantissa = 0.0;
8502 +                             }
8503 +
8504 +                           if (has_precision
8505 +                               && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1)
8506 +                             {
8507 +                               /* Round the mantissa.  */
8508 +                               double tail = mantissa;
8509 +                               size_t q;
8510 +
8511 +                               for (q = precision; ; q--)
8512 +                                 {
8513 +                                   int digit = (int) tail;
8514 +                                   tail -= digit;
8515 +                                   if (q == 0)
8516 +                                     {
8517 +                                       if (digit & 1 ? tail >= 0.5 : tail > 0.5)
8518 +                                         tail = 1 - tail;
8519 +                                       else
8520 +                                         tail = - tail;
8521 +                                       break;
8522 +                                     }
8523 +                                   tail *= 16.0;
8524 +                                 }
8525 +                               if (tail != 0.0)
8526 +                                 for (q = precision; q > 0; q--)
8527 +                                   tail *= 0.0625;
8528 +                               mantissa += tail;
8529 +                             }
8530 +
8531 +                           *p++ = '0';
8532 +                           *p++ = dp->conversion - 'A' + 'X';
8533 +                           pad_ptr = p;
8534 +                           {
8535 +                             int digit;
8536 +
8537 +                             digit = (int) mantissa;
8538 +                             mantissa -= digit;
8539 +                             *p++ = '0' + digit;
8540 +                             if ((flags & FLAG_ALT)
8541 +                                 || mantissa > 0.0 || precision > 0)
8542 +                               {
8543 +                                 *p++ = decimal_point_char ();
8544 +                                 /* This loop terminates because we assume
8545 +                                    that FLT_RADIX is a power of 2.  */
8546 +                                 while (mantissa > 0.0)
8547 +                                   {
8548 +                                     mantissa *= 16.0;
8549 +                                     digit = (int) mantissa;
8550 +                                     mantissa -= digit;
8551 +                                     *p++ = digit
8552 +                                            + (digit < 10
8553 +                                               ? '0'
8554 +                                               : dp->conversion - 10);
8555 +                                     if (precision > 0)
8556 +                                       precision--;
8557 +                                   }
8558 +                                 while (precision > 0)
8559 +                                   {
8560 +                                     *p++ = '0';
8561 +                                     precision--;
8562 +                                   }
8563 +                               }
8564 +                             }
8565 +                             *p++ = dp->conversion - 'A' + 'P';
8566 +#  if WIDE_CHAR_VERSION
8567 +                             {
8568 +                               static const wchar_t decimal_format[] =
8569 +                                 { '%', '+', 'd', '\0' };
8570 +                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
8571 +                             }
8572 +                             while (*p != '\0')
8573 +                               p++;
8574 +#  else
8575 +                             if (sizeof (DCHAR_T) == 1)
8576 +                               {
8577 +                                 sprintf ((char *) p, "%+d", exponent);
8578 +                                 while (*p != '\0')
8579 +                                   p++;
8580 +                               }
8581 +                             else
8582 +                               {
8583 +                                 char expbuf[6 + 1];
8584 +                                 const char *ep;
8585 +                                 sprintf (expbuf, "%+d", exponent);
8586 +                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
8587 +                                   p++;
8588 +                               }
8589 +#  endif
8590 +                         }
8591 +                     }
8592 +# else
8593 +                   abort ();
8594 +# endif
8595 +                 }
8596 +               /* The generated string now extends from tmp to p, with the
8597 +                  zero padding insertion point being at pad_ptr.  */
8598 +               if (has_width && p - tmp < width)
8599 +                 {
8600 +                   size_t pad = width - (p - tmp);
8601 +                   DCHAR_T *end = p + pad;
8602 +
8603 +                   if (flags & FLAG_LEFT)
8604 +                     {
8605 +                       /* Pad with spaces on the right.  */
8606 +                       for (; pad > 0; pad--)
8607 +                         *p++ = ' ';
8608 +                     }
8609 +                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
8610 +                     {
8611 +                       /* Pad with zeroes.  */
8612 +                       DCHAR_T *q = end;
8613 +
8614 +                       while (p > pad_ptr)
8615 +                         *--q = *--p;
8616 +                       for (; pad > 0; pad--)
8617 +                         *p++ = '0';
8618 +                     }
8619 +                   else
8620 +                     {
8621 +                       /* Pad with spaces on the left.  */
8622 +                       DCHAR_T *q = end;
8623 +
8624 +                       while (p > tmp)
8625 +                         *--q = *--p;
8626 +                       for (; pad > 0; pad--)
8627 +                         *p++ = ' ';
8628 +                     }
8629 +
8630 +                   p = end;
8631 +                 }
8632 +
8633 +               {
8634 +                 size_t count = p - tmp;
8635 +
8636 +                 if (count >= tmp_length)
8637 +                   /* tmp_length was incorrectly calculated - fix the
8638 +                      code above!  */
8639 +                   abort ();
8640 +
8641 +                 /* Make room for the result.  */
8642 +                 if (count >= allocated - length)
8643 +                   {
8644 +                     size_t n = xsum (length, count);
8645 +
8646 +                     ENSURE_ALLOCATION (n);
8647 +                   }
8648 +
8649 +                 /* Append the result.  */
8650 +                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
8651 +                 if (tmp != tmpbuf)
8652 +                   free (tmp);
8653 +                 length += count;
8654 +               }
8655 +             }
8656 +#endif
8657 +#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
8658 +           else if ((dp->conversion == 'f' || dp->conversion == 'F'
8659 +                     || dp->conversion == 'e' || dp->conversion == 'E'
8660 +                     || dp->conversion == 'g' || dp->conversion == 'G'
8661 +                     || dp->conversion == 'a' || dp->conversion == 'A')
8662 +                    && (0
8663 +# if NEED_PRINTF_DOUBLE
8664 +                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
8665 +# elif NEED_PRINTF_INFINITE_DOUBLE
8666 +                        || (a.arg[dp->arg_index].type == TYPE_DOUBLE
8667 +                            /* The systems (mingw) which produce wrong output
8668 +                               for Inf, -Inf, and NaN also do so for -0.0.
8669 +                               Therefore we treat this case here as well.  */
8670 +                            && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double))
8671 +# endif
8672 +# if NEED_PRINTF_LONG_DOUBLE
8673 +                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
8674 +# elif NEED_PRINTF_INFINITE_LONG_DOUBLE
8675 +                        || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
8676 +                            /* Some systems produce wrong output for Inf,
8677 +                               -Inf, and NaN.  Some systems in this category
8678 +                               (IRIX 5.3) also do so for -0.0.  Therefore we
8679 +                               treat this case here as well.  */
8680 +                            && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble))
8681 +# endif
8682 +                       ))
8683 +             {
8684 +# if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE)
8685 +               arg_type type = a.arg[dp->arg_index].type;
8686 +# endif
8687 +               int flags = dp->flags;
8688 +               int has_width;
8689 +               size_t width;
8690 +               int has_precision;
8691 +               size_t precision;
8692 +               size_t tmp_length;
8693 +               DCHAR_T tmpbuf[700];
8694 +               DCHAR_T *tmp;
8695 +               DCHAR_T *pad_ptr;
8696 +               DCHAR_T *p;
8697 +
8698 +               has_width = 0;
8699 +               width = 0;
8700 +               if (dp->width_start != dp->width_end)
8701 +                 {
8702 +                   if (dp->width_arg_index != ARG_NONE)
8703 +                     {
8704 +                       int arg;
8705 +
8706 +                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
8707 +                         abort ();
8708 +                       arg = a.arg[dp->width_arg_index].a.a_int;
8709 +                       if (arg < 0)
8710 +                         {
8711 +                           /* "A negative field width is taken as a '-' flag
8712 +                               followed by a positive field width."  */
8713 +                           flags |= FLAG_LEFT;
8714 +                           width = (unsigned int) (-arg);
8715 +                         }
8716 +                       else
8717 +                         width = arg;
8718 +                     }
8719 +                   else
8720 +                     {
8721 +                       const FCHAR_T *digitp = dp->width_start;
8722 +
8723 +                       do
8724 +                         width = xsum (xtimes (width, 10), *digitp++ - '0');
8725 +                       while (digitp != dp->width_end);
8726 +                     }
8727 +                   has_width = 1;
8728 +                 }
8729 +
8730 +               has_precision = 0;
8731 +               precision = 0;
8732 +               if (dp->precision_start != dp->precision_end)
8733 +                 {
8734 +                   if (dp->precision_arg_index != ARG_NONE)
8735 +                     {
8736 +                       int arg;
8737 +
8738 +                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
8739 +                         abort ();
8740 +                       arg = a.arg[dp->precision_arg_index].a.a_int;
8741 +                       /* "A negative precision is taken as if the precision
8742 +                           were omitted."  */
8743 +                       if (arg >= 0)
8744 +                         {
8745 +                           precision = arg;
8746 +                           has_precision = 1;
8747 +                         }
8748 +                     }
8749 +                   else
8750 +                     {
8751 +                       const FCHAR_T *digitp = dp->precision_start + 1;
8752 +
8753 +                       precision = 0;
8754 +                       while (digitp != dp->precision_end)
8755 +                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
8756 +                       has_precision = 1;
8757 +                     }
8758 +                 }
8759 +
8760 +               /* POSIX specifies the default precision to be 6 for %f, %F,
8761 +                  %e, %E, but not for %g, %G.  Implementations appear to use
8762 +                  the same default precision also for %g, %G.  But for %a, %A,
8763 +                  the default precision is 0.  */
8764 +               if (!has_precision)
8765 +                 if (!(dp->conversion == 'a' || dp->conversion == 'A'))
8766 +                   precision = 6;
8767 +
8768 +               /* Allocate a temporary buffer of sufficient size.  */
8769 +# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
8770 +               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1);
8771 +# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
8772 +               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
8773 +# elif NEED_PRINTF_LONG_DOUBLE
8774 +               tmp_length = LDBL_DIG + 1;
8775 +# elif NEED_PRINTF_DOUBLE
8776 +               tmp_length = DBL_DIG + 1;
8777 +# else
8778 +               tmp_length = 0;
8779 +# endif
8780 +               if (tmp_length < precision)
8781 +                 tmp_length = precision;
8782 +# if NEED_PRINTF_LONG_DOUBLE
8783 +#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
8784 +               if (type == TYPE_LONGDOUBLE)
8785 +#  endif
8786 +                 if (dp->conversion == 'f' || dp->conversion == 'F')
8787 +                   {
8788 +                     long double arg = a.arg[dp->arg_index].a.a_longdouble;
8789 +                     if (!(isnanl (arg) || arg + arg == arg))
8790 +                       {
8791 +                         /* arg is finite and nonzero.  */
8792 +                         int exponent = floorlog10l (arg < 0 ? -arg : arg);
8793 +                         if (exponent >= 0 && tmp_length < exponent + precision)
8794 +                           tmp_length = exponent + precision;
8795 +                       }
8796 +                   }
8797 +# endif
8798 +# if NEED_PRINTF_DOUBLE
8799 +#  if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
8800 +               if (type == TYPE_DOUBLE)
8801 +#  endif
8802 +                 if (dp->conversion == 'f' || dp->conversion == 'F')
8803 +                   {
8804 +                     double arg = a.arg[dp->arg_index].a.a_double;
8805 +                     if (!(isnand (arg) || arg + arg == arg))
8806 +                       {
8807 +                         /* arg is finite and nonzero.  */
8808 +                         int exponent = floorlog10 (arg < 0 ? -arg : arg);
8809 +                         if (exponent >= 0 && tmp_length < exponent + precision)
8810 +                           tmp_length = exponent + precision;
8811 +                       }
8812 +                   }
8813 +# endif
8814 +               /* Account for sign, decimal point etc. */
8815 +               tmp_length = xsum (tmp_length, 12);
8816 +
8817 +               if (tmp_length < width)
8818 +                 tmp_length = width;
8819 +
8820 +               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
8821 +
8822 +               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
8823 +                 tmp = tmpbuf;
8824 +               else
8825 +                 {
8826 +                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
8827 +
8828 +                   if (size_overflow_p (tmp_memsize))
8829 +                     /* Overflow, would lead to out of memory.  */
8830 +                     goto out_of_memory;
8831 +                   tmp = (DCHAR_T *) malloc (tmp_memsize);
8832 +                   if (tmp == NULL)
8833 +                     /* Out of memory.  */
8834 +                     goto out_of_memory;
8835 +                 }
8836 +
8837 +               pad_ptr = NULL;
8838 +               p = tmp;
8839 +
8840 +# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
8841 +#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
8842 +               if (type == TYPE_LONGDOUBLE)
8843 +#  endif
8844 +                 {
8845 +                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
8846 +
8847 +                   if (isnanl (arg))
8848 +                     {
8849 +                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
8850 +                         {
8851 +                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
8852 +                         }
8853 +                       else
8854 +                         {
8855 +                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
8856 +                         }
8857 +                     }
8858 +                   else
8859 +                     {
8860 +                       int sign = 0;
8861 +                       DECL_LONG_DOUBLE_ROUNDING
8862 +
8863 +                       BEGIN_LONG_DOUBLE_ROUNDING ();
8864 +
8865 +                       if (signbit (arg)) /* arg < 0.0L or negative zero */
8866 +                         {
8867 +                           sign = -1;
8868 +                           arg = -arg;
8869 +                         }
8870 +
8871 +                       if (sign < 0)
8872 +                         *p++ = '-';
8873 +                       else if (flags & FLAG_SHOWSIGN)
8874 +                         *p++ = '+';
8875 +                       else if (flags & FLAG_SPACE)
8876 +                         *p++ = ' ';
8877 +
8878 +                       if (arg > 0.0L && arg + arg == arg)
8879 +                         {
8880 +                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
8881 +                             {
8882 +                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
8883 +                             }
8884 +                           else
8885 +                             {
8886 +                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
8887 +                             }
8888 +                         }
8889 +                       else
8890 +                         {
8891 +#  if NEED_PRINTF_LONG_DOUBLE
8892 +                           pad_ptr = p;
8893 +
8894 +                           if (dp->conversion == 'f' || dp->conversion == 'F')
8895 +                             {
8896 +                               char *digits;
8897 +                               size_t ndigits;
8898 +
8899 +                               digits =
8900 +                                 scale10_round_decimal_long_double (arg, precision);
8901 +                               if (digits == NULL)
8902 +                                 {
8903 +                                   END_LONG_DOUBLE_ROUNDING ();
8904 +                                   goto out_of_memory;
8905 +                                 }
8906 +                               ndigits = strlen (digits);
8907 +
8908 +                               if (ndigits > precision)
8909 +                                 do
8910 +                                   {
8911 +                                     --ndigits;
8912 +                                     *p++ = digits[ndigits];
8913 +                                   }
8914 +                                 while (ndigits > precision);
8915 +                               else
8916 +                                 *p++ = '0';
8917 +                               /* Here ndigits <= precision.  */
8918 +                               if ((flags & FLAG_ALT) || precision > 0)
8919 +                                 {
8920 +                                   *p++ = decimal_point_char ();
8921 +                                   for (; precision > ndigits; precision--)
8922 +                                     *p++ = '0';
8923 +                                   while (ndigits > 0)
8924 +                                     {
8925 +                                       --ndigits;
8926 +                                       *p++ = digits[ndigits];
8927 +                                     }
8928 +                                 }
8929 +
8930 +                               free (digits);
8931 +                             }
8932 +                           else if (dp->conversion == 'e' || dp->conversion == 'E')
8933 +                             {
8934 +                               int exponent;
8935 +
8936 +                               if (arg == 0.0L)
8937 +                                 {
8938 +                                   exponent = 0;
8939 +                                   *p++ = '0';
8940 +                                   if ((flags & FLAG_ALT) || precision > 0)
8941 +                                     {
8942 +                                       *p++ = decimal_point_char ();
8943 +                                       for (; precision > 0; precision--)
8944 +                                         *p++ = '0';
8945 +                                     }
8946 +                                 }
8947 +                               else
8948 +                                 {
8949 +                                   /* arg > 0.0L.  */
8950 +                                   int adjusted;
8951 +                                   char *digits;
8952 +                                   size_t ndigits;
8953 +
8954 +                                   exponent = floorlog10l (arg);
8955 +                                   adjusted = 0;
8956 +                                   for (;;)
8957 +                                     {
8958 +                                       digits =
8959 +                                         scale10_round_decimal_long_double (arg,
8960 +                                                                            (int)precision - exponent);
8961 +                                       if (digits == NULL)
8962 +                                         {
8963 +                                           END_LONG_DOUBLE_ROUNDING ();
8964 +                                           goto out_of_memory;
8965 +                                         }
8966 +                                       ndigits = strlen (digits);
8967 +
8968 +                                       if (ndigits == precision + 1)
8969 +                                         break;
8970 +                                       if (ndigits < precision
8971 +                                           || ndigits > precision + 2)
8972 +                                         /* The exponent was not guessed
8973 +                                            precisely enough.  */
8974 +                                         abort ();
8975 +                                       if (adjusted)
8976 +                                         /* None of two values of exponent is
8977 +                                            the right one.  Prevent an endless
8978 +                                            loop.  */
8979 +                                         abort ();
8980 +                                       free (digits);
8981 +                                       if (ndigits == precision)
8982 +                                         exponent -= 1;
8983 +                                       else
8984 +                                         exponent += 1;
8985 +                                       adjusted = 1;
8986 +                                     }
8987 +                                   /* Here ndigits = precision+1.  */
8988 +                                   if (is_borderline (digits, precision))
8989 +                                     {
8990 +                                       /* Maybe the exponent guess was too high
8991 +                                          and a smaller exponent can be reached
8992 +                                          by turning a 10...0 into 9...9x.  */
8993 +                                       char *digits2 =
8994 +                                         scale10_round_decimal_long_double (arg,
8995 +                                                                            (int)precision - exponent + 1);
8996 +                                       if (digits2 == NULL)
8997 +                                         {
8998 +                                           free (digits);
8999 +                                           END_LONG_DOUBLE_ROUNDING ();
9000 +                                           goto out_of_memory;
9001 +                                         }
9002 +                                       if (strlen (digits2) == precision + 1)
9003 +                                         {
9004 +                                           free (digits);
9005 +                                           digits = digits2;
9006 +                                           exponent -= 1;
9007 +                                         }
9008 +                                       else
9009 +                                         free (digits2);
9010 +                                     }
9011 +                                   /* Here ndigits = precision+1.  */
9012 +
9013 +                                   *p++ = digits[--ndigits];
9014 +                                   if ((flags & FLAG_ALT) || precision > 0)
9015 +                                     {
9016 +                                       *p++ = decimal_point_char ();
9017 +                                       while (ndigits > 0)
9018 +                                         {
9019 +                                           --ndigits;
9020 +                                           *p++ = digits[ndigits];
9021 +                                         }
9022 +                                     }
9023 +
9024 +                                   free (digits);
9025 +                                 }
9026 +
9027 +                               *p++ = dp->conversion; /* 'e' or 'E' */
9028 +#   if WIDE_CHAR_VERSION
9029 +                               {
9030 +                                 static const wchar_t decimal_format[] =
9031 +                                   { '%', '+', '.', '2', 'd', '\0' };
9032 +                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
9033 +                               }
9034 +                               while (*p != '\0')
9035 +                                 p++;
9036 +#   else
9037 +                               if (sizeof (DCHAR_T) == 1)
9038 +                                 {
9039 +                                   sprintf ((char *) p, "%+.2d", exponent);
9040 +                                   while (*p != '\0')
9041 +                                     p++;
9042 +                                 }
9043 +                               else
9044 +                                 {
9045 +                                   char expbuf[6 + 1];
9046 +                                   const char *ep;
9047 +                                   sprintf (expbuf, "%+.2d", exponent);
9048 +                                   for (ep = expbuf; (*p = *ep) != '\0'; ep++)
9049 +                                     p++;
9050 +                                 }
9051 +#   endif
9052 +                             }
9053 +                           else if (dp->conversion == 'g' || dp->conversion == 'G')
9054 +                             {
9055 +                               if (precision == 0)
9056 +                                 precision = 1;
9057 +                               /* precision >= 1.  */
9058 +
9059 +                               if (arg == 0.0L)
9060 +                                 /* The exponent is 0, >= -4, < precision.
9061 +                                    Use fixed-point notation.  */
9062 +                                 {
9063 +                                   size_t ndigits = precision;
9064 +                                   /* Number of trailing zeroes that have to be
9065 +                                      dropped.  */
9066 +                                   size_t nzeroes =
9067 +                                     (flags & FLAG_ALT ? 0 : precision - 1);
9068 +
9069 +                                   --ndigits;
9070 +                                   *p++ = '0';
9071 +                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
9072 +                                     {
9073 +                                       *p++ = decimal_point_char ();
9074 +                                       while (ndigits > nzeroes)
9075 +                                         {
9076 +                                           --ndigits;
9077 +                                           *p++ = '0';
9078 +                                         }
9079 +                                     }
9080 +                                 }
9081 +                               else
9082 +                                 {
9083 +                                   /* arg > 0.0L.  */
9084 +                                   int exponent;
9085 +                                   int adjusted;
9086 +                                   char *digits;
9087 +                                   size_t ndigits;
9088 +                                   size_t nzeroes;
9089 +
9090 +                                   exponent = floorlog10l (arg);
9091 +                                   adjusted = 0;
9092 +                                   for (;;)
9093 +                                     {
9094 +                                       digits =
9095 +                                         scale10_round_decimal_long_double (arg,
9096 +                                                                            (int)(precision - 1) - exponent);
9097 +                                       if (digits == NULL)
9098 +                                         {
9099 +                                           END_LONG_DOUBLE_ROUNDING ();
9100 +                                           goto out_of_memory;
9101 +                                         }
9102 +                                       ndigits = strlen (digits);
9103 +
9104 +                                       if (ndigits == precision)
9105 +                                         break;
9106 +                                       if (ndigits < precision - 1
9107 +                                           || ndigits > precision + 1)
9108 +                                         /* The exponent was not guessed
9109 +                                            precisely enough.  */
9110 +                                         abort ();
9111 +                                       if (adjusted)
9112 +                                         /* None of two values of exponent is
9113 +                                            the right one.  Prevent an endless
9114 +                                            loop.  */
9115 +                                         abort ();
9116 +                                       free (digits);
9117 +                                       if (ndigits < precision)
9118 +                                         exponent -= 1;
9119 +                                       else
9120 +                                         exponent += 1;
9121 +                                       adjusted = 1;
9122 +                                     }
9123 +                                   /* Here ndigits = precision.  */
9124 +                                   if (is_borderline (digits, precision - 1))
9125 +                                     {
9126 +                                       /* Maybe the exponent guess was too high
9127 +                                          and a smaller exponent can be reached
9128 +                                          by turning a 10...0 into 9...9x.  */
9129 +                                       char *digits2 =
9130 +                                         scale10_round_decimal_long_double (arg,
9131 +                                                                            (int)(precision - 1) - exponent + 1);
9132 +                                       if (digits2 == NULL)
9133 +                                         {
9134 +                                           free (digits);
9135 +                                           END_LONG_DOUBLE_ROUNDING ();
9136 +                                           goto out_of_memory;
9137 +                                         }
9138 +                                       if (strlen (digits2) == precision)
9139 +                                         {
9140 +                                           free (digits);
9141 +                                           digits = digits2;
9142 +                                           exponent -= 1;
9143 +                                         }
9144 +                                       else
9145 +                                         free (digits2);
9146 +                                     }
9147 +                                   /* Here ndigits = precision.  */
9148 +
9149 +                                   /* Determine the number of trailing zeroes
9150 +                                      that have to be dropped.  */
9151 +                                   nzeroes = 0;
9152 +                                   if ((flags & FLAG_ALT) == 0)
9153 +                                     while (nzeroes < ndigits
9154 +                                            && digits[nzeroes] == '0')
9155 +                                       nzeroes++;
9156 +
9157 +                                   /* The exponent is now determined.  */
9158 +                                   if (exponent >= -4
9159 +                                       && exponent < (long)precision)
9160 +                                     {
9161 +                                       /* Fixed-point notation:
9162 +                                          max(exponent,0)+1 digits, then the
9163 +                                          decimal point, then the remaining
9164 +                                          digits without trailing zeroes.  */
9165 +                                       if (exponent >= 0)
9166 +                                         {
9167 +                                           size_t count = exponent + 1;
9168 +                                           /* Note: count <= precision = ndigits.  */
9169 +                                           for (; count > 0; count--)
9170 +                                             *p++ = digits[--ndigits];
9171 +                                           if ((flags & FLAG_ALT) || ndigits > nzeroes)
9172 +                                             {
9173 +                                               *p++ = decimal_point_char ();
9174 +                                               while (ndigits > nzeroes)
9175 +                                                 {
9176 +                                                   --ndigits;
9177 +                                                   *p++ = digits[ndigits];
9178 +                                                 }
9179 +                                             }
9180 +                                         }
9181 +                                       else
9182 +                                         {
9183 +                                           size_t count = -exponent - 1;
9184 +                                           *p++ = '0';
9185 +                                           *p++ = decimal_point_char ();
9186 +                                           for (; count > 0; count--)
9187 +                                             *p++ = '0';
9188 +                                           while (ndigits > nzeroes)
9189 +                                             {
9190 +                                               --ndigits;
9191 +                                               *p++ = digits[ndigits];
9192 +                                             }
9193 +                                         }
9194 +                                     }
9195 +                                   else
9196 +                                     {
9197 +                                       /* Exponential notation.  */
9198 +                                       *p++ = digits[--ndigits];
9199 +                                       if ((flags & FLAG_ALT) || ndigits > nzeroes)
9200 +                                         {
9201 +                                           *p++ = decimal_point_char ();
9202 +                                           while (ndigits > nzeroes)
9203 +                                             {
9204 +                                               --ndigits;
9205 +                                               *p++ = digits[ndigits];
9206 +                                             }
9207 +                                         }
9208 +                                       *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
9209 +#   if WIDE_CHAR_VERSION
9210 +                                       {
9211 +                                         static const wchar_t decimal_format[] =
9212 +                                           { '%', '+', '.', '2', 'd', '\0' };
9213 +                                         SNPRINTF (p, 6 + 1, decimal_format, exponent);
9214 +                                       }
9215 +                                       while (*p != '\0')
9216 +                                         p++;
9217 +#   else
9218 +                                       if (sizeof (DCHAR_T) == 1)
9219 +                                         {
9220 +                                           sprintf ((char *) p, "%+.2d", exponent);
9221 +                                           while (*p != '\0')
9222 +                                             p++;
9223 +                                         }
9224 +                                       else
9225 +                                         {
9226 +                                           char expbuf[6 + 1];
9227 +                                           const char *ep;
9228 +                                           sprintf (expbuf, "%+.2d", exponent);
9229 +                                           for (ep = expbuf; (*p = *ep) != '\0'; ep++)
9230 +                                             p++;
9231 +                                         }
9232 +#   endif
9233 +                                     }
9234 +
9235 +                                   free (digits);
9236 +                                 }
9237 +                             }
9238 +                           else
9239 +                             abort ();
9240 +#  else
9241 +                           /* arg is finite.  */
9242 +                           if (!(arg == 0.0L))
9243 +                             abort ();
9244 +
9245 +                           pad_ptr = p;
9246 +
9247 +                           if (dp->conversion == 'f' || dp->conversion == 'F')
9248 +                             {
9249 +                               *p++ = '0';
9250 +                               if ((flags & FLAG_ALT) || precision > 0)
9251 +                                 {
9252 +                                   *p++ = decimal_point_char ();
9253 +                                   for (; precision > 0; precision--)
9254 +                                     *p++ = '0';
9255 +                                 }
9256 +                             }
9257 +                           else if (dp->conversion == 'e' || dp->conversion == 'E')
9258 +                             {
9259 +                               *p++ = '0';
9260 +                               if ((flags & FLAG_ALT) || precision > 0)
9261 +                                 {
9262 +                                   *p++ = decimal_point_char ();
9263 +                                   for (; precision > 0; precision--)
9264 +                                     *p++ = '0';
9265 +                                 }
9266 +                               *p++ = dp->conversion; /* 'e' or 'E' */
9267 +                               *p++ = '+';
9268 +                               *p++ = '0';
9269 +                               *p++ = '0';
9270 +                             }
9271 +                           else if (dp->conversion == 'g' || dp->conversion == 'G')
9272 +                             {
9273 +                               *p++ = '0';
9274 +                               if (flags & FLAG_ALT)
9275 +                                 {
9276 +                                   size_t ndigits =
9277 +                                     (precision > 0 ? precision - 1 : 0);
9278 +                                   *p++ = decimal_point_char ();
9279 +                                   for (; ndigits > 0; --ndigits)
9280 +                                     *p++ = '0';
9281 +                                 }
9282 +                             }
9283 +                           else if (dp->conversion == 'a' || dp->conversion == 'A')
9284 +                             {
9285 +                               *p++ = '0';
9286 +                               *p++ = dp->conversion - 'A' + 'X';
9287 +                               pad_ptr = p;
9288 +                               *p++ = '0';
9289 +                               if ((flags & FLAG_ALT) || precision > 0)
9290 +                                 {
9291 +                                   *p++ = decimal_point_char ();
9292 +                                   for (; precision > 0; precision--)
9293 +                                     *p++ = '0';
9294 +                                 }
9295 +                               *p++ = dp->conversion - 'A' + 'P';
9296 +                               *p++ = '+';
9297 +                               *p++ = '0';
9298 +                             }
9299 +                           else
9300 +                             abort ();
9301 +#  endif
9302 +                         }
9303 +
9304 +                       END_LONG_DOUBLE_ROUNDING ();
9305 +                     }
9306 +                 }
9307 +#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
9308 +               else
9309 +#  endif
9310 +# endif
9311 +# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
9312 +                 {
9313 +                   double arg = a.arg[dp->arg_index].a.a_double;
9314 +
9315 +                   if (isnand (arg))
9316 +                     {
9317 +                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
9318 +                         {
9319 +                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
9320 +                         }
9321 +                       else
9322 +                         {
9323 +                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
9324 +                         }
9325 +                     }
9326 +                   else
9327 +                     {
9328 +                       int sign = 0;
9329 +
9330 +                       if (signbit (arg)) /* arg < 0.0 or negative zero */
9331 +                         {
9332 +                           sign = -1;
9333 +                           arg = -arg;
9334 +                         }
9335 +
9336 +                       if (sign < 0)
9337 +                         *p++ = '-';
9338 +                       else if (flags & FLAG_SHOWSIGN)
9339 +                         *p++ = '+';
9340 +                       else if (flags & FLAG_SPACE)
9341 +                         *p++ = ' ';
9342 +
9343 +                       if (arg > 0.0 && arg + arg == arg)
9344 +                         {
9345 +                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
9346 +                             {
9347 +                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
9348 +                             }
9349 +                           else
9350 +                             {
9351 +                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
9352 +                             }
9353 +                         }
9354 +                       else
9355 +                         {
9356 +#  if NEED_PRINTF_DOUBLE
9357 +                           pad_ptr = p;
9358 +
9359 +                           if (dp->conversion == 'f' || dp->conversion == 'F')
9360 +                             {
9361 +                               char *digits;
9362 +                               size_t ndigits;
9363 +
9364 +                               digits =
9365 +                                 scale10_round_decimal_double (arg, precision);
9366 +                               if (digits == NULL)
9367 +                                 goto out_of_memory;
9368 +                               ndigits = strlen (digits);
9369 +
9370 +                               if (ndigits > precision)
9371 +                                 do
9372 +                                   {
9373 +                                     --ndigits;
9374 +                                     *p++ = digits[ndigits];
9375 +                                   }
9376 +                                 while (ndigits > precision);
9377 +                               else
9378 +                                 *p++ = '0';
9379 +                               /* Here ndigits <= precision.  */
9380 +                               if ((flags & FLAG_ALT) || precision > 0)
9381 +                                 {
9382 +                                   *p++ = decimal_point_char ();
9383 +                                   for (; precision > ndigits; precision--)
9384 +                                     *p++ = '0';
9385 +                                   while (ndigits > 0)
9386 +                                     {
9387 +                                       --ndigits;
9388 +                                       *p++ = digits[ndigits];
9389 +                                     }
9390 +                                 }
9391 +
9392 +                               free (digits);
9393 +                             }
9394 +                           else if (dp->conversion == 'e' || dp->conversion == 'E')
9395 +                             {
9396 +                               int exponent;
9397 +
9398 +                               if (arg == 0.0)
9399 +                                 {
9400 +                                   exponent = 0;
9401 +                                   *p++ = '0';
9402 +                                   if ((flags & FLAG_ALT) || precision > 0)
9403 +                                     {
9404 +                                       *p++ = decimal_point_char ();
9405 +                                       for (; precision > 0; precision--)
9406 +                                         *p++ = '0';
9407 +                                     }
9408 +                                 }
9409 +                               else
9410 +                                 {
9411 +                                   /* arg > 0.0.  */
9412 +                                   int adjusted;
9413 +                                   char *digits;
9414 +                                   size_t ndigits;
9415 +
9416 +                                   exponent = floorlog10 (arg);
9417 +                                   adjusted = 0;
9418 +                                   for (;;)
9419 +                                     {
9420 +                                       digits =
9421 +                                         scale10_round_decimal_double (arg,
9422 +                                                                       (int)precision - exponent);
9423 +                                       if (digits == NULL)
9424 +                                         goto out_of_memory;
9425 +                                       ndigits = strlen (digits);
9426 +
9427 +                                       if (ndigits == precision + 1)
9428 +                                         break;
9429 +                                       if (ndigits < precision
9430 +                                           || ndigits > precision + 2)
9431 +                                         /* The exponent was not guessed
9432 +                                            precisely enough.  */
9433 +                                         abort ();
9434 +                                       if (adjusted)
9435 +                                         /* None of two values of exponent is
9436 +                                            the right one.  Prevent an endless
9437 +                                            loop.  */
9438 +                                         abort ();
9439 +                                       free (digits);
9440 +                                       if (ndigits == precision)
9441 +                                         exponent -= 1;
9442 +                                       else
9443 +                                         exponent += 1;
9444 +                                       adjusted = 1;
9445 +                                     }
9446 +                                   /* Here ndigits = precision+1.  */
9447 +                                   if (is_borderline (digits, precision))
9448 +                                     {
9449 +                                       /* Maybe the exponent guess was too high
9450 +                                          and a smaller exponent can be reached
9451 +                                          by turning a 10...0 into 9...9x.  */
9452 +                                       char *digits2 =
9453 +                                         scale10_round_decimal_double (arg,
9454 +                                                                       (int)precision - exponent + 1);
9455 +                                       if (digits2 == NULL)
9456 +                                         {
9457 +                                           free (digits);
9458 +                                           goto out_of_memory;
9459 +                                         }
9460 +                                       if (strlen (digits2) == precision + 1)
9461 +                                         {
9462 +                                           free (digits);
9463 +                                           digits = digits2;
9464 +                                           exponent -= 1;
9465 +                                         }
9466 +                                       else
9467 +                                         free (digits2);
9468 +                                     }
9469 +                                   /* Here ndigits = precision+1.  */
9470 +
9471 +                                   *p++ = digits[--ndigits];
9472 +                                   if ((flags & FLAG_ALT) || precision > 0)
9473 +                                     {
9474 +                                       *p++ = decimal_point_char ();
9475 +                                       while (ndigits > 0)
9476 +                                         {
9477 +                                           --ndigits;
9478 +                                           *p++ = digits[ndigits];
9479 +                                         }
9480 +                                     }
9481 +
9482 +                                   free (digits);
9483 +                                 }
9484 +
9485 +                               *p++ = dp->conversion; /* 'e' or 'E' */
9486 +#   if WIDE_CHAR_VERSION
9487 +                               {
9488 +                                 static const wchar_t decimal_format[] =
9489 +                                   /* Produce the same number of exponent digits
9490 +                                      as the native printf implementation.  */
9491 +#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9492 +                                   { '%', '+', '.', '3', 'd', '\0' };
9493 +#    else
9494 +                                   { '%', '+', '.', '2', 'd', '\0' };
9495 +#    endif
9496 +                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
9497 +                               }
9498 +                               while (*p != '\0')
9499 +                                 p++;
9500 +#   else
9501 +                               {
9502 +                                 static const char decimal_format[] =
9503 +                                   /* Produce the same number of exponent digits
9504 +                                      as the native printf implementation.  */
9505 +#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9506 +                                   "%+.3d";
9507 +#    else
9508 +                                   "%+.2d";
9509 +#    endif
9510 +                                 if (sizeof (DCHAR_T) == 1)
9511 +                                   {
9512 +                                     sprintf ((char *) p, decimal_format, exponent);
9513 +                                     while (*p != '\0')
9514 +                                       p++;
9515 +                                   }
9516 +                                 else
9517 +                                   {
9518 +                                     char expbuf[6 + 1];
9519 +                                     const char *ep;
9520 +                                     sprintf (expbuf, decimal_format, exponent);
9521 +                                     for (ep = expbuf; (*p = *ep) != '\0'; ep++)
9522 +                                       p++;
9523 +                                   }
9524 +                               }
9525 +#   endif
9526 +                             }
9527 +                           else if (dp->conversion == 'g' || dp->conversion == 'G')
9528 +                             {
9529 +                               if (precision == 0)
9530 +                                 precision = 1;
9531 +                               /* precision >= 1.  */
9532 +
9533 +                               if (arg == 0.0)
9534 +                                 /* The exponent is 0, >= -4, < precision.
9535 +                                    Use fixed-point notation.  */
9536 +                                 {
9537 +                                   size_t ndigits = precision;
9538 +                                   /* Number of trailing zeroes that have to be
9539 +                                      dropped.  */
9540 +                                   size_t nzeroes =
9541 +                                     (flags & FLAG_ALT ? 0 : precision - 1);
9542 +
9543 +                                   --ndigits;
9544 +                                   *p++ = '0';
9545 +                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
9546 +                                     {
9547 +                                       *p++ = decimal_point_char ();
9548 +                                       while (ndigits > nzeroes)
9549 +                                         {
9550 +                                           --ndigits;
9551 +                                           *p++ = '0';
9552 +                                         }
9553 +                                     }
9554 +                                 }
9555 +                               else
9556 +                                 {
9557 +                                   /* arg > 0.0.  */
9558 +                                   int exponent;
9559 +                                   int adjusted;
9560 +                                   char *digits;
9561 +                                   size_t ndigits;
9562 +                                   size_t nzeroes;
9563 +
9564 +                                   exponent = floorlog10 (arg);
9565 +                                   adjusted = 0;
9566 +                                   for (;;)
9567 +                                     {
9568 +                                       digits =
9569 +                                         scale10_round_decimal_double (arg,
9570 +                                                                       (int)(precision - 1) - exponent);
9571 +                                       if (digits == NULL)
9572 +                                         goto out_of_memory;
9573 +                                       ndigits = strlen (digits);
9574 +
9575 +                                       if (ndigits == precision)
9576 +                                         break;
9577 +                                       if (ndigits < precision - 1
9578 +                                           || ndigits > precision + 1)
9579 +                                         /* The exponent was not guessed
9580 +                                            precisely enough.  */
9581 +                                         abort ();
9582 +                                       if (adjusted)
9583 +                                         /* None of two values of exponent is
9584 +                                            the right one.  Prevent an endless
9585 +                                            loop.  */
9586 +                                         abort ();
9587 +                                       free (digits);
9588 +                                       if (ndigits < precision)
9589 +                                         exponent -= 1;
9590 +                                       else
9591 +                                         exponent += 1;
9592 +                                       adjusted = 1;
9593 +                                     }
9594 +                                   /* Here ndigits = precision.  */
9595 +                                   if (is_borderline (digits, precision - 1))
9596 +                                     {
9597 +                                       /* Maybe the exponent guess was too high
9598 +                                          and a smaller exponent can be reached
9599 +                                          by turning a 10...0 into 9...9x.  */
9600 +                                       char *digits2 =
9601 +                                         scale10_round_decimal_double (arg,
9602 +                                                                       (int)(precision - 1) - exponent + 1);
9603 +                                       if (digits2 == NULL)
9604 +                                         {
9605 +                                           free (digits);
9606 +                                           goto out_of_memory;
9607 +                                         }
9608 +                                       if (strlen (digits2) == precision)
9609 +                                         {
9610 +                                           free (digits);
9611 +                                           digits = digits2;
9612 +                                           exponent -= 1;
9613 +                                         }
9614 +                                       else
9615 +                                         free (digits2);
9616 +                                     }
9617 +                                   /* Here ndigits = precision.  */
9618 +
9619 +                                   /* Determine the number of trailing zeroes
9620 +                                      that have to be dropped.  */
9621 +                                   nzeroes = 0;
9622 +                                   if ((flags & FLAG_ALT) == 0)
9623 +                                     while (nzeroes < ndigits
9624 +                                            && digits[nzeroes] == '0')
9625 +                                       nzeroes++;
9626 +
9627 +                                   /* The exponent is now determined.  */
9628 +                                   if (exponent >= -4
9629 +                                       && exponent < (long)precision)
9630 +                                     {
9631 +                                       /* Fixed-point notation:
9632 +                                          max(exponent,0)+1 digits, then the
9633 +                                          decimal point, then the remaining
9634 +                                          digits without trailing zeroes.  */
9635 +                                       if (exponent >= 0)
9636 +                                         {
9637 +                                           size_t count = exponent + 1;
9638 +                                           /* Note: count <= precision = ndigits.  */
9639 +                                           for (; count > 0; count--)
9640 +                                             *p++ = digits[--ndigits];
9641 +                                           if ((flags & FLAG_ALT) || ndigits > nzeroes)
9642 +                                             {
9643 +                                               *p++ = decimal_point_char ();
9644 +                                               while (ndigits > nzeroes)
9645 +                                                 {
9646 +                                                   --ndigits;
9647 +                                                   *p++ = digits[ndigits];
9648 +                                                 }
9649 +                                             }
9650 +                                         }
9651 +                                       else
9652 +                                         {
9653 +                                           size_t count = -exponent - 1;
9654 +                                           *p++ = '0';
9655 +                                           *p++ = decimal_point_char ();
9656 +                                           for (; count > 0; count--)
9657 +                                             *p++ = '0';
9658 +                                           while (ndigits > nzeroes)
9659 +                                             {
9660 +                                               --ndigits;
9661 +                                               *p++ = digits[ndigits];
9662 +                                             }
9663 +                                         }
9664 +                                     }
9665 +                                   else
9666 +                                     {
9667 +                                       /* Exponential notation.  */
9668 +                                       *p++ = digits[--ndigits];
9669 +                                       if ((flags & FLAG_ALT) || ndigits > nzeroes)
9670 +                                         {
9671 +                                           *p++ = decimal_point_char ();
9672 +                                           while (ndigits > nzeroes)
9673 +                                             {
9674 +                                               --ndigits;
9675 +                                               *p++ = digits[ndigits];
9676 +                                             }
9677 +                                         }
9678 +                                       *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
9679 +#   if WIDE_CHAR_VERSION
9680 +                                       {
9681 +                                         static const wchar_t decimal_format[] =
9682 +                                           /* Produce the same number of exponent digits
9683 +                                              as the native printf implementation.  */
9684 +#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9685 +                                           { '%', '+', '.', '3', 'd', '\0' };
9686 +#    else
9687 +                                           { '%', '+', '.', '2', 'd', '\0' };
9688 +#    endif
9689 +                                         SNPRINTF (p, 6 + 1, decimal_format, exponent);
9690 +                                       }
9691 +                                       while (*p != '\0')
9692 +                                         p++;
9693 +#   else
9694 +                                       {
9695 +                                         static const char decimal_format[] =
9696 +                                           /* Produce the same number of exponent digits
9697 +                                              as the native printf implementation.  */
9698 +#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9699 +                                           "%+.3d";
9700 +#    else
9701 +                                           "%+.2d";
9702 +#    endif
9703 +                                         if (sizeof (DCHAR_T) == 1)
9704 +                                           {
9705 +                                             sprintf ((char *) p, decimal_format, exponent);
9706 +                                             while (*p != '\0')
9707 +                                               p++;
9708 +                                           }
9709 +                                         else
9710 +                                           {
9711 +                                             char expbuf[6 + 1];
9712 +                                             const char *ep;
9713 +                                             sprintf (expbuf, decimal_format, exponent);
9714 +                                             for (ep = expbuf; (*p = *ep) != '\0'; ep++)
9715 +                                               p++;
9716 +                                           }
9717 +                                       }
9718 +#   endif
9719 +                                     }
9720 +
9721 +                                   free (digits);
9722 +                                 }
9723 +                             }
9724 +                           else
9725 +                             abort ();
9726 +#  else
9727 +                           /* arg is finite.  */
9728 +                           if (!(arg == 0.0))
9729 +                             abort ();
9730 +
9731 +                           pad_ptr = p;
9732 +
9733 +                           if (dp->conversion == 'f' || dp->conversion == 'F')
9734 +                             {
9735 +                               *p++ = '0';
9736 +                               if ((flags & FLAG_ALT) || precision > 0)
9737 +                                 {
9738 +                                   *p++ = decimal_point_char ();
9739 +                                   for (; precision > 0; precision--)
9740 +                                     *p++ = '0';
9741 +                                 }
9742 +                             }
9743 +                           else if (dp->conversion == 'e' || dp->conversion == 'E')
9744 +                             {
9745 +                               *p++ = '0';
9746 +                               if ((flags & FLAG_ALT) || precision > 0)
9747 +                                 {
9748 +                                   *p++ = decimal_point_char ();
9749 +                                   for (; precision > 0; precision--)
9750 +                                     *p++ = '0';
9751 +                                 }
9752 +                               *p++ = dp->conversion; /* 'e' or 'E' */
9753 +                               *p++ = '+';
9754 +                               /* Produce the same number of exponent digits as
9755 +                                  the native printf implementation.  */
9756 +#   if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9757 +                               *p++ = '0';
9758 +#   endif
9759 +                               *p++ = '0';
9760 +                               *p++ = '0';
9761 +                             }
9762 +                           else if (dp->conversion == 'g' || dp->conversion == 'G')
9763 +                             {
9764 +                               *p++ = '0';
9765 +                               if (flags & FLAG_ALT)
9766 +                                 {
9767 +                                   size_t ndigits =
9768 +                                     (precision > 0 ? precision - 1 : 0);
9769 +                                   *p++ = decimal_point_char ();
9770 +                                   for (; ndigits > 0; --ndigits)
9771 +                                     *p++ = '0';
9772 +                                 }
9773 +                             }
9774 +                           else
9775 +                             abort ();
9776 +#  endif
9777 +                         }
9778 +                     }
9779 +                 }
9780 +# endif
9781 +
9782 +               /* The generated string now extends from tmp to p, with the
9783 +                  zero padding insertion point being at pad_ptr.  */
9784 +               if (has_width && p - tmp < width)
9785 +                 {
9786 +                   size_t pad = width - (p - tmp);
9787 +                   DCHAR_T *end = p + pad;
9788 +
9789 +                   if (flags & FLAG_LEFT)
9790 +                     {
9791 +                       /* Pad with spaces on the right.  */
9792 +                       for (; pad > 0; pad--)
9793 +                         *p++ = ' ';
9794 +                     }
9795 +                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
9796 +                     {
9797 +                       /* Pad with zeroes.  */
9798 +                       DCHAR_T *q = end;
9799 +
9800 +                       while (p > pad_ptr)
9801 +                         *--q = *--p;
9802 +                       for (; pad > 0; pad--)
9803 +                         *p++ = '0';
9804 +                     }
9805 +                   else
9806 +                     {
9807 +                       /* Pad with spaces on the left.  */
9808 +                       DCHAR_T *q = end;
9809 +
9810 +                       while (p > tmp)
9811 +                         *--q = *--p;
9812 +                       for (; pad > 0; pad--)
9813 +                         *p++ = ' ';
9814 +                     }
9815 +
9816 +                   p = end;
9817 +                 }
9818 +
9819 +               {
9820 +                 size_t count = p - tmp;
9821 +
9822 +                 if (count >= tmp_length)
9823 +                   /* tmp_length was incorrectly calculated - fix the
9824 +                      code above!  */
9825 +                   abort ();
9826 +
9827 +                 /* Make room for the result.  */
9828 +                 if (count >= allocated - length)
9829 +                   {
9830 +                     size_t n = xsum (length, count);
9831 +
9832 +                     ENSURE_ALLOCATION (n);
9833 +                   }
9834 +
9835 +                 /* Append the result.  */
9836 +                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
9837 +                 if (tmp != tmpbuf)
9838 +                   free (tmp);
9839 +                 length += count;
9840 +               }
9841 +             }
9842 +#endif
9843 +           else
9844 +             {
9845 +               arg_type type = a.arg[dp->arg_index].type;
9846 +               int flags = dp->flags;
9847 +#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
9848 +               int has_width;
9849 +               size_t width;
9850 +#endif
9851 +#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
9852 +               int has_precision;
9853 +               size_t precision;
9854 +#endif
9855 +#if NEED_PRINTF_UNBOUNDED_PRECISION
9856 +               int prec_ourselves;
9857 +#else
9858 +#              define prec_ourselves 0
9859 +#endif
9860 +#if NEED_PRINTF_FLAG_LEFTADJUST
9861 +#              define pad_ourselves 1
9862 +#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
9863 +               int pad_ourselves;
9864 +#else
9865 +#              define pad_ourselves 0
9866 +#endif
9867 +               TCHAR_T *fbp;
9868 +               unsigned int prefix_count;
9869 +               int prefixes[2] IF_LINT (= { 0 });
9870 +#if !USE_SNPRINTF
9871 +               size_t tmp_length;
9872 +               TCHAR_T tmpbuf[700];
9873 +               TCHAR_T *tmp;
9874 +#endif
9875 +
9876 +#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
9877 +               has_width = 0;
9878 +               width = 0;
9879 +               if (dp->width_start != dp->width_end)
9880 +                 {
9881 +                   if (dp->width_arg_index != ARG_NONE)
9882 +                     {
9883 +                       int arg;
9884 +
9885 +                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
9886 +                         abort ();
9887 +                       arg = a.arg[dp->width_arg_index].a.a_int;
9888 +                       if (arg < 0)
9889 +                         {
9890 +                           /* "A negative field width is taken as a '-' flag
9891 +                               followed by a positive field width."  */
9892 +                           flags |= FLAG_LEFT;
9893 +                           width = (unsigned int) (-arg);
9894 +                         }
9895 +                       else
9896 +                         width = arg;
9897 +                     }
9898 +                   else
9899 +                     {
9900 +                       const FCHAR_T *digitp = dp->width_start;
9901 +
9902 +                       do
9903 +                         width = xsum (xtimes (width, 10), *digitp++ - '0');
9904 +                       while (digitp != dp->width_end);
9905 +                     }
9906 +                   has_width = 1;
9907 +                 }
9908 +#endif
9909 +
9910 +#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
9911 +               has_precision = 0;
9912 +               precision = 6;
9913 +               if (dp->precision_start != dp->precision_end)
9914 +                 {
9915 +                   if (dp->precision_arg_index != ARG_NONE)
9916 +                     {
9917 +                       int arg;
9918 +
9919 +                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
9920 +                         abort ();
9921 +                       arg = a.arg[dp->precision_arg_index].a.a_int;
9922 +                       /* "A negative precision is taken as if the precision
9923 +                           were omitted."  */
9924 +                       if (arg >= 0)
9925 +                         {
9926 +                           precision = arg;
9927 +                           has_precision = 1;
9928 +                         }
9929 +                     }
9930 +                   else
9931 +                     {
9932 +                       const FCHAR_T *digitp = dp->precision_start + 1;
9933 +
9934 +                       precision = 0;
9935 +                       while (digitp != dp->precision_end)
9936 +                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
9937 +                       has_precision = 1;
9938 +                     }
9939 +                 }
9940 +#endif
9941 +
9942 +               /* Decide whether to handle the precision ourselves.  */
9943 +#if NEED_PRINTF_UNBOUNDED_PRECISION
9944 +               switch (dp->conversion)
9945 +                 {
9946 +                 case 'd': case 'i': case 'u':
9947 +                 case 'o':
9948 +                 case 'x': case 'X': case 'p':
9949 +                   prec_ourselves = has_precision && (precision > 0);
9950 +                   break;
9951 +                 default:
9952 +                   prec_ourselves = 0;
9953 +                   break;
9954 +                 }
9955 +#endif
9956 +
9957 +               /* Decide whether to perform the padding ourselves.  */
9958 +#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
9959 +               switch (dp->conversion)
9960 +                 {
9961 +# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
9962 +                 /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
9963 +                    to perform the padding after this conversion.  Functions
9964 +                    with unistdio extensions perform the padding based on
9965 +                    character count rather than element count.  */
9966 +                 case 'c': case 's':
9967 +# endif
9968 +# if NEED_PRINTF_FLAG_ZERO
9969 +                 case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
9970 +                 case 'a': case 'A':
9971 +# endif
9972 +                   pad_ourselves = 1;
9973 +                   break;
9974 +                 default:
9975 +                   pad_ourselves = prec_ourselves;
9976 +                   break;
9977 +                 }
9978 +#endif
9979 +
9980 +#if !USE_SNPRINTF
9981 +               /* Allocate a temporary buffer of sufficient size for calling
9982 +                  sprintf.  */
9983 +               {
9984 +                 switch (dp->conversion)
9985 +                   {
9986 +
9987 +                   case 'd': case 'i': case 'u':
9988 +# if HAVE_LONG_LONG_INT
9989 +                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
9990 +                       tmp_length =
9991 +                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
9992 +                                         * 0.30103 /* binary -> decimal */
9993 +                                        )
9994 +                         + 1; /* turn floor into ceil */
9995 +                     else
9996 +# endif
9997 +                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
9998 +                       tmp_length =
9999 +                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
10000 +                                         * 0.30103 /* binary -> decimal */
10001 +                                        )
10002 +                         + 1; /* turn floor into ceil */
10003 +                     else
10004 +                       tmp_length =
10005 +                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
10006 +                                         * 0.30103 /* binary -> decimal */
10007 +                                        )
10008 +                         + 1; /* turn floor into ceil */
10009 +                     if (tmp_length < precision)
10010 +                       tmp_length = precision;
10011 +                     /* Multiply by 2, as an estimate for FLAG_GROUP.  */
10012 +                     tmp_length = xsum (tmp_length, tmp_length);
10013 +                     /* Add 1, to account for a leading sign.  */
10014 +                     tmp_length = xsum (tmp_length, 1);
10015 +                     break;
10016 +
10017 +                   case 'o':
10018 +# if HAVE_LONG_LONG_INT
10019 +                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
10020 +                       tmp_length =
10021 +                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
10022 +                                         * 0.333334 /* binary -> octal */
10023 +                                        )
10024 +                         + 1; /* turn floor into ceil */
10025 +                     else
10026 +# endif
10027 +                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
10028 +                       tmp_length =
10029 +                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
10030 +                                         * 0.333334 /* binary -> octal */
10031 +                                        )
10032 +                         + 1; /* turn floor into ceil */
10033 +                     else
10034 +                       tmp_length =
10035 +                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
10036 +                                         * 0.333334 /* binary -> octal */
10037 +                                        )
10038 +                         + 1; /* turn floor into ceil */
10039 +                     if (tmp_length < precision)
10040 +                       tmp_length = precision;
10041 +                     /* Add 1, to account for a leading sign.  */
10042 +                     tmp_length = xsum (tmp_length, 1);
10043 +                     break;
10044 +
10045 +                   case 'x': case 'X':
10046 +# if HAVE_LONG_LONG_INT
10047 +                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
10048 +                       tmp_length =
10049 +                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
10050 +                                         * 0.25 /* binary -> hexadecimal */
10051 +                                        )
10052 +                         + 1; /* turn floor into ceil */
10053 +                     else
10054 +# endif
10055 +                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
10056 +                       tmp_length =
10057 +                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
10058 +                                         * 0.25 /* binary -> hexadecimal */
10059 +                                        )
10060 +                         + 1; /* turn floor into ceil */
10061 +                     else
10062 +                       tmp_length =
10063 +                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
10064 +                                         * 0.25 /* binary -> hexadecimal */
10065 +                                        )
10066 +                         + 1; /* turn floor into ceil */
10067 +                     if (tmp_length < precision)
10068 +                       tmp_length = precision;
10069 +                     /* Add 2, to account for a leading sign or alternate form.  */
10070 +                     tmp_length = xsum (tmp_length, 2);
10071 +                     break;
10072 +
10073 +                   case 'f': case 'F':
10074 +                     if (type == TYPE_LONGDOUBLE)
10075 +                       tmp_length =
10076 +                         (unsigned int) (LDBL_MAX_EXP
10077 +                                         * 0.30103 /* binary -> decimal */
10078 +                                         * 2 /* estimate for FLAG_GROUP */
10079 +                                        )
10080 +                         + 1 /* turn floor into ceil */
10081 +                         + 10; /* sign, decimal point etc. */
10082 +                     else
10083 +                       tmp_length =
10084 +                         (unsigned int) (DBL_MAX_EXP
10085 +                                         * 0.30103 /* binary -> decimal */
10086 +                                         * 2 /* estimate for FLAG_GROUP */
10087 +                                        )
10088 +                         + 1 /* turn floor into ceil */
10089 +                         + 10; /* sign, decimal point etc. */
10090 +                     tmp_length = xsum (tmp_length, precision);
10091 +                     break;
10092 +
10093 +                   case 'e': case 'E': case 'g': case 'G':
10094 +                     tmp_length =
10095 +                       12; /* sign, decimal point, exponent etc. */
10096 +                     tmp_length = xsum (tmp_length, precision);
10097 +                     break;
10098 +
10099 +                   case 'a': case 'A':
10100 +                     if (type == TYPE_LONGDOUBLE)
10101 +                       tmp_length =
10102 +                         (unsigned int) (LDBL_DIG
10103 +                                         * 0.831 /* decimal -> hexadecimal */
10104 +                                        )
10105 +                         + 1; /* turn floor into ceil */
10106 +                     else
10107 +                       tmp_length =
10108 +                         (unsigned int) (DBL_DIG
10109 +                                         * 0.831 /* decimal -> hexadecimal */
10110 +                                        )
10111 +                         + 1; /* turn floor into ceil */
10112 +                     if (tmp_length < precision)
10113 +                       tmp_length = precision;
10114 +                     /* Account for sign, decimal point etc. */
10115 +                     tmp_length = xsum (tmp_length, 12);
10116 +                     break;
10117 +
10118 +                   case 'c':
10119 +# if HAVE_WINT_T && !WIDE_CHAR_VERSION
10120 +                     if (type == TYPE_WIDE_CHAR)
10121 +                       tmp_length = MB_CUR_MAX;
10122 +                     else
10123 +# endif
10124 +                       tmp_length = 1;
10125 +                     break;
10126 +
10127 +                   case 's':
10128 +# if HAVE_WCHAR_T
10129 +                     if (type == TYPE_WIDE_STRING)
10130 +                       {
10131 +                         tmp_length =
10132 +                           local_wcslen (a.arg[dp->arg_index].a.a_wide_string);
10133 +
10134 +#  if !WIDE_CHAR_VERSION
10135 +                         tmp_length = xtimes (tmp_length, MB_CUR_MAX);
10136 +#  endif
10137 +                       }
10138 +                     else
10139 +# endif
10140 +                       tmp_length = strlen (a.arg[dp->arg_index].a.a_string);
10141 +                     break;
10142 +
10143 +                   case 'p':
10144 +                     tmp_length =
10145 +                       (unsigned int) (sizeof (void *) * CHAR_BIT
10146 +                                       * 0.25 /* binary -> hexadecimal */
10147 +                                      )
10148 +                         + 1 /* turn floor into ceil */
10149 +                         + 2; /* account for leading 0x */
10150 +                     break;
10151 +
10152 +                   default:
10153 +                     abort ();
10154 +                   }
10155 +
10156 +                 if (!pad_ourselves)
10157 +                   {
10158 +# if ENABLE_UNISTDIO
10159 +                     /* Padding considers the number of characters, therefore
10160 +                        the number of elements after padding may be
10161 +                          > max (tmp_length, width)
10162 +                        but is certainly
10163 +                          <= tmp_length + width.  */
10164 +                     tmp_length = xsum (tmp_length, width);
10165 +# else
10166 +                     /* Padding considers the number of elements,
10167 +                        says POSIX.  */
10168 +                     if (tmp_length < width)
10169 +                       tmp_length = width;
10170 +# endif
10171 +                   }
10172 +
10173 +                 tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
10174 +               }
10175 +
10176 +               if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
10177 +                 tmp = tmpbuf;
10178 +               else
10179 +                 {
10180 +                   size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
10181 +
10182 +                   if (size_overflow_p (tmp_memsize))
10183 +                     /* Overflow, would lead to out of memory.  */
10184 +                     goto out_of_memory;
10185 +                   tmp = (TCHAR_T *) malloc (tmp_memsize);
10186 +                   if (tmp == NULL)
10187 +                     /* Out of memory.  */
10188 +                     goto out_of_memory;
10189 +                 }
10190 +#endif
10191 +
10192 +               /* Construct the format string for calling snprintf or
10193 +                  sprintf.  */
10194 +               fbp = buf;
10195 +               *fbp++ = '%';
10196 +#if NEED_PRINTF_FLAG_GROUPING
10197 +               /* The underlying implementation doesn't support the ' flag.
10198 +                  Produce no grouping characters in this case; this is
10199 +                  acceptable because the grouping is locale dependent.  */
10200 +#else
10201 +               if (flags & FLAG_GROUP)
10202 +                 *fbp++ = '\'';
10203 +#endif
10204 +               if (flags & FLAG_LEFT)
10205 +                 *fbp++ = '-';
10206 +               if (flags & FLAG_SHOWSIGN)
10207 +                 *fbp++ = '+';
10208 +               if (flags & FLAG_SPACE)
10209 +                 *fbp++ = ' ';
10210 +               if (flags & FLAG_ALT)
10211 +                 *fbp++ = '#';
10212 +               if (!pad_ourselves)
10213 +                 {
10214 +                   if (flags & FLAG_ZERO)
10215 +                     *fbp++ = '0';
10216 +                   if (dp->width_start != dp->width_end)
10217 +                     {
10218 +                       size_t n = dp->width_end - dp->width_start;
10219 +                       /* The width specification is known to consist only
10220 +                          of standard ASCII characters.  */
10221 +                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
10222 +                         {
10223 +                           memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T));
10224 +                           fbp += n;
10225 +                         }
10226 +                       else
10227 +                         {
10228 +                           const FCHAR_T *mp = dp->width_start;
10229 +                           do
10230 +                             *fbp++ = (unsigned char) *mp++;
10231 +                           while (--n > 0);
10232 +                         }
10233 +                     }
10234 +                 }
10235 +               if (!prec_ourselves)
10236 +                 {
10237 +                   if (dp->precision_start != dp->precision_end)
10238 +                     {
10239 +                       size_t n = dp->precision_end - dp->precision_start;
10240 +                       /* The precision specification is known to consist only
10241 +                          of standard ASCII characters.  */
10242 +                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
10243 +                         {
10244 +                           memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
10245 +                           fbp += n;
10246 +                         }
10247 +                       else
10248 +                         {
10249 +                           const FCHAR_T *mp = dp->precision_start;
10250 +                           do
10251 +                             *fbp++ = (unsigned char) *mp++;
10252 +                           while (--n > 0);
10253 +                         }
10254 +                     }
10255 +                 }
10256 +
10257 +               switch (type)
10258 +                 {
10259 +#if HAVE_LONG_LONG_INT
10260 +                 case TYPE_LONGLONGINT:
10261 +                 case TYPE_ULONGLONGINT:
10262 +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
10263 +                   *fbp++ = 'I';
10264 +                   *fbp++ = '6';
10265 +                   *fbp++ = '4';
10266 +                   break;
10267 +# else
10268 +                   *fbp++ = 'l';
10269 +                   /*FALLTHROUGH*/
10270 +# endif
10271 +#endif
10272 +                 case TYPE_LONGINT:
10273 +                 case TYPE_ULONGINT:
10274 +#if HAVE_WINT_T
10275 +                 case TYPE_WIDE_CHAR:
10276 +#endif
10277 +#if HAVE_WCHAR_T
10278 +                 case TYPE_WIDE_STRING:
10279 +#endif
10280 +                   *fbp++ = 'l';
10281 +                   break;
10282 +                 case TYPE_LONGDOUBLE:
10283 +                   *fbp++ = 'L';
10284 +                   break;
10285 +                 default:
10286 +                   break;
10287 +                 }
10288 +#if NEED_PRINTF_DIRECTIVE_F
10289 +               if (dp->conversion == 'F')
10290 +                 *fbp = 'f';
10291 +               else
10292 +#endif
10293 +                 *fbp = dp->conversion;
10294 +#if USE_SNPRINTF
10295 +# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
10296 +               fbp[1] = '%';
10297 +               fbp[2] = 'n';
10298 +               fbp[3] = '\0';
10299 +# else
10300 +               /* On glibc2 systems from glibc >= 2.3 - probably also older
10301 +                  ones - we know that snprintf's returns value conforms to
10302 +                  ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
10303 +                  Therefore we can avoid using %n in this situation.
10304 +                  On glibc2 systems from 2004-10-18 or newer, the use of %n
10305 +                  in format strings in writable memory may crash the program
10306 +                  (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
10307 +                  in this situation.  */
10308 +               /* On native Win32 systems (such as mingw), we can avoid using
10309 +                  %n because:
10310 +                    - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
10311 +                      snprintf does not write more than the specified number
10312 +                      of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
10313 +                      '4', '5', '6' into buf, not '4', '5', '\0'.)
10314 +                    - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
10315 +                      allows us to recognize the case of an insufficient
10316 +                      buffer size: it returns -1 in this case.
10317 +                  On native Win32 systems (such as mingw) where the OS is
10318 +                  Windows Vista, the use of %n in format strings by default
10319 +                  crashes the program. See
10320 +                    <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
10321 +                    <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
10322 +                  So we should avoid %n in this situation.  */
10323 +               fbp[1] = '\0';
10324 +# endif
10325 +#else
10326 +               fbp[1] = '\0';
10327 +#endif
10328 +
10329 +               /* Construct the arguments for calling snprintf or sprintf.  */
10330 +               prefix_count = 0;
10331 +               if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
10332 +                 {
10333 +                   if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
10334 +                     abort ();
10335 +                   prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
10336 +                 }
10337 +               if (!prec_ourselves && dp->precision_arg_index != ARG_NONE)
10338 +                 {
10339 +                   if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
10340 +                     abort ();
10341 +                   prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
10342 +                 }
10343 +
10344 +#if USE_SNPRINTF
10345 +               /* The SNPRINTF result is appended after result[0..length].
10346 +                  The latter is an array of DCHAR_T; SNPRINTF appends an
10347 +                  array of TCHAR_T to it.  This is possible because
10348 +                  sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
10349 +                  alignof (TCHAR_T) <= alignof (DCHAR_T).  */
10350 +# define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T))
10351 +               /* Ensure that maxlen below will be >= 2.  Needed on BeOS,
10352 +                  where an snprintf() with maxlen==1 acts like sprintf().  */
10353 +               ENSURE_ALLOCATION (xsum (length,
10354 +                                        (2 + TCHARS_PER_DCHAR - 1)
10355 +                                        / TCHARS_PER_DCHAR));
10356 +               /* Prepare checking whether snprintf returns the count
10357 +                  via %n.  */
10358 +               *(TCHAR_T *) (result + length) = '\0';
10359 +#endif
10360 +
10361 +               for (;;)
10362 +                 {
10363 +                   int count = -1;
10364 +
10365 +#if USE_SNPRINTF
10366 +                   int retcount = 0;
10367 +                   size_t maxlen = allocated - length;
10368 +                   /* SNPRINTF can fail if its second argument is
10369 +                      > INT_MAX.  */
10370 +                   if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
10371 +                     maxlen = INT_MAX / TCHARS_PER_DCHAR;
10372 +                   maxlen = maxlen * TCHARS_PER_DCHAR;
10373 +# define SNPRINTF_BUF(arg) \
10374 +                   switch (prefix_count)                                   \
10375 +                     {                                                     \
10376 +                     case 0:                                               \
10377 +                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
10378 +                                            maxlen, buf,                   \
10379 +                                            arg, &count);                  \
10380 +                       break;                                              \
10381 +                     case 1:                                               \
10382 +                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
10383 +                                            maxlen, buf,                   \
10384 +                                            prefixes[0], arg, &count);     \
10385 +                       break;                                              \
10386 +                     case 2:                                               \
10387 +                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
10388 +                                            maxlen, buf,                   \
10389 +                                            prefixes[0], prefixes[1], arg, \
10390 +                                            &count);                       \
10391 +                       break;                                              \
10392 +                     default:                                              \
10393 +                       abort ();                                           \
10394 +                     }
10395 +#else
10396 +# define SNPRINTF_BUF(arg) \
10397 +                   switch (prefix_count)                                   \
10398 +                     {                                                     \
10399 +                     case 0:                                               \
10400 +                       count = sprintf (tmp, buf, arg);                    \
10401 +                       break;                                              \
10402 +                     case 1:                                               \
10403 +                       count = sprintf (tmp, buf, prefixes[0], arg);       \
10404 +                       break;                                              \
10405 +                     case 2:                                               \
10406 +                       count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
10407 +                                        arg);                              \
10408 +                       break;                                              \
10409 +                     default:                                              \
10410 +                       abort ();                                           \
10411 +                     }
10412 +#endif
10413 +
10414 +                   switch (type)
10415 +                     {
10416 +                     case TYPE_SCHAR:
10417 +                       {
10418 +                         int arg = a.arg[dp->arg_index].a.a_schar;
10419 +                         SNPRINTF_BUF (arg);
10420 +                       }
10421 +                       break;
10422 +                     case TYPE_UCHAR:
10423 +                       {
10424 +                         unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
10425 +                         SNPRINTF_BUF (arg);
10426 +                       }
10427 +                       break;
10428 +                     case TYPE_SHORT:
10429 +                       {
10430 +                         int arg = a.arg[dp->arg_index].a.a_short;
10431 +                         SNPRINTF_BUF (arg);
10432 +                       }
10433 +                       break;
10434 +                     case TYPE_USHORT:
10435 +                       {
10436 +                         unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
10437 +                         SNPRINTF_BUF (arg);
10438 +                       }
10439 +                       break;
10440 +                     case TYPE_INT:
10441 +                       {
10442 +                         int arg = a.arg[dp->arg_index].a.a_int;
10443 +                         SNPRINTF_BUF (arg);
10444 +                       }
10445 +                       break;
10446 +                     case TYPE_UINT:
10447 +                       {
10448 +                         unsigned int arg = a.arg[dp->arg_index].a.a_uint;
10449 +                         SNPRINTF_BUF (arg);
10450 +                       }
10451 +                       break;
10452 +                     case TYPE_LONGINT:
10453 +                       {
10454 +                         long int arg = a.arg[dp->arg_index].a.a_longint;
10455 +                         SNPRINTF_BUF (arg);
10456 +                       }
10457 +                       break;
10458 +                     case TYPE_ULONGINT:
10459 +                       {
10460 +                         unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
10461 +                         SNPRINTF_BUF (arg);
10462 +                       }
10463 +                       break;
10464 +#if HAVE_LONG_LONG_INT
10465 +                     case TYPE_LONGLONGINT:
10466 +                       {
10467 +                         long long int arg = a.arg[dp->arg_index].a.a_longlongint;
10468 +                         SNPRINTF_BUF (arg);
10469 +                       }
10470 +                       break;
10471 +                     case TYPE_ULONGLONGINT:
10472 +                       {
10473 +                         unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
10474 +                         SNPRINTF_BUF (arg);
10475 +                       }
10476 +                       break;
10477 +#endif
10478 +                     case TYPE_DOUBLE:
10479 +                       {
10480 +                         double arg = a.arg[dp->arg_index].a.a_double;
10481 +                         SNPRINTF_BUF (arg);
10482 +                       }
10483 +                       break;
10484 +                     case TYPE_LONGDOUBLE:
10485 +                       {
10486 +                         long double arg = a.arg[dp->arg_index].a.a_longdouble;
10487 +                         SNPRINTF_BUF (arg);
10488 +                       }
10489 +                       break;
10490 +                     case TYPE_CHAR:
10491 +                       {
10492 +                         int arg = a.arg[dp->arg_index].a.a_char;
10493 +                         SNPRINTF_BUF (arg);
10494 +                       }
10495 +                       break;
10496 +#if HAVE_WINT_T
10497 +                     case TYPE_WIDE_CHAR:
10498 +                       {
10499 +                         wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
10500 +                         SNPRINTF_BUF (arg);
10501 +                       }
10502 +                       break;
10503 +#endif
10504 +                     case TYPE_STRING:
10505 +                       {
10506 +                         const char *arg = a.arg[dp->arg_index].a.a_string;
10507 +                         SNPRINTF_BUF (arg);
10508 +                       }
10509 +                       break;
10510 +#if HAVE_WCHAR_T
10511 +                     case TYPE_WIDE_STRING:
10512 +                       {
10513 +                         const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
10514 +                         SNPRINTF_BUF (arg);
10515 +                       }
10516 +                       break;
10517 +#endif
10518 +                     case TYPE_POINTER:
10519 +                       {
10520 +                         void *arg = a.arg[dp->arg_index].a.a_pointer;
10521 +                         SNPRINTF_BUF (arg);
10522 +                       }
10523 +                       break;
10524 +                     default:
10525 +                       abort ();
10526 +                     }
10527 +
10528 +#if USE_SNPRINTF
10529 +                   /* Portability: Not all implementations of snprintf()
10530 +                      are ISO C 99 compliant.  Determine the number of
10531 +                      bytes that snprintf() has produced or would have
10532 +                      produced.  */
10533 +                   if (count >= 0)
10534 +                     {
10535 +                       /* Verify that snprintf() has NUL-terminated its
10536 +                          result.  */
10537 +                       if (count < maxlen
10538 +                           && ((TCHAR_T *) (result + length)) [count] != '\0')
10539 +                         abort ();
10540 +                       /* Portability hack.  */
10541 +                       if (retcount > count)
10542 +                         count = retcount;
10543 +                     }
10544 +                   else
10545 +                     {
10546 +                       /* snprintf() doesn't understand the '%n'
10547 +                          directive.  */
10548 +                       if (fbp[1] != '\0')
10549 +                         {
10550 +                           /* Don't use the '%n' directive; instead, look
10551 +                              at the snprintf() return value.  */
10552 +                           fbp[1] = '\0';
10553 +                           continue;
10554 +                         }
10555 +                       else
10556 +                         {
10557 +                           /* Look at the snprintf() return value.  */
10558 +                           if (retcount < 0)
10559 +                             {
10560 +                               /* HP-UX 10.20 snprintf() is doubly deficient:
10561 +                                  It doesn't understand the '%n' directive,
10562 +                                  *and* it returns -1 (rather than the length
10563 +                                  that would have been required) when the
10564 +                                  buffer is too small.  */
10565 +                               size_t bigger_need =
10566 +                                 xsum (xtimes (allocated, 2), 12);
10567 +                               ENSURE_ALLOCATION (bigger_need);
10568 +                               continue;
10569 +                             }
10570 +                           else
10571 +                             count = retcount;
10572 +                         }
10573 +                     }
10574 +#endif
10575 +
10576 +                   /* Attempt to handle failure.  */
10577 +                   if (count < 0)
10578 +                     {
10579 +                       if (!(result == resultbuf || result == NULL))
10580 +                         free (result);
10581 +                       if (buf_malloced != NULL)
10582 +                         free (buf_malloced);
10583 +                       CLEANUP ();
10584 +                       errno = EINVAL;
10585 +                       return NULL;
10586 +                     }
10587 +
10588 +#if USE_SNPRINTF
10589 +                   /* Handle overflow of the allocated buffer.
10590 +                      If such an overflow occurs, a C99 compliant snprintf()
10591 +                      returns a count >= maxlen.  However, a non-compliant
10592 +                      snprintf() function returns only count = maxlen - 1.  To
10593 +                      cover both cases, test whether count >= maxlen - 1.  */
10594 +                   if ((unsigned int) count + 1 >= maxlen)
10595 +                     {
10596 +                       /* If maxlen already has attained its allowed maximum,
10597 +                          allocating more memory will not increase maxlen.
10598 +                          Instead of looping, bail out.  */
10599 +                       if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
10600 +                         goto overflow;
10601 +                       else
10602 +                         {
10603 +                           /* Need at least (count + 1) * sizeof (TCHAR_T)
10604 +                              bytes.  (The +1 is for the trailing NUL.)
10605 +                              But ask for (count + 2) * sizeof (TCHAR_T)
10606 +                              bytes, so that in the next round, we likely get
10607 +                                maxlen > (unsigned int) count + 1
10608 +                              and so we don't get here again.
10609 +                              And allocate proportionally, to avoid looping
10610 +                              eternally if snprintf() reports a too small
10611 +                              count.  */
10612 +                           size_t n =
10613 +                             xmax (xsum (length,
10614 +                                         ((unsigned int) count + 2
10615 +                                          + TCHARS_PER_DCHAR - 1)
10616 +                                         / TCHARS_PER_DCHAR),
10617 +                                   xtimes (allocated, 2));
10618 +
10619 +                           ENSURE_ALLOCATION (n);
10620 +                           continue;
10621 +                         }
10622 +                     }
10623 +#endif
10624 +
10625 +#if NEED_PRINTF_UNBOUNDED_PRECISION
10626 +                   if (prec_ourselves)
10627 +                     {
10628 +                       /* Handle the precision.  */
10629 +                       TCHAR_T *prec_ptr =
10630 +# if USE_SNPRINTF
10631 +                         (TCHAR_T *) (result + length);
10632 +# else
10633 +                         tmp;
10634 +# endif
10635 +                       size_t prefix_count;
10636 +                       size_t move;
10637 +
10638 +                       prefix_count = 0;
10639 +                       /* Put the additional zeroes after the sign.  */
10640 +                       if (count >= 1
10641 +                           && (*prec_ptr == '-' || *prec_ptr == '+'
10642 +                               || *prec_ptr == ' '))
10643 +                         prefix_count = 1;
10644 +                       /* Put the additional zeroes after the 0x prefix if
10645 +                          (flags & FLAG_ALT) || (dp->conversion == 'p').  */
10646 +                       else if (count >= 2
10647 +                                && prec_ptr[0] == '0'
10648 +                                && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
10649 +                         prefix_count = 2;
10650 +
10651 +                       move = count - prefix_count;
10652 +                       if (precision > move)
10653 +                         {
10654 +                           /* Insert zeroes.  */
10655 +                           size_t insert = precision - move;
10656 +                           TCHAR_T *prec_end;
10657 +
10658 +# if USE_SNPRINTF
10659 +                           size_t n =
10660 +                             xsum (length,
10661 +                                   (count + insert + TCHARS_PER_DCHAR - 1)
10662 +                                   / TCHARS_PER_DCHAR);
10663 +                           length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
10664 +                           ENSURE_ALLOCATION (n);
10665 +                           length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
10666 +                           prec_ptr = (TCHAR_T *) (result + length);
10667 +# endif
10668 +
10669 +                           prec_end = prec_ptr + count;
10670 +                           prec_ptr += prefix_count;
10671 +
10672 +                           while (prec_end > prec_ptr)
10673 +                             {
10674 +                               prec_end--;
10675 +                               prec_end[insert] = prec_end[0];
10676 +                             }
10677 +
10678 +                           prec_end += insert;
10679 +                           do
10680 +                             *--prec_end = '0';
10681 +                           while (prec_end > prec_ptr);
10682 +
10683 +                           count += insert;
10684 +                         }
10685 +                     }
10686 +#endif
10687 +
10688 +#if !USE_SNPRINTF
10689 +                   if (count >= tmp_length)
10690 +                     /* tmp_length was incorrectly calculated - fix the
10691 +                        code above!  */
10692 +                     abort ();
10693 +#endif
10694 +
10695 +#if !DCHAR_IS_TCHAR
10696 +                   /* Convert from TCHAR_T[] to DCHAR_T[].  */
10697 +                   if (dp->conversion == 'c' || dp->conversion == 's')
10698 +                     {
10699 +                       /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING
10700 +                          TYPE_WIDE_STRING.
10701 +                          The result string is not certainly ASCII.  */
10702 +                       const TCHAR_T *tmpsrc;
10703 +                       DCHAR_T *tmpdst;
10704 +                       size_t tmpdst_len;
10705 +                       /* This code assumes that TCHAR_T is 'char'.  */
10706 +                       typedef int TCHAR_T_verify
10707 +                                   [2 * (sizeof (TCHAR_T) == 1) - 1];
10708 +# if USE_SNPRINTF
10709 +                       tmpsrc = (TCHAR_T *) (result + length);
10710 +# else
10711 +                       tmpsrc = tmp;
10712 +# endif
10713 +                       tmpdst = NULL;
10714 +                       tmpdst_len = 0;
10715 +                       if (DCHAR_CONV_FROM_ENCODING (locale_charset (),
10716 +                                                     iconveh_question_mark,
10717 +                                                     tmpsrc, count,
10718 +                                                     NULL,
10719 +                                                     &tmpdst, &tmpdst_len)
10720 +                           < 0)
10721 +                         {
10722 +                           int saved_errno = errno;
10723 +                           if (!(result == resultbuf || result == NULL))
10724 +                             free (result);
10725 +                           if (buf_malloced != NULL)
10726 +                             free (buf_malloced);
10727 +                           CLEANUP ();
10728 +                           errno = saved_errno;
10729 +                           return NULL;
10730 +                         }
10731 +                       ENSURE_ALLOCATION (xsum (length, tmpdst_len));
10732 +                       DCHAR_CPY (result + length, tmpdst, tmpdst_len);
10733 +                       free (tmpdst);
10734 +                       count = tmpdst_len;
10735 +                     }
10736 +                   else
10737 +                     {
10738 +                       /* The result string is ASCII.
10739 +                          Simple 1:1 conversion.  */
10740 +# if USE_SNPRINTF
10741 +                       /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
10742 +                          no-op conversion, in-place on the array starting
10743 +                          at (result + length).  */
10744 +                       if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
10745 +# endif
10746 +                         {
10747 +                           const TCHAR_T *tmpsrc;
10748 +                           DCHAR_T *tmpdst;
10749 +                           size_t n;
10750 +
10751 +# if USE_SNPRINTF
10752 +                           if (result == resultbuf)
10753 +                             {
10754 +                               tmpsrc = (TCHAR_T *) (result + length);
10755 +                               /* ENSURE_ALLOCATION will not move tmpsrc
10756 +                                  (because it's part of resultbuf).  */
10757 +                               ENSURE_ALLOCATION (xsum (length, count));
10758 +                             }
10759 +                           else
10760 +                             {
10761 +                               /* ENSURE_ALLOCATION will move the array
10762 +                                  (because it uses realloc().  */
10763 +                               ENSURE_ALLOCATION (xsum (length, count));
10764 +                               tmpsrc = (TCHAR_T *) (result + length);
10765 +                             }
10766 +# else
10767 +                           tmpsrc = tmp;
10768 +                           ENSURE_ALLOCATION (xsum (length, count));
10769 +# endif
10770 +                           tmpdst = result + length;
10771 +                           /* Copy backwards, because of overlapping.  */
10772 +                           tmpsrc += count;
10773 +                           tmpdst += count;
10774 +                           for (n = count; n > 0; n--)
10775 +                             *--tmpdst = (unsigned char) *--tmpsrc;
10776 +                         }
10777 +                     }
10778 +#endif
10779 +
10780 +#if DCHAR_IS_TCHAR && !USE_SNPRINTF
10781 +                   /* Make room for the result.  */
10782 +                   if (count > allocated - length)
10783 +                     {
10784 +                       /* Need at least count elements.  But allocate
10785 +                          proportionally.  */
10786 +                       size_t n =
10787 +                         xmax (xsum (length, count), xtimes (allocated, 2));
10788 +
10789 +                       ENSURE_ALLOCATION (n);
10790 +                     }
10791 +#endif
10792 +
10793 +                   /* Here count <= allocated - length.  */
10794 +
10795 +                   /* Perform padding.  */
10796 +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
10797 +                   if (pad_ourselves && has_width)
10798 +                     {
10799 +                       size_t w;
10800 +# if ENABLE_UNISTDIO
10801 +                       /* Outside POSIX, it's preferrable to compare the width
10802 +                          against the number of _characters_ of the converted
10803 +                          value.  */
10804 +                       w = DCHAR_MBSNLEN (result + length, count);
10805 +# else
10806 +                       /* The width is compared against the number of _bytes_
10807 +                          of the converted value, says POSIX.  */
10808 +                       w = count;
10809 +# endif
10810 +                       if (w < width)
10811 +                         {
10812 +                           size_t pad = width - w;
10813 +
10814 +                           /* Make room for the result.  */
10815 +                           if (xsum (count, pad) > allocated - length)
10816 +                             {
10817 +                               /* Need at least count + pad elements.  But
10818 +                                  allocate proportionally.  */
10819 +                               size_t n =
10820 +                                 xmax (xsum3 (length, count, pad),
10821 +                                       xtimes (allocated, 2));
10822 +
10823 +# if USE_SNPRINTF
10824 +                               length += count;
10825 +                               ENSURE_ALLOCATION (n);
10826 +                               length -= count;
10827 +# else
10828 +                               ENSURE_ALLOCATION (n);
10829 +# endif
10830 +                             }
10831 +                           /* Here count + pad <= allocated - length.  */
10832 +
10833 +                           {
10834 +# if !DCHAR_IS_TCHAR || USE_SNPRINTF
10835 +                             DCHAR_T * const rp = result + length;
10836 +# else
10837 +                             DCHAR_T * const rp = tmp;
10838 +# endif
10839 +                             DCHAR_T *p = rp + count;
10840 +                             DCHAR_T *end = p + pad;
10841 +                             DCHAR_T *pad_ptr;
10842 +# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
10843 +                             if (dp->conversion == 'c'
10844 +                                 || dp->conversion == 's')
10845 +                               /* No zero-padding for string directives.  */
10846 +                               pad_ptr = NULL;
10847 +                             else
10848 +# endif
10849 +                               {
10850 +                                 pad_ptr = (*rp == '-' ? rp + 1 : rp);
10851 +                                 /* No zero-padding of "inf" and "nan".  */
10852 +                                 if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
10853 +                                     || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
10854 +                                   pad_ptr = NULL;
10855 +                               }
10856 +                             /* The generated string now extends from rp to p,
10857 +                                with the zero padding insertion point being at
10858 +                                pad_ptr.  */
10859 +
10860 +                             count = count + pad; /* = end - rp */
10861 +
10862 +                             if (flags & FLAG_LEFT)
10863 +                               {
10864 +                                 /* Pad with spaces on the right.  */
10865 +                                 for (; pad > 0; pad--)
10866 +                                   *p++ = ' ';
10867 +                               }
10868 +                             else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
10869 +                               {
10870 +                                 /* Pad with zeroes.  */
10871 +                                 DCHAR_T *q = end;
10872 +
10873 +                                 while (p > pad_ptr)
10874 +                                   *--q = *--p;
10875 +                                 for (; pad > 0; pad--)
10876 +                                   *p++ = '0';
10877 +                               }
10878 +                             else
10879 +                               {
10880 +                                 /* Pad with spaces on the left.  */
10881 +                                 DCHAR_T *q = end;
10882 +
10883 +                                 while (p > rp)
10884 +                                   *--q = *--p;
10885 +                                 for (; pad > 0; pad--)
10886 +                                   *p++ = ' ';
10887 +                               }
10888 +                           }
10889 +                         }
10890 +                     }
10891 +#endif
10892 +
10893 +                   /* Here still count <= allocated - length.  */
10894 +
10895 +#if !DCHAR_IS_TCHAR || USE_SNPRINTF
10896 +                   /* The snprintf() result did fit.  */
10897 +#else
10898 +                   /* Append the sprintf() result.  */
10899 +                   memcpy (result + length, tmp, count * sizeof (DCHAR_T));
10900 +#endif
10901 +#if !USE_SNPRINTF
10902 +                   if (tmp != tmpbuf)
10903 +                     free (tmp);
10904 +#endif
10905 +
10906 +#if NEED_PRINTF_DIRECTIVE_F
10907 +                   if (dp->conversion == 'F')
10908 +                     {
10909 +                       /* Convert the %f result to upper case for %F.  */
10910 +                       DCHAR_T *rp = result + length;
10911 +                       size_t rc;
10912 +                       for (rc = count; rc > 0; rc--, rp++)
10913 +                         if (*rp >= 'a' && *rp <= 'z')
10914 +                           *rp = *rp - 'a' + 'A';
10915 +                     }
10916 +#endif
10917 +
10918 +                   length += count;
10919 +                   break;
10920 +                 }
10921 +             }
10922 +         }
10923 +      }
10924 +
10925 +    /* Add the final NUL.  */
10926 +    ENSURE_ALLOCATION (xsum (length, 1));
10927 +    result[length] = '\0';
10928 +
10929 +    if (result != resultbuf && length + 1 < allocated)
10930 +      {
10931 +       /* Shrink the allocated memory if possible.  */
10932 +       DCHAR_T *memory;
10933 +
10934 +       memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
10935 +       if (memory != NULL)
10936 +         result = memory;
10937 +      }
10938 +
10939 +    if (buf_malloced != NULL)
10940 +      free (buf_malloced);
10941 +    CLEANUP ();
10942 +    *lengthp = length;
10943 +    /* Note that we can produce a big string of a length > INT_MAX.  POSIX
10944 +       says that snprintf() fails with errno = EOVERFLOW in this case, but
10945 +       that's only because snprintf() returns an 'int'.  This function does
10946 +       not have this limitation.  */
10947 +    return result;
10948 +
10949 +#if USE_SNPRINTF
10950 +  overflow:
10951 +    if (!(result == resultbuf || result == NULL))
10952 +      free (result);
10953 +    if (buf_malloced != NULL)
10954 +      free (buf_malloced);
10955 +    CLEANUP ();
10956 +    errno = EOVERFLOW;
10957 +    return NULL;
10958 +#endif
10959 +
10960 +  out_of_memory:
10961 +    if (!(result == resultbuf || result == NULL))
10962 +      free (result);
10963 +    if (buf_malloced != NULL)
10964 +      free (buf_malloced);
10965 +  out_of_memory_1:
10966 +    CLEANUP ();
10967 +    errno = ENOMEM;
10968 +    return NULL;
10969 +  }
10970 +}
10971 +
10972 +#undef TCHARS_PER_DCHAR
10973 +#undef SNPRINTF
10974 +#undef USE_SNPRINTF
10975 +#undef DCHAR_CPY
10976 +#undef PRINTF_PARSE
10977 +#undef DIRECTIVES
10978 +#undef DIRECTIVE
10979 +#undef DCHAR_IS_TCHAR
10980 +#undef TCHAR_T
10981 +#undef DCHAR_T
10982 +#undef FCHAR_T
10983 +#undef VASNPRINTF
10984 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/vasnprintf.h gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.h
10985 --- gtk-vnc-0.3.7.dan3/gnulib/lib/vasnprintf.h  1970-01-01 01:00:00.000000000 +0100
10986 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.h        2008-10-09 15:24:52.000000000 +0100
10987 @@ -0,0 +1,81 @@
10988 +/* vsprintf with automatic memory allocation.
10989 +   Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
10990 +
10991 +   This program is free software; you can redistribute it and/or modify
10992 +   it under the terms of the GNU Lesser General Public License as published by
10993 +   the Free Software Foundation; either version 2.1, or (at your option)
10994 +   any later version.
10995 +
10996 +   This program is distributed in the hope that it will be useful,
10997 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
10998 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10999 +   GNU Lesser General Public License for more details.
11000 +
11001 +   You should have received a copy of the GNU Lesser General Public License along
11002 +   with this program; if not, write to the Free Software Foundation,
11003 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
11004 +
11005 +#ifndef _VASNPRINTF_H
11006 +#define _VASNPRINTF_H
11007 +
11008 +/* Get va_list.  */
11009 +#include <stdarg.h>
11010 +
11011 +/* Get size_t.  */
11012 +#include <stddef.h>
11013 +
11014 +#ifndef __attribute__
11015 +/* This feature is available in gcc versions 2.5 and later.  */
11016 +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
11017 +#  define __attribute__(Spec) /* empty */
11018 +# endif
11019 +/* The __-protected variants of `format' and `printf' attributes
11020 +   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
11021 +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
11022 +#  define __format__ format
11023 +#  define __printf__ printf
11024 +# endif
11025 +#endif
11026 +
11027 +#ifdef __cplusplus
11028 +extern "C" {
11029 +#endif
11030 +
11031 +/* Write formatted output to a string dynamically allocated with malloc().
11032 +   You can pass a preallocated buffer for the result in RESULTBUF and its
11033 +   size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
11034 +   If successful, return the address of the string (this may be = RESULTBUF
11035 +   if no dynamic memory allocation was necessary) and set *LENGTHP to the
11036 +   number of resulting bytes, excluding the trailing NUL.  Upon error, set
11037 +   errno and return NULL.
11038 +
11039 +   When dynamic memory allocation occurs, the preallocated buffer is left
11040 +   alone (with possibly modified contents).  This makes it possible to use
11041 +   a statically allocated or stack-allocated buffer, like this:
11042 +
11043 +          char buf[100];
11044 +          size_t len = sizeof (buf);
11045 +          char *output = vasnprintf (buf, &len, format, args);
11046 +          if (output == NULL)
11047 +            ... error handling ...;
11048 +          else
11049 +            {
11050 +              ... use the output string ...;
11051 +              if (output != buf)
11052 +                free (output);
11053 +            }
11054 +  */
11055 +#if REPLACE_VASNPRINTF
11056 +# define asnprintf rpl_asnprintf
11057 +# define vasnprintf rpl_vasnprintf
11058 +#endif
11059 +extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
11060 +       __attribute__ ((__format__ (__printf__, 3, 4)));
11061 +extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
11062 +       __attribute__ ((__format__ (__printf__, 3, 0)));
11063 +
11064 +#ifdef __cplusplus
11065 +}
11066 +#endif
11067 +
11068 +#endif /* _VASNPRINTF_H */
11069 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/wchar.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/wchar.in.h
11070 --- gtk-vnc-0.3.7.dan3/gnulib/lib/wchar.in.h    1970-01-01 01:00:00.000000000 +0100
11071 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/wchar.in.h  2008-10-09 15:24:52.000000000 +0100
11072 @@ -0,0 +1,99 @@
11073 +/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
11074 +
11075 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
11076 +
11077 +   This program is free software; you can redistribute it and/or modify
11078 +   it under the terms of the GNU Lesser General Public License as published by
11079 +   the Free Software Foundation; either version 2.1, or (at your option)
11080 +   any later version.
11081 +
11082 +   This program is distributed in the hope that it will be useful,
11083 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
11084 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11085 +   GNU Lesser General Public License for more details.
11086 +
11087 +   You should have received a copy of the GNU Lesser General Public License
11088 +   along with this program; if not, write to the Free Software Foundation,
11089 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
11090 +
11091 +/* Written by Eric Blake.  */
11092 +
11093 +/*
11094 + * ISO C 99 <wchar.h> for platforms that have issues.
11095 + * <http://www.opengroup.org/susv3xbd/wchar.h.html>
11096 + *
11097 + * For now, this just ensures proper prerequisite inclusion order and
11098 + * the declaration of wcwidth().
11099 + */
11100 +
11101 +@PRAGMA_SYSTEM_HEADER@
11102 +
11103 +#ifdef __need_mbstate_t
11104 +/* Special invocation convention inside uClibc header files.  */
11105 +
11106 +#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
11107 +
11108 +#else
11109 +/* Normal invocation convention.  */
11110 +
11111 +#ifndef _GL_WCHAR_H
11112 +
11113 +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
11114 +   <wchar.h>.
11115 +   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
11116 +   included before <wchar.h>.  */
11117 +#include <stddef.h>
11118 +#include <stdio.h>
11119 +#include <time.h>
11120 +
11121 +/* Include the original <wchar.h> if it exists.
11122 +   Some builds of uClibc lack it.  */
11123 +/* The include_next requires a split double-inclusion guard.  */
11124 +#if @HAVE_WCHAR_H@
11125 +# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
11126 +#endif
11127 +
11128 +#ifndef _GL_WCHAR_H
11129 +#define _GL_WCHAR_H
11130 +
11131 +/* The definition of GL_LINK_WARNING is copied here.  */
11132 +
11133 +#ifdef __cplusplus
11134 +extern "C" {
11135 +#endif
11136 +
11137 +
11138 +/* Define wint_t.  (Also done in wctype.in.h.)  */
11139 +#if !@HAVE_WINT_T@ && !defined wint_t
11140 +# define wint_t int
11141 +#endif
11142 +
11143 +
11144 +/* Return the number of screen columns needed for WC.  */
11145 +#if @GNULIB_WCWIDTH@
11146 +# if @REPLACE_WCWIDTH@
11147 +#  undef wcwidth
11148 +#  define wcwidth rpl_wcwidth
11149 +extern int wcwidth (wchar_t);
11150 +# else
11151 +#  if !defined wcwidth && !@HAVE_DECL_WCWIDTH@
11152 +/* wcwidth exists but is not declared.  */
11153 +extern int wcwidth (int /* actually wchar_t */);
11154 +#  endif
11155 +# endif
11156 +#elif defined GNULIB_POSIXCHECK
11157 +# undef wcwidth
11158 +# define wcwidth(w) \
11159 +    (GL_LINK_WARNING ("wcwidth is unportable - " \
11160 +                      "use gnulib module wcwidth for portability"), \
11161 +     wcwidth (w))
11162 +#endif
11163 +
11164 +
11165 +#ifdef __cplusplus
11166 +}
11167 +#endif
11168 +
11169 +#endif /* _GL_WCHAR_H */
11170 +#endif /* _GL_WCHAR_H */
11171 +#endif
11172 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/winsock.c gtk-vnc-0.3.7.gnulib/gnulib/lib/winsock.c
11173 --- gtk-vnc-0.3.7.dan3/gnulib/lib/winsock.c     1970-01-01 01:00:00.000000000 +0100
11174 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/winsock.c   2008-10-09 15:24:52.000000000 +0100
11175 @@ -0,0 +1,308 @@
11176 +/* winsock.c --- wrappers for Windows socket functions
11177 +
11178 +   Copyright (C) 2008 Free Software Foundation, Inc.
11179 +
11180 +   This program is free software: you can redistribute it and/or modify
11181 +   it under the terms of the GNU Lesser General Public License as published by
11182 +   the Free Software Foundation; either version 2.1 of the License, or
11183 +   (at your option) any later version.
11184 +
11185 +   This program is distributed in the hope that it will be useful,
11186 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
11187 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11188 +   GNU Lesser General Public License for more details.
11189 +
11190 +   You should have received a copy of the GNU Lesser General Public License
11191 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
11192 +
11193 +/* Written by Paolo Bonzini */
11194 +
11195 +#include <config.h>
11196 +#include <stdio.h>
11197 +#include <string.h>
11198 +#include <errno.h>
11199 +#include <fcntl.h>
11200 +#include <io.h>
11201 +#include <sys/socket.h>
11202 +
11203 +#undef close
11204 +#undef socket
11205 +#undef connect
11206 +#undef accept
11207 +#undef bind
11208 +#undef getpeername
11209 +#undef getsockname
11210 +#undef getsockopt
11211 +#undef listen
11212 +#undef recv
11213 +#undef send
11214 +#undef recvfrom
11215 +#undef sendto
11216 +#undef setsockopt
11217 +
11218 +# define FD_TO_SOCKET(fd)   ((SOCKET) _get_osfhandle ((fd)))
11219 +# define SOCKET_TO_FD(fh)   (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
11220 +
11221 +
11222 +/* Wrappers for libc functions.  */
11223 +
11224 +int
11225 +rpl_close (int fd)
11226 +{
11227 +  SOCKET sock = FD_TO_SOCKET (fd);
11228 +  WSANETWORKEVENTS ev;
11229 +
11230 +  ev.lNetworkEvents = 0xDEADBEEF;
11231 +  WSAEnumNetworkEvents (sock, NULL, &ev);
11232 +  if (ev.lNetworkEvents != 0xDEADBEEF)
11233 +    {
11234 +      /* FIXME: other applications, like squid, use an undocumented
11235 +        _free_osfhnd free function.  Instead, here we just close twice
11236 +        the file descriptor.  I could not get the former to work
11237 +        (pb, Sep 22 2008).  */
11238 +      int r = closesocket (sock);
11239 +      _close (fd);
11240 +      return r;
11241 +    }
11242 +  else
11243 +    return _close (fd);
11244 +}
11245 +
11246 +
11247 +/* Wrappers for WinSock functions.  */
11248 +
11249 +static inline void
11250 +set_winsock_errno (void)
11251 +{
11252 +  int err = WSAGetLastError ();
11253 +  WSASetLastError (0);
11254 +
11255 +  /* Map some WSAE* errors to the runtime library's error codes.  */
11256 +  switch (err)
11257 +    {
11258 +    case WSA_INVALID_HANDLE:
11259 +      errno = EBADF;
11260 +      break;
11261 +    case WSA_NOT_ENOUGH_MEMORY:
11262 +      errno = ENOMEM;
11263 +      break;
11264 +    case WSA_INVALID_PARAMETER:
11265 +      errno = EINVAL;
11266 +      break;
11267 +    case WSAEWOULDBLOCK:
11268 +      errno = EWOULDBLOCK;
11269 +      break;
11270 +    case WSAENAMETOOLONG:
11271 +      errno = ENAMETOOLONG;
11272 +      break;
11273 +    case WSAENOTEMPTY:
11274 +      errno = ENOTEMPTY;
11275 +      break;
11276 +    default:
11277 +      errno = (err > 10000 && err < 10025) ? err - 10000 : err;
11278 +      break;
11279 +    }
11280 +}
11281 +
11282 +#if GNULIB_SOCKET
11283 +int
11284 +rpl_socket (int domain, int type, int protocol)
11285 +{
11286 +  /* We have to use WSASocket() to create non-overlapped IO sockets.
11287 +     Overlapped IO sockets cannot be used with read/write.  */
11288 +  SOCKET fh = WSASocket (domain, type, protocol, NULL, 0, 0);
11289 +
11290 +  if (fh == INVALID_SOCKET)
11291 +    {
11292 +      set_winsock_errno ();
11293 +      return -1;
11294 +    }
11295 +  else
11296 +    return SOCKET_TO_FD (fh);
11297 +}
11298 +#endif
11299 +
11300 +#if GNULIB_CONNECT
11301 +int
11302 +rpl_connect (int fd, struct sockaddr *sockaddr, int len)
11303 +{
11304 +  SOCKET sock = FD_TO_SOCKET (fd);
11305 +  int r = connect (sock, sockaddr, len);
11306 +  if (r < 0)
11307 +    {
11308 +      /* EINPROGRESS is not returned by WinSock 2.0; for backwards
11309 +        compatibility, connect(2) uses EWOULDBLOCK.  */
11310 +      if (WSAGetLastError () == WSAEWOULDBLOCK)
11311 +        WSASetLastError (WSAEINPROGRESS);
11312 +
11313 +      set_winsock_errno ();
11314 +    }
11315 +
11316 +  return r;
11317 +}
11318 +#endif
11319 +
11320 +#if GNULIB_ACCEPT
11321 +int
11322 +rpl_accept (int fd, struct sockaddr *addr, int *addrlen)
11323 +{
11324 +  SOCKET fh = accept (FD_TO_SOCKET (fd), addr, addrlen);
11325 +  if (fh == INVALID_SOCKET)
11326 +    {
11327 +      set_winsock_errno ();
11328 +      return -1;
11329 +    }
11330 +  else
11331 +    return SOCKET_TO_FD (fh);
11332 +}
11333 +#endif
11334 +
11335 +#if GNULIB_BIND
11336 +int
11337 +rpl_bind (int fd, struct sockaddr *sockaddr, int len)
11338 +{
11339 +  SOCKET sock = FD_TO_SOCKET (fd);
11340 +  int r = bind (sock, sockaddr, len);
11341 +  if (r < 0)
11342 +    set_winsock_errno ();
11343 +
11344 +  return r;
11345 +}
11346 +#endif
11347 +
11348 +#if GNULIB_GETPEERNAME
11349 +int
11350 +rpl_getpeername (int fd, struct sockaddr *addr, int *addrlen)
11351 +{
11352 +  SOCKET sock = FD_TO_SOCKET (fd);
11353 +  int r = getpeername (sock, addr, addrlen);
11354 +  if (r < 0)
11355 +    set_winsock_errno ();
11356 +
11357 +  return r;
11358 +}
11359 +#endif
11360 +
11361 +#if GNULIB_GETSOCKNAME
11362 +int
11363 +rpl_getsockname (int fd, struct sockaddr *addr, int *addrlen)
11364 +{
11365 +  SOCKET sock = FD_TO_SOCKET (fd);
11366 +  int r = getsockname (sock, addr, addrlen);
11367 +  if (r < 0)
11368 +    set_winsock_errno ();
11369 +
11370 +  return r;
11371 +}
11372 +#endif
11373 +
11374 +#if GNULIB_GETSOCKOPT
11375 +int
11376 +rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen)
11377 +{
11378 +  SOCKET sock = FD_TO_SOCKET (fd);
11379 +  int r = getsockopt (sock, level, optname, optval, optlen);
11380 +  if (r < 0)
11381 +    set_winsock_errno ();
11382 +
11383 +  return r;
11384 +}
11385 +#endif
11386 +
11387 +#if GNULIB_LISTEN
11388 +int
11389 +rpl_listen (int fd, int backlog)
11390 +{
11391 +  SOCKET sock = FD_TO_SOCKET (fd);
11392 +  int r = listen (sock, backlog);
11393 +  if (r < 0)
11394 +    set_winsock_errno ();
11395 +
11396 +  return r;
11397 +}
11398 +#endif
11399 +
11400 +int
11401 +rpl_ioctl (int fd, unsigned long req, char *buf)
11402 +{
11403 +  SOCKET sock = FD_TO_SOCKET (fd);
11404 +  int r = ioctlsocket (sock, req, (void *) buf);
11405 +  if (r < 0)
11406 +    set_winsock_errno ();
11407 +
11408 +  return r;
11409 +}
11410 +
11411 +#if GNULIB_RECV
11412 +int
11413 +rpl_recv (int fd, void *buf, int len, int flags)
11414 +{
11415 +  SOCKET sock = FD_TO_SOCKET (fd);
11416 +  int r = recv (sock, buf, len, flags);
11417 +  if (r < 0)
11418 +    set_winsock_errno ();
11419 +
11420 +  return r;
11421 +}
11422 +#endif
11423 +
11424 +#if GNULIB_SEND
11425 +int
11426 +rpl_send (int fd, const void *buf, int len, int flags)
11427 +{
11428 +  SOCKET sock = FD_TO_SOCKET (fd);
11429 +  int r = send (sock, buf, len, flags);
11430 +  if (r < 0)
11431 +    set_winsock_errno ();
11432 +
11433 +  return r;
11434 +}
11435 +#endif
11436 +
11437 +#if GNULIB_RECVFROM
11438 +int
11439 +rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from,
11440 +             int *fromlen)
11441 +{
11442 +  int frombufsize = *fromlen;
11443 +  SOCKET sock = FD_TO_SOCKET (fd);
11444 +  int r = recvfrom (sock, buf, len, flags, from, fromlen);
11445 +
11446 +  if (r < 0)
11447 +    set_winsock_errno ();
11448 +
11449 +  /* Winsock recvfrom() only returns a valid 'from' when the socket is
11450 +     connectionless.  POSIX gives a valid 'from' for all types of sockets.  */
11451 +  else if (*fromlen == frombufsize)
11452 +    rpl_getpeername (fd, from, fromlen);
11453 +
11454 +  return r;
11455 +}
11456 +#endif
11457 +
11458 +#if GNULIB_SENDTO
11459 +int
11460 +rpl_sendto (int fd, const void *buf, int len, int flags,
11461 +           struct sockaddr *to, int tolen)
11462 +{
11463 +  SOCKET sock = FD_TO_SOCKET (fd);
11464 +  int r = sendto (sock, buf, len, flags, to, tolen);
11465 +  if (r < 0)
11466 +    set_winsock_errno ();
11467 +
11468 +  return r;
11469 +}
11470 +#endif
11471 +
11472 +#if GNULIB_SETSOCKOPT
11473 +int
11474 +rpl_setsockopt (int fd, int level, int optname, const void *optval, int optlen)
11475 +{
11476 +  SOCKET sock = FD_TO_SOCKET (fd);
11477 +  int r = setsockopt (sock, level, optname, optval, optlen);
11478 +  if (r < 0)
11479 +    set_winsock_errno ();
11480 +
11481 +  return r;
11482 +}
11483 +#endif
11484 diff -urN gtk-vnc-0.3.7.dan3/gnulib/lib/xsize.h gtk-vnc-0.3.7.gnulib/gnulib/lib/xsize.h
11485 --- gtk-vnc-0.3.7.dan3/gnulib/lib/xsize.h       1970-01-01 01:00:00.000000000 +0100
11486 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/xsize.h     2008-10-09 15:24:52.000000000 +0100
11487 @@ -0,0 +1,108 @@
11488 +/* xsize.h -- Checked size_t computations.
11489 +
11490 +   Copyright (C) 2003, 2008 Free Software Foundation, Inc.
11491 +
11492 +   This program is free software; you can redistribute it and/or modify
11493 +   it under the terms of the GNU Lesser General Public License as published by
11494 +   the Free Software Foundation; either version 2.1, or (at your option)
11495 +   any later version.
11496 +
11497 +   This program is distributed in the hope that it will be useful,
11498 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
11499 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11500 +   GNU Lesser General Public License for more details.
11501 +
11502 +   You should have received a copy of the GNU Lesser General Public License
11503 +   along with this program; if not, write to the Free Software Foundation,
11504 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
11505 +
11506 +#ifndef _XSIZE_H
11507 +#define _XSIZE_H
11508 +
11509 +/* Get size_t.  */
11510 +#include <stddef.h>
11511 +
11512 +/* Get SIZE_MAX.  */
11513 +#include <limits.h>
11514 +#if HAVE_STDINT_H
11515 +# include <stdint.h>
11516 +#endif
11517 +
11518 +/* The size of memory objects is often computed through expressions of
11519 +   type size_t. Example:
11520 +      void* p = malloc (header_size + n * element_size).
11521 +   These computations can lead to overflow.  When this happens, malloc()
11522 +   returns a piece of memory that is way too small, and the program then
11523 +   crashes while attempting to fill the memory.
11524 +   To avoid this, the functions and macros in this file check for overflow.
11525 +   The convention is that SIZE_MAX represents overflow.
11526 +   malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc
11527 +   implementation that uses mmap --, it's recommended to use size_overflow_p()
11528 +   or size_in_bounds_p() before invoking malloc().
11529 +   The example thus becomes:
11530 +      size_t size = xsum (header_size, xtimes (n, element_size));
11531 +      void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
11532 +*/
11533 +
11534 +/* Convert an arbitrary value >= 0 to type size_t.  */
11535 +#define xcast_size_t(N) \
11536 +  ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
11537 +
11538 +/* Sum of two sizes, with overflow check.  */
11539 +static inline size_t
11540 +#if __GNUC__ >= 3
11541 +__attribute__ ((__pure__))
11542 +#endif
11543 +xsum (size_t size1, size_t size2)
11544 +{
11545 +  size_t sum = size1 + size2;
11546 +  return (sum >= size1 ? sum : SIZE_MAX);
11547 +}
11548 +
11549 +/* Sum of three sizes, with overflow check.  */
11550 +static inline size_t
11551 +#if __GNUC__ >= 3
11552 +__attribute__ ((__pure__))
11553 +#endif
11554 +xsum3 (size_t size1, size_t size2, size_t size3)
11555 +{
11556 +  return xsum (xsum (size1, size2), size3);
11557 +}
11558 +
11559 +/* Sum of four sizes, with overflow check.  */
11560 +static inline size_t
11561 +#if __GNUC__ >= 3
11562 +__attribute__ ((__pure__))
11563 +#endif
11564 +xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
11565 +{
11566 +  return xsum (xsum (xsum (size1, size2), size3), size4);
11567 +}
11568 +
11569 +/* Maximum of two sizes, with overflow check.  */
11570 +static inline size_t
11571 +#if __GNUC__ >= 3
11572 +__attribute__ ((__pure__))
11573 +#endif
11574 +xmax (size_t size1, size_t size2)
11575 +{
11576 +  /* No explicit check is needed here, because for any n:
11577 +     max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX.  */
11578 +  return (size1 >= size2 ? size1 : size2);
11579 +}
11580 +
11581 +/* Multiplication of a count with an element size, with overflow check.
11582 +   The count must be >= 0 and the element size must be > 0.
11583 +   This is a macro, not an inline function, so that it works correctly even
11584 +   when N is of a wider type and N > SIZE_MAX.  */
11585 +#define xtimes(N, ELSIZE) \
11586 +  ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
11587 +
11588 +/* Check for overflow.  */
11589 +#define size_overflow_p(SIZE) \
11590 +  ((SIZE) == SIZE_MAX)
11591 +/* Check against overflow.  */
11592 +#define size_in_bounds_p(SIZE) \
11593 +  ((SIZE) != SIZE_MAX)
11594 +
11595 +#endif /* _XSIZE_H */
11596 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/alloca.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/alloca.m4
11597 --- gtk-vnc-0.3.7.dan3/gnulib/m4/alloca.m4      1970-01-01 01:00:00.000000000 +0100
11598 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/alloca.m4    2008-10-09 15:24:52.000000000 +0100
11599 @@ -0,0 +1,46 @@
11600 +# alloca.m4 serial 8
11601 +dnl Copyright (C) 2002-2004, 2006, 2007 Free Software Foundation, Inc.
11602 +dnl This file is free software; the Free Software Foundation
11603 +dnl gives unlimited permission to copy and/or distribute it,
11604 +dnl with or without modifications, as long as this notice is preserved.
11605 +
11606 +AC_DEFUN([gl_FUNC_ALLOCA],
11607 +[
11608 +  dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
11609 +  AC_REQUIRE([AC_PROG_CPP])
11610 +  AC_REQUIRE([AC_PROG_EGREP])
11611 +
11612 +  AC_REQUIRE([AC_FUNC_ALLOCA])
11613 +  if test $ac_cv_func_alloca_works = no; then
11614 +    gl_PREREQ_ALLOCA
11615 +  fi
11616 +
11617 +  # Define an additional variable used in the Makefile substitution.
11618 +  if test $ac_cv_working_alloca_h = yes; then
11619 +    AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [
11620 +      AC_EGREP_CPP([Need own alloca], [
11621 +#if defined __GNUC__ || defined _AIX || defined _MSC_VER
11622 +        Need own alloca
11623 +#endif
11624 +        ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no])
11625 +    ])
11626 +    if test $gl_cv_rpl_alloca = yes; then
11627 +      dnl OK, alloca can be implemented through a compiler built-in.
11628 +      AC_DEFINE([HAVE_ALLOCA], 1,
11629 +        [Define to 1 if you have 'alloca' after including <alloca.h>,
11630 +         a header that may be supplied by this distribution.])
11631 +      ALLOCA_H=alloca.h
11632 +    else
11633 +      dnl alloca exists as a library function, i.e. it is slow and probably
11634 +      dnl a memory leak. Don't define HAVE_ALLOCA in this case.
11635 +      ALLOCA_H=
11636 +    fi
11637 +  else
11638 +    ALLOCA_H=alloca.h
11639 +  fi
11640 +  AC_SUBST([ALLOCA_H])
11641 +])
11642 +
11643 +# Prerequisites of lib/alloca.c.
11644 +# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
11645 +AC_DEFUN([gl_PREREQ_ALLOCA], [:])
11646 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/arpa_inet_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/arpa_inet_h.m4
11647 --- gtk-vnc-0.3.7.dan3/gnulib/m4/arpa_inet_h.m4 1970-01-01 01:00:00.000000000 +0100
11648 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/arpa_inet_h.m4       2008-10-09 15:24:52.000000000 +0100
11649 @@ -0,0 +1,50 @@
11650 +# arpa_inet_h.m4 serial 5
11651 +dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc.
11652 +dnl This file is free software; the Free Software Foundation
11653 +dnl gives unlimited permission to copy and/or distribute it,
11654 +dnl with or without modifications, as long as this notice is preserved.
11655 +
11656 +dnl Written by Simon Josefsson and Bruno Haible
11657 +
11658 +AC_DEFUN([gl_HEADER_ARPA_INET],
11659 +[
11660 +  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
11661 +  dnl once only, before all statements that occur in other macros.
11662 +  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
11663 +
11664 +  AC_CHECK_HEADERS_ONCE([arpa/inet.h])
11665 +  if test $ac_cv_header_arpa_inet_h = yes; then
11666 +    HAVE_ARPA_INET_H=1
11667 +  else
11668 +    ARPA_INET_H='arpa/inet.h'
11669 +    HAVE_ARPA_INET_H=0
11670 +  fi
11671 +  AC_SUBST([HAVE_ARPA_INET_H])
11672 +  dnl Execute this unconditionally, because ARPA_INET_H may be set by other
11673 +  dnl modules, after this code is executed.
11674 +  gl_CHECK_NEXT_HEADERS([arpa/inet.h])
11675 +])
11676 +
11677 +dnl Unconditionally enables the replacement of <arpa/inet.h>.
11678 +AC_DEFUN([gl_REPLACE_ARPA_INET_H],
11679 +[
11680 +  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
11681 +  ARPA_INET_H='arpa/inet.h'
11682 +])
11683 +
11684 +AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
11685 +[
11686 +  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
11687 +  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
11688 +  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
11689 +])
11690 +
11691 +AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
11692 +[
11693 +  GNULIB_INET_NTOP=0;     AC_SUBST([GNULIB_INET_NTOP])
11694 +  GNULIB_INET_PTON=0;     AC_SUBST([GNULIB_INET_PTON])
11695 +  dnl Assume proper GNU behavior unless another module says otherwise.
11696 +  HAVE_DECL_INET_NTOP=1;  AC_SUBST([HAVE_DECL_INET_NTOP])
11697 +  HAVE_DECL_INET_PTON=1;  AC_SUBST([HAVE_DECL_INET_PTON])
11698 +  ARPA_INET_H='';         AC_SUBST([ARPA_INET_H])
11699 +])
11700 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/errno_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/errno_h.m4
11701 --- gtk-vnc-0.3.7.dan3/gnulib/m4/errno_h.m4     1970-01-01 01:00:00.000000000 +0100
11702 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/errno_h.m4   2008-10-09 15:24:52.000000000 +0100
11703 @@ -0,0 +1,113 @@
11704 +# errno_h.m4 serial 1
11705 +dnl Copyright (C) 2004, 2006, 2008 Free Software Foundation, Inc.
11706 +dnl This file is free software; the Free Software Foundation
11707 +dnl gives unlimited permission to copy and/or distribute it,
11708 +dnl with or without modifications, as long as this notice is preserved.
11709 +
11710 +AC_DEFUN([gl_HEADER_ERRNO_H],
11711 +[
11712 +  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
11713 +  dnl once only, before all statements that occur in other macros.
11714 +  AC_REQUIRE([gl_HEADER_ERRNO_H_BODY])
11715 +])
11716 +
11717 +AC_DEFUN([gl_HEADER_ERRNO_H_BODY],
11718 +[
11719 +  AC_REQUIRE([AC_PROG_CC])
11720 +  AC_CACHE_CHECK([for complete errno.h], gl_cv_header_errno_h_complete, [
11721 +    AC_EGREP_CPP(booboo,[
11722 +#include <errno.h>
11723 +#if !defined ENOMSG
11724 +booboo
11725 +#endif
11726 +#if !defined EIDRM
11727 +booboo
11728 +#endif
11729 +#if !defined ENOLINK
11730 +booboo
11731 +#endif
11732 +#if !defined EPROTO
11733 +booboo
11734 +#endif
11735 +#if !defined EMULTIHOP
11736 +booboo
11737 +#endif
11738 +#if !defined EBADMSG
11739 +booboo
11740 +#endif
11741 +#if !defined EOVERFLOW
11742 +booboo
11743 +#endif
11744 +#if !defined ENOTSUP
11745 +booboo
11746 +#endif
11747 +#if !defined ECANCELED
11748 +booboo
11749 +#endif
11750 +      ],
11751 +      [gl_cv_header_errno_h_complete=no],
11752 +      [gl_cv_header_errno_h_complete=yes])
11753 +  ])
11754 +  if test $gl_cv_header_errno_h_complete = yes; then
11755 +    ERRNO_H=''
11756 +  else
11757 +    gl_CHECK_NEXT_HEADERS([errno.h])
11758 +    ERRNO_H='errno.h'
11759 +  fi
11760 +  AC_SUBST([ERRNO_H])
11761 +  gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
11762 +  gl_REPLACE_ERRNO_VALUE([ENOLINK])
11763 +  gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
11764 +])
11765 +
11766 +# Assuming $1 = EOVERFLOW.
11767 +# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
11768 +# POSIX.  But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
11769 +# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
11770 +# Check for the value of EOVERFLOW.
11771 +# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
11772 +AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
11773 +[
11774 +  if test -n "$ERRNO_H"; then
11775 +    AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
11776 +      AC_EGREP_CPP(yes,[
11777 +#include <errno.h>
11778 +#ifdef ]$1[
11779 +yes
11780 +#endif
11781 +      ],
11782 +      [gl_cv_header_errno_h_]$1[=yes],
11783 +      [gl_cv_header_errno_h_]$1[=no])
11784 +      if test $gl_cv_header_errno_h_]$1[ = no; then
11785 +        AC_EGREP_CPP(yes,[
11786 +#define _XOPEN_SOURCE_EXTENDED 1
11787 +#include <errno.h>
11788 +#ifdef ]$1[
11789 +yes
11790 +#endif
11791 +          ], [gl_cv_header_errno_h_]$1[=hidden])
11792 +        if test $gl_cv_header_errno_h_]$1[ = hidden; then
11793 +          dnl The macro exists but is hidden.
11794 +          dnl Define it to the same value.
11795 +          AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
11796 +#define _XOPEN_SOURCE_EXTENDED 1
11797 +#include <errno.h>
11798 +/* The following two lines are a workaround against an autoconf-2.52 bug.  */
11799 +#include <stdio.h>
11800 +#include <stdlib.h>
11801 +])
11802 +        fi
11803 +      fi
11804 +    ])
11805 +    case $gl_cv_header_errno_h_]$1[ in
11806 +      yes | no)
11807 +        ]$1[_HIDDEN=0; ]$1[_VALUE=
11808 +        ;;
11809 +      *)
11810 +        ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
11811 +        ;;
11812 +    esac
11813 +    AC_SUBST($1[_HIDDEN])
11814 +    AC_SUBST($1[_VALUE])
11815 +  fi
11816 +])
11817 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/extensions.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/extensions.m4
11818 --- gtk-vnc-0.3.7.dan3/gnulib/m4/extensions.m4  1970-01-01 01:00:00.000000000 +0100
11819 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/extensions.m4        2008-10-09 15:24:52.000000000 +0100
11820 @@ -0,0 +1,82 @@
11821 +# serial 5  -*- Autoconf -*-
11822 +# Enable extensions on systems that normally disable them.
11823 +
11824 +# Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc.
11825 +# This file is free software; the Free Software Foundation
11826 +# gives unlimited permission to copy and/or distribute it,
11827 +# with or without modifications, as long as this notice is preserved.
11828 +
11829 +# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
11830 +# Autoconf.  Perhaps we can remove this once we can assume Autoconf
11831 +# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
11832 +# enough in this area it's likely we'll need to redefine
11833 +# AC_USE_SYSTEM_EXTENSIONS for quite some time.
11834 +
11835 +# AC_USE_SYSTEM_EXTENSIONS
11836 +# ------------------------
11837 +# Enable extensions on systems that normally disable them,
11838 +# typically due to standards-conformance issues.
11839 +# Remember that #undef in AH_VERBATIM gets replaced with #define by
11840 +# AC_DEFINE.  The goal here is to define all known feature-enabling
11841 +# macros, then, if reports of conflicts are made, disable macros that
11842 +# cause problems on some platforms (such as __EXTENSIONS__).
11843 +AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
11844 +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
11845 +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
11846 +
11847 +  AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
11848 +  if test "$MINIX" = yes; then
11849 +    AC_DEFINE([_POSIX_SOURCE], [1],
11850 +      [Define to 1 if you need to in order for `stat' and other
11851 +       things to work.])
11852 +    AC_DEFINE([_POSIX_1_SOURCE], [2],
11853 +      [Define to 2 if the system does not provide POSIX.1 features
11854 +       except with this defined.])
11855 +    AC_DEFINE([_MINIX], [1],
11856 +      [Define to 1 if on MINIX.])
11857 +  fi
11858 +
11859 +  AH_VERBATIM([__EXTENSIONS__],
11860 +[/* Enable extensions on AIX 3, Interix.  */
11861 +#ifndef _ALL_SOURCE
11862 +# undef _ALL_SOURCE
11863 +#endif
11864 +/* Enable GNU extensions on systems that have them.  */
11865 +#ifndef _GNU_SOURCE
11866 +# undef _GNU_SOURCE
11867 +#endif
11868 +/* Enable threading extensions on Solaris.  */
11869 +#ifndef _POSIX_PTHREAD_SEMANTICS
11870 +# undef _POSIX_PTHREAD_SEMANTICS
11871 +#endif
11872 +/* Enable extensions on HP NonStop.  */
11873 +#ifndef _TANDEM_SOURCE
11874 +# undef _TANDEM_SOURCE
11875 +#endif
11876 +/* Enable general extensions on Solaris.  */
11877 +#ifndef __EXTENSIONS__
11878 +# undef __EXTENSIONS__
11879 +#endif
11880 +])
11881 +  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
11882 +    [ac_cv_safe_to_define___extensions__],
11883 +    [AC_COMPILE_IFELSE(
11884 +       [AC_LANG_PROGRAM([[
11885 +#        define __EXTENSIONS__ 1
11886 +         ]AC_INCLUDES_DEFAULT])],
11887 +       [ac_cv_safe_to_define___extensions__=yes],
11888 +       [ac_cv_safe_to_define___extensions__=no])])
11889 +  test $ac_cv_safe_to_define___extensions__ = yes &&
11890 +    AC_DEFINE([__EXTENSIONS__])
11891 +  AC_DEFINE([_ALL_SOURCE])
11892 +  AC_DEFINE([_GNU_SOURCE])
11893 +  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
11894 +  AC_DEFINE([_TANDEM_SOURCE])
11895 +])# AC_USE_SYSTEM_EXTENSIONS
11896 +
11897 +# gl_USE_SYSTEM_EXTENSIONS
11898 +# ------------------------
11899 +# Enable extensions on systems that normally disable them,
11900 +# typically due to standards-conformance issues.
11901 +AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
11902 +  [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
11903 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/float_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/float_h.m4
11904 --- gtk-vnc-0.3.7.dan3/gnulib/m4/float_h.m4     1970-01-01 01:00:00.000000000 +0100
11905 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/float_h.m4   2008-10-09 15:24:52.000000000 +0100
11906 @@ -0,0 +1,19 @@
11907 +# float_h.m4 serial 3
11908 +dnl Copyright (C) 2007 Free Software Foundation, Inc.
11909 +dnl This file is free software; the Free Software Foundation
11910 +dnl gives unlimited permission to copy and/or distribute it,
11911 +dnl with or without modifications, as long as this notice is preserved.
11912 +
11913 +AC_DEFUN([gl_FLOAT_H],
11914 +[
11915 +  AC_REQUIRE([AC_PROG_CC])
11916 +  AC_REQUIRE([AC_CANONICAL_HOST])
11917 +  FLOAT_H=
11918 +  case "$host_os" in
11919 +    beos* | openbsd*)
11920 +      FLOAT_H=float.h
11921 +      gl_CHECK_NEXT_HEADERS([float.h])
11922 +      ;;
11923 +  esac
11924 +  AC_SUBST([FLOAT_H])
11925 +])
11926 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/getaddrinfo.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/getaddrinfo.m4
11927 --- gtk-vnc-0.3.7.dan3/gnulib/m4/getaddrinfo.m4 1970-01-01 01:00:00.000000000 +0100
11928 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/getaddrinfo.m4       2008-10-09 15:24:52.000000000 +0100
11929 @@ -0,0 +1,130 @@
11930 +# getaddrinfo.m4 serial 15
11931 +dnl Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
11932 +dnl This file is free software; the Free Software Foundation
11933 +dnl gives unlimited permission to copy and/or distribute it,
11934 +dnl with or without modifications, as long as this notice is preserved.
11935 +
11936 +AC_DEFUN([gl_GETADDRINFO],
11937 +[
11938 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
11939 +  AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo])
11940 +
11941 +  AC_CHECK_HEADERS_ONCE(netdb.h)
11942 +
11943 +  AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
11944 +  AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
11945 +    AC_TRY_LINK([
11946 +#include <sys/types.h>
11947 +#ifdef HAVE_SYS_SOCKET_H
11948 +#include <sys/socket.h>
11949 +#endif
11950 +#ifdef HAVE_NETDB_H
11951 +#include <netdb.h>
11952 +#endif
11953 +#include <stddef.h>
11954 +], [getaddrinfo("", "", NULL, NULL);],
11955 +      [gl_cv_func_getaddrinfo=yes],
11956 +      [gl_cv_func_getaddrinfo=no])])
11957 +  if test $gl_cv_func_getaddrinfo = no; then
11958 +    AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
11959 +                  gl_cv_w32_getaddrinfo, [
11960 +      gl_cv_w32_getaddrinfo=no
11961 +      am_save_LIBS="$LIBS"
11962 +      LIBS="$LIBS -lws2_32"
11963 +      AC_TRY_LINK([
11964 +#ifdef HAVE_WS2TCPIP_H
11965 +#include <ws2tcpip.h>
11966 +#endif
11967 +#include <stddef.h>
11968 +], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes)
11969 +    LIBS="$am_save_LIBS"])
11970 +    if test "$gl_cv_w32_getaddrinfo" = "yes"; then
11971 +      LIBS="$LIBS -lws2_32"
11972 +    else
11973 +      AC_LIBOBJ(getaddrinfo)
11974 +    fi
11975 +  fi
11976 +
11977 +  # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
11978 +  # inline function declared in ws2tcpip.h, so we need to get that
11979 +  # header included somehow.
11980 +  AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
11981 +    gl_cv_func_gai_strerror, [
11982 +      AC_TRY_LINK([
11983 +#include <sys/types.h>
11984 +#ifdef HAVE_SYS_SOCKET_H
11985 +#include <sys/socket.h>
11986 +#endif
11987 +#ifdef HAVE_NETDB_H
11988 +#include <netdb.h>
11989 +#endif
11990 +#ifdef HAVE_WS2TCPIP_H
11991 +#include <ws2tcpip.h>
11992 +#endif
11993 +#include <stddef.h>
11994 +], [gai_strerror (NULL);],
11995 +        [gl_cv_func_gai_strerror=yes],
11996 +        [gl_cv_func_gai_strerror=no])])
11997 +  if test $gl_cv_func_gai_strerror = no; then
11998 +    AC_LIBOBJ(gai_strerror)
11999 +  fi
12000 +
12001 +  gl_PREREQ_GETADDRINFO
12002 +])
12003 +
12004 +# Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c.
12005 +AC_DEFUN([gl_PREREQ_GETADDRINFO], [
12006 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
12007 +  AC_SEARCH_LIBS(gethostbyname, [inet nsl])
12008 +  AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
12009 +  AC_CHECK_FUNCS(gethostbyname,, [
12010 +    AC_CACHE_CHECK(for gethostbyname in winsock2.h and -lws2_32,
12011 +                  gl_cv_w32_gethostbyname, [
12012 +      gl_cv_w32_gethostbyname=no
12013 +      am_save_LIBS="$LIBS"
12014 +      LIBS="$LIBS -lws2_32"
12015 +      AC_TRY_LINK([
12016 +#ifdef HAVE_WINSOCK2_H
12017 +#include <winsock2.h>
12018 +#endif
12019 +#include <stddef.h>
12020 +], [gethostbyname(NULL);], gl_cv_w32_gethostbyname=yes)
12021 +    LIBS="$am_save_LIBS"])
12022 +    if test "$gl_cv_w32_gethostbyname" = "yes"; then
12023 +      LIBS="$LIBS -lws2_32"
12024 +    fi
12025 +    ])
12026 +  AC_REQUIRE([AC_C_RESTRICT])
12027 +  AC_REQUIRE([gl_SOCKET_FAMILIES])
12028 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
12029 +  AC_REQUIRE([AC_C_INLINE])
12030 +  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
12031 +  AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h)
12032 +  AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
12033 +  /* sys/types.h is not needed according to POSIX, but the
12034 +     sys/socket.h in i386-unknown-freebsd4.10 and
12035 +     powerpc-apple-darwin5.5 required it. */
12036 +#include <sys/types.h>
12037 +#ifdef HAVE_SYS_SOCKET_H
12038 +#include <sys/socket.h>
12039 +#endif
12040 +#ifdef HAVE_NETDB_H
12041 +#include <netdb.h>
12042 +#endif
12043 +#ifdef HAVE_WS2TCPIP_H
12044 +#include <ws2tcpip.h>
12045 +#endif
12046 +])
12047 +  AC_CHECK_TYPES([struct addrinfo],,,[
12048 +#include <sys/types.h>
12049 +#ifdef HAVE_SYS_SOCKET_H
12050 +#include <sys/socket.h>
12051 +#endif
12052 +#ifdef HAVE_NETDB_H
12053 +#include <netdb.h>
12054 +#endif
12055 +#ifdef HAVE_WS2TCPIP_H
12056 +#include <ws2tcpip.h>
12057 +#endif
12058 +])
12059 +])
12060 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/gnulib-cache.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-cache.m4
12061 --- gtk-vnc-0.3.7.dan3/gnulib/m4/gnulib-cache.m4        1970-01-01 01:00:00.000000000 +0100
12062 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-cache.m4      2008-10-09 15:24:53.000000000 +0100
12063 @@ -0,0 +1,43 @@
12064 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
12065 +#
12066 +# This file is free software, distributed under the terms of the GNU
12067 +# General Public License.  As a special exception to the GNU General
12068 +# Public License, this file may be distributed as part of a program
12069 +# that contains a configuration script generated by Autoconf, under
12070 +# the same distribution terms as the rest of that program.
12071 +#
12072 +# Generated by gnulib-tool.
12073 +#
12074 +# This file represents the specification of how gnulib-tool is used.
12075 +# It acts as a cache: It is written and read by gnulib-tool.
12076 +# In projects using CVS, this file is meant to be stored in CVS,
12077 +# like the configure.ac and various Makefile.am files.
12078 +
12079 +
12080 +# Specification in the form of a command-line invocation:
12081 +#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=. --with-tests --lgpl=2 --libtool --macro-prefix=gl connect getaddrinfo malloc recv send socket vc-list-files
12082 +
12083 +# Specification in the form of a few gnulib-tool.m4 macro invocations:
12084 +gl_LOCAL_DIR([])
12085 +gl_MODULES([
12086 +  connect
12087 +  getaddrinfo
12088 +  malloc
12089 +  recv
12090 +  send
12091 +  socket
12092 +  vc-list-files
12093 +])
12094 +gl_AVOID([])
12095 +gl_SOURCE_BASE([gnulib/lib])
12096 +gl_M4_BASE([gnulib/m4])
12097 +gl_PO_BASE([])
12098 +gl_DOC_BASE([doc])
12099 +gl_TESTS_BASE([gnulib/tests])
12100 +gl_WITH_TESTS
12101 +gl_LIB([libgnu])
12102 +gl_LGPL([2])
12103 +gl_MAKEFILE_NAME([])
12104 +gl_LIBTOOL
12105 +gl_MACRO_PREFIX([gl])
12106 +gl_PO_DOMAIN([])
12107 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/gnulib-common.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-common.m4
12108 --- gtk-vnc-0.3.7.dan3/gnulib/m4/gnulib-common.m4       1970-01-01 01:00:00.000000000 +0100
12109 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-common.m4     2008-10-09 15:24:52.000000000 +0100
12110 @@ -0,0 +1,91 @@
12111 +# gnulib-common.m4 serial 5
12112 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
12113 +dnl This file is free software; the Free Software Foundation
12114 +dnl gives unlimited permission to copy and/or distribute it,
12115 +dnl with or without modifications, as long as this notice is preserved.
12116 +
12117 +# gl_COMMON
12118 +# is expanded unconditionally through gnulib-tool magic.
12119 +AC_DEFUN([gl_COMMON], [
12120 +  dnl Use AC_REQUIRE here, so that the code is expanded once only.
12121 +  AC_REQUIRE([gl_COMMON_BODY])
12122 +])
12123 +AC_DEFUN([gl_COMMON_BODY], [
12124 +  AH_VERBATIM([isoc99_inline],
12125 +[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
12126 +   the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
12127 +   earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
12128 +   __APPLE__ && __MACH__ test for MacOS X.
12129 +   __APPLE_CC__ tests for the Apple compiler and its version.
12130 +   __STDC_VERSION__ tests for the C99 mode.  */
12131 +#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
12132 +# define __GNUC_STDC_INLINE__ 1
12133 +#endif])
12134 +])
12135 +
12136 +# gl_MODULE_INDICATOR([modulename])
12137 +# defines a C macro indicating the presence of the given module.
12138 +AC_DEFUN([gl_MODULE_INDICATOR],
12139 +[
12140 +  AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
12141 +    [Define to 1 when using the gnulib module ]$1[.])
12142 +])
12143 +
12144 +# m4_foreach_w
12145 +# is a backport of autoconf-2.59c's m4_foreach_w.
12146 +# Remove this macro when we can assume autoconf >= 2.60.
12147 +m4_ifndef([m4_foreach_w],
12148 +  [m4_define([m4_foreach_w],
12149 +    [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
12150 +
12151 +# AC_PROG_MKDIR_P
12152 +# is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
12153 +# Remove this macro when we can assume autoconf >= 2.60.
12154 +m4_ifdef([AC_PROG_MKDIR_P], [], [
12155 +  AC_DEFUN([AC_PROG_MKDIR_P],
12156 +    [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
12157 +     MKDIR_P='$(mkdir_p)'
12158 +     AC_SUBST([MKDIR_P])])])
12159 +
12160 +# AC_C_RESTRICT
12161 +# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
12162 +# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
12163 +# works.
12164 +# This definition can be removed once autoconf >= 2.62 can be assumed.
12165 +AC_DEFUN([AC_C_RESTRICT],
12166 +[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
12167 +  [ac_cv_c_restrict=no
12168 +   # The order here caters to the fact that C++ does not require restrict.
12169 +   for ac_kw in __restrict __restrict__ _Restrict restrict; do
12170 +     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
12171 +      [[typedef int * int_ptr;
12172 +       int foo (int_ptr $ac_kw ip) {
12173 +       return ip[0];
12174 +       }]],
12175 +      [[int s[1];
12176 +       int * $ac_kw t = s;
12177 +       t[0] = 0;
12178 +       return foo(t)]])],
12179 +      [ac_cv_c_restrict=$ac_kw])
12180 +     test "$ac_cv_c_restrict" != no && break
12181 +   done
12182 +  ])
12183 + AH_VERBATIM([restrict],
12184 +[/* Define to the equivalent of the C99 'restrict' keyword, or to
12185 +   nothing if this is not supported.  Do not define if restrict is
12186 +   supported directly.  */
12187 +#undef restrict
12188 +/* Work around a bug in Sun C++: it does not support _Restrict, even
12189 +   though the corresponding Sun C compiler does, which causes
12190 +   "#define restrict _Restrict" in the previous line.  Perhaps some future
12191 +   version of Sun C++ will work with _Restrict; if so, it'll probably
12192 +   define __RESTRICT, just as Sun C does.  */
12193 +#if defined __SUNPRO_CC && !defined __RESTRICT
12194 +# define _Restrict
12195 +#endif])
12196 + case $ac_cv_c_restrict in
12197 +   restrict) ;;
12198 +   no) AC_DEFINE([restrict], []) ;;
12199 +   *)  AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
12200 + esac
12201 +])
12202 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/gnulib-comp.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-comp.m4
12203 --- gtk-vnc-0.3.7.dan3/gnulib/m4/gnulib-comp.m4 1970-01-01 01:00:00.000000000 +0100
12204 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-comp.m4       2008-10-09 15:24:54.000000000 +0100
12205 @@ -0,0 +1,314 @@
12206 +# DO NOT EDIT! GENERATED AUTOMATICALLY!
12207 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
12208 +#
12209 +# This file is free software, distributed under the terms of the GNU
12210 +# General Public License.  As a special exception to the GNU General
12211 +# Public License, this file may be distributed as part of a program
12212 +# that contains a configuration script generated by Autoconf, under
12213 +# the same distribution terms as the rest of that program.
12214 +#
12215 +# Generated by gnulib-tool.
12216 +#
12217 +# This file represents the compiled summary of the specification in
12218 +# gnulib-cache.m4. It lists the computed macro invocations that need
12219 +# to be invoked from configure.ac.
12220 +# In projects using CVS, this file can be treated like other built files.
12221 +
12222 +
12223 +# This macro should be invoked from ./configure.ac, in the section
12224 +# "Checks for programs", right after AC_PROG_CC, and certainly before
12225 +# any checks for libraries, header files, types and library functions.
12226 +AC_DEFUN([gl_EARLY],
12227 +[
12228 +  m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
12229 +  m4_pattern_allow([^gl_ES$])dnl a valid locale name
12230 +  m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
12231 +  m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
12232 +  AC_REQUIRE([AC_PROG_RANLIB])
12233 +  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12234 +])
12235 +
12236 +# This macro should be invoked from ./configure.ac, in the section
12237 +# "Check for header files, types and library functions".
12238 +AC_DEFUN([gl_INIT],
12239 +[
12240 +  AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
12241 +  gl_cond_libtool=true
12242 +  m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
12243 +  m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
12244 +  m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
12245 +  m4_pushdef([gl_LIBSOURCES_LIST], [])
12246 +  m4_pushdef([gl_LIBSOURCES_DIR], [])
12247 +  gl_COMMON
12248 +  gl_source_base='gnulib/lib'
12249 +  gl_FUNC_ALLOCA
12250 +  gl_HEADER_ARPA_INET
12251 +  AC_PROG_MKDIR_P
12252 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
12253 +  if test "$ac_cv_header_winsock2_h" = yes; then
12254 +    AC_LIBOBJ([winsock])
12255 +  fi
12256 +  gl_SYS_SOCKET_MODULE_INDICATOR([connect])
12257 +  gl_HEADER_ERRNO_H
12258 +  gl_FLOAT_H
12259 +  gl_GETADDRINFO
12260 +  AC_SUBST([LIBINTL])
12261 +  AC_SUBST([LTLIBINTL])
12262 +  gl_INET_NTOP
12263 +  gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
12264 +  AC_FUNC_MALLOC
12265 +  AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.])
12266 +  gl_FUNC_MALLOC_POSIX
12267 +  gl_STDLIB_MODULE_INDICATOR([malloc-posix])
12268 +  gl_HEADER_NETINET_IN
12269 +  AC_PROG_MKDIR_P
12270 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
12271 +  if test "$ac_cv_header_winsock2_h" = yes; then
12272 +    AC_LIBOBJ([winsock])
12273 +  fi
12274 +  gl_SYS_SOCKET_MODULE_INDICATOR([recv])
12275 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
12276 +  if test "$ac_cv_header_winsock2_h" = yes; then
12277 +    AC_LIBOBJ([winsock])
12278 +  fi
12279 +  gl_SYS_SOCKET_MODULE_INDICATOR([send])
12280 +  gl_SIZE_MAX
12281 +  gl_FUNC_SNPRINTF
12282 +  gl_STDIO_MODULE_INDICATOR([snprintf])
12283 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
12284 +  if test "$ac_cv_header_winsock2_h" = yes; then
12285 +    AC_LIBOBJ([winsock])
12286 +  fi
12287 +  gl_SYS_SOCKET_MODULE_INDICATOR([socket])
12288 +  gl_TYPE_SOCKLEN_T
12289 +  AM_STDBOOL_H
12290 +  gl_STDINT_H
12291 +  gl_STDIO_H
12292 +  gl_STDLIB_H
12293 +  gl_HEADER_SYS_SOCKET
12294 +  AC_PROG_MKDIR_P
12295 +  gl_UNISTD_H
12296 +  gl_FUNC_VASNPRINTF
12297 +  gl_WCHAR_H
12298 +  gl_XSIZE
12299 +  m4_ifval(gl_LIBSOURCES_LIST, [
12300 +    m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
12301 +      for gl_file in ]gl_LIBSOURCES_LIST[ ; do
12302 +        if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then
12303 +          echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2
12304 +          exit 1
12305 +        fi
12306 +      done])dnl
12307 +      m4_if(m4_sysval, [0], [],
12308 +        [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
12309 +  ])
12310 +  m4_popdef([gl_LIBSOURCES_DIR])
12311 +  m4_popdef([gl_LIBSOURCES_LIST])
12312 +  m4_popdef([AC_LIBSOURCES])
12313 +  m4_popdef([AC_REPLACE_FUNCS])
12314 +  m4_popdef([AC_LIBOBJ])
12315 +  AC_CONFIG_COMMANDS_PRE([
12316 +    gl_libobjs=
12317 +    gl_ltlibobjs=
12318 +    if test -n "$gl_LIBOBJS"; then
12319 +      # Remove the extension.
12320 +      sed_drop_objext='s/\.o$//;s/\.obj$//'
12321 +      for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
12322 +        gl_libobjs="$gl_libobjs $i.$ac_objext"
12323 +        gl_ltlibobjs="$gl_ltlibobjs $i.lo"
12324 +      done
12325 +    fi
12326 +    AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
12327 +    AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
12328 +  ])
12329 +  gltests_libdeps=
12330 +  gltests_ltlibdeps=
12331 +  m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
12332 +  m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
12333 +  m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
12334 +  m4_pushdef([gltests_LIBSOURCES_LIST], [])
12335 +  m4_pushdef([gltests_LIBSOURCES_DIR], [])
12336 +  gl_COMMON
12337 +  gl_source_base='gnulib/tests'
12338 +  gt_TYPE_WCHAR_T
12339 +  gt_TYPE_WINT_T
12340 +  AC_CHECK_FUNCS([shutdown])
12341 +  abs_aux_dir=`cd "$ac_aux_dir"; pwd`
12342 +  AC_SUBST([abs_aux_dir])
12343 +  m4_ifval(gltests_LIBSOURCES_LIST, [
12344 +    m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
12345 +      for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
12346 +        if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then
12347 +          echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2
12348 +          exit 1
12349 +        fi
12350 +      done])dnl
12351 +      m4_if(m4_sysval, [0], [],
12352 +        [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
12353 +  ])
12354 +  m4_popdef([gltests_LIBSOURCES_DIR])
12355 +  m4_popdef([gltests_LIBSOURCES_LIST])
12356 +  m4_popdef([AC_LIBSOURCES])
12357 +  m4_popdef([AC_REPLACE_FUNCS])
12358 +  m4_popdef([AC_LIBOBJ])
12359 +  AC_CONFIG_COMMANDS_PRE([
12360 +    gltests_libobjs=
12361 +    gltests_ltlibobjs=
12362 +    if test -n "$gltests_LIBOBJS"; then
12363 +      # Remove the extension.
12364 +      sed_drop_objext='s/\.o$//;s/\.obj$//'
12365 +      for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
12366 +        gltests_libobjs="$gltests_libobjs $i.$ac_objext"
12367 +        gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
12368 +      done
12369 +    fi
12370 +    AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
12371 +    AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
12372 +  ])
12373 +  LIBTESTS_LIBDEPS="$gltests_libdeps"
12374 +  AC_SUBST([LIBTESTS_LIBDEPS])
12375 +])
12376 +
12377 +# Like AC_LIBOBJ, except that the module name goes
12378 +# into gl_LIBOBJS instead of into LIBOBJS.
12379 +AC_DEFUN([gl_LIBOBJ], [
12380 +  AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl
12381 +  gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
12382 +])
12383 +
12384 +# Like AC_REPLACE_FUNCS, except that the module name goes
12385 +# into gl_LIBOBJS instead of into LIBOBJS.
12386 +AC_DEFUN([gl_REPLACE_FUNCS], [
12387 +  m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
12388 +  AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])
12389 +])
12390 +
12391 +# Like AC_LIBSOURCES, except the directory where the source file is
12392 +# expected is derived from the gnulib-tool parameterization,
12393 +# and alloca is special cased (for the alloca-opt module).
12394 +# We could also entirely rely on EXTRA_lib..._SOURCES.
12395 +AC_DEFUN([gl_LIBSOURCES], [
12396 +  m4_foreach([_gl_NAME], [$1], [
12397 +    m4_if(_gl_NAME, [alloca.c], [], [
12398 +      m4_define([gl_LIBSOURCES_DIR], [gnulib/lib])
12399 +      m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ])
12400 +    ])
12401 +  ])
12402 +])
12403 +
12404 +# Like AC_LIBOBJ, except that the module name goes
12405 +# into gltests_LIBOBJS instead of into LIBOBJS.
12406 +AC_DEFUN([gltests_LIBOBJ], [
12407 +  AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl
12408 +  gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext"
12409 +])
12410 +
12411 +# Like AC_REPLACE_FUNCS, except that the module name goes
12412 +# into gltests_LIBOBJS instead of into LIBOBJS.
12413 +AC_DEFUN([gltests_REPLACE_FUNCS], [
12414 +  m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
12415 +  AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)])
12416 +])
12417 +
12418 +# Like AC_LIBSOURCES, except the directory where the source file is
12419 +# expected is derived from the gnulib-tool parameterization,
12420 +# and alloca is special cased (for the alloca-opt module).
12421 +# We could also entirely rely on EXTRA_lib..._SOURCES.
12422 +AC_DEFUN([gltests_LIBSOURCES], [
12423 +  m4_foreach([_gl_NAME], [$1], [
12424 +    m4_if(_gl_NAME, [alloca.c], [], [
12425 +      m4_define([gltests_LIBSOURCES_DIR], [gnulib/tests])
12426 +      m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ])
12427 +    ])
12428 +  ])
12429 +])
12430 +
12431 +# This macro records the list of files which have been installed by
12432 +# gnulib-tool and may be removed by future gnulib-tool invocations.
12433 +AC_DEFUN([gl_FILE_LIST], [
12434 +  build-aux/link-warning.h
12435 +  build-aux/vc-list-files
12436 +  lib/alloca.in.h
12437 +  lib/arpa_inet.in.h
12438 +  lib/asnprintf.c
12439 +  lib/dummy.c
12440 +  lib/errno.in.h
12441 +  lib/float+.h
12442 +  lib/float.in.h
12443 +  lib/gai_strerror.c
12444 +  lib/getaddrinfo.c
12445 +  lib/getaddrinfo.h
12446 +  lib/gettext.h
12447 +  lib/inet_ntop.c
12448 +  lib/malloc.c
12449 +  lib/netinet_in.in.h
12450 +  lib/printf-args.c
12451 +  lib/printf-args.h
12452 +  lib/printf-parse.c
12453 +  lib/printf-parse.h
12454 +  lib/size_max.h
12455 +  lib/snprintf.c
12456 +  lib/stdbool.in.h
12457 +  lib/stdint.in.h
12458 +  lib/stdio-write.c
12459 +  lib/stdio.in.h
12460 +  lib/stdlib.in.h
12461 +  lib/sys_socket.in.h
12462 +  lib/unistd.in.h
12463 +  lib/vasnprintf.c
12464 +  lib/vasnprintf.h
12465 +  lib/wchar.in.h
12466 +  lib/winsock.c
12467 +  lib/xsize.h
12468 +  m4/alloca.m4
12469 +  m4/arpa_inet_h.m4
12470 +  m4/errno_h.m4
12471 +  m4/extensions.m4
12472 +  m4/float_h.m4
12473 +  m4/getaddrinfo.m4
12474 +  m4/gnulib-common.m4
12475 +  m4/include_next.m4
12476 +  m4/inet_ntop.m4
12477 +  m4/intmax_t.m4
12478 +  m4/inttypes_h.m4
12479 +  m4/longlong.m4
12480 +  m4/malloc.m4
12481 +  m4/netinet_in_h.m4
12482 +  m4/onceonly.m4
12483 +  m4/printf.m4
12484 +  m4/size_max.m4
12485 +  m4/snprintf.m4
12486 +  m4/socklen.m4
12487 +  m4/sockpfaf.m4
12488 +  m4/stdbool.m4
12489 +  m4/stdint.m4
12490 +  m4/stdint_h.m4
12491 +  m4/stdio_h.m4
12492 +  m4/stdlib_h.m4
12493 +  m4/sys_socket_h.m4
12494 +  m4/unistd_h.m4
12495 +  m4/vasnprintf.m4
12496 +  m4/wchar.m4
12497 +  m4/wchar_t.m4
12498 +  m4/wint_t.m4
12499 +  m4/xsize.m4
12500 +  tests/test-alloca-opt.c
12501 +  tests/test-arpa_inet.c
12502 +  tests/test-errno.c
12503 +  tests/test-getaddrinfo.c
12504 +  tests/test-netinet_in.c
12505 +  tests/test-snprintf.c
12506 +  tests/test-stdbool.c
12507 +  tests/test-stdint.c
12508 +  tests/test-stdio.c
12509 +  tests/test-stdlib.c
12510 +  tests/test-sys_socket.c
12511 +  tests/test-unistd.c
12512 +  tests/test-vasnprintf.c
12513 +  tests/test-vc-list-files-cvs.sh
12514 +  tests/test-vc-list-files-git.sh
12515 +  tests/test-wchar.c
12516 +  tests=lib/dummy.c
12517 +  tests=lib/intprops.h
12518 +  tests=lib/verify.h
12519 +])
12520 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/gnulib-tool.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-tool.m4
12521 --- gtk-vnc-0.3.7.dan3/gnulib/m4/gnulib-tool.m4 1970-01-01 01:00:00.000000000 +0100
12522 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-tool.m4       2008-10-09 15:24:52.000000000 +0100
12523 @@ -0,0 +1,57 @@
12524 +# gnulib-tool.m4 serial 2
12525 +dnl Copyright (C) 2004-2005 Free Software Foundation, Inc.
12526 +dnl This file is free software; the Free Software Foundation
12527 +dnl gives unlimited permission to copy and/or distribute it,
12528 +dnl with or without modifications, as long as this notice is preserved.
12529 +
12530 +dnl The following macros need not be invoked explicitly.
12531 +dnl Invoking them does nothing except to declare default arguments
12532 +dnl for "gnulib-tool --import".
12533 +
12534 +dnl Usage: gl_LOCAL_DIR([DIR])
12535 +AC_DEFUN([gl_LOCAL_DIR], [])
12536 +
12537 +dnl Usage: gl_MODULES([module1 module2 ...])
12538 +AC_DEFUN([gl_MODULES], [])
12539 +
12540 +dnl Usage: gl_AVOID([module1 module2 ...])
12541 +AC_DEFUN([gl_AVOID], [])
12542 +
12543 +dnl Usage: gl_SOURCE_BASE([DIR])
12544 +AC_DEFUN([gl_SOURCE_BASE], [])
12545 +
12546 +dnl Usage: gl_M4_BASE([DIR])
12547 +AC_DEFUN([gl_M4_BASE], [])
12548 +
12549 +dnl Usage: gl_PO_BASE([DIR])
12550 +AC_DEFUN([gl_PO_BASE], [])
12551 +
12552 +dnl Usage: gl_DOC_BASE([DIR])
12553 +AC_DEFUN([gl_DOC_BASE], [])
12554 +
12555 +dnl Usage: gl_TESTS_BASE([DIR])
12556 +AC_DEFUN([gl_TESTS_BASE], [])
12557 +
12558 +dnl Usage: gl_WITH_TESTS
12559 +AC_DEFUN([gl_WITH_TESTS], [])
12560 +
12561 +dnl Usage: gl_LIB([LIBNAME])
12562 +AC_DEFUN([gl_LIB], [])
12563 +
12564 +dnl Usage: gl_LGPL or gl_LGPL([VERSION])
12565 +AC_DEFUN([gl_LGPL], [])
12566 +
12567 +dnl Usage: gl_MAKEFILE_NAME([FILENAME])
12568 +AC_DEFUN([gl_MAKEFILE_NAME], [])
12569 +
12570 +dnl Usage: gl_LIBTOOL
12571 +AC_DEFUN([gl_LIBTOOL], [])
12572 +
12573 +dnl Usage: gl_MACRO_PREFIX([PREFIX])
12574 +AC_DEFUN([gl_MACRO_PREFIX], [])
12575 +
12576 +dnl Usage: gl_PO_DOMAIN([DOMAIN])
12577 +AC_DEFUN([gl_PO_DOMAIN], [])
12578 +
12579 +dnl Usage: gl_VC_FILES([BOOLEAN])
12580 +AC_DEFUN([gl_VC_FILES], [])
12581 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/include_next.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/include_next.m4
12582 --- gtk-vnc-0.3.7.dan3/gnulib/m4/include_next.m4        1970-01-01 01:00:00.000000000 +0100
12583 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/include_next.m4      2008-10-09 15:24:52.000000000 +0100
12584 @@ -0,0 +1,128 @@
12585 +# include_next.m4 serial 8
12586 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
12587 +dnl This file is free software; the Free Software Foundation
12588 +dnl gives unlimited permission to copy and/or distribute it,
12589 +dnl with or without modifications, as long as this notice is preserved.
12590 +
12591 +dnl From Paul Eggert and Derek Price.
12592 +
12593 +dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER.
12594 +dnl
12595 +dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to
12596 +dnl 'include' otherwise.
12597 +dnl
12598 +dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next,
12599 +dnl so as to avoid GCC warnings when the gcc option -pedantic is used.
12600 +dnl '#pragma GCC system_header' has the same effect as if the file was found
12601 +dnl through the include search path specified with '-isystem' options (as
12602 +dnl opposed to the search path specified with '-I' options). Namely, gcc
12603 +dnl does not warn about some things, and on some systems (Solaris and Interix)
12604 +dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
12605 +dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
12606 +dnl of plain '__STDC__'.
12607 +
12608 +AC_DEFUN([gl_INCLUDE_NEXT],
12609 +[
12610 +  AC_LANG_PREPROC_REQUIRE()
12611 +  AC_CACHE_CHECK([whether the preprocessor supports include_next],
12612 +    [gl_cv_have_include_next],
12613 +    [rm -rf conftestd1 conftestd2
12614 +     mkdir conftestd1 conftestd2
12615 +     dnl The include of <stdio.h> is because IBM C 9.0 on AIX 6.1 supports
12616 +     dnl include_next when used as first preprocessor directive in a file,
12617 +     dnl but not when preceded by another include directive.
12618 +     cat <<EOF > conftestd1/conftest.h
12619 +#define DEFINED_IN_CONFTESTD1
12620 +#include <stdio.h>
12621 +#include_next <conftest.h>
12622 +#ifdef DEFINED_IN_CONFTESTD2
12623 +int foo;
12624 +#else
12625 +#error "include_next doesn't work"
12626 +#endif
12627 +EOF
12628 +     cat <<EOF > conftestd2/conftest.h
12629 +#ifndef DEFINED_IN_CONFTESTD1
12630 +#error "include_next test doesn't work"
12631 +#endif
12632 +#define DEFINED_IN_CONFTESTD2
12633 +EOF
12634 +     save_CPPFLAGS="$CPPFLAGS"
12635 +     CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2"
12636 +     AC_COMPILE_IFELSE([#include <conftest.h>],
12637 +       [gl_cv_have_include_next=yes],
12638 +       [gl_cv_have_include_next=no])
12639 +     CPPFLAGS="$save_CPPFLAGS"
12640 +     rm -rf conftestd1 conftestd2
12641 +    ])
12642 +  PRAGMA_SYSTEM_HEADER=
12643 +  if test $gl_cv_have_include_next = yes; then
12644 +    INCLUDE_NEXT=include_next
12645 +    if test -n "$GCC"; then
12646 +      PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
12647 +    fi
12648 +  else
12649 +    INCLUDE_NEXT=include
12650 +  fi
12651 +  AC_SUBST([INCLUDE_NEXT])
12652 +  AC_SUBST([PRAGMA_SYSTEM_HEADER])
12653 +])
12654 +
12655 +# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
12656 +# ------------------------------------------
12657 +# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
12658 +# '<foo.h>'; otherwise define it to be
12659 +# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
12660 +# That way, a header file with the following line:
12661 +#      #@INCLUDE_NEXT@ @NEXT_FOO_H@
12662 +# behaves (after sed substitution) as if it contained
12663 +#      #include_next <foo.h>
12664 +# even if the compiler does not support include_next.
12665 +# The three "///" are to pacify Sun C 5.8, which otherwise would say
12666 +# "warning: #include of /usr/include/... may be non-portable".
12667 +# Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
12668 +# Note: This macro assumes that the header file is not empty after
12669 +# preprocessing, i.e. it does not only define preprocessor macros but also
12670 +# provides some type/enum definitions or function/variable declarations.
12671 +AC_DEFUN([gl_CHECK_NEXT_HEADERS],
12672 +[
12673 +  AC_REQUIRE([gl_INCLUDE_NEXT])
12674 +  AC_CHECK_HEADERS_ONCE([$1])
12675 +
12676 +  m4_foreach_w([gl_HEADER_NAME], [$1],
12677 +    [AS_VAR_PUSHDEF([gl_next_header],
12678 +                   [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
12679 +     if test $gl_cv_have_include_next = yes; then
12680 +       AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
12681 +     else
12682 +       AC_CACHE_CHECK(
12683 +        [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
12684 +        m4_quote(m4_defn([gl_next_header])),
12685 +        [AS_VAR_PUSHDEF([gl_header_exists],
12686 +                        [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))
12687 +         if test AS_VAR_GET(gl_header_exists) = yes; then
12688 +           AC_LANG_CONFTEST(
12689 +             [AC_LANG_SOURCE(
12690 +                [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
12691 +              )])
12692 +           dnl eval is necessary to expand ac_cpp.
12693 +           dnl Ultrix and Pyramid sh refuse to redirect output of eval,
12694 +           dnl so use subshell.
12695 +           AS_VAR_SET([gl_next_header],
12696 +             ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
12697 +              sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
12698 +                s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
12699 +                s#^/[^/]#//&#
12700 +                p
12701 +                q
12702 +              }'`'"'])
12703 +         else
12704 +           AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
12705 +         fi
12706 +         AS_VAR_POPDEF([gl_header_exists])])
12707 +     fi
12708 +     AC_SUBST(
12709 +       AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
12710 +       [AS_VAR_GET([gl_next_header])])
12711 +     AS_VAR_POPDEF([gl_next_header])])
12712 +])
12713 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/inet_ntop.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/inet_ntop.m4
12714 --- gtk-vnc-0.3.7.dan3/gnulib/m4/inet_ntop.m4   1970-01-01 01:00:00.000000000 +0100
12715 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/inet_ntop.m4 2008-10-09 15:24:52.000000000 +0100
12716 @@ -0,0 +1,26 @@
12717 +# inet_ntop.m4 serial 7
12718 +dnl Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
12719 +dnl This file is free software; the Free Software Foundation
12720 +dnl gives unlimited permission to copy and/or distribute it,
12721 +dnl with or without modifications, as long as this notice is preserved.
12722 +
12723 +AC_DEFUN([gl_INET_NTOP],
12724 +[
12725 +  dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
12726 +  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12727 +
12728 +  gl_REPLACE_ARPA_INET_H
12729 +
12730 +  AC_REPLACE_FUNCS(inet_ntop)
12731 +  gl_PREREQ_INET_NTOP
12732 +])
12733 +
12734 +# Prerequisites of lib/inet_ntop.c.
12735 +AC_DEFUN([gl_PREREQ_INET_NTOP], [
12736 +  AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
12737 +  if test $ac_cv_have_decl_inet_ntop = no; then
12738 +    HAVE_DECL_INET_NTOP=0
12739 +  fi
12740 +  AC_REQUIRE([gl_SOCKET_FAMILIES])
12741 +  AC_REQUIRE([AC_C_RESTRICT])
12742 +])
12743 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/intmax_t.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/intmax_t.m4
12744 --- gtk-vnc-0.3.7.dan3/gnulib/m4/intmax_t.m4    1970-01-01 01:00:00.000000000 +0100
12745 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/intmax_t.m4  2008-10-09 15:24:52.000000000 +0100
12746 @@ -0,0 +1,61 @@
12747 +# intmax_t.m4 serial 6
12748 +dnl Copyright (C) 1997-2004, 2006-2007 Free Software Foundation, Inc.
12749 +dnl This file is free software; the Free Software Foundation
12750 +dnl gives unlimited permission to copy and/or distribute it,
12751 +dnl with or without modifications, as long as this notice is preserved.
12752 +
12753 +dnl From Paul Eggert.
12754 +
12755 +AC_PREREQ(2.13)
12756 +
12757 +# Define intmax_t to 'long' or 'long long'
12758 +# if it is not already defined in <stdint.h> or <inttypes.h>.
12759 +
12760 +AC_DEFUN([gl_AC_TYPE_INTMAX_T],
12761 +[
12762 +  dnl For simplicity, we assume that a header file defines 'intmax_t' if and
12763 +  dnl only if it defines 'uintmax_t'.
12764 +  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
12765 +  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
12766 +  if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
12767 +    AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
12768 +    test $ac_cv_type_long_long_int = yes \
12769 +      && ac_type='long long' \
12770 +      || ac_type='long'
12771 +    AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
12772 +     [Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
12773 +  else
12774 +    AC_DEFINE(HAVE_INTMAX_T, 1,
12775 +      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
12776 +  fi
12777 +])
12778 +
12779 +dnl An alternative would be to explicitly test for 'intmax_t'.
12780 +
12781 +AC_DEFUN([gt_AC_TYPE_INTMAX_T],
12782 +[
12783 +  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
12784 +  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
12785 +  AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
12786 +    [AC_TRY_COMPILE([
12787 +#include <stddef.h>
12788 +#include <stdlib.h>
12789 +#if HAVE_STDINT_H_WITH_UINTMAX
12790 +#include <stdint.h>
12791 +#endif
12792 +#if HAVE_INTTYPES_H_WITH_UINTMAX
12793 +#include <inttypes.h>
12794 +#endif
12795 +], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
12796 +  if test $gt_cv_c_intmax_t = yes; then
12797 +    AC_DEFINE(HAVE_INTMAX_T, 1,
12798 +      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
12799 +  else
12800 +    AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
12801 +    test $ac_cv_type_long_long_int = yes \
12802 +      && ac_type='long long' \
12803 +      || ac_type='long'
12804 +    AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
12805 +     [Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
12806 +  fi
12807 +])
12808 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/inttypes_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/inttypes_h.m4
12809 --- gtk-vnc-0.3.7.dan3/gnulib/m4/inttypes_h.m4  1970-01-01 01:00:00.000000000 +0100
12810 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/inttypes_h.m4        2008-10-09 15:24:52.000000000 +0100
12811 @@ -0,0 +1,26 @@
12812 +# inttypes_h.m4 serial 7
12813 +dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc.
12814 +dnl This file is free software; the Free Software Foundation
12815 +dnl gives unlimited permission to copy and/or distribute it,
12816 +dnl with or without modifications, as long as this notice is preserved.
12817 +
12818 +dnl From Paul Eggert.
12819 +
12820 +# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
12821 +# doesn't clash with <sys/types.h>, and declares uintmax_t.
12822 +
12823 +AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
12824 +[
12825 +  AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h,
12826 +  [AC_TRY_COMPILE(
12827 +    [#include <sys/types.h>
12828 +#include <inttypes.h>],
12829 +    [uintmax_t i = (uintmax_t) -1; return !i;],
12830 +    gl_cv_header_inttypes_h=yes,
12831 +    gl_cv_header_inttypes_h=no)])
12832 +  if test $gl_cv_header_inttypes_h = yes; then
12833 +    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
12834 +      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
12835 +       and declares uintmax_t. ])
12836 +  fi
12837 +])
12838 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/longlong.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/longlong.m4
12839 --- gtk-vnc-0.3.7.dan3/gnulib/m4/longlong.m4    1970-01-01 01:00:00.000000000 +0100
12840 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/longlong.m4  2008-10-09 15:24:52.000000000 +0100
12841 @@ -0,0 +1,106 @@
12842 +# longlong.m4 serial 13
12843 +dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
12844 +dnl This file is free software; the Free Software Foundation
12845 +dnl gives unlimited permission to copy and/or distribute it,
12846 +dnl with or without modifications, as long as this notice is preserved.
12847 +
12848 +dnl From Paul Eggert.
12849 +
12850 +# Define HAVE_LONG_LONG_INT if 'long long int' works.
12851 +# This fixes a bug in Autoconf 2.61, but can be removed once we
12852 +# assume 2.62 everywhere.
12853 +
12854 +# Note: If the type 'long long int' exists but is only 32 bits large
12855 +# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
12856 +# defined. In this case you can treat 'long long int' like 'long int'.
12857 +
12858 +AC_DEFUN([AC_TYPE_LONG_LONG_INT],
12859 +[
12860 +  AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
12861 +    [AC_LINK_IFELSE(
12862 +       [_AC_TYPE_LONG_LONG_SNIPPET],
12863 +       [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
12864 +       dnl If cross compiling, assume the bug isn't important, since
12865 +       dnl nobody cross compiles for this platform as far as we know.
12866 +       AC_RUN_IFELSE(
12867 +         [AC_LANG_PROGRAM(
12868 +            [[@%:@include <limits.h>
12869 +              @%:@ifndef LLONG_MAX
12870 +              @%:@ define HALF \
12871 +                       (1LL << (sizeof (long long int) * CHAR_BIT - 2))
12872 +              @%:@ define LLONG_MAX (HALF - 1 + HALF)
12873 +              @%:@endif]],
12874 +            [[long long int n = 1;
12875 +              int i;
12876 +              for (i = 0; ; i++)
12877 +                {
12878 +                  long long int m = n << i;
12879 +                  if (m >> i != n)
12880 +                    return 1;
12881 +                  if (LLONG_MAX / 2 < m)
12882 +                    break;
12883 +                }
12884 +              return 0;]])],
12885 +         [ac_cv_type_long_long_int=yes],
12886 +         [ac_cv_type_long_long_int=no],
12887 +         [ac_cv_type_long_long_int=yes])],
12888 +       [ac_cv_type_long_long_int=no])])
12889 +  if test $ac_cv_type_long_long_int = yes; then
12890 +    AC_DEFINE([HAVE_LONG_LONG_INT], 1,
12891 +      [Define to 1 if the system has the type `long long int'.])
12892 +  fi
12893 +])
12894 +
12895 +# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
12896 +# This fixes a bug in Autoconf 2.61, but can be removed once we
12897 +# assume 2.62 everywhere.
12898 +
12899 +# Note: If the type 'unsigned long long int' exists but is only 32 bits
12900 +# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
12901 +# will not be defined. In this case you can treat 'unsigned long long int'
12902 +# like 'unsigned long int'.
12903 +
12904 +AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
12905 +[
12906 +  AC_CACHE_CHECK([for unsigned long long int],
12907 +    [ac_cv_type_unsigned_long_long_int],
12908 +    [AC_LINK_IFELSE(
12909 +       [_AC_TYPE_LONG_LONG_SNIPPET],
12910 +       [ac_cv_type_unsigned_long_long_int=yes],
12911 +       [ac_cv_type_unsigned_long_long_int=no])])
12912 +  if test $ac_cv_type_unsigned_long_long_int = yes; then
12913 +    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
12914 +      [Define to 1 if the system has the type `unsigned long long int'.])
12915 +  fi
12916 +])
12917 +
12918 +# Expands to a C program that can be used to test for simultaneous support
12919 +# of 'long long' and 'unsigned long long'. We don't want to say that
12920 +# 'long long' is available if 'unsigned long long' is not, or vice versa,
12921 +# because too many programs rely on the symmetry between signed and unsigned
12922 +# integer types (excluding 'bool').
12923 +AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
12924 +[
12925 +  AC_LANG_PROGRAM(
12926 +    [[/* For now, do not test the preprocessor; as of 2007 there are too many
12927 +        implementations with broken preprocessors.  Perhaps this can
12928 +        be revisited in 2012.  In the meantime, code should not expect
12929 +        #if to work with literals wider than 32 bits.  */
12930 +      /* Test literals.  */
12931 +      long long int ll = 9223372036854775807ll;
12932 +      long long int nll = -9223372036854775807LL;
12933 +      unsigned long long int ull = 18446744073709551615ULL;
12934 +      /* Test constant expressions.   */
12935 +      typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
12936 +                    ? 1 : -1)];
12937 +      typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
12938 +                    ? 1 : -1)];
12939 +      int i = 63;]],
12940 +    [[/* Test availability of runtime routines for shift and division.  */
12941 +      long long int llmax = 9223372036854775807ll;
12942 +      unsigned long long int ullmax = 18446744073709551615ull;
12943 +      return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
12944 +             | (llmax / ll) | (llmax % ll)
12945 +             | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
12946 +             | (ullmax / ull) | (ullmax % ull));]])
12947 +])
12948 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/malloc.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/malloc.m4
12949 --- gtk-vnc-0.3.7.dan3/gnulib/m4/malloc.m4      1970-01-01 01:00:00.000000000 +0100
12950 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/malloc.m4    2008-10-09 15:24:52.000000000 +0100
12951 @@ -0,0 +1,41 @@
12952 +# malloc.m4 serial 8
12953 +dnl Copyright (C) 2007 Free Software Foundation, Inc.
12954 +dnl This file is free software; the Free Software Foundation
12955 +dnl gives unlimited permission to copy and/or distribute it,
12956 +dnl with or without modifications, as long as this notice is preserved.
12957 +
12958 +# gl_FUNC_MALLOC_POSIX
12959 +# --------------------
12960 +# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
12961 +# fails), and replace malloc if it is not.
12962 +AC_DEFUN([gl_FUNC_MALLOC_POSIX],
12963 +[
12964 +  AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
12965 +  if test $gl_cv_func_malloc_posix = yes; then
12966 +    HAVE_MALLOC_POSIX=1
12967 +    AC_DEFINE([HAVE_MALLOC_POSIX], 1,
12968 +      [Define if the 'malloc' function is POSIX compliant.])
12969 +  else
12970 +    AC_LIBOBJ([malloc])
12971 +    HAVE_MALLOC_POSIX=0
12972 +  fi
12973 +  AC_SUBST([HAVE_MALLOC_POSIX])
12974 +])
12975 +
12976 +# Test whether malloc, realloc, calloc are POSIX compliant,
12977 +# Set gl_cv_func_malloc_posix to yes or no accordingly.
12978 +AC_DEFUN([gl_CHECK_MALLOC_POSIX],
12979 +[
12980 +  AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
12981 +    [gl_cv_func_malloc_posix],
12982 +    [
12983 +      dnl It is too dangerous to try to allocate a large amount of memory:
12984 +      dnl some systems go to their knees when you do that. So assume that
12985 +      dnl all Unix implementations of the function are POSIX compliant.
12986 +      AC_TRY_COMPILE([],
12987 +        [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
12988 +         choke me
12989 +         #endif
12990 +        ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])
12991 +    ])
12992 +])
12993 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/netinet_in_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/netinet_in_h.m4
12994 --- gtk-vnc-0.3.7.dan3/gnulib/m4/netinet_in_h.m4        1970-01-01 01:00:00.000000000 +0100
12995 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/netinet_in_h.m4      2008-10-09 15:24:52.000000000 +0100
12996 @@ -0,0 +1,30 @@
12997 +# netinet_in_h.m4 serial 4
12998 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
12999 +dnl This file is free software; the Free Software Foundation
13000 +dnl gives unlimited permission to copy and/or distribute it,
13001 +dnl with or without modifications, as long as this notice is preserved.
13002 +
13003 +AC_DEFUN([gl_HEADER_NETINET_IN],
13004 +[
13005 +  AC_CACHE_CHECK([whether <netinet/in.h> is self-contained],
13006 +    [gl_cv_header_netinet_in_h_selfcontained],
13007 +    [
13008 +      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[]])],
13009 +        [gl_cv_header_netinet_in_h_selfcontained=yes],
13010 +        [gl_cv_header_netinet_in_h_selfcontained=no])
13011 +    ])
13012 +  if test $gl_cv_header_netinet_in_h_selfcontained = yes; then
13013 +    NETINET_IN_H=''
13014 +  else
13015 +    NETINET_IN_H='netinet/in.h'
13016 +    AC_CHECK_HEADERS([netinet/in.h])
13017 +    gl_CHECK_NEXT_HEADERS([netinet/in.h])
13018 +    if test $ac_cv_header_netinet_in_h = yes; then
13019 +      HAVE_NETINET_IN_H=1
13020 +    else
13021 +      HAVE_NETINET_IN_H=0
13022 +    fi
13023 +    AC_SUBST([HAVE_NETINET_IN_H])
13024 +  fi
13025 +  AC_SUBST([NETINET_IN_H])
13026 +])
13027 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/onceonly.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/onceonly.m4
13028 --- gtk-vnc-0.3.7.dan3/gnulib/m4/onceonly.m4    1970-01-01 01:00:00.000000000 +0100
13029 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/onceonly.m4  2008-10-09 15:24:52.000000000 +0100
13030 @@ -0,0 +1,90 @@
13031 +# onceonly.m4 serial 6
13032 +dnl Copyright (C) 2002-2003, 2005-2006, 2008 Free Software Foundation, Inc.
13033 +dnl This file is free software, distributed under the terms of the GNU
13034 +dnl General Public License.  As a special exception to the GNU General
13035 +dnl Public License, this file may be distributed as part of a program
13036 +dnl that contains a configuration script generated by Autoconf, under
13037 +dnl the same distribution terms as the rest of that program.
13038 +
13039 +dnl This file defines some "once only" variants of standard autoconf macros.
13040 +dnl   AC_CHECK_HEADERS_ONCE          like  AC_CHECK_HEADERS
13041 +dnl   AC_CHECK_FUNCS_ONCE            like  AC_CHECK_FUNCS
13042 +dnl   AC_CHECK_DECLS_ONCE            like  AC_CHECK_DECLS
13043 +dnl   AC_REQUIRE([AC_FUNC_STRCOLL])  like  AC_FUNC_STRCOLL
13044 +dnl The advantage is that the check for each of the headers/functions/decls
13045 +dnl will be put only once into the 'configure' file. It keeps the size of
13046 +dnl the 'configure' file down, and avoids redundant output when 'configure'
13047 +dnl is run.
13048 +dnl The drawback is that the checks cannot be conditionalized. If you write
13049 +dnl   if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
13050 +dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
13051 +dnl empty, and the check will be inserted before the body of the AC_DEFUNed
13052 +dnl function.
13053 +
13054 +dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE
13055 +dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to
13056 +dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested
13057 +dnl headers at once, thus reducing the size of 'configure'. It is known to work
13058 +dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%.
13059 +
13060 +dnl Autoconf version 2.59 plus gnulib is required; this file is not needed
13061 +dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of
13062 +dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first
13063 +dnl argument!
13064 +AC_PREREQ([2.59])
13065 +
13066 +# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
13067 +# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
13068 +AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
13069 +  :
13070 +  m4_foreach_w([gl_HEADER_NAME], [$1], [
13071 +    AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
13072 +                                                 [./-], [___])), [
13073 +      m4_divert_text([INIT_PREPARE],
13074 +        [gl_header_list="$gl_header_list gl_HEADER_NAME"])
13075 +      gl_HEADERS_EXPANSION
13076 +      AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
13077 +        [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
13078 +    ])
13079 +    AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
13080 +                                                   [./-], [___])))
13081 +  ])
13082 +])
13083 +m4_define([gl_HEADERS_EXPANSION], [
13084 +  m4_divert_text([DEFAULTS], [gl_header_list=])
13085 +  AC_CHECK_HEADERS([$gl_header_list])
13086 +  m4_define([gl_HEADERS_EXPANSION], [])
13087 +])
13088 +
13089 +# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
13090 +# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
13091 +AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
13092 +  :
13093 +  m4_foreach_w([gl_FUNC_NAME], [$1], [
13094 +    AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
13095 +      m4_divert_text([INIT_PREPARE],
13096 +        [gl_func_list="$gl_func_list gl_FUNC_NAME"])
13097 +      gl_FUNCS_EXPANSION
13098 +      AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
13099 +        [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
13100 +    ])
13101 +    AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
13102 +  ])
13103 +])
13104 +m4_define([gl_FUNCS_EXPANSION], [
13105 +  m4_divert_text([DEFAULTS], [gl_func_list=])
13106 +  AC_CHECK_FUNCS([$gl_func_list])
13107 +  m4_define([gl_FUNCS_EXPANSION], [])
13108 +])
13109 +
13110 +# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
13111 +# AC_CHECK_DECLS(DECL1, DECL2, ...).
13112 +AC_DEFUN([AC_CHECK_DECLS_ONCE], [
13113 +  :
13114 +  m4_foreach_w([gl_DECL_NAME], [$1], [
13115 +    AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
13116 +      AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
13117 +    ])
13118 +    AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
13119 +  ])
13120 +])
13121 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/printf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/printf.m4
13122 --- gtk-vnc-0.3.7.dan3/gnulib/m4/printf.m4      1970-01-01 01:00:00.000000000 +0100
13123 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/printf.m4    2008-10-09 15:24:52.000000000 +0100
13124 @@ -0,0 +1,1309 @@
13125 +# printf.m4 serial 23
13126 +dnl Copyright (C) 2003, 2007-2008 Free Software Foundation, Inc.
13127 +dnl This file is free software; the Free Software Foundation
13128 +dnl gives unlimited permission to copy and/or distribute it,
13129 +dnl with or without modifications, as long as this notice is preserved.
13130 +
13131 +dnl Test whether the *printf family of functions supports the 'j', 'z', 't',
13132 +dnl 'L' size specifiers. (ISO C99, POSIX:2001)
13133 +dnl Result is gl_cv_func_printf_sizes_c99.
13134 +
13135 +AC_DEFUN([gl_PRINTF_SIZES_C99],
13136 +[
13137 +  AC_REQUIRE([AC_PROG_CC])
13138 +  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
13139 +  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
13140 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13141 +  AC_CACHE_CHECK([whether printf supports size specifiers as in C99],
13142 +    [gl_cv_func_printf_sizes_c99],
13143 +    [
13144 +      AC_TRY_RUN([
13145 +#include <stddef.h>
13146 +#include <stdio.h>
13147 +#include <string.h>
13148 +#include <sys/types.h>
13149 +#if HAVE_STDINT_H_WITH_UINTMAX
13150 +# include <stdint.h>
13151 +#endif
13152 +#if HAVE_INTTYPES_H_WITH_UINTMAX
13153 +# include <inttypes.h>
13154 +#endif
13155 +static char buf[100];
13156 +int main ()
13157 +{
13158 +#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX
13159 +  buf[0] = '\0';
13160 +  if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
13161 +      || strcmp (buf, "12345671 33") != 0)
13162 +    return 1;
13163 +#endif
13164 +  buf[0] = '\0';
13165 +  if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
13166 +      || strcmp (buf, "12345672 33") != 0)
13167 +    return 1;
13168 +  buf[0] = '\0';
13169 +  if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0
13170 +      || strcmp (buf, "12345673 33") != 0)
13171 +    return 1;
13172 +  buf[0] = '\0';
13173 +  if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0
13174 +      || strcmp (buf, "1.5 33") != 0)
13175 +    return 1;
13176 +  return 0;
13177 +}], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no],
13178 +      [
13179 +changequote(,)dnl
13180 +       case "$host_os" in
13181 +                               # Guess yes on glibc systems.
13182 +         *-gnu*)               gl_cv_func_printf_sizes_c99="guessing yes";;
13183 +                               # Guess yes on FreeBSD >= 5.
13184 +         freebsd[1-4]*)        gl_cv_func_printf_sizes_c99="guessing no";;
13185 +         freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
13186 +                               # Guess yes on MacOS X >= 10.3.
13187 +         darwin[1-6].*)        gl_cv_func_printf_sizes_c99="guessing no";;
13188 +         darwin*)              gl_cv_func_printf_sizes_c99="guessing yes";;
13189 +                               # Guess yes on OpenBSD >= 3.9.
13190 +         openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
13191 +                               gl_cv_func_printf_sizes_c99="guessing no";;
13192 +         openbsd*)             gl_cv_func_printf_sizes_c99="guessing yes";;
13193 +                               # Guess yes on Solaris >= 2.10.
13194 +         solaris2.[0-9]*)      gl_cv_func_printf_sizes_c99="guessing no";;
13195 +         solaris*)             gl_cv_func_printf_sizes_c99="guessing yes";;
13196 +                               # Guess yes on NetBSD >= 3.
13197 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
13198 +                               gl_cv_func_printf_sizes_c99="guessing no";;
13199 +         netbsd*)              gl_cv_func_printf_sizes_c99="guessing yes";;
13200 +                               # If we don't know, assume the worst.
13201 +         *)                    gl_cv_func_printf_sizes_c99="guessing no";;
13202 +       esac
13203 +changequote([,])dnl
13204 +      ])
13205 +    ])
13206 +])
13207 +
13208 +dnl Test whether the *printf family of functions supports 'long double'
13209 +dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001)
13210 +dnl Result is gl_cv_func_printf_long_double.
13211 +
13212 +AC_DEFUN([gl_PRINTF_LONG_DOUBLE],
13213 +[
13214 +  AC_REQUIRE([AC_PROG_CC])
13215 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13216 +  AC_CACHE_CHECK([whether printf supports 'long double' arguments],
13217 +    [gl_cv_func_printf_long_double],
13218 +    [
13219 +      AC_TRY_RUN([
13220 +#include <stdio.h>
13221 +#include <string.h>
13222 +static char buf[10000];
13223 +int main ()
13224 +{
13225 +  buf[0] = '\0';
13226 +  if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0
13227 +      || strcmp (buf, "1.750000 33") != 0)
13228 +    return 1;
13229 +  buf[0] = '\0';
13230 +  if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0
13231 +      || strcmp (buf, "1.750000e+00 33") != 0)
13232 +    return 1;
13233 +  buf[0] = '\0';
13234 +  if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0
13235 +      || strcmp (buf, "1.75 33") != 0)
13236 +    return 1;
13237 +  return 0;
13238 +}], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no],
13239 +      [
13240 +changequote(,)dnl
13241 +       case "$host_os" in
13242 +         beos*)        gl_cv_func_printf_long_double="guessing no";;
13243 +         mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
13244 +         *)            gl_cv_func_printf_long_double="guessing yes";;
13245 +       esac
13246 +changequote([,])dnl
13247 +      ])
13248 +    ])
13249 +])
13250 +
13251 +dnl Test whether the *printf family of functions supports infinite and NaN
13252 +dnl 'double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001)
13253 +dnl Result is gl_cv_func_printf_infinite.
13254 +
13255 +AC_DEFUN([gl_PRINTF_INFINITE],
13256 +[
13257 +  AC_REQUIRE([AC_PROG_CC])
13258 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13259 +  AC_CACHE_CHECK([whether printf supports infinite 'double' arguments],
13260 +    [gl_cv_func_printf_infinite],
13261 +    [
13262 +      AC_TRY_RUN([
13263 +#include <stdio.h>
13264 +#include <string.h>
13265 +static int
13266 +strisnan (const char *string, size_t start_index, size_t end_index)
13267 +{
13268 +  if (start_index < end_index)
13269 +    {
13270 +      if (string[start_index] == '-')
13271 +        start_index++;
13272 +      if (start_index + 3 <= end_index
13273 +          && memcmp (string + start_index, "nan", 3) == 0)
13274 +        {
13275 +          start_index += 3;
13276 +          if (start_index == end_index
13277 +              || (string[start_index] == '(' && string[end_index - 1] == ')'))
13278 +            return 1;
13279 +        }
13280 +    }
13281 +  return 0;
13282 +}
13283 +static char buf[10000];
13284 +static double zero = 0.0;
13285 +int main ()
13286 +{
13287 +  if (sprintf (buf, "%f", 1.0 / 0.0) < 0
13288 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13289 +    return 1;
13290 +  if (sprintf (buf, "%f", -1.0 / 0.0) < 0
13291 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13292 +    return 1;
13293 +  if (sprintf (buf, "%f", zero / zero) < 0
13294 +      || !strisnan (buf, 0, strlen (buf)))
13295 +    return 1;
13296 +  if (sprintf (buf, "%e", 1.0 / 0.0) < 0
13297 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13298 +    return 1;
13299 +  if (sprintf (buf, "%e", -1.0 / 0.0) < 0
13300 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13301 +    return 1;
13302 +  if (sprintf (buf, "%e", zero / zero) < 0
13303 +      || !strisnan (buf, 0, strlen (buf)))
13304 +    return 1;
13305 +  if (sprintf (buf, "%g", 1.0 / 0.0) < 0
13306 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13307 +    return 1;
13308 +  if (sprintf (buf, "%g", -1.0 / 0.0) < 0
13309 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13310 +    return 1;
13311 +  if (sprintf (buf, "%g", zero / zero) < 0
13312 +      || !strisnan (buf, 0, strlen (buf)))
13313 +    return 1;
13314 +  return 0;
13315 +}], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no],
13316 +      [
13317 +changequote(,)dnl
13318 +       case "$host_os" in
13319 +                               # Guess yes on glibc systems.
13320 +         *-gnu*)               gl_cv_func_printf_infinite="guessing yes";;
13321 +                               # Guess yes on FreeBSD >= 6.
13322 +         freebsd[1-5]*)        gl_cv_func_printf_infinite="guessing no";;
13323 +         freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
13324 +                               # Guess yes on MacOS X >= 10.3.
13325 +         darwin[1-6].*)        gl_cv_func_printf_infinite="guessing no";;
13326 +         darwin*)              gl_cv_func_printf_infinite="guessing yes";;
13327 +                               # Guess yes on HP-UX >= 11.
13328 +         hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";;
13329 +         hpux*)                gl_cv_func_printf_infinite="guessing yes";;
13330 +                               # Guess yes on NetBSD >= 3.
13331 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
13332 +                               gl_cv_func_printf_infinite="guessing no";;
13333 +         netbsd*)              gl_cv_func_printf_infinite="guessing yes";;
13334 +                               # Guess yes on BeOS.
13335 +         beos*)                gl_cv_func_printf_infinite="guessing yes";;
13336 +                               # If we don't know, assume the worst.
13337 +         *)                    gl_cv_func_printf_infinite="guessing no";;
13338 +       esac
13339 +changequote([,])dnl
13340 +      ])
13341 +    ])
13342 +])
13343 +
13344 +dnl Test whether the *printf family of functions supports infinite and NaN
13345 +dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001)
13346 +dnl Result is gl_cv_func_printf_infinite_long_double.
13347 +
13348 +AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE],
13349 +[
13350 +  AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
13351 +  AC_REQUIRE([AC_PROG_CC])
13352 +  AC_REQUIRE([AC_C_BIGENDIAN])
13353 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13354 +  dnl The user can set or unset the variable gl_printf_safe to indicate
13355 +  dnl that he wishes a safe handling of non-IEEE-754 'long double' values.
13356 +  if test -n "$gl_printf_safe"; then
13357 +    AC_DEFINE([CHECK_PRINTF_SAFE], 1,
13358 +      [Define if you wish *printf() functions that have a safe handling of
13359 +       non-IEEE-754 'long double' values.])
13360 +  fi
13361 +  case "$gl_cv_func_printf_long_double" in
13362 +    *yes)
13363 +      AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments],
13364 +        [gl_cv_func_printf_infinite_long_double],
13365 +        [
13366 +          AC_TRY_RUN([
13367 +]GL_NOCRASH[
13368 +#include <float.h>
13369 +#include <stdio.h>
13370 +#include <string.h>
13371 +static int
13372 +strisnan (const char *string, size_t start_index, size_t end_index)
13373 +{
13374 +  if (start_index < end_index)
13375 +    {
13376 +      if (string[start_index] == '-')
13377 +        start_index++;
13378 +      if (start_index + 3 <= end_index
13379 +          && memcmp (string + start_index, "nan", 3) == 0)
13380 +        {
13381 +          start_index += 3;
13382 +          if (start_index == end_index
13383 +              || (string[start_index] == '(' && string[end_index - 1] == ')'))
13384 +            return 1;
13385 +        }
13386 +    }
13387 +  return 0;
13388 +}
13389 +static char buf[10000];
13390 +static long double zeroL = 0.0L;
13391 +int main ()
13392 +{
13393 +  nocrash_init();
13394 +  if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0
13395 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13396 +    return 1;
13397 +  if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0
13398 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13399 +    return 1;
13400 +  if (sprintf (buf, "%Lf", zeroL / zeroL) < 0
13401 +      || !strisnan (buf, 0, strlen (buf)))
13402 +    return 1;
13403 +  if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0
13404 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13405 +    return 1;
13406 +  if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0
13407 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13408 +    return 1;
13409 +  if (sprintf (buf, "%Le", zeroL / zeroL) < 0
13410 +      || !strisnan (buf, 0, strlen (buf)))
13411 +    return 1;
13412 +  if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0
13413 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13414 +    return 1;
13415 +  if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0
13416 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13417 +    return 1;
13418 +  if (sprintf (buf, "%Lg", zeroL / zeroL) < 0
13419 +      || !strisnan (buf, 0, strlen (buf)))
13420 +    return 1;
13421 +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
13422 +/* Representation of an 80-bit 'long double' as an initializer for a sequence
13423 +   of 'unsigned int' words.  */
13424 +# ifdef WORDS_BIGENDIAN
13425 +#  define LDBL80_WORDS(exponent,manthi,mantlo) \
13426 +     { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
13427 +       ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16),    \
13428 +       (unsigned int) (mantlo) << 16                                        \
13429 +     }
13430 +# else
13431 +#  define LDBL80_WORDS(exponent,manthi,mantlo) \
13432 +     { mantlo, manthi, exponent }
13433 +# endif
13434 +  { /* Quiet NaN.  */
13435 +    static union { unsigned int word[4]; long double value; } x =
13436 +      { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
13437 +    if (sprintf (buf, "%Lf", x.value) < 0
13438 +        || !strisnan (buf, 0, strlen (buf)))
13439 +      return 1;
13440 +    if (sprintf (buf, "%Le", x.value) < 0
13441 +        || !strisnan (buf, 0, strlen (buf)))
13442 +      return 1;
13443 +    if (sprintf (buf, "%Lg", x.value) < 0
13444 +        || !strisnan (buf, 0, strlen (buf)))
13445 +      return 1;
13446 +  }
13447 +  {
13448 +    /* Signalling NaN.  */
13449 +    static union { unsigned int word[4]; long double value; } x =
13450 +      { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
13451 +    if (sprintf (buf, "%Lf", x.value) < 0
13452 +        || !strisnan (buf, 0, strlen (buf)))
13453 +      return 1;
13454 +    if (sprintf (buf, "%Le", x.value) < 0
13455 +        || !strisnan (buf, 0, strlen (buf)))
13456 +      return 1;
13457 +    if (sprintf (buf, "%Lg", x.value) < 0
13458 +        || !strisnan (buf, 0, strlen (buf)))
13459 +      return 1;
13460 +  }
13461 +  { /* Pseudo-NaN.  */
13462 +    static union { unsigned int word[4]; long double value; } x =
13463 +      { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
13464 +    if (sprintf (buf, "%Lf", x.value) < 0
13465 +        || !strisnan (buf, 0, strlen (buf)))
13466 +      return 1;
13467 +    if (sprintf (buf, "%Le", x.value) < 0
13468 +        || !strisnan (buf, 0, strlen (buf)))
13469 +      return 1;
13470 +    if (sprintf (buf, "%Lg", x.value) < 0
13471 +        || !strisnan (buf, 0, strlen (buf)))
13472 +      return 1;
13473 +  }
13474 +  { /* Pseudo-Infinity.  */
13475 +    static union { unsigned int word[4]; long double value; } x =
13476 +      { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
13477 +    if (sprintf (buf, "%Lf", x.value) < 0
13478 +        || !strisnan (buf, 0, strlen (buf)))
13479 +      return 1;
13480 +    if (sprintf (buf, "%Le", x.value) < 0
13481 +        || !strisnan (buf, 0, strlen (buf)))
13482 +      return 1;
13483 +    if (sprintf (buf, "%Lg", x.value) < 0
13484 +        || !strisnan (buf, 0, strlen (buf)))
13485 +      return 1;
13486 +  }
13487 +  { /* Pseudo-Zero.  */
13488 +    static union { unsigned int word[4]; long double value; } x =
13489 +      { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
13490 +    if (sprintf (buf, "%Lf", x.value) < 0
13491 +        || !strisnan (buf, 0, strlen (buf)))
13492 +      return 1;
13493 +    if (sprintf (buf, "%Le", x.value) < 0
13494 +        || !strisnan (buf, 0, strlen (buf)))
13495 +      return 1;
13496 +    if (sprintf (buf, "%Lg", x.value) < 0
13497 +        || !strisnan (buf, 0, strlen (buf)))
13498 +      return 1;
13499 +  }
13500 +  { /* Unnormalized number.  */
13501 +    static union { unsigned int word[4]; long double value; } x =
13502 +      { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
13503 +    if (sprintf (buf, "%Lf", x.value) < 0
13504 +        || !strisnan (buf, 0, strlen (buf)))
13505 +      return 1;
13506 +    if (sprintf (buf, "%Le", x.value) < 0
13507 +        || !strisnan (buf, 0, strlen (buf)))
13508 +      return 1;
13509 +    if (sprintf (buf, "%Lg", x.value) < 0
13510 +        || !strisnan (buf, 0, strlen (buf)))
13511 +      return 1;
13512 +  }
13513 +  { /* Pseudo-Denormal.  */
13514 +    static union { unsigned int word[4]; long double value; } x =
13515 +      { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
13516 +    if (sprintf (buf, "%Lf", x.value) < 0
13517 +        || !strisnan (buf, 0, strlen (buf)))
13518 +      return 1;
13519 +    if (sprintf (buf, "%Le", x.value) < 0
13520 +        || !strisnan (buf, 0, strlen (buf)))
13521 +      return 1;
13522 +    if (sprintf (buf, "%Lg", x.value) < 0
13523 +        || !strisnan (buf, 0, strlen (buf)))
13524 +      return 1;
13525 +  }
13526 +#endif
13527 +  return 0;
13528 +}],
13529 +          [gl_cv_func_printf_infinite_long_double=yes],
13530 +          [gl_cv_func_printf_infinite_long_double=no],
13531 +          [
13532 +changequote(,)dnl
13533 +           case "$host_cpu" in
13534 +                                   # Guess no on ia64, x86_64, i386.
13535 +             ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
13536 +             *)
13537 +               case "$host_os" in
13538 +                                       # Guess yes on glibc systems.
13539 +                 *-gnu*)               gl_cv_func_printf_infinite_long_double="guessing yes";;
13540 +                                       # Guess yes on FreeBSD >= 6.
13541 +                 freebsd[1-5]*)        gl_cv_func_printf_infinite_long_double="guessing no";;
13542 +                 freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
13543 +                                       # Guess yes on MacOS X >= 10.3.
13544 +                 darwin[1-6].*)        gl_cv_func_printf_infinite_long_double="guessing no";;
13545 +                 darwin*)              gl_cv_func_printf_infinite_long_double="guessing yes";;
13546 +                                       # Guess yes on HP-UX >= 11.
13547 +                 hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
13548 +                 hpux*)                gl_cv_func_printf_infinite_long_double="guessing yes";;
13549 +                                       # Guess yes on NetBSD >= 3.
13550 +                 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
13551 +                                       gl_cv_func_printf_infinite_long_double="guessing no";;
13552 +                 netbsd*)              gl_cv_func_printf_infinite_long_double="guessing yes";;
13553 +                                       # If we don't know, assume the worst.
13554 +                 *)                    gl_cv_func_printf_infinite_long_double="guessing no";;
13555 +               esac
13556 +               ;;
13557 +           esac
13558 +changequote([,])dnl
13559 +          ])
13560 +        ])
13561 +      ;;
13562 +    *)
13563 +      gl_cv_func_printf_infinite_long_double="irrelevant"
13564 +      ;;
13565 +  esac
13566 +])
13567 +
13568 +dnl Test whether the *printf family of functions supports the 'a' and 'A'
13569 +dnl conversion specifier for hexadecimal output of floating-point numbers.
13570 +dnl (ISO C99, POSIX:2001)
13571 +dnl Result is gl_cv_func_printf_directive_a.
13572 +
13573 +AC_DEFUN([gl_PRINTF_DIRECTIVE_A],
13574 +[
13575 +  AC_REQUIRE([AC_PROG_CC])
13576 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13577 +  AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives],
13578 +    [gl_cv_func_printf_directive_a],
13579 +    [
13580 +      AC_TRY_RUN([
13581 +#include <stdio.h>
13582 +#include <string.h>
13583 +static char buf[100];
13584 +int main ()
13585 +{
13586 +  if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
13587 +      || (strcmp (buf, "0x1.922p+1 33") != 0
13588 +          && strcmp (buf, "0x3.244p+0 33") != 0
13589 +          && strcmp (buf, "0x6.488p-1 33") != 0
13590 +          && strcmp (buf, "0xc.91p-2 33") != 0))
13591 +    return 1;
13592 +  if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0
13593 +      || (strcmp (buf, "-0X1.922P+1 33") != 0
13594 +          && strcmp (buf, "-0X3.244P+0 33") != 0
13595 +          && strcmp (buf, "-0X6.488P-1 33") != 0
13596 +          && strcmp (buf, "-0XC.91P-2 33") != 0))
13597 +    return 1;
13598 +  /* This catches a FreeBSD 6.1 bug: it doesn't round.  */
13599 +  if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
13600 +      || (strcmp (buf, "0x1.83p+0 33") != 0
13601 +          && strcmp (buf, "0x3.05p-1 33") != 0
13602 +          && strcmp (buf, "0x6.0ap-2 33") != 0
13603 +          && strcmp (buf, "0xc.14p-3 33") != 0))
13604 +    return 1;
13605 +  /* This catches a FreeBSD 6.1 bug.  See
13606 +     <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
13607 +  if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0
13608 +      || buf[0] == '0')
13609 +    return 1;
13610 +  /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug.  */
13611 +  if (sprintf (buf, "%.1a", 1.999) < 0
13612 +      || (strcmp (buf, "0x1.0p+1") != 0
13613 +          && strcmp (buf, "0x2.0p+0") != 0
13614 +          && strcmp (buf, "0x4.0p-1") != 0
13615 +          && strcmp (buf, "0x8.0p-2") != 0))
13616 +    return 1;
13617 +  /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a
13618 +     glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>.  */
13619 +  if (sprintf (buf, "%.1La", 1.999L) < 0
13620 +      || (strcmp (buf, "0x1.0p+1") != 0
13621 +          && strcmp (buf, "0x2.0p+0") != 0
13622 +          && strcmp (buf, "0x4.0p-1") != 0
13623 +          && strcmp (buf, "0x8.0p-2") != 0))
13624 +    return 1;
13625 +  return 0;
13626 +}], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no],
13627 +      [
13628 +       case "$host_os" in
13629 +                               # Guess yes on glibc >= 2.5 systems.
13630 +         *-gnu*)
13631 +           AC_EGREP_CPP([BZ2908], [
13632 +             #include <features.h>
13633 +             #ifdef __GNU_LIBRARY__
13634 +              #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)
13635 +               BZ2908
13636 +              #endif
13637 +             #endif
13638 +             ],
13639 +             [gl_cv_func_printf_directive_a="guessing yes"],
13640 +             [gl_cv_func_printf_directive_a="guessing no"])
13641 +           ;;
13642 +                               # If we don't know, assume the worst.
13643 +         *)                    gl_cv_func_printf_directive_a="guessing no";;
13644 +       esac
13645 +      ])
13646 +    ])
13647 +])
13648 +
13649 +dnl Test whether the *printf family of functions supports the %F format
13650 +dnl directive. (ISO C99, POSIX:2001)
13651 +dnl Result is gl_cv_func_printf_directive_f.
13652 +
13653 +AC_DEFUN([gl_PRINTF_DIRECTIVE_F],
13654 +[
13655 +  AC_REQUIRE([AC_PROG_CC])
13656 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13657 +  AC_CACHE_CHECK([whether printf supports the 'F' directive],
13658 +    [gl_cv_func_printf_directive_f],
13659 +    [
13660 +      AC_TRY_RUN([
13661 +#include <stdio.h>
13662 +#include <string.h>
13663 +static char buf[100];
13664 +int main ()
13665 +{
13666 +  if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0
13667 +      || strcmp (buf, "1234567.000000 33") != 0)
13668 +    return 1;
13669 +  if (sprintf (buf, "%F", 1.0 / 0.0) < 0
13670 +      || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0))
13671 +    return 1;
13672 +  /* This catches a Cygwin 2007 bug.  */
13673 +  if (sprintf (buf, "%.F", 1234.0) < 0
13674 +      || strcmp (buf, "1234") != 0)
13675 +    return 1;
13676 +  return 0;
13677 +}], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no],
13678 +      [
13679 +changequote(,)dnl
13680 +       case "$host_os" in
13681 +                               # Guess yes on glibc systems.
13682 +         *-gnu*)               gl_cv_func_printf_directive_f="guessing yes";;
13683 +                               # Guess yes on FreeBSD >= 6.
13684 +         freebsd[1-5]*)        gl_cv_func_printf_directive_f="guessing no";;
13685 +         freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
13686 +                               # Guess yes on MacOS X >= 10.3.
13687 +         darwin[1-6].*)        gl_cv_func_printf_directive_f="guessing no";;
13688 +         darwin*)              gl_cv_func_printf_directive_f="guessing yes";;
13689 +                               # Guess yes on Solaris >= 2.10.
13690 +         solaris2.[0-9]*)      gl_cv_func_printf_directive_f="guessing no";;
13691 +         solaris*)             gl_cv_func_printf_directive_f="guessing yes";;
13692 +                               # If we don't know, assume the worst.
13693 +         *)                    gl_cv_func_printf_directive_f="guessing no";;
13694 +       esac
13695 +changequote([,])dnl
13696 +      ])
13697 +    ])
13698 +])
13699 +
13700 +dnl Test whether the *printf family of functions supports the %n format
13701 +dnl directive. (ISO C99, POSIX:2001)
13702 +dnl Result is gl_cv_func_printf_directive_n.
13703 +
13704 +AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
13705 +[
13706 +  AC_REQUIRE([AC_PROG_CC])
13707 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13708 +  AC_CACHE_CHECK([whether printf supports the 'n' directive],
13709 +    [gl_cv_func_printf_directive_n],
13710 +    [
13711 +      AC_TRY_RUN([
13712 +#include <stdio.h>
13713 +#include <string.h>
13714 +static char fmtstring[10];
13715 +static char buf[100];
13716 +int main ()
13717 +{
13718 +  int count = -1;
13719 +  /* Copy the format string.  Some systems (glibc with _FORTIFY_SOURCE=2)
13720 +     support %n in format strings in read-only memory but not in writable
13721 +     memory.  */
13722 +  strcpy (fmtstring, "%d %n");
13723 +  if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0
13724 +      || strcmp (buf, "123 ") != 0
13725 +      || count != 4)
13726 +    return 1;
13727 +  return 0;
13728 +}], [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no],
13729 +      [
13730 +changequote(,)dnl
13731 +       case "$host_os" in
13732 +         *)     gl_cv_func_printf_directive_n="guessing yes";;
13733 +       esac
13734 +changequote([,])dnl
13735 +      ])
13736 +    ])
13737 +])
13738 +
13739 +dnl Test whether the *printf family of functions supports POSIX/XSI format
13740 +dnl strings with positions. (POSIX:2001)
13741 +dnl Result is gl_cv_func_printf_positions.
13742 +
13743 +AC_DEFUN([gl_PRINTF_POSITIONS],
13744 +[
13745 +  AC_REQUIRE([AC_PROG_CC])
13746 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13747 +  AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions],
13748 +    [gl_cv_func_printf_positions],
13749 +    [
13750 +      AC_TRY_RUN([
13751 +#include <stdio.h>
13752 +#include <string.h>
13753 +/* The string "%2$d %1$d", with dollar characters protected from the shell's
13754 +   dollar expansion (possibly an autoconf bug).  */
13755 +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
13756 +static char buf[100];
13757 +int main ()
13758 +{
13759 +  sprintf (buf, format, 33, 55);
13760 +  return (strcmp (buf, "55 33") != 0);
13761 +}], [gl_cv_func_printf_positions=yes], [gl_cv_func_printf_positions=no],
13762 +      [
13763 +changequote(,)dnl
13764 +       case "$host_os" in
13765 +         netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
13766 +                       gl_cv_func_printf_positions="guessing no";;
13767 +         beos*)        gl_cv_func_printf_positions="guessing no";;
13768 +         mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
13769 +         *)            gl_cv_func_printf_positions="guessing yes";;
13770 +       esac
13771 +changequote([,])dnl
13772 +      ])
13773 +    ])
13774 +])
13775 +
13776 +dnl Test whether the *printf family of functions supports POSIX/XSI format
13777 +dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001)
13778 +dnl Result is gl_cv_func_printf_flag_grouping.
13779 +
13780 +AC_DEFUN([gl_PRINTF_FLAG_GROUPING],
13781 +[
13782 +  AC_REQUIRE([AC_PROG_CC])
13783 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13784 +  AC_CACHE_CHECK([whether printf supports the grouping flag],
13785 +    [gl_cv_func_printf_flag_grouping],
13786 +    [
13787 +      AC_TRY_RUN([
13788 +#include <stdio.h>
13789 +#include <string.h>
13790 +static char buf[100];
13791 +int main ()
13792 +{
13793 +  if (sprintf (buf, "%'d %d", 1234567, 99) < 0
13794 +      || buf[strlen (buf) - 1] != '9')
13795 +    return 1;
13796 +  return 0;
13797 +}], [gl_cv_func_printf_flag_grouping=yes], [gl_cv_func_printf_flag_grouping=no],
13798 +      [
13799 +changequote(,)dnl
13800 +       case "$host_os" in
13801 +         cygwin*)      gl_cv_func_printf_flag_grouping="guessing no";;
13802 +         netbsd*)      gl_cv_func_printf_flag_grouping="guessing no";;
13803 +         mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
13804 +         *)            gl_cv_func_printf_flag_grouping="guessing yes";;
13805 +       esac
13806 +changequote([,])dnl
13807 +      ])
13808 +    ])
13809 +])
13810 +
13811 +dnl Test whether the *printf family of functions supports the - flag correctly.
13812 +dnl (ISO C99.) See
13813 +dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html>
13814 +dnl Result is gl_cv_func_printf_flag_leftadjust.
13815 +
13816 +AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
13817 +[
13818 +  AC_REQUIRE([AC_PROG_CC])
13819 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13820 +  AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly],
13821 +    [gl_cv_func_printf_flag_leftadjust],
13822 +    [
13823 +      AC_TRY_RUN([
13824 +#include <stdio.h>
13825 +#include <string.h>
13826 +static char buf[100];
13827 +int main ()
13828 +{
13829 +  /* Check that a '-' flag is not annihilated by a negative width.  */
13830 +  if (sprintf (buf, "a%-*sc", -3, "b") < 0
13831 +      || strcmp (buf, "ab  c") != 0)
13832 +    return 1;
13833 +  return 0;
13834 +}],
13835 +        [gl_cv_func_printf_flag_leftadjust=yes],
13836 +        [gl_cv_func_printf_flag_leftadjust=no],
13837 +        [
13838 +changequote(,)dnl
13839 +         case "$host_os" in
13840 +                    # Guess yes on HP-UX 11.
13841 +           hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
13842 +                    # Guess no on HP-UX 10 and older.
13843 +           hpux*)   gl_cv_func_printf_flag_leftadjust="guessing no";;
13844 +                    # Guess yes otherwise.
13845 +           *)       gl_cv_func_printf_flag_leftadjust="guessing yes";;
13846 +         esac
13847 +changequote([,])dnl
13848 +        ])
13849 +    ])
13850 +])
13851 +
13852 +dnl Test whether the *printf family of functions supports padding of non-finite
13853 +dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See
13854 +dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html>
13855 +dnl Result is gl_cv_func_printf_flag_zero.
13856 +
13857 +AC_DEFUN([gl_PRINTF_FLAG_ZERO],
13858 +[
13859 +  AC_REQUIRE([AC_PROG_CC])
13860 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13861 +  AC_CACHE_CHECK([whether printf supports the zero flag correctly],
13862 +    [gl_cv_func_printf_flag_zero],
13863 +    [
13864 +      AC_TRY_RUN([
13865 +#include <stdio.h>
13866 +#include <string.h>
13867 +static char buf[100];
13868 +int main ()
13869 +{
13870 +  if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0
13871 +      || (strcmp (buf, "       inf") != 0
13872 +          && strcmp (buf, "  infinity") != 0))
13873 +    return 1;
13874 +  return 0;
13875 +}], [gl_cv_func_printf_flag_zero=yes], [gl_cv_func_printf_flag_zero=no],
13876 +      [
13877 +changequote(,)dnl
13878 +       case "$host_os" in
13879 +                 # Guess yes on glibc systems.
13880 +         *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
13881 +                 # Guess yes on BeOS.
13882 +         beos*)  gl_cv_func_printf_flag_zero="guessing yes";;
13883 +                 # If we don't know, assume the worst.
13884 +         *)      gl_cv_func_printf_flag_zero="guessing no";;
13885 +       esac
13886 +changequote([,])dnl
13887 +      ])
13888 +    ])
13889 +])
13890 +
13891 +dnl Test whether the *printf family of functions supports large precisions.
13892 +dnl On mingw, precisions larger than 512 are treated like 512, in integer,
13893 +dnl floating-point or pointer output. On BeOS, precisions larger than 1044
13894 +dnl crash the program.
13895 +dnl Result is gl_cv_func_printf_precision.
13896 +
13897 +AC_DEFUN([gl_PRINTF_PRECISION],
13898 +[
13899 +  AC_REQUIRE([AC_PROG_CC])
13900 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13901 +  AC_CACHE_CHECK([whether printf supports large precisions],
13902 +    [gl_cv_func_printf_precision],
13903 +    [
13904 +      AC_TRY_RUN([
13905 +#include <stdio.h>
13906 +#include <string.h>
13907 +static char buf[5000];
13908 +int main ()
13909 +{
13910 +#ifdef __BEOS__
13911 +  /* On BeOS, this would crash and show a dialog box.  Avoid the crash.  */
13912 +  return 1;
13913 +#endif
13914 +  if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
13915 +    return 1;
13916 +  return 0;
13917 +}], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no],
13918 +      [
13919 +changequote(,)dnl
13920 +       case "$host_os" in
13921 +         # Guess no only on native Win32 and BeOS systems.
13922 +         mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
13923 +         beos*)        gl_cv_func_printf_precision="guessing no" ;;
13924 +         *)            gl_cv_func_printf_precision="guessing yes" ;;
13925 +       esac
13926 +changequote([,])dnl
13927 +      ])
13928 +    ])
13929 +])
13930 +
13931 +dnl Test whether the *printf family of functions recovers gracefully in case
13932 +dnl of an out-of-memory condition, or whether it crashes the entire program.
13933 +dnl Result is gl_cv_func_printf_enomem.
13934 +
13935 +AC_DEFUN([gl_PRINTF_ENOMEM],
13936 +[
13937 +  AC_REQUIRE([AC_PROG_CC])
13938 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13939 +  AC_CACHE_CHECK([whether printf survives out-of-memory conditions],
13940 +    [gl_cv_func_printf_enomem],
13941 +    [
13942 +      if test "$cross_compiling" = no; then
13943 +        AC_LANG_CONFTEST([AC_LANG_SOURCE([
13944 +]GL_NOCRASH[
13945 +changequote(,)dnl
13946 +#include <stdio.h>
13947 +#include <sys/types.h>
13948 +#include <sys/time.h>
13949 +#include <sys/resource.h>
13950 +#include <errno.h>
13951 +int main()
13952 +{
13953 +  struct rlimit limit;
13954 +  int ret;
13955 +  nocrash_init ();
13956 +  /* Some printf implementations allocate temporary space with malloc.  */
13957 +  /* On BSD systems, malloc() is limited by RLIMIT_DATA.  */
13958 +#ifdef RLIMIT_DATA
13959 +  if (getrlimit (RLIMIT_DATA, &limit) < 0)
13960 +    return 77;
13961 +  if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
13962 +    limit.rlim_max = 5000000;
13963 +  limit.rlim_cur = limit.rlim_max;
13964 +  if (setrlimit (RLIMIT_DATA, &limit) < 0)
13965 +    return 77;
13966 +#endif
13967 +  /* On Linux systems, malloc() is limited by RLIMIT_AS.  */
13968 +#ifdef RLIMIT_AS
13969 +  if (getrlimit (RLIMIT_AS, &limit) < 0)
13970 +    return 77;
13971 +  if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
13972 +    limit.rlim_max = 5000000;
13973 +  limit.rlim_cur = limit.rlim_max;
13974 +  if (setrlimit (RLIMIT_AS, &limit) < 0)
13975 +    return 77;
13976 +#endif
13977 +  /* Some printf implementations allocate temporary space on the stack.  */
13978 +#ifdef RLIMIT_STACK
13979 +  if (getrlimit (RLIMIT_STACK, &limit) < 0)
13980 +    return 77;
13981 +  if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
13982 +    limit.rlim_max = 5000000;
13983 +  limit.rlim_cur = limit.rlim_max;
13984 +  if (setrlimit (RLIMIT_STACK, &limit) < 0)
13985 +    return 77;
13986 +#endif
13987 +  ret = printf ("%.5000000f", 1.0);
13988 +  return !(ret == 5000002 || (ret < 0 && errno == ENOMEM));
13989 +}
13990 +changequote([,])dnl
13991 +          ])])
13992 +        if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
13993 +          (./conftest
13994 +           result=$?
13995 +           if test $result != 0 && test $result != 77; then result=1; fi
13996 +           exit $result
13997 +          ) >/dev/null 2>/dev/null
13998 +          case $? in
13999 +            0) gl_cv_func_printf_enomem="yes" ;;
14000 +            77) gl_cv_func_printf_enomem="guessing no" ;;
14001 +            *) gl_cv_func_printf_enomem="no" ;;
14002 +          esac
14003 +        else
14004 +          gl_cv_func_printf_enomem="guessing no"
14005 +        fi
14006 +        rm -fr conftest*
14007 +      else
14008 +changequote(,)dnl
14009 +        case "$host_os" in
14010 +                    # Guess yes on glibc systems.
14011 +          *-gnu*)   gl_cv_func_printf_enomem="guessing yes";;
14012 +                    # Guess yes on Solaris.
14013 +          solaris*) gl_cv_func_printf_enomem="guessing yes";;
14014 +                    # Guess yes on AIX.
14015 +          aix*)     gl_cv_func_printf_enomem="guessing yes";;
14016 +                    # Guess yes on HP-UX/hppa.
14017 +          hpux*)    case "$host_cpu" in
14018 +                      hppa*) gl_cv_func_printf_enomem="guessing yes";;
14019 +                      *)     gl_cv_func_printf_enomem="guessing no";;
14020 +                    esac
14021 +                    ;;
14022 +                    # Guess yes on IRIX.
14023 +          irix*)    gl_cv_func_printf_enomem="guessing yes";;
14024 +                    # Guess yes on OSF/1.
14025 +          osf*)     gl_cv_func_printf_enomem="guessing yes";;
14026 +                    # Guess yes on BeOS.
14027 +          beos*)    gl_cv_func_printf_enomem="guessing yes";;
14028 +                    # If we don't know, assume the worst.
14029 +          *)        gl_cv_func_printf_enomem="guessing no";;
14030 +        esac
14031 +changequote([,])dnl
14032 +      fi
14033 +    ])
14034 +])
14035 +
14036 +dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001)
14037 +dnl Result is ac_cv_func_snprintf.
14038 +
14039 +AC_DEFUN([gl_SNPRINTF_PRESENCE],
14040 +[
14041 +  AC_CHECK_FUNCS_ONCE([snprintf])
14042 +])
14043 +
14044 +dnl Test whether the string produced by the snprintf function is always NUL
14045 +dnl terminated. (ISO C99, POSIX:2001)
14046 +dnl Result is gl_cv_func_snprintf_truncation_c99.
14047 +
14048 +AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99],
14049 +[
14050 +  AC_REQUIRE([AC_PROG_CC])
14051 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14052 +  AC_CACHE_CHECK([whether snprintf truncates the result as in C99],
14053 +    [gl_cv_func_snprintf_truncation_c99],
14054 +    [
14055 +      AC_TRY_RUN([
14056 +#include <stdio.h>
14057 +#include <string.h>
14058 +static char buf[100];
14059 +int main ()
14060 +{
14061 +  strcpy (buf, "ABCDEF");
14062 +  snprintf (buf, 3, "%d %d", 4567, 89);
14063 +  if (memcmp (buf, "45\0DEF", 6) != 0)
14064 +    return 1;
14065 +  return 0;
14066 +}], [gl_cv_func_snprintf_truncation_c99=yes], [gl_cv_func_snprintf_truncation_c99=no],
14067 +      [
14068 +changequote(,)dnl
14069 +       case "$host_os" in
14070 +                               # Guess yes on glibc systems.
14071 +         *-gnu*)               gl_cv_func_snprintf_truncation_c99="guessing yes";;
14072 +                               # Guess yes on FreeBSD >= 5.
14073 +         freebsd[1-4]*)        gl_cv_func_snprintf_truncation_c99="guessing no";;
14074 +         freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
14075 +                               # Guess yes on MacOS X >= 10.3.
14076 +         darwin[1-6].*)        gl_cv_func_snprintf_truncation_c99="guessing no";;
14077 +         darwin*)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
14078 +                               # Guess yes on OpenBSD >= 3.9.
14079 +         openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
14080 +                               gl_cv_func_snprintf_truncation_c99="guessing no";;
14081 +         openbsd*)             gl_cv_func_snprintf_truncation_c99="guessing yes";;
14082 +                               # Guess yes on Solaris >= 2.6.
14083 +         solaris2.[0-5]*)      gl_cv_func_snprintf_truncation_c99="guessing no";;
14084 +         solaris*)             gl_cv_func_snprintf_truncation_c99="guessing yes";;
14085 +                               # Guess yes on AIX >= 4.
14086 +         aix[1-3]*)            gl_cv_func_snprintf_truncation_c99="guessing no";;
14087 +         aix*)                 gl_cv_func_snprintf_truncation_c99="guessing yes";;
14088 +                               # Guess yes on HP-UX >= 11.
14089 +         hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
14090 +         hpux*)                gl_cv_func_snprintf_truncation_c99="guessing yes";;
14091 +                               # Guess yes on IRIX >= 6.5.
14092 +         irix6.5)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
14093 +                               # Guess yes on OSF/1 >= 5.
14094 +         osf[3-4]*)            gl_cv_func_snprintf_truncation_c99="guessing no";;
14095 +         osf*)                 gl_cv_func_snprintf_truncation_c99="guessing yes";;
14096 +                               # Guess yes on NetBSD >= 3.
14097 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
14098 +                               gl_cv_func_snprintf_truncation_c99="guessing no";;
14099 +         netbsd*)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
14100 +                               # Guess yes on BeOS.
14101 +         beos*)                gl_cv_func_snprintf_truncation_c99="guessing yes";;
14102 +                               # If we don't know, assume the worst.
14103 +         *)                    gl_cv_func_snprintf_truncation_c99="guessing no";;
14104 +       esac
14105 +changequote([,])dnl
14106 +      ])
14107 +    ])
14108 +])
14109 +
14110 +dnl Test whether the return value of the snprintf function is the number
14111 +dnl of bytes (excluding the terminating NUL) that would have been produced
14112 +dnl if the buffer had been large enough. (ISO C99, POSIX:2001)
14113 +dnl For example, this test program fails on IRIX 6.5:
14114 +dnl     ---------------------------------------------------------------------
14115 +dnl     #include <stdio.h>
14116 +dnl     int main()
14117 +dnl     {
14118 +dnl       static char buf[8];
14119 +dnl       int retval = snprintf (buf, 3, "%d", 12345);
14120 +dnl       return retval >= 0 && retval < 3;
14121 +dnl     }
14122 +dnl     ---------------------------------------------------------------------
14123 +dnl Result is gl_cv_func_snprintf_retval_c99.
14124 +
14125 +AC_DEFUN([gl_SNPRINTF_RETVAL_C99],
14126 +[
14127 +  AC_REQUIRE([AC_PROG_CC])
14128 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14129 +  AC_CACHE_CHECK([whether snprintf returns a byte count as in C99],
14130 +    [gl_cv_func_snprintf_retval_c99],
14131 +    [
14132 +      AC_TRY_RUN([
14133 +#include <stdio.h>
14134 +#include <string.h>
14135 +static char buf[100];
14136 +int main ()
14137 +{
14138 +  strcpy (buf, "ABCDEF");
14139 +  if (snprintf (buf, 3, "%d %d", 4567, 89) != 7)
14140 +    return 1;
14141 +  return 0;
14142 +}], [gl_cv_func_snprintf_retval_c99=yes], [gl_cv_func_snprintf_retval_c99=no],
14143 +      [
14144 +changequote(,)dnl
14145 +       case "$host_os" in
14146 +                               # Guess yes on glibc systems.
14147 +         *-gnu*)               gl_cv_func_snprintf_retval_c99="guessing yes";;
14148 +                               # Guess yes on FreeBSD >= 5.
14149 +         freebsd[1-4]*)        gl_cv_func_snprintf_retval_c99="guessing no";;
14150 +         freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
14151 +                               # Guess yes on MacOS X >= 10.3.
14152 +         darwin[1-6].*)        gl_cv_func_snprintf_retval_c99="guessing no";;
14153 +         darwin*)              gl_cv_func_snprintf_retval_c99="guessing yes";;
14154 +                               # Guess yes on OpenBSD >= 3.9.
14155 +         openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
14156 +                               gl_cv_func_snprintf_retval_c99="guessing no";;
14157 +         openbsd*)             gl_cv_func_snprintf_retval_c99="guessing yes";;
14158 +                               # Guess yes on Solaris >= 2.6.
14159 +         solaris2.[0-5]*)      gl_cv_func_snprintf_retval_c99="guessing no";;
14160 +         solaris*)             gl_cv_func_snprintf_retval_c99="guessing yes";;
14161 +                               # Guess yes on AIX >= 4.
14162 +         aix[1-3]*)            gl_cv_func_snprintf_retval_c99="guessing no";;
14163 +         aix*)                 gl_cv_func_snprintf_retval_c99="guessing yes";;
14164 +                               # Guess yes on NetBSD >= 3.
14165 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
14166 +                               gl_cv_func_snprintf_retval_c99="guessing no";;
14167 +         netbsd*)              gl_cv_func_snprintf_retval_c99="guessing yes";;
14168 +                               # Guess yes on BeOS.
14169 +         beos*)                gl_cv_func_snprintf_retval_c99="guessing yes";;
14170 +                               # If we don't know, assume the worst.
14171 +         *)                    gl_cv_func_snprintf_retval_c99="guessing no";;
14172 +       esac
14173 +changequote([,])dnl
14174 +      ])
14175 +    ])
14176 +])
14177 +
14178 +dnl Test whether the snprintf function supports the %n format directive
14179 +dnl also in truncated portions of the format string. (ISO C99, POSIX:2001)
14180 +dnl Result is gl_cv_func_snprintf_directive_n.
14181 +
14182 +AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
14183 +[
14184 +  AC_REQUIRE([AC_PROG_CC])
14185 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14186 +  AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive],
14187 +    [gl_cv_func_snprintf_directive_n],
14188 +    [
14189 +      AC_TRY_RUN([
14190 +#include <stdio.h>
14191 +#include <string.h>
14192 +static char fmtstring[10];
14193 +static char buf[100];
14194 +int main ()
14195 +{
14196 +  int count = -1;
14197 +  /* Copy the format string.  Some systems (glibc with _FORTIFY_SOURCE=2)
14198 +     support %n in format strings in read-only memory but not in writable
14199 +     memory.  */
14200 +  strcpy (fmtstring, "%d %n");
14201 +  snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55);
14202 +  if (count != 6)
14203 +    return 1;
14204 +  return 0;
14205 +}], [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no],
14206 +      [
14207 +changequote(,)dnl
14208 +       case "$host_os" in
14209 +                               # Guess yes on glibc systems.
14210 +         *-gnu*)               gl_cv_func_snprintf_directive_n="guessing yes";;
14211 +                               # Guess yes on FreeBSD >= 5.
14212 +         freebsd[1-4]*)        gl_cv_func_snprintf_directive_n="guessing no";;
14213 +         freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
14214 +                               # Guess yes on MacOS X >= 10.3.
14215 +         darwin[1-6].*)        gl_cv_func_snprintf_directive_n="guessing no";;
14216 +         darwin*)              gl_cv_func_snprintf_directive_n="guessing yes";;
14217 +                               # Guess yes on Solaris >= 2.6.
14218 +         solaris2.[0-5]*)      gl_cv_func_snprintf_directive_n="guessing no";;
14219 +         solaris*)             gl_cv_func_snprintf_directive_n="guessing yes";;
14220 +                               # Guess yes on AIX >= 4.
14221 +         aix[1-3]*)            gl_cv_func_snprintf_directive_n="guessing no";;
14222 +         aix*)                 gl_cv_func_snprintf_directive_n="guessing yes";;
14223 +                               # Guess yes on IRIX >= 6.5.
14224 +         irix6.5)              gl_cv_func_snprintf_directive_n="guessing yes";;
14225 +                               # Guess yes on OSF/1 >= 5.
14226 +         osf[3-4]*)            gl_cv_func_snprintf_directive_n="guessing no";;
14227 +         osf*)                 gl_cv_func_snprintf_directive_n="guessing yes";;
14228 +                               # Guess yes on NetBSD >= 3.
14229 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
14230 +                               gl_cv_func_snprintf_directive_n="guessing no";;
14231 +         netbsd*)              gl_cv_func_snprintf_directive_n="guessing yes";;
14232 +                               # Guess yes on BeOS.
14233 +         beos*)                gl_cv_func_snprintf_directive_n="guessing yes";;
14234 +                               # If we don't know, assume the worst.
14235 +         *)                    gl_cv_func_snprintf_directive_n="guessing no";;
14236 +       esac
14237 +changequote([,])dnl
14238 +      ])
14239 +    ])
14240 +])
14241 +
14242 +dnl Test whether the snprintf function, when passed a size = 1, writes any
14243 +dnl output without bounds in this case, behaving like sprintf. This is the
14244 +dnl case on Linux libc5.
14245 +dnl Result is gl_cv_func_snprintf_size1.
14246 +
14247 +AC_DEFUN([gl_SNPRINTF_SIZE1],
14248 +[
14249 +  AC_REQUIRE([AC_PROG_CC])
14250 +  AC_CACHE_CHECK([whether snprintf respects a size of 1],
14251 +    [gl_cv_func_snprintf_size1],
14252 +    [
14253 +      AC_TRY_RUN([
14254 +#include <stdio.h>
14255 +int main()
14256 +{
14257 +  static char buf[8] = "DEADBEEF";
14258 +  snprintf (buf, 1, "%d", 12345);
14259 +  return buf[1] != 'E';
14260 +}],
14261 +      [gl_cv_func_snprintf_size1=yes],
14262 +      [gl_cv_func_snprintf_size1=no],
14263 +      [gl_cv_func_snprintf_size1="guessing yes"])
14264 +    ])
14265 +])
14266 +
14267 +dnl Test whether the vsnprintf function, when passed a zero size, produces no
14268 +dnl output. (ISO C99, POSIX:2001)
14269 +dnl For example, snprintf nevertheless writes a NUL byte in this case
14270 +dnl on OSF/1 5.1:
14271 +dnl     ---------------------------------------------------------------------
14272 +dnl     #include <stdio.h>
14273 +dnl     int main()
14274 +dnl     {
14275 +dnl       static char buf[8] = "DEADBEEF";
14276 +dnl       snprintf (buf, 0, "%d", 12345);
14277 +dnl       return buf[0] != 'D';
14278 +dnl     }
14279 +dnl     ---------------------------------------------------------------------
14280 +dnl And vsnprintf writes any output without bounds in this case, behaving like
14281 +dnl vsprintf, on HP-UX 11 and OSF/1 5.1:
14282 +dnl     ---------------------------------------------------------------------
14283 +dnl     #include <stdarg.h>
14284 +dnl     #include <stdio.h>
14285 +dnl     static int my_snprintf (char *buf, int size, const char *format, ...)
14286 +dnl     {
14287 +dnl       va_list args;
14288 +dnl       int ret;
14289 +dnl       va_start (args, format);
14290 +dnl       ret = vsnprintf (buf, size, format, args);
14291 +dnl       va_end (args);
14292 +dnl       return ret;
14293 +dnl     }
14294 +dnl     int main()
14295 +dnl     {
14296 +dnl       static char buf[8] = "DEADBEEF";
14297 +dnl       my_snprintf (buf, 0, "%d", 12345);
14298 +dnl       return buf[0] != 'D';
14299 +dnl     }
14300 +dnl     ---------------------------------------------------------------------
14301 +dnl Result is gl_cv_func_vsnprintf_zerosize_c99.
14302 +
14303 +AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99],
14304 +[
14305 +  AC_REQUIRE([AC_PROG_CC])
14306 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14307 +  AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99],
14308 +    [gl_cv_func_vsnprintf_zerosize_c99],
14309 +    [
14310 +      AC_TRY_RUN([
14311 +#include <stdarg.h>
14312 +#include <stdio.h>
14313 +static int my_snprintf (char *buf, int size, const char *format, ...)
14314 +{
14315 +  va_list args;
14316 +  int ret;
14317 +  va_start (args, format);
14318 +  ret = vsnprintf (buf, size, format, args);
14319 +  va_end (args);
14320 +  return ret;
14321 +}
14322 +int main()
14323 +{
14324 +  static char buf[8] = "DEADBEEF";
14325 +  my_snprintf (buf, 0, "%d", 12345);
14326 +  return buf[0] != 'D';
14327 +}],
14328 +      [gl_cv_func_vsnprintf_zerosize_c99=yes],
14329 +      [gl_cv_func_vsnprintf_zerosize_c99=no],
14330 +      [
14331 +changequote(,)dnl
14332 +       case "$host_os" in
14333 +                               # Guess yes on glibc systems.
14334 +         *-gnu*)               gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14335 +                               # Guess yes on FreeBSD >= 5.
14336 +         freebsd[1-4]*)        gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14337 +         freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14338 +                               # Guess yes on MacOS X >= 10.3.
14339 +         darwin[1-6].*)        gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14340 +         darwin*)              gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14341 +                               # Guess yes on Cygwin.
14342 +         cygwin*)              gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14343 +                               # Guess yes on Solaris >= 2.6.
14344 +         solaris2.[0-5]*)      gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14345 +         solaris*)             gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14346 +                               # Guess yes on AIX >= 4.
14347 +         aix[1-3]*)            gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14348 +         aix*)                 gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14349 +                               # Guess yes on IRIX >= 6.5.
14350 +         irix6.5)              gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14351 +                               # Guess yes on NetBSD >= 3.
14352 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
14353 +                               gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14354 +         netbsd*)              gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14355 +                               # Guess yes on BeOS.
14356 +         beos*)                gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14357 +                               # Guess yes on mingw.
14358 +         mingw* | pw*)         gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14359 +                               # If we don't know, assume the worst.
14360 +         *)                    gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14361 +       esac
14362 +changequote([,])dnl
14363 +      ])
14364 +    ])
14365 +])
14366 +
14367 +dnl The results of these tests on various platforms are:
14368 +dnl
14369 +dnl 1 = gl_PRINTF_SIZES_C99
14370 +dnl 2 = gl_PRINTF_LONG_DOUBLE
14371 +dnl 3 = gl_PRINTF_INFINITE
14372 +dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE
14373 +dnl 5 = gl_PRINTF_DIRECTIVE_A
14374 +dnl 6 = gl_PRINTF_DIRECTIVE_F
14375 +dnl 7 = gl_PRINTF_DIRECTIVE_N
14376 +dnl 8 = gl_PRINTF_POSITIONS
14377 +dnl 9 = gl_PRINTF_FLAG_GROUPING
14378 +dnl 10 = gl_PRINTF_FLAG_LEFTADJUST
14379 +dnl 11 = gl_PRINTF_FLAG_ZERO
14380 +dnl 12 = gl_PRINTF_PRECISION
14381 +dnl 13 = gl_PRINTF_ENOMEM
14382 +dnl 14 = gl_SNPRINTF_PRESENCE
14383 +dnl 15 = gl_SNPRINTF_TRUNCATION_C99
14384 +dnl 16 = gl_SNPRINTF_RETVAL_C99
14385 +dnl 17 = gl_SNPRINTF_DIRECTIVE_N
14386 +dnl 18 = gl_SNPRINTF_SIZE1
14387 +dnl 19 = gl_VSNPRINTF_ZEROSIZE_C99
14388 +dnl
14389 +dnl 1 = checking whether printf supports size specifiers as in C99...
14390 +dnl 2 = checking whether printf supports 'long double' arguments...
14391 +dnl 3 = checking whether printf supports infinite 'double' arguments...
14392 +dnl 4 = checking whether printf supports infinite 'long double' arguments...
14393 +dnl 5 = checking whether printf supports the 'a' and 'A' directives...
14394 +dnl 6 = checking whether printf supports the 'F' directive...
14395 +dnl 7 = checking whether printf supports the 'n' directive...
14396 +dnl 8 = checking whether printf supports POSIX/XSI format strings with positions...
14397 +dnl 9 = checking whether printf supports the grouping flag...
14398 +dnl 10 = checking whether printf supports the left-adjust flag correctly...
14399 +dnl 11 = checking whether printf supports the zero flag correctly...
14400 +dnl 12 = checking whether printf supports large precisions...
14401 +dnl 13 = checking whether printf survives out-of-memory conditions...
14402 +dnl 14 = checking for snprintf...
14403 +dnl 15 = checking whether snprintf truncates the result as in C99...
14404 +dnl 16 = checking whether snprintf returns a byte count as in C99...
14405 +dnl 17 = checking whether snprintf fully supports the 'n' directive...
14406 +dnl 18 = checking whether snprintf respects a size of 1...
14407 +dnl 19 = checking whether vsnprintf respects a zero size as in C99...
14408 +dnl
14409 +dnl . = yes, # = no.
14410 +dnl
14411 +dnl                                  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19
14412 +dnl   glibc 2.5                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
14413 +dnl   glibc 2.3.6                    .  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .
14414 +dnl   FreeBSD 5.4, 6.1               .  .  .  .  #  .  .  .  .  .  #  .  #  .  .  .  .  .  .
14415 +dnl   MacOS X 10.3.9                 .  .  .  .  #  .  .  .  .  .  #  .  #  .  .  .  .  .  .
14416 +dnl   OpenBSD 3.9, 4.0               .  .  #  #  #  #  .  .  #  .  #  .  #  .  .  .  .  .  .
14417 +dnl   Cygwin 2007 (= Cygwin 1.5.24)  .  .  .  .  #  #  .  .  .  ?  #  ?  ?  .  .  .  .  .  .
14418 +dnl   Cygwin 2006 (= Cygwin 1.5.19)  #  .  .  .  #  #  .  .  #  ?  #  ?  ?  .  .  .  .  .  .
14419 +dnl   Solaris 10                     .  .  #  #  #  .  .  .  .  .  #  .  .  .  .  .  .  .  .
14420 +dnl   Solaris 2.6 ... 9              #  .  #  #  #  #  .  .  .  .  #  .  .  .  .  .  .  .  .
14421 +dnl   Solaris 2.5.1                  #  .  #  #  #  #  .  .  .  .  #  .  .  #  #  #  #  #  #
14422 +dnl   AIX 5.2                        .  .  #  #  #  .  .  .  .  .  #  .  .  .  .  .  .  .  .
14423 +dnl   AIX 4.3.2, 5.1                 #  .  #  #  #  #  .  .  .  .  #  .  .  .  .  .  .  .  .
14424 +dnl   HP-UX 11.31                    .  .  .  .  #  .  .  .  .  .  #  .  .  .  .  #  #  .  .
14425 +dnl   HP-UX 11.{00,11,23}            #  .  .  .  #  #  .  .  .  .  #  .  .  .  .  #  #  .  #
14426 +dnl   HP-UX 10.20                    #  .  .  .  #  #  .  .  .  #  #  .  .  .  .  #  #  ?  #
14427 +dnl   IRIX 6.5                       #  .  #  #  #  #  .  .  .  .  #  .  .  .  .  #  .  .  .
14428 +dnl   OSF/1 5.1                      #  .  #  #  #  #  .  .  .  .  #  .  .  .  .  #  .  .  #
14429 +dnl   OSF/1 4.0d                     #  .  #  #  #  #  .  .  .  .  #  .  .  #  #  #  #  #  #
14430 +dnl   NetBSD 4.0                     .  ?  ?  ?  ?  ?  .  .  ?  ?  ?  ?  ?  .  .  .  ?  ?  ?
14431 +dnl   NetBSD 3.0                     .  .  .  .  #  #  .  #  #  ?  #  .  #  .  .  .  .  .  .
14432 +dnl   BeOS                           #  #  .  #  #  #  .  #  .  ?  .  #  ?  .  .  .  .  .  .
14433 +dnl   mingw                          #  #  #  #  #  #  .  #  #  .  #  #  ?  .  #  #  #  .  .
14434 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/size_max.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/size_max.m4
14435 --- gtk-vnc-0.3.7.dan3/gnulib/m4/size_max.m4    1970-01-01 01:00:00.000000000 +0100
14436 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/size_max.m4  2008-10-09 15:24:52.000000000 +0100
14437 @@ -0,0 +1,68 @@
14438 +# size_max.m4 serial 6
14439 +dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc.
14440 +dnl This file is free software; the Free Software Foundation
14441 +dnl gives unlimited permission to copy and/or distribute it,
14442 +dnl with or without modifications, as long as this notice is preserved.
14443 +
14444 +dnl From Bruno Haible.
14445 +
14446 +AC_DEFUN([gl_SIZE_MAX],
14447 +[
14448 +  AC_CHECK_HEADERS(stdint.h)
14449 +  dnl First test whether the system already has SIZE_MAX.
14450 +  AC_MSG_CHECKING([for SIZE_MAX])
14451 +  AC_CACHE_VAL([gl_cv_size_max], [
14452 +    gl_cv_size_max=
14453 +    AC_EGREP_CPP([Found it], [
14454 +#include <limits.h>
14455 +#if HAVE_STDINT_H
14456 +#include <stdint.h>
14457 +#endif
14458 +#ifdef SIZE_MAX
14459 +Found it
14460 +#endif
14461 +], gl_cv_size_max=yes)
14462 +    if test -z "$gl_cv_size_max"; then
14463 +      dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
14464 +      dnl than the type 'unsigned long'. Try hard to find a definition that can
14465 +      dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
14466 +      AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1],
14467 +        [#include <stddef.h>
14468 +#include <limits.h>], size_t_bits_minus_1=)
14469 +      AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)],
14470 +        [#include <stddef.h>], fits_in_uint=)
14471 +      if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
14472 +        if test $fits_in_uint = 1; then
14473 +          dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
14474 +          dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
14475 +          AC_TRY_COMPILE([#include <stddef.h>
14476 +            extern size_t foo;
14477 +            extern unsigned long foo;
14478 +            ], [], fits_in_uint=0)
14479 +        fi
14480 +        dnl We cannot use 'expr' to simplify this expression, because 'expr'
14481 +        dnl works only with 'long' integers in the host environment, while we
14482 +        dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
14483 +        if test $fits_in_uint = 1; then
14484 +          gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
14485 +        else
14486 +          gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
14487 +        fi
14488 +      else
14489 +        dnl Shouldn't happen, but who knows...
14490 +        gl_cv_size_max='((size_t)~(size_t)0)'
14491 +      fi
14492 +    fi
14493 +  ])
14494 +  AC_MSG_RESULT([$gl_cv_size_max])
14495 +  if test "$gl_cv_size_max" != yes; then
14496 +    AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max],
14497 +      [Define as the maximum value of type 'size_t', if the system doesn't define it.])
14498 +  fi
14499 +])
14500 +
14501 +dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
14502 +dnl Remove this when we can assume autoconf >= 2.61.
14503 +m4_ifdef([AC_COMPUTE_INT], [], [
14504 +  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
14505 +])
14506 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/snprintf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/snprintf.m4
14507 --- gtk-vnc-0.3.7.dan3/gnulib/m4/snprintf.m4    1970-01-01 01:00:00.000000000 +0100
14508 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/snprintf.m4  2008-10-09 15:24:53.000000000 +0100
14509 @@ -0,0 +1,40 @@
14510 +# snprintf.m4 serial 5
14511 +dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
14512 +dnl This file is free software; the Free Software Foundation
14513 +dnl gives unlimited permission to copy and/or distribute it,
14514 +dnl with or without modifications, as long as this notice is preserved.
14515 +
14516 +AC_DEFUN([gl_FUNC_SNPRINTF],
14517 +[
14518 +  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
14519 +  gl_cv_func_snprintf_usable=no
14520 +  AC_CHECK_FUNCS([snprintf])
14521 +  if test $ac_cv_func_snprintf = yes; then
14522 +    gl_SNPRINTF_SIZE1
14523 +    case "$gl_cv_func_snprintf_size1" in
14524 +      *yes)
14525 +        gl_cv_func_snprintf_usable=yes
14526 +        ;;
14527 +    esac
14528 +  fi
14529 +  if test $gl_cv_func_snprintf_usable = no; then
14530 +    gl_REPLACE_SNPRINTF
14531 +  fi
14532 +  AC_CHECK_DECLS_ONCE([snprintf])
14533 +  if test $ac_cv_have_decl_snprintf = no; then
14534 +    HAVE_DECL_SNPRINTF=0
14535 +  fi
14536 +])
14537 +
14538 +AC_DEFUN([gl_REPLACE_SNPRINTF],
14539 +[
14540 +  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
14541 +  AC_LIBOBJ([snprintf])
14542 +  if test $ac_cv_func_snprintf = yes; then
14543 +    REPLACE_SNPRINTF=1
14544 +  fi
14545 +  gl_PREREQ_SNPRINTF
14546 +])
14547 +
14548 +# Prerequisites of lib/snprintf.c.
14549 +AC_DEFUN([gl_PREREQ_SNPRINTF], [:])
14550 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/socklen.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/socklen.m4
14551 --- gtk-vnc-0.3.7.dan3/gnulib/m4/socklen.m4     1970-01-01 01:00:00.000000000 +0100
14552 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/socklen.m4   2008-10-09 15:24:53.000000000 +0100
14553 @@ -0,0 +1,52 @@
14554 +# socklen.m4 serial 6
14555 +dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
14556 +dnl This file is free software; the Free Software Foundation
14557 +dnl gives unlimited permission to copy and/or distribute it,
14558 +dnl with or without modifications, as long as this notice is preserved.
14559 +
14560 +dnl From Albert Chin, Windows fixes from Simon Josefsson.
14561 +
14562 +dnl Check for socklen_t: historically on BSD it is an int, and in
14563 +dnl POSIX 1g it is a type of its own, but some platforms use different
14564 +dnl types for the argument to getsockopt, getpeername, etc.  So we
14565 +dnl have to test to find something that will work.
14566 +
14567 +dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
14568 +dnl it there first.  That file is included by gnulib's sys_socket.in.h, which
14569 +dnl all users of this module should include.  Cygwin must not include
14570 +dnl ws2tcpip.h.
14571 +AC_DEFUN([gl_TYPE_SOCKLEN_T],
14572 +  [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl
14573 +   AC_CHECK_TYPE([socklen_t], ,
14574 +     [AC_MSG_CHECKING([for socklen_t equivalent])
14575 +      AC_CACHE_VAL([gl_cv_socklen_t_equiv],
14576 +       [# Systems have either "struct sockaddr *" or
14577 +        # "void *" as the second argument to getpeername
14578 +        gl_cv_socklen_t_equiv=
14579 +        for arg2 in "struct sockaddr" void; do
14580 +          for t in int size_t "unsigned int" "long int" "unsigned long int"; do
14581 +            AC_TRY_COMPILE(
14582 +              [#include <sys/types.h>
14583 +               #include <sys/socket.h>
14584 +
14585 +               int getpeername (int, $arg2 *, $t *);],
14586 +              [$t len;
14587 +               getpeername (0, 0, &len);],
14588 +              [gl_cv_socklen_t_equiv="$t"])
14589 +            test "$gl_cv_socklen_t_equiv" != "" && break
14590 +          done
14591 +          test "$gl_cv_socklen_t_equiv" != "" && break
14592 +        done
14593 +      ])
14594 +      if test "$gl_cv_socklen_t_equiv" = ""; then
14595 +       AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
14596 +      fi
14597 +      AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
14598 +      AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
14599 +       [type to use in place of socklen_t if not defined])],
14600 +     [#include <sys/types.h>
14601 +      #if HAVE_SYS_SOCKET_H
14602 +      # include <sys/socket.h>
14603 +      #elif HAVE_WS2TCPIP_H
14604 +      # include <ws2tcpip.h>
14605 +      #endif])])
14606 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/sockpfaf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/sockpfaf.m4
14607 --- gtk-vnc-0.3.7.dan3/gnulib/m4/sockpfaf.m4    1970-01-01 01:00:00.000000000 +0100
14608 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/sockpfaf.m4  2008-10-09 15:24:53.000000000 +0100
14609 @@ -0,0 +1,58 @@
14610 +# sockpfaf.m4 serial 5
14611 +dnl Copyright (C) 2004, 2006 Free Software Foundation, Inc.
14612 +dnl This file is free software; the Free Software Foundation
14613 +dnl gives unlimited permission to copy and/or distribute it,
14614 +dnl with or without modifications, as long as this notice is preserved.
14615 +
14616 +dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...)
14617 +dnl and some common address families (AF_INET, AF_INET6, ...).
14618 +dnl This test assumes that a system supports an address family if and only if
14619 +dnl it supports the corresponding protocol family.
14620 +
14621 +dnl From Bruno Haible.
14622 +
14623 +AC_DEFUN([gl_SOCKET_FAMILIES],
14624 +[
14625 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
14626 +  AC_CHECK_HEADERS_ONCE([netinet/in.h])
14627 +
14628 +  AC_MSG_CHECKING(for IPv4 sockets)
14629 +  AC_CACHE_VAL(gl_cv_socket_ipv4,
14630 +    [AC_TRY_COMPILE([#include <sys/types.h>
14631 +#ifdef HAVE_SYS_SOCKET_H
14632 +#include <sys/socket.h>
14633 +#endif
14634 +#ifdef HAVE_NETINET_IN_H
14635 +#include <netinet/in.h>
14636 +#endif
14637 +#ifdef HAVE_WINSOCK2_H
14638 +#include <winsock2.h>
14639 +#endif],
14640 +[int x = AF_INET; struct in_addr y; struct sockaddr_in z;
14641 + if (&x && &y && &z) return 0;],
14642 +       gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
14643 +  AC_MSG_RESULT($gl_cv_socket_ipv4)
14644 +  if test $gl_cv_socket_ipv4 = yes; then
14645 +    AC_DEFINE(HAVE_IPV4, 1, [Define to 1 if <sys/socket.h> defines AF_INET.])
14646 +  fi
14647 +
14648 +  AC_MSG_CHECKING(for IPv6 sockets)
14649 +  AC_CACHE_VAL(gl_cv_socket_ipv6,
14650 +    [AC_TRY_COMPILE([#include <sys/types.h>
14651 +#ifdef HAVE_SYS_SOCKET_H
14652 +#include <sys/socket.h>
14653 +#endif
14654 +#ifdef HAVE_NETINET_IN_H
14655 +#include <netinet/in.h>
14656 +#endif
14657 +#ifdef HAVE_WINSOCK2_H
14658 +#include <winsock2.h>
14659 +#endif],
14660 +[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
14661 + if (&x && &y && &z) return 0;],
14662 +       gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
14663 +  AC_MSG_RESULT($gl_cv_socket_ipv6)
14664 +  if test $gl_cv_socket_ipv6 = yes; then
14665 +    AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if <sys/socket.h> defines AF_INET6.])
14666 +  fi
14667 +])
14668 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/stdbool.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdbool.m4
14669 --- gtk-vnc-0.3.7.dan3/gnulib/m4/stdbool.m4     1970-01-01 01:00:00.000000000 +0100
14670 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdbool.m4   2008-10-09 15:24:53.000000000 +0100
14671 @@ -0,0 +1,115 @@
14672 +# Check for stdbool.h that conforms to C99.
14673 +
14674 +dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
14675 +dnl This file is free software; the Free Software Foundation
14676 +dnl gives unlimited permission to copy and/or distribute it,
14677 +dnl with or without modifications, as long as this notice is preserved.
14678 +
14679 +# Prepare for substituting <stdbool.h> if it is not supported.
14680 +
14681 +AC_DEFUN([AM_STDBOOL_H],
14682 +[
14683 +  AC_REQUIRE([AC_HEADER_STDBOOL])
14684 +
14685 +  # Define two additional variables used in the Makefile substitution.
14686 +
14687 +  if test "$ac_cv_header_stdbool_h" = yes; then
14688 +    STDBOOL_H=''
14689 +  else
14690 +    STDBOOL_H='stdbool.h'
14691 +  fi
14692 +  AC_SUBST([STDBOOL_H])
14693 +
14694 +  if test "$ac_cv_type__Bool" = yes; then
14695 +    HAVE__BOOL=1
14696 +  else
14697 +    HAVE__BOOL=0
14698 +  fi
14699 +  AC_SUBST([HAVE__BOOL])
14700 +])
14701 +
14702 +# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
14703 +AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
14704 +
14705 +# This macro is only needed in autoconf <= 2.59.  Newer versions of autoconf
14706 +# have this macro built-in.
14707 +
14708 +AC_DEFUN([AC_HEADER_STDBOOL],
14709 +  [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
14710 +     [ac_cv_header_stdbool_h],
14711 +     [AC_TRY_COMPILE(
14712 +       [
14713 +         #include <stdbool.h>
14714 +         #ifndef bool
14715 +          "error: bool is not defined"
14716 +         #endif
14717 +         #ifndef false
14718 +          "error: false is not defined"
14719 +         #endif
14720 +         #if false
14721 +          "error: false is not 0"
14722 +         #endif
14723 +         #ifndef true
14724 +          "error: true is not defined"
14725 +         #endif
14726 +         #if true != 1
14727 +          "error: true is not 1"
14728 +         #endif
14729 +         #ifndef __bool_true_false_are_defined
14730 +          "error: __bool_true_false_are_defined is not defined"
14731 +         #endif
14732 +
14733 +         struct s { _Bool s: 1; _Bool t; } s;
14734 +
14735 +         char a[true == 1 ? 1 : -1];
14736 +         char b[false == 0 ? 1 : -1];
14737 +         char c[__bool_true_false_are_defined == 1 ? 1 : -1];
14738 +         char d[(bool) 0.5 == true ? 1 : -1];
14739 +         bool e = &s;
14740 +         char f[(_Bool) 0.0 == false ? 1 : -1];
14741 +         char g[true];
14742 +         char h[sizeof (_Bool)];
14743 +         char i[sizeof s.t];
14744 +         enum { j = false, k = true, l = false * true, m = true * 256 };
14745 +         _Bool n[m];
14746 +         char o[sizeof n == m * sizeof n[0] ? 1 : -1];
14747 +         char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
14748 +         #if defined __xlc__ || defined __GNUC__
14749 +          /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
14750 +             reported by James Lemley on 2005-10-05; see
14751 +             http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
14752 +             This test is not quite right, since xlc is allowed to
14753 +             reject this program, as the initializer for xlcbug is
14754 +             not one of the forms that C requires support for.
14755 +             However, doing the test right would require a run-time
14756 +             test, and that would make cross-compilation harder.
14757 +             Let us hope that IBM fixes the xlc bug, and also adds
14758 +             support for this kind of constant expression.  In the
14759 +             meantime, this test will reject xlc, which is OK, since
14760 +             our stdbool.h substitute should suffice.  We also test
14761 +             this with GCC, where it should work, to detect more
14762 +             quickly whether someone messes up the test in the
14763 +             future.  */
14764 +          char digs[] = "0123456789";
14765 +          int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
14766 +         #endif
14767 +         /* Catch a bug in an HP-UX C compiler.  See
14768 +            http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
14769 +            http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
14770 +          */
14771 +         _Bool q = true;
14772 +         _Bool *pq = &q;
14773 +       ],
14774 +       [
14775 +         *pq |= q;
14776 +         *pq |= ! q;
14777 +         /* Refer to every declared value, to avoid compiler optimizations.  */
14778 +         return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
14779 +                 + !m + !n + !o + !p + !q + !pq);
14780 +       ],
14781 +       [ac_cv_header_stdbool_h=yes],
14782 +       [ac_cv_header_stdbool_h=no])])
14783 +   AC_CHECK_TYPES([_Bool])
14784 +   if test $ac_cv_header_stdbool_h = yes; then
14785 +     AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
14786 +   fi])
14787 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/stdint_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint_h.m4
14788 --- gtk-vnc-0.3.7.dan3/gnulib/m4/stdint_h.m4    1970-01-01 01:00:00.000000000 +0100
14789 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint_h.m4  2008-10-09 15:24:53.000000000 +0100
14790 @@ -0,0 +1,26 @@
14791 +# stdint_h.m4 serial 6
14792 +dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc.
14793 +dnl This file is free software; the Free Software Foundation
14794 +dnl gives unlimited permission to copy and/or distribute it,
14795 +dnl with or without modifications, as long as this notice is preserved.
14796 +
14797 +dnl From Paul Eggert.
14798 +
14799 +# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
14800 +# doesn't clash with <sys/types.h>, and declares uintmax_t.
14801 +
14802 +AC_DEFUN([gl_AC_HEADER_STDINT_H],
14803 +[
14804 +  AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h,
14805 +  [AC_TRY_COMPILE(
14806 +    [#include <sys/types.h>
14807 +#include <stdint.h>],
14808 +    [uintmax_t i = (uintmax_t) -1; return !i;],
14809 +    gl_cv_header_stdint_h=yes,
14810 +    gl_cv_header_stdint_h=no)])
14811 +  if test $gl_cv_header_stdint_h = yes; then
14812 +    AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
14813 +      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
14814 +       and declares uintmax_t. ])
14815 +  fi
14816 +])
14817 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/stdint.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint.m4
14818 --- gtk-vnc-0.3.7.dan3/gnulib/m4/stdint.m4      1970-01-01 01:00:00.000000000 +0100
14819 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint.m4    2008-10-09 15:24:53.000000000 +0100
14820 @@ -0,0 +1,395 @@
14821 +# stdint.m4 serial 31
14822 +dnl Copyright (C) 2001-2008 Free Software Foundation, Inc.
14823 +dnl This file is free software; the Free Software Foundation
14824 +dnl gives unlimited permission to copy and/or distribute it,
14825 +dnl with or without modifications, as long as this notice is preserved.
14826 +
14827 +dnl From Paul Eggert and Bruno Haible.
14828 +dnl Test whether <stdint.h> is supported or must be substituted.
14829 +
14830 +AC_DEFUN([gl_STDINT_H],
14831 +[
14832 +  AC_PREREQ(2.59)dnl
14833 +
14834 +  dnl Check for long long int and unsigned long long int.
14835 +  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
14836 +  if test $ac_cv_type_long_long_int = yes; then
14837 +    HAVE_LONG_LONG_INT=1
14838 +  else
14839 +    HAVE_LONG_LONG_INT=0
14840 +  fi
14841 +  AC_SUBST([HAVE_LONG_LONG_INT])
14842 +  AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
14843 +  if test $ac_cv_type_unsigned_long_long_int = yes; then
14844 +    HAVE_UNSIGNED_LONG_LONG_INT=1
14845 +  else
14846 +    HAVE_UNSIGNED_LONG_LONG_INT=0
14847 +  fi
14848 +  AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
14849 +
14850 +  dnl Check for <inttypes.h>.
14851 +  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
14852 +  if test $ac_cv_header_inttypes_h = yes; then
14853 +    HAVE_INTTYPES_H=1
14854 +  else
14855 +    HAVE_INTTYPES_H=0
14856 +  fi
14857 +  AC_SUBST([HAVE_INTTYPES_H])
14858 +
14859 +  dnl Check for <sys/types.h>.
14860 +  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
14861 +  if test $ac_cv_header_sys_types_h = yes; then
14862 +    HAVE_SYS_TYPES_H=1
14863 +  else
14864 +    HAVE_SYS_TYPES_H=0
14865 +  fi
14866 +  AC_SUBST([HAVE_SYS_TYPES_H])
14867 +
14868 +  gl_CHECK_NEXT_HEADERS([stdint.h])
14869 +  if test $ac_cv_header_stdint_h = yes; then
14870 +    HAVE_STDINT_H=1
14871 +  else
14872 +    HAVE_STDINT_H=0
14873 +  fi
14874 +  AC_SUBST([HAVE_STDINT_H])
14875 +
14876 +  dnl Now see whether we need a substitute <stdint.h>.
14877 +  if test $ac_cv_header_stdint_h = yes; then
14878 +    AC_CACHE_CHECK([whether stdint.h conforms to C99],
14879 +      [gl_cv_header_working_stdint_h],
14880 +      [gl_cv_header_working_stdint_h=no
14881 +       AC_COMPILE_IFELSE([
14882 +         AC_LANG_PROGRAM([[
14883 +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
14884 +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
14885 +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
14886 +#include <stdint.h>
14887 +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>.  */
14888 +#if !(defined WCHAR_MIN && defined WCHAR_MAX)
14889 +#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
14890 +#endif
14891 +]
14892 +gl_STDINT_INCLUDES
14893 +[
14894 +#ifdef INT8_MAX
14895 +int8_t a1 = INT8_MAX;
14896 +int8_t a1min = INT8_MIN;
14897 +#endif
14898 +#ifdef INT16_MAX
14899 +int16_t a2 = INT16_MAX;
14900 +int16_t a2min = INT16_MIN;
14901 +#endif
14902 +#ifdef INT32_MAX
14903 +int32_t a3 = INT32_MAX;
14904 +int32_t a3min = INT32_MIN;
14905 +#endif
14906 +#ifdef INT64_MAX
14907 +int64_t a4 = INT64_MAX;
14908 +int64_t a4min = INT64_MIN;
14909 +#endif
14910 +#ifdef UINT8_MAX
14911 +uint8_t b1 = UINT8_MAX;
14912 +#else
14913 +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
14914 +#endif
14915 +#ifdef UINT16_MAX
14916 +uint16_t b2 = UINT16_MAX;
14917 +#endif
14918 +#ifdef UINT32_MAX
14919 +uint32_t b3 = UINT32_MAX;
14920 +#endif
14921 +#ifdef UINT64_MAX
14922 +uint64_t b4 = UINT64_MAX;
14923 +#endif
14924 +int_least8_t c1 = INT8_C (0x7f);
14925 +int_least8_t c1max = INT_LEAST8_MAX;
14926 +int_least8_t c1min = INT_LEAST8_MIN;
14927 +int_least16_t c2 = INT16_C (0x7fff);
14928 +int_least16_t c2max = INT_LEAST16_MAX;
14929 +int_least16_t c2min = INT_LEAST16_MIN;
14930 +int_least32_t c3 = INT32_C (0x7fffffff);
14931 +int_least32_t c3max = INT_LEAST32_MAX;
14932 +int_least32_t c3min = INT_LEAST32_MIN;
14933 +int_least64_t c4 = INT64_C (0x7fffffffffffffff);
14934 +int_least64_t c4max = INT_LEAST64_MAX;
14935 +int_least64_t c4min = INT_LEAST64_MIN;
14936 +uint_least8_t d1 = UINT8_C (0xff);
14937 +uint_least8_t d1max = UINT_LEAST8_MAX;
14938 +uint_least16_t d2 = UINT16_C (0xffff);
14939 +uint_least16_t d2max = UINT_LEAST16_MAX;
14940 +uint_least32_t d3 = UINT32_C (0xffffffff);
14941 +uint_least32_t d3max = UINT_LEAST32_MAX;
14942 +uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
14943 +uint_least64_t d4max = UINT_LEAST64_MAX;
14944 +int_fast8_t e1 = INT_FAST8_MAX;
14945 +int_fast8_t e1min = INT_FAST8_MIN;
14946 +int_fast16_t e2 = INT_FAST16_MAX;
14947 +int_fast16_t e2min = INT_FAST16_MIN;
14948 +int_fast32_t e3 = INT_FAST32_MAX;
14949 +int_fast32_t e3min = INT_FAST32_MIN;
14950 +int_fast64_t e4 = INT_FAST64_MAX;
14951 +int_fast64_t e4min = INT_FAST64_MIN;
14952 +uint_fast8_t f1 = UINT_FAST8_MAX;
14953 +uint_fast16_t f2 = UINT_FAST16_MAX;
14954 +uint_fast32_t f3 = UINT_FAST32_MAX;
14955 +uint_fast64_t f4 = UINT_FAST64_MAX;
14956 +#ifdef INTPTR_MAX
14957 +intptr_t g = INTPTR_MAX;
14958 +intptr_t gmin = INTPTR_MIN;
14959 +#endif
14960 +#ifdef UINTPTR_MAX
14961 +uintptr_t h = UINTPTR_MAX;
14962 +#endif
14963 +intmax_t i = INTMAX_MAX;
14964 +uintmax_t j = UINTMAX_MAX;
14965 +
14966 +#include <limits.h> /* for CHAR_BIT */
14967 +#define TYPE_MINIMUM(t) \
14968 +  ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
14969 +#define TYPE_MAXIMUM(t) \
14970 +  ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
14971 +struct s {
14972 +  int check_PTRDIFF:
14973 +      PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
14974 +      && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
14975 +      ? 1 : -1;
14976 +  /* Detect bug in FreeBSD 6.0 / ia64.  */
14977 +  int check_SIG_ATOMIC:
14978 +      SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
14979 +      && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
14980 +      ? 1 : -1;
14981 +  int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
14982 +  int check_WCHAR:
14983 +      WCHAR_MIN == TYPE_MINIMUM (wchar_t)
14984 +      && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
14985 +      ? 1 : -1;
14986 +  /* Detect bug in mingw.  */
14987 +  int check_WINT:
14988 +      WINT_MIN == TYPE_MINIMUM (wint_t)
14989 +      && WINT_MAX == TYPE_MAXIMUM (wint_t)
14990 +      ? 1 : -1;
14991 +
14992 +  /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others.  */
14993 +  int check_UINT8_C:
14994 +        (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
14995 +  int check_UINT16_C:
14996 +        (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
14997 +
14998 +  /* Detect bugs in OpenBSD 3.9 stdint.h.  */
14999 +#ifdef UINT8_MAX
15000 +  int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
15001 +#endif
15002 +#ifdef UINT16_MAX
15003 +  int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
15004 +#endif
15005 +#ifdef UINT32_MAX
15006 +  int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
15007 +#endif
15008 +#ifdef UINT64_MAX
15009 +  int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
15010 +#endif
15011 +  int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
15012 +  int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
15013 +  int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
15014 +  int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
15015 +  int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
15016 +  int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
15017 +  int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
15018 +  int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
15019 +  int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
15020 +  int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
15021 +  int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
15022 +};
15023 +         ]])],
15024 +         [gl_cv_header_working_stdint_h=yes])])
15025 +  fi
15026 +  if test "$gl_cv_header_working_stdint_h" = yes; then
15027 +    STDINT_H=
15028 +  else
15029 +    dnl Check for <sys/inttypes.h>, and for
15030 +    dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
15031 +    AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
15032 +    if test $ac_cv_header_sys_inttypes_h = yes; then
15033 +      HAVE_SYS_INTTYPES_H=1
15034 +    else
15035 +      HAVE_SYS_INTTYPES_H=0
15036 +    fi
15037 +    AC_SUBST([HAVE_SYS_INTTYPES_H])
15038 +    if test $ac_cv_header_sys_bitypes_h = yes; then
15039 +      HAVE_SYS_BITYPES_H=1
15040 +    else
15041 +      HAVE_SYS_BITYPES_H=0
15042 +    fi
15043 +    AC_SUBST([HAVE_SYS_BITYPES_H])
15044 +
15045 +    dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
15046 +    dnl character support).
15047 +    AC_CHECK_HEADERS_ONCE([wchar.h])
15048 +
15049 +    gl_STDINT_TYPE_PROPERTIES
15050 +    STDINT_H=stdint.h
15051 +  fi
15052 +  AC_SUBST(STDINT_H)
15053 +])
15054 +
15055 +dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
15056 +dnl Determine the size of each of the given types in bits.
15057 +AC_DEFUN([gl_STDINT_BITSIZEOF],
15058 +[
15059 +  dnl Use a shell loop, to avoid bloating configure, and
15060 +  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
15061 +  dnl   config.h.in,
15062 +  dnl - extra AC_SUBST calls, so that the right substitutions are made.
15063 +  m4_foreach_w([gltype], [$1],
15064 +    [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
15065 +       [Define to the number of bits in type ']gltype['.])])
15066 +  for gltype in $1 ; do
15067 +    AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
15068 +      [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
15069 +         [$2
15070 +#include <limits.h>], [result=unknown])
15071 +       eval gl_cv_bitsizeof_${gltype}=\$result
15072 +      ])
15073 +    eval result=\$gl_cv_bitsizeof_${gltype}
15074 +    if test $result = unknown; then
15075 +      dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
15076 +      dnl do a syntax check even on unused #if conditions and give an error
15077 +      dnl on valid C code like this:
15078 +      dnl   #if 0
15079 +      dnl   # if  > 32
15080 +      dnl   # endif
15081 +      dnl   #endif
15082 +      result=0
15083 +    fi
15084 +    GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
15085 +    AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
15086 +    eval BITSIZEOF_${GLTYPE}=\$result
15087 +  done
15088 +  m4_foreach_w([gltype], [$1],
15089 +    [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
15090 +])
15091 +
15092 +dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
15093 +dnl Determine the signedness of each of the given types.
15094 +dnl Define HAVE_SIGNED_TYPE if type is signed.
15095 +AC_DEFUN([gl_CHECK_TYPES_SIGNED],
15096 +[
15097 +  dnl Use a shell loop, to avoid bloating configure, and
15098 +  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
15099 +  dnl   config.h.in,
15100 +  dnl - extra AC_SUBST calls, so that the right substitutions are made.
15101 +  m4_foreach_w([gltype], [$1],
15102 +    [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
15103 +       [Define to 1 if ']gltype[' is a signed integer type.])])
15104 +  for gltype in $1 ; do
15105 +    AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
15106 +      [AC_COMPILE_IFELSE(
15107 +         [AC_LANG_PROGRAM([$2[
15108 +            int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
15109 +         result=yes, result=no)
15110 +       eval gl_cv_type_${gltype}_signed=\$result
15111 +      ])
15112 +    eval result=\$gl_cv_type_${gltype}_signed
15113 +    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
15114 +    if test "$result" = yes; then
15115 +      AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], 1)
15116 +      eval HAVE_SIGNED_${GLTYPE}=1
15117 +    else
15118 +      eval HAVE_SIGNED_${GLTYPE}=0
15119 +    fi
15120 +  done
15121 +  m4_foreach_w([gltype], [$1],
15122 +    [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
15123 +])
15124 +
15125 +dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
15126 +dnl Determine the suffix to use for integer constants of the given types.
15127 +dnl Define t_SUFFIX for each such type.
15128 +AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
15129 +[
15130 +  dnl Use a shell loop, to avoid bloating configure, and
15131 +  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
15132 +  dnl   config.h.in,
15133 +  dnl - extra AC_SUBST calls, so that the right substitutions are made.
15134 +  m4_foreach_w([gltype], [$1],
15135 +    [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
15136 +       [Define to l, ll, u, ul, ull, etc., as suitable for
15137 +        constants of type ']gltype['.])])
15138 +  for gltype in $1 ; do
15139 +    AC_CACHE_CHECK([for $gltype integer literal suffix],
15140 +      [gl_cv_type_${gltype}_suffix],
15141 +      [eval gl_cv_type_${gltype}_suffix=no
15142 +       eval result=\$gl_cv_type_${gltype}_signed
15143 +       if test "$result" = yes; then
15144 +         glsufu=
15145 +       else
15146 +         glsufu=u
15147 +       fi
15148 +       for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
15149 +         case $glsuf in
15150 +           '')  gltype1='int';;
15151 +           l)  gltype1='long int';;
15152 +           ll) gltype1='long long int';;
15153 +           i64)        gltype1='__int64';;
15154 +           u)  gltype1='unsigned int';;
15155 +           ul) gltype1='unsigned long int';;
15156 +           ull)        gltype1='unsigned long long int';;
15157 +           ui64)gltype1='unsigned __int64';;
15158 +         esac
15159 +         AC_COMPILE_IFELSE(
15160 +           [AC_LANG_PROGRAM([$2[
15161 +              extern $gltype foo;
15162 +              extern $gltype1 foo;]])],
15163 +           [eval gl_cv_type_${gltype}_suffix=\$glsuf])
15164 +         eval result=\$gl_cv_type_${gltype}_suffix
15165 +         test "$result" != no && break
15166 +       done])
15167 +    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
15168 +    eval result=\$gl_cv_type_${gltype}_suffix
15169 +    test "$result" = no && result=
15170 +    eval ${GLTYPE}_SUFFIX=\$result
15171 +    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
15172 +  done
15173 +  m4_foreach_w([gltype], [$1],
15174 +    [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
15175 +])
15176 +
15177 +dnl gl_STDINT_INCLUDES
15178 +AC_DEFUN([gl_STDINT_INCLUDES],
15179 +[[
15180 +  /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
15181 +     included before <wchar.h>.  */
15182 +  #include <stddef.h>
15183 +  #include <signal.h>
15184 +  #if HAVE_WCHAR_H
15185 +  # include <stdio.h>
15186 +  # include <time.h>
15187 +  # include <wchar.h>
15188 +  #endif
15189 +]])
15190 +
15191 +dnl gl_STDINT_TYPE_PROPERTIES
15192 +dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
15193 +dnl of interest to stdint.in.h.
15194 +AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
15195 +[
15196 +  gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
15197 +    [gl_STDINT_INCLUDES])
15198 +  gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
15199 +    [gl_STDINT_INCLUDES])
15200 +  gl_cv_type_ptrdiff_t_signed=yes
15201 +  gl_cv_type_size_t_signed=no
15202 +  gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
15203 +    [gl_STDINT_INCLUDES])
15204 +])
15205 +
15206 +dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
15207 +dnl Remove this when we can assume autoconf >= 2.61.
15208 +m4_ifdef([AC_COMPUTE_INT], [], [
15209 +  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
15210 +])
15211 +
15212 +# Hey Emacs!
15213 +# Local Variables:
15214 +# indent-tabs-mode: nil
15215 +# End:
15216 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/stdio_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdio_h.m4
15217 --- gtk-vnc-0.3.7.dan3/gnulib/m4/stdio_h.m4     1970-01-01 01:00:00.000000000 +0100
15218 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdio_h.m4   2008-10-09 15:24:53.000000000 +0100
15219 @@ -0,0 +1,125 @@
15220 +# stdio_h.m4 serial 13
15221 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
15222 +dnl This file is free software; the Free Software Foundation
15223 +dnl gives unlimited permission to copy and/or distribute it,
15224 +dnl with or without modifications, as long as this notice is preserved.
15225 +
15226 +AC_DEFUN([gl_STDIO_H],
15227 +[
15228 +  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
15229 +  gl_CHECK_NEXT_HEADERS([stdio.h])
15230 +  dnl No need to create extra modules for these functions. Everyone who uses
15231 +  dnl <stdio.h> likely needs them.
15232 +  GNULIB_FPRINTF=1
15233 +  GNULIB_PRINTF=1
15234 +  GNULIB_VFPRINTF=1
15235 +  GNULIB_VPRINTF=1
15236 +  GNULIB_FPUTC=1
15237 +  GNULIB_PUTC=1
15238 +  GNULIB_PUTCHAR=1
15239 +  GNULIB_FPUTS=1
15240 +  GNULIB_PUTS=1
15241 +  GNULIB_FWRITE=1
15242 +  dnl This ifdef is just an optimization, to avoid performing a configure
15243 +  dnl check whose result is not used. It does not make the test of
15244 +  dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant.
15245 +  m4_ifdef([gl_SIGNAL_SIGPIPE], [
15246 +    gl_SIGNAL_SIGPIPE
15247 +    if test $gl_cv_header_signal_h_SIGPIPE != yes; then
15248 +      REPLACE_STDIO_WRITE_FUNCS=1
15249 +      AC_LIBOBJ([stdio-write])
15250 +    fi
15251 +  ])
15252 +])
15253 +
15254 +AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
15255 +[
15256 +  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
15257 +  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
15258 +  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
15259 +])
15260 +
15261 +AC_DEFUN([gl_STDIO_H_DEFAULTS],
15262 +[
15263 +  GNULIB_FPRINTF=0;              AC_SUBST([GNULIB_FPRINTF])
15264 +  GNULIB_FPRINTF_POSIX=0;        AC_SUBST([GNULIB_FPRINTF_POSIX])
15265 +  GNULIB_PRINTF=0;               AC_SUBST([GNULIB_PRINTF])
15266 +  GNULIB_PRINTF_POSIX=0;         AC_SUBST([GNULIB_PRINTF_POSIX])
15267 +  GNULIB_SNPRINTF=0;             AC_SUBST([GNULIB_SNPRINTF])
15268 +  GNULIB_SPRINTF_POSIX=0;        AC_SUBST([GNULIB_SPRINTF_POSIX])
15269 +  GNULIB_VFPRINTF=0;             AC_SUBST([GNULIB_VFPRINTF])
15270 +  GNULIB_VFPRINTF_POSIX=0;       AC_SUBST([GNULIB_VFPRINTF_POSIX])
15271 +  GNULIB_VPRINTF=0;              AC_SUBST([GNULIB_VPRINTF])
15272 +  GNULIB_VPRINTF_POSIX=0;        AC_SUBST([GNULIB_VPRINTF_POSIX])
15273 +  GNULIB_VSNPRINTF=0;            AC_SUBST([GNULIB_VSNPRINTF])
15274 +  GNULIB_VSPRINTF_POSIX=0;       AC_SUBST([GNULIB_VSPRINTF_POSIX])
15275 +  GNULIB_VASPRINTF=0;            AC_SUBST([GNULIB_VASPRINTF])
15276 +  GNULIB_OBSTACK_PRINTF=0;       AC_SUBST([GNULIB_OBSTACK_PRINTF])
15277 +  GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
15278 +  GNULIB_FOPEN=0;                AC_SUBST([GNULIB_FOPEN])
15279 +  GNULIB_FREOPEN=0;              AC_SUBST([GNULIB_FREOPEN])
15280 +  GNULIB_FSEEK=0;                AC_SUBST([GNULIB_FSEEK])
15281 +  GNULIB_FSEEKO=0;               AC_SUBST([GNULIB_FSEEKO])
15282 +  GNULIB_FTELL=0;                AC_SUBST([GNULIB_FTELL])
15283 +  GNULIB_FTELLO=0;               AC_SUBST([GNULIB_FTELLO])
15284 +  GNULIB_FFLUSH=0;               AC_SUBST([GNULIB_FFLUSH])
15285 +  GNULIB_FPUTC=0;                AC_SUBST([GNULIB_FPUTC])
15286 +  GNULIB_PUTC=0;                 AC_SUBST([GNULIB_PUTC])
15287 +  GNULIB_PUTCHAR=0;              AC_SUBST([GNULIB_PUTCHAR])
15288 +  GNULIB_FPUTS=0;                AC_SUBST([GNULIB_FPUTS])
15289 +  GNULIB_PUTS=0;                 AC_SUBST([GNULIB_PUTS])
15290 +  GNULIB_FWRITE=0;               AC_SUBST([GNULIB_FWRITE])
15291 +  GNULIB_GETDELIM=0;             AC_SUBST([GNULIB_GETDELIM])
15292 +  GNULIB_GETLINE=0;              AC_SUBST([GNULIB_GETLINE])
15293 +  GNULIB_PERROR=0;               AC_SUBST([GNULIB_PERROR])
15294 +  GNULIB_STDIO_H_SIGPIPE=0;      AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
15295 +  dnl Assume proper GNU behavior unless another module says otherwise.
15296 +  REPLACE_STDIO_WRITE_FUNCS=0;   AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
15297 +  REPLACE_FPRINTF=0;             AC_SUBST([REPLACE_FPRINTF])
15298 +  REPLACE_VFPRINTF=0;            AC_SUBST([REPLACE_VFPRINTF])
15299 +  REPLACE_PRINTF=0;              AC_SUBST([REPLACE_PRINTF])
15300 +  REPLACE_VPRINTF=0;             AC_SUBST([REPLACE_VPRINTF])
15301 +  REPLACE_SNPRINTF=0;            AC_SUBST([REPLACE_SNPRINTF])
15302 +  HAVE_DECL_SNPRINTF=1;          AC_SUBST([HAVE_DECL_SNPRINTF])
15303 +  REPLACE_VSNPRINTF=0;           AC_SUBST([REPLACE_VSNPRINTF])
15304 +  HAVE_DECL_VSNPRINTF=1;         AC_SUBST([HAVE_DECL_VSNPRINTF])
15305 +  REPLACE_SPRINTF=0;             AC_SUBST([REPLACE_SPRINTF])
15306 +  REPLACE_VSPRINTF=0;            AC_SUBST([REPLACE_VSPRINTF])
15307 +  HAVE_VASPRINTF=1;              AC_SUBST([HAVE_VASPRINTF])
15308 +  REPLACE_VASPRINTF=0;           AC_SUBST([REPLACE_VASPRINTF])
15309 +  HAVE_DECL_OBSTACK_PRINTF=1;    AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
15310 +  REPLACE_OBSTACK_PRINTF=0;      AC_SUBST([REPLACE_OBSTACK_PRINTF])
15311 +  REPLACE_FOPEN=0;               AC_SUBST([REPLACE_FOPEN])
15312 +  REPLACE_FREOPEN=0;             AC_SUBST([REPLACE_FREOPEN])
15313 +  HAVE_FSEEKO=1;                 AC_SUBST([HAVE_FSEEKO])
15314 +  REPLACE_FSEEKO=0;              AC_SUBST([REPLACE_FSEEKO])
15315 +  REPLACE_FSEEK=0;               AC_SUBST([REPLACE_FSEEK])
15316 +  HAVE_FTELLO=1;                 AC_SUBST([HAVE_FTELLO])
15317 +  REPLACE_FTELLO=0;              AC_SUBST([REPLACE_FTELLO])
15318 +  REPLACE_FTELL=0;               AC_SUBST([REPLACE_FTELL])
15319 +  REPLACE_FFLUSH=0;              AC_SUBST([REPLACE_FFLUSH])
15320 +  HAVE_DECL_GETDELIM=1;          AC_SUBST([HAVE_DECL_GETDELIM])
15321 +  HAVE_DECL_GETLINE=1;           AC_SUBST([HAVE_DECL_GETLINE])
15322 +  REPLACE_GETLINE=0;             AC_SUBST([REPLACE_GETLINE])
15323 +  REPLACE_PERROR=0;              AC_SUBST([REPLACE_PERROR])
15324 +])
15325 +
15326 +dnl Code shared by fseeko and ftello.  Determine if large files are supported,
15327 +dnl but stdin does not start as a large file by default.
15328 +AC_DEFUN([gl_STDIN_LARGE_OFFSET],
15329 +  [
15330 +    AC_CACHE_CHECK([whether stdin defaults to large file offsets],
15331 +      [gl_cv_var_stdin_large_offset],
15332 +      [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
15333 +[[#if defined __SL64 && defined __SCLE /* cygwin */
15334 +  /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
15335 +     fseeko/ftello needlessly fail.  This bug was fixed in 1.5.25, and
15336 +     it is easier to do a version check than building a runtime test.  */
15337 +# include <cygwin/version.h>
15338 +# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
15339 +  choke me
15340 +# endif
15341 +#endif]])],
15342 +       [gl_cv_var_stdin_large_offset=yes],
15343 +       [gl_cv_var_stdin_large_offset=no])])
15344 +])
15345 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/stdlib_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdlib_h.m4
15346 --- gtk-vnc-0.3.7.dan3/gnulib/m4/stdlib_h.m4    1970-01-01 01:00:00.000000000 +0100
15347 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdlib_h.m4  2008-10-09 15:24:53.000000000 +0100
15348 @@ -0,0 +1,47 @@
15349 +# stdlib_h.m4 serial 7
15350 +dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc.
15351 +dnl This file is free software; the Free Software Foundation
15352 +dnl gives unlimited permission to copy and/or distribute it,
15353 +dnl with or without modifications, as long as this notice is preserved.
15354 +
15355 +AC_DEFUN([gl_STDLIB_H],
15356 +[
15357 +  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
15358 +  gl_CHECK_NEXT_HEADERS([stdlib.h])
15359 +])
15360 +
15361 +AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
15362 +[
15363 +  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
15364 +  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
15365 +  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
15366 +])
15367 +
15368 +AC_DEFUN([gl_STDLIB_H_DEFAULTS],
15369 +[
15370 +  GNULIB_MALLOC_POSIX=0;  AC_SUBST([GNULIB_MALLOC_POSIX])
15371 +  GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
15372 +  GNULIB_CALLOC_POSIX=0;  AC_SUBST([GNULIB_CALLOC_POSIX])
15373 +  GNULIB_GETSUBOPT=0;     AC_SUBST([GNULIB_GETSUBOPT])
15374 +  GNULIB_MKDTEMP=0;       AC_SUBST([GNULIB_MKDTEMP])
15375 +  GNULIB_MKSTEMP=0;       AC_SUBST([GNULIB_MKSTEMP])
15376 +  GNULIB_PUTENV=0;        AC_SUBST([GNULIB_PUTENV])
15377 +  GNULIB_RPMATCH=0;       AC_SUBST([GNULIB_RPMATCH])
15378 +  GNULIB_SETENV=0;        AC_SUBST([GNULIB_SETENV])
15379 +  GNULIB_STRTOD=0;        AC_SUBST([GNULIB_STRTOD])
15380 +  GNULIB_UNSETENV=0;      AC_SUBST([GNULIB_UNSETENV])
15381 +  dnl Assume proper GNU behavior unless another module says otherwise.
15382 +  HAVE_CALLOC_POSIX=1;    AC_SUBST([HAVE_CALLOC_POSIX])
15383 +  HAVE_GETSUBOPT=1;       AC_SUBST([HAVE_GETSUBOPT])
15384 +  HAVE_MALLOC_POSIX=1;    AC_SUBST([HAVE_MALLOC_POSIX])
15385 +  HAVE_MKDTEMP=1;         AC_SUBST([HAVE_MKDTEMP])
15386 +  HAVE_REALLOC_POSIX=1;   AC_SUBST([HAVE_REALLOC_POSIX])
15387 +  HAVE_RPMATCH=1;         AC_SUBST([HAVE_RPMATCH])
15388 +  HAVE_SETENV=1;          AC_SUBST([HAVE_SETENV])
15389 +  HAVE_STRTOD=1;          AC_SUBST([HAVE_STRTOD])
15390 +  HAVE_UNSETENV=1;        AC_SUBST([HAVE_UNSETENV])
15391 +  REPLACE_MKSTEMP=0;      AC_SUBST([REPLACE_MKSTEMP])
15392 +  REPLACE_PUTENV=0;       AC_SUBST([REPLACE_PUTENV])
15393 +  REPLACE_STRTOD=0;       AC_SUBST([REPLACE_STRTOD])
15394 +  VOID_UNSETENV=0;        AC_SUBST([VOID_UNSETENV])
15395 +])
15396 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/sys_socket_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/sys_socket_h.m4
15397 --- gtk-vnc-0.3.7.dan3/gnulib/m4/sys_socket_h.m4        1970-01-01 01:00:00.000000000 +0100
15398 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/sys_socket_h.m4      2008-10-09 15:24:53.000000000 +0100
15399 @@ -0,0 +1,113 @@
15400 +# sys_socket_h.m4 serial 8
15401 +dnl Copyright (C) 2005-2008 Free Software Foundation, Inc.
15402 +dnl This file is free software; the Free Software Foundation
15403 +dnl gives unlimited permission to copy and/or distribute it,
15404 +dnl with or without modifications, as long as this notice is preserved.
15405 +
15406 +dnl From Simon Josefsson.
15407 +
15408 +AC_DEFUN([gl_HEADER_SYS_SOCKET],
15409 +[
15410 +  AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
15411 +  AC_REQUIRE([AC_C_INLINE])
15412 +
15413 +  AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
15414 +    [gl_cv_header_sys_socket_h_selfcontained],
15415 +    [
15416 +      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[]])],
15417 +        [gl_cv_header_sys_socket_h_selfcontained=yes],
15418 +        [gl_cv_header_sys_socket_h_selfcontained=no])
15419 +    ])
15420 +  if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
15421 +    SYS_SOCKET_H=''
15422 +    dnl If the shutdown function exists, <sys/socket.h> should define
15423 +    dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
15424 +    AC_CHECK_FUNCS([shutdown])
15425 +    if test $ac_cv_func_shutdown = yes; then
15426 +      AC_CACHE_CHECK([whether <sys/socket.h> defines the SHUT_* macros],
15427 +        [gl_cv_header_sys_socket_h_shut],
15428 +        [
15429 +          AC_COMPILE_IFELSE(
15430 +            [AC_LANG_PROGRAM([[#include <sys/socket.h>]],
15431 +               [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])],
15432 +            [gl_cv_header_sys_socket_h_shut=yes],
15433 +            [gl_cv_header_sys_socket_h_shut=no])
15434 +        ])
15435 +      if test $gl_cv_header_sys_socket_h_shut = no; then
15436 +        SYS_SOCKET_H='sys/socket.h'
15437 +      fi
15438 +    fi
15439 +  else
15440 +    SYS_SOCKET_H='sys/socket.h'
15441 +  fi
15442 +  if test -n "$SYS_SOCKET_H"; then
15443 +    dnl Check prerequisites of the <sys/socket.h> replacement.
15444 +    gl_CHECK_NEXT_HEADERS([sys/socket.h])
15445 +    if test $ac_cv_header_sys_socket_h = yes; then
15446 +      HAVE_SYS_SOCKET_H=1
15447 +      HAVE_WS2TCPIP_H=0
15448 +    else
15449 +      HAVE_SYS_SOCKET_H=0
15450 +      dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
15451 +      dnl the check for those headers unconditional; yet cygwin reports
15452 +      dnl that the headers are present but cannot be compiled (since on
15453 +      dnl cygwin, all socket information should come from sys/socket.h).
15454 +      AC_CHECK_HEADERS([ws2tcpip.h])
15455 +      if test $ac_cv_header_ws2tcpip_h = yes; then
15456 +        HAVE_WS2TCPIP_H=1
15457 +      else
15458 +        HAVE_WS2TCPIP_H=0
15459 +      fi
15460 +    fi
15461 +    gl_PREREQ_SYS_H_WINSOCK2
15462 +    AC_SUBST([HAVE_SYS_SOCKET_H])
15463 +    AC_SUBST([HAVE_WS2TCPIP_H])
15464 +  fi
15465 +  AC_SUBST([SYS_SOCKET_H])
15466 +])
15467 +
15468 +# Common prerequisites of of the <sys/socket.h> replacement and of the
15469 +# <sys/select.h> replacement.
15470 +# Sets and substitutes HAVE_WINSOCK2_H.
15471 +AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
15472 +[
15473 +  AC_CHECK_HEADERS_ONCE([sys/socket.h])
15474 +  if test $ac_cv_header_sys_socket_h != yes; then
15475 +    dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
15476 +    dnl the check for those headers unconditional; yet cygwin reports
15477 +    dnl that the headers are present but cannot be compiled (since on
15478 +    dnl cygwin, all socket information should come from sys/socket.h).
15479 +    AC_CHECK_HEADERS([winsock2.h])
15480 +  fi
15481 +  if test "$ac_cv_header_winsock2_h" = yes; then
15482 +    HAVE_WINSOCK2_H=1
15483 +  else
15484 +    HAVE_WINSOCK2_H=0
15485 +  fi
15486 +  AC_SUBST([HAVE_WINSOCK2_H])
15487 +])
15488 +
15489 +AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
15490 +[
15491 +  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
15492 +  AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
15493 +  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
15494 +  gl_MODULE_INDICATOR([$1])
15495 +])
15496 +
15497 +AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
15498 +[
15499 +  GNULIB_SOCKET=0;      AC_SUBST([GNULIB_SOCKET])
15500 +  GNULIB_CONNECT=0;     AC_SUBST([GNULIB_CONNECT])
15501 +  GNULIB_ACCEPT=0;      AC_SUBST([GNULIB_ACCEPT])
15502 +  GNULIB_BIND=0;        AC_SUBST([GNULIB_BIND])
15503 +  GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME])
15504 +  GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME])
15505 +  GNULIB_GETSOCKOPT=0;  AC_SUBST([GNULIB_GETSOCKOPT])
15506 +  GNULIB_LISTEN=0;      AC_SUBST([GNULIB_LISTEN])
15507 +  GNULIB_RECV=0;        AC_SUBST([GNULIB_RECV])
15508 +  GNULIB_SEND=0;        AC_SUBST([GNULIB_SEND])
15509 +  GNULIB_RECVFROM=0;    AC_SUBST([GNULIB_RECVFROM])
15510 +  GNULIB_SENDTO=0;      AC_SUBST([GNULIB_SENDTO])
15511 +  GNULIB_SETSOCKOPT=0;  AC_SUBST([GNULIB_SETSOCKOPT])
15512 +])
15513 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/unistd_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/unistd_h.m4
15514 --- gtk-vnc-0.3.7.dan3/gnulib/m4/unistd_h.m4    1970-01-01 01:00:00.000000000 +0100
15515 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/unistd_h.m4  2008-10-09 15:24:53.000000000 +0100
15516 @@ -0,0 +1,70 @@
15517 +# unistd_h.m4 serial 13
15518 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
15519 +dnl This file is free software; the Free Software Foundation
15520 +dnl gives unlimited permission to copy and/or distribute it,
15521 +dnl with or without modifications, as long as this notice is preserved.
15522 +
15523 +dnl Written by Simon Josefsson, Bruno Haible.
15524 +
15525 +AC_DEFUN([gl_UNISTD_H],
15526 +[
15527 +  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
15528 +  dnl once only, before all statements that occur in other macros.
15529 +  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
15530 +
15531 +  gl_CHECK_NEXT_HEADERS([unistd.h])
15532 +
15533 +  AC_CHECK_HEADERS_ONCE([unistd.h])
15534 +  if test $ac_cv_header_unistd_h = yes; then
15535 +    HAVE_UNISTD_H=1
15536 +  else
15537 +    HAVE_UNISTD_H=0
15538 +  fi
15539 +  AC_SUBST([HAVE_UNISTD_H])
15540 +])
15541 +
15542 +AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
15543 +[
15544 +  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
15545 +  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
15546 +  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
15547 +])
15548 +
15549 +AC_DEFUN([gl_UNISTD_H_DEFAULTS],
15550 +[
15551 +  GNULIB_CHOWN=0;            AC_SUBST([GNULIB_CHOWN])
15552 +  GNULIB_DUP2=0;             AC_SUBST([GNULIB_DUP2])
15553 +  GNULIB_ENVIRON=0;          AC_SUBST([GNULIB_ENVIRON])
15554 +  GNULIB_FCHDIR=0;           AC_SUBST([GNULIB_FCHDIR])
15555 +  GNULIB_FSYNC=0;            AC_SUBST([GNULIB_FSYNC])
15556 +  GNULIB_FTRUNCATE=0;        AC_SUBST([GNULIB_FTRUNCATE])
15557 +  GNULIB_GETCWD=0;           AC_SUBST([GNULIB_GETCWD])
15558 +  GNULIB_GETDTABLESIZE=0;    AC_SUBST([GNULIB_GETDTABLESIZE])
15559 +  GNULIB_GETLOGIN_R=0;       AC_SUBST([GNULIB_GETLOGIN_R])
15560 +  GNULIB_GETPAGESIZE=0;      AC_SUBST([GNULIB_GETPAGESIZE])
15561 +  GNULIB_LCHOWN=0;           AC_SUBST([GNULIB_LCHOWN])
15562 +  GNULIB_LSEEK=0;            AC_SUBST([GNULIB_LSEEK])
15563 +  GNULIB_READLINK=0;         AC_SUBST([GNULIB_READLINK])
15564 +  GNULIB_SLEEP=0;            AC_SUBST([GNULIB_SLEEP])
15565 +  GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
15566 +  GNULIB_WRITE=0;            AC_SUBST([GNULIB_WRITE])
15567 +  dnl Assume proper GNU behavior unless another module says otherwise.
15568 +  HAVE_DUP2=1;            AC_SUBST([HAVE_DUP2])
15569 +  HAVE_FSYNC=1;           AC_SUBST([HAVE_FSYNC])
15570 +  HAVE_FTRUNCATE=1;       AC_SUBST([HAVE_FTRUNCATE])
15571 +  HAVE_GETDTABLESIZE=1;   AC_SUBST([HAVE_GETDTABLESIZE])
15572 +  HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
15573 +  HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
15574 +  HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
15575 +  HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
15576 +  HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
15577 +  HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
15578 +  HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
15579 +  REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
15580 +  REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
15581 +  REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
15582 +  REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
15583 +  REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
15584 +  REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
15585 +  REPLACE_WRITE=0;        AC_SUBST([REPLACE_WRITE])
15586 +])
15587 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/vasnprintf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/vasnprintf.m4
15588 --- gtk-vnc-0.3.7.dan3/gnulib/m4/vasnprintf.m4  1970-01-01 01:00:00.000000000 +0100
15589 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/vasnprintf.m4        2008-10-09 15:24:53.000000000 +0100
15590 @@ -0,0 +1,260 @@
15591 +# vasnprintf.m4 serial 25
15592 +dnl Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc.
15593 +dnl This file is free software; the Free Software Foundation
15594 +dnl gives unlimited permission to copy and/or distribute it,
15595 +dnl with or without modifications, as long as this notice is preserved.
15596 +
15597 +AC_DEFUN([gl_FUNC_VASNPRINTF],
15598 +[
15599 +  AC_CHECK_FUNCS_ONCE([vasnprintf])
15600 +  if test $ac_cv_func_vasnprintf = no; then
15601 +    gl_REPLACE_VASNPRINTF
15602 +  fi
15603 +])
15604 +
15605 +AC_DEFUN([gl_REPLACE_VASNPRINTF],
15606 +[
15607 +  AC_CHECK_FUNCS_ONCE([vasnprintf])
15608 +  AC_LIBOBJ([vasnprintf])
15609 +  AC_LIBOBJ([printf-args])
15610 +  AC_LIBOBJ([printf-parse])
15611 +  AC_LIBOBJ([asnprintf])
15612 +  if test $ac_cv_func_vasnprintf = yes; then
15613 +    AC_DEFINE([REPLACE_VASNPRINTF], 1,
15614 +      [Define if vasnprintf exists but is overridden by gnulib.])
15615 +  fi
15616 +  gl_PREREQ_PRINTF_ARGS
15617 +  gl_PREREQ_PRINTF_PARSE
15618 +  gl_PREREQ_VASNPRINTF
15619 +  gl_PREREQ_ASNPRINTF
15620 +])
15621 +
15622 +# Prequisites of lib/printf-args.h, lib/printf-args.c.
15623 +AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
15624 +[
15625 +  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
15626 +  AC_REQUIRE([gt_TYPE_WCHAR_T])
15627 +  AC_REQUIRE([gt_TYPE_WINT_T])
15628 +])
15629 +
15630 +# Prequisites of lib/printf-parse.h, lib/printf-parse.c.
15631 +AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
15632 +[
15633 +  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
15634 +  AC_REQUIRE([gt_TYPE_WCHAR_T])
15635 +  AC_REQUIRE([gt_TYPE_WINT_T])
15636 +  AC_REQUIRE([AC_TYPE_SIZE_T])
15637 +  AC_CHECK_TYPE([ptrdiff_t], ,
15638 +    [AC_DEFINE([ptrdiff_t], [long],
15639 +       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
15640 +    ])
15641 +  AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
15642 +])
15643 +
15644 +# Prerequisites of lib/vasnprintf.c.
15645 +AC_DEFUN([gl_PREREQ_VASNPRINTF],
15646 +[
15647 +  AC_REQUIRE([AC_FUNC_ALLOCA])
15648 +  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
15649 +  AC_REQUIRE([gt_TYPE_WCHAR_T])
15650 +  AC_REQUIRE([gt_TYPE_WINT_T])
15651 +  AC_CHECK_FUNCS(snprintf wcslen)
15652 +  dnl Use the _snprintf function only if it is declared (because on NetBSD it
15653 +  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
15654 +  AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>])
15655 +])
15656 +
15657 +# Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
15658 +# arguments.
15659 +AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
15660 +[
15661 +  AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
15662 +  case "$gl_cv_func_printf_long_double" in
15663 +    *yes)
15664 +      ;;
15665 +    *)
15666 +      AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
15667 +        [Define if the vasnprintf implementation needs special code for
15668 +         'long double' arguments.])
15669 +      ;;
15670 +  esac
15671 +])
15672 +
15673 +# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
15674 +# arguments.
15675 +AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
15676 +[
15677 +  AC_REQUIRE([gl_PRINTF_INFINITE])
15678 +  case "$gl_cv_func_printf_infinite" in
15679 +    *yes)
15680 +      ;;
15681 +    *)
15682 +      AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], 1,
15683 +        [Define if the vasnprintf implementation needs special code for
15684 +         infinite 'double' arguments.])
15685 +      ;;
15686 +  esac
15687 +])
15688 +
15689 +# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
15690 +# arguments.
15691 +AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
15692 +[
15693 +  AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
15694 +  dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
15695 +  dnl NEED_PRINTF_LONG_DOUBLE is already set.
15696 +  AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
15697 +  case "$gl_cv_func_printf_long_double" in
15698 +    *yes)
15699 +      case "$gl_cv_func_printf_infinite_long_double" in
15700 +        *yes)
15701 +          ;;
15702 +        *)
15703 +          AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], 1,
15704 +            [Define if the vasnprintf implementation needs special code for
15705 +             infinite 'long double' arguments.])
15706 +          ;;
15707 +      esac
15708 +      ;;
15709 +  esac
15710 +])
15711 +
15712 +# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
15713 +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
15714 +[
15715 +  AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
15716 +  case "$gl_cv_func_printf_directive_a" in
15717 +    *yes)
15718 +      ;;
15719 +    *)
15720 +      AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
15721 +        [Define if the vasnprintf implementation needs special code for
15722 +         the 'a' and 'A' directives.])
15723 +      AC_CHECK_FUNCS([nl_langinfo])
15724 +      ;;
15725 +  esac
15726 +])
15727 +
15728 +# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
15729 +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
15730 +[
15731 +  AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
15732 +  case "$gl_cv_func_printf_directive_f" in
15733 +    *yes)
15734 +      ;;
15735 +    *)
15736 +      AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], 1,
15737 +        [Define if the vasnprintf implementation needs special code for
15738 +         the 'F' directive.])
15739 +      ;;
15740 +  esac
15741 +])
15742 +
15743 +# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
15744 +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
15745 +[
15746 +  AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
15747 +  case "$gl_cv_func_printf_flag_grouping" in
15748 +    *yes)
15749 +      ;;
15750 +    *)
15751 +      AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], 1,
15752 +        [Define if the vasnprintf implementation needs special code for the
15753 +         ' flag.])
15754 +      ;;
15755 +  esac
15756 +])
15757 +
15758 +# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
15759 +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
15760 +[
15761 +  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
15762 +  case "$gl_cv_func_printf_flag_leftadjust" in
15763 +    *yes)
15764 +      ;;
15765 +    *)
15766 +      AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1,
15767 +        [Define if the vasnprintf implementation needs special code for the
15768 +         '-' flag.])
15769 +      ;;
15770 +  esac
15771 +])
15772 +
15773 +# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
15774 +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
15775 +[
15776 +  AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
15777 +  case "$gl_cv_func_printf_flag_zero" in
15778 +    *yes)
15779 +      ;;
15780 +    *)
15781 +      AC_DEFINE([NEED_PRINTF_FLAG_ZERO], 1,
15782 +        [Define if the vasnprintf implementation needs special code for the
15783 +         0 flag.])
15784 +      ;;
15785 +  esac
15786 +])
15787 +
15788 +# Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
15789 +AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
15790 +[
15791 +  AC_REQUIRE([gl_PRINTF_PRECISION])
15792 +  case "$gl_cv_func_printf_precision" in
15793 +    *yes)
15794 +      ;;
15795 +    *)
15796 +      AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1,
15797 +        [Define if the vasnprintf implementation needs special code for
15798 +         supporting large precisions without arbitrary bounds.])
15799 +      AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
15800 +        [Define if the vasnprintf implementation needs special code for
15801 +         'double' arguments.])
15802 +      AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
15803 +        [Define if the vasnprintf implementation needs special code for
15804 +         'long double' arguments.])
15805 +      ;;
15806 +  esac
15807 +])
15808 +
15809 +# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
15810 +# conditions.
15811 +AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
15812 +[
15813 +  AC_REQUIRE([gl_PRINTF_ENOMEM])
15814 +  case "$gl_cv_func_printf_enomem" in
15815 +    *yes)
15816 +      ;;
15817 +    *)
15818 +      AC_DEFINE([NEED_PRINTF_ENOMEM], 1,
15819 +        [Define if the vasnprintf implementation needs special code for
15820 +         surviving out-of-memory conditions.])
15821 +      AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
15822 +        [Define if the vasnprintf implementation needs special code for
15823 +         'double' arguments.])
15824 +      AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
15825 +        [Define if the vasnprintf implementation needs special code for
15826 +         'long double' arguments.])
15827 +      ;;
15828 +  esac
15829 +])
15830 +
15831 +# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
15832 +AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
15833 +[
15834 +  AC_REQUIRE([gl_PREREQ_VASNPRINTF])
15835 +  gl_PREREQ_VASNPRINTF_LONG_DOUBLE
15836 +  gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
15837 +  gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
15838 +  gl_PREREQ_VASNPRINTF_DIRECTIVE_A
15839 +  gl_PREREQ_VASNPRINTF_DIRECTIVE_F
15840 +  gl_PREREQ_VASNPRINTF_FLAG_GROUPING
15841 +  gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
15842 +  gl_PREREQ_VASNPRINTF_FLAG_ZERO
15843 +  gl_PREREQ_VASNPRINTF_PRECISION
15844 +  gl_PREREQ_VASNPRINTF_ENOMEM
15845 +])
15846 +
15847 +# Prerequisites of lib/asnprintf.c.
15848 +AC_DEFUN([gl_PREREQ_ASNPRINTF],
15849 +[
15850 +])
15851 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/wchar.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar.m4
15852 --- gtk-vnc-0.3.7.dan3/gnulib/m4/wchar.m4       1970-01-01 01:00:00.000000000 +0100
15853 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar.m4     2008-10-09 15:24:53.000000000 +0100
15854 @@ -0,0 +1,69 @@
15855 +dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
15856 +
15857 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
15858 +dnl This file is free software; the Free Software Foundation
15859 +dnl gives unlimited permission to copy and/or distribute it,
15860 +dnl with or without modifications, as long as this notice is preserved.
15861 +
15862 +dnl Written by Eric Blake.
15863 +
15864 +# wchar.m4 serial 6
15865 +
15866 +AC_DEFUN([gl_WCHAR_H],
15867 +[
15868 +  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
15869 +  AC_CACHE_CHECK([whether <wchar.h> is standalone],
15870 +    [gl_cv_header_wchar_h_standalone],
15871 +    [AC_COMPILE_IFELSE([[#include <wchar.h>
15872 +wchar_t w;]],
15873 +      [gl_cv_header_wchar_h_standalone=yes],
15874 +      [gl_cv_header_wchar_h_standalone=no])])
15875 +
15876 +  AC_REQUIRE([gt_TYPE_WINT_T])
15877 +  if test $gt_cv_c_wint_t = yes; then
15878 +    HAVE_WINT_T=1
15879 +  else
15880 +    HAVE_WINT_T=0
15881 +  fi
15882 +  AC_SUBST([HAVE_WINT_T])
15883 +
15884 +  if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then
15885 +    WCHAR_H=wchar.h
15886 +  fi
15887 +
15888 +  dnl Prepare for creating substitute <wchar.h>.
15889 +  dnl Do it always: WCHAR_H may be empty here but can be set later.
15890 +  dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
15891 +  dnl character support).
15892 +  AC_CHECK_HEADERS_ONCE([wchar.h])
15893 +  if test $ac_cv_header_wchar_h = yes; then
15894 +    HAVE_WCHAR_H=1
15895 +  else
15896 +    HAVE_WCHAR_H=0
15897 +  fi
15898 +  AC_SUBST([HAVE_WCHAR_H])
15899 +  gl_CHECK_NEXT_HEADERS([wchar.h])
15900 +])
15901 +
15902 +dnl Unconditionally enables the replacement of <wchar.h>.
15903 +AC_DEFUN([gl_REPLACE_WCHAR_H],
15904 +[
15905 +  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
15906 +  WCHAR_H=wchar.h
15907 +])
15908 +
15909 +AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
15910 +[
15911 +  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
15912 +  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
15913 +  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
15914 +])
15915 +
15916 +AC_DEFUN([gl_WCHAR_H_DEFAULTS],
15917 +[
15918 +  GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
15919 +  dnl Assume proper GNU behavior unless another module says otherwise.
15920 +  HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
15921 +  REPLACE_WCWIDTH=0;   AC_SUBST([REPLACE_WCWIDTH])
15922 +  WCHAR_H='';          AC_SUBST([WCHAR_H])
15923 +])
15924 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/wchar_t.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar_t.m4
15925 --- gtk-vnc-0.3.7.dan3/gnulib/m4/wchar_t.m4     1970-01-01 01:00:00.000000000 +0100
15926 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar_t.m4   2008-10-09 15:24:53.000000000 +0100
15927 @@ -0,0 +1,20 @@
15928 +# wchar_t.m4 serial 1 (gettext-0.12)
15929 +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
15930 +dnl This file is free software; the Free Software Foundation
15931 +dnl gives unlimited permission to copy and/or distribute it,
15932 +dnl with or without modifications, as long as this notice is preserved.
15933 +
15934 +dnl From Bruno Haible.
15935 +dnl Test whether <stddef.h> has the 'wchar_t' type.
15936 +dnl Prerequisite: AC_PROG_CC
15937 +
15938 +AC_DEFUN([gt_TYPE_WCHAR_T],
15939 +[
15940 +  AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
15941 +    [AC_TRY_COMPILE([#include <stddef.h>
15942 +       wchar_t foo = (wchar_t)'\0';], ,
15943 +       gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
15944 +  if test $gt_cv_c_wchar_t = yes; then
15945 +    AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
15946 +  fi
15947 +])
15948 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/wint_t.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/wint_t.m4
15949 --- gtk-vnc-0.3.7.dan3/gnulib/m4/wint_t.m4      1970-01-01 01:00:00.000000000 +0100
15950 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/wint_t.m4    2008-10-09 15:24:53.000000000 +0100
15951 @@ -0,0 +1,28 @@
15952 +# wint_t.m4 serial 2 (gettext-0.17)
15953 +dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
15954 +dnl This file is free software; the Free Software Foundation
15955 +dnl gives unlimited permission to copy and/or distribute it,
15956 +dnl with or without modifications, as long as this notice is preserved.
15957 +
15958 +dnl From Bruno Haible.
15959 +dnl Test whether <wchar.h> has the 'wint_t' type.
15960 +dnl Prerequisite: AC_PROG_CC
15961 +
15962 +AC_DEFUN([gt_TYPE_WINT_T],
15963 +[
15964 +  AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
15965 +    [AC_TRY_COMPILE([
15966 +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
15967 +   <wchar.h>.
15968 +   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
15969 +   before <wchar.h>.  */
15970 +#include <stddef.h>
15971 +#include <stdio.h>
15972 +#include <time.h>
15973 +#include <wchar.h>
15974 +       wint_t foo = (wchar_t)'\0';], ,
15975 +       gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
15976 +  if test $gt_cv_c_wint_t = yes; then
15977 +    AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
15978 +  fi
15979 +])
15980 diff -urN gtk-vnc-0.3.7.dan3/gnulib/m4/xsize.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/xsize.m4
15981 --- gtk-vnc-0.3.7.dan3/gnulib/m4/xsize.m4       1970-01-01 01:00:00.000000000 +0100
15982 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/xsize.m4     2008-10-09 15:24:53.000000000 +0100
15983 @@ -0,0 +1,13 @@
15984 +# xsize.m4 serial 3
15985 +dnl Copyright (C) 2003-2004 Free Software Foundation, Inc.
15986 +dnl This file is free software; the Free Software Foundation
15987 +dnl gives unlimited permission to copy and/or distribute it,
15988 +dnl with or without modifications, as long as this notice is preserved.
15989 +
15990 +AC_DEFUN([gl_XSIZE],
15991 +[
15992 +  dnl Prerequisites of lib/xsize.h.
15993 +  AC_REQUIRE([gl_SIZE_MAX])
15994 +  AC_REQUIRE([AC_C_INLINE])
15995 +  AC_CHECK_HEADERS(stdint.h)
15996 +])
15997 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/dummy.c gtk-vnc-0.3.7.gnulib/gnulib/tests/dummy.c
15998 --- gtk-vnc-0.3.7.dan3/gnulib/tests/dummy.c     1970-01-01 01:00:00.000000000 +0100
15999 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/dummy.c   2008-10-09 15:24:53.000000000 +0100
16000 @@ -0,0 +1,42 @@
16001 +/* A dummy file, to prevent empty libraries from breaking builds.
16002 +   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
16003 +
16004 +   This program is free software: you can redistribute it and/or modify
16005 +   it under the terms of the GNU General Public License as published by
16006 +   the Free Software Foundation; either version 3 of the License, or
16007 +   (at your option) any later version.
16008 +
16009 +   This program is distributed in the hope that it will be useful,
16010 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16011 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16012 +   GNU General Public License for more details.
16013 +
16014 +   You should have received a copy of the GNU General Public License
16015 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16016 +
16017 +/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
16018 +   libraries without any object files.  You might get an error like:
16019 +
16020 +   > ar cru .libs/libgl.a
16021 +   > ar: no archive members specified
16022 +
16023 +   Compiling this file, and adding its object file to the library, will
16024 +   prevent the library from being empty.  */
16025 +
16026 +/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
16027 +   that don't export any symbol.  You might get an error like:
16028 +
16029 +   > cc ... libgnu.a
16030 +   > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
16031 +
16032 +   Compiling this file, and adding its object file to the library, will
16033 +   prevent the library from exporting no symbols.  */
16034 +
16035 +#ifdef __sun
16036 +/* This declaration ensures that the library will export at least 1 symbol.  */
16037 +int gl_dummy_symbol;
16038 +#else
16039 +/* This declaration is solely to ensure that after preprocessing
16040 +   this file is never empty.  */
16041 +typedef int dummy;
16042 +#endif
16043 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/intprops.h gtk-vnc-0.3.7.gnulib/gnulib/tests/intprops.h
16044 --- gtk-vnc-0.3.7.dan3/gnulib/tests/intprops.h  1970-01-01 01:00:00.000000000 +0100
16045 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/intprops.h        2008-10-09 15:24:53.000000000 +0100
16046 @@ -0,0 +1,77 @@
16047 +/* intprops.h -- properties of integer types
16048 +
16049 +   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
16050 +
16051 +   This program is free software: you can redistribute it and/or modify
16052 +   it under the terms of the GNU General Public License as published by
16053 +   the Free Software Foundation; either version 3 of the License, or
16054 +   (at your option) any later version.
16055 +
16056 +   This program is distributed in the hope that it will be useful,
16057 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16058 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16059 +   GNU General Public License for more details.
16060 +
16061 +   You should have received a copy of the GNU General Public License
16062 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16063 +
16064 +/* Written by Paul Eggert.  */
16065 +
16066 +#include <limits.h>
16067 +
16068 +/* The extra casts in the following macros work around compiler bugs,
16069 +   e.g., in Cray C 5.0.3.0.  */
16070 +
16071 +/* True if the arithmetic type T is an integer type.  bool counts as
16072 +   an integer.  */
16073 +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
16074 +
16075 +/* True if negative values of the signed integer type T use two's
16076 +   complement, ones' complement, or signed magnitude representation,
16077 +   respectively.  Much GNU code assumes two's complement, but some
16078 +   people like to be portable to all possible C hosts.  */
16079 +#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
16080 +#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
16081 +#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
16082 +
16083 +/* True if the arithmetic type T is signed.  */
16084 +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
16085 +
16086 +/* The maximum and minimum values for the integer type T.  These
16087 +   macros have undefined behavior if T is signed and has padding bits.
16088 +   If this is a problem for you, please let us know how to fix it for
16089 +   your host.  */
16090 +#define TYPE_MINIMUM(t) \
16091 +  ((t) (! TYPE_SIGNED (t) \
16092 +       ? (t) 0 \
16093 +       : TYPE_SIGNED_MAGNITUDE (t) \
16094 +       ? ~ (t) 0 \
16095 +       : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
16096 +#define TYPE_MAXIMUM(t) \
16097 +  ((t) (! TYPE_SIGNED (t) \
16098 +       ? (t) -1 \
16099 +       : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
16100 +
16101 +/* Return zero if T can be determined to be an unsigned type.
16102 +   Otherwise, return 1.
16103 +   When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a
16104 +   tighter bound.  Otherwise, it overestimates the true bound by one byte
16105 +   when applied to unsigned types of size 2, 4, 16, ... bytes.
16106 +   The symbol signed_type_or_expr__ is private to this header file.  */
16107 +#if __GNUC__ >= 2
16108 +# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
16109 +#else
16110 +# define signed_type_or_expr__(t) 1
16111 +#endif
16112 +
16113 +/* Bound on length of the string representing an integer type or expression T.
16114 +   Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
16115 +   add 1 for integer division truncation; add 1 more for a minus sign
16116 +   if needed.  */
16117 +#define INT_STRLEN_BOUND(t) \
16118 +  ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
16119 +   + signed_type_or_expr__ (t) + 1)
16120 +
16121 +/* Bound on buffer size needed to represent an integer type or expression T,
16122 +   including the terminating null.  */
16123 +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
16124 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/Makefile.am gtk-vnc-0.3.7.gnulib/gnulib/tests/Makefile.am
16125 --- gtk-vnc-0.3.7.dan3/gnulib/tests/Makefile.am 1970-01-01 01:00:00.000000000 +0100
16126 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/Makefile.am       2008-10-09 15:24:54.000000000 +0100
16127 @@ -0,0 +1,210 @@
16128 +## DO NOT EDIT! GENERATED AUTOMATICALLY!
16129 +## Process this file with automake to produce Makefile.in.
16130 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
16131 +#
16132 +# This file is free software, distributed under the terms of the GNU
16133 +# General Public License.  As a special exception to the GNU General
16134 +# Public License, this file may be distributed as part of a program
16135 +# that contains a configuration script generated by Autoconf, under
16136 +# the same distribution terms as the rest of that program.
16137 +#
16138 +# Generated by gnulib-tool.
16139 +
16140 +AUTOMAKE_OPTIONS = 1.5 foreign
16141 +
16142 +SUBDIRS =
16143 +TESTS =
16144 +TESTS_ENVIRONMENT =
16145 +noinst_PROGRAMS =
16146 +check_PROGRAMS =
16147 +noinst_HEADERS =
16148 +noinst_LIBRARIES =
16149 +check_LIBRARIES = libtests.a
16150 +EXTRA_DIST =
16151 +BUILT_SOURCES =
16152 +SUFFIXES =
16153 +MOSTLYCLEANFILES = core *.stackdump
16154 +MOSTLYCLEANDIRS =
16155 +CLEANFILES =
16156 +DISTCLEANFILES =
16157 +MAINTAINERCLEANFILES =
16158 +
16159 +AM_CPPFLAGS = \
16160 +  -I. -I$(srcdir) \
16161 +  -I../.. -I$(srcdir)/../.. \
16162 +  -I../../gnulib/lib -I$(srcdir)/../../gnulib/lib
16163 +
16164 +LDADD = libtests.a ../../gnulib/lib/libgnu.la libtests.a $(LIBTESTS_LIBDEPS)
16165 +
16166 +libtests_a_SOURCES =
16167 +libtests_a_LIBADD = $(gltests_LIBOBJS)
16168 +libtests_a_DEPENDENCIES = $(gltests_LIBOBJS)
16169 +EXTRA_libtests_a_SOURCES =
16170 +AM_LIBTOOLFLAGS = --preserve-dup-deps
16171 +
16172 +## begin gnulib module alloca-opt-tests
16173 +
16174 +TESTS += test-alloca-opt
16175 +check_PROGRAMS += test-alloca-opt
16176 +
16177 +EXTRA_DIST += test-alloca-opt.c
16178 +
16179 +## end   gnulib module alloca-opt-tests
16180 +
16181 +## begin gnulib module arpa_inet-tests
16182 +
16183 +TESTS += test-arpa_inet
16184 +check_PROGRAMS += test-arpa_inet
16185 +
16186 +EXTRA_DIST += test-arpa_inet.c
16187 +
16188 +## end   gnulib module arpa_inet-tests
16189 +
16190 +## begin gnulib module errno-tests
16191 +
16192 +TESTS += test-errno
16193 +check_PROGRAMS += test-errno
16194 +
16195 +EXTRA_DIST += test-errno.c
16196 +
16197 +## end   gnulib module errno-tests
16198 +
16199 +## begin gnulib module getaddrinfo-tests
16200 +
16201 +TESTS += test-getaddrinfo
16202 +check_PROGRAMS += test-getaddrinfo
16203 +test_getaddrinfo_LDADD = $(LDADD) @LIBINTL@
16204 +
16205 +EXTRA_DIST += test-getaddrinfo.c
16206 +
16207 +## end   gnulib module getaddrinfo-tests
16208 +
16209 +## begin gnulib module intprops
16210 +
16211 +
16212 +EXTRA_DIST += intprops.h
16213 +
16214 +## end   gnulib module intprops
16215 +
16216 +## begin gnulib module netinet_in-tests
16217 +
16218 +TESTS += test-netinet_in
16219 +check_PROGRAMS += test-netinet_in
16220 +
16221 +EXTRA_DIST += test-netinet_in.c
16222 +
16223 +## end   gnulib module netinet_in-tests
16224 +
16225 +## begin gnulib module snprintf-tests
16226 +
16227 +TESTS += test-snprintf
16228 +check_PROGRAMS += test-snprintf
16229 +
16230 +EXTRA_DIST += test-snprintf.c
16231 +
16232 +## end   gnulib module snprintf-tests
16233 +
16234 +## begin gnulib module stdbool-tests
16235 +
16236 +TESTS += test-stdbool
16237 +check_PROGRAMS += test-stdbool
16238 +
16239 +EXTRA_DIST += test-stdbool.c
16240 +
16241 +## end   gnulib module stdbool-tests
16242 +
16243 +## begin gnulib module stdint-tests
16244 +
16245 +TESTS += test-stdint
16246 +check_PROGRAMS += test-stdint
16247 +
16248 +EXTRA_DIST += test-stdint.c
16249 +
16250 +## end   gnulib module stdint-tests
16251 +
16252 +## begin gnulib module stdio-tests
16253 +
16254 +TESTS += test-stdio
16255 +check_PROGRAMS += test-stdio
16256 +
16257 +EXTRA_DIST += test-stdio.c
16258 +
16259 +## end   gnulib module stdio-tests
16260 +
16261 +## begin gnulib module stdlib-tests
16262 +
16263 +TESTS += test-stdlib
16264 +check_PROGRAMS += test-stdlib
16265 +
16266 +EXTRA_DIST += test-stdlib.c
16267 +
16268 +## end   gnulib module stdlib-tests
16269 +
16270 +## begin gnulib module sys_socket-tests
16271 +
16272 +TESTS += test-sys_socket
16273 +check_PROGRAMS += test-sys_socket
16274 +
16275 +EXTRA_DIST += test-sys_socket.c
16276 +
16277 +## end   gnulib module sys_socket-tests
16278 +
16279 +## begin gnulib module unistd-tests
16280 +
16281 +TESTS += test-unistd
16282 +check_PROGRAMS += test-unistd
16283 +
16284 +EXTRA_DIST += test-unistd.c
16285 +
16286 +## end   gnulib module unistd-tests
16287 +
16288 +## begin gnulib module vasnprintf-tests
16289 +
16290 +TESTS += test-vasnprintf
16291 +check_PROGRAMS += test-vasnprintf
16292 +
16293 +EXTRA_DIST += test-vasnprintf.c
16294 +
16295 +## end   gnulib module vasnprintf-tests
16296 +
16297 +## begin gnulib module vc-list-files-tests
16298 +
16299 +TESTS += test-vc-list-files-git.sh
16300 +TESTS += test-vc-list-files-cvs.sh
16301 +TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)':"$$PATH"
16302 +EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh
16303 +
16304 +## end   gnulib module vc-list-files-tests
16305 +
16306 +## begin gnulib module verify
16307 +
16308 +libtests_a_SOURCES += verify.h
16309 +
16310 +## end   gnulib module verify
16311 +
16312 +## begin gnulib module wchar-tests
16313 +
16314 +TESTS += test-wchar
16315 +check_PROGRAMS += test-wchar
16316 +
16317 +EXTRA_DIST += test-wchar.c
16318 +
16319 +## end   gnulib module wchar-tests
16320 +
16321 +## begin gnulib module dummy
16322 +
16323 +libtests_a_SOURCES += dummy.c
16324 +
16325 +## end   gnulib module dummy
16326 +
16327 +# Clean up after Solaris cc.
16328 +clean-local:
16329 +       rm -rf SunWS_cache
16330 +
16331 +mostlyclean-local: mostlyclean-generic
16332 +       @for dir in '' $(MOSTLYCLEANDIRS); do \
16333 +         if test -n "$$dir" && test -d $$dir; then \
16334 +           echo "rmdir $$dir"; rmdir $$dir; \
16335 +         fi; \
16336 +       done; \
16337 +       :
16338 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-alloca-opt.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-alloca-opt.c
16339 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-alloca-opt.c   1970-01-01 01:00:00.000000000 +0100
16340 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-alloca-opt.c 2008-10-09 15:24:53.000000000 +0100
16341 @@ -0,0 +1,62 @@
16342 +/* Test of optional automatic memory allocation.
16343 +   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
16344 +
16345 +   This program is free software: you can redistribute it and/or modify
16346 +   it under the terms of the GNU General Public License as published by
16347 +   the Free Software Foundation; either version 3 of the License, or
16348 +   (at your option) any later version.
16349 +
16350 +   This program is distributed in the hope that it will be useful,
16351 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16352 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16353 +   GNU General Public License for more details.
16354 +
16355 +   You should have received a copy of the GNU General Public License
16356 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16357 +
16358 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
16359 +
16360 +#include <config.h>
16361 +
16362 +#include <alloca.h>
16363 +
16364 +#if HAVE_ALLOCA
16365 +
16366 +static void
16367 +do_allocation (int n)
16368 +{
16369 +  void *ptr = alloca (n);
16370 +  (void) ptr;
16371 +}
16372 +
16373 +void (*func) (int) = do_allocation;
16374 +
16375 +#endif
16376 +
16377 +int
16378 +main ()
16379 +{
16380 +#if HAVE_ALLOCA
16381 +  int i;
16382 +
16383 +  /* Repeat a lot of times, to make sure there's no memory leak.  */
16384 +  for (i = 0; i < 100000; i++)
16385 +    {
16386 +      /* Try various values.
16387 +         n = 0 gave a crash on Alpha with gcc-2.5.8.
16388 +         Some versions of MacOS X have a stack size limit of 512 KB.  */
16389 +      func (34);
16390 +      func (134);
16391 +      func (399);
16392 +      func (510823);
16393 +      func (129321);
16394 +      func (0);
16395 +      func (4070);
16396 +      func (4095);
16397 +      func (1);
16398 +      func (16582);
16399 +    }
16400 +#endif
16401 +
16402 +  return 0;
16403 +}
16404 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-arpa_inet.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-arpa_inet.c
16405 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-arpa_inet.c    1970-01-01 01:00:00.000000000 +0100
16406 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-arpa_inet.c  2008-10-09 15:24:53.000000000 +0100
16407 @@ -0,0 +1,27 @@
16408 +/* Test of <arpa/inet.h> substitute.
16409 +   Copyright (C) 2007 Free Software Foundation, Inc.
16410 +
16411 +   This program is free software: you can redistribute it and/or modify
16412 +   it under the terms of the GNU General Public License as published by
16413 +   the Free Software Foundation; either version 3 of the License, or
16414 +   (at your option) any later version.
16415 +
16416 +   This program is distributed in the hope that it will be useful,
16417 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16418 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16419 +   GNU General Public License for more details.
16420 +
16421 +   You should have received a copy of the GNU General Public License
16422 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16423 +
16424 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
16425 +
16426 +#include <config.h>
16427 +
16428 +#include <arpa/inet.h>
16429 +
16430 +int
16431 +main ()
16432 +{
16433 +  return 0;
16434 +}
16435 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-errno.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-errno.c
16436 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-errno.c        1970-01-01 01:00:00.000000000 +0100
16437 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-errno.c      2008-10-09 15:24:53.000000000 +0100
16438 @@ -0,0 +1,117 @@
16439 +/* Test of <errno.h> substitute.
16440 +   Copyright (C) 2008 Free Software Foundation, Inc.
16441 +
16442 +   This program is free software: you can redistribute it and/or modify
16443 +   it under the terms of the GNU General Public License as published by
16444 +   the Free Software Foundation; either version 3 of the License, or
16445 +   (at your option) any later version.
16446 +
16447 +   This program is distributed in the hope that it will be useful,
16448 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16449 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16450 +   GNU General Public License for more details.
16451 +
16452 +   You should have received a copy of the GNU General Public License
16453 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16454 +
16455 +/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
16456 +
16457 +#include <config.h>
16458 +
16459 +#include <errno.h>
16460 +
16461 +/* Verify that the POSIX mandated errno values exist and can be used as
16462 +   initializers outside of a function.
16463 +   The variable names happen to match the Linux/x86 error numbers.  */
16464 +int e1 = EPERM;
16465 +int e2 = ENOENT;
16466 +int e3 = ESRCH;
16467 +int e4 = EINTR;
16468 +int e5 = EIO;
16469 +int e6 = ENXIO;
16470 +int e7 = E2BIG;
16471 +int e8 = ENOEXEC;
16472 +int e9 = EBADF;
16473 +int e10 = ECHILD;
16474 +int e11 = EAGAIN;
16475 +int e11a = EWOULDBLOCK;
16476 +int e12 = ENOMEM;
16477 +int e13 = EACCES;
16478 +int e14 = EFAULT;
16479 +int e16 = EBUSY;
16480 +int e17 = EEXIST;
16481 +int e18 = EXDEV;
16482 +int e19 = ENODEV;
16483 +int e20 = ENOTDIR;
16484 +int e21 = EISDIR;
16485 +int e22 = EINVAL;
16486 +int e23 = ENFILE;
16487 +int e24 = EMFILE;
16488 +int e25 = ENOTTY;
16489 +int e26 = ETXTBSY;
16490 +int e27 = EFBIG;
16491 +int e28 = ENOSPC;
16492 +int e29 = ESPIPE;
16493 +int e30 = EROFS;
16494 +int e31 = EMLINK;
16495 +int e32 = EPIPE;
16496 +int e33 = EDOM;
16497 +int e34 = ERANGE;
16498 +int e35 = EDEADLK;
16499 +int e36 = ENAMETOOLONG;
16500 +int e37 = ENOLCK;
16501 +int e38 = ENOSYS;
16502 +int e39 = ENOTEMPTY;
16503 +int e40 = ELOOP;
16504 +int e42 = ENOMSG;
16505 +int e43 = EIDRM;
16506 +int e67 = ENOLINK;
16507 +int e71 = EPROTO;
16508 +int e72 = EMULTIHOP;
16509 +int e74 = EBADMSG;
16510 +int e75 = EOVERFLOW;
16511 +int e84 = EILSEQ;
16512 +int e88 = ENOTSOCK;
16513 +int e89 = EDESTADDRREQ;
16514 +int e90 = EMSGSIZE;
16515 +int e91 = EPROTOTYPE;
16516 +int e92 = ENOPROTOOPT;
16517 +int e93 = EPROTONOSUPPORT;
16518 +int e95 = EOPNOTSUPP;
16519 +int e95a = ENOTSUP;
16520 +int e97 = EAFNOSUPPORT;
16521 +int e98 = EADDRINUSE;
16522 +int e99 = EADDRNOTAVAIL;
16523 +int e100 = ENETDOWN;
16524 +int e101 = ENETUNREACH;
16525 +int e102 = ENETRESET;
16526 +int e103 = ECONNABORTED;
16527 +int e104 = ECONNRESET;
16528 +int e105 = ENOBUFS;
16529 +int e106 = EISCONN;
16530 +int e107 = ENOTCONN;
16531 +int e110 = ETIMEDOUT;
16532 +int e111 = ECONNREFUSED;
16533 +int e113 = EHOSTUNREACH;
16534 +int e114 = EALREADY;
16535 +int e115 = EINPROGRESS;
16536 +int e116 = ESTALE;
16537 +int e122 = EDQUOT;
16538 +int e125 = ECANCELED;
16539 +
16540 +/* Don't verify that these errno values are all different, except for possibly
16541 +   EWOULDBLOCK == EAGAIN.  Even Linux/x86 does not pass this check: it has
16542 +   ENOTSUP == EOPNOTSUPP.  */
16543 +
16544 +int
16545 +main ()
16546 +{
16547 +  /* Verify that errno can be assigned.  */
16548 +  errno = EOVERFLOW;
16549 +
16550 +  /* snprintf() callers want to distinguish EINVAL and EOVERFLOW.  */
16551 +  if (errno == EINVAL)
16552 +    return 1;
16553 +
16554 +  return 0;
16555 +}
16556 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-getaddrinfo.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-getaddrinfo.c
16557 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-getaddrinfo.c  1970-01-01 01:00:00.000000000 +0100
16558 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-getaddrinfo.c        2008-10-09 15:24:53.000000000 +0100
16559 @@ -0,0 +1,155 @@
16560 +/* Test the getaddrinfo module.
16561 +
16562 +   Copyright (C) 2006-2008 Free Software Foundation, Inc.
16563 +
16564 +   This program is free software: you can redistribute it and/or modify
16565 +   it under the terms of the GNU General Public License as published by
16566 +   the Free Software Foundation; either version 3 of the License, or
16567 +   (at your option) any later version.
16568 +
16569 +   This program is distributed in the hope that it will be useful,
16570 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16571 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16572 +   GNU General Public License for more details.
16573 +
16574 +   You should have received a copy of the GNU General Public License
16575 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16576 +
16577 +/* Written by Simon Josefsson.  */
16578 +
16579 +#include <config.h>
16580 +#include "getaddrinfo.h"
16581 +#include <arpa/inet.h>
16582 +#include <netinet/in.h>
16583 +#include <stdio.h>
16584 +#include <string.h>
16585 +
16586 +/* Whether to print debugging messages.  */
16587 +#define ENABLE_DEBUGGING 0
16588 +
16589 +#if ENABLE_DEBUGGING
16590 +# define dbgprintf printf
16591 +#else
16592 +# define dbgprintf if (0) printf
16593 +#endif
16594 +
16595 +/* BeOS does not have AF_UNSPEC.  */
16596 +#ifndef AF_UNSPEC
16597 +# define AF_UNSPEC 0
16598 +#endif
16599 +
16600 +#ifndef EAI_SERVICE
16601 +# define EAI_SERVICE 0
16602 +#endif
16603 +
16604 +int simple (char *host, char *service)
16605 +{
16606 +  char buf[BUFSIZ];
16607 +  struct addrinfo hints;
16608 +  struct addrinfo *ai0, *ai;
16609 +  int res;
16610 +
16611 +  dbgprintf ("Finding %s service %s...\n", host, service);
16612 +
16613 +  /* This initializes "hints" but does not use it.  Is there a reason
16614 +     for this?  If so, please fix this comment.  */
16615 +  memset (&hints, 0, sizeof (hints));
16616 +  hints.ai_flags = AI_CANONNAME;
16617 +  hints.ai_family = AF_UNSPEC;
16618 +  hints.ai_socktype = SOCK_STREAM;
16619 +
16620 +  res = getaddrinfo (host, service, 0, &ai0);
16621 +
16622 +  dbgprintf ("res %d: %s\n", res, gai_strerror (res));
16623 +
16624 +  if (res != 0)
16625 +    {
16626 +      /* IRIX reports EAI_NONAME for "https".  Don't fail the test
16627 +        merely because of this.  */
16628 +      if (res == EAI_NONAME)
16629 +       return 0;
16630 +      /* Solaris reports EAI_SERVICE for "http" and "https".  Don't
16631 +         fail the test merely because of this.  */
16632 +      if (res == EAI_SERVICE)
16633 +       return 0;
16634 +      /* AIX reports EAI_NODATA for "https".  Don't fail the test
16635 +        merely because of this.  */
16636 +      if (res == EAI_NODATA)
16637 +       return 0;
16638 +
16639 +      return 1;
16640 +    }
16641 +
16642 +  for (ai = ai0; ai; ai = ai->ai_next)
16643 +    {
16644 +      dbgprintf ("\tflags %x\n", ai->ai_flags);
16645 +      dbgprintf ("\tfamily %x\n", ai->ai_family);
16646 +      dbgprintf ("\tsocktype %x\n", ai->ai_socktype);
16647 +      dbgprintf ("\tprotocol %x\n", ai->ai_protocol);
16648 +      dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen);
16649 +      dbgprintf ("\tFound %s\n",
16650 +                inet_ntop (ai->ai_family,
16651 +                           &((struct sockaddr_in *)
16652 +                             ai->ai_addr)->sin_addr,
16653 +                           buf, sizeof (buf) - 1));
16654 +      if (ai->ai_canonname)
16655 +       dbgprintf ("\tFound %s...\n", ai->ai_canonname);
16656 +
16657 +      {
16658 +       char ipbuf[BUFSIZ];
16659 +       char portbuf[BUFSIZ];
16660 +
16661 +       res = getnameinfo (ai->ai_addr, ai->ai_addrlen,
16662 +                          ipbuf, sizeof (ipbuf) - 1,
16663 +                          portbuf, sizeof (portbuf) - 1,
16664 +                          NI_NUMERICHOST|NI_NUMERICSERV);
16665 +       dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res));
16666 +       if (res == 0)
16667 +         {
16668 +           dbgprintf ("\t\tip %s\n", ipbuf);
16669 +           dbgprintf ("\t\tport %s\n", portbuf);
16670 +         }
16671 +      }
16672 +
16673 +    }
16674 +
16675 +  freeaddrinfo (ai0);
16676 +
16677 +  return 0;
16678 +}
16679 +
16680 +#define HOST1 "www.gnu.org"
16681 +#define SERV1 "http"
16682 +#define HOST2 "www.ibm.com"
16683 +#define SERV2 "https"
16684 +#define HOST3 "microsoft.com"
16685 +#define SERV3 "http"
16686 +#define HOST4 "google.org"
16687 +#define SERV4 "ldap"
16688 +
16689 +int main (void)
16690 +{
16691 +#if _WIN32
16692 +  {
16693 +    WORD requested;
16694 +    WSADATA data;
16695 +    int err;
16696 +
16697 +    requested = MAKEWORD (1, 1);
16698 +    err = WSAStartup (requested, &data);
16699 +    if (err != 0)
16700 +      return 1;
16701 +
16702 +    if (data.wVersion < requested)
16703 +      {
16704 +       WSACleanup ();
16705 +       return 2;
16706 +      }
16707 +  }
16708 +#endif
16709 +
16710 +  return simple (HOST1, SERV1)
16711 +    + simple (HOST2, SERV2)
16712 +    + simple (HOST3, SERV3)
16713 +    + simple (HOST4, SERV4);
16714 +}
16715 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-netinet_in.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-netinet_in.c
16716 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-netinet_in.c   1970-01-01 01:00:00.000000000 +0100
16717 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-netinet_in.c 2008-10-09 15:24:53.000000000 +0100
16718 @@ -0,0 +1,27 @@
16719 +/* Test of <netinet/in.h> substitute.
16720 +   Copyright (C) 2007 Free Software Foundation, Inc.
16721 +
16722 +   This program is free software: you can redistribute it and/or modify
16723 +   it under the terms of the GNU General Public License as published by
16724 +   the Free Software Foundation; either version 3 of the License, or
16725 +   (at your option) any later version.
16726 +
16727 +   This program is distributed in the hope that it will be useful,
16728 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16729 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16730 +   GNU General Public License for more details.
16731 +
16732 +   You should have received a copy of the GNU General Public License
16733 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16734 +
16735 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
16736 +
16737 +#include <config.h>
16738 +
16739 +#include <netinet/in.h>
16740 +
16741 +int
16742 +main ()
16743 +{
16744 +  return 0;
16745 +}
16746 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-snprintf.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-snprintf.c
16747 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-snprintf.c     1970-01-01 01:00:00.000000000 +0100
16748 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-snprintf.c   2008-10-09 15:24:53.000000000 +0100
16749 @@ -0,0 +1,72 @@
16750 +/* Test of snprintf() function.
16751 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
16752 +
16753 +   This program is free software: you can redistribute it and/or modify
16754 +   it under the terms of the GNU General Public License as published by
16755 +   the Free Software Foundation; either version 3 of the License, or
16756 +   (at your option) any later version.
16757 +
16758 +   This program is distributed in the hope that it will be useful,
16759 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16760 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16761 +   GNU General Public License for more details.
16762 +
16763 +   You should have received a copy of the GNU General Public License
16764 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16765 +
16766 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
16767 +
16768 +#include <config.h>
16769 +
16770 +#include <stdio.h>
16771 +
16772 +#include <stdlib.h>
16773 +#include <string.h>
16774 +
16775 +#define ASSERT(expr) \
16776 +  do                                                                        \
16777 +    {                                                                       \
16778 +      if (!(expr))                                                          \
16779 +        {                                                                   \
16780 +          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
16781 +          fflush (stderr);                                                  \
16782 +          abort ();                                                         \
16783 +        }                                                                   \
16784 +    }                                                                       \
16785 +  while (0)
16786 +
16787 +int
16788 +main (int argc, char *argv[])
16789 +{
16790 +  char buf[8];
16791 +  int size;
16792 +  int retval;
16793 +
16794 +  for (size = 0; size <= 8; size++)
16795 +    {
16796 +      memcpy (buf, "DEADBEEF", 8);
16797 +      retval = snprintf (buf, size, "%d", 12345);
16798 +      if (size < 6)
16799 +       {
16800 +#if CHECK_SNPRINTF_POSIX
16801 +         ASSERT (retval < 0 || retval >= size);
16802 +#endif
16803 +         if (size > 0)
16804 +           {
16805 +             ASSERT (memcmp (buf, "12345", size - 1) == 0);
16806 +             ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
16807 +           }
16808 +#if !CHECK_SNPRINTF_POSIX
16809 +         if (size > 0)
16810 +#endif
16811 +           ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
16812 +       }
16813 +      else
16814 +       {
16815 +         ASSERT (retval == 5);
16816 +         ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
16817 +       }
16818 +    }
16819 +
16820 +  return 0;
16821 +}
16822 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-stdbool.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdbool.c
16823 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-stdbool.c      1970-01-01 01:00:00.000000000 +0100
16824 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdbool.c    2008-10-09 15:24:53.000000000 +0100
16825 @@ -0,0 +1,95 @@
16826 +/* Test of <stdbool.h> substitute.
16827 +   Copyright (C) 2002-2007 Free Software Foundation, Inc.
16828 +
16829 +   This program is free software: you can redistribute it and/or modify
16830 +   it under the terms of the GNU General Public License as published by
16831 +   the Free Software Foundation; either version 3 of the License, or
16832 +   (at your option) any later version.
16833 +
16834 +   This program is distributed in the hope that it will be useful,
16835 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16836 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16837 +   GNU General Public License for more details.
16838 +
16839 +   You should have received a copy of the GNU General Public License
16840 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16841 +
16842 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
16843 +
16844 +#include <config.h>
16845 +
16846 +#include <stdbool.h>
16847 +
16848 +#ifndef bool
16849 + "error: bool is not defined"
16850 +#endif
16851 +#ifndef false
16852 + "error: false is not defined"
16853 +#endif
16854 +#if false
16855 + "error: false is not 0"
16856 +#endif
16857 +#ifndef true
16858 + "error: true is not defined"
16859 +#endif
16860 +#if true != 1
16861 + "error: true is not 1"
16862 +#endif
16863 +#ifndef __bool_true_false_are_defined
16864 + "error: __bool_true_false_are_defined is not defined"
16865 +#endif
16866 +
16867 +#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>.  */
16868 +struct s { _Bool s: 1; _Bool t; } s;
16869 +#endif
16870 +
16871 +char a[true == 1 ? 1 : -1];
16872 +char b[false == 0 ? 1 : -1];
16873 +char c[__bool_true_false_are_defined == 1 ? 1 : -1];
16874 +#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>.  */
16875 +char d[(bool) 0.5 == true ? 1 : -1];
16876 +bool e = &s;
16877 +#endif
16878 +char f[(_Bool) 0.0 == false ? 1 : -1];
16879 +char g[true];
16880 +char h[sizeof (_Bool)];
16881 +#if 0 /* See above.  */
16882 +char i[sizeof s.t];
16883 +#endif
16884 +enum { j = false, k = true, l = false * true, m = true * 256 };
16885 +_Bool n[m];
16886 +char o[sizeof n == m * sizeof n[0] ? 1 : -1];
16887 +char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
16888 +#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>.  */
16889 +#if defined __xlc__ || defined __GNUC__
16890 + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
16891 +    reported by James Lemley on 2005-10-05; see
16892 +    http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
16893 +    This test is not quite right, since xlc is allowed to
16894 +    reject this program, as the initializer for xlcbug is
16895 +    not one of the forms that C requires support for.
16896 +    However, doing the test right would require a run-time
16897 +    test, and that would make cross-compilation harder.
16898 +    Let us hope that IBM fixes the xlc bug, and also adds
16899 +    support for this kind of constant expression.  In the
16900 +    meantime, this test will reject xlc, which is OK, since
16901 +    our stdbool.h substitute should suffice.  We also test
16902 +    this with GCC, where it should work, to detect more
16903 +    quickly whether someone messes up the test in the
16904 +    future.  */
16905 + char digs[] = "0123456789";
16906 + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
16907 +#endif
16908 +#endif
16909 +/* Catch a bug in an HP-UX C compiler.  See
16910 +   http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
16911 +   http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
16912 + */
16913 +_Bool q = true;
16914 +_Bool *pq = &q;
16915 +
16916 +int
16917 +main ()
16918 +{
16919 +  return 0;
16920 +}
16921 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-stdint.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdint.c
16922 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-stdint.c       1970-01-01 01:00:00.000000000 +0100
16923 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdint.c     2008-10-09 15:24:53.000000000 +0100
16924 @@ -0,0 +1,360 @@
16925 +/* Test of <stdint.h> substitute.
16926 +   Copyright (C) 2006-2008 Free Software Foundation, Inc.
16927 +
16928 +   This program is free software: you can redistribute it and/or modify
16929 +   it under the terms of the GNU General Public License as published by
16930 +   the Free Software Foundation; either version 3 of the License, or
16931 +   (at your option) any later version.
16932 +
16933 +   This program is distributed in the hope that it will be useful,
16934 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16935 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16936 +   GNU General Public License for more details.
16937 +
16938 +   You should have received a copy of the GNU General Public License
16939 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16940 +
16941 +/* Written by Bruno Haible <bruno@clisp.org>, 2006.  */
16942 +
16943 +#include <config.h>
16944 +
16945 +/* Whether to enable pedantic checks. */
16946 +#define DO_PEDANTIC 0
16947 +
16948 +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
16949 +#include <stdint.h>
16950 +
16951 +#include "verify.h"
16952 +#include "intprops.h"
16953 +
16954 +#if __GNUC__ >= 2 && DO_PEDANTIC
16955 +# define verify_same_types(expr1,expr2)  \
16956 +    extern void _verify_func(__LINE__) (__typeof__ (expr1) *); \
16957 +    extern void _verify_func(__LINE__) (__typeof__ (expr2) *);
16958 +# define _verify_func(line) _verify_func2(line)
16959 +# define _verify_func2(line) verify_func_ ## line
16960 +#else
16961 +# define verify_same_types(expr1,expr2) extern void verify_func (int)
16962 +#endif
16963 +
16964 +/* 7.18.1.1. Exact-width integer types */
16965 +/* 7.18.2.1. Limits of exact-width integer types */
16966 +
16967 +int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX };
16968 +verify (TYPE_MINIMUM (int8_t) == INT8_MIN);
16969 +verify (TYPE_MAXIMUM (int8_t) == INT8_MAX);
16970 +verify_same_types (INT8_MIN, (int8_t) 0 + 0);
16971 +verify_same_types (INT8_MAX, (int8_t) 0 + 0);
16972 +
16973 +int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX };
16974 +verify (TYPE_MINIMUM (int16_t) == INT16_MIN);
16975 +verify (TYPE_MAXIMUM (int16_t) == INT16_MAX);
16976 +verify_same_types (INT16_MIN, (int16_t) 0 + 0);
16977 +verify_same_types (INT16_MAX, (int16_t) 0 + 0);
16978 +
16979 +int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX };
16980 +verify (TYPE_MINIMUM (int32_t) == INT32_MIN);
16981 +verify (TYPE_MAXIMUM (int32_t) == INT32_MAX);
16982 +verify_same_types (INT32_MIN, (int32_t) 0 + 0);
16983 +verify_same_types (INT32_MAX, (int32_t) 0 + 0);
16984 +
16985 +#ifdef INT64_MAX
16986 +int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX };
16987 +verify (TYPE_MINIMUM (int64_t) == INT64_MIN);
16988 +verify (TYPE_MAXIMUM (int64_t) == INT64_MAX);
16989 +verify_same_types (INT64_MIN, (int64_t) 0 + 0);
16990 +verify_same_types (INT64_MAX, (int64_t) 0 + 0);
16991 +#endif
16992 +
16993 +uint8_t b1[2] = { UINT8_C (17), UINT8_MAX };
16994 +verify (TYPE_MAXIMUM (uint8_t) == UINT8_MAX);
16995 +verify_same_types (UINT8_MAX, (uint8_t) 0 + 0);
16996 +
16997 +uint16_t b2[2] = { UINT16_C (17), UINT16_MAX };
16998 +verify (TYPE_MAXIMUM (uint16_t) == UINT16_MAX);
16999 +verify_same_types (UINT16_MAX, (uint16_t) 0 + 0);
17000 +
17001 +uint32_t b3[2] = { UINT32_C (17), UINT32_MAX };
17002 +verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX);
17003 +verify_same_types (UINT32_MAX, (uint32_t) 0 + 0);
17004 +
17005 +#ifdef UINT64_MAX
17006 +uint64_t b4[2] = { UINT64_C (17), UINT64_MAX };
17007 +verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX);
17008 +verify_same_types (UINT64_MAX, (uint64_t) 0 + 0);
17009 +#endif
17010 +
17011 +#if INT8_MIN && INT8_MAX && INT16_MIN && INT16_MAX && INT32_MIN && INT32_MAX
17012 +/* ok */
17013 +#else
17014 +err or;
17015 +#endif
17016 +
17017 +#if UINT8_MAX && UINT16_MAX && UINT32_MAX
17018 +/* ok */
17019 +#else
17020 +err or;
17021 +#endif
17022 +
17023 +/* 7.18.1.2. Minimum-width integer types */
17024 +/* 7.18.2.2. Limits of minimum-width integer types */
17025 +
17026 +int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX };
17027 +verify (TYPE_MINIMUM (int_least8_t) == INT_LEAST8_MIN);
17028 +verify (TYPE_MAXIMUM (int_least8_t) == INT_LEAST8_MAX);
17029 +verify_same_types (INT_LEAST8_MIN, (int_least8_t) 0 + 0);
17030 +verify_same_types (INT_LEAST8_MAX, (int_least8_t) 0 + 0);
17031 +
17032 +int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX };
17033 +verify (TYPE_MINIMUM (int_least16_t) == INT_LEAST16_MIN);
17034 +verify (TYPE_MAXIMUM (int_least16_t) == INT_LEAST16_MAX);
17035 +verify_same_types (INT_LEAST16_MIN, (int_least16_t) 0 + 0);
17036 +verify_same_types (INT_LEAST16_MAX, (int_least16_t) 0 + 0);
17037 +
17038 +int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX };
17039 +verify (TYPE_MINIMUM (int_least32_t) == INT_LEAST32_MIN);
17040 +verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX);
17041 +verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0);
17042 +verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0);
17043 +
17044 +#ifdef INT_LEAST64_MAX
17045 +int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX };
17046 +verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN);
17047 +verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX);
17048 +verify_same_types (INT_LEAST64_MIN, (int_least64_t) 0 + 0);
17049 +verify_same_types (INT_LEAST64_MAX, (int_least64_t) 0 + 0);
17050 +#endif
17051 +
17052 +uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX };
17053 +verify (TYPE_MAXIMUM (uint_least8_t) == UINT_LEAST8_MAX);
17054 +verify_same_types (UINT_LEAST8_MAX, (uint_least8_t) 0 + 0);
17055 +
17056 +uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX };
17057 +verify (TYPE_MAXIMUM (uint_least16_t) == UINT_LEAST16_MAX);
17058 +verify_same_types (UINT_LEAST16_MAX, (uint_least16_t) 0 + 0);
17059 +
17060 +uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX };
17061 +verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX);
17062 +verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0);
17063 +
17064 +#ifdef UINT_LEAST64_MAX
17065 +uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX };
17066 +verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX);
17067 +verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0);
17068 +#endif
17069 +
17070 +#if INT_LEAST8_MIN && INT_LEAST8_MAX && INT_LEAST16_MIN && INT_LEAST16_MAX && INT_LEAST32_MIN && INT_LEAST32_MAX
17071 +/* ok */
17072 +#else
17073 +err or;
17074 +#endif
17075 +
17076 +#if UINT_LEAST8_MAX && UINT_LEAST16_MAX && UINT_LEAST32_MAX
17077 +/* ok */
17078 +#else
17079 +err or;
17080 +#endif
17081 +
17082 +/* 7.18.1.3. Fastest minimum-width integer types */
17083 +/* 7.18.2.3. Limits of fastest minimum-width integer types */
17084 +
17085 +int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX };
17086 +verify (TYPE_MINIMUM (int_fast8_t) == INT_FAST8_MIN);
17087 +verify (TYPE_MAXIMUM (int_fast8_t) == INT_FAST8_MAX);
17088 +verify_same_types (INT_FAST8_MIN, (int_fast8_t) 0 + 0);
17089 +verify_same_types (INT_FAST8_MAX, (int_fast8_t) 0 + 0);
17090 +
17091 +int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX };
17092 +verify (TYPE_MINIMUM (int_fast16_t) == INT_FAST16_MIN);
17093 +verify (TYPE_MAXIMUM (int_fast16_t) == INT_FAST16_MAX);
17094 +verify_same_types (INT_FAST16_MIN, (int_fast16_t) 0 + 0);
17095 +verify_same_types (INT_FAST16_MAX, (int_fast16_t) 0 + 0);
17096 +
17097 +int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX };
17098 +verify (TYPE_MINIMUM (int_fast32_t) == INT_FAST32_MIN);
17099 +verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX);
17100 +verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0);
17101 +verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0);
17102 +
17103 +#ifdef INT_FAST64_MAX
17104 +int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX };
17105 +verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN);
17106 +verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX);
17107 +verify_same_types (INT_FAST64_MIN, (int_fast64_t) 0 + 0);
17108 +verify_same_types (INT_FAST64_MAX, (int_fast64_t) 0 + 0);
17109 +#endif
17110 +
17111 +uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX };
17112 +verify (TYPE_MAXIMUM (uint_fast8_t) == UINT_FAST8_MAX);
17113 +verify_same_types (UINT_FAST8_MAX, (uint_fast8_t) 0 + 0);
17114 +
17115 +uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX };
17116 +verify (TYPE_MAXIMUM (uint_fast16_t) == UINT_FAST16_MAX);
17117 +verify_same_types (UINT_FAST16_MAX, (uint_fast16_t) 0 + 0);
17118 +
17119 +uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX };
17120 +verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX);
17121 +verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0);
17122 +
17123 +#ifdef UINT_FAST64_MAX
17124 +uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX };
17125 +verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX);
17126 +verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0);
17127 +#endif
17128 +
17129 +#if INT_FAST8_MIN && INT_FAST8_MAX && INT_FAST16_MIN && INT_FAST16_MAX && INT_FAST32_MIN && INT_FAST32_MAX
17130 +/* ok */
17131 +#else
17132 +err or;
17133 +#endif
17134 +
17135 +#if UINT_FAST8_MAX && UINT_FAST16_MAX && UINT_FAST32_MAX
17136 +/* ok */
17137 +#else
17138 +err or;
17139 +#endif
17140 +
17141 +/* 7.18.1.4. Integer types capable of holding object pointers */
17142 +/* 7.18.2.4. Limits of integer types capable of holding object pointers */
17143 +
17144 +intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX };
17145 +verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN);
17146 +verify (TYPE_MAXIMUM (intptr_t) == INTPTR_MAX);
17147 +verify_same_types (INTPTR_MIN, (intptr_t) 0 + 0);
17148 +verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0);
17149 +
17150 +uintptr_t h[2] = { 17, UINTPTR_MAX };
17151 +verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX);
17152 +verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0);
17153 +
17154 +#if INTPTR_MIN && INTPTR_MAX && UINTPTR_MAX
17155 +/* ok */
17156 +#else
17157 +err or;
17158 +#endif
17159 +
17160 +/* 7.18.1.5. Greatest-width integer types */
17161 +/* 7.18.2.5. Limits of greatest-width integer types */
17162 +
17163 +intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX };
17164 +verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN);
17165 +verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX);
17166 +verify_same_types (INTMAX_MIN, (intmax_t) 0 + 0);
17167 +verify_same_types (INTMAX_MAX, (intmax_t) 0 + 0);
17168 +
17169 +uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX };
17170 +verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX);
17171 +verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0);
17172 +
17173 +/* As of 2007, Sun C and HP-UX 10.20 cc don't support 'long long' constants in
17174 +   the preprocessor.  */
17175 +#if !(defined __SUNPRO_C || (defined __hpux && !defined __GNUC__))
17176 +#if INTMAX_MIN && INTMAX_MAX && UINTMAX_MAX
17177 +/* ok */
17178 +#else
17179 +err or;
17180 +#endif
17181 +#endif
17182 +
17183 +/* 7.18.3. Limits of other integer types */
17184 +
17185 +#include <stddef.h>
17186 +
17187 +verify (TYPE_MINIMUM (ptrdiff_t) == PTRDIFF_MIN);
17188 +verify (TYPE_MAXIMUM (ptrdiff_t) == PTRDIFF_MAX);
17189 +verify_same_types (PTRDIFF_MIN, (ptrdiff_t) 0 + 0);
17190 +verify_same_types (PTRDIFF_MAX, (ptrdiff_t) 0 + 0);
17191 +
17192 +#if PTRDIFF_MIN && PTRDIFF_MAX
17193 +/* ok */
17194 +#else
17195 +err or;
17196 +#endif
17197 +
17198 +#include <signal.h>
17199 +
17200 +verify (TYPE_MINIMUM (sig_atomic_t) == SIG_ATOMIC_MIN);
17201 +verify (TYPE_MAXIMUM (sig_atomic_t) == SIG_ATOMIC_MAX);
17202 +verify_same_types (SIG_ATOMIC_MIN, (sig_atomic_t) 0 + 0);
17203 +verify_same_types (SIG_ATOMIC_MAX, (sig_atomic_t) 0 + 0);
17204 +
17205 +#if SIG_ATOMIC_MIN != 17 && SIG_ATOMIC_MAX
17206 +/* ok */
17207 +#else
17208 +err or;
17209 +#endif
17210 +
17211 +verify (TYPE_MAXIMUM (size_t) == SIZE_MAX);
17212 +verify_same_types (SIZE_MAX, (size_t) 0 + 0);
17213 +
17214 +#if SIZE_MAX
17215 +/* ok */
17216 +#else
17217 +err or;
17218 +#endif
17219 +
17220 +#if HAVE_WCHAR_T
17221 +verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN);
17222 +verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX);
17223 +verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0);
17224 +verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0);
17225 +
17226 +# if WCHAR_MIN != 17 && WCHAR_MAX
17227 +/* ok */
17228 +# else
17229 +err or;
17230 +# endif
17231 +#endif
17232 +
17233 +#if HAVE_WINT_T
17234 +# include <wchar.h>
17235 +
17236 +verify (TYPE_MINIMUM (wint_t) == WINT_MIN);
17237 +verify (TYPE_MAXIMUM (wint_t) == WINT_MAX);
17238 +verify_same_types (WINT_MIN, (wint_t) 0 + 0);
17239 +verify_same_types (WINT_MAX, (wint_t) 0 + 0);
17240 +
17241 +# if WINT_MIN != 17 && WINT_MAX
17242 +/* ok */
17243 +# else
17244 +err or;
17245 +# endif
17246 +#endif
17247 +
17248 +/* 7.18.4. Macros for integer constants */
17249 +
17250 +verify (INT8_C (17) == 17);
17251 +verify_same_types (INT8_C (17), (int_least8_t)0 + 0);
17252 +verify (UINT8_C (17) == 17);
17253 +verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0);
17254 +
17255 +verify (INT16_C (17) == 17);
17256 +verify_same_types (INT16_C (17), (int_least16_t)0 + 0);
17257 +verify (UINT16_C (17) == 17);
17258 +verify_same_types (UINT16_C (17), (uint_least16_t)0 + 0);
17259 +
17260 +verify (INT32_C (17) == 17);
17261 +verify_same_types (INT32_C (17), (int_least32_t)0 + 0);
17262 +verify (UINT32_C (17) == 17);
17263 +verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0);
17264 +
17265 +#ifdef INT64_C
17266 +verify (INT64_C (17) == 17);
17267 +verify_same_types (INT64_C (17), (int_least64_t)0 + 0);
17268 +#endif
17269 +#ifdef UINT64_C
17270 +verify (UINT64_C (17) == 17);
17271 +verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0);
17272 +#endif
17273 +
17274 +verify (INTMAX_C (17) == 17);
17275 +verify_same_types (INTMAX_C (17), (intmax_t)0 + 0);
17276 +verify (UINTMAX_C (17) == 17);
17277 +verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
17278 +
17279 +
17280 +int
17281 +main ()
17282 +{
17283 +  return 0;
17284 +}
17285 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-stdio.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdio.c
17286 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-stdio.c        1970-01-01 01:00:00.000000000 +0100
17287 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdio.c      2008-10-09 15:24:53.000000000 +0100
17288 @@ -0,0 +1,30 @@
17289 +/* Test of <stdio.h> substitute.
17290 +   Copyright (C) 2007 Free Software Foundation, Inc.
17291 +
17292 +   This program is free software: you can redistribute it and/or modify
17293 +   it under the terms of the GNU General Public License as published by
17294 +   the Free Software Foundation; either version 3 of the License, or
17295 +   (at your option) any later version.
17296 +
17297 +   This program is distributed in the hope that it will be useful,
17298 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17299 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17300 +   GNU General Public License for more details.
17301 +
17302 +   You should have received a copy of the GNU General Public License
17303 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17304 +
17305 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
17306 +
17307 +#include <config.h>
17308 +
17309 +#include <stdio.h>
17310 +
17311 +/* Check that the various SEEK_* macros are defined.  */
17312 +int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
17313 +
17314 +int
17315 +main ()
17316 +{
17317 +  return 0;
17318 +}
17319 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-stdlib.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdlib.c
17320 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-stdlib.c       1970-01-01 01:00:00.000000000 +0100
17321 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdlib.c     2008-10-09 15:24:53.000000000 +0100
17322 @@ -0,0 +1,37 @@
17323 +/* Test of <stdlib.h> substitute.
17324 +   Copyright (C) 2007 Free Software Foundation, Inc.
17325 +
17326 +   This program is free software: you can redistribute it and/or modify
17327 +   it under the terms of the GNU General Public License as published by
17328 +   the Free Software Foundation; either version 3 of the License, or
17329 +   (at your option) any later version.
17330 +
17331 +   This program is distributed in the hope that it will be useful,
17332 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17333 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17334 +   GNU General Public License for more details.
17335 +
17336 +   You should have received a copy of the GNU General Public License
17337 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17338 +
17339 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
17340 +
17341 +#include <config.h>
17342 +
17343 +#include <stdlib.h>
17344 +
17345 +int exitcode;
17346 +
17347 +int
17348 +main ()
17349 +{
17350 +  /* Check that some macros are defined and different integer constants.  */
17351 +  switch (exitcode)
17352 +    {
17353 +    case EXIT_SUCCESS:
17354 +    case EXIT_FAILURE:
17355 +      break;
17356 +    }
17357 +
17358 +  return 0;
17359 +}
17360 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-sys_socket.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-sys_socket.c
17361 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-sys_socket.c   1970-01-01 01:00:00.000000000 +0100
17362 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-sys_socket.c 2008-10-09 15:24:53.000000000 +0100
17363 @@ -0,0 +1,47 @@
17364 +/* Test of <sys/socket.h> substitute.
17365 +   Copyright (C) 2007 Free Software Foundation, Inc.
17366 +
17367 +   This program is free software: you can redistribute it and/or modify
17368 +   it under the terms of the GNU General Public License as published by
17369 +   the Free Software Foundation; either version 3 of the License, or
17370 +   (at your option) any later version.
17371 +
17372 +   This program is distributed in the hope that it will be useful,
17373 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17374 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17375 +   GNU General Public License for more details.
17376 +
17377 +   You should have received a copy of the GNU General Public License
17378 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17379 +
17380 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
17381 +
17382 +#include <config.h>
17383 +
17384 +#include <sys/socket.h>
17385 +
17386 +#include <errno.h>
17387 +
17388 +#if HAVE_SHUTDOWN
17389 +/* Check some integer constant expressions.  */
17390 +int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
17391 +#endif
17392 +
17393 +int
17394 +main ()
17395 +{
17396 +  /* Check some errno values.  */
17397 +  switch (0)
17398 +    {
17399 +    case ENOTSOCK:
17400 +    case EADDRINUSE:
17401 +    case ENETRESET:
17402 +    case ECONNABORTED:
17403 +    case ECONNRESET:
17404 +    case ENOTCONN:
17405 +    case ESHUTDOWN:
17406 +      break;
17407 +    }
17408 +
17409 +  return 0;
17410 +}
17411 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-unistd.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-unistd.c
17412 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-unistd.c       1970-01-01 01:00:00.000000000 +0100
17413 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-unistd.c     2008-10-09 15:24:53.000000000 +0100
17414 @@ -0,0 +1,44 @@
17415 +/* Test of <unistd.h> substitute.
17416 +   Copyright (C) 2007 Free Software Foundation, Inc.
17417 +
17418 +   This program is free software: you can redistribute it and/or modify
17419 +   it under the terms of the GNU General Public License as published by
17420 +   the Free Software Foundation; either version 3 of the License, or
17421 +   (at your option) any later version.
17422 +
17423 +   This program is distributed in the hope that it will be useful,
17424 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17425 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17426 +   GNU General Public License for more details.
17427 +
17428 +   You should have received a copy of the GNU General Public License
17429 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17430 +
17431 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
17432 +
17433 +#include <config.h>
17434 +
17435 +#include <unistd.h>
17436 +
17437 +/* Check that the various SEEK_* macros are defined.  */
17438 +int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
17439 +
17440 +/* Check that the types are all defined.  */
17441 +size_t t1;
17442 +ssize_t t2;
17443 +#ifdef TODO /* Not implemented in gnulib yet */
17444 +uid_t t3;
17445 +gid_t t4;
17446 +#endif
17447 +off_t t5;
17448 +pid_t t6;
17449 +#ifdef TODO
17450 +useconds_t t7;
17451 +intptr_t t8;
17452 +#endif
17453 +
17454 +int
17455 +main ()
17456 +{
17457 +  return 0;
17458 +}
17459 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-vasnprintf.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vasnprintf.c
17460 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-vasnprintf.c   1970-01-01 01:00:00.000000000 +0100
17461 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vasnprintf.c 2008-10-09 15:24:53.000000000 +0100
17462 @@ -0,0 +1,128 @@
17463 +/* Test of vasnprintf() and asnprintf() functions.
17464 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
17465 +
17466 +   This program is free software: you can redistribute it and/or modify
17467 +   it under the terms of the GNU General Public License as published by
17468 +   the Free Software Foundation; either version 3 of the License, or
17469 +   (at your option) any later version.
17470 +
17471 +   This program is distributed in the hope that it will be useful,
17472 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17473 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17474 +   GNU General Public License for more details.
17475 +
17476 +   You should have received a copy of the GNU General Public License
17477 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17478 +
17479 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
17480 +
17481 +#include <config.h>
17482 +
17483 +#include "vasnprintf.h"
17484 +
17485 +#include <stdarg.h>
17486 +#include <stdio.h>
17487 +#include <stdlib.h>
17488 +#include <string.h>
17489 +
17490 +#define ASSERT(expr) \
17491 +  do                                                                        \
17492 +    {                                                                       \
17493 +      if (!(expr))                                                          \
17494 +        {                                                                   \
17495 +          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
17496 +          fflush (stderr);                                                  \
17497 +          abort ();                                                         \
17498 +        }                                                                   \
17499 +    }                                                                       \
17500 +  while (0)
17501 +
17502 +static char *
17503 +my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
17504 +{
17505 +  va_list args;
17506 +  char *ret;
17507 +
17508 +  va_start (args, format);
17509 +  ret = vasnprintf (resultbuf, lengthp, format, args);
17510 +  va_end (args);
17511 +  return ret;
17512 +}
17513 +
17514 +static void
17515 +test_vasnprintf ()
17516 +{
17517 +  char buf[8];
17518 +  int size;
17519 +
17520 +  for (size = 0; size <= 8; size++)
17521 +    {
17522 +      size_t length = size;
17523 +      char *result = my_asnprintf (NULL, &length, "%d", 12345);
17524 +      ASSERT (result != NULL);
17525 +      ASSERT (strcmp (result, "12345") == 0);
17526 +      ASSERT (length == 5);
17527 +      free (result);
17528 +    }
17529 +
17530 +  for (size = 0; size <= 8; size++)
17531 +    {
17532 +      size_t length;
17533 +      char *result;
17534 +
17535 +      memcpy (buf, "DEADBEEF", 8);
17536 +      length = size;
17537 +      result = my_asnprintf (buf, &length, "%d", 12345);
17538 +      ASSERT (result != NULL);
17539 +      ASSERT (strcmp (result, "12345") == 0);
17540 +      ASSERT (length == 5);
17541 +      if (size < 6)
17542 +       ASSERT (result != buf);
17543 +      ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
17544 +      if (result != buf)
17545 +       free (result);
17546 +    }
17547 +}
17548 +
17549 +static void
17550 +test_asnprintf ()
17551 +{
17552 +  char buf[8];
17553 +  int size;
17554 +
17555 +  for (size = 0; size <= 8; size++)
17556 +    {
17557 +      size_t length = size;
17558 +      char *result = asnprintf (NULL, &length, "%d", 12345);
17559 +      ASSERT (result != NULL);
17560 +      ASSERT (strcmp (result, "12345") == 0);
17561 +      ASSERT (length == 5);
17562 +      free (result);
17563 +    }
17564 +
17565 +  for (size = 0; size <= 8; size++)
17566 +    {
17567 +      size_t length;
17568 +      char *result;
17569 +
17570 +      memcpy (buf, "DEADBEEF", 8);
17571 +      length = size;
17572 +      result = asnprintf (buf, &length, "%d", 12345);
17573 +      ASSERT (result != NULL);
17574 +      ASSERT (strcmp (result, "12345") == 0);
17575 +      ASSERT (length == 5);
17576 +      if (size < 6)
17577 +       ASSERT (result != buf);
17578 +      ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
17579 +      if (result != buf)
17580 +       free (result);
17581 +    }
17582 +}
17583 +
17584 +int
17585 +main (int argc, char *argv[])
17586 +{
17587 +  test_vasnprintf ();
17588 +  test_asnprintf ();
17589 +  return 0;
17590 +}
17591 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-vc-list-files-cvs.sh gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-cvs.sh
17592 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-vc-list-files-cvs.sh   1970-01-01 01:00:00.000000000 +0100
17593 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-cvs.sh 2008-10-09 15:24:53.000000000 +0100
17594 @@ -0,0 +1,62 @@
17595 +#!/bin/sh
17596 +# Unit tests for vc-list-files
17597 +# Copyright (C) 2008 Free Software Foundation, Inc.
17598 +# This file is part of the GNUlib Library.
17599 +#
17600 +# This program is free software: you can redistribute it and/or modify
17601 +# it under the terms of the GNU General Public License as published by
17602 +# the Free Software Foundation; either version 3 of the License, or
17603 +# (at your option) any later version.
17604 +#
17605 +# This program is distributed in the hope that it will be useful,
17606 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
17607 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17608 +# GNU General Public License for more details.
17609 +#
17610 +# You should have received a copy of the GNU General Public License
17611 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17612 +
17613 +tmpdir=vc-cvs-$$
17614 +trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0
17615 +trap '(exit $?); exit $?' 1 2 13 15
17616 +
17617 +if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
17618 +  compare() { diff -u "$@"; }
17619 +elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
17620 +  compare() { cmp -s "$@"; }
17621 +else
17622 +  compare() { cmp "$@"; }
17623 +fi
17624 +
17625 +repo=`pwd`/$tmpdir/repo
17626 +
17627 +fail=0
17628 +for i in with-cvsu without; do
17629 +  # On the first iteration, test using cvsu, if it's in your path.
17630 +  # On the second iteration, ensure that cvsu fails, so we'll
17631 +  # exercise the awk-using code.
17632 +  if test $i = without; then
17633 +    printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu
17634 +    chmod a+x cvsu
17635 +    PATH=`pwd`:$PATH
17636 +    export PATH
17637 +  fi
17638 +  ok=0
17639 +  mkdir $tmpdir && cd $tmpdir &&
17640 +    # without cvs, skip the test
17641 +    # The double use of 'exit' is needed for the reference to $? inside the trap.
17642 +    { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \
17643 +      || { echo "Skipping test: cvs not found in PATH"; (exit 77); exit 77; }; } &&
17644 +    mkdir w && cd w &&
17645 +    mkdir d &&
17646 +    touch d/a b c &&
17647 +    cvs -Q -d "$repo" import -m imp m M M0 &&
17648 +    cvs -Q -d "$repo" co m && cd m &&
17649 +    printf '%s\n' b c d/a > expected &&
17650 +    vc-list-files | sort > actual &&
17651 +    compare expected actual &&
17652 +    ok=1
17653 +  test $ok = 0 && fail=1
17654 +done
17655 +
17656 +(exit $fail); exit $fail
17657 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-vc-list-files-git.sh gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-git.sh
17658 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-vc-list-files-git.sh   1970-01-01 01:00:00.000000000 +0100
17659 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-git.sh 2008-10-09 15:24:53.000000000 +0100
17660 @@ -0,0 +1,46 @@
17661 +#!/bin/sh
17662 +# Unit tests for vc-list-files
17663 +# Copyright (C) 2008 Free Software Foundation, Inc.
17664 +# This file is part of the GNUlib Library.
17665 +#
17666 +# This program is free software: you can redistribute it and/or modify
17667 +# it under the terms of the GNU General Public License as published by
17668 +# the Free Software Foundation; either version 3 of the License, or
17669 +# (at your option) any later version.
17670 +#
17671 +# This program is distributed in the hope that it will be useful,
17672 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
17673 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17674 +# GNU General Public License for more details.
17675 +#
17676 +# You should have received a copy of the GNU General Public License
17677 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17678 +
17679 +if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
17680 +  compare() { diff -u "$@"; }
17681 +elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
17682 +  compare() { cmp -s "$@"; }
17683 +else
17684 +  compare() { cmp "$@"; }
17685 +fi
17686 +
17687 +tmpdir=vc-git-$$
17688 +trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0
17689 +trap '(exit $?); exit $?' 1 2 13 15
17690 +
17691 +fail=1
17692 +mkdir $tmpdir && cd $tmpdir &&
17693 +  # without git, skip the test
17694 +  # The double use of 'exit' is needed for the reference to $? inside the trap.
17695 +  { ( git init -q ) > /dev/null 2>&1 \
17696 +    || { echo "Skipping test: git not found in PATH"; (exit 77); exit 77; }; } &&
17697 +  mkdir d &&
17698 +  touch d/a b c &&
17699 +  git add . > /dev/null &&
17700 +  git commit -q -a -m log &&
17701 +  printf '%s\n' b c d/a > expected &&
17702 +  vc-list-files > actual &&
17703 +  compare expected actual &&
17704 +  fail=0
17705 +
17706 +(exit $fail); exit $fail
17707 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/test-wchar.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-wchar.c
17708 --- gtk-vnc-0.3.7.dan3/gnulib/tests/test-wchar.c        1970-01-01 01:00:00.000000000 +0100
17709 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-wchar.c      2008-10-09 15:24:53.000000000 +0100
17710 @@ -0,0 +1,31 @@
17711 +/* Test of <wchar.h> substitute.
17712 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
17713 +
17714 +   This program is free software: you can redistribute it and/or modify
17715 +   it under the terms of the GNU General Public License as published by
17716 +   the Free Software Foundation; either version 3 of the License, or
17717 +   (at your option) any later version.
17718 +
17719 +   This program is distributed in the hope that it will be useful,
17720 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17721 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17722 +   GNU General Public License for more details.
17723 +
17724 +   You should have received a copy of the GNU General Public License
17725 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17726 +
17727 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
17728 +
17729 +#include <config.h>
17730 +
17731 +#include <wchar.h>
17732 +
17733 +/* Check that the types wchar_t and wint_t are defined.  */
17734 +wchar_t a = 'c';
17735 +wint_t b = 'x';
17736 +
17737 +int
17738 +main ()
17739 +{
17740 +  return 0;
17741 +}
17742 diff -urN gtk-vnc-0.3.7.dan3/gnulib/tests/verify.h gtk-vnc-0.3.7.gnulib/gnulib/tests/verify.h
17743 --- gtk-vnc-0.3.7.dan3/gnulib/tests/verify.h    1970-01-01 01:00:00.000000000 +0100
17744 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/verify.h  2008-10-09 15:24:53.000000000 +0100
17745 @@ -0,0 +1,140 @@
17746 +/* Compile-time assert-like macros.
17747 +
17748 +   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
17749 +
17750 +   This program is free software: you can redistribute it and/or modify
17751 +   it under the terms of the GNU General Public License as published by
17752 +   the Free Software Foundation; either version 3 of the License, or
17753 +   (at your option) any later version.
17754 +
17755 +   This program is distributed in the hope that it will be useful,
17756 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17757 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17758 +   GNU General Public License for more details.
17759 +
17760 +   You should have received a copy of the GNU General Public License
17761 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17762 +
17763 +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
17764 +
17765 +#ifndef VERIFY_H
17766 +# define VERIFY_H 1
17767 +
17768 +/* Each of these macros verifies that its argument R is nonzero.  To
17769 +   be portable, R should be an integer constant expression.  Unlike
17770 +   assert (R), there is no run-time overhead.
17771 +
17772 +   There are two macros, since no single macro can be used in all
17773 +   contexts in C.  verify_true (R) is for scalar contexts, including
17774 +   integer constant expression contexts.  verify (R) is for declaration
17775 +   contexts, e.g., the top level.
17776 +
17777 +   Symbols ending in "__" are private to this header.
17778 +
17779 +   The code below uses several ideas.
17780 +
17781 +   * The first step is ((R) ? 1 : -1).  Given an expression R, of
17782 +     integral or boolean or floating-point type, this yields an
17783 +     expression of integral type, whose value is later verified to be
17784 +     constant and nonnegative.
17785 +
17786 +   * Next this expression W is wrapped in a type
17787 +     struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }.
17788 +     If W is negative, this yields a compile-time error.  No compiler can
17789 +     deal with a bit-field of negative size.
17790 +
17791 +     One might think that an array size check would have the same
17792 +     effect, that is, that the type struct { unsigned int dummy[W]; }
17793 +     would work as well.  However, inside a function, some compilers
17794 +     (such as C++ compilers and GNU C) allow local parameters and
17795 +     variables inside array size expressions.  With these compilers,
17796 +     an array size check would not properly diagnose this misuse of
17797 +     the verify macro:
17798 +
17799 +       void function (int n) { verify (n < 0); }
17800 +
17801 +   * For the verify macro, the struct verify_type__ will need to
17802 +     somehow be embedded into a declaration.  To be portable, this
17803 +     declaration must declare an object, a constant, a function, or a
17804 +     typedef name.  If the declared entity uses the type directly,
17805 +     such as in
17806 +
17807 +       struct dummy {...};
17808 +       typedef struct {...} dummy;
17809 +       extern struct {...} *dummy;
17810 +       extern void dummy (struct {...} *);
17811 +       extern struct {...} *dummy (void);
17812 +
17813 +     two uses of the verify macro would yield colliding declarations
17814 +     if the entity names are not disambiguated.  A workaround is to
17815 +     attach the current line number to the entity name:
17816 +
17817 +       #define GL_CONCAT0(x, y) x##y
17818 +       #define GL_CONCAT(x, y) GL_CONCAT0 (x, y)
17819 +       extern struct {...} * GL_CONCAT(dummy,__LINE__);
17820 +
17821 +     But this has the problem that two invocations of verify from
17822 +     within the same macro would collide, since the __LINE__ value
17823 +     would be the same for both invocations.
17824 +
17825 +     A solution is to use the sizeof operator.  It yields a number,
17826 +     getting rid of the identity of the type.  Declarations like
17827 +
17828 +       extern int dummy [sizeof (struct {...})];
17829 +       extern void dummy (int [sizeof (struct {...})]);
17830 +       extern int (*dummy (void)) [sizeof (struct {...})];
17831 +
17832 +     can be repeated.
17833 +
17834 +   * Should the implementation use a named struct or an unnamed struct?
17835 +     Which of the following alternatives can be used?
17836 +
17837 +       extern int dummy [sizeof (struct {...})];
17838 +       extern int dummy [sizeof (struct verify_type__ {...})];
17839 +       extern void dummy (int [sizeof (struct {...})]);
17840 +       extern void dummy (int [sizeof (struct verify_type__ {...})]);
17841 +       extern int (*dummy (void)) [sizeof (struct {...})];
17842 +       extern int (*dummy (void)) [sizeof (struct verify_type__ {...})];
17843 +
17844 +     In the second and sixth case, the struct type is exported to the
17845 +     outer scope; two such declarations therefore collide.  GCC warns
17846 +     about the first, third, and fourth cases.  So the only remaining
17847 +     possibility is the fifth case:
17848 +
17849 +       extern int (*dummy (void)) [sizeof (struct {...})];
17850 +
17851 +   * This implementation exploits the fact that GCC does not warn about
17852 +     the last declaration mentioned above.  If a future version of GCC
17853 +     introduces a warning for this, the problem could be worked around
17854 +     by using code specialized to GCC, e.g.,:
17855 +
17856 +       #if 4 <= __GNUC__
17857 +       # define verify(R) \
17858 +          extern int (* verify_function__ (void)) \
17859 +                     [__builtin_constant_p (R) && (R) ? 1 : -1]
17860 +       #endif
17861 +
17862 +   * In C++, any struct definition inside sizeof is invalid.
17863 +     Use a template type to work around the problem.  */
17864 +
17865 +
17866 +/* Verify requirement R at compile-time, as an integer constant expression.
17867 +   Return 1.  */
17868 +
17869 +# ifdef __cplusplus
17870 +template <int w>
17871 +  struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
17872 +#  define verify_true(R) \
17873 +     (!!sizeof (verify_type__<(R) ? 1 : -1>))
17874 +# else
17875 +#  define verify_true(R) \
17876 +     (!!sizeof \
17877 +      (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
17878 +# endif
17879 +
17880 +/* Verify requirement R at compile-time, as a declaration without a
17881 +   trailing ';'.  */
17882 +
17883 +# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)]
17884 +
17885 +#endif
17886 diff -urN gtk-vnc-0.3.7.dan3/link-warning.h gtk-vnc-0.3.7.gnulib/link-warning.h
17887 --- gtk-vnc-0.3.7.dan3/link-warning.h   1970-01-01 01:00:00.000000000 +0100
17888 +++ gtk-vnc-0.3.7.gnulib/link-warning.h 2008-10-09 15:24:52.000000000 +0100
17889 @@ -0,0 +1,28 @@
17890 +/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
17891 +   a linker warning on most glibc systems.
17892 +   We use a linker warning rather than a preprocessor warning, because
17893 +   #warning cannot be used inside macros.  */
17894 +#ifndef GL_LINK_WARNING
17895 +  /* This works on platforms with GNU ld and ELF object format.
17896 +     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
17897 +     Testing __ELF__ guarantees the ELF object format.
17898 +     Testing __GNUC__ is necessary for the compound expression syntax.  */
17899 +# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
17900 +#  define GL_LINK_WARNING(message) \
17901 +     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
17902 +#  define GL_LINK_WARNING1(file, line, message) \
17903 +     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
17904 +#  define GL_LINK_WARNING2(file, line, message) \
17905 +     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
17906 +#  define GL_LINK_WARNING3(message) \
17907 +     ({ static const char warning[sizeof (message)]            \
17908 +          __attribute__ ((__unused__,                          \
17909 +                          __section__ (".gnu.warning"),                \
17910 +                          __aligned__ (1)))                    \
17911 +          = message "\n";                                      \
17912 +        (void)0;                                               \
17913 +     })
17914 +# else
17915 +#  define GL_LINK_WARNING(message) ((void) 0)
17916 +# endif
17917 +#endif