gtk-vnc with Dan's version 2 patch.
[fedora-mingw.git] / gtk-vnc / gtk-vnc-0.3.7-mingw32-gnulib-files.patch
1 diff -urN gtk-vnc-0.3.7.mingw/bootstrap gtk-vnc-0.3.7.gnulib/bootstrap
2 --- gtk-vnc-0.3.7.mingw/bootstrap       2008-10-09 12:19:03.000000000 +0100
3 +++ gtk-vnc-0.3.7.gnulib/bootstrap      2008-10-09 12:33:37.000000000 +0100
4 @@ -65,6 +65,10 @@
5  <$gnulib_tool || exit
6  
7  modules='
8 +recv
9 +send
10 +socket
11 +connect
12  getaddrinfo
13  vc-list-files
14  '
15 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/alloca.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/alloca.in.h
16 --- gtk-vnc-0.3.7.mingw/gnulib/lib/alloca.in.h  1970-01-01 01:00:00.000000000 +0100
17 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/alloca.in.h 2008-10-09 12:24:39.000000000 +0100
18 @@ -0,0 +1,56 @@
19 +/* Memory allocation on the stack.
20 +
21 +   Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software
22 +   Foundation, Inc.
23 +
24 +   This program is free software; you can redistribute it and/or modify it
25 +   under the terms of the GNU Lesser General Public License as published
26 +   by the Free Software Foundation; either version 2.1, or (at your option)
27 +   any later version.
28 +
29 +   This program is distributed in the hope that it will be useful,
30 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
31 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
32 +   General Public License for more details.
33 +
34 +   You should have received a copy of the GNU Lesser General Public
35 +   License along with this program; if not, write to the Free Software
36 +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
37 +   USA.  */
38 +
39 +/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
40 +   means there is a real alloca function.  */
41 +#ifndef _GL_ALLOCA_H
42 +#define _GL_ALLOCA_H
43 +
44 +/* alloca (N) returns a pointer to N bytes of memory
45 +   allocated on the stack, which will last until the function returns.
46 +   Use of alloca should be avoided:
47 +     - inside arguments of function calls - undefined behaviour,
48 +     - in inline functions - the allocation may actually last until the
49 +       calling function returns,
50 +     - for huge N (say, N >= 65536) - you never know how large (or small)
51 +       the stack is, and when the stack cannot fulfill the memory allocation
52 +       request, the program just crashes.
53 + */
54 +
55 +#ifndef alloca
56 +# ifdef __GNUC__
57 +#  define alloca __builtin_alloca
58 +# elif defined _AIX
59 +#  define alloca __alloca
60 +# elif defined _MSC_VER
61 +#  include <malloc.h>
62 +#  define alloca _alloca
63 +# elif defined __DECC && defined __VMS
64 +#  define alloca __ALLOCA
65 +# else
66 +#  include <stddef.h>
67 +#  ifdef  __cplusplus
68 +extern "C"
69 +#  endif
70 +void *alloca (size_t);
71 +# endif
72 +#endif
73 +
74 +#endif /* _GL_ALLOCA_H */
75 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/arpa_inet.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/arpa_inet.in.h
76 --- gtk-vnc-0.3.7.mingw/gnulib/lib/arpa_inet.in.h       1970-01-01 01:00:00.000000000 +0100
77 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/arpa_inet.in.h      2008-10-09 12:24:39.000000000 +0100
78 @@ -0,0 +1,80 @@
79 +/* A GNU-like <arpa/inet.h>.
80 +
81 +   Copyright (C) 2005-2006, 2008 Free Software Foundation, Inc.
82 +
83 +   This program is free software; you can redistribute it and/or modify
84 +   it under the terms of the GNU Lesser General Public License as published by
85 +   the Free Software Foundation; either version 2.1, or (at your option)
86 +   any later version.
87 +
88 +   This program is distributed in the hope that it will be useful,
89 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
90 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
91 +   GNU Lesser General Public License for more details.
92 +
93 +   You should have received a copy of the GNU Lesser General Public License
94 +   along with this program; if not, write to the Free Software Foundation,
95 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
96 +
97 +#ifndef _GL_ARPA_INET_H
98 +
99 +/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
100 +   under MinGW. */
101 +#include <sys/socket.h>
102 +
103 +#if @HAVE_ARPA_INET_H@
104 +
105 +@PRAGMA_SYSTEM_HEADER@
106 +
107 +/* The include_next requires a split double-inclusion guard.  */
108 +# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
109 +
110 +#endif
111 +
112 +#ifndef _GL_ARPA_INET_H
113 +#define _GL_ARPA_INET_H
114 +
115 +/* The definition of GL_LINK_WARNING is copied here.  */
116 +
117 +#if @GNULIB_INET_NTOP@
118 +# if !@HAVE_DECL_INET_NTOP@
119 +/* Converts an internet address from internal format to a printable,
120 +   presentable format.
121 +   AF is an internet address family, such as AF_INET or AF_INET6.
122 +   SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
123 +   (for AF_INET6).
124 +   DST points to a buffer having room for CNT bytes.
125 +   The printable representation of the address (in numeric form, not
126 +   surrounded by [...], no reverse DNS is done) is placed in DST, and
127 +   DST is returned.  If an error occurs, the return value is NULL and
128 +   errno is set.  If CNT bytes are not sufficient to hold the result,
129 +   the return value is NULL and errno is set to ENOSPC.  A good value
130 +   for CNT is 46.
131 +
132 +   For more details, see the POSIX:2001 specification
133 +   <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
134 +extern const char *inet_ntop (int af, const void *restrict src,
135 +                             char *restrict dst, socklen_t cnt);
136 +# endif
137 +#elif defined GNULIB_POSIXCHECK
138 +# undef inet_ntop
139 +# define inet_ntop(af,src,dst,cnt) \
140 +    (GL_LINK_WARNING ("inet_ntop is unportable - " \
141 +                      "use gnulib module inet_ntop for portability"), \
142 +     inet_ntop (af, src, dst, cnt))
143 +#endif
144 +
145 +#if @GNULIB_INET_PTON@
146 +# if !@HAVE_DECL_INET_PTON@
147 +extern int inet_pton (int af, const char *restrict src, void *restrict dst);
148 +# endif
149 +#elif defined GNULIB_POSIXCHECK
150 +# undef inet_pton
151 +# define inet_pton(af,src,dst) \
152 +  (GL_LINK_WARNING ("inet_pton is unportable - " \
153 +                   "use gnulib module inet_pton for portability"), \
154 +   inet_pton (af, src, dst))
155 +#endif
156 +
157 +#endif /* _GL_ARPA_INET_H */
158 +#endif /* _GL_ARPA_INET_H */
159 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/asnprintf.c gtk-vnc-0.3.7.gnulib/gnulib/lib/asnprintf.c
160 --- gtk-vnc-0.3.7.mingw/gnulib/lib/asnprintf.c  1970-01-01 01:00:00.000000000 +0100
161 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/asnprintf.c 2008-10-09 12:24:39.000000000 +0100
162 @@ -0,0 +1,35 @@
163 +/* Formatted output to strings.
164 +   Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
165 +
166 +   This program is free software; you can redistribute it and/or modify
167 +   it under the terms of the GNU Lesser General Public License as published by
168 +   the Free Software Foundation; either version 2.1, or (at your option)
169 +   any later version.
170 +
171 +   This program is distributed in the hope that it will be useful,
172 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
173 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
174 +   GNU Lesser General Public License for more details.
175 +
176 +   You should have received a copy of the GNU Lesser General Public License along
177 +   with this program; if not, write to the Free Software Foundation,
178 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
179 +
180 +#include <config.h>
181 +
182 +/* Specification.  */
183 +#include "vasnprintf.h"
184 +
185 +#include <stdarg.h>
186 +
187 +char *
188 +asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
189 +{
190 +  va_list args;
191 +  char *result;
192 +
193 +  va_start (args, format);
194 +  result = vasnprintf (resultbuf, lengthp, format, args);
195 +  va_end (args);
196 +  return result;
197 +}
198 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/dummy.c gtk-vnc-0.3.7.gnulib/gnulib/lib/dummy.c
199 --- gtk-vnc-0.3.7.mingw/gnulib/lib/dummy.c      1970-01-01 01:00:00.000000000 +0100
200 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/dummy.c     2008-10-09 12:24:39.000000000 +0100
201 @@ -0,0 +1,42 @@
202 +/* A dummy file, to prevent empty libraries from breaking builds.
203 +   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
204 +
205 +   This program is free software: you can redistribute it and/or modify
206 +   it under the terms of the GNU Lesser General Public License as published by
207 +   the Free Software Foundation; either version 2.1 of the License, or
208 +   (at your option) any later version.
209 +
210 +   This program is distributed in the hope that it will be useful,
211 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
212 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
213 +   GNU Lesser General Public License for more details.
214 +
215 +   You should have received a copy of the GNU Lesser General Public License
216 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
217 +
218 +/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
219 +   libraries without any object files.  You might get an error like:
220 +
221 +   > ar cru .libs/libgl.a
222 +   > ar: no archive members specified
223 +
224 +   Compiling this file, and adding its object file to the library, will
225 +   prevent the library from being empty.  */
226 +
227 +/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
228 +   that don't export any symbol.  You might get an error like:
229 +
230 +   > cc ... libgnu.a
231 +   > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
232 +
233 +   Compiling this file, and adding its object file to the library, will
234 +   prevent the library from exporting no symbols.  */
235 +
236 +#ifdef __sun
237 +/* This declaration ensures that the library will export at least 1 symbol.  */
238 +int gl_dummy_symbol;
239 +#else
240 +/* This declaration is solely to ensure that after preprocessing
241 +   this file is never empty.  */
242 +typedef int dummy;
243 +#endif
244 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/errno.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/errno.in.h
245 --- gtk-vnc-0.3.7.mingw/gnulib/lib/errno.in.h   1970-01-01 01:00:00.000000000 +0100
246 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/errno.in.h  2008-10-09 12:24:39.000000000 +0100
247 @@ -0,0 +1,153 @@
248 +/* A POSIX-like <errno.h>.
249 +
250 +   Copyright (C) 2008 Free Software Foundation, Inc.
251 +
252 +   This program is free software; you can redistribute it and/or modify
253 +   it under the terms of the GNU Lesser General Public License as published by
254 +   the Free Software Foundation; either version 2.1, or (at your option)
255 +   any later version.
256 +
257 +   This program is distributed in the hope that it will be useful,
258 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
259 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
260 +   GNU Lesser General Public License for more details.
261 +
262 +   You should have received a copy of the GNU Lesser General Public License
263 +   along with this program; if not, write to the Free Software Foundation,
264 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
265 +
266 +#ifndef _GL_ERRNO_H
267 +
268 +@PRAGMA_SYSTEM_HEADER@
269 +
270 +/* The include_next requires a split double-inclusion guard.  */
271 +#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
272 +
273 +#ifndef _GL_ERRNO_H
274 +#define _GL_ERRNO_H
275 +
276 +
277 +/* On native Windows platforms, many macros are not defined.  */
278 +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
279 +
280 +/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value.  */
281 +#  define EWOULDBLOCK     EAGAIN
282 +
283 +/* Values >= 100 seem safe to use.  */
284 +#  define ETXTBSY   100
285 +#  define GNULIB_defined_ETXTBSY 1
286 +
287 +/* These are intentionally the same values as the WSA* error numbers, defined
288 +   in <winsock2.h>.  */
289 +#  define EINPROGRESS     10036
290 +#  define EALREADY        10037
291 +#  define ENOTSOCK        10038
292 +#  define EDESTADDRREQ    10039
293 +#  define EMSGSIZE        10040
294 +#  define EPROTOTYPE      10041
295 +#  define ENOPROTOOPT     10042
296 +#  define EPROTONOSUPPORT 10043
297 +#  define ESOCKTNOSUPPORT 10044  /* not required by POSIX */
298 +#  define EOPNOTSUPP      10045
299 +#  define EPFNOSUPPORT    10046  /* not required by POSIX */
300 +#  define EAFNOSUPPORT    10047
301 +#  define EADDRINUSE      10048
302 +#  define EADDRNOTAVAIL   10049
303 +#  define ENETDOWN        10050
304 +#  define ENETUNREACH     10051
305 +#  define ENETRESET       10052
306 +#  define ECONNABORTED    10053
307 +#  define ECONNRESET      10054
308 +#  define ENOBUFS         10055
309 +#  define EISCONN         10056
310 +#  define ENOTCONN        10057
311 +#  define ESHUTDOWN       10058  /* not required by POSIX */
312 +#  define ETOOMANYREFS    10059  /* not required by POSIX */
313 +#  define ETIMEDOUT       10060
314 +#  define ECONNREFUSED    10061
315 +#  define ELOOP           10062
316 +#  define EHOSTDOWN       10064  /* not required by POSIX */
317 +#  define EHOSTUNREACH    10065
318 +#  define EPROCLIM        10067  /* not required by POSIX */
319 +#  define EUSERS          10068  /* not required by POSIX */
320 +#  define EDQUOT          10069
321 +#  define ESTALE          10070
322 +#  define EREMOTE         10071  /* not required by POSIX */
323 +#  define GNULIB_defined_ESOCK 1
324 +
325 +# endif
326 +
327 +
328 +/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
329 +   EMULTIHOP, ENOLINK, EOVERFLOW are not defined.  */
330 +# if @EMULTIHOP_HIDDEN@
331 +#  define EMULTIHOP @EMULTIHOP_VALUE@
332 +#  define GNULIB_defined_EMULTIHOP 1
333 +# endif
334 +# if @ENOLINK_HIDDEN@
335 +#  define ENOLINK   @ENOLINK_VALUE@
336 +#  define GNULIB_defined_ENOLINK 1
337 +# endif
338 +# if @EOVERFLOW_HIDDEN@
339 +#  define EOVERFLOW @EOVERFLOW_VALUE@
340 +#  define GNULIB_defined_EOVERFLOW 1
341 +# endif
342 +
343 +
344 +/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
345 +   EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
346 +   Define them here.  Values >= 2000 seem safe to use: Solaris ESTALE = 151,
347 +   HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
348 +
349 +   Note: When one of these systems defines some of these macros some day,
350 +   binaries will have to be recompiled so that they recognizes the new
351 +   errno values from the system.  */
352 +
353 +# ifndef ENOMSG
354 +#  define ENOMSG    2000
355 +#  define GNULIB_defined_ENOMSG 1
356 +# endif
357 +
358 +# ifndef EIDRM
359 +#  define EIDRM     2001
360 +#  define GNULIB_defined_EIDRM 1
361 +# endif
362 +
363 +# ifndef ENOLINK
364 +#  define ENOLINK   2002
365 +#  define GNULIB_defined_ENOLINK 1
366 +# endif
367 +
368 +# ifndef EPROTO
369 +#  define EPROTO    2003
370 +#  define GNULIB_defined_EPROTO 1
371 +# endif
372 +
373 +# ifndef EMULTIHOP
374 +#  define EMULTIHOP 2004
375 +#  define GNULIB_defined_EMULTIHOP 1
376 +# endif
377 +
378 +# ifndef EBADMSG
379 +#  define EBADMSG   2005
380 +#  define GNULIB_defined_EBADMSG 1
381 +# endif
382 +
383 +# ifndef EOVERFLOW
384 +#  define EOVERFLOW 2006
385 +#  define GNULIB_defined_EOVERFLOW 1
386 +# endif
387 +
388 +# ifndef ENOTSUP
389 +#  define ENOTSUP   2007
390 +#  define GNULIB_defined_ENOTSUP 1
391 +# endif
392 +
393 +# ifndef ECANCELED
394 +#  define ECANCELED 2008
395 +#  define GNULIB_defined_ECANCELED 1
396 +# endif
397 +
398 +
399 +#endif /* _GL_ERRNO_H */
400 +#endif /* _GL_ERRNO_H */
401 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/float+.h gtk-vnc-0.3.7.gnulib/gnulib/lib/float+.h
402 --- gtk-vnc-0.3.7.mingw/gnulib/lib/float+.h     1970-01-01 01:00:00.000000000 +0100
403 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/float+.h    2008-10-09 12:24:39.000000000 +0100
404 @@ -0,0 +1,148 @@
405 +/* Supplemental information about the floating-point formats.
406 +   Copyright (C) 2007 Free Software Foundation, Inc.
407 +   Written by Bruno Haible <bruno@clisp.org>, 2007.
408 +
409 +   This program is free software; you can redistribute it and/or modify
410 +   it under the terms of the GNU Lesser General Public License as published by
411 +   the Free Software Foundation; either version 2.1, or (at your option)
412 +   any later version.
413 +
414 +   This program is distributed in the hope that it will be useful,
415 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
416 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
417 +   GNU Lesser General Public License for more details.
418 +
419 +   You should have received a copy of the GNU Lesser General Public License
420 +   along with this program; if not, write to the Free Software Foundation,
421 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
422 +
423 +#ifndef _FLOATPLUS_H
424 +#define _FLOATPLUS_H
425 +
426 +#include <float.h>
427 +#include <limits.h>
428 +
429 +/* Number of bits in the mantissa of a floating-point number, including the
430 +   "hidden bit".  */
431 +#if FLT_RADIX == 2
432 +# define FLT_MANT_BIT FLT_MANT_DIG
433 +# define DBL_MANT_BIT DBL_MANT_DIG
434 +# define LDBL_MANT_BIT LDBL_MANT_DIG
435 +#elif FLT_RADIX == 4
436 +# define FLT_MANT_BIT (FLT_MANT_DIG * 2)
437 +# define DBL_MANT_BIT (DBL_MANT_DIG * 2)
438 +# define LDBL_MANT_BIT (LDBL_MANT_DIG * 2)
439 +#elif FLT_RADIX == 16
440 +# define FLT_MANT_BIT (FLT_MANT_DIG * 4)
441 +# define DBL_MANT_BIT (DBL_MANT_DIG * 4)
442 +# define LDBL_MANT_BIT (LDBL_MANT_DIG * 4)
443 +#endif
444 +
445 +/* Bit mask that can be used to mask the exponent, as an unsigned number.  */
446 +#define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7)
447 +#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
448 +#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)
449 +
450 +/* Number of bits used for the exponent of a floating-point number, including
451 +   the exponent's sign.  */
452 +#define FLT_EXP_BIT \
453 +  (FLT_EXP_MASK < 0x100 ? 8 : \
454 +   FLT_EXP_MASK < 0x200 ? 9 : \
455 +   FLT_EXP_MASK < 0x400 ? 10 : \
456 +   FLT_EXP_MASK < 0x800 ? 11 : \
457 +   FLT_EXP_MASK < 0x1000 ? 12 : \
458 +   FLT_EXP_MASK < 0x2000 ? 13 : \
459 +   FLT_EXP_MASK < 0x4000 ? 14 : \
460 +   FLT_EXP_MASK < 0x8000 ? 15 : \
461 +   FLT_EXP_MASK < 0x10000 ? 16 : \
462 +   FLT_EXP_MASK < 0x20000 ? 17 : \
463 +   FLT_EXP_MASK < 0x40000 ? 18 : \
464 +   FLT_EXP_MASK < 0x80000 ? 19 : \
465 +   FLT_EXP_MASK < 0x100000 ? 20 : \
466 +   FLT_EXP_MASK < 0x200000 ? 21 : \
467 +   FLT_EXP_MASK < 0x400000 ? 22 : \
468 +   FLT_EXP_MASK < 0x800000 ? 23 : \
469 +   FLT_EXP_MASK < 0x1000000 ? 24 : \
470 +   FLT_EXP_MASK < 0x2000000 ? 25 : \
471 +   FLT_EXP_MASK < 0x4000000 ? 26 : \
472 +   FLT_EXP_MASK < 0x8000000 ? 27 : \
473 +   FLT_EXP_MASK < 0x10000000 ? 28 : \
474 +   FLT_EXP_MASK < 0x20000000 ? 29 : \
475 +   FLT_EXP_MASK < 0x40000000 ? 30 : \
476 +   FLT_EXP_MASK <= 0x7fffffff ? 31 : \
477 +   32)
478 +#define DBL_EXP_BIT \
479 +  (DBL_EXP_MASK < 0x100 ? 8 : \
480 +   DBL_EXP_MASK < 0x200 ? 9 : \
481 +   DBL_EXP_MASK < 0x400 ? 10 : \
482 +   DBL_EXP_MASK < 0x800 ? 11 : \
483 +   DBL_EXP_MASK < 0x1000 ? 12 : \
484 +   DBL_EXP_MASK < 0x2000 ? 13 : \
485 +   DBL_EXP_MASK < 0x4000 ? 14 : \
486 +   DBL_EXP_MASK < 0x8000 ? 15 : \
487 +   DBL_EXP_MASK < 0x10000 ? 16 : \
488 +   DBL_EXP_MASK < 0x20000 ? 17 : \
489 +   DBL_EXP_MASK < 0x40000 ? 18 : \
490 +   DBL_EXP_MASK < 0x80000 ? 19 : \
491 +   DBL_EXP_MASK < 0x100000 ? 20 : \
492 +   DBL_EXP_MASK < 0x200000 ? 21 : \
493 +   DBL_EXP_MASK < 0x400000 ? 22 : \
494 +   DBL_EXP_MASK < 0x800000 ? 23 : \
495 +   DBL_EXP_MASK < 0x1000000 ? 24 : \
496 +   DBL_EXP_MASK < 0x2000000 ? 25 : \
497 +   DBL_EXP_MASK < 0x4000000 ? 26 : \
498 +   DBL_EXP_MASK < 0x8000000 ? 27 : \
499 +   DBL_EXP_MASK < 0x10000000 ? 28 : \
500 +   DBL_EXP_MASK < 0x20000000 ? 29 : \
501 +   DBL_EXP_MASK < 0x40000000 ? 30 : \
502 +   DBL_EXP_MASK <= 0x7fffffff ? 31 : \
503 +   32)
504 +#define LDBL_EXP_BIT \
505 +  (LDBL_EXP_MASK < 0x100 ? 8 : \
506 +   LDBL_EXP_MASK < 0x200 ? 9 : \
507 +   LDBL_EXP_MASK < 0x400 ? 10 : \
508 +   LDBL_EXP_MASK < 0x800 ? 11 : \
509 +   LDBL_EXP_MASK < 0x1000 ? 12 : \
510 +   LDBL_EXP_MASK < 0x2000 ? 13 : \
511 +   LDBL_EXP_MASK < 0x4000 ? 14 : \
512 +   LDBL_EXP_MASK < 0x8000 ? 15 : \
513 +   LDBL_EXP_MASK < 0x10000 ? 16 : \
514 +   LDBL_EXP_MASK < 0x20000 ? 17 : \
515 +   LDBL_EXP_MASK < 0x40000 ? 18 : \
516 +   LDBL_EXP_MASK < 0x80000 ? 19 : \
517 +   LDBL_EXP_MASK < 0x100000 ? 20 : \
518 +   LDBL_EXP_MASK < 0x200000 ? 21 : \
519 +   LDBL_EXP_MASK < 0x400000 ? 22 : \
520 +   LDBL_EXP_MASK < 0x800000 ? 23 : \
521 +   LDBL_EXP_MASK < 0x1000000 ? 24 : \
522 +   LDBL_EXP_MASK < 0x2000000 ? 25 : \
523 +   LDBL_EXP_MASK < 0x4000000 ? 26 : \
524 +   LDBL_EXP_MASK < 0x8000000 ? 27 : \
525 +   LDBL_EXP_MASK < 0x10000000 ? 28 : \
526 +   LDBL_EXP_MASK < 0x20000000 ? 29 : \
527 +   LDBL_EXP_MASK < 0x40000000 ? 30 : \
528 +   LDBL_EXP_MASK <= 0x7fffffff ? 31 : \
529 +   32)
530 +
531 +/* Number of bits used for a floating-point number: the mantissa (not
532 +   counting the "hidden bit", since it may or may not be explicit), the
533 +   exponent, and the sign.  */
534 +#define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1)
535 +#define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1)
536 +#define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1)
537 +
538 +/* Number of bytes used for a floating-point number.
539 +   This can be smaller than the 'sizeof'.  For example, on i386 systems,
540 +   'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence
541 +   LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but
542 +   sizeof (long double) = 12 or = 16.  */
543 +#define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
544 +#define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
545 +#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
546 +
547 +/* Verify that SIZEOF_FLT <= sizeof (float) etc.  */
548 +typedef int verify_sizeof_flt[2 * (SIZEOF_FLT <= sizeof (float)) - 1];
549 +typedef int verify_sizeof_dbl[2 * (SIZEOF_DBL <= sizeof (double)) - 1];
550 +typedef int verify_sizeof_ldbl[2 * (SIZEOF_LDBL <= sizeof (long double)) - 1];
551 +
552 +#endif /* _FLOATPLUS_H */
553 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/float.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/float.in.h
554 --- gtk-vnc-0.3.7.mingw/gnulib/lib/float.in.h   1970-01-01 01:00:00.000000000 +0100
555 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/float.in.h  2008-10-09 12:24:39.000000000 +0100
556 @@ -0,0 +1,60 @@
557 +/* A correct <float.h>.
558 +
559 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
560 +
561 +   This program is free software: you can redistribute it and/or modify
562 +   it under the terms of the GNU Lesser General Public License as published by
563 +   the Free Software Foundation; either version 2.1 of the License, or
564 +   (at your option) any later version.
565 +
566 +   This program is distributed in the hope that it will be useful,
567 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
568 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
569 +   GNU Lesser General Public License for more details.
570 +
571 +   You should have received a copy of the GNU Lesser General Public License
572 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
573 +
574 +#ifndef _GL_FLOAT_H
575 +
576 +@PRAGMA_SYSTEM_HEADER@
577 +
578 +/* The include_next requires a split double-inclusion guard.  */
579 +#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
580 +
581 +#ifndef _GL_FLOAT_H
582 +#define _GL_FLOAT_H
583 +
584 +/* 'long double' properties.  */
585 +#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
586 +/* Number of mantissa units, in base FLT_RADIX.  */
587 +# undef LDBL_MANT_DIG
588 +# define LDBL_MANT_DIG   64
589 +/* Number of decimal digits that is sufficient for representing a number.  */
590 +# undef LDBL_DIG
591 +# define LDBL_DIG        18
592 +/* x-1 where x is the smallest representable number > 1.  */
593 +# undef LDBL_EPSILON
594 +# define LDBL_EPSILON    1.0842021724855044340E-19L
595 +/* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
596 +# undef LDBL_MIN_EXP
597 +# define LDBL_MIN_EXP    (-16381)
598 +/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
599 +# undef LDBL_MAX_EXP
600 +# define LDBL_MAX_EXP    16384
601 +/* Minimum positive normalized number.  */
602 +# undef LDBL_MIN
603 +# define LDBL_MIN        3.3621031431120935063E-4932L
604 +/* Maximum representable finite number.  */
605 +# undef LDBL_MAX
606 +# define LDBL_MAX        1.1897314953572317650E+4932L
607 +/* Minimum e such that 10^e is in the range of normalized numbers.  */
608 +# undef LDBL_MIN_10_EXP
609 +# define LDBL_MIN_10_EXP (-4931)
610 +/* Maximum e such that 10^e is in the range of representable finite numbers.  */
611 +# undef LDBL_MAX_10_EXP
612 +# define LDBL_MAX_10_EXP 4932
613 +#endif
614 +
615 +#endif /* _GL_FLOAT_H */
616 +#endif /* _GL_FLOAT_H */
617 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/gai_strerror.c gtk-vnc-0.3.7.gnulib/gnulib/lib/gai_strerror.c
618 --- gtk-vnc-0.3.7.mingw/gnulib/lib/gai_strerror.c       1970-01-01 01:00:00.000000000 +0100
619 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/gai_strerror.c      2008-10-09 12:24:39.000000000 +0100
620 @@ -0,0 +1,78 @@
621 +/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
622 +   This file is part of the GNU C Library.
623 +   Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
624 +
625 +   This program is free software; you can redistribute it and/or modify
626 +   it under the terms of the GNU Lesser General Public License as published by
627 +   the Free Software Foundation; either version 2.1, or (at your option)
628 +   any later version.
629 +
630 +   This program is distributed in the hope that it will be useful,
631 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
632 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
633 +   GNU Lesser General Public License for more details.
634 +
635 +   You should have received a copy of the GNU Lesser General Public License
636 +   along with this program; if not, write to the Free Software Foundation,
637 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
638 +
639 +#ifndef _LIBC
640 +# include <config.h>
641 +# include "getaddrinfo.h"
642 +#endif
643 +
644 +#include <stdio.h>
645 +#ifdef HAVE_NETDB_H
646 +# include <netdb.h>
647 +#endif
648 +
649 +#ifdef _LIBC
650 +# include <libintl.h>
651 +#else
652 +# include "gettext.h"
653 +# define _(String) gettext (String)
654 +# define N_(String) String
655 +#endif
656 +
657 +static struct
658 +  {
659 +    int code;
660 +    const char *msg;
661 +  }
662 +values[] =
663 +  {
664 +    { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
665 +    { EAI_AGAIN, N_("Temporary failure in name resolution") },
666 +    { EAI_BADFLAGS, N_("Bad value for ai_flags") },
667 +    { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
668 +    { EAI_FAMILY, N_("ai_family not supported") },
669 +    { EAI_MEMORY, N_("Memory allocation failure") },
670 +    { EAI_NODATA, N_("No address associated with hostname") },
671 +    { EAI_NONAME, N_("Name or service not known") },
672 +    { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
673 +    { EAI_SOCKTYPE, N_("ai_socktype not supported") },
674 +    { EAI_SYSTEM, N_("System error") },
675 +    { EAI_OVERFLOW, N_("Argument buffer too small") },
676 +#ifdef __USE_GNU
677 +    { EAI_INPROGRESS, N_("Processing request in progress") },
678 +    { EAI_CANCELED, N_("Request canceled") },
679 +    { EAI_NOTCANCELED, N_("Request not canceled") },
680 +    { EAI_ALLDONE, N_("All requests done") },
681 +    { EAI_INTR, N_("Interrupted by a signal") },
682 +    { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
683 +#endif
684 +  };
685 +
686 +const char *
687 +gai_strerror (int code)
688 +{
689 +  size_t i;
690 +  for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
691 +    if (values[i].code == code)
692 +      return _(values[i].msg);
693 +
694 +  return _("Unknown error");
695 +}
696 +#ifdef _LIBC
697 +libc_hidden_def (gai_strerror)
698 +#endif
699 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/getaddrinfo.c gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.c
700 --- gtk-vnc-0.3.7.mingw/gnulib/lib/getaddrinfo.c        1970-01-01 01:00:00.000000000 +0100
701 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.c       2008-10-09 12:24:39.000000000 +0100
702 @@ -0,0 +1,419 @@
703 +/* Get address information (partial implementation).
704 +   Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software
705 +   Foundation, Inc.
706 +   Contributed by Simon Josefsson <simon@josefsson.org>.
707 +
708 +   This program is free software; you can redistribute it and/or modify
709 +   it under the terms of the GNU Lesser General Public License as published by
710 +   the Free Software Foundation; either version 2.1, or (at your option)
711 +   any later version.
712 +
713 +   This program is distributed in the hope that it will be useful,
714 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
715 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
716 +   GNU Lesser General Public License for more details.
717 +
718 +   You should have received a copy of the GNU Lesser General Public License
719 +   along with this program; if not, write to the Free Software Foundation,
720 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
721 +
722 +#include <config.h>
723 +
724 +#include "getaddrinfo.h"
725 +
726 +#if HAVE_NETINET_IN_H
727 +# include <netinet/in.h>
728 +#endif
729 +
730 +/* Get inet_ntop.  */
731 +#include <arpa/inet.h>
732 +
733 +/* Get calloc. */
734 +#include <stdlib.h>
735 +
736 +/* Get memcpy, strdup. */
737 +#include <string.h>
738 +
739 +/* Get snprintf. */
740 +#include <stdio.h>
741 +
742 +#include <stdbool.h>
743 +
744 +#include "gettext.h"
745 +#define _(String) gettext (String)
746 +#define N_(String) String
747 +
748 +/* BeOS has AF_INET, but not PF_INET.  */
749 +#ifndef PF_INET
750 +# define PF_INET AF_INET
751 +#endif
752 +/* BeOS also lacks PF_UNSPEC.  */
753 +#ifndef PF_UNSPEC
754 +# define PF_UNSPEC 0
755 +#endif
756 +
757 +#if defined _WIN32 || defined __WIN32__
758 +# define WIN32_NATIVE
759 +#endif
760 +
761 +#ifdef WIN32_NATIVE
762 +typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
763 +                                       const struct addrinfo*,
764 +                                       struct addrinfo**);
765 +typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
766 +typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
767 +                                       socklen_t, char*, DWORD,
768 +                                       char*, DWORD, int);
769 +
770 +static getaddrinfo_func getaddrinfo_ptr = NULL;
771 +static freeaddrinfo_func freeaddrinfo_ptr = NULL;
772 +static getnameinfo_func getnameinfo_ptr = NULL;
773 +
774 +static int
775 +use_win32_p (void)
776 +{
777 +  static int done = 0;
778 +  HMODULE h;
779 +
780 +  if (done)
781 +    return getaddrinfo_ptr ? 1 : 0;
782 +
783 +  done = 1;
784 +
785 +  h = GetModuleHandle ("ws2_32.dll");
786 +
787 +  if (h)
788 +    {
789 +      getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo");
790 +      freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, "freeaddrinfo");
791 +      getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo");
792 +    }
793 +
794 +  /* If either is missing, something is odd. */
795 +  if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr)
796 +    {
797 +      getaddrinfo_ptr = NULL;
798 +      freeaddrinfo_ptr = NULL;
799 +      getnameinfo_ptr = NULL;
800 +      return 0;
801 +    }
802 +
803 +  return 1;
804 +}
805 +#endif
806 +
807 +static inline bool
808 +validate_family (int family)
809 +{
810 +  /* FIXME: Support more families. */
811 +#if HAVE_IPV4
812 +     if (family == PF_INET)
813 +       return true;
814 +#endif
815 +#if HAVE_IPV6
816 +     if (family == PF_INET6)
817 +       return true;
818 +#endif
819 +     if (family == PF_UNSPEC)
820 +       return true;
821 +     return false;
822 +}
823 +
824 +/* Translate name of a service location and/or a service name to set of
825 +   socket addresses. */
826 +int
827 +getaddrinfo (const char *restrict nodename,
828 +            const char *restrict servname,
829 +            const struct addrinfo *restrict hints,
830 +            struct addrinfo **restrict res)
831 +{
832 +  struct addrinfo *tmp;
833 +  int port = 0;
834 +  struct hostent *he;
835 +  void *storage;
836 +  size_t size;
837 +#if HAVE_IPV6
838 +  struct v6_pair {
839 +    struct addrinfo addrinfo;
840 +    struct sockaddr_in6 sockaddr_in6;
841 +  };
842 +#endif
843 +#if HAVE_IPV4
844 +  struct v4_pair {
845 +    struct addrinfo addrinfo;
846 +    struct sockaddr_in sockaddr_in;
847 +  };
848 +#endif
849 +
850 +#ifdef WIN32_NATIVE
851 +  if (use_win32_p ())
852 +    return getaddrinfo_ptr (nodename, servname, hints, res);
853 +#endif
854 +
855 +  if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE)))
856 +    /* FIXME: Support more flags. */
857 +    return EAI_BADFLAGS;
858 +
859 +  if (hints && !validate_family (hints->ai_family))
860 +    return EAI_FAMILY;
861 +
862 +  if (hints &&
863 +      hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM)
864 +    /* FIXME: Support other socktype. */
865 +    return EAI_SOCKTYPE; /* FIXME: Better return code? */
866 +
867 +  if (!nodename)
868 +    {
869 +      if (!(hints->ai_flags & AI_PASSIVE))
870 +       return EAI_NONAME;
871 +
872 +#ifdef HAVE_IPV6
873 +      nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
874 +#else
875 +      nodename = "0.0.0.0";
876 +#endif
877 +    }
878 +
879 +  if (servname)
880 +    {
881 +      struct servent *se = NULL;
882 +      const char *proto =
883 +       (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
884 +
885 +      if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
886 +       /* FIXME: Use getservbyname_r if available. */
887 +       se = getservbyname (servname, proto);
888 +
889 +      if (!se)
890 +       {
891 +         char *c;
892 +         if (!(*servname >= '0' && *servname <= '9'))
893 +           return EAI_NONAME;
894 +         port = strtoul (servname, &c, 10);
895 +         if (*c || port > 0xffff)
896 +           return EAI_NONAME;
897 +         port = htons (port);
898 +       }
899 +      else
900 +       port = se->s_port;
901 +    }
902 +
903 +  /* FIXME: Use gethostbyname_r if available. */
904 +  he = gethostbyname (nodename);
905 +  if (!he || he->h_addr_list[0] == NULL)
906 +    return EAI_NONAME;
907 +
908 +  switch (he->h_addrtype)
909 +    {
910 +#if HAVE_IPV6
911 +    case PF_INET6:
912 +      size = sizeof (struct v6_pair);
913 +      break;
914 +#endif
915 +
916 +#if HAVE_IPV4
917 +    case PF_INET:
918 +      size = sizeof (struct v4_pair);
919 +      break;
920 +#endif
921 +
922 +    default:
923 +      return EAI_NODATA;
924 +    }
925 +
926 +  storage = calloc (1, size);
927 +  if (!storage)
928 +    return EAI_MEMORY;
929 +
930 +  switch (he->h_addrtype)
931 +    {
932 +#if HAVE_IPV6
933 +    case PF_INET6:
934 +      {
935 +       struct v6_pair *p = storage;
936 +       struct sockaddr_in6 *sinp = &p->sockaddr_in6;
937 +       tmp = &p->addrinfo;
938 +
939 +       if (port)
940 +         sinp->sin6_port = port;
941 +
942 +       if (he->h_length != sizeof (sinp->sin6_addr))
943 +         {
944 +           free (storage);
945 +           return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
946 +         }
947 +
948 +       memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
949 +
950 +       tmp->ai_addr = (struct sockaddr *) sinp;
951 +       tmp->ai_addrlen = sizeof *sinp;
952 +      }
953 +      break;
954 +#endif
955 +
956 +#if HAVE_IPV4
957 +    case PF_INET:
958 +      {
959 +       struct v4_pair *p = storage;
960 +       struct sockaddr_in *sinp = &p->sockaddr_in;
961 +       tmp = &p->addrinfo;
962 +
963 +       if (port)
964 +         sinp->sin_port = port;
965 +
966 +       if (he->h_length != sizeof (sinp->sin_addr))
967 +         {
968 +           free (storage);
969 +           return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
970 +         }
971 +
972 +       memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
973 +
974 +       tmp->ai_addr = (struct sockaddr *) sinp;
975 +       tmp->ai_addrlen = sizeof *sinp;
976 +      }
977 +      break;
978 +#endif
979 +
980 +    default:
981 +      free (storage);
982 +      return EAI_NODATA;
983 +    }
984 +
985 +  if (hints && hints->ai_flags & AI_CANONNAME)
986 +    {
987 +      const char *cn;
988 +      if (he->h_name)
989 +       cn = he->h_name;
990 +      else
991 +       cn = nodename;
992 +
993 +      tmp->ai_canonname = strdup (cn);
994 +      if (!tmp->ai_canonname)
995 +       {
996 +         free (storage);
997 +         return EAI_MEMORY;
998 +       }
999 +    }
1000 +
1001 +  tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
1002 +  tmp->ai_socktype = (hints) ? hints->ai_socktype : 0;
1003 +  tmp->ai_addr->sa_family = he->h_addrtype;
1004 +  tmp->ai_family = he->h_addrtype;
1005 +
1006 +  /* FIXME: If more than one address, create linked list of addrinfo's. */
1007 +
1008 +  *res = tmp;
1009 +
1010 +  return 0;
1011 +}
1012 +
1013 +/* Free `addrinfo' structure AI including associated storage.  */
1014 +void
1015 +freeaddrinfo (struct addrinfo *ai)
1016 +{
1017 +#ifdef WIN32_NATIVE
1018 +  if (use_win32_p ())
1019 +    {
1020 +      freeaddrinfo_ptr (ai);
1021 +      return;
1022 +    }
1023 +#endif
1024 +
1025 +  while (ai)
1026 +    {
1027 +      struct addrinfo *cur;
1028 +
1029 +      cur = ai;
1030 +      ai = ai->ai_next;
1031 +
1032 +      free (cur->ai_canonname);
1033 +      free (cur);
1034 +    }
1035 +}
1036 +
1037 +int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
1038 +               char *restrict node, socklen_t nodelen,
1039 +               char *restrict service, socklen_t servicelen,
1040 +               int flags)
1041 +{
1042 +#ifdef WIN32_NATIVE
1043 +  if (use_win32_p ())
1044 +    return getnameinfo_ptr (sa, salen, node, nodelen,
1045 +                           service, servicelen, flags);
1046 +#endif
1047 +
1048 +  /* FIXME: Support other flags. */
1049 +  if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) ||
1050 +      (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) ||
1051 +      (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV)))
1052 +    return EAI_BADFLAGS;
1053 +
1054 +  if (sa == NULL || salen < sizeof (sa->sa_family))
1055 +    return EAI_FAMILY;
1056 +
1057 +  switch (sa->sa_family)
1058 +    {
1059 +#if HAVE_IPV4
1060 +    case AF_INET:
1061 +      if (salen < sizeof (struct sockaddr_in))
1062 +       return EAI_FAMILY;
1063 +      break;
1064 +#endif
1065 +#if HAVE_IPV6
1066 +    case AF_INET6:
1067 +      if (salen < sizeof (struct sockaddr_in6))
1068 +       return EAI_FAMILY;
1069 +      break;
1070 +#endif
1071 +    default:
1072 +      return EAI_FAMILY;
1073 +    }
1074 +
1075 +  if (node && nodelen > 0 && flags & NI_NUMERICHOST)
1076 +    {
1077 +      switch (sa->sa_family)
1078 +       {
1079 +#if HAVE_IPV4
1080 +       case AF_INET:
1081 +         if (!inet_ntop (AF_INET,
1082 +                         &(((const struct sockaddr_in *) sa)->sin_addr),
1083 +                         node, nodelen))
1084 +           return EAI_SYSTEM;
1085 +         break;
1086 +#endif
1087 +
1088 +#if HAVE_IPV6
1089 +       case AF_INET6:
1090 +         if (!inet_ntop (AF_INET6,
1091 +                         &(((const struct sockaddr_in6 *) sa)->sin6_addr),
1092 +                         node, nodelen))
1093 +           return EAI_SYSTEM;
1094 +         break;
1095 +#endif
1096 +
1097 +       default:
1098 +         return EAI_FAMILY;
1099 +       }
1100 +    }
1101 +
1102 +  if (service && servicelen > 0 && flags & NI_NUMERICSERV)
1103 +    switch (sa->sa_family)
1104 +      {
1105 +#if HAVE_IPV4
1106 +      case AF_INET:
1107 +#endif
1108 +#if HAVE_IPV6
1109 +      case AF_INET6:
1110 +#endif
1111 +       {
1112 +         unsigned short int port
1113 +           = ntohs (((const struct sockaddr_in *) sa)->sin_port);
1114 +         if (servicelen <= snprintf (service, servicelen, "%u", port))
1115 +           return EAI_OVERFLOW;
1116 +       }
1117 +       break;
1118 +      }
1119 +
1120 +  return 0;
1121 +}
1122 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/getaddrinfo.h gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.h
1123 --- gtk-vnc-0.3.7.mingw/gnulib/lib/getaddrinfo.h        1970-01-01 01:00:00.000000000 +0100
1124 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.h       2008-10-09 12:24:39.000000000 +0100
1125 @@ -0,0 +1,163 @@
1126 +/* Get address information.
1127 +   Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2008
1128 +                 Free Software Foundation, Inc.
1129 +   Contributed by Simon Josefsson <simon@josefsson.org>.
1130 +
1131 +   This program is free software; you can redistribute it and/or modify
1132 +   it under the terms of the GNU Lesser General Public License as published by
1133 +   the Free Software Foundation; either version 2.1, or (at your option)
1134 +   any later version.
1135 +
1136 +   This program is distributed in the hope that it will be useful,
1137 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1138 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1139 +   GNU Lesser General Public License for more details.
1140 +
1141 +   You should have received a copy of the GNU Lesser General Public License
1142 +   along with this program; if not, write to the Free Software Foundation,
1143 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
1144 +
1145 +#ifndef GETADDRINFO_H
1146 +#define GETADDRINFO_H
1147 +
1148 +/* sys/socket.h in i386-unknown-freebsd4.10 and
1149 +   powerpc-apple-darwin5.5 require sys/types.h, so include it first.
1150 +   Then we'll also get 'socklen_t' and 'struct sockaddr' which are
1151 +   used below. */
1152 +#include <sys/types.h>
1153 +/* Get all getaddrinfo related declarations, if available.  */
1154 +#include <sys/socket.h>
1155 +#ifdef HAVE_NETDB_H
1156 +# include <netdb.h>
1157 +#endif
1158 +
1159 +#ifndef HAVE_STRUCT_ADDRINFO
1160 +
1161 +/* Structure to contain information about address of a service provider.  */
1162 +struct addrinfo
1163 +{
1164 +  int ai_flags;                        /* Input flags.  */
1165 +  int ai_family;               /* Protocol family for socket.  */
1166 +  int ai_socktype;             /* Socket type.  */
1167 +  int ai_protocol;             /* Protocol for socket.  */
1168 +  socklen_t ai_addrlen;                /* Length of socket address.  */
1169 +  struct sockaddr *ai_addr;    /* Socket address for socket.  */
1170 +  char *ai_canonname;          /* Canonical name for service location.  */
1171 +  struct addrinfo *ai_next;    /* Pointer to next in list.  */
1172 +};
1173 +#endif
1174 +
1175 +/* Possible values for `ai_flags' field in `addrinfo' structure.  */
1176 +#ifndef AI_PASSIVE
1177 +# define AI_PASSIVE    0x0001  /* Socket address is intended for `bind'.  */
1178 +#endif
1179 +#ifndef AI_CANONNAME
1180 +# define AI_CANONNAME  0x0002  /* Request for canonical name.  */
1181 +#endif
1182 +#ifndef AI_NUMERICSERV
1183 +# define AI_NUMERICSERV        0x0400  /* Don't use name resolution.  */
1184 +#endif
1185 +
1186 +#if 0
1187 +/* The commented out definitions below are not yet implemented in the
1188 +   GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact,
1189 +   cause conflicts on systems with a getaddrinfo() function which does not
1190 +   define them.
1191 +
1192 +   If they are restored, be sure to protect the definitions with #ifndef.  */
1193 +#define AI_NUMERICHOST 0x0004  /* Don't use name resolution.  */
1194 +#define AI_V4MAPPED    0x0008  /* IPv4 mapped addresses are acceptable.  */
1195 +#define AI_ALL         0x0010  /* Return IPv4 mapped and IPv6 addresses.  */
1196 +#define AI_ADDRCONFIG  0x0020  /* Use configuration of this host to choose
1197 +                                  returned address type..  */
1198 +#endif /* 0 */
1199 +
1200 +/* Error values for `getaddrinfo' function.  */
1201 +#ifndef EAI_BADFLAGS
1202 +# define EAI_BADFLAGS    -1    /* Invalid value for `ai_flags' field.  */
1203 +# define EAI_NONAME      -2    /* NAME or SERVICE is unknown.  */
1204 +# define EAI_AGAIN       -3    /* Temporary failure in name resolution.  */
1205 +# define EAI_FAIL        -4    /* Non-recoverable failure in name res.  */
1206 +# define EAI_NODATA      -5    /* No address associated with NAME.  */
1207 +# define EAI_FAMILY      -6    /* `ai_family' not supported.  */
1208 +# define EAI_SOCKTYPE    -7    /* `ai_socktype' not supported.  */
1209 +# define EAI_SERVICE     -8    /* SERVICE not supported for `ai_socktype'.  */
1210 +# define EAI_MEMORY      -10   /* Memory allocation failure.  */
1211 +#endif
1212 +
1213 +/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
1214 +   FreeBSD, which does define EAI_BADFLAGS) have removed the definition
1215 +   in favor of EAI_NONAME.  */
1216 +#if !defined EAI_NODATA && defined EAI_NONAME
1217 +# define EAI_NODATA EAI_NONAME
1218 +#endif
1219 +
1220 +#ifndef EAI_OVERFLOW
1221 +/* Not defined on mingw32. */
1222 +# define EAI_OVERFLOW    -12   /* Argument buffer overflow.  */
1223 +#endif
1224 +#ifndef EAI_ADDRFAMILY
1225 +/* Not defined on mingw32. */
1226 +# define EAI_ADDRFAMILY  -9    /* Address family for NAME not supported.  */
1227 +#endif
1228 +#ifndef EAI_SYSTEM
1229 +/* Not defined on mingw32. */
1230 +# define EAI_SYSTEM      -11   /* System error returned in `errno'.  */
1231 +#endif
1232 +
1233 +#ifdef __USE_GNU
1234 +# ifndef EAI_INPROGRESS
1235 +#  define EAI_INPROGRESS       -100    /* Processing request in progress.  */
1236 +#  define EAI_CANCELED         -101    /* Request canceled.  */
1237 +#  define EAI_NOTCANCELED      -102    /* Request not canceled.  */
1238 +#  define EAI_ALLDONE          -103    /* All requests done.  */
1239 +#  define EAI_INTR             -104    /* Interrupted by a signal.  */
1240 +#  define EAI_IDN_ENCODE       -105    /* IDN encoding failed.  */
1241 +# endif
1242 +#endif
1243 +
1244 +#if !HAVE_DECL_GETADDRINFO
1245 +/* Translate name of a service location and/or a service name to set of
1246 +   socket addresses.
1247 +   For more details, see the POSIX:2001 specification
1248 +   <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
1249 +extern int getaddrinfo (const char *restrict nodename,
1250 +                       const char *restrict servname,
1251 +                       const struct addrinfo *restrict hints,
1252 +                       struct addrinfo **restrict res);
1253 +#endif
1254 +
1255 +#if !HAVE_DECL_FREEADDRINFO
1256 +/* Free `addrinfo' structure AI including associated storage.
1257 +   For more details, see the POSIX:2001 specification
1258 +   <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
1259 +extern void freeaddrinfo (struct addrinfo *ai);
1260 +#endif
1261 +
1262 +#if !HAVE_DECL_GAI_STRERROR
1263 +/* Convert error return from getaddrinfo() to a string.
1264 +   For more details, see the POSIX:2001 specification
1265 +   <http://www.opengroup.org/susv3xsh/gai_strerror.html>.  */
1266 +extern const char *gai_strerror (int ecode);
1267 +#endif
1268 +
1269 +#if !HAVE_DECL_GETNAMEINFO
1270 +/* Convert socket address to printable node and service names.
1271 +   For more details, see the POSIX:2001 specification
1272 +   <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
1273 +extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
1274 +                      char *restrict node, socklen_t nodelen,
1275 +                      char *restrict service, socklen_t servicelen,
1276 +                      int flags);
1277 +
1278 +#endif
1279 +
1280 +/* Possible flags for getnameinfo.  */
1281 +#ifndef NI_NUMERICHOST
1282 +# define NI_NUMERICHOST 1
1283 +#endif
1284 +#ifndef NI_NUMERICSERV
1285 +# define NI_NUMERICSERV 2
1286 +#endif
1287 +
1288 +#endif /* GETADDRINFO_H */
1289 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/gettext.h gtk-vnc-0.3.7.gnulib/gnulib/lib/gettext.h
1290 --- gtk-vnc-0.3.7.mingw/gnulib/lib/gettext.h    1970-01-01 01:00:00.000000000 +0100
1291 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/gettext.h   2008-10-09 12:24:39.000000000 +0100
1292 @@ -0,0 +1,270 @@
1293 +/* Convenience header for conditional use of GNU <libintl.h>.
1294 +   Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc.
1295 +
1296 +   This program is free software; you can redistribute it and/or modify
1297 +   it under the terms of the GNU Lesser General Public License as published by
1298 +   the Free Software Foundation; either version 2.1, or (at your option)
1299 +   any later version.
1300 +
1301 +   This program is distributed in the hope that it will be useful,
1302 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1303 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1304 +   GNU Lesser General Public License for more details.
1305 +
1306 +   You should have received a copy of the GNU Lesser General Public License along
1307 +   with this program; if not, write to the Free Software Foundation,
1308 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
1309 +
1310 +#ifndef _LIBGETTEXT_H
1311 +#define _LIBGETTEXT_H 1
1312 +
1313 +/* NLS can be disabled through the configure --disable-nls option.  */
1314 +#if ENABLE_NLS
1315 +
1316 +/* Get declarations of GNU message catalog functions.  */
1317 +# include <libintl.h>
1318 +
1319 +/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
1320 +   the gettext() and ngettext() macros.  This is an alternative to calling
1321 +   textdomain(), and is useful for libraries.  */
1322 +# ifdef DEFAULT_TEXT_DOMAIN
1323 +#  undef gettext
1324 +#  define gettext(Msgid) \
1325 +     dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
1326 +#  undef ngettext
1327 +#  define ngettext(Msgid1, Msgid2, N) \
1328 +     dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
1329 +# endif
1330 +
1331 +#else
1332 +
1333 +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
1334 +   chokes if dcgettext is defined as a macro.  So include it now, to make
1335 +   later inclusions of <locale.h> a NOP.  We don't include <libintl.h>
1336 +   as well because people using "gettext.h" will not include <libintl.h>,
1337 +   and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
1338 +   is OK.  */
1339 +#if defined(__sun)
1340 +# include <locale.h>
1341 +#endif
1342 +
1343 +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
1344 +   <libintl.h>, which chokes if dcgettext is defined as a macro.  So include
1345 +   it now, to make later inclusions of <libintl.h> a NOP.  */
1346 +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
1347 +# include <cstdlib>
1348 +# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
1349 +#  include <libintl.h>
1350 +# endif
1351 +#endif
1352 +
1353 +/* Disabled NLS.
1354 +   The casts to 'const char *' serve the purpose of producing warnings
1355 +   for invalid uses of the value returned from these functions.
1356 +   On pre-ANSI systems without 'const', the config.h file is supposed to
1357 +   contain "#define const".  */
1358 +# define gettext(Msgid) ((const char *) (Msgid))
1359 +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
1360 +# define dcgettext(Domainname, Msgid, Category) \
1361 +    ((void) (Category), dgettext (Domainname, Msgid))
1362 +# define ngettext(Msgid1, Msgid2, N) \
1363 +    ((N) == 1 \
1364 +     ? ((void) (Msgid2), (const char *) (Msgid1)) \
1365 +     : ((void) (Msgid1), (const char *) (Msgid2)))
1366 +# define dngettext(Domainname, Msgid1, Msgid2, N) \
1367 +    ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
1368 +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
1369 +    ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
1370 +# define textdomain(Domainname) ((const char *) (Domainname))
1371 +# define bindtextdomain(Domainname, Dirname) \
1372 +    ((void) (Domainname), (const char *) (Dirname))
1373 +# define bind_textdomain_codeset(Domainname, Codeset) \
1374 +    ((void) (Domainname), (const char *) (Codeset))
1375 +
1376 +#endif
1377 +
1378 +/* A pseudo function call that serves as a marker for the automated
1379 +   extraction of messages, but does not call gettext().  The run-time
1380 +   translation is done at a different place in the code.
1381 +   The argument, String, should be a literal string.  Concatenated strings
1382 +   and other string expressions won't work.
1383 +   The macro's expansion is not parenthesized, so that it is suitable as
1384 +   initializer for static 'char[]' or 'const char[]' variables.  */
1385 +#define gettext_noop(String) String
1386 +
1387 +/* The separator between msgctxt and msgid in a .mo file.  */
1388 +#define GETTEXT_CONTEXT_GLUE "\004"
1389 +
1390 +/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
1391 +   MSGID.  MSGCTXT and MSGID must be string literals.  MSGCTXT should be
1392 +   short and rarely need to change.
1393 +   The letter 'p' stands for 'particular' or 'special'.  */
1394 +#ifdef DEFAULT_TEXT_DOMAIN
1395 +# define pgettext(Msgctxt, Msgid) \
1396 +   pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
1397 +#else
1398 +# define pgettext(Msgctxt, Msgid) \
1399 +   pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
1400 +#endif
1401 +#define dpgettext(Domainname, Msgctxt, Msgid) \
1402 +  pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
1403 +#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
1404 +  pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
1405 +#ifdef DEFAULT_TEXT_DOMAIN
1406 +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
1407 +   npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
1408 +#else
1409 +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
1410 +   npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
1411 +#endif
1412 +#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
1413 +  npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
1414 +#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
1415 +  npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
1416 +
1417 +#ifdef __GNUC__
1418 +__inline
1419 +#else
1420 +#ifdef __cplusplus
1421 +inline
1422 +#endif
1423 +#endif
1424 +static const char *
1425 +pgettext_aux (const char *domain,
1426 +             const char *msg_ctxt_id, const char *msgid,
1427 +             int category)
1428 +{
1429 +  const char *translation = dcgettext (domain, msg_ctxt_id, category);
1430 +  if (translation == msg_ctxt_id)
1431 +    return msgid;
1432 +  else
1433 +    return translation;
1434 +}
1435 +
1436 +#ifdef __GNUC__
1437 +__inline
1438 +#else
1439 +#ifdef __cplusplus
1440 +inline
1441 +#endif
1442 +#endif
1443 +static const char *
1444 +npgettext_aux (const char *domain,
1445 +              const char *msg_ctxt_id, const char *msgid,
1446 +              const char *msgid_plural, unsigned long int n,
1447 +              int category)
1448 +{
1449 +  const char *translation =
1450 +    dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
1451 +  if (translation == msg_ctxt_id || translation == msgid_plural)
1452 +    return (n == 1 ? msgid : msgid_plural);
1453 +  else
1454 +    return translation;
1455 +}
1456 +
1457 +/* The same thing extended for non-constant arguments.  Here MSGCTXT and MSGID
1458 +   can be arbitrary expressions.  But for string literals these macros are
1459 +   less efficient than those above.  */
1460 +
1461 +#include <string.h>
1462 +
1463 +#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
1464 +  (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
1465 +   /* || __STDC_VERSION__ >= 199901L */ )
1466 +
1467 +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
1468 +#include <stdlib.h>
1469 +#endif
1470 +
1471 +#define pgettext_expr(Msgctxt, Msgid) \
1472 +  dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
1473 +#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
1474 +  dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
1475 +
1476 +#ifdef __GNUC__
1477 +__inline
1478 +#else
1479 +#ifdef __cplusplus
1480 +inline
1481 +#endif
1482 +#endif
1483 +static const char *
1484 +dcpgettext_expr (const char *domain,
1485 +                const char *msgctxt, const char *msgid,
1486 +                int category)
1487 +{
1488 +  size_t msgctxt_len = strlen (msgctxt) + 1;
1489 +  size_t msgid_len = strlen (msgid) + 1;
1490 +  const char *translation;
1491 +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
1492 +  char msg_ctxt_id[msgctxt_len + msgid_len];
1493 +#else
1494 +  char buf[1024];
1495 +  char *msg_ctxt_id =
1496 +    (msgctxt_len + msgid_len <= sizeof (buf)
1497 +     ? buf
1498 +     : (char *) malloc (msgctxt_len + msgid_len));
1499 +  if (msg_ctxt_id != NULL)
1500 +#endif
1501 +    {
1502 +      memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
1503 +      msg_ctxt_id[msgctxt_len - 1] = '\004';
1504 +      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
1505 +      translation = dcgettext (domain, msg_ctxt_id, category);
1506 +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
1507 +      if (msg_ctxt_id != buf)
1508 +       free (msg_ctxt_id);
1509 +#endif
1510 +      if (translation != msg_ctxt_id)
1511 +       return translation;
1512 +    }
1513 +  return msgid;
1514 +}
1515 +
1516 +#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
1517 +  dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
1518 +#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
1519 +  dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
1520 +
1521 +#ifdef __GNUC__
1522 +__inline
1523 +#else
1524 +#ifdef __cplusplus
1525 +inline
1526 +#endif
1527 +#endif
1528 +static const char *
1529 +dcnpgettext_expr (const char *domain,
1530 +                 const char *msgctxt, const char *msgid,
1531 +                 const char *msgid_plural, unsigned long int n,
1532 +                 int category)
1533 +{
1534 +  size_t msgctxt_len = strlen (msgctxt) + 1;
1535 +  size_t msgid_len = strlen (msgid) + 1;
1536 +  const char *translation;
1537 +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
1538 +  char msg_ctxt_id[msgctxt_len + msgid_len];
1539 +#else
1540 +  char buf[1024];
1541 +  char *msg_ctxt_id =
1542 +    (msgctxt_len + msgid_len <= sizeof (buf)
1543 +     ? buf
1544 +     : (char *) malloc (msgctxt_len + msgid_len));
1545 +  if (msg_ctxt_id != NULL)
1546 +#endif
1547 +    {
1548 +      memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
1549 +      msg_ctxt_id[msgctxt_len - 1] = '\004';
1550 +      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
1551 +      translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
1552 +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
1553 +      if (msg_ctxt_id != buf)
1554 +       free (msg_ctxt_id);
1555 +#endif
1556 +      if (!(translation == msg_ctxt_id || translation == msgid_plural))
1557 +       return translation;
1558 +    }
1559 +  return (n == 1 ? msgid : msgid_plural);
1560 +}
1561 +
1562 +#endif /* _LIBGETTEXT_H */
1563 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/inet_ntop.c gtk-vnc-0.3.7.gnulib/gnulib/lib/inet_ntop.c
1564 --- gtk-vnc-0.3.7.mingw/gnulib/lib/inet_ntop.c  1970-01-01 01:00:00.000000000 +0100
1565 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/inet_ntop.c 2008-10-09 12:24:39.000000000 +0100
1566 @@ -0,0 +1,238 @@
1567 +/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
1568 +
1569 +   Copyright (C) 2005, 2006, 2008  Free Software Foundation, Inc.
1570 +
1571 +   This program is free software; you can redistribute it and/or modify
1572 +   it under the terms of the GNU Lesser General Public License as published by
1573 +   the Free Software Foundation; either version 2.1, or (at your option)
1574 +   any later version.
1575 +
1576 +   This program is distributed in the hope that it will be useful,
1577 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1578 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1579 +   GNU Lesser General Public License for more details.
1580 +
1581 +   You should have received a copy of the GNU Lesser General Public License
1582 +   along with this program; if not, write to the Free Software Foundation,
1583 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
1584 +
1585 +/*
1586 + * Copyright (c) 1996-1999 by Internet Software Consortium.
1587 + *
1588 + * Permission to use, copy, modify, and distribute this software for any
1589 + * purpose with or without fee is hereby granted, provided that the above
1590 + * copyright notice and this permission notice appear in all copies.
1591 + *
1592 + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
1593 + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
1594 + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
1595 + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
1596 + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
1597 + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
1598 + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1599 + * SOFTWARE.
1600 + */
1601 +
1602 +#include <config.h>
1603 +
1604 +/* Specification.  */
1605 +#include <arpa/inet.h>
1606 +
1607 +#include <stdio.h>
1608 +#include <string.h>
1609 +#include <errno.h>
1610 +
1611 +#ifndef EAFNOSUPPORT
1612 +# define EAFNOSUPPORT EINVAL
1613 +#endif
1614 +
1615 +#define NS_IN6ADDRSZ 16
1616 +#define NS_INT16SZ 2
1617 +
1618 +/*
1619 + * WARNING: Don't even consider trying to compile this on a system where
1620 + * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
1621 + */
1622 +typedef int verify_int_size[2 * sizeof (int) - 7];
1623 +
1624 +static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
1625 +#if HAVE_IPV6
1626 +static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size);
1627 +#endif
1628 +
1629 +
1630 +/* char *
1631 + * inet_ntop(af, src, dst, size)
1632 + *     convert a network format address to presentation format.
1633 + * return:
1634 + *     pointer to presentation format address (`dst'), or NULL (see errno).
1635 + * author:
1636 + *     Paul Vixie, 1996.
1637 + */
1638 +const char *
1639 +inet_ntop (int af, const void *restrict src,
1640 +          char *restrict dst, socklen_t cnt)
1641 +{
1642 +  switch (af)
1643 +    {
1644 +#if HAVE_IPV4
1645 +    case AF_INET:
1646 +      return (inet_ntop4 (src, dst, cnt));
1647 +#endif
1648 +
1649 +#if HAVE_IPV6
1650 +    case AF_INET6:
1651 +      return (inet_ntop6 (src, dst, cnt));
1652 +#endif
1653 +
1654 +    default:
1655 +      errno = EAFNOSUPPORT;
1656 +      return (NULL);
1657 +    }
1658 +  /* NOTREACHED */
1659 +}
1660 +
1661 +/* const char *
1662 + * inet_ntop4(src, dst, size)
1663 + *     format an IPv4 address
1664 + * return:
1665 + *     `dst' (as a const)
1666 + * notes:
1667 + *     (1) uses no statics
1668 + *     (2) takes a u_char* not an in_addr as input
1669 + * author:
1670 + *     Paul Vixie, 1996.
1671 + */
1672 +static const char *
1673 +inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
1674 +{
1675 +  char tmp[sizeof "255.255.255.255"];
1676 +  int len;
1677 +
1678 +  len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]);
1679 +  if (len < 0)
1680 +    return NULL;
1681 +
1682 +  if (len > size)
1683 +    {
1684 +      errno = ENOSPC;
1685 +      return NULL;
1686 +    }
1687 +
1688 +  return strcpy (dst, tmp);
1689 +}
1690 +
1691 +#if HAVE_IPV6
1692 +
1693 +/* const char *
1694 + * inet_ntop6(src, dst, size)
1695 + *     convert IPv6 binary address into presentation (printable) format
1696 + * author:
1697 + *     Paul Vixie, 1996.
1698 + */
1699 +static const char *
1700 +inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
1701 +{
1702 +  /*
1703 +   * Note that int32_t and int16_t need only be "at least" large enough
1704 +   * to contain a value of the specified size.  On some systems, like
1705 +   * Crays, there is no such thing as an integer variable with 16 bits.
1706 +   * Keep this in mind if you think this function should have been coded
1707 +   * to use pointer overlays.  All the world's not a VAX.
1708 +   */
1709 +  char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
1710 +  struct
1711 +  {
1712 +    int base, len;
1713 +  } best, cur;
1714 +  unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
1715 +  int i;
1716 +
1717 +  /*
1718 +   * Preprocess:
1719 +   *      Copy the input (bytewise) array into a wordwise array.
1720 +   *      Find the longest run of 0x00's in src[] for :: shorthanding.
1721 +   */
1722 +  memset (words, '\0', sizeof words);
1723 +  for (i = 0; i < NS_IN6ADDRSZ; i += 2)
1724 +    words[i / 2] = (src[i] << 8) | src[i + 1];
1725 +  best.base = -1;
1726 +  cur.base = -1;
1727 +  for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
1728 +    {
1729 +      if (words[i] == 0)
1730 +       {
1731 +         if (cur.base == -1)
1732 +           cur.base = i, cur.len = 1;
1733 +         else
1734 +           cur.len++;
1735 +       }
1736 +      else
1737 +       {
1738 +         if (cur.base != -1)
1739 +           {
1740 +             if (best.base == -1 || cur.len > best.len)
1741 +               best = cur;
1742 +             cur.base = -1;
1743 +           }
1744 +       }
1745 +    }
1746 +  if (cur.base != -1)
1747 +    {
1748 +      if (best.base == -1 || cur.len > best.len)
1749 +       best = cur;
1750 +    }
1751 +  if (best.base != -1 && best.len < 2)
1752 +    best.base = -1;
1753 +
1754 +  /*
1755 +   * Format the result.
1756 +   */
1757 +  tp = tmp;
1758 +  for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
1759 +    {
1760 +      /* Are we inside the best run of 0x00's? */
1761 +      if (best.base != -1 && i >= best.base && i < (best.base + best.len))
1762 +       {
1763 +         if (i == best.base)
1764 +           *tp++ = ':';
1765 +         continue;
1766 +       }
1767 +      /* Are we following an initial run of 0x00s or any real hex? */
1768 +      if (i != 0)
1769 +       *tp++ = ':';
1770 +      /* Is this address an encapsulated IPv4? */
1771 +      if (i == 6 && best.base == 0 &&
1772 +         (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
1773 +       {
1774 +         if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
1775 +           return (NULL);
1776 +         tp += strlen (tp);
1777 +         break;
1778 +       }
1779 +      {
1780 +       int len = sprintf (tp, "%x", words[i]);
1781 +       if (len < 0)
1782 +         return NULL;
1783 +       tp += len;
1784 +      }
1785 +    }
1786 +  /* Was it a trailing run of 0x00's? */
1787 +  if (best.base != -1 && (best.base + best.len) ==
1788 +      (NS_IN6ADDRSZ / NS_INT16SZ))
1789 +    *tp++ = ':';
1790 +  *tp++ = '\0';
1791 +
1792 +  /*
1793 +   * Check for overflow, copy, and we're done.
1794 +   */
1795 +  if ((socklen_t) (tp - tmp) > size)
1796 +    {
1797 +      errno = ENOSPC;
1798 +      return NULL;
1799 +    }
1800 +
1801 +  return strcpy (dst, tmp);
1802 +}
1803 +
1804 +#endif
1805 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/Makefile.am gtk-vnc-0.3.7.gnulib/gnulib/lib/Makefile.am
1806 --- gtk-vnc-0.3.7.mingw/gnulib/lib/Makefile.am  1970-01-01 01:00:00.000000000 +0100
1807 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/Makefile.am 2008-10-09 12:33:42.000000000 +0100
1808 @@ -0,0 +1,484 @@
1809 +## DO NOT EDIT! GENERATED AUTOMATICALLY!
1810 +## Process this file with automake to produce Makefile.in.
1811 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
1812 +#
1813 +# This file is free software, distributed under the terms of the GNU
1814 +# General Public License.  As a special exception to the GNU General
1815 +# Public License, this file may be distributed as part of a program
1816 +# that contains a configuration script generated by Autoconf, under
1817 +# the same distribution terms as the rest of that program.
1818 +#
1819 +# Generated by gnulib-tool.
1820 +# 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 recv send socket vc-list-files
1821 +
1822 +AUTOMAKE_OPTIONS = 1.5 gnits
1823 +
1824 +SUBDIRS =
1825 +noinst_HEADERS =
1826 +noinst_LIBRARIES =
1827 +noinst_LTLIBRARIES =
1828 +EXTRA_DIST =
1829 +BUILT_SOURCES =
1830 +SUFFIXES =
1831 +MOSTLYCLEANFILES = core *.stackdump
1832 +MOSTLYCLEANDIRS =
1833 +CLEANFILES =
1834 +DISTCLEANFILES =
1835 +MAINTAINERCLEANFILES =
1836 +
1837 +AM_CPPFLAGS =
1838 +
1839 +noinst_LTLIBRARIES += libgnu.la
1840 +
1841 +libgnu_la_SOURCES =
1842 +libgnu_la_LIBADD = $(gl_LTLIBOBJS)
1843 +libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
1844 +EXTRA_libgnu_la_SOURCES =
1845 +libgnu_la_LDFLAGS = $(AM_LDFLAGS)
1846 +
1847 +## begin gnulib module alloca-opt
1848 +
1849 +BUILT_SOURCES += $(ALLOCA_H)
1850 +
1851 +# We need the following in order to create <alloca.h> when the system
1852 +# doesn't have one that works with the given compiler.
1853 +alloca.h: alloca.in.h
1854 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
1855 +         cat $(srcdir)/alloca.in.h; \
1856 +       } > $@-t
1857 +       mv -f $@-t $@
1858 +MOSTLYCLEANFILES += alloca.h alloca.h-t
1859 +
1860 +EXTRA_DIST += alloca.in.h
1861 +
1862 +## end   gnulib module alloca-opt
1863 +
1864 +## begin gnulib module arpa_inet
1865 +
1866 +BUILT_SOURCES += $(ARPA_INET_H)
1867 +
1868 +# We need the following in order to create <arpa/inet.h> when the system
1869 +# doesn't have one.
1870 +arpa/inet.h:
1871 +       @MKDIR_P@ arpa
1872 +       rm -f $@-t $@
1873 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
1874 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
1875 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1876 +             -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
1877 +             -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
1878 +             -e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \
1879 +             -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
1880 +             -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
1881 +             -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
1882 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
1883 +             < $(srcdir)/arpa_inet.in.h; \
1884 +       } > $@-t
1885 +       mv $@-t $@
1886 +MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
1887 +MOSTLYCLEANDIRS += arpa
1888 +
1889 +EXTRA_DIST += arpa_inet.in.h
1890 +
1891 +## end   gnulib module arpa_inet
1892 +
1893 +## begin gnulib module connect
1894 +
1895 +
1896 +EXTRA_DIST += winsock.c
1897 +
1898 +EXTRA_libgnu_la_SOURCES += winsock.c
1899 +
1900 +## end   gnulib module connect
1901 +
1902 +## begin gnulib module errno
1903 +
1904 +BUILT_SOURCES += $(ERRNO_H)
1905 +
1906 +# We need the following in order to create <errno.h> when the system
1907 +# doesn't have one that is POSIX compliant.
1908 +errno.h: errno.in.h
1909 +       rm -f $@-t $@
1910 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
1911 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
1912 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1913 +             -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
1914 +             -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
1915 +             -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
1916 +             -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
1917 +             -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
1918 +             -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
1919 +             -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
1920 +             < $(srcdir)/errno.in.h; \
1921 +       } > $@-t
1922 +       mv $@-t $@
1923 +MOSTLYCLEANFILES += errno.h errno.h-t
1924 +
1925 +EXTRA_DIST += errno.in.h
1926 +
1927 +## end   gnulib module errno
1928 +
1929 +## begin gnulib module float
1930 +
1931 +BUILT_SOURCES += $(FLOAT_H)
1932 +
1933 +# We need the following in order to create <float.h> when the system
1934 +# doesn't have one that works with the given compiler.
1935 +float.h: float.in.h
1936 +       rm -f $@-t $@
1937 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
1938 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
1939 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1940 +             -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
1941 +             < $(srcdir)/float.in.h; \
1942 +       } > $@-t
1943 +       mv $@-t $@
1944 +MOSTLYCLEANFILES += float.h float.h-t
1945 +
1946 +EXTRA_DIST += float.in.h
1947 +
1948 +## end   gnulib module float
1949 +
1950 +## begin gnulib module getaddrinfo
1951 +
1952 +
1953 +EXTRA_DIST += gai_strerror.c getaddrinfo.c getaddrinfo.h
1954 +
1955 +EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c
1956 +
1957 +## end   gnulib module getaddrinfo
1958 +
1959 +## begin gnulib module gettext-h
1960 +
1961 +libgnu_la_SOURCES += gettext.h
1962 +
1963 +## end   gnulib module gettext-h
1964 +
1965 +## begin gnulib module inet_ntop
1966 +
1967 +
1968 +EXTRA_DIST += inet_ntop.c
1969 +
1970 +EXTRA_libgnu_la_SOURCES += inet_ntop.c
1971 +
1972 +## end   gnulib module inet_ntop
1973 +
1974 +## begin gnulib module link-warning
1975 +
1976 +LINK_WARNING_H=$(top_srcdir)/./link-warning.h
1977 +
1978 +EXTRA_DIST += $(top_srcdir)/./link-warning.h
1979 +
1980 +## end   gnulib module link-warning
1981 +
1982 +## begin gnulib module netinet_in
1983 +
1984 +BUILT_SOURCES += $(NETINET_IN_H)
1985 +
1986 +# We need the following in order to create <netinet/in.h> when the system
1987 +# doesn't have one.
1988 +netinet/in.h: netinet_in.in.h
1989 +       @MKDIR_P@ netinet
1990 +       rm -f $@-t $@
1991 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
1992 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
1993 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1994 +             -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
1995 +             -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
1996 +             < $(srcdir)/netinet_in.in.h; \
1997 +       } > $@-t
1998 +       mv $@-t $@
1999 +MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
2000 +MOSTLYCLEANDIRS += netinet
2001 +
2002 +EXTRA_DIST += netinet_in.in.h
2003 +
2004 +## end   gnulib module netinet_in
2005 +
2006 +## begin gnulib module recv
2007 +
2008 +
2009 +EXTRA_DIST += winsock.c
2010 +
2011 +EXTRA_libgnu_la_SOURCES += winsock.c
2012 +
2013 +## end   gnulib module recv
2014 +
2015 +## begin gnulib module send
2016 +
2017 +
2018 +EXTRA_DIST += winsock.c
2019 +
2020 +EXTRA_libgnu_la_SOURCES += winsock.c
2021 +
2022 +## end   gnulib module send
2023 +
2024 +## begin gnulib module size_max
2025 +
2026 +libgnu_la_SOURCES += size_max.h
2027 +
2028 +## end   gnulib module size_max
2029 +
2030 +## begin gnulib module snprintf
2031 +
2032 +
2033 +EXTRA_DIST += snprintf.c
2034 +
2035 +EXTRA_libgnu_la_SOURCES += snprintf.c
2036 +
2037 +## end   gnulib module snprintf
2038 +
2039 +## begin gnulib module socket
2040 +
2041 +
2042 +EXTRA_DIST += winsock.c
2043 +
2044 +EXTRA_libgnu_la_SOURCES += winsock.c
2045 +
2046 +## end   gnulib module socket
2047 +
2048 +## begin gnulib module stdbool
2049 +
2050 +BUILT_SOURCES += $(STDBOOL_H)
2051 +
2052 +# We need the following in order to create <stdbool.h> when the system
2053 +# doesn't have one that works.
2054 +stdbool.h: stdbool.in.h
2055 +       rm -f $@-t $@
2056 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2057 +         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
2058 +       } > $@-t
2059 +       mv $@-t $@
2060 +MOSTLYCLEANFILES += stdbool.h stdbool.h-t
2061 +
2062 +EXTRA_DIST += stdbool.in.h
2063 +
2064 +## end   gnulib module stdbool
2065 +
2066 +## begin gnulib module stdint
2067 +
2068 +BUILT_SOURCES += $(STDINT_H)
2069 +
2070 +# We need the following in order to create <stdint.h> when the system
2071 +# doesn't have one that works with the given compiler.
2072 +stdint.h: stdint.in.h
2073 +       rm -f $@-t $@
2074 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2075 +         sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
2076 +             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2077 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2078 +             -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
2079 +             -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
2080 +             -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
2081 +             -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
2082 +             -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
2083 +             -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
2084 +             -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
2085 +             -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
2086 +             -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
2087 +             -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
2088 +             -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
2089 +             -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
2090 +             -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
2091 +             -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
2092 +             -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
2093 +             -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
2094 +             -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
2095 +             -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
2096 +             -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
2097 +             -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
2098 +             < $(srcdir)/stdint.in.h; \
2099 +       } > $@-t
2100 +       mv $@-t $@
2101 +MOSTLYCLEANFILES += stdint.h stdint.h-t
2102 +
2103 +EXTRA_DIST += stdint.in.h
2104 +
2105 +## end   gnulib module stdint
2106 +
2107 +## begin gnulib module stdio
2108 +
2109 +BUILT_SOURCES += stdio.h
2110 +
2111 +# We need the following in order to create <stdio.h> when the system
2112 +# doesn't have one that works with the given compiler.
2113 +stdio.h: stdio.in.h
2114 +       rm -f $@-t $@
2115 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
2116 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2117 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2118 +             -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
2119 +             -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \
2120 +             -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
2121 +             -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \
2122 +             -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
2123 +             -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
2124 +             -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
2125 +             -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \
2126 +             -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
2127 +             -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \
2128 +             -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
2129 +             -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
2130 +             -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
2131 +             -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
2132 +             -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
2133 +             -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
2134 +             -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
2135 +             -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
2136 +             -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
2137 +             -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
2138 +             -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
2139 +             -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
2140 +             -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
2141 +             -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
2142 +             -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
2143 +             -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \
2144 +             -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \
2145 +             -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \
2146 +             -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \
2147 +             -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
2148 +             -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
2149 +             -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
2150 +             -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \
2151 +             -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
2152 +             -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
2153 +             -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
2154 +             -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
2155 +             -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
2156 +             -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
2157 +             -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
2158 +             -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
2159 +             -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
2160 +             -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
2161 +             -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
2162 +             -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
2163 +             -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
2164 +             -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
2165 +             -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
2166 +             -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
2167 +             -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
2168 +             -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
2169 +             -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
2170 +             -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
2171 +             -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
2172 +             -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
2173 +             -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
2174 +             -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
2175 +             -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
2176 +             -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
2177 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2178 +             < $(srcdir)/stdio.in.h; \
2179 +       } > $@-t
2180 +       mv $@-t $@
2181 +MOSTLYCLEANFILES += stdio.h stdio.h-t
2182 +
2183 +EXTRA_DIST += stdio-write.c stdio.in.h
2184 +
2185 +EXTRA_libgnu_la_SOURCES += stdio-write.c
2186 +
2187 +## end   gnulib module stdio
2188 +
2189 +## begin gnulib module sys_socket
2190 +
2191 +BUILT_SOURCES += $(SYS_SOCKET_H)
2192 +
2193 +# We need the following in order to create <sys/socket.h> when the system
2194 +# doesn't have one that works with the given compiler.
2195 +sys/socket.h: sys_socket.in.h
2196 +       @MKDIR_P@ sys
2197 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2198 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2199 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2200 +             -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
2201 +             -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
2202 +             -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \
2203 +             -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \
2204 +             -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \
2205 +             -e 's|@''GNULIB_BIND''@|$(GNULIB_BIND)|g' \
2206 +             -e 's|@''GNULIB_GETPEERNAME''@|$(GNULIB_GETPEERNAME)|g' \
2207 +             -e 's|@''GNULIB_GETSOCKNAME''@|$(GNULIB_GETSOCKNAME)|g' \
2208 +             -e 's|@''GNULIB_GETSOCKOPT''@|$(GNULIB_GETSOCKOPT)|g' \
2209 +             -e 's|@''GNULIB_LISTEN''@|$(GNULIB_LISTEN)|g' \
2210 +             -e 's|@''GNULIB_RECV''@|$(GNULIB_RECV)|g' \
2211 +             -e 's|@''GNULIB_SEND''@|$()GNULIB_SEND|g' \
2212 +             -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \
2213 +             -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \
2214 +             -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \
2215 +             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
2216 +             -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
2217 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2218 +             < $(srcdir)/sys_socket.in.h; \
2219 +       } > $@-t
2220 +       mv -f $@-t $@
2221 +MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
2222 +MOSTLYCLEANDIRS += sys
2223 +
2224 +EXTRA_DIST += sys_socket.in.h winsock.c
2225 +
2226 +EXTRA_libgnu_la_SOURCES += winsock.c
2227 +
2228 +## end   gnulib module sys_socket
2229 +
2230 +## begin gnulib module vasnprintf
2231 +
2232 +
2233 +EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h
2234 +
2235 +EXTRA_libgnu_la_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c
2236 +
2237 +## end   gnulib module vasnprintf
2238 +
2239 +## begin gnulib module vc-list-files
2240 +
2241 +
2242 +EXTRA_DIST += $(top_srcdir)/./vc-list-files
2243 +
2244 +## end   gnulib module vc-list-files
2245 +
2246 +## begin gnulib module wchar
2247 +
2248 +BUILT_SOURCES += $(WCHAR_H)
2249 +
2250 +# We need the following in order to create <wchar.h> when the system
2251 +# version does not work standalone.
2252 +wchar.h: wchar.in.h
2253 +       rm -f $@-t $@
2254 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2255 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2256 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2257 +             -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
2258 +             -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
2259 +             -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
2260 +             -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
2261 +             -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
2262 +             -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
2263 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2264 +           < $(srcdir)/wchar.in.h; \
2265 +       } > $@-t
2266 +       mv $@-t $@
2267 +MOSTLYCLEANFILES += wchar.h wchar.h-t
2268 +
2269 +EXTRA_DIST += wchar.in.h
2270 +
2271 +## end   gnulib module wchar
2272 +
2273 +## begin gnulib module xsize
2274 +
2275 +libgnu_la_SOURCES += xsize.h
2276 +
2277 +## end   gnulib module xsize
2278 +
2279 +## begin gnulib module dummy
2280 +
2281 +libgnu_la_SOURCES += dummy.c
2282 +
2283 +## end   gnulib module dummy
2284 +
2285 +
2286 +mostlyclean-local: mostlyclean-generic
2287 +       @for dir in '' $(MOSTLYCLEANDIRS); do \
2288 +         if test -n "$$dir" && test -d $$dir; then \
2289 +           echo "rmdir $$dir"; rmdir $$dir; \
2290 +         fi; \
2291 +       done; \
2292 +       :
2293 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/Makefile.am~ gtk-vnc-0.3.7.gnulib/gnulib/lib/Makefile.am~
2294 --- gtk-vnc-0.3.7.mingw/gnulib/lib/Makefile.am~ 1970-01-01 01:00:00.000000000 +0100
2295 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/Makefile.am~        2008-10-09 12:24:40.000000000 +0100
2296 @@ -0,0 +1,448 @@
2297 +## DO NOT EDIT! GENERATED AUTOMATICALLY!
2298 +## Process this file with automake to produce Makefile.in.
2299 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
2300 +#
2301 +# This file is free software, distributed under the terms of the GNU
2302 +# General Public License.  As a special exception to the GNU General
2303 +# Public License, this file may be distributed as part of a program
2304 +# that contains a configuration script generated by Autoconf, under
2305 +# the same distribution terms as the rest of that program.
2306 +#
2307 +# Generated by gnulib-tool.
2308 +# 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 getaddrinfo vc-list-files
2309 +
2310 +AUTOMAKE_OPTIONS = 1.5 gnits
2311 +
2312 +SUBDIRS =
2313 +noinst_HEADERS =
2314 +noinst_LIBRARIES =
2315 +noinst_LTLIBRARIES =
2316 +EXTRA_DIST =
2317 +BUILT_SOURCES =
2318 +SUFFIXES =
2319 +MOSTLYCLEANFILES = core *.stackdump
2320 +MOSTLYCLEANDIRS =
2321 +CLEANFILES =
2322 +DISTCLEANFILES =
2323 +MAINTAINERCLEANFILES =
2324 +
2325 +AM_CPPFLAGS =
2326 +
2327 +noinst_LTLIBRARIES += libgnu.la
2328 +
2329 +libgnu_la_SOURCES =
2330 +libgnu_la_LIBADD = $(gl_LTLIBOBJS)
2331 +libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
2332 +EXTRA_libgnu_la_SOURCES =
2333 +libgnu_la_LDFLAGS = $(AM_LDFLAGS)
2334 +
2335 +## begin gnulib module alloca-opt
2336 +
2337 +BUILT_SOURCES += $(ALLOCA_H)
2338 +
2339 +# We need the following in order to create <alloca.h> when the system
2340 +# doesn't have one that works with the given compiler.
2341 +alloca.h: alloca.in.h
2342 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2343 +         cat $(srcdir)/alloca.in.h; \
2344 +       } > $@-t
2345 +       mv -f $@-t $@
2346 +MOSTLYCLEANFILES += alloca.h alloca.h-t
2347 +
2348 +EXTRA_DIST += alloca.in.h
2349 +
2350 +## end   gnulib module alloca-opt
2351 +
2352 +## begin gnulib module arpa_inet
2353 +
2354 +BUILT_SOURCES += $(ARPA_INET_H)
2355 +
2356 +# We need the following in order to create <arpa/inet.h> when the system
2357 +# doesn't have one.
2358 +arpa/inet.h:
2359 +       @MKDIR_P@ arpa
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_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
2365 +             -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
2366 +             -e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \
2367 +             -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
2368 +             -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
2369 +             -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
2370 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2371 +             < $(srcdir)/arpa_inet.in.h; \
2372 +       } > $@-t
2373 +       mv $@-t $@
2374 +MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
2375 +MOSTLYCLEANDIRS += arpa
2376 +
2377 +EXTRA_DIST += arpa_inet.in.h
2378 +
2379 +## end   gnulib module arpa_inet
2380 +
2381 +## begin gnulib module errno
2382 +
2383 +BUILT_SOURCES += $(ERRNO_H)
2384 +
2385 +# We need the following in order to create <errno.h> when the system
2386 +# doesn't have one that is POSIX compliant.
2387 +errno.h: errno.in.h
2388 +       rm -f $@-t $@
2389 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
2390 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2391 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2392 +             -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
2393 +             -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
2394 +             -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
2395 +             -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
2396 +             -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
2397 +             -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
2398 +             -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
2399 +             < $(srcdir)/errno.in.h; \
2400 +       } > $@-t
2401 +       mv $@-t $@
2402 +MOSTLYCLEANFILES += errno.h errno.h-t
2403 +
2404 +EXTRA_DIST += errno.in.h
2405 +
2406 +## end   gnulib module errno
2407 +
2408 +## begin gnulib module float
2409 +
2410 +BUILT_SOURCES += $(FLOAT_H)
2411 +
2412 +# We need the following in order to create <float.h> when the system
2413 +# doesn't have one that works with the given compiler.
2414 +float.h: float.in.h
2415 +       rm -f $@-t $@
2416 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
2417 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2418 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2419 +             -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
2420 +             < $(srcdir)/float.in.h; \
2421 +       } > $@-t
2422 +       mv $@-t $@
2423 +MOSTLYCLEANFILES += float.h float.h-t
2424 +
2425 +EXTRA_DIST += float.in.h
2426 +
2427 +## end   gnulib module float
2428 +
2429 +## begin gnulib module getaddrinfo
2430 +
2431 +
2432 +EXTRA_DIST += gai_strerror.c getaddrinfo.c getaddrinfo.h
2433 +
2434 +EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c
2435 +
2436 +## end   gnulib module getaddrinfo
2437 +
2438 +## begin gnulib module gettext-h
2439 +
2440 +libgnu_la_SOURCES += gettext.h
2441 +
2442 +## end   gnulib module gettext-h
2443 +
2444 +## begin gnulib module inet_ntop
2445 +
2446 +
2447 +EXTRA_DIST += inet_ntop.c
2448 +
2449 +EXTRA_libgnu_la_SOURCES += inet_ntop.c
2450 +
2451 +## end   gnulib module inet_ntop
2452 +
2453 +## begin gnulib module link-warning
2454 +
2455 +LINK_WARNING_H=$(top_srcdir)/./link-warning.h
2456 +
2457 +EXTRA_DIST += $(top_srcdir)/./link-warning.h
2458 +
2459 +## end   gnulib module link-warning
2460 +
2461 +## begin gnulib module netinet_in
2462 +
2463 +BUILT_SOURCES += $(NETINET_IN_H)
2464 +
2465 +# We need the following in order to create <netinet/in.h> when the system
2466 +# doesn't have one.
2467 +netinet/in.h: netinet_in.in.h
2468 +       @MKDIR_P@ netinet
2469 +       rm -f $@-t $@
2470 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2471 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2472 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2473 +             -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
2474 +             -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
2475 +             < $(srcdir)/netinet_in.in.h; \
2476 +       } > $@-t
2477 +       mv $@-t $@
2478 +MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
2479 +MOSTLYCLEANDIRS += netinet
2480 +
2481 +EXTRA_DIST += netinet_in.in.h
2482 +
2483 +## end   gnulib module netinet_in
2484 +
2485 +## begin gnulib module size_max
2486 +
2487 +libgnu_la_SOURCES += size_max.h
2488 +
2489 +## end   gnulib module size_max
2490 +
2491 +## begin gnulib module snprintf
2492 +
2493 +
2494 +EXTRA_DIST += snprintf.c
2495 +
2496 +EXTRA_libgnu_la_SOURCES += snprintf.c
2497 +
2498 +## end   gnulib module snprintf
2499 +
2500 +## begin gnulib module stdbool
2501 +
2502 +BUILT_SOURCES += $(STDBOOL_H)
2503 +
2504 +# We need the following in order to create <stdbool.h> when the system
2505 +# doesn't have one that works.
2506 +stdbool.h: stdbool.in.h
2507 +       rm -f $@-t $@
2508 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2509 +         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
2510 +       } > $@-t
2511 +       mv $@-t $@
2512 +MOSTLYCLEANFILES += stdbool.h stdbool.h-t
2513 +
2514 +EXTRA_DIST += stdbool.in.h
2515 +
2516 +## end   gnulib module stdbool
2517 +
2518 +## begin gnulib module stdint
2519 +
2520 +BUILT_SOURCES += $(STDINT_H)
2521 +
2522 +# We need the following in order to create <stdint.h> when the system
2523 +# doesn't have one that works with the given compiler.
2524 +stdint.h: stdint.in.h
2525 +       rm -f $@-t $@
2526 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2527 +         sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
2528 +             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2529 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2530 +             -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
2531 +             -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
2532 +             -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
2533 +             -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
2534 +             -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
2535 +             -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
2536 +             -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
2537 +             -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
2538 +             -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
2539 +             -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
2540 +             -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
2541 +             -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
2542 +             -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
2543 +             -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
2544 +             -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
2545 +             -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
2546 +             -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
2547 +             -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
2548 +             -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
2549 +             -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
2550 +             < $(srcdir)/stdint.in.h; \
2551 +       } > $@-t
2552 +       mv $@-t $@
2553 +MOSTLYCLEANFILES += stdint.h stdint.h-t
2554 +
2555 +EXTRA_DIST += stdint.in.h
2556 +
2557 +## end   gnulib module stdint
2558 +
2559 +## begin gnulib module stdio
2560 +
2561 +BUILT_SOURCES += stdio.h
2562 +
2563 +# We need the following in order to create <stdio.h> when the system
2564 +# doesn't have one that works with the given compiler.
2565 +stdio.h: stdio.in.h
2566 +       rm -f $@-t $@
2567 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
2568 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2569 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2570 +             -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
2571 +             -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \
2572 +             -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
2573 +             -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \
2574 +             -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
2575 +             -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
2576 +             -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
2577 +             -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \
2578 +             -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
2579 +             -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \
2580 +             -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
2581 +             -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
2582 +             -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
2583 +             -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
2584 +             -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
2585 +             -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
2586 +             -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
2587 +             -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
2588 +             -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
2589 +             -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
2590 +             -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
2591 +             -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
2592 +             -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
2593 +             -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
2594 +             -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
2595 +             -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \
2596 +             -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \
2597 +             -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \
2598 +             -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \
2599 +             -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
2600 +             -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
2601 +             -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
2602 +             -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \
2603 +             -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
2604 +             -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
2605 +             -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
2606 +             -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
2607 +             -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
2608 +             -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
2609 +             -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
2610 +             -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
2611 +             -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
2612 +             -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
2613 +             -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
2614 +             -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
2615 +             -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
2616 +             -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
2617 +             -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
2618 +             -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
2619 +             -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
2620 +             -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
2621 +             -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
2622 +             -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
2623 +             -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
2624 +             -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
2625 +             -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
2626 +             -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
2627 +             -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
2628 +             -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
2629 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2630 +             < $(srcdir)/stdio.in.h; \
2631 +       } > $@-t
2632 +       mv $@-t $@
2633 +MOSTLYCLEANFILES += stdio.h stdio.h-t
2634 +
2635 +EXTRA_DIST += stdio-write.c stdio.in.h
2636 +
2637 +EXTRA_libgnu_la_SOURCES += stdio-write.c
2638 +
2639 +## end   gnulib module stdio
2640 +
2641 +## begin gnulib module sys_socket
2642 +
2643 +BUILT_SOURCES += $(SYS_SOCKET_H)
2644 +
2645 +# We need the following in order to create <sys/socket.h> when the system
2646 +# doesn't have one that works with the given compiler.
2647 +sys/socket.h: sys_socket.in.h
2648 +       @MKDIR_P@ sys
2649 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2650 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2651 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2652 +             -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
2653 +             -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
2654 +             -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \
2655 +             -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \
2656 +             -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \
2657 +             -e 's|@''GNULIB_BIND''@|$(GNULIB_BIND)|g' \
2658 +             -e 's|@''GNULIB_GETPEERNAME''@|$(GNULIB_GETPEERNAME)|g' \
2659 +             -e 's|@''GNULIB_GETSOCKNAME''@|$(GNULIB_GETSOCKNAME)|g' \
2660 +             -e 's|@''GNULIB_GETSOCKOPT''@|$(GNULIB_GETSOCKOPT)|g' \
2661 +             -e 's|@''GNULIB_LISTEN''@|$(GNULIB_LISTEN)|g' \
2662 +             -e 's|@''GNULIB_RECV''@|$(GNULIB_RECV)|g' \
2663 +             -e 's|@''GNULIB_SEND''@|$()GNULIB_SEND|g' \
2664 +             -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \
2665 +             -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \
2666 +             -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \
2667 +             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
2668 +             -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
2669 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2670 +             < $(srcdir)/sys_socket.in.h; \
2671 +       } > $@-t
2672 +       mv -f $@-t $@
2673 +MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
2674 +MOSTLYCLEANDIRS += sys
2675 +
2676 +EXTRA_DIST += sys_socket.in.h winsock.c
2677 +
2678 +EXTRA_libgnu_la_SOURCES += winsock.c
2679 +
2680 +## end   gnulib module sys_socket
2681 +
2682 +## begin gnulib module vasnprintf
2683 +
2684 +
2685 +EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h
2686 +
2687 +EXTRA_libgnu_la_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c
2688 +
2689 +## end   gnulib module vasnprintf
2690 +
2691 +## begin gnulib module vc-list-files
2692 +
2693 +
2694 +EXTRA_DIST += $(top_srcdir)/./vc-list-files
2695 +
2696 +## end   gnulib module vc-list-files
2697 +
2698 +## begin gnulib module wchar
2699 +
2700 +BUILT_SOURCES += $(WCHAR_H)
2701 +
2702 +# We need the following in order to create <wchar.h> when the system
2703 +# version does not work standalone.
2704 +wchar.h: wchar.in.h
2705 +       rm -f $@-t $@
2706 +       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
2707 +         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2708 +             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2709 +             -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
2710 +             -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
2711 +             -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
2712 +             -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
2713 +             -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
2714 +             -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
2715 +             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
2716 +           < $(srcdir)/wchar.in.h; \
2717 +       } > $@-t
2718 +       mv $@-t $@
2719 +MOSTLYCLEANFILES += wchar.h wchar.h-t
2720 +
2721 +EXTRA_DIST += wchar.in.h
2722 +
2723 +## end   gnulib module wchar
2724 +
2725 +## begin gnulib module xsize
2726 +
2727 +libgnu_la_SOURCES += xsize.h
2728 +
2729 +## end   gnulib module xsize
2730 +
2731 +## begin gnulib module dummy
2732 +
2733 +libgnu_la_SOURCES += dummy.c
2734 +
2735 +## end   gnulib module dummy
2736 +
2737 +
2738 +mostlyclean-local: mostlyclean-generic
2739 +       @for dir in '' $(MOSTLYCLEANDIRS); do \
2740 +         if test -n "$$dir" && test -d $$dir; then \
2741 +           echo "rmdir $$dir"; rmdir $$dir; \
2742 +         fi; \
2743 +       done; \
2744 +       :
2745 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/netinet_in.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/netinet_in.in.h
2746 --- gtk-vnc-0.3.7.mingw/gnulib/lib/netinet_in.in.h      1970-01-01 01:00:00.000000000 +0100
2747 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/netinet_in.in.h     2008-10-09 12:24:39.000000000 +0100
2748 @@ -0,0 +1,45 @@
2749 +/* Substitute for <netinet/in.h>.
2750 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
2751 +
2752 +   This program is free software; you can redistribute it and/or modify
2753 +   it under the terms of the GNU Lesser General Public License as published by
2754 +   the Free Software Foundation; either version 2.1, or (at your option)
2755 +   any later version.
2756 +
2757 +   This program is distributed in the hope that it will be useful,
2758 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2759 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2760 +   GNU Lesser General Public License for more details.
2761 +
2762 +   You should have received a copy of the GNU Lesser General Public License
2763 +   along with this program; if not, write to the Free Software Foundation,
2764 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
2765 +
2766 +#ifndef _GL_NETINET_IN_H
2767 +
2768 +#if @HAVE_NETINET_IN_H@
2769 +
2770 +@PRAGMA_SYSTEM_HEADER@
2771 +
2772 +/* On many platforms, <netinet/in.h> assumes prior inclusion of
2773 +   <sys/types.h>.  */
2774 +# include <sys/types.h>
2775 +
2776 +/* The include_next requires a split double-inclusion guard.  */
2777 +# @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@
2778 +
2779 +#endif
2780 +
2781 +#ifndef _GL_NETINET_IN_H
2782 +#define _GL_NETINET_IN_H
2783 +
2784 +#if !@HAVE_NETINET_IN_H@
2785 +
2786 +/* A platform that lacks <netinet/in.h>.  */
2787 +
2788 +# include <sys/socket.h>
2789 +
2790 +#endif
2791 +
2792 +#endif /* _GL_NETINET_IN_H */
2793 +#endif /* _GL_NETINET_IN_H */
2794 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/printf-args.c gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.c
2795 --- gtk-vnc-0.3.7.mingw/gnulib/lib/printf-args.c        1970-01-01 01:00:00.000000000 +0100
2796 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.c       2008-10-09 12:24:39.000000000 +0100
2797 @@ -0,0 +1,187 @@
2798 +/* Decomposed printf argument list.
2799 +   Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
2800 +
2801 +   This program is free software; you can redistribute it and/or modify
2802 +   it under the terms of the GNU Lesser General Public License as published by
2803 +   the Free Software Foundation; either version 2.1, or (at your option)
2804 +   any later version.
2805 +
2806 +   This program is distributed in the hope that it will be useful,
2807 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2808 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2809 +   GNU Lesser General Public License for more details.
2810 +
2811 +   You should have received a copy of the GNU Lesser General Public License along
2812 +   with this program; if not, write to the Free Software Foundation,
2813 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
2814 +
2815 +/* This file can be parametrized with the following macros:
2816 +     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
2817 +     PRINTF_FETCHARGS   Name of the function to be defined.
2818 +     STATIC             Set to 'static' to declare the function static.  */
2819 +
2820 +#ifndef PRINTF_FETCHARGS
2821 +# include <config.h>
2822 +#endif
2823 +
2824 +/* Specification.  */
2825 +#ifndef PRINTF_FETCHARGS
2826 +# include "printf-args.h"
2827 +#endif
2828 +
2829 +#ifdef STATIC
2830 +STATIC
2831 +#endif
2832 +int
2833 +PRINTF_FETCHARGS (va_list args, arguments *a)
2834 +{
2835 +  size_t i;
2836 +  argument *ap;
2837 +
2838 +  for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
2839 +    switch (ap->type)
2840 +      {
2841 +      case TYPE_SCHAR:
2842 +       ap->a.a_schar = va_arg (args, /*signed char*/ int);
2843 +       break;
2844 +      case TYPE_UCHAR:
2845 +       ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
2846 +       break;
2847 +      case TYPE_SHORT:
2848 +       ap->a.a_short = va_arg (args, /*short*/ int);
2849 +       break;
2850 +      case TYPE_USHORT:
2851 +       ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
2852 +       break;
2853 +      case TYPE_INT:
2854 +       ap->a.a_int = va_arg (args, int);
2855 +       break;
2856 +      case TYPE_UINT:
2857 +       ap->a.a_uint = va_arg (args, unsigned int);
2858 +       break;
2859 +      case TYPE_LONGINT:
2860 +       ap->a.a_longint = va_arg (args, long int);
2861 +       break;
2862 +      case TYPE_ULONGINT:
2863 +       ap->a.a_ulongint = va_arg (args, unsigned long int);
2864 +       break;
2865 +#if HAVE_LONG_LONG_INT
2866 +      case TYPE_LONGLONGINT:
2867 +       ap->a.a_longlongint = va_arg (args, long long int);
2868 +       break;
2869 +      case TYPE_ULONGLONGINT:
2870 +       ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
2871 +       break;
2872 +#endif
2873 +      case TYPE_DOUBLE:
2874 +       ap->a.a_double = va_arg (args, double);
2875 +       break;
2876 +      case TYPE_LONGDOUBLE:
2877 +       ap->a.a_longdouble = va_arg (args, long double);
2878 +       break;
2879 +      case TYPE_CHAR:
2880 +       ap->a.a_char = va_arg (args, int);
2881 +       break;
2882 +#if HAVE_WINT_T
2883 +      case TYPE_WIDE_CHAR:
2884 +       /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
2885 +          default argument promotions", this is not the case in mingw32,
2886 +          where wint_t is 'unsigned short'.  */
2887 +       ap->a.a_wide_char =
2888 +         (sizeof (wint_t) < sizeof (int)
2889 +          ? va_arg (args, int)
2890 +          : va_arg (args, wint_t));
2891 +       break;
2892 +#endif
2893 +      case TYPE_STRING:
2894 +       ap->a.a_string = va_arg (args, const char *);
2895 +       /* A null pointer is an invalid argument for "%s", but in practice
2896 +          it occurs quite frequently in printf statements that produce
2897 +          debug output.  Use a fallback in this case.  */
2898 +       if (ap->a.a_string == NULL)
2899 +         ap->a.a_string = "(NULL)";
2900 +       break;
2901 +#if HAVE_WCHAR_T
2902 +      case TYPE_WIDE_STRING:
2903 +       ap->a.a_wide_string = va_arg (args, const wchar_t *);
2904 +       /* A null pointer is an invalid argument for "%ls", but in practice
2905 +          it occurs quite frequently in printf statements that produce
2906 +          debug output.  Use a fallback in this case.  */
2907 +       if (ap->a.a_wide_string == NULL)
2908 +         {
2909 +           static const wchar_t wide_null_string[] =
2910 +             {
2911 +               (wchar_t)'(',
2912 +               (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
2913 +               (wchar_t)')',
2914 +               (wchar_t)0
2915 +             };
2916 +           ap->a.a_wide_string = wide_null_string;
2917 +         }
2918 +       break;
2919 +#endif
2920 +      case TYPE_POINTER:
2921 +       ap->a.a_pointer = va_arg (args, void *);
2922 +       break;
2923 +      case TYPE_COUNT_SCHAR_POINTER:
2924 +       ap->a.a_count_schar_pointer = va_arg (args, signed char *);
2925 +       break;
2926 +      case TYPE_COUNT_SHORT_POINTER:
2927 +       ap->a.a_count_short_pointer = va_arg (args, short *);
2928 +       break;
2929 +      case TYPE_COUNT_INT_POINTER:
2930 +       ap->a.a_count_int_pointer = va_arg (args, int *);
2931 +       break;
2932 +      case TYPE_COUNT_LONGINT_POINTER:
2933 +       ap->a.a_count_longint_pointer = va_arg (args, long int *);
2934 +       break;
2935 +#if HAVE_LONG_LONG_INT
2936 +      case TYPE_COUNT_LONGLONGINT_POINTER:
2937 +       ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
2938 +       break;
2939 +#endif
2940 +#if ENABLE_UNISTDIO
2941 +      /* The unistdio extensions.  */
2942 +      case TYPE_U8_STRING:
2943 +       ap->a.a_u8_string = va_arg (args, const uint8_t *);
2944 +       /* A null pointer is an invalid argument for "%U", but in practice
2945 +          it occurs quite frequently in printf statements that produce
2946 +          debug output.  Use a fallback in this case.  */
2947 +       if (ap->a.a_u8_string == NULL)
2948 +         {
2949 +           static const uint8_t u8_null_string[] =
2950 +             { '(', 'N', 'U', 'L', 'L', ')', 0 };
2951 +           ap->a.a_u8_string = u8_null_string;
2952 +         }
2953 +       break;
2954 +      case TYPE_U16_STRING:
2955 +       ap->a.a_u16_string = va_arg (args, const uint16_t *);
2956 +       /* A null pointer is an invalid argument for "%lU", but in practice
2957 +          it occurs quite frequently in printf statements that produce
2958 +          debug output.  Use a fallback in this case.  */
2959 +       if (ap->a.a_u16_string == NULL)
2960 +         {
2961 +           static const uint16_t u16_null_string[] =
2962 +             { '(', 'N', 'U', 'L', 'L', ')', 0 };
2963 +           ap->a.a_u16_string = u16_null_string;
2964 +         }
2965 +       break;
2966 +      case TYPE_U32_STRING:
2967 +       ap->a.a_u32_string = va_arg (args, const uint32_t *);
2968 +       /* A null pointer is an invalid argument for "%llU", but in practice
2969 +          it occurs quite frequently in printf statements that produce
2970 +          debug output.  Use a fallback in this case.  */
2971 +       if (ap->a.a_u32_string == NULL)
2972 +         {
2973 +           static const uint32_t u32_null_string[] =
2974 +             { '(', 'N', 'U', 'L', 'L', ')', 0 };
2975 +           ap->a.a_u32_string = u32_null_string;
2976 +         }
2977 +       break;
2978 +#endif
2979 +      default:
2980 +       /* Unknown type.  */
2981 +       return -1;
2982 +      }
2983 +  return 0;
2984 +}
2985 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/printf-args.h gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.h
2986 --- gtk-vnc-0.3.7.mingw/gnulib/lib/printf-args.h        1970-01-01 01:00:00.000000000 +0100
2987 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.h       2008-10-09 12:24:39.000000000 +0100
2988 @@ -0,0 +1,154 @@
2989 +/* Decomposed printf argument list.
2990 +   Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc.
2991 +
2992 +   This program is free software; you can redistribute it and/or modify
2993 +   it under the terms of the GNU Lesser General Public License as published by
2994 +   the Free Software Foundation; either version 2.1, or (at your option)
2995 +   any later version.
2996 +
2997 +   This program is distributed in the hope that it will be useful,
2998 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2999 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3000 +   GNU Lesser General Public License for more details.
3001 +
3002 +   You should have received a copy of the GNU Lesser General Public License along
3003 +   with this program; if not, write to the Free Software Foundation,
3004 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
3005 +
3006 +#ifndef _PRINTF_ARGS_H
3007 +#define _PRINTF_ARGS_H
3008 +
3009 +/* This file can be parametrized with the following macros:
3010 +     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
3011 +     PRINTF_FETCHARGS   Name of the function to be declared.
3012 +     STATIC             Set to 'static' to declare the function static.  */
3013 +
3014 +/* Default parameters.  */
3015 +#ifndef PRINTF_FETCHARGS
3016 +# define PRINTF_FETCHARGS printf_fetchargs
3017 +#endif
3018 +
3019 +/* Get size_t.  */
3020 +#include <stddef.h>
3021 +
3022 +/* Get wchar_t.  */
3023 +#if HAVE_WCHAR_T
3024 +# include <stddef.h>
3025 +#endif
3026 +
3027 +/* Get wint_t.  */
3028 +#if HAVE_WINT_T
3029 +# include <wchar.h>
3030 +#endif
3031 +
3032 +/* Get va_list.  */
3033 +#include <stdarg.h>
3034 +
3035 +
3036 +/* Argument types */
3037 +typedef enum
3038 +{
3039 +  TYPE_NONE,
3040 +  TYPE_SCHAR,
3041 +  TYPE_UCHAR,
3042 +  TYPE_SHORT,
3043 +  TYPE_USHORT,
3044 +  TYPE_INT,
3045 +  TYPE_UINT,
3046 +  TYPE_LONGINT,
3047 +  TYPE_ULONGINT,
3048 +#if HAVE_LONG_LONG_INT
3049 +  TYPE_LONGLONGINT,
3050 +  TYPE_ULONGLONGINT,
3051 +#endif
3052 +  TYPE_DOUBLE,
3053 +  TYPE_LONGDOUBLE,
3054 +  TYPE_CHAR,
3055 +#if HAVE_WINT_T
3056 +  TYPE_WIDE_CHAR,
3057 +#endif
3058 +  TYPE_STRING,
3059 +#if HAVE_WCHAR_T
3060 +  TYPE_WIDE_STRING,
3061 +#endif
3062 +  TYPE_POINTER,
3063 +  TYPE_COUNT_SCHAR_POINTER,
3064 +  TYPE_COUNT_SHORT_POINTER,
3065 +  TYPE_COUNT_INT_POINTER,
3066 +  TYPE_COUNT_LONGINT_POINTER
3067 +#if HAVE_LONG_LONG_INT
3068 +, TYPE_COUNT_LONGLONGINT_POINTER
3069 +#endif
3070 +#if ENABLE_UNISTDIO
3071 +  /* The unistdio extensions.  */
3072 +, TYPE_U8_STRING
3073 +, TYPE_U16_STRING
3074 +, TYPE_U32_STRING
3075 +#endif
3076 +} arg_type;
3077 +
3078 +/* Polymorphic argument */
3079 +typedef struct
3080 +{
3081 +  arg_type type;
3082 +  union
3083 +  {
3084 +    signed char                        a_schar;
3085 +    unsigned char              a_uchar;
3086 +    short                      a_short;
3087 +    unsigned short             a_ushort;
3088 +    int                                a_int;
3089 +    unsigned int               a_uint;
3090 +    long int                   a_longint;
3091 +    unsigned long int          a_ulongint;
3092 +#if HAVE_LONG_LONG_INT
3093 +    long long int              a_longlongint;
3094 +    unsigned long long int     a_ulonglongint;
3095 +#endif
3096 +    float                      a_float;
3097 +    double                     a_double;
3098 +    long double                        a_longdouble;
3099 +    int                                a_char;
3100 +#if HAVE_WINT_T
3101 +    wint_t                     a_wide_char;
3102 +#endif
3103 +    const char*                        a_string;
3104 +#if HAVE_WCHAR_T
3105 +    const wchar_t*             a_wide_string;
3106 +#endif
3107 +    void*                      a_pointer;
3108 +    signed char *              a_count_schar_pointer;
3109 +    short *                    a_count_short_pointer;
3110 +    int *                      a_count_int_pointer;
3111 +    long int *                 a_count_longint_pointer;
3112 +#if HAVE_LONG_LONG_INT
3113 +    long long int *            a_count_longlongint_pointer;
3114 +#endif
3115 +#if ENABLE_UNISTDIO
3116 +    /* The unistdio extensions.  */
3117 +    const uint8_t *            a_u8_string;
3118 +    const uint16_t *           a_u16_string;
3119 +    const uint32_t *           a_u32_string;
3120 +#endif
3121 +  }
3122 +  a;
3123 +}
3124 +argument;
3125 +
3126 +typedef struct
3127 +{
3128 +  size_t count;
3129 +  argument *arg;
3130 +}
3131 +arguments;
3132 +
3133 +
3134 +/* Fetch the arguments, putting them into a. */
3135 +#ifdef STATIC
3136 +STATIC
3137 +#else
3138 +extern
3139 +#endif
3140 +int PRINTF_FETCHARGS (va_list args, arguments *a);
3141 +
3142 +#endif /* _PRINTF_ARGS_H */
3143 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/printf-parse.c gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.c
3144 --- gtk-vnc-0.3.7.mingw/gnulib/lib/printf-parse.c       1970-01-01 01:00:00.000000000 +0100
3145 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.c      2008-10-09 12:24:39.000000000 +0100
3146 @@ -0,0 +1,627 @@
3147 +/* Formatted output to strings.
3148 +   Copyright (C) 1999-2000, 2002-2003, 2006-2008 Free Software Foundation, Inc.
3149 +
3150 +   This program is free software; you can redistribute it and/or modify
3151 +   it under the terms of the GNU Lesser General Public License as published by
3152 +   the Free Software Foundation; either version 2.1, or (at your option)
3153 +   any later version.
3154 +
3155 +   This program is distributed in the hope that it will be useful,
3156 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3157 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3158 +   GNU Lesser General Public License for more details.
3159 +
3160 +   You should have received a copy of the GNU Lesser General Public License along
3161 +   with this program; if not, write to the Free Software Foundation,
3162 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
3163 +
3164 +/* This file can be parametrized with the following macros:
3165 +     CHAR_T             The element type of the format string.
3166 +     CHAR_T_ONLY_ASCII  Set to 1 to enable verification that all characters
3167 +                        in the format string are ASCII.
3168 +     DIRECTIVE          Structure denoting a format directive.
3169 +                        Depends on CHAR_T.
3170 +     DIRECTIVES         Structure denoting the set of format directives of a
3171 +                        format string.  Depends on CHAR_T.
3172 +     PRINTF_PARSE       Function that parses a format string.
3173 +                        Depends on CHAR_T.
3174 +     STATIC             Set to 'static' to declare the function static.
3175 +     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.  */
3176 +
3177 +#ifndef PRINTF_PARSE
3178 +# include <config.h>
3179 +#endif
3180 +
3181 +/* Specification.  */
3182 +#ifndef PRINTF_PARSE
3183 +# include "printf-parse.h"
3184 +#endif
3185 +
3186 +/* Default parameters.  */
3187 +#ifndef PRINTF_PARSE
3188 +# define PRINTF_PARSE printf_parse
3189 +# define CHAR_T char
3190 +# define DIRECTIVE char_directive
3191 +# define DIRECTIVES char_directives
3192 +#endif
3193 +
3194 +/* Get size_t, NULL.  */
3195 +#include <stddef.h>
3196 +
3197 +/* Get intmax_t.  */
3198 +#if defined IN_LIBINTL || defined IN_LIBASPRINTF
3199 +# if HAVE_STDINT_H_WITH_UINTMAX
3200 +#  include <stdint.h>
3201 +# endif
3202 +# if HAVE_INTTYPES_H_WITH_UINTMAX
3203 +#  include <inttypes.h>
3204 +# endif
3205 +#else
3206 +# include <stdint.h>
3207 +#endif
3208 +
3209 +/* malloc(), realloc(), free().  */
3210 +#include <stdlib.h>
3211 +
3212 +/* errno.  */
3213 +#include <errno.h>
3214 +
3215 +/* Checked size_t computations.  */
3216 +#include "xsize.h"
3217 +
3218 +#if CHAR_T_ONLY_ASCII
3219 +/* c_isascii().  */
3220 +# include "c-ctype.h"
3221 +#endif
3222 +
3223 +#ifdef STATIC
3224 +STATIC
3225 +#endif
3226 +int
3227 +PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
3228 +{
3229 +  const CHAR_T *cp = format;           /* pointer into format */
3230 +  size_t arg_posn = 0;         /* number of regular arguments consumed */
3231 +  size_t d_allocated;                  /* allocated elements of d->dir */
3232 +  size_t a_allocated;                  /* allocated elements of a->arg */
3233 +  size_t max_width_length = 0;
3234 +  size_t max_precision_length = 0;
3235 +
3236 +  d->count = 0;
3237 +  d_allocated = 1;
3238 +  d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE));
3239 +  if (d->dir == NULL)
3240 +    /* Out of memory.  */
3241 +    goto out_of_memory_1;
3242 +
3243 +  a->count = 0;
3244 +  a_allocated = 0;
3245 +  a->arg = NULL;
3246 +
3247 +#define REGISTER_ARG(_index_,_type_) \
3248 +  {                                                                    \
3249 +    size_t n = (_index_);                                              \
3250 +    if (n >= a_allocated)                                              \
3251 +      {                                                                        \
3252 +       size_t memory_size;                                             \
3253 +       argument *memory;                                               \
3254 +                                                                       \
3255 +       a_allocated = xtimes (a_allocated, 2);                          \
3256 +       if (a_allocated <= n)                                           \
3257 +         a_allocated = xsum (n, 1);                                    \
3258 +       memory_size = xtimes (a_allocated, sizeof (argument));          \
3259 +       if (size_overflow_p (memory_size))                              \
3260 +         /* Overflow, would lead to out of memory.  */                 \
3261 +         goto out_of_memory;                                           \
3262 +       memory = (argument *) (a->arg                                   \
3263 +                              ? realloc (a->arg, memory_size)          \
3264 +                              : malloc (memory_size));                 \
3265 +       if (memory == NULL)                                             \
3266 +         /* Out of memory.  */                                         \
3267 +         goto out_of_memory;                                           \
3268 +       a->arg = memory;                                                \
3269 +      }                                                                        \
3270 +    while (a->count <= n)                                              \
3271 +      a->arg[a->count++].type = TYPE_NONE;                             \
3272 +    if (a->arg[n].type == TYPE_NONE)                                   \
3273 +      a->arg[n].type = (_type_);                                       \
3274 +    else if (a->arg[n].type != (_type_))                               \
3275 +      /* Ambiguous type for positional argument.  */                   \
3276 +      goto error;                                                      \
3277 +  }
3278 +
3279 +  while (*cp != '\0')
3280 +    {
3281 +      CHAR_T c = *cp++;
3282 +      if (c == '%')
3283 +       {
3284 +         size_t arg_index = ARG_NONE;
3285 +         DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
3286 +
3287 +         /* Initialize the next directive.  */
3288 +         dp->dir_start = cp - 1;
3289 +         dp->flags = 0;
3290 +         dp->width_start = NULL;
3291 +         dp->width_end = NULL;
3292 +         dp->width_arg_index = ARG_NONE;
3293 +         dp->precision_start = NULL;
3294 +         dp->precision_end = NULL;
3295 +         dp->precision_arg_index = ARG_NONE;
3296 +         dp->arg_index = ARG_NONE;
3297 +
3298 +         /* Test for positional argument.  */
3299 +         if (*cp >= '0' && *cp <= '9')
3300 +           {
3301 +             const CHAR_T *np;
3302 +
3303 +             for (np = cp; *np >= '0' && *np <= '9'; np++)
3304 +               ;
3305 +             if (*np == '$')
3306 +               {
3307 +                 size_t n = 0;
3308 +
3309 +                 for (np = cp; *np >= '0' && *np <= '9'; np++)
3310 +                   n = xsum (xtimes (n, 10), *np - '0');
3311 +                 if (n == 0)
3312 +                   /* Positional argument 0.  */
3313 +                   goto error;
3314 +                 if (size_overflow_p (n))
3315 +                   /* n too large, would lead to out of memory later.  */
3316 +                   goto error;
3317 +                 arg_index = n - 1;
3318 +                 cp = np + 1;
3319 +               }
3320 +           }
3321 +
3322 +         /* Read the flags.  */
3323 +         for (;;)
3324 +           {
3325 +             if (*cp == '\'')
3326 +               {
3327 +                 dp->flags |= FLAG_GROUP;
3328 +                 cp++;
3329 +               }
3330 +             else if (*cp == '-')
3331 +               {
3332 +                 dp->flags |= FLAG_LEFT;
3333 +                 cp++;
3334 +               }
3335 +             else if (*cp == '+')
3336 +               {
3337 +                 dp->flags |= FLAG_SHOWSIGN;
3338 +                 cp++;
3339 +               }
3340 +             else if (*cp == ' ')
3341 +               {
3342 +                 dp->flags |= FLAG_SPACE;
3343 +                 cp++;
3344 +               }
3345 +             else if (*cp == '#')
3346 +               {
3347 +                 dp->flags |= FLAG_ALT;
3348 +                 cp++;
3349 +               }
3350 +             else if (*cp == '0')
3351 +               {
3352 +                 dp->flags |= FLAG_ZERO;
3353 +                 cp++;
3354 +               }
3355 +             else
3356 +               break;
3357 +           }
3358 +
3359 +         /* Parse the field width.  */
3360 +         if (*cp == '*')
3361 +           {
3362 +             dp->width_start = cp;
3363 +             cp++;
3364 +             dp->width_end = cp;
3365 +             if (max_width_length < 1)
3366 +               max_width_length = 1;
3367 +
3368 +             /* Test for positional argument.  */
3369 +             if (*cp >= '0' && *cp <= '9')
3370 +               {
3371 +                 const CHAR_T *np;
3372 +
3373 +                 for (np = cp; *np >= '0' && *np <= '9'; np++)
3374 +                   ;
3375 +                 if (*np == '$')
3376 +                   {
3377 +                     size_t n = 0;
3378 +
3379 +                     for (np = cp; *np >= '0' && *np <= '9'; np++)
3380 +                       n = xsum (xtimes (n, 10), *np - '0');
3381 +                     if (n == 0)
3382 +                       /* Positional argument 0.  */
3383 +                       goto error;
3384 +                     if (size_overflow_p (n))
3385 +                       /* n too large, would lead to out of memory later.  */
3386 +                       goto error;
3387 +                     dp->width_arg_index = n - 1;
3388 +                     cp = np + 1;
3389 +                   }
3390 +               }
3391 +             if (dp->width_arg_index == ARG_NONE)
3392 +               {
3393 +                 dp->width_arg_index = arg_posn++;
3394 +                 if (dp->width_arg_index == ARG_NONE)
3395 +                   /* arg_posn wrapped around.  */
3396 +                   goto error;
3397 +               }
3398 +             REGISTER_ARG (dp->width_arg_index, TYPE_INT);
3399 +           }
3400 +         else if (*cp >= '0' && *cp <= '9')
3401 +           {
3402 +             size_t width_length;
3403 +
3404 +             dp->width_start = cp;
3405 +             for (; *cp >= '0' && *cp <= '9'; cp++)
3406 +               ;
3407 +             dp->width_end = cp;
3408 +             width_length = dp->width_end - dp->width_start;
3409 +             if (max_width_length < width_length)
3410 +               max_width_length = width_length;
3411 +           }
3412 +
3413 +         /* Parse the precision.  */
3414 +         if (*cp == '.')
3415 +           {
3416 +             cp++;
3417 +             if (*cp == '*')
3418 +               {
3419 +                 dp->precision_start = cp - 1;
3420 +                 cp++;
3421 +                 dp->precision_end = cp;
3422 +                 if (max_precision_length < 2)
3423 +                   max_precision_length = 2;
3424 +
3425 +                 /* Test for positional argument.  */
3426 +                 if (*cp >= '0' && *cp <= '9')
3427 +                   {
3428 +                     const CHAR_T *np;
3429 +
3430 +                     for (np = cp; *np >= '0' && *np <= '9'; np++)
3431 +                       ;
3432 +                     if (*np == '$')
3433 +                       {
3434 +                         size_t n = 0;
3435 +
3436 +                         for (np = cp; *np >= '0' && *np <= '9'; np++)
3437 +                           n = xsum (xtimes (n, 10), *np - '0');
3438 +                         if (n == 0)
3439 +                           /* Positional argument 0.  */
3440 +                           goto error;
3441 +                         if (size_overflow_p (n))
3442 +                           /* n too large, would lead to out of memory
3443 +                              later.  */
3444 +                           goto error;
3445 +                         dp->precision_arg_index = n - 1;
3446 +                         cp = np + 1;
3447 +                       }
3448 +                   }
3449 +                 if (dp->precision_arg_index == ARG_NONE)
3450 +                   {
3451 +                     dp->precision_arg_index = arg_posn++;
3452 +                     if (dp->precision_arg_index == ARG_NONE)
3453 +                       /* arg_posn wrapped around.  */
3454 +                       goto error;
3455 +                   }
3456 +                 REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
3457 +               }
3458 +             else
3459 +               {
3460 +                 size_t precision_length;
3461 +
3462 +                 dp->precision_start = cp - 1;
3463 +                 for (; *cp >= '0' && *cp <= '9'; cp++)
3464 +                   ;
3465 +                 dp->precision_end = cp;
3466 +                 precision_length = dp->precision_end - dp->precision_start;
3467 +                 if (max_precision_length < precision_length)
3468 +                   max_precision_length = precision_length;
3469 +               }
3470 +           }
3471 +
3472 +         {
3473 +           arg_type type;
3474 +
3475 +           /* Parse argument type/size specifiers.  */
3476 +           {
3477 +             int flags = 0;
3478 +
3479 +             for (;;)
3480 +               {
3481 +                 if (*cp == 'h')
3482 +                   {
3483 +                     flags |= (1 << (flags & 1));
3484 +                     cp++;
3485 +                   }
3486 +                 else if (*cp == 'L')
3487 +                   {
3488 +                     flags |= 4;
3489 +                     cp++;
3490 +                   }
3491 +                 else if (*cp == 'l')
3492 +                   {
3493 +                     flags += 8;
3494 +                     cp++;
3495 +                   }
3496 +                 else if (*cp == 'j')
3497 +                   {
3498 +                     if (sizeof (intmax_t) > sizeof (long))
3499 +                       {
3500 +                         /* intmax_t = long long */
3501 +                         flags += 16;
3502 +                       }
3503 +                     else if (sizeof (intmax_t) > sizeof (int))
3504 +                       {
3505 +                         /* intmax_t = long */
3506 +                         flags += 8;
3507 +                       }
3508 +                     cp++;
3509 +                   }
3510 +                 else if (*cp == 'z' || *cp == 'Z')
3511 +                   {
3512 +                     /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
3513 +                        because the warning facility in gcc-2.95.2 understands
3514 +                        only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784).  */
3515 +                     if (sizeof (size_t) > sizeof (long))
3516 +                       {
3517 +                         /* size_t = long long */
3518 +                         flags += 16;
3519 +                       }
3520 +                     else if (sizeof (size_t) > sizeof (int))
3521 +                       {
3522 +                         /* size_t = long */
3523 +                         flags += 8;
3524 +                       }
3525 +                     cp++;
3526 +                   }
3527 +                 else if (*cp == 't')
3528 +                   {
3529 +                     if (sizeof (ptrdiff_t) > sizeof (long))
3530 +                       {
3531 +                         /* ptrdiff_t = long long */
3532 +                         flags += 16;
3533 +                       }
3534 +                     else if (sizeof (ptrdiff_t) > sizeof (int))
3535 +                       {
3536 +                         /* ptrdiff_t = long */
3537 +                         flags += 8;
3538 +                       }
3539 +                     cp++;
3540 +                   }
3541 +#if defined __APPLE__ && defined __MACH__
3542 +                 /* On MacOS X 10.3, PRIdMAX is defined as "qd".
3543 +                    We cannot change it to "lld" because PRIdMAX must also
3544 +                    be understood by the system's printf routines.  */
3545 +                 else if (*cp == 'q')
3546 +                   {
3547 +                     if (64 / 8 > sizeof (long))
3548 +                       {
3549 +                         /* int64_t = long long */
3550 +                         flags += 16;
3551 +                       }
3552 +                     else
3553 +                       {
3554 +                         /* int64_t = long */
3555 +                         flags += 8;
3556 +                       }
3557 +                     cp++;
3558 +                   }
3559 +#endif
3560 +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
3561 +                 /* On native Win32, PRIdMAX is defined as "I64d".
3562 +                    We cannot change it to "lld" because PRIdMAX must also
3563 +                    be understood by the system's printf routines.  */
3564 +                 else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
3565 +                   {
3566 +                     if (64 / 8 > sizeof (long))
3567 +                       {
3568 +                         /* __int64 = long long */
3569 +                         flags += 16;
3570 +                       }
3571 +                     else
3572 +                       {
3573 +                         /* __int64 = long */
3574 +                         flags += 8;
3575 +                       }
3576 +                     cp += 3;
3577 +                   }
3578 +#endif
3579 +                 else
3580 +                   break;
3581 +               }
3582 +
3583 +             /* Read the conversion character.  */
3584 +             c = *cp++;
3585 +             switch (c)
3586 +               {
3587 +               case 'd': case 'i':
3588 +#if HAVE_LONG_LONG_INT
3589 +                 /* If 'long long' exists and is larger than 'long':  */
3590 +                 if (flags >= 16 || (flags & 4))
3591 +                   type = TYPE_LONGLONGINT;
3592 +                 else
3593 +#endif
3594 +                 /* If 'long long' exists and is the same as 'long', we parse
3595 +                    "lld" into TYPE_LONGINT.  */
3596 +                 if (flags >= 8)
3597 +                   type = TYPE_LONGINT;
3598 +                 else if (flags & 2)
3599 +                   type = TYPE_SCHAR;
3600 +                 else if (flags & 1)
3601 +                   type = TYPE_SHORT;
3602 +                 else
3603 +                   type = TYPE_INT;
3604 +                 break;
3605 +               case 'o': case 'u': case 'x': case 'X':
3606 +#if HAVE_LONG_LONG_INT
3607 +                 /* If 'long long' exists and is larger than 'long':  */
3608 +                 if (flags >= 16 || (flags & 4))
3609 +                   type = TYPE_ULONGLONGINT;
3610 +                 else
3611 +#endif
3612 +                 /* If 'unsigned long long' exists and is the same as
3613 +                    'unsigned long', we parse "llu" into TYPE_ULONGINT.  */
3614 +                 if (flags >= 8)
3615 +                   type = TYPE_ULONGINT;
3616 +                 else if (flags & 2)
3617 +                   type = TYPE_UCHAR;
3618 +                 else if (flags & 1)
3619 +                   type = TYPE_USHORT;
3620 +                 else
3621 +                   type = TYPE_UINT;
3622 +                 break;
3623 +               case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
3624 +               case 'a': case 'A':
3625 +                 if (flags >= 16 || (flags & 4))
3626 +                   type = TYPE_LONGDOUBLE;
3627 +                 else
3628 +                   type = TYPE_DOUBLE;
3629 +                 break;
3630 +               case 'c':
3631 +                 if (flags >= 8)
3632 +#if HAVE_WINT_T
3633 +                   type = TYPE_WIDE_CHAR;
3634 +#else
3635 +                   goto error;
3636 +#endif
3637 +                 else
3638 +                   type = TYPE_CHAR;
3639 +                 break;
3640 +#if HAVE_WINT_T
3641 +               case 'C':
3642 +                 type = TYPE_WIDE_CHAR;
3643 +                 c = 'c';
3644 +                 break;
3645 +#endif
3646 +               case 's':
3647 +                 if (flags >= 8)
3648 +#if HAVE_WCHAR_T
3649 +                   type = TYPE_WIDE_STRING;
3650 +#else
3651 +                   goto error;
3652 +#endif
3653 +                 else
3654 +                   type = TYPE_STRING;
3655 +                 break;
3656 +#if HAVE_WCHAR_T
3657 +               case 'S':
3658 +                 type = TYPE_WIDE_STRING;
3659 +                 c = 's';
3660 +                 break;
3661 +#endif
3662 +               case 'p':
3663 +                 type = TYPE_POINTER;
3664 +                 break;
3665 +               case 'n':
3666 +#if HAVE_LONG_LONG_INT
3667 +                 /* If 'long long' exists and is larger than 'long':  */
3668 +                 if (flags >= 16 || (flags & 4))
3669 +                   type = TYPE_COUNT_LONGLONGINT_POINTER;
3670 +                 else
3671 +#endif
3672 +                 /* If 'long long' exists and is the same as 'long', we parse
3673 +                    "lln" into TYPE_COUNT_LONGINT_POINTER.  */
3674 +                 if (flags >= 8)
3675 +                   type = TYPE_COUNT_LONGINT_POINTER;
3676 +                 else if (flags & 2)
3677 +                   type = TYPE_COUNT_SCHAR_POINTER;
3678 +                 else if (flags & 1)
3679 +                   type = TYPE_COUNT_SHORT_POINTER;
3680 +                 else
3681 +                   type = TYPE_COUNT_INT_POINTER;
3682 +                 break;
3683 +#if ENABLE_UNISTDIO
3684 +               /* The unistdio extensions.  */
3685 +               case 'U':
3686 +                 if (flags >= 16)
3687 +                   type = TYPE_U32_STRING;
3688 +                 else if (flags >= 8)
3689 +                   type = TYPE_U16_STRING;
3690 +                 else
3691 +                   type = TYPE_U8_STRING;
3692 +                 break;
3693 +#endif
3694 +               case '%':
3695 +                 type = TYPE_NONE;
3696 +                 break;
3697 +               default:
3698 +                 /* Unknown conversion character.  */
3699 +                 goto error;
3700 +               }
3701 +           }
3702 +
3703 +           if (type != TYPE_NONE)
3704 +             {
3705 +               dp->arg_index = arg_index;
3706 +               if (dp->arg_index == ARG_NONE)
3707 +                 {
3708 +                   dp->arg_index = arg_posn++;
3709 +                   if (dp->arg_index == ARG_NONE)
3710 +                     /* arg_posn wrapped around.  */
3711 +                     goto error;
3712 +                 }
3713 +               REGISTER_ARG (dp->arg_index, type);
3714 +             }
3715 +           dp->conversion = c;
3716 +           dp->dir_end = cp;
3717 +         }
3718 +
3719 +         d->count++;
3720 +         if (d->count >= d_allocated)
3721 +           {
3722 +             size_t memory_size;
3723 +             DIRECTIVE *memory;
3724 +
3725 +             d_allocated = xtimes (d_allocated, 2);
3726 +             memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
3727 +             if (size_overflow_p (memory_size))
3728 +               /* Overflow, would lead to out of memory.  */
3729 +               goto out_of_memory;
3730 +             memory = (DIRECTIVE *) realloc (d->dir, memory_size);
3731 +             if (memory == NULL)
3732 +               /* Out of memory.  */
3733 +               goto out_of_memory;
3734 +             d->dir = memory;
3735 +           }
3736 +       }
3737 +#if CHAR_T_ONLY_ASCII
3738 +      else if (!c_isascii (c))
3739 +       {
3740 +         /* Non-ASCII character.  Not supported.  */
3741 +         goto error;
3742 +       }
3743 +#endif
3744 +    }
3745 +  d->dir[d->count].dir_start = cp;
3746 +
3747 +  d->max_width_length = max_width_length;
3748 +  d->max_precision_length = max_precision_length;
3749 +  return 0;
3750 +
3751 +error:
3752 +  if (a->arg)
3753 +    free (a->arg);
3754 +  if (d->dir)
3755 +    free (d->dir);
3756 +  errno = EINVAL;
3757 +  return -1;
3758 +
3759 +out_of_memory:
3760 +  if (a->arg)
3761 +    free (a->arg);
3762 +  if (d->dir)
3763 +    free (d->dir);
3764 +out_of_memory_1:
3765 +  errno = ENOMEM;
3766 +  return -1;
3767 +}
3768 +
3769 +#undef PRINTF_PARSE
3770 +#undef DIRECTIVES
3771 +#undef DIRECTIVE
3772 +#undef CHAR_T_ONLY_ASCII
3773 +#undef CHAR_T
3774 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/printf-parse.h gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.h
3775 --- gtk-vnc-0.3.7.mingw/gnulib/lib/printf-parse.h       1970-01-01 01:00:00.000000000 +0100
3776 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.h      2008-10-09 12:24:39.000000000 +0100
3777 @@ -0,0 +1,179 @@
3778 +/* Parse printf format string.
3779 +   Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc.
3780 +
3781 +   This program is free software; you can redistribute it and/or modify
3782 +   it under the terms of the GNU Lesser General Public License as published by
3783 +   the Free Software Foundation; either version 2.1, or (at your option)
3784 +   any later version.
3785 +
3786 +   This program is distributed in the hope that it will be useful,
3787 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3788 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3789 +   GNU Lesser General Public License for more details.
3790 +
3791 +   You should have received a copy of the GNU Lesser General Public License along
3792 +   with this program; if not, write to the Free Software Foundation,
3793 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
3794 +
3795 +#ifndef _PRINTF_PARSE_H
3796 +#define _PRINTF_PARSE_H
3797 +
3798 +/* This file can be parametrized with the following macros:
3799 +     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
3800 +     STATIC             Set to 'static' to declare the function static.  */
3801 +
3802 +#include "printf-args.h"
3803 +
3804 +
3805 +/* Flags */
3806 +#define FLAG_GROUP      1      /* ' flag */
3807 +#define FLAG_LEFT       2      /* - flag */
3808 +#define FLAG_SHOWSIGN   4      /* + flag */
3809 +#define FLAG_SPACE      8      /* space flag */
3810 +#define FLAG_ALT       16      /* # flag */
3811 +#define FLAG_ZERO      32
3812 +
3813 +/* arg_index value indicating that no argument is consumed.  */
3814 +#define ARG_NONE       (~(size_t)0)
3815 +
3816 +/* xxx_directive: A parsed directive.
3817 +   xxx_directives: A parsed format string.  */
3818 +
3819 +/* A parsed directive.  */
3820 +typedef struct
3821 +{
3822 +  const char* dir_start;
3823 +  const char* dir_end;
3824 +  int flags;
3825 +  const char* width_start;
3826 +  const char* width_end;
3827 +  size_t width_arg_index;
3828 +  const char* precision_start;
3829 +  const char* precision_end;
3830 +  size_t precision_arg_index;
3831 +  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 */
3832 +  size_t arg_index;
3833 +}
3834 +char_directive;
3835 +
3836 +/* A parsed format string.  */
3837 +typedef struct
3838 +{
3839 +  size_t count;
3840 +  char_directive *dir;
3841 +  size_t max_width_length;
3842 +  size_t max_precision_length;
3843 +}
3844 +char_directives;
3845 +
3846 +#if ENABLE_UNISTDIO
3847 +
3848 +/* A parsed directive.  */
3849 +typedef struct
3850 +{
3851 +  const uint8_t* dir_start;
3852 +  const uint8_t* dir_end;
3853 +  int flags;
3854 +  const uint8_t* width_start;
3855 +  const uint8_t* width_end;
3856 +  size_t width_arg_index;
3857 +  const uint8_t* precision_start;
3858 +  const uint8_t* precision_end;
3859 +  size_t precision_arg_index;
3860 +  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 */
3861 +  size_t arg_index;
3862 +}
3863 +u8_directive;
3864 +
3865 +/* A parsed format string.  */
3866 +typedef struct
3867 +{
3868 +  size_t count;
3869 +  u8_directive *dir;
3870 +  size_t max_width_length;
3871 +  size_t max_precision_length;
3872 +}
3873 +u8_directives;
3874 +
3875 +/* A parsed directive.  */
3876 +typedef struct
3877 +{
3878 +  const uint16_t* dir_start;
3879 +  const uint16_t* dir_end;
3880 +  int flags;
3881 +  const uint16_t* width_start;
3882 +  const uint16_t* width_end;
3883 +  size_t width_arg_index;
3884 +  const uint16_t* precision_start;
3885 +  const uint16_t* precision_end;
3886 +  size_t precision_arg_index;
3887 +  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 */
3888 +  size_t arg_index;
3889 +}
3890 +u16_directive;
3891 +
3892 +/* A parsed format string.  */
3893 +typedef struct
3894 +{
3895 +  size_t count;
3896 +  u16_directive *dir;
3897 +  size_t max_width_length;
3898 +  size_t max_precision_length;
3899 +}
3900 +u16_directives;
3901 +
3902 +/* A parsed directive.  */
3903 +typedef struct
3904 +{
3905 +  const uint32_t* dir_start;
3906 +  const uint32_t* dir_end;
3907 +  int flags;
3908 +  const uint32_t* width_start;
3909 +  const uint32_t* width_end;
3910 +  size_t width_arg_index;
3911 +  const uint32_t* precision_start;
3912 +  const uint32_t* precision_end;
3913 +  size_t precision_arg_index;
3914 +  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 */
3915 +  size_t arg_index;
3916 +}
3917 +u32_directive;
3918 +
3919 +/* A parsed format string.  */
3920 +typedef struct
3921 +{
3922 +  size_t count;
3923 +  u32_directive *dir;
3924 +  size_t max_width_length;
3925 +  size_t max_precision_length;
3926 +}
3927 +u32_directives;
3928 +
3929 +#endif
3930 +
3931 +
3932 +/* Parses the format string.  Fills in the number N of directives, and fills
3933 +   in directives[0], ..., directives[N-1], and sets directives[N].dir_start
3934 +   to the end of the format string.  Also fills in the arg_type fields of the
3935 +   arguments and the needed count of arguments.  */
3936 +#if ENABLE_UNISTDIO
3937 +extern int
3938 +       ulc_printf_parse (const char *format, char_directives *d, arguments *a);
3939 +extern int
3940 +       u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
3941 +extern int
3942 +       u16_printf_parse (const uint16_t *format, u16_directives *d,
3943 +                        arguments *a);
3944 +extern int
3945 +       u32_printf_parse (const uint32_t *format, u32_directives *d,
3946 +                        arguments *a);
3947 +#else
3948 +# ifdef STATIC
3949 +STATIC
3950 +# else
3951 +extern
3952 +# endif
3953 +int printf_parse (const char *format, char_directives *d, arguments *a);
3954 +#endif
3955 +
3956 +#endif /* _PRINTF_PARSE_H */
3957 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/size_max.h gtk-vnc-0.3.7.gnulib/gnulib/lib/size_max.h
3958 --- gtk-vnc-0.3.7.mingw/gnulib/lib/size_max.h   1970-01-01 01:00:00.000000000 +0100
3959 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/size_max.h  2008-10-09 12:24:39.000000000 +0100
3960 @@ -0,0 +1,31 @@
3961 +/* size_max.h -- declare SIZE_MAX through system headers
3962 +   Copyright (C) 2005-2006 Free Software Foundation, Inc.
3963 +   Written by Simon Josefsson.
3964 +
3965 +   This program is free software; you can redistribute it and/or modify
3966 +   it under the terms of the GNU Lesser General Public License as published by
3967 +   the Free Software Foundation; either version 2.1, or (at your option)
3968 +   any later version.
3969 +
3970 +   This program is distributed in the hope that it will be useful,
3971 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3972 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3973 +   GNU Lesser General Public License for more details.
3974 +
3975 +   You should have received a copy of the GNU Lesser General Public License
3976 +   along with this program; if not, write to the Free Software Foundation,
3977 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
3978 +
3979 +#ifndef GNULIB_SIZE_MAX_H
3980 +#define GNULIB_SIZE_MAX_H
3981 +
3982 +/* Get SIZE_MAX declaration on systems like Solaris 7/8/9.  */
3983 +# include <limits.h>
3984 +/* Get SIZE_MAX declaration on systems like glibc 2.  */
3985 +# if HAVE_STDINT_H
3986 +#  include <stdint.h>
3987 +# endif
3988 +/* On systems where these include files don't define it, SIZE_MAX is defined
3989 +   in config.h.  */
3990 +
3991 +#endif /* GNULIB_SIZE_MAX_H */
3992 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/snprintf.c gtk-vnc-0.3.7.gnulib/gnulib/lib/snprintf.c
3993 --- gtk-vnc-0.3.7.mingw/gnulib/lib/snprintf.c   1970-01-01 01:00:00.000000000 +0100
3994 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/snprintf.c  2008-10-09 12:24:39.000000000 +0100
3995 @@ -0,0 +1,72 @@
3996 +/* Formatted output to strings.
3997 +   Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc.
3998 +   Written by Simon Josefsson and Paul Eggert.
3999 +
4000 +   This program is free software; you can redistribute it and/or modify
4001 +   it under the terms of the GNU Lesser General Public License as published by
4002 +   the Free Software Foundation; either version 2.1, or (at your option)
4003 +   any later version.
4004 +
4005 +   This program is distributed in the hope that it will be useful,
4006 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
4007 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4008 +   GNU Lesser General Public License for more details.
4009 +
4010 +   You should have received a copy of the GNU Lesser General Public License along
4011 +   with this program; if not, write to the Free Software Foundation,
4012 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
4013 +
4014 +#include <config.h>
4015 +
4016 +/* Specification.  */
4017 +#include <stdio.h>
4018 +
4019 +#include <errno.h>
4020 +#include <limits.h>
4021 +#include <stdarg.h>
4022 +#include <stdlib.h>
4023 +#include <string.h>
4024 +
4025 +#include "vasnprintf.h"
4026 +
4027 +/* Print formatted output to string STR.  Similar to sprintf, but
4028 +   additional length SIZE limit how much is written into STR.  Returns
4029 +   string length of formatted string (which may be larger than SIZE).
4030 +   STR may be NULL, in which case nothing will be written.  On error,
4031 +   return a negative value.  */
4032 +int
4033 +snprintf (char *str, size_t size, const char *format, ...)
4034 +{
4035 +  char *output;
4036 +  size_t len;
4037 +  size_t lenbuf = size;
4038 +  va_list args;
4039 +
4040 +  va_start (args, format);
4041 +  output = vasnprintf (str, &lenbuf, format, args);
4042 +  len = lenbuf;
4043 +  va_end (args);
4044 +
4045 +  if (!output)
4046 +    return -1;
4047 +
4048 +  if (output != str)
4049 +    {
4050 +      if (size)
4051 +       {
4052 +         size_t pruned_len = (len < size ? len : size - 1);
4053 +         memcpy (str, output, pruned_len);
4054 +         str[pruned_len] = '\0';
4055 +       }
4056 +
4057 +      free (output);
4058 +    }
4059 +
4060 +  if (INT_MAX < len)
4061 +    {
4062 +      errno = EOVERFLOW;
4063 +      return -1;
4064 +    }
4065 +
4066 +  return len;
4067 +}
4068 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/stdbool.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/stdbool.in.h
4069 --- gtk-vnc-0.3.7.mingw/gnulib/lib/stdbool.in.h 1970-01-01 01:00:00.000000000 +0100
4070 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdbool.in.h        2008-10-09 12:24:39.000000000 +0100
4071 @@ -0,0 +1,119 @@
4072 +/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc.
4073 +   Written by Bruno Haible <haible@clisp.cons.org>, 2001.
4074 +
4075 +   This program is free software; you can redistribute it and/or modify
4076 +   it under the terms of the GNU Lesser General Public License as published by
4077 +   the Free Software Foundation; either version 2.1, or (at your option)
4078 +   any later version.
4079 +
4080 +   This program is distributed in the hope that it will be useful,
4081 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
4082 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4083 +   GNU Lesser General Public License for more details.
4084 +
4085 +   You should have received a copy of the GNU Lesser General Public License
4086 +   along with this program; if not, write to the Free Software Foundation,
4087 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
4088 +
4089 +#ifndef _GL_STDBOOL_H
4090 +#define _GL_STDBOOL_H
4091 +
4092 +/* ISO C 99 <stdbool.h> for platforms that lack it.  */
4093 +
4094 +/* Usage suggestions:
4095 +
4096 +   Programs that use <stdbool.h> should be aware of some limitations
4097 +   and standards compliance issues.
4098 +
4099 +   Standards compliance:
4100 +
4101 +       - <stdbool.h> must be #included before 'bool', 'false', 'true'
4102 +         can be used.
4103 +
4104 +       - You cannot assume that sizeof (bool) == 1.
4105 +
4106 +       - Programs should not undefine the macros bool, true, and false,
4107 +         as C99 lists that as an "obsolescent feature".
4108 +
4109 +   Limitations of this substitute, when used in a C89 environment:
4110 +
4111 +       - <stdbool.h> must be #included before the '_Bool' type can be used.
4112 +
4113 +       - You cannot assume that _Bool is a typedef; it might be a macro.
4114 +
4115 +       - Bit-fields of type 'bool' are not supported.  Portable code
4116 +         should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
4117 +
4118 +       - In C99, casts and automatic conversions to '_Bool' or 'bool' are
4119 +         performed in such a way that every nonzero value gets converted
4120 +         to 'true', and zero gets converted to 'false'.  This doesn't work
4121 +         with this substitute.  With this substitute, only the values 0 and 1
4122 +         give the expected result when converted to _Bool' or 'bool'.
4123 +
4124 +   Also, it is suggested that programs use 'bool' rather than '_Bool';
4125 +   this isn't required, but 'bool' is more common.  */
4126 +
4127 +
4128 +/* 7.16. Boolean type and values */
4129 +
4130 +/* BeOS <sys/socket.h> already #defines false 0, true 1.  We use the same
4131 +   definitions below, but temporarily we have to #undef them.  */
4132 +#if defined __BEOS__ && !defined __HAIKU__
4133 +# include <OS.h> /* defines bool but not _Bool */
4134 +# undef false
4135 +# undef true
4136 +#endif
4137 +
4138 +/* For the sake of symbolic names in gdb, we define true and false as
4139 +   enum constants, not only as macros.
4140 +   It is tempting to write
4141 +      typedef enum { false = 0, true = 1 } _Bool;
4142 +   so that gdb prints values of type 'bool' symbolically. But if we do
4143 +   this, values of type '_Bool' may promote to 'int' or 'unsigned int'
4144 +   (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
4145 +   (see ISO C 99 6.3.1.1.(2)).  So we add a negative value to the
4146 +   enum; this ensures that '_Bool' promotes to 'int'.  */
4147 +#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__)
4148 +  /* A compiler known to have 'bool'.  */
4149 +  /* If the compiler already has both 'bool' and '_Bool', we can assume they
4150 +     are the same types.  */
4151 +# if !@HAVE__BOOL@
4152 +typedef bool _Bool;
4153 +# endif
4154 +#else
4155 +# if !defined __GNUC__
4156 +   /* If @HAVE__BOOL@:
4157 +        Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
4158 +        the built-in _Bool type is used.  See
4159 +          http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
4160 +          http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
4161 +          http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
4162 +        Similar bugs are likely with other compilers as well; this file
4163 +        wouldn't be used if <stdbool.h> was working.
4164 +        So we override the _Bool type.
4165 +      If !@HAVE__BOOL@:
4166 +        Need to define _Bool ourselves. As 'signed char' or as an enum type?
4167 +        Use of a typedef, with SunPRO C, leads to a stupid
4168 +          "warning: _Bool is a keyword in ISO C99".
4169 +        Use of an enum type, with IRIX cc, leads to a stupid
4170 +          "warning(1185): enumerated type mixed with another type".
4171 +        Even the existence of an enum type, without a typedef,
4172 +          "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
4173 +        The only benefit of the enum, debuggability, is not important
4174 +        with these compilers.  So use 'signed char' and no enum.  */
4175 +#  define _Bool signed char
4176 +# else
4177 +   /* With this compiler, trust the _Bool type if the compiler has it.  */
4178 +#  if !@HAVE__BOOL@
4179 +typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
4180 +#  endif
4181 +# endif
4182 +#endif
4183 +#define bool _Bool
4184 +
4185 +/* The other macros must be usable in preprocessor directives.  */
4186 +#define false 0
4187 +#define true 1
4188 +#define __bool_true_false_are_defined 1
4189 +
4190 +#endif /* _GL_STDBOOL_H */
4191 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/stdint.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/stdint.in.h
4192 --- gtk-vnc-0.3.7.mingw/gnulib/lib/stdint.in.h  1970-01-01 01:00:00.000000000 +0100
4193 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdint.in.h 2008-10-09 12:24:39.000000000 +0100
4194 @@ -0,0 +1,523 @@
4195 +/* Copyright (C) 2001-2002, 2004-2008 Free Software Foundation, Inc.
4196 +   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
4197 +   This file is part of gnulib.
4198 +
4199 +   This program is free software; you can redistribute it and/or modify
4200 +   it under the terms of the GNU Lesser General Public License as published by
4201 +   the Free Software Foundation; either version 2.1, or (at your option)
4202 +   any later version.
4203 +
4204 +   This program is distributed in the hope that it will be useful,
4205 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
4206 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4207 +   GNU Lesser General Public License for more details.
4208 +
4209 +   You should have received a copy of the GNU Lesser General Public License
4210 +   along with this program; if not, write to the Free Software Foundation,
4211 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
4212 +
4213 +/*
4214 + * ISO C 99 <stdint.h> for platforms that lack it.
4215 + * <http://www.opengroup.org/susv3xbd/stdint.h.html>
4216 + */
4217 +
4218 +#ifndef _GL_STDINT_H
4219 +
4220 +/* When including a system file that in turn includes <inttypes.h>,
4221 +   use the system <inttypes.h>, not our substitute.  This avoids
4222 +   problems with (for example) VMS, whose <sys/bitypes.h> includes
4223 +   <inttypes.h>.  */
4224 +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
4225 +
4226 +/* Get those types that are already defined in other system include
4227 +   files, so that we can "#define int8_t signed char" below without
4228 +   worrying about a later system include file containing a "typedef
4229 +   signed char int8_t;" that will get messed up by our macro.  Our
4230 +   macros should all be consistent with the system versions, except
4231 +   for the "fast" types and macros, which we recommend against using
4232 +   in public interfaces due to compiler differences.  */
4233 +
4234 +#if @HAVE_STDINT_H@
4235 +# if defined __sgi && ! defined __c99
4236 +   /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
4237 +      with "This header file is to be used only for c99 mode compilations"
4238 +      diagnostics.  */
4239 +#  define __STDINT_H__
4240 +# endif
4241 +  /* Other systems may have an incomplete or buggy <stdint.h>.
4242 +     Include it before <inttypes.h>, since any "#include <stdint.h>"
4243 +     in <inttypes.h> would reinclude us, skipping our contents because
4244 +     _GL_STDINT_H is defined.
4245 +     The include_next requires a split double-inclusion guard.  */
4246 +@PRAGMA_SYSTEM_HEADER@
4247 +# @INCLUDE_NEXT@ @NEXT_STDINT_H@
4248 +#endif
4249 +
4250 +#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
4251 +#define _GL_STDINT_H
4252 +
4253 +/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
4254 +   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
4255 +   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
4256 +   MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
4257 +   relies on the system <stdint.h> definitions, so include
4258 +   <sys/types.h> after @NEXT_STDINT_H@.  */
4259 +#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
4260 +# include <sys/types.h>
4261 +#endif
4262 +
4263 +/* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
4264 +#include <limits.h>
4265 +
4266 +#if @HAVE_INTTYPES_H@
4267 +  /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
4268 +     int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
4269 +     <inttypes.h> also defines intptr_t and uintptr_t.  */
4270 +# include <inttypes.h>
4271 +#elif @HAVE_SYS_INTTYPES_H@
4272 +  /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
4273 +     the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
4274 +# include <sys/inttypes.h>
4275 +#endif
4276 +
4277 +#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
4278 +  /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
4279 +     int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
4280 +     included by <sys/types.h>.  */
4281 +# include <sys/bitypes.h>
4282 +#endif
4283 +
4284 +#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
4285 +
4286 +/* Get WCHAR_MIN, WCHAR_MAX.  */
4287 +# if ! (defined WCHAR_MIN && defined WCHAR_MAX)
4288 +#  include <wchar.h>
4289 +# endif
4290 +
4291 +#endif
4292 +
4293 +#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
4294 +
4295 +/* Minimum and maximum values for a integer type under the usual assumption.
4296 +   Return an unspecified value if BITS == 0, adding a check to pacify
4297 +   picky compilers.  */
4298 +
4299 +#define _STDINT_MIN(signed, bits, zero) \
4300 +  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
4301 +
4302 +#define _STDINT_MAX(signed, bits, zero) \
4303 +  ((signed) \
4304 +   ? ~ _STDINT_MIN (signed, bits, zero) \
4305 +   : /* The expression for the unsigned case.  The subtraction of (signed) \
4306 +       is a nop in the unsigned case and avoids "signed integer overflow" \
4307 +       warnings in the signed case.  */ \
4308 +     ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
4309 +
4310 +/* 7.18.1.1. Exact-width integer types */
4311 +
4312 +/* Here we assume a standard architecture where the hardware integer
4313 +   types have 8, 16, 32, optionally 64 bits.  */
4314 +
4315 +#undef int8_t
4316 +#undef uint8_t
4317 +#define int8_t signed char
4318 +#define uint8_t unsigned char
4319 +
4320 +#undef int16_t
4321 +#undef uint16_t
4322 +#define int16_t short int
4323 +#define uint16_t unsigned short int
4324 +
4325 +#undef int32_t
4326 +#undef uint32_t
4327 +#define int32_t int
4328 +#define uint32_t unsigned int
4329 +
4330 +/* Do not undefine int64_t if gnulib is not being used with 64-bit
4331 +   types, since otherwise it breaks platforms like Tandem/NSK.  */
4332 +#if LONG_MAX >> 31 >> 31 == 1
4333 +# undef int64_t
4334 +# define int64_t long int
4335 +# define GL_INT64_T
4336 +#elif defined _MSC_VER
4337 +# undef int64_t
4338 +# define int64_t __int64
4339 +# define GL_INT64_T
4340 +#elif @HAVE_LONG_LONG_INT@
4341 +# undef int64_t
4342 +# define int64_t long long int
4343 +# define GL_INT64_T
4344 +#endif
4345 +
4346 +#if ULONG_MAX >> 31 >> 31 >> 1 == 1
4347 +# undef uint64_t
4348 +# define uint64_t unsigned long int
4349 +# define GL_UINT64_T
4350 +#elif defined _MSC_VER
4351 +# undef uint64_t
4352 +# define uint64_t unsigned __int64
4353 +# define GL_UINT64_T
4354 +#elif @HAVE_UNSIGNED_LONG_LONG_INT@
4355 +# undef uint64_t
4356 +# define uint64_t unsigned long long int
4357 +# define GL_UINT64_T
4358 +#endif
4359 +
4360 +/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
4361 +#define _UINT8_T
4362 +#define _UINT32_T
4363 +#define _UINT64_T
4364 +
4365 +
4366 +/* 7.18.1.2. Minimum-width integer types */
4367 +
4368 +/* Here we assume a standard architecture where the hardware integer
4369 +   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
4370 +   are the same as the corresponding N_t types.  */
4371 +
4372 +#undef int_least8_t
4373 +#undef uint_least8_t
4374 +#undef int_least16_t
4375 +#undef uint_least16_t
4376 +#undef int_least32_t
4377 +#undef uint_least32_t
4378 +#undef int_least64_t
4379 +#undef uint_least64_t
4380 +#define int_least8_t int8_t
4381 +#define uint_least8_t uint8_t
4382 +#define int_least16_t int16_t
4383 +#define uint_least16_t uint16_t
4384 +#define int_least32_t int32_t
4385 +#define uint_least32_t uint32_t
4386 +#ifdef GL_INT64_T
4387 +# define int_least64_t int64_t
4388 +#endif
4389 +#ifdef GL_UINT64_T
4390 +# define uint_least64_t uint64_t
4391 +#endif
4392 +
4393 +/* 7.18.1.3. Fastest minimum-width integer types */
4394 +
4395 +/* Note: Other <stdint.h> substitutes may define these types differently.
4396 +   It is not recommended to use these types in public header files. */
4397 +
4398 +/* Here we assume a standard architecture where the hardware integer
4399 +   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
4400 +   are taken from the same list of types.  Assume that 'long int'
4401 +   is fast enough for all narrower integers.  */
4402 +
4403 +#undef int_fast8_t
4404 +#undef uint_fast8_t
4405 +#undef int_fast16_t
4406 +#undef uint_fast16_t
4407 +#undef int_fast32_t
4408 +#undef uint_fast32_t
4409 +#undef int_fast64_t
4410 +#undef uint_fast64_t
4411 +#define int_fast8_t long int
4412 +#define uint_fast8_t unsigned int_fast8_t
4413 +#define int_fast16_t long int
4414 +#define uint_fast16_t unsigned int_fast16_t
4415 +#define int_fast32_t long int
4416 +#define uint_fast32_t unsigned int_fast32_t
4417 +#ifdef GL_INT64_T
4418 +# define int_fast64_t int64_t
4419 +#endif
4420 +#ifdef GL_UINT64_T
4421 +# define uint_fast64_t uint64_t
4422 +#endif
4423 +
4424 +/* 7.18.1.4. Integer types capable of holding object pointers */
4425 +
4426 +#undef intptr_t
4427 +#undef uintptr_t
4428 +#define intptr_t long int
4429 +#define uintptr_t unsigned long int
4430 +
4431 +/* 7.18.1.5. Greatest-width integer types */
4432 +
4433 +/* Note: These types are compiler dependent. It may be unwise to use them in
4434 +   public header files. */
4435 +
4436 +#undef intmax_t
4437 +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
4438 +# define intmax_t long long int
4439 +#elif defined GL_INT64_T
4440 +# define intmax_t int64_t
4441 +#else
4442 +# define intmax_t long int
4443 +#endif
4444 +
4445 +#undef uintmax_t
4446 +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
4447 +# define uintmax_t unsigned long long int
4448 +#elif defined GL_UINT64_T
4449 +# define uintmax_t uint64_t
4450 +#else
4451 +# define uintmax_t unsigned long int
4452 +#endif
4453 +
4454 +/* Verify that intmax_t and uintmax_t have the same size.  Too much code
4455 +   breaks if this is not the case.  If this check fails, the reason is likely
4456 +   to be found in the autoconf macros.  */
4457 +typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
4458 +
4459 +/* 7.18.2. Limits of specified-width integer types */
4460 +
4461 +#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
4462 +
4463 +/* 7.18.2.1. Limits of exact-width integer types */
4464 +
4465 +/* Here we assume a standard architecture where the hardware integer
4466 +   types have 8, 16, 32, optionally 64 bits.  */
4467 +
4468 +#undef INT8_MIN
4469 +#undef INT8_MAX
4470 +#undef UINT8_MAX
4471 +#define INT8_MIN  (~ INT8_MAX)
4472 +#define INT8_MAX  127
4473 +#define UINT8_MAX  255
4474 +
4475 +#undef INT16_MIN
4476 +#undef INT16_MAX
4477 +#undef UINT16_MAX
4478 +#define INT16_MIN  (~ INT16_MAX)
4479 +#define INT16_MAX  32767
4480 +#define UINT16_MAX  65535
4481 +
4482 +#undef INT32_MIN
4483 +#undef INT32_MAX
4484 +#undef UINT32_MAX
4485 +#define INT32_MIN  (~ INT32_MAX)
4486 +#define INT32_MAX  2147483647
4487 +#define UINT32_MAX  4294967295U
4488 +
4489 +#undef INT64_MIN
4490 +#undef INT64_MAX
4491 +#ifdef GL_INT64_T
4492 +/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
4493 +   evaluates the latter incorrectly in preprocessor expressions.  */
4494 +# define INT64_MIN  (- INTMAX_C (1) << 63)
4495 +# define INT64_MAX  INTMAX_C (9223372036854775807)
4496 +#endif
4497 +
4498 +#undef UINT64_MAX
4499 +#ifdef GL_UINT64_T
4500 +# define UINT64_MAX  UINTMAX_C (18446744073709551615)
4501 +#endif
4502 +
4503 +/* 7.18.2.2. Limits of minimum-width integer types */
4504 +
4505 +/* Here we assume a standard architecture where the hardware integer
4506 +   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
4507 +   are the same as the corresponding N_t types.  */
4508 +
4509 +#undef INT_LEAST8_MIN
4510 +#undef INT_LEAST8_MAX
4511 +#undef UINT_LEAST8_MAX
4512 +#define INT_LEAST8_MIN  INT8_MIN
4513 +#define INT_LEAST8_MAX  INT8_MAX
4514 +#define UINT_LEAST8_MAX  UINT8_MAX
4515 +
4516 +#undef INT_LEAST16_MIN
4517 +#undef INT_LEAST16_MAX
4518 +#undef UINT_LEAST16_MAX
4519 +#define INT_LEAST16_MIN  INT16_MIN
4520 +#define INT_LEAST16_MAX  INT16_MAX
4521 +#define UINT_LEAST16_MAX  UINT16_MAX
4522 +
4523 +#undef INT_LEAST32_MIN
4524 +#undef INT_LEAST32_MAX
4525 +#undef UINT_LEAST32_MAX
4526 +#define INT_LEAST32_MIN  INT32_MIN
4527 +#define INT_LEAST32_MAX  INT32_MAX
4528 +#define UINT_LEAST32_MAX  UINT32_MAX
4529 +
4530 +#undef INT_LEAST64_MIN
4531 +#undef INT_LEAST64_MAX
4532 +#ifdef GL_INT64_T
4533 +# define INT_LEAST64_MIN  INT64_MIN
4534 +# define INT_LEAST64_MAX  INT64_MAX
4535 +#endif
4536 +
4537 +#undef UINT_LEAST64_MAX
4538 +#ifdef GL_UINT64_T
4539 +# define UINT_LEAST64_MAX  UINT64_MAX
4540 +#endif
4541 +
4542 +/* 7.18.2.3. Limits of fastest minimum-width integer types */
4543 +
4544 +/* Here we assume a standard architecture where the hardware integer
4545 +   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
4546 +   are taken from the same list of types.  */
4547 +
4548 +#undef INT_FAST8_MIN
4549 +#undef INT_FAST8_MAX
4550 +#undef UINT_FAST8_MAX
4551 +#define INT_FAST8_MIN  LONG_MIN
4552 +#define INT_FAST8_MAX  LONG_MAX
4553 +#define UINT_FAST8_MAX  ULONG_MAX
4554 +
4555 +#undef INT_FAST16_MIN
4556 +#undef INT_FAST16_MAX
4557 +#undef UINT_FAST16_MAX
4558 +#define INT_FAST16_MIN  LONG_MIN
4559 +#define INT_FAST16_MAX  LONG_MAX
4560 +#define UINT_FAST16_MAX  ULONG_MAX
4561 +
4562 +#undef INT_FAST32_MIN
4563 +#undef INT_FAST32_MAX
4564 +#undef UINT_FAST32_MAX
4565 +#define INT_FAST32_MIN  LONG_MIN
4566 +#define INT_FAST32_MAX  LONG_MAX
4567 +#define UINT_FAST32_MAX  ULONG_MAX
4568 +
4569 +#undef INT_FAST64_MIN
4570 +#undef INT_FAST64_MAX
4571 +#ifdef GL_INT64_T
4572 +# define INT_FAST64_MIN  INT64_MIN
4573 +# define INT_FAST64_MAX  INT64_MAX
4574 +#endif
4575 +
4576 +#undef UINT_FAST64_MAX
4577 +#ifdef GL_UINT64_T
4578 +# define UINT_FAST64_MAX  UINT64_MAX
4579 +#endif
4580 +
4581 +/* 7.18.2.4. Limits of integer types capable of holding object pointers */
4582 +
4583 +#undef INTPTR_MIN
4584 +#undef INTPTR_MAX
4585 +#undef UINTPTR_MAX
4586 +#define INTPTR_MIN  LONG_MIN
4587 +#define INTPTR_MAX  LONG_MAX
4588 +#define UINTPTR_MAX  ULONG_MAX
4589 +
4590 +/* 7.18.2.5. Limits of greatest-width integer types */
4591 +
4592 +#undef INTMAX_MIN
4593 +#undef INTMAX_MAX
4594 +#ifdef INT64_MAX
4595 +# define INTMAX_MIN  INT64_MIN
4596 +# define INTMAX_MAX  INT64_MAX
4597 +#else
4598 +# define INTMAX_MIN  INT32_MIN
4599 +# define INTMAX_MAX  INT32_MAX
4600 +#endif
4601 +
4602 +#undef UINTMAX_MAX
4603 +#ifdef UINT64_MAX
4604 +# define UINTMAX_MAX  UINT64_MAX
4605 +#else
4606 +# define UINTMAX_MAX  UINT32_MAX
4607 +#endif
4608 +
4609 +/* 7.18.3. Limits of other integer types */
4610 +
4611 +/* ptrdiff_t limits */
4612 +#undef PTRDIFF_MIN
4613 +#undef PTRDIFF_MAX
4614 +#define PTRDIFF_MIN  \
4615 +   _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
4616 +#define PTRDIFF_MAX  \
4617 +   _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
4618 +
4619 +/* sig_atomic_t limits */
4620 +#undef SIG_ATOMIC_MIN
4621 +#undef SIG_ATOMIC_MAX
4622 +#define SIG_ATOMIC_MIN  \
4623 +   _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
4624 +               0@SIG_ATOMIC_T_SUFFIX@)
4625 +#define SIG_ATOMIC_MAX  \
4626 +   _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
4627 +               0@SIG_ATOMIC_T_SUFFIX@)
4628 +
4629 +
4630 +/* size_t limit */
4631 +#undef SIZE_MAX
4632 +#define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
4633 +
4634 +/* wchar_t limits */
4635 +#undef WCHAR_MIN
4636 +#undef WCHAR_MAX
4637 +#define WCHAR_MIN  \
4638 +   _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
4639 +#define WCHAR_MAX  \
4640 +   _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
4641 +
4642 +/* wint_t limits */
4643 +#undef WINT_MIN
4644 +#undef WINT_MAX
4645 +#define WINT_MIN  \
4646 +   _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
4647 +#define WINT_MAX  \
4648 +   _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
4649 +
4650 +#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
4651 +
4652 +/* 7.18.4. Macros for integer constants */
4653 +
4654 +#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
4655 +
4656 +/* 7.18.4.1. Macros for minimum-width integer constants */
4657 +/* According to ISO C 99 Technical Corrigendum 1 */
4658 +
4659 +/* Here we assume a standard architecture where the hardware integer
4660 +   types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
4661 +
4662 +#undef INT8_C
4663 +#undef UINT8_C
4664 +#define INT8_C(x) x
4665 +#define UINT8_C(x) x
4666 +
4667 +#undef INT16_C
4668 +#undef UINT16_C
4669 +#define INT16_C(x) x
4670 +#define UINT16_C(x) x
4671 +
4672 +#undef INT32_C
4673 +#undef UINT32_C
4674 +#define INT32_C(x) x
4675 +#define UINT32_C(x) x ## U
4676 +
4677 +#undef INT64_C
4678 +#undef UINT64_C
4679 +#if LONG_MAX >> 31 >> 31 == 1
4680 +# define INT64_C(x) x##L
4681 +#elif defined _MSC_VER
4682 +# define INT64_C(x) x##i64
4683 +#elif @HAVE_LONG_LONG_INT@
4684 +# define INT64_C(x) x##LL
4685 +#endif
4686 +#if ULONG_MAX >> 31 >> 31 >> 1 == 1
4687 +# define UINT64_C(x) x##UL
4688 +#elif defined _MSC_VER
4689 +# define UINT64_C(x) x##ui64
4690 +#elif @HAVE_UNSIGNED_LONG_LONG_INT@
4691 +# define UINT64_C(x) x##ULL
4692 +#endif
4693 +
4694 +/* 7.18.4.2. Macros for greatest-width integer constants */
4695 +
4696 +#undef INTMAX_C
4697 +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
4698 +# define INTMAX_C(x)   x##LL
4699 +#elif defined GL_INT64_T
4700 +# define INTMAX_C(x)   INT64_C(x)
4701 +#else
4702 +# define INTMAX_C(x)   x##L
4703 +#endif
4704 +
4705 +#undef UINTMAX_C
4706 +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
4707 +# define UINTMAX_C(x)  x##ULL
4708 +#elif defined GL_UINT64_T
4709 +# define UINTMAX_C(x)  UINT64_C(x)
4710 +#else
4711 +# define UINTMAX_C(x)  x##UL
4712 +#endif
4713 +
4714 +#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
4715 +
4716 +#endif /* _GL_STDINT_H */
4717 +#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
4718 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/stdio.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio.in.h
4719 --- gtk-vnc-0.3.7.mingw/gnulib/lib/stdio.in.h   1970-01-01 01:00:00.000000000 +0100
4720 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio.in.h  2008-10-09 12:24:39.000000000 +0100
4721 @@ -0,0 +1,475 @@
4722 +/* A GNU-like <stdio.h>.
4723 +
4724 +   Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
4725 +
4726 +   This program is free software; you can redistribute it and/or modify
4727 +   it under the terms of the GNU Lesser General Public License as published by
4728 +   the Free Software Foundation; either version 2.1, or (at your option)
4729 +   any later version.
4730 +
4731 +   This program is distributed in the hope that it will be useful,
4732 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
4733 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4734 +   GNU Lesser General Public License for more details.
4735 +
4736 +   You should have received a copy of the GNU Lesser General Public License
4737 +   along with this program; if not, write to the Free Software Foundation,
4738 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
4739 +
4740 +@PRAGMA_SYSTEM_HEADER@
4741 +
4742 +#if defined __need_FILE || defined __need___FILE
4743 +/* Special invocation convention inside glibc header files.  */
4744 +
4745 +#@INCLUDE_NEXT@ @NEXT_STDIO_H@
4746 +
4747 +#else
4748 +/* Normal invocation convention.  */
4749 +
4750 +#ifndef _GL_STDIO_H
4751 +
4752 +/* The include_next requires a split double-inclusion guard.  */
4753 +#@INCLUDE_NEXT@ @NEXT_STDIO_H@
4754 +
4755 +#ifndef _GL_STDIO_H
4756 +#define _GL_STDIO_H
4757 +
4758 +#include <stdarg.h>
4759 +#include <stddef.h>
4760 +
4761 +#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
4762 +  || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
4763 +  || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
4764 +  || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
4765 +/* Get off_t and ssize_t.  */
4766 +# include <sys/types.h>
4767 +#endif
4768 +
4769 +#ifndef __attribute__
4770 +/* This feature is available in gcc versions 2.5 and later.  */
4771 +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
4772 +#  define __attribute__(Spec) /* empty */
4773 +# endif
4774 +/* The __-protected variants of `format' and `printf' attributes
4775 +   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
4776 +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
4777 +#  define __format__ format
4778 +#  define __printf__ printf
4779 +# endif
4780 +#endif
4781 +
4782 +
4783 +/* The definition of GL_LINK_WARNING is copied here.  */
4784 +
4785 +
4786 +#ifdef __cplusplus
4787 +extern "C" {
4788 +#endif
4789 +
4790 +
4791 +#if @GNULIB_FPRINTF_POSIX@
4792 +# if @REPLACE_FPRINTF@
4793 +#  define fprintf rpl_fprintf
4794 +extern int fprintf (FILE *fp, const char *format, ...)
4795 +       __attribute__ ((__format__ (__printf__, 2, 3)));
4796 +# endif
4797 +#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4798 +# define fprintf rpl_fprintf
4799 +extern int fprintf (FILE *fp, const char *format, ...)
4800 +       __attribute__ ((__format__ (__printf__, 2, 3)));
4801 +#elif defined GNULIB_POSIXCHECK
4802 +# undef fprintf
4803 +# define fprintf \
4804 +    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
4805 +                      "use gnulib module fprintf-posix for portable " \
4806 +                      "POSIX compliance"), \
4807 +     fprintf)
4808 +#endif
4809 +
4810 +#if @GNULIB_VFPRINTF_POSIX@
4811 +# if @REPLACE_VFPRINTF@
4812 +#  define vfprintf rpl_vfprintf
4813 +extern int vfprintf (FILE *fp, const char *format, va_list args)
4814 +       __attribute__ ((__format__ (__printf__, 2, 0)));
4815 +# endif
4816 +#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4817 +# define vfprintf rpl_vfprintf
4818 +extern int vfprintf (FILE *fp, const char *format, va_list args)
4819 +       __attribute__ ((__format__ (__printf__, 2, 0)));
4820 +#elif defined GNULIB_POSIXCHECK
4821 +# undef vfprintf
4822 +# define vfprintf(s,f,a) \
4823 +    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
4824 +                      "use gnulib module vfprintf-posix for portable " \
4825 +                      "POSIX compliance"), \
4826 +     vfprintf (s, f, a))
4827 +#endif
4828 +
4829 +#if @GNULIB_PRINTF_POSIX@
4830 +# if @REPLACE_PRINTF@
4831 +/* Don't break __attribute__((format(printf,M,N))).  */
4832 +#  define printf __printf__
4833 +extern int printf (const char *format, ...)
4834 +       __attribute__ ((__format__ (__printf__, 1, 2)));
4835 +# endif
4836 +#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4837 +/* Don't break __attribute__((format(printf,M,N))).  */
4838 +# define printf __printf__
4839 +extern int printf (const char *format, ...)
4840 +       __attribute__ ((__format__ (__printf__, 1, 2)));
4841 +#elif defined GNULIB_POSIXCHECK
4842 +# undef printf
4843 +# define printf \
4844 +    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
4845 +                      "use gnulib module printf-posix for portable " \
4846 +                      "POSIX compliance"), \
4847 +     printf)
4848 +/* Don't break __attribute__((format(printf,M,N))).  */
4849 +# define format(kind,m,n) format (__##kind##__, m, n)
4850 +# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
4851 +# define ____printf____ __printf__
4852 +# define ____scanf____ __scanf__
4853 +# define ____strftime____ __strftime__
4854 +# define ____strfmon____ __strfmon__
4855 +#endif
4856 +
4857 +#if @GNULIB_VPRINTF_POSIX@
4858 +# if @REPLACE_VPRINTF@
4859 +#  define vprintf rpl_vprintf
4860 +extern int vprintf (const char *format, va_list args)
4861 +       __attribute__ ((__format__ (__printf__, 1, 0)));
4862 +# endif
4863 +#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
4864 +# define vprintf rpl_vprintf
4865 +extern int vprintf (const char *format, va_list args)
4866 +       __attribute__ ((__format__ (__printf__, 1, 0)));
4867 +#elif defined GNULIB_POSIXCHECK
4868 +# undef vprintf
4869 +# define vprintf(f,a) \
4870 +    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
4871 +                      "use gnulib module vprintf-posix for portable " \
4872 +                      "POSIX compliance"), \
4873 +     vprintf (f, a))
4874 +#endif
4875 +
4876 +#if @GNULIB_SNPRINTF@
4877 +# if @REPLACE_SNPRINTF@
4878 +#  define snprintf rpl_snprintf
4879 +# endif
4880 +# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
4881 +extern int snprintf (char *str, size_t size, const char *format, ...)
4882 +       __attribute__ ((__format__ (__printf__, 3, 4)));
4883 +# endif
4884 +#elif defined GNULIB_POSIXCHECK
4885 +# undef snprintf
4886 +# define snprintf \
4887 +    (GL_LINK_WARNING ("snprintf is unportable - " \
4888 +                      "use gnulib module snprintf for portability"), \
4889 +     snprintf)
4890 +#endif
4891 +
4892 +#if @GNULIB_VSNPRINTF@
4893 +# if @REPLACE_VSNPRINTF@
4894 +#  define vsnprintf rpl_vsnprintf
4895 +# endif
4896 +# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
4897 +extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
4898 +       __attribute__ ((__format__ (__printf__, 3, 0)));
4899 +# endif
4900 +#elif defined GNULIB_POSIXCHECK
4901 +# undef vsnprintf
4902 +# define vsnprintf(b,s,f,a) \
4903 +    (GL_LINK_WARNING ("vsnprintf is unportable - " \
4904 +                      "use gnulib module vsnprintf for portability"), \
4905 +     vsnprintf (b, s, f, a))
4906 +#endif
4907 +
4908 +#if @GNULIB_SPRINTF_POSIX@
4909 +# if @REPLACE_SPRINTF@
4910 +#  define sprintf rpl_sprintf
4911 +extern int sprintf (char *str, const char *format, ...)
4912 +       __attribute__ ((__format__ (__printf__, 2, 3)));
4913 +# endif
4914 +#elif defined GNULIB_POSIXCHECK
4915 +# undef sprintf
4916 +# define sprintf \
4917 +    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
4918 +                      "use gnulib module sprintf-posix for portable " \
4919 +                      "POSIX compliance"), \
4920 +     sprintf)
4921 +#endif
4922 +
4923 +#if @GNULIB_VSPRINTF_POSIX@
4924 +# if @REPLACE_VSPRINTF@
4925 +#  define vsprintf rpl_vsprintf
4926 +extern int vsprintf (char *str, const char *format, va_list args)
4927 +       __attribute__ ((__format__ (__printf__, 2, 0)));
4928 +# endif
4929 +#elif defined GNULIB_POSIXCHECK
4930 +# undef vsprintf
4931 +# define vsprintf(b,f,a) \
4932 +    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
4933 +                      "use gnulib module vsprintf-posix for portable " \
4934 +                      "POSIX compliance"), \
4935 +     vsprintf (b, f, a))
4936 +#endif
4937 +
4938 +#if @GNULIB_VASPRINTF@
4939 +# if @REPLACE_VASPRINTF@
4940 +#  define asprintf rpl_asprintf
4941 +#  define vasprintf rpl_vasprintf
4942 +# endif
4943 +# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
4944 +  /* Write formatted output to a string dynamically allocated with malloc().
4945 +     If the memory allocation succeeds, store the address of the string in
4946 +     *RESULT and return the number of resulting bytes, excluding the trailing
4947 +     NUL.  Upon memory allocation error, or some other error, return -1.  */
4948 +  extern int asprintf (char **result, const char *format, ...)
4949 +    __attribute__ ((__format__ (__printf__, 2, 3)));
4950 +  extern int vasprintf (char **result, const char *format, va_list args)
4951 +    __attribute__ ((__format__ (__printf__, 2, 0)));
4952 +# endif
4953 +#endif
4954 +
4955 +#if @GNULIB_OBSTACK_PRINTF@
4956 +# if @REPLACE_OBSTACK_PRINTF@
4957 +#  define obstack_printf rpl_osbtack_printf
4958 +#  define obstack_vprintf rpl_obstack_vprintf
4959 +# endif
4960 +# if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
4961 +  struct obstack;
4962 +  /* Grow an obstack with formatted output.  Return the number of
4963 +     bytes added to OBS.  No trailing nul byte is added, and the
4964 +     object should be closed with obstack_finish before use.  Upon
4965 +     memory allocation error, call obstack_alloc_failed_handler.  Upon
4966 +     other error, return -1.  */
4967 +  extern int obstack_printf (struct obstack *obs, const char *format, ...)
4968 +    __attribute__ ((__format__ (__printf__, 2, 3)));
4969 +  extern int obstack_vprintf (struct obstack *obs, const char *format,
4970 +                             va_list args)
4971 +    __attribute__ ((__format__ (__printf__, 2, 0)));
4972 +# endif
4973 +#endif
4974 +
4975 +#if @GNULIB_FOPEN@
4976 +# if @REPLACE_FOPEN@
4977 +#  undef fopen
4978 +#  define fopen rpl_fopen
4979 +extern FILE * fopen (const char *filename, const char *mode);
4980 +# endif
4981 +#elif defined GNULIB_POSIXCHECK
4982 +# undef fopen
4983 +# define fopen(f,m) \
4984 +   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
4985 +                     "use gnulib module fopen for portability"), \
4986 +    fopen (f, m))
4987 +#endif
4988 +
4989 +#if @GNULIB_FREOPEN@
4990 +# if @REPLACE_FREOPEN@
4991 +#  undef freopen
4992 +#  define freopen rpl_freopen
4993 +extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
4994 +# endif
4995 +#elif defined GNULIB_POSIXCHECK
4996 +# undef freopen
4997 +# define freopen(f,m,s) \
4998 +   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
4999 +                     "use gnulib module freopen for portability"), \
5000 +    freopen (f, m, s))
5001 +#endif
5002 +
5003 +#if @GNULIB_FSEEKO@
5004 +# if @REPLACE_FSEEKO@
5005 +/* Provide fseek, fseeko functions that are aware of a preceding
5006 +   fflush(), and which detect pipes.  */
5007 +#  define fseeko rpl_fseeko
5008 +extern int fseeko (FILE *fp, off_t offset, int whence);
5009 +#  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
5010 +# endif
5011 +#elif defined GNULIB_POSIXCHECK
5012 +# undef fseeko
5013 +# define fseeko(f,o,w) \
5014 +   (GL_LINK_WARNING ("fseeko is unportable - " \
5015 +                     "use gnulib module fseeko for portability"), \
5016 +    fseeko (f, o, w))
5017 +#endif
5018 +
5019 +#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
5020 +extern int rpl_fseek (FILE *fp, long offset, int whence);
5021 +# undef fseek
5022 +# if defined GNULIB_POSIXCHECK
5023 +#  define fseek(f,o,w) \
5024 +     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
5025 +                       "on 32-bit platforms - " \
5026 +                       "use fseeko function for handling of large files"), \
5027 +      rpl_fseek (f, o, w))
5028 +# else
5029 +#  define fseek rpl_fseek
5030 +# endif
5031 +#elif defined GNULIB_POSIXCHECK
5032 +# ifndef fseek
5033 +#  define fseek(f,o,w) \
5034 +     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
5035 +                       "on 32-bit platforms - " \
5036 +                       "use fseeko function for handling of large files"), \
5037 +      fseek (f, o, w))
5038 +# endif
5039 +#endif
5040 +
5041 +#if @GNULIB_FTELLO@
5042 +# if @REPLACE_FTELLO@
5043 +#  define ftello rpl_ftello
5044 +extern off_t ftello (FILE *fp);
5045 +#  define ftell(fp) ftello (fp)
5046 +# endif
5047 +#elif defined GNULIB_POSIXCHECK
5048 +# undef ftello
5049 +# define ftello(f) \
5050 +   (GL_LINK_WARNING ("ftello is unportable - " \
5051 +                     "use gnulib module ftello for portability"), \
5052 +    ftello (f))
5053 +#endif
5054 +
5055 +#if @GNULIB_FTELL@ && @REPLACE_FTELL@
5056 +extern long rpl_ftell (FILE *fp);
5057 +# undef ftell
5058 +# if GNULIB_POSIXCHECK
5059 +#  define ftell(f) \
5060 +     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
5061 +                       "on 32-bit platforms - " \
5062 +                       "use ftello function for handling of large files"), \
5063 +      rpl_ftell (f))
5064 +# else
5065 +#  define ftell rpl_ftell
5066 +# endif
5067 +#elif defined GNULIB_POSIXCHECK
5068 +# ifndef ftell
5069 +#  define ftell(f) \
5070 +     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
5071 +                       "on 32-bit platforms - " \
5072 +                       "use ftello function for handling of large files"), \
5073 +      ftell (f))
5074 +# endif
5075 +#endif
5076 +
5077 +#if @GNULIB_FFLUSH@
5078 +# if @REPLACE_FFLUSH@
5079 +#  define fflush rpl_fflush
5080 +  /* Flush all pending data on STREAM according to POSIX rules.  Both
5081 +     output and seekable input streams are supported.
5082 +     Note! LOSS OF DATA can occur if fflush is applied on an input stream
5083 +     that is _not_seekable_ or on an update stream that is _not_seekable_
5084 +     and in which the most recent operation was input.  Seekability can
5085 +     be tested with lseek(fileno(fp),0,SEEK_CUR).  */
5086 +  extern int fflush (FILE *gl_stream);
5087 +# endif
5088 +#elif defined GNULIB_POSIXCHECK
5089 +# undef fflush
5090 +# define fflush(f) \
5091 +   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
5092 +                     "use gnulib module fflush for portable " \
5093 +                     "POSIX compliance"), \
5094 +    fflush (f))
5095 +#endif
5096 +
5097 +#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
5098 +# undef fputc
5099 +# define fputc rpl_fputc
5100 +extern int fputc (int c, FILE *stream);
5101 +#endif
5102 +
5103 +#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
5104 +# undef putc
5105 +# define putc rpl_fputc
5106 +extern int putc (int c, FILE *stream);
5107 +#endif
5108 +
5109 +#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
5110 +# undef putchar
5111 +# define putchar rpl_putchar
5112 +extern int putchar (int c);
5113 +#endif
5114 +
5115 +#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
5116 +# undef fputs
5117 +# define fputs rpl_fputs
5118 +extern int fputs (const char *string, FILE *stream);
5119 +#endif
5120 +
5121 +#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
5122 +# undef puts
5123 +# define puts rpl_puts
5124 +extern int puts (const char *string);
5125 +#endif
5126 +
5127 +#if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
5128 +# undef fwrite
5129 +# define fwrite rpl_fwrite
5130 +extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
5131 +#endif
5132 +
5133 +#if @GNULIB_GETDELIM@
5134 +# if !@HAVE_DECL_GETDELIM@
5135 +/* Read input, up to (and including) the next occurrence of DELIMITER, from
5136 +   STREAM, store it in *LINEPTR (and NUL-terminate it).
5137 +   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
5138 +   bytes of space.  It is realloc'd as necessary.
5139 +   Return the number of bytes read and stored at *LINEPTR (not including the
5140 +   NUL terminator), or -1 on error or EOF.  */
5141 +extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
5142 +                        FILE *stream);
5143 +# endif
5144 +#elif defined GNULIB_POSIXCHECK
5145 +# undef getdelim
5146 +# define getdelim(l, s, d, f)                                      \
5147 +  (GL_LINK_WARNING ("getdelim is unportable - "                            \
5148 +                   "use gnulib module getdelim for portability"),  \
5149 +   getdelim (l, s, d, f))
5150 +#endif
5151 +
5152 +#if @GNULIB_GETLINE@
5153 +# if @REPLACE_GETLINE@
5154 +#  undef getline
5155 +#  define getline rpl_getline
5156 +# endif
5157 +# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
5158 +/* Read a line, up to (and including) the next newline, from STREAM, store it
5159 +   in *LINEPTR (and NUL-terminate it).
5160 +   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
5161 +   bytes of space.  It is realloc'd as necessary.
5162 +   Return the number of bytes read and stored at *LINEPTR (not including the
5163 +   NUL terminator), or -1 on error or EOF.  */
5164 +extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
5165 +# endif
5166 +#elif defined GNULIB_POSIXCHECK
5167 +# undef getline
5168 +# define getline(l, s, f)                                              \
5169 +  (GL_LINK_WARNING ("getline is unportable - "                         \
5170 +                   "use gnulib module getline for portability"),       \
5171 +   getline (l, s, f))
5172 +#endif
5173 +
5174 +#if @GNULIB_PERROR@
5175 +# if @REPLACE_PERROR@
5176 +#  define perror rpl_perror
5177 +/* Print a message to standard error, describing the value of ERRNO,
5178 +   (if STRING is not NULL and not empty) prefixed with STRING and ": ",
5179 +   and terminated with a newline.  */
5180 +extern void perror (const char *string);
5181 +# endif
5182 +#elif defined GNULIB_POSIXCHECK
5183 +# undef perror
5184 +# define perror(s) \
5185 +    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
5186 +                      "use gnulib module perror for portability"), \
5187 +     perror (s))
5188 +#endif
5189 +
5190 +#ifdef __cplusplus
5191 +}
5192 +#endif
5193 +
5194 +#endif /* _GL_STDIO_H */
5195 +#endif /* _GL_STDIO_H */
5196 +#endif
5197 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/stdio-write.c gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio-write.c
5198 --- gtk-vnc-0.3.7.mingw/gnulib/lib/stdio-write.c        1970-01-01 01:00:00.000000000 +0100
5199 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio-write.c       2008-10-09 12:24:39.000000000 +0100
5200 @@ -0,0 +1,148 @@
5201 +/* POSIX compatible FILE stream write function.
5202 +   Copyright (C) 2008 Free Software Foundation, Inc.
5203 +   Written by Bruno Haible <bruno@clisp.org>, 2008.
5204 +
5205 +   This program is free software: you can redistribute it and/or modify
5206 +   it under the terms of the GNU Lesser General Public License as published by
5207 +   the Free Software Foundation; either version 2.1 of the License, or
5208 +   (at your option) any later version.
5209 +
5210 +   This program is distributed in the hope that it will be useful,
5211 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
5212 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5213 +   GNU Lesser General Public License for more details.
5214 +
5215 +   You should have received a copy of the GNU Lesser General Public License
5216 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
5217 +
5218 +#include <config.h>
5219 +
5220 +/* Specification.  */
5221 +#include <stdio.h>
5222 +
5223 +/* Replace these functions only if module 'sigpipe' is requested.  */
5224 +#if GNULIB_SIGPIPE
5225 +
5226 +/* On native Windows platforms, SIGPIPE does not exist.  When write() is
5227 +   called on a pipe with no readers, WriteFile() fails with error
5228 +   GetLastError() = ERROR_NO_DATA, and write() in consequence fails with
5229 +   error EINVAL.  This write() function is at the basis of the function
5230 +   which flushes the buffer of a FILE stream.  */
5231 +
5232 +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
5233 +
5234 +#  include <errno.h>
5235 +#  include <signal.h>
5236 +#  include <io.h>
5237 +
5238 +#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
5239 +#  include <windows.h>
5240 +
5241 +#  define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
5242 +  if (ferror (stream))                                                       \
5243 +    return (EXPRESSION);                                                     \
5244 +  else                                                                       \
5245 +    {                                                                        \
5246 +      RETTYPE ret;                                                           \
5247 +      SetLastError (0);                                                              \
5248 +      ret = (EXPRESSION);                                                    \
5249 +      if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream))      \
5250 +       {                                                                     \
5251 +         int fd = fileno (stream);                                           \
5252 +         if (fd >= 0                                                         \
5253 +             && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
5254 +           {                                                                 \
5255 +             /* Try to raise signal SIGPIPE.  */                             \
5256 +             raise (SIGPIPE);                                                \
5257 +             /* If it is currently blocked or ignored, change errno from     \
5258 +                EINVAL to EPIPE.  */                                         \
5259 +             errno = EPIPE;                                                  \
5260 +           }                                                                 \
5261 +       }                                                                     \
5262 +      return ret;                                                            \
5263 +    }
5264 +
5265 +#  if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */
5266 +int
5267 +printf (const char *format, ...)
5268 +{
5269 +  int retval;
5270 +  va_list args;
5271 +
5272 +  va_start (args, format);
5273 +  retval = vfprintf (stdout, format, args);
5274 +  va_end (args);
5275 +
5276 +  return retval;
5277 +}
5278 +#  endif
5279 +
5280 +#  if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */
5281 +int
5282 +fprintf (FILE *stream, const char *format, ...)
5283 +{
5284 +  int retval;
5285 +  va_list args;
5286 +
5287 +  va_start (args, format);
5288 +  retval = vfprintf (stream, format, args);
5289 +  va_end (args);
5290 +
5291 +  return retval;
5292 +}
5293 +#  endif
5294 +
5295 +#  if !REPLACE_VFPRINTF_POSIX /* avoid collision with vprintf.c */
5296 +int
5297 +vprintf (const char *format, va_list args)
5298 +{
5299 +  return vfprintf (stdout, format, args);
5300 +}
5301 +#  endif
5302 +
5303 +#  if !REPLACE_VPRINTF_POSIX /* avoid collision with vfprintf.c */
5304 +int
5305 +vfprintf (FILE *stream, const char *format, va_list args)
5306 +#undef vfprintf
5307 +{
5308 +  CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF)
5309 +}
5310 +#  endif
5311 +
5312 +int
5313 +putchar (int c)
5314 +{
5315 +  return fputc (c, stdout);
5316 +}
5317 +
5318 +int
5319 +fputc (int c, FILE *stream)
5320 +#undef fputc
5321 +{
5322 +  CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF)
5323 +}
5324 +
5325 +int
5326 +fputs (const char *string, FILE *stream)
5327 +#undef fputs
5328 +{
5329 +  CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF)
5330 +}
5331 +
5332 +int
5333 +puts (const char *string)
5334 +#undef puts
5335 +{
5336 +  FILE *stream = stdout;
5337 +  CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF)
5338 +}
5339 +
5340 +size_t
5341 +fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
5342 +#undef fwrite
5343 +{
5344 +  CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n)
5345 +}
5346 +
5347 +# endif
5348 +#endif
5349 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/sys_socket.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/sys_socket.in.h
5350 --- gtk-vnc-0.3.7.mingw/gnulib/lib/sys_socket.in.h      1970-01-01 01:00:00.000000000 +0100
5351 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/sys_socket.in.h     2008-10-09 12:24:39.000000000 +0100
5352 @@ -0,0 +1,386 @@
5353 +/* Provide a sys/socket header file for systems lacking it (read: MinGW)
5354 +   and for systems where it is incomplete.
5355 +   Copyright (C) 2005-2008 Free Software Foundation, Inc.
5356 +   Written by Simon Josefsson.
5357 +
5358 +   This program is free software; you can redistribute it and/or modify
5359 +   it under the terms of the GNU Lesser General Public License as published by
5360 +   the Free Software Foundation; either version 2.1, or (at your option)
5361 +   any later version.
5362 +
5363 +   This program is distributed in the hope that it will be useful,
5364 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
5365 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5366 +   GNU Lesser General Public License for more details.
5367 +
5368 +   You should have received a copy of the GNU Lesser General Public License
5369 +   along with this program; if not, write to the Free Software Foundation,
5370 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
5371 +
5372 +/* This file is supposed to be used on platforms that lack <sys/socket.h>,
5373 +   on platforms where <sys/socket.h> cannot be included standalone, and on
5374 +   platforms where <sys/socket.h> does not provide all necessary definitions.
5375 +   It is intended to provide definitions and prototypes needed by an
5376 +   application.  */
5377 +
5378 +#ifndef _GL_SYS_SOCKET_H
5379 +
5380 +#if @HAVE_SYS_SOCKET_H@
5381 +
5382 +@PRAGMA_SYSTEM_HEADER@
5383 +
5384 +/* On many platforms, <sys/socket.h> assumes prior inclusion of
5385 +   <sys/types.h>.  */
5386 +# include <sys/types.h>
5387 +
5388 +/* The include_next requires a split double-inclusion guard.  */
5389 +# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
5390 +
5391 +#endif
5392 +
5393 +#ifndef _GL_SYS_SOCKET_H
5394 +#define _GL_SYS_SOCKET_H
5395 +
5396 +#if @HAVE_SYS_SOCKET_H@
5397 +
5398 +/* A platform that has <sys/socket.h>.  */
5399 +
5400 +/* For shutdown().  */
5401 +# if !defined SHUT_RD
5402 +#  define SHUT_RD 0
5403 +# endif
5404 +# if !defined SHUT_WR
5405 +#  define SHUT_WR 1
5406 +# endif
5407 +# if !defined SHUT_RDWR
5408 +#  define SHUT_RDWR 2
5409 +# endif
5410 +
5411 +#else
5412 +
5413 +# ifdef __CYGWIN__
5414 +#  error "Cygwin does have a sys/socket.h, doesn't it?!?"
5415 +# endif
5416 +
5417 +/* A platform that lacks <sys/socket.h>.
5418 +
5419 +   Currently only MinGW is supported.  See the gnulib manual regarding
5420 +   Windows sockets.  MinGW has the header files winsock2.h and
5421 +   ws2tcpip.h that declare the sys/socket.h definitions we need.  Note
5422 +   that you can influence which definitions you get by setting the
5423 +   WINVER symbol before including these two files.  For example,
5424 +   getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
5425 +   symbol is set indiriectly through WINVER).  You can set this by
5426 +   adding AC_DEFINE(WINVER, 0x0501) to configure.ac.  Note that your
5427 +   code may not run on older Windows releases then.  My Windows 2000
5428 +   box was not able to run the code, for example.  The situation is
5429 +   slightly confusing because:
5430 +   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
5431 +   suggests that getaddrinfo should be available on all Windows
5432 +   releases. */
5433 +
5434 +
5435 +# if @HAVE_WINSOCK2_H@
5436 +#  include <winsock2.h>
5437 +# endif
5438 +# if @HAVE_WS2TCPIP_H@
5439 +#  include <ws2tcpip.h>
5440 +# endif
5441 +
5442 +/* For shutdown(). */
5443 +# if !defined SHUT_RD && defined SD_RECEIVE
5444 +#  define SHUT_RD SD_RECEIVE
5445 +# endif
5446 +# if !defined SHUT_WR && defined SD_SEND
5447 +#  define SHUT_WR SD_SEND
5448 +# endif
5449 +# if !defined SHUT_RDWR && defined SD_BOTH
5450 +#  define SHUT_RDWR SD_BOTH
5451 +# endif
5452 +
5453 +/* The definition of GL_LINK_WARNING is copied here.  */
5454 +
5455 +# if @HAVE_WINSOCK2_H@
5456 +/* Include headers needed by the emulation code.  */
5457 +#  include <sys/types.h>
5458 +#  include <io.h>
5459 +
5460 +typedef int socklen_t;
5461 +
5462 +# endif
5463 +
5464 +# ifdef __cplusplus
5465 +extern "C" {
5466 +# endif
5467 +
5468 +# if @HAVE_WINSOCK2_H@
5469 +
5470 +/* Re-define FD_ISSET to avoid a WSA call while we are not using
5471 +   network sockets.  */
5472 +static inline int
5473 +rpl_fd_isset (int fd, fd_set * set)
5474 +{
5475 +  int i;
5476 +  if (set == NULL)
5477 +    return 0;
5478 +
5479 +  for (i = 0; i < set->fd_count; i++)
5480 +    if (set->fd_array[i] == fd)
5481 +      return 1;
5482 +
5483 +  return 0;
5484 +}
5485 +
5486 +#  undef FD_ISSET
5487 +#  define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
5488 +
5489 +# endif
5490 +
5491 +/* Wrap everything else to use libc file descriptors for sockets.  */
5492 +
5493 +# if @HAVE_WINSOCK2_H@
5494 +#  undef close
5495 +#  define close                        rpl_close
5496 +extern int rpl_close(int);
5497 +# endif
5498 +
5499 +# if @GNULIB_SOCKET@
5500 +#  if @HAVE_WINSOCK2_H@
5501 +#   undef socket
5502 +#   define socket              rpl_socket
5503 +extern int rpl_socket (int, int, int protocol);
5504 +#  endif
5505 +# elif @HAVE_WINSOCK2_H@
5506 +#  undef socket
5507 +#  define socket socket_used_without_requesting_gnulib_module_socket
5508 +# elif defined GNULIB_POSIXCHECK
5509 +#  undef socket
5510 +#  define socket(d,t,p) \
5511 +     (GL_LINK_WARNING ("socket is not always POSIX compliant - " \
5512 +                       "use gnulib module socket for portability"), \
5513 +      socket (d, t, p))
5514 +# endif
5515 +
5516 +# if @GNULIB_CONNECT@
5517 +#  if @HAVE_WINSOCK2_H@
5518 +#   undef connect
5519 +#   define connect             rpl_connect
5520 +extern int rpl_connect (int, struct sockaddr *, int);
5521 +#  endif
5522 +# elif @HAVE_WINSOCK2_H@
5523 +#  undef connect
5524 +#  define connect socket_used_without_requesting_gnulib_module_connect
5525 +# elif defined GNULIB_POSIXCHECK
5526 +#  undef connect
5527 +#  define connect(s,a,l) \
5528 +     (GL_LINK_WARNING ("connect is not always POSIX compliant - " \
5529 +                       "use gnulib module connect for portability"), \
5530 +      connect (s, a, l))
5531 +# endif
5532 +
5533 +# if @GNULIB_ACCEPT@
5534 +#  if @HAVE_WINSOCK2_H@
5535 +#   undef accept
5536 +#   define accept              rpl_accept
5537 +extern int rpl_accept (int, struct sockaddr *, int *);
5538 +#  endif
5539 +# elif @HAVE_WINSOCK2_H@
5540 +#  undef accept
5541 +#  define accept accept_used_without_requesting_gnulib_module_accept
5542 +# elif defined GNULIB_POSIXCHECK
5543 +#  undef accept
5544 +#  define accept(s,a,l) \
5545 +     (GL_LINK_WARNING ("accept is not always POSIX compliant - " \
5546 +                       "use gnulib module accept for portability"), \
5547 +      accept (s, a, l))
5548 +# endif
5549 +
5550 +# if @GNULIB_BIND@
5551 +#  if @HAVE_WINSOCK2_H@
5552 +#   undef bind
5553 +#   define bind                        rpl_bind
5554 +extern int rpl_bind (int, struct sockaddr *, int);
5555 +#  endif
5556 +# elif @HAVE_WINSOCK2_H@
5557 +#  undef bind
5558 +#  define bind bind_used_without_requesting_gnulib_module_bind
5559 +# elif defined GNULIB_POSIXCHECK
5560 +#  undef bind
5561 +#  define bind(s,a,l) \
5562 +     (GL_LINK_WARNING ("bind is not always POSIX compliant - " \
5563 +                       "use gnulib module bind for portability"), \
5564 +      bind (s, a, l))
5565 +# endif
5566 +
5567 +# if @GNULIB_GETPEERNAME@
5568 +#  if @HAVE_WINSOCK2_H@
5569 +#   undef getpeername
5570 +#   define getpeername         rpl_getpeername
5571 +extern int rpl_getpeername (int, struct sockaddr *, int *);
5572 +#  endif
5573 +# elif @HAVE_WINSOCK2_H@
5574 +#  undef getpeername
5575 +#  define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
5576 +# elif defined GNULIB_POSIXCHECK
5577 +#  undef getpeername
5578 +#  define getpeername(s,a,l) \
5579 +     (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \
5580 +                       "use gnulib module getpeername for portability"), \
5581 +      getpeername (s, a, l))
5582 +# endif
5583 +
5584 +# if @GNULIB_GETSOCKNAME@
5585 +#  if @HAVE_WINSOCK2_H@
5586 +#   undef getsockname
5587 +#   define getsockname         rpl_getsockname
5588 +extern int rpl_getsockname (int, struct sockaddr *, int *);
5589 +#  endif
5590 +# elif @HAVE_WINSOCK2_H@
5591 +#  undef getsockname
5592 +#  define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
5593 +# elif defined GNULIB_POSIXCHECK
5594 +#  undef getsockname
5595 +#  define getsockname(s,a,l) \
5596 +     (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \
5597 +                       "use gnulib module getsockname for portability"), \
5598 +      getsockname (s, a, l))
5599 +# endif
5600 +
5601 +# if @GNULIB_GETSOCKOPT@
5602 +#  if @HAVE_WINSOCK2_H@
5603 +#   undef getsockopt
5604 +#   define getsockopt          rpl_getsockopt
5605 +extern int rpl_getsockopt (int, int, int, void *, int *);
5606 +#  endif
5607 +# elif @HAVE_WINSOCK2_H@
5608 +#  undef getsockopt
5609 +#  define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
5610 +# elif defined GNULIB_POSIXCHECK
5611 +#  undef getsockopt
5612 +#  define getsockopt(s,lvl,o,v,l) \
5613 +     (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \
5614 +                       "use gnulib module getsockopt for portability"), \
5615 +      getsockopt (s, lvl, o, v, l))
5616 +# endif
5617 +
5618 +# if @GNULIB_LISTEN@
5619 +#  if @HAVE_WINSOCK2_H@
5620 +#   undef listen
5621 +#   define listen              rpl_listen
5622 +extern int rpl_listen (int, int);
5623 +#  endif
5624 +# elif @HAVE_WINSOCK2_H@
5625 +#  undef listen
5626 +#  define listen listen_used_without_requesting_gnulib_module_listen
5627 +# elif defined GNULIB_POSIXCHECK
5628 +#  undef listen
5629 +#  define listen(s,b) \
5630 +     (GL_LINK_WARNING ("listen is not always POSIX compliant - " \
5631 +                       "use gnulib module listen for portability"), \
5632 +      listen (s, b))
5633 +# endif
5634 +
5635 +# if @HAVE_WINSOCK2_H@
5636 +#  undef ioctl
5637 +#  define ioctl                        rpl_ioctl
5638 +extern int rpl_ioctl (int, unsigned long, char *);
5639 +# endif
5640 +
5641 +# if @GNULIB_RECV@
5642 +#  if @HAVE_WINSOCK2_H@
5643 +#   undef recv
5644 +#   define recv                        rpl_recv
5645 +extern int rpl_recv (int, void *, int, int);
5646 +#  endif
5647 +# elif @HAVE_WINSOCK2_H@
5648 +#  undef recv
5649 +#  define recv recv_used_without_requesting_gnulib_module_recv
5650 +# elif defined GNULIB_POSIXCHECK
5651 +#  undef recv
5652 +#  define recv(s,b,n,f) \
5653 +     (GL_LINK_WARNING ("recv is not always POSIX compliant - " \
5654 +                       "use gnulib module recv for portability"), \
5655 +      recv (s, b, n, f))
5656 +# endif
5657 +
5658 +# if @GNULIB_SEND@
5659 +#  if @HAVE_WINSOCK2_H@
5660 +#   undef send
5661 +#   define send                        rpl_send
5662 +extern int rpl_send (int, const void *, int, int);
5663 +#  endif
5664 +# elif @HAVE_WINSOCK2_H@
5665 +#  undef send
5666 +#  define send send_used_without_requesting_gnulib_module_send
5667 +# elif defined GNULIB_POSIXCHECK
5668 +#  undef send
5669 +#  define send(s,b,n,f) \
5670 +     (GL_LINK_WARNING ("send is not always POSIX compliant - " \
5671 +                       "use gnulib module send for portability"), \
5672 +      send (s, b, n, f))
5673 +# endif
5674 +
5675 +# if @GNULIB_RECVFROM@
5676 +#  if @HAVE_WINSOCK2_H@
5677 +#   undef recvfrom
5678 +#   define recvfrom            rpl_recvfrom
5679 +extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *);
5680 +#  endif
5681 +# elif @HAVE_WINSOCK2_H@
5682 +#  undef recvfrom
5683 +#  define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
5684 +# elif defined GNULIB_POSIXCHECK
5685 +#  undef recvfrom
5686 +#  define recvfrom(s,b,n,f,a,l) \
5687 +     (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \
5688 +                       "use gnulib module recvfrom for portability"), \
5689 +      recvfrom (s, b, n, f, a, l))
5690 +# endif
5691 +
5692 +# if @GNULIB_SENDTO@
5693 +#  if @HAVE_WINSOCK2_H@
5694 +#   undef sendto
5695 +#   define sendto              rpl_sendto
5696 +extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int);
5697 +#  endif
5698 +# elif @HAVE_WINSOCK2_H@
5699 +#  undef sendto
5700 +#  define sendto sendto_used_without_requesting_gnulib_module_sendto
5701 +# elif defined GNULIB_POSIXCHECK
5702 +#  undef sendto
5703 +#  define sendto(s,b,n,f,a,l) \
5704 +     (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \
5705 +                       "use gnulib module sendto for portability"), \
5706 +      sendto (s, b, n, f, a, l))
5707 +# endif
5708 +
5709 +# if @GNULIB_SETSOCKOPT@
5710 +#  if @HAVE_WINSOCK2_H@
5711 +#   undef setsockopt
5712 +#   define setsockopt          rpl_setsockopt
5713 +extern int rpl_setsockopt (int, int, int, const void *, int);
5714 +#  endif
5715 +# elif @HAVE_WINSOCK2_H@
5716 +#  undef setsockopt
5717 +#  define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
5718 +# elif defined GNULIB_POSIXCHECK
5719 +#  undef setsockopt
5720 +#  define setsockopt(s,lvl,o,v,l) \
5721 +     (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \
5722 +                       "use gnulib module setsockopt for portability"), \
5723 +      setsockopt (s, lvl, o, v, l))
5724 +# endif
5725 +
5726 +# if @HAVE_WINSOCK2_H@
5727 +#  undef select
5728 +#  define select               select_used_without_including_sys_select_h
5729 +# endif
5730 +
5731 +# ifdef __cplusplus
5732 +}
5733 +# endif
5734 +
5735 +#endif /* HAVE_SYS_SOCKET_H */
5736 +
5737 +#endif /* _GL_SYS_SOCKET_H */
5738 +#endif /* _GL_SYS_SOCKET_H */
5739 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/vasnprintf.c gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.c
5740 --- gtk-vnc-0.3.7.mingw/gnulib/lib/vasnprintf.c 1970-01-01 01:00:00.000000000 +0100
5741 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.c        2008-10-09 12:24:39.000000000 +0100
5742 @@ -0,0 +1,4887 @@
5743 +/* vsprintf with automatic memory allocation.
5744 +   Copyright (C) 1999, 2002-2008 Free Software Foundation, Inc.
5745 +
5746 +   This program is free software; you can redistribute it and/or modify
5747 +   it under the terms of the GNU Lesser General Public License as published by
5748 +   the Free Software Foundation; either version 2.1, or (at your option)
5749 +   any later version.
5750 +
5751 +   This program is distributed in the hope that it will be useful,
5752 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
5753 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5754 +   GNU Lesser General Public License for more details.
5755 +
5756 +   You should have received a copy of the GNU Lesser General Public License along
5757 +   with this program; if not, write to the Free Software Foundation,
5758 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
5759 +
5760 +/* This file can be parametrized with the following macros:
5761 +     VASNPRINTF         The name of the function being defined.
5762 +     FCHAR_T            The element type of the format string.
5763 +     DCHAR_T            The element type of the destination (result) string.
5764 +     FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters
5765 +                        in the format string are ASCII. MUST be set if
5766 +                        FCHAR_T and DCHAR_T are not the same type.
5767 +     DIRECTIVE          Structure denoting a format directive.
5768 +                        Depends on FCHAR_T.
5769 +     DIRECTIVES         Structure denoting the set of format directives of a
5770 +                        format string.  Depends on FCHAR_T.
5771 +     PRINTF_PARSE       Function that parses a format string.
5772 +                        Depends on FCHAR_T.
5773 +     DCHAR_CPY          memcpy like function for DCHAR_T[] arrays.
5774 +     DCHAR_SET          memset like function for DCHAR_T[] arrays.
5775 +     DCHAR_MBSNLEN      mbsnlen like function for DCHAR_T[] arrays.
5776 +     SNPRINTF           The system's snprintf (or similar) function.
5777 +                        This may be either snprintf or swprintf.
5778 +     TCHAR_T            The element type of the argument and result string
5779 +                        of the said SNPRINTF function.  This may be either
5780 +                        char or wchar_t.  The code exploits that
5781 +                        sizeof (TCHAR_T) | sizeof (DCHAR_T) and
5782 +                        alignof (TCHAR_T) <= alignof (DCHAR_T).
5783 +     DCHAR_IS_TCHAR     Set to 1 if DCHAR_T and TCHAR_T are the same type.
5784 +     DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[].
5785 +     DCHAR_IS_UINT8_T   Set to 1 if DCHAR_T is uint8_t.
5786 +     DCHAR_IS_UINT16_T  Set to 1 if DCHAR_T is uint16_t.
5787 +     DCHAR_IS_UINT32_T  Set to 1 if DCHAR_T is uint32_t.  */
5788 +
5789 +/* Tell glibc's <stdio.h> to provide a prototype for snprintf().
5790 +   This must come before <config.h> because <config.h> may include
5791 +   <features.h>, and once <features.h> has been included, it's too late.  */
5792 +#ifndef _GNU_SOURCE
5793 +# define _GNU_SOURCE    1
5794 +#endif
5795 +
5796 +#ifndef VASNPRINTF
5797 +# include <config.h>
5798 +#endif
5799 +#ifndef IN_LIBINTL
5800 +# include <alloca.h>
5801 +#endif
5802 +
5803 +/* Specification.  */
5804 +#ifndef VASNPRINTF
5805 +# if WIDE_CHAR_VERSION
5806 +#  include "vasnwprintf.h"
5807 +# else
5808 +#  include "vasnprintf.h"
5809 +# endif
5810 +#endif
5811 +
5812 +#include <locale.h>    /* localeconv() */
5813 +#include <stdio.h>     /* snprintf(), sprintf() */
5814 +#include <stdlib.h>    /* abort(), malloc(), realloc(), free() */
5815 +#include <string.h>    /* memcpy(), strlen() */
5816 +#include <errno.h>     /* errno */
5817 +#include <limits.h>    /* CHAR_BIT */
5818 +#include <float.h>     /* DBL_MAX_EXP, LDBL_MAX_EXP */
5819 +#if HAVE_NL_LANGINFO
5820 +# include <langinfo.h>
5821 +#endif
5822 +#ifndef VASNPRINTF
5823 +# if WIDE_CHAR_VERSION
5824 +#  include "wprintf-parse.h"
5825 +# else
5826 +#  include "printf-parse.h"
5827 +# endif
5828 +#endif
5829 +
5830 +/* Checked size_t computations.  */
5831 +#include "xsize.h"
5832 +
5833 +#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
5834 +# include <math.h>
5835 +# include "float+.h"
5836 +#endif
5837 +
5838 +#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
5839 +# include <math.h>
5840 +# include "isnand-nolibm.h"
5841 +#endif
5842 +
5843 +#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL
5844 +# include <math.h>
5845 +# include "isnanl-nolibm.h"
5846 +# include "fpucw.h"
5847 +#endif
5848 +
5849 +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
5850 +# include <math.h>
5851 +# include "isnand-nolibm.h"
5852 +# include "printf-frexp.h"
5853 +#endif
5854 +
5855 +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
5856 +# include <math.h>
5857 +# include "isnanl-nolibm.h"
5858 +# include "printf-frexpl.h"
5859 +# include "fpucw.h"
5860 +#endif
5861 +
5862 +#if HAVE_WCHAR_T
5863 +# if HAVE_WCSLEN
5864 +#  define local_wcslen wcslen
5865 +# else
5866 +   /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
5867 +      a dependency towards this library, here is a local substitute.
5868 +      Define this substitute only once, even if this file is included
5869 +      twice in the same compilation unit.  */
5870 +#  ifndef local_wcslen_defined
5871 +#   define local_wcslen_defined 1
5872 +static size_t
5873 +local_wcslen (const wchar_t *s)
5874 +{
5875 +  const wchar_t *ptr;
5876 +
5877 +  for (ptr = s; *ptr != (wchar_t) 0; ptr++)
5878 +    ;
5879 +  return ptr - s;
5880 +}
5881 +#  endif
5882 +# endif
5883 +#endif
5884 +
5885 +/* Default parameters.  */
5886 +#ifndef VASNPRINTF
5887 +# if WIDE_CHAR_VERSION
5888 +#  define VASNPRINTF vasnwprintf
5889 +#  define FCHAR_T wchar_t
5890 +#  define DCHAR_T wchar_t
5891 +#  define TCHAR_T wchar_t
5892 +#  define DCHAR_IS_TCHAR 1
5893 +#  define DIRECTIVE wchar_t_directive
5894 +#  define DIRECTIVES wchar_t_directives
5895 +#  define PRINTF_PARSE wprintf_parse
5896 +#  define DCHAR_CPY wmemcpy
5897 +# else
5898 +#  define VASNPRINTF vasnprintf
5899 +#  define FCHAR_T char
5900 +#  define DCHAR_T char
5901 +#  define TCHAR_T char
5902 +#  define DCHAR_IS_TCHAR 1
5903 +#  define DIRECTIVE char_directive
5904 +#  define DIRECTIVES char_directives
5905 +#  define PRINTF_PARSE printf_parse
5906 +#  define DCHAR_CPY memcpy
5907 +# endif
5908 +#endif
5909 +#if WIDE_CHAR_VERSION
5910 +  /* TCHAR_T is wchar_t.  */
5911 +# define USE_SNPRINTF 1
5912 +# if HAVE_DECL__SNWPRINTF
5913 +   /* On Windows, the function swprintf() has a different signature than
5914 +      on Unix; we use the _snwprintf() function instead.  */
5915 +#  define SNPRINTF _snwprintf
5916 +# else
5917 +   /* Unix.  */
5918 +#  define SNPRINTF swprintf
5919 +# endif
5920 +#else
5921 +  /* TCHAR_T is char.  */
5922 +  /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'.
5923 +     But don't use it on BeOS, since BeOS snprintf produces no output if the
5924 +     size argument is >= 0x3000000.
5925 +     Also don't use it on Linux libc5, since there snprintf with size = 1
5926 +     writes any output without bounds, like sprintf.  */
5927 +# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ && !(__GNU_LIBRARY__ == 1)
5928 +#  define USE_SNPRINTF 1
5929 +# else
5930 +#  define USE_SNPRINTF 0
5931 +# endif
5932 +# if HAVE_DECL__SNPRINTF
5933 +   /* Windows.  */
5934 +#  define SNPRINTF _snprintf
5935 +# else
5936 +   /* Unix.  */
5937 +#  define SNPRINTF snprintf
5938 +   /* Here we need to call the native snprintf, not rpl_snprintf.  */
5939 +#  undef snprintf
5940 +# endif
5941 +#endif
5942 +/* Here we need to call the native sprintf, not rpl_sprintf.  */
5943 +#undef sprintf
5944 +
5945 +/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized"
5946 +   warnings in this file.  Use -Dlint to suppress them.  */
5947 +#ifdef lint
5948 +# define IF_LINT(Code) Code
5949 +#else
5950 +# define IF_LINT(Code) /* empty */
5951 +#endif
5952 +
5953 +/* Avoid some warnings from "gcc -Wshadow".
5954 +   This file doesn't use the exp() and remainder() functions.  */
5955 +#undef exp
5956 +#define exp expo
5957 +#undef remainder
5958 +#define remainder rem
5959 +
5960 +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
5961 +/* Determine the decimal-point character according to the current locale.  */
5962 +# ifndef decimal_point_char_defined
5963 +#  define decimal_point_char_defined 1
5964 +static char
5965 +decimal_point_char ()
5966 +{
5967 +  const char *point;
5968 +  /* Determine it in a multithread-safe way.  We know nl_langinfo is
5969 +     multithread-safe on glibc systems, but is not required to be multithread-
5970 +     safe by POSIX.  sprintf(), however, is multithread-safe.  localeconv()
5971 +     is rarely multithread-safe.  */
5972 +#  if HAVE_NL_LANGINFO && __GLIBC__
5973 +  point = nl_langinfo (RADIXCHAR);
5974 +#  elif 1
5975 +  char pointbuf[5];
5976 +  sprintf (pointbuf, "%#.0f", 1.0);
5977 +  point = &pointbuf[1];
5978 +#  else
5979 +  point = localeconv () -> decimal_point;
5980 +#  endif
5981 +  /* The decimal point is always a single byte: either '.' or ','.  */
5982 +  return (point[0] != '\0' ? point[0] : '.');
5983 +}
5984 +# endif
5985 +#endif
5986 +
5987 +#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL
5988 +
5989 +/* Equivalent to !isfinite(x) || x == 0, but does not require libm.  */
5990 +static int
5991 +is_infinite_or_zero (double x)
5992 +{
5993 +  return isnand (x) || x + x == x;
5994 +}
5995 +
5996 +#endif
5997 +
5998 +#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
5999 +
6000 +/* Equivalent to !isfinite(x) || x == 0, but does not require libm.  */
6001 +static int
6002 +is_infinite_or_zerol (long double x)
6003 +{
6004 +  return isnanl (x) || x + x == x;
6005 +}
6006 +
6007 +#endif
6008 +
6009 +#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
6010 +
6011 +/* Converting 'long double' to decimal without rare rounding bugs requires
6012 +   real bignums.  We use the naming conventions of GNU gmp, but vastly simpler
6013 +   (and slower) algorithms.  */
6014 +
6015 +typedef unsigned int mp_limb_t;
6016 +# define GMP_LIMB_BITS 32
6017 +typedef int mp_limb_verify[2 * (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS) - 1];
6018 +
6019 +typedef unsigned long long mp_twolimb_t;
6020 +# define GMP_TWOLIMB_BITS 64
6021 +typedef int mp_twolimb_verify[2 * (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS) - 1];
6022 +
6023 +/* Representation of a bignum >= 0.  */
6024 +typedef struct
6025 +{
6026 +  size_t nlimbs;
6027 +  mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc().  */
6028 +} mpn_t;
6029 +
6030 +/* Compute the product of two bignums >= 0.
6031 +   Return the allocated memory in case of success, NULL in case of memory
6032 +   allocation failure.  */
6033 +static void *
6034 +multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
6035 +{
6036 +  const mp_limb_t *p1;
6037 +  const mp_limb_t *p2;
6038 +  size_t len1;
6039 +  size_t len2;
6040 +
6041 +  if (src1.nlimbs <= src2.nlimbs)
6042 +    {
6043 +      len1 = src1.nlimbs;
6044 +      p1 = src1.limbs;
6045 +      len2 = src2.nlimbs;
6046 +      p2 = src2.limbs;
6047 +    }
6048 +  else
6049 +    {
6050 +      len1 = src2.nlimbs;
6051 +      p1 = src2.limbs;
6052 +      len2 = src1.nlimbs;
6053 +      p2 = src1.limbs;
6054 +    }
6055 +  /* Now 0 <= len1 <= len2.  */
6056 +  if (len1 == 0)
6057 +    {
6058 +      /* src1 or src2 is zero.  */
6059 +      dest->nlimbs = 0;
6060 +      dest->limbs = (mp_limb_t *) malloc (1);
6061 +    }
6062 +  else
6063 +    {
6064 +      /* Here 1 <= len1 <= len2.  */
6065 +      size_t dlen;
6066 +      mp_limb_t *dp;
6067 +      size_t k, i, j;
6068 +
6069 +      dlen = len1 + len2;
6070 +      dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t));
6071 +      if (dp == NULL)
6072 +       return NULL;
6073 +      for (k = len2; k > 0; )
6074 +       dp[--k] = 0;
6075 +      for (i = 0; i < len1; i++)
6076 +       {
6077 +         mp_limb_t digit1 = p1[i];
6078 +         mp_twolimb_t carry = 0;
6079 +         for (j = 0; j < len2; j++)
6080 +           {
6081 +             mp_limb_t digit2 = p2[j];
6082 +             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
6083 +             carry += dp[i + j];
6084 +             dp[i + j] = (mp_limb_t) carry;
6085 +             carry = carry >> GMP_LIMB_BITS;
6086 +           }
6087 +         dp[i + len2] = (mp_limb_t) carry;
6088 +       }
6089 +      /* Normalise.  */
6090 +      while (dlen > 0 && dp[dlen - 1] == 0)
6091 +       dlen--;
6092 +      dest->nlimbs = dlen;
6093 +      dest->limbs = dp;
6094 +    }
6095 +  return dest->limbs;
6096 +}
6097 +
6098 +/* Compute the quotient of a bignum a >= 0 and a bignum b > 0.
6099 +   a is written as  a = q * b + r  with 0 <= r < b.  q is the quotient, r
6100 +   the remainder.
6101 +   Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd,
6102 +   q is incremented.
6103 +   Return the allocated memory in case of success, NULL in case of memory
6104 +   allocation failure.  */
6105 +static void *
6106 +divide (mpn_t a, mpn_t b, mpn_t *q)
6107 +{
6108 +  /* Algorithm:
6109 +     First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]]
6110 +     with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS).
6111 +     If m<n, then q:=0 and r:=a.
6112 +     If m>=n=1, perform a single-precision division:
6113 +       r:=0, j:=m,
6114 +       while j>0 do
6115 +         {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j =
6116 +               = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r<b[0]<beta}
6117 +         j:=j-1, r:=r*beta+a[j], q[j]:=floor(r/b[0]), r:=r-b[0]*q[j].
6118 +       Normalise [q[m-1],...,q[0]], yields q.
6119 +     If m>=n>1, perform a multiple-precision division:
6120 +       We have a/b < beta^(m-n+1).
6121 +       s:=intDsize-1-(hightest bit in b[n-1]), 0<=s<intDsize.
6122 +       Shift a and b left by s bits, copying them. r:=a.
6123 +       r=[r[m],...,r[0]], b=[b[n-1],...,b[0]] with b[n-1]>=beta/2.
6124 +       For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).}
6125 +         Compute q* :
6126 +           q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]).
6127 +           In case of overflow (q* >= beta) set q* := beta-1.
6128 +           Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2]
6129 +           and c3 := b[n-2] * q*.
6130 +           {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow
6131 +            occurred.  Furthermore 0 <= c3 < beta^2.
6132 +            If there was overflow and
6133 +            r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2,
6134 +            the next test can be skipped.}
6135 +           While c3 > c2, {Here 0 <= c2 < c3 < beta^2}
6136 +             Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2].
6137 +           If q* > 0:
6138 +             Put r := r - b * q* * beta^j. In detail:
6139 +               [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]].
6140 +               hence: u:=0, for i:=0 to n-1 do
6141 +                              u := u + q* * b[i],
6142 +                              r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry),
6143 +                              u:=u div beta (+ 1, if carry in subtraction)
6144 +                      r[n+j]:=r[n+j]-u.
6145 +               {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1
6146 +                               < q* + 1 <= beta,
6147 +                the carry u does not overflow.}
6148 +             If a negative carry occurs, put q* := q* - 1
6149 +               and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]].
6150 +         Set q[j] := q*.
6151 +       Normalise [q[m-n],..,q[0]]; this yields the quotient q.
6152 +       Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the
6153 +       rest r.
6154 +       The room for q[j] can be allocated at the memory location of r[n+j].
6155 +     Finally, round-to-even:
6156 +       Shift r left by 1 bit.
6157 +       If r > b or if r = b and q[0] is odd, q := q+1.
6158 +   */
6159 +  const mp_limb_t *a_ptr = a.limbs;
6160 +  size_t a_len = a.nlimbs;
6161 +  const mp_limb_t *b_ptr = b.limbs;
6162 +  size_t b_len = b.nlimbs;
6163 +  mp_limb_t *roomptr;
6164 +  mp_limb_t *tmp_roomptr = NULL;
6165 +  mp_limb_t *q_ptr;
6166 +  size_t q_len;
6167 +  mp_limb_t *r_ptr;
6168 +  size_t r_len;
6169 +
6170 +  /* Allocate room for a_len+2 digits.
6171 +     (Need a_len+1 digits for the real division and 1 more digit for the
6172 +     final rounding of q.)  */
6173 +  roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t));
6174 +  if (roomptr == NULL)
6175 +    return NULL;
6176 +
6177 +  /* Normalise a.  */
6178 +  while (a_len > 0 && a_ptr[a_len - 1] == 0)
6179 +    a_len--;
6180 +
6181 +  /* Normalise b.  */
6182 +  for (;;)
6183 +    {
6184 +      if (b_len == 0)
6185 +       /* Division by zero.  */
6186 +       abort ();
6187 +      if (b_ptr[b_len - 1] == 0)
6188 +       b_len--;
6189 +      else
6190 +       break;
6191 +    }
6192 +
6193 +  /* Here m = a_len >= 0 and n = b_len > 0.  */
6194 +
6195 +  if (a_len < b_len)
6196 +    {
6197 +      /* m<n: trivial case.  q=0, r := copy of a.  */
6198 +      r_ptr = roomptr;
6199 +      r_len = a_len;
6200 +      memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
6201 +      q_ptr = roomptr + a_len;
6202 +      q_len = 0;
6203 +    }
6204 +  else if (b_len == 1)
6205 +    {
6206 +      /* n=1: single precision division.
6207 +        beta^(m-1) <= a < beta^m  ==>  beta^(m-2) <= a/b < beta^m  */
6208 +      r_ptr = roomptr;
6209 +      q_ptr = roomptr + 1;
6210 +      {
6211 +       mp_limb_t den = b_ptr[0];
6212 +       mp_limb_t remainder = 0;
6213 +       const mp_limb_t *sourceptr = a_ptr + a_len;
6214 +       mp_limb_t *destptr = q_ptr + a_len;
6215 +       size_t count;
6216 +       for (count = a_len; count > 0; count--)
6217 +         {
6218 +           mp_twolimb_t num =
6219 +             ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
6220 +           *--destptr = num / den;
6221 +           remainder = num % den;
6222 +         }
6223 +       /* Normalise and store r.  */
6224 +       if (remainder > 0)
6225 +         {
6226 +           r_ptr[0] = remainder;
6227 +           r_len = 1;
6228 +         }
6229 +       else
6230 +         r_len = 0;
6231 +       /* Normalise q.  */
6232 +       q_len = a_len;
6233 +       if (q_ptr[q_len - 1] == 0)
6234 +         q_len--;
6235 +      }
6236 +    }
6237 +  else
6238 +    {
6239 +      /* n>1: multiple precision division.
6240 +        beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n  ==>
6241 +        beta^(m-n-1) <= a/b < beta^(m-n+1).  */
6242 +      /* Determine s.  */
6243 +      size_t s;
6244 +      {
6245 +       mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
6246 +       s = 31;
6247 +       if (msd >= 0x10000)
6248 +         {
6249 +           msd = msd >> 16;
6250 +           s -= 16;
6251 +         }
6252 +       if (msd >= 0x100)
6253 +         {
6254 +           msd = msd >> 8;
6255 +           s -= 8;
6256 +         }
6257 +       if (msd >= 0x10)
6258 +         {
6259 +           msd = msd >> 4;
6260 +           s -= 4;
6261 +         }
6262 +       if (msd >= 0x4)
6263 +         {
6264 +           msd = msd >> 2;
6265 +           s -= 2;
6266 +         }
6267 +       if (msd >= 0x2)
6268 +         {
6269 +           msd = msd >> 1;
6270 +           s -= 1;
6271 +         }
6272 +      }
6273 +      /* 0 <= s < GMP_LIMB_BITS.
6274 +        Copy b, shifting it left by s bits.  */
6275 +      if (s > 0)
6276 +       {
6277 +         tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
6278 +         if (tmp_roomptr == NULL)
6279 +           {
6280 +             free (roomptr);
6281 +             return NULL;
6282 +           }
6283 +         {
6284 +           const mp_limb_t *sourceptr = b_ptr;
6285 +           mp_limb_t *destptr = tmp_roomptr;
6286 +           mp_twolimb_t accu = 0;
6287 +           size_t count;
6288 +           for (count = b_len; count > 0; count--)
6289 +             {
6290 +               accu += (mp_twolimb_t) *sourceptr++ << s;
6291 +               *destptr++ = (mp_limb_t) accu;
6292 +               accu = accu >> GMP_LIMB_BITS;
6293 +             }
6294 +           /* accu must be zero, since that was how s was determined.  */
6295 +           if (accu != 0)
6296 +             abort ();
6297 +         }
6298 +         b_ptr = tmp_roomptr;
6299 +       }
6300 +      /* Copy a, shifting it left by s bits, yields r.
6301 +        Memory layout:
6302 +        At the beginning: r = roomptr[0..a_len],
6303 +        at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len]  */
6304 +      r_ptr = roomptr;
6305 +      if (s == 0)
6306 +       {
6307 +         memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
6308 +         r_ptr[a_len] = 0;
6309 +       }
6310 +      else
6311 +       {
6312 +         const mp_limb_t *sourceptr = a_ptr;
6313 +         mp_limb_t *destptr = r_ptr;
6314 +         mp_twolimb_t accu = 0;
6315 +         size_t count;
6316 +         for (count = a_len; count > 0; count--)
6317 +           {
6318 +             accu += (mp_twolimb_t) *sourceptr++ << s;
6319 +             *destptr++ = (mp_limb_t) accu;
6320 +             accu = accu >> GMP_LIMB_BITS;
6321 +           }
6322 +         *destptr++ = (mp_limb_t) accu;
6323 +       }
6324 +      q_ptr = roomptr + b_len;
6325 +      q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */
6326 +      {
6327 +       size_t j = a_len - b_len; /* m-n */
6328 +       mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
6329 +       mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
6330 +       mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
6331 +         ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
6332 +       /* Division loop, traversed m-n+1 times.
6333 +          j counts down, b is unchanged, beta/2 <= b[n-1] < beta.  */
6334 +       for (;;)
6335 +         {
6336 +           mp_limb_t q_star;
6337 +           mp_limb_t c1;
6338 +           if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
6339 +             {
6340 +               /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow.  */
6341 +               mp_twolimb_t num =
6342 +                 ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
6343 +                 | r_ptr[j + b_len - 1];
6344 +               q_star = num / b_msd;
6345 +               c1 = num % b_msd;
6346 +             }
6347 +           else
6348 +             {
6349 +               /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1].  */
6350 +               q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
6351 +               /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
6352 +                  <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
6353 +                  <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
6354 +                       {<= beta !}.
6355 +                  If yes, jump directly to the subtraction loop.
6356 +                  (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
6357 +                   <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */
6358 +               if (r_ptr[j + b_len] > b_msd
6359 +                   || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
6360 +                 /* r[j+n] >= b[n-1]+1 or
6361 +                    r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
6362 +                    carry.  */
6363 +                 goto subtract;
6364 +             }
6365 +           /* q_star = q*,
6366 +              c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta).  */
6367 +           {
6368 +             mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
6369 +               ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
6370 +             mp_twolimb_t c3 = /* b[n-2] * q* */
6371 +               (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
6372 +             /* While c2 < c3, increase c2 and decrease c3.
6373 +                Consider c3-c2.  While it is > 0, decrease it by
6374 +                b[n-1]*beta+b[n-2].  Because of b[n-1]*beta+b[n-2] >= beta^2/2
6375 +                this can happen only twice.  */
6376 +             if (c3 > c2)
6377 +               {
6378 +                 q_star = q_star - 1; /* q* := q* - 1 */
6379 +                 if (c3 - c2 > b_msdd)
6380 +                   q_star = q_star - 1; /* q* := q* - 1 */
6381 +               }
6382 +           }
6383 +           if (q_star > 0)
6384 +             subtract:
6385 +             {
6386 +               /* Subtract r := r - b * q* * beta^j.  */
6387 +               mp_limb_t cr;
6388 +               {
6389 +                 const mp_limb_t *sourceptr = b_ptr;
6390 +                 mp_limb_t *destptr = r_ptr + j;
6391 +                 mp_twolimb_t carry = 0;
6392 +                 size_t count;
6393 +                 for (count = b_len; count > 0; count--)
6394 +                   {
6395 +                     /* Here 0 <= carry <= q*.  */
6396 +                     carry =
6397 +                       carry
6398 +                       + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
6399 +                       + (mp_limb_t) ~(*destptr);
6400 +                     /* Here 0 <= carry <= beta*q* + beta-1.  */
6401 +                     *destptr++ = ~(mp_limb_t) carry;
6402 +                     carry = carry >> GMP_LIMB_BITS; /* <= q* */
6403 +                   }
6404 +                 cr = (mp_limb_t) carry;
6405 +               }
6406 +               /* Subtract cr from r_ptr[j + b_len], then forget about
6407 +                  r_ptr[j + b_len].  */
6408 +               if (cr > r_ptr[j + b_len])
6409 +                 {
6410 +                   /* Subtraction gave a carry.  */
6411 +                   q_star = q_star - 1; /* q* := q* - 1 */
6412 +                   /* Add b back.  */
6413 +                   {
6414 +                     const mp_limb_t *sourceptr = b_ptr;
6415 +                     mp_limb_t *destptr = r_ptr + j;
6416 +                     mp_limb_t carry = 0;
6417 +                     size_t count;
6418 +                     for (count = b_len; count > 0; count--)
6419 +                       {
6420 +                         mp_limb_t source1 = *sourceptr++;
6421 +                         mp_limb_t source2 = *destptr;
6422 +                         *destptr++ = source1 + source2 + carry;
6423 +                         carry =
6424 +                           (carry
6425 +                            ? source1 >= (mp_limb_t) ~source2
6426 +                            : source1 > (mp_limb_t) ~source2);
6427 +                       }
6428 +                   }
6429 +                   /* Forget about the carry and about r[j+n].  */
6430 +                 }
6431 +             }
6432 +           /* q* is determined.  Store it as q[j].  */
6433 +           q_ptr[j] = q_star;
6434 +           if (j == 0)
6435 +             break;
6436 +           j--;
6437 +         }
6438 +      }
6439 +      r_len = b_len;
6440 +      /* Normalise q.  */
6441 +      if (q_ptr[q_len - 1] == 0)
6442 +       q_len--;
6443 +# if 0 /* Not needed here, since we need r only to compare it with b/2, and
6444 +         b is shifted left by s bits.  */
6445 +      /* Shift r right by s bits.  */
6446 +      if (s > 0)
6447 +       {
6448 +         mp_limb_t ptr = r_ptr + r_len;
6449 +         mp_twolimb_t accu = 0;
6450 +         size_t count;
6451 +         for (count = r_len; count > 0; count--)
6452 +           {
6453 +             accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
6454 +             accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
6455 +             *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
6456 +           }
6457 +       }
6458 +# endif
6459 +      /* Normalise r.  */
6460 +      while (r_len > 0 && r_ptr[r_len - 1] == 0)
6461 +       r_len--;
6462 +    }
6463 +  /* Compare r << 1 with b.  */
6464 +  if (r_len > b_len)
6465 +    goto increment_q;
6466 +  {
6467 +    size_t i;
6468 +    for (i = b_len;;)
6469 +      {
6470 +       mp_limb_t r_i =
6471 +         (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
6472 +         | (i < r_len ? r_ptr[i] << 1 : 0);
6473 +       mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
6474 +       if (r_i > b_i)
6475 +         goto increment_q;
6476 +       if (r_i < b_i)
6477 +         goto keep_q;
6478 +       if (i == 0)
6479 +         break;
6480 +       i--;
6481 +      }
6482 +  }
6483 +  if (q_len > 0 && ((q_ptr[0] & 1) != 0))
6484 +    /* q is odd.  */
6485 +    increment_q:
6486 +    {
6487 +      size_t i;
6488 +      for (i = 0; i < q_len; i++)
6489 +       if (++(q_ptr[i]) != 0)
6490 +         goto keep_q;
6491 +      q_ptr[q_len++] = 1;
6492 +    }
6493 +  keep_q:
6494 +  if (tmp_roomptr != NULL)
6495 +    free (tmp_roomptr);
6496 +  q->limbs = q_ptr;
6497 +  q->nlimbs = q_len;
6498 +  return roomptr;
6499 +}
6500 +
6501 +/* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal
6502 +   representation.
6503 +   Destroys the contents of a.
6504 +   Return the allocated memory - containing the decimal digits in low-to-high
6505 +   order, terminated with a NUL character - in case of success, NULL in case
6506 +   of memory allocation failure.  */
6507 +static char *
6508 +convert_to_decimal (mpn_t a, size_t extra_zeroes)
6509 +{
6510 +  mp_limb_t *a_ptr = a.limbs;
6511 +  size_t a_len = a.nlimbs;
6512 +  /* 0.03345 is slightly larger than log(2)/(9*log(10)).  */
6513 +  size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1);
6514 +  char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes));
6515 +  if (c_ptr != NULL)
6516 +    {
6517 +      char *d_ptr = c_ptr;
6518 +      for (; extra_zeroes > 0; extra_zeroes--)
6519 +       *d_ptr++ = '0';
6520 +      while (a_len > 0)
6521 +       {
6522 +         /* Divide a by 10^9, in-place.  */
6523 +         mp_limb_t remainder = 0;
6524 +         mp_limb_t *ptr = a_ptr + a_len;
6525 +         size_t count;
6526 +         for (count = a_len; count > 0; count--)
6527 +           {
6528 +             mp_twolimb_t num =
6529 +               ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
6530 +             *ptr = num / 1000000000;
6531 +             remainder = num % 1000000000;
6532 +           }
6533 +         /* Store the remainder as 9 decimal digits.  */
6534 +         for (count = 9; count > 0; count--)
6535 +           {
6536 +             *d_ptr++ = '0' + (remainder % 10);
6537 +             remainder = remainder / 10;
6538 +           }
6539 +         /* Normalize a.  */
6540 +         if (a_ptr[a_len - 1] == 0)
6541 +           a_len--;
6542 +       }
6543 +      /* Remove leading zeroes.  */
6544 +      while (d_ptr > c_ptr && d_ptr[-1] == '0')
6545 +       d_ptr--;
6546 +      /* But keep at least one zero.  */
6547 +      if (d_ptr == c_ptr)
6548 +       *d_ptr++ = '0';
6549 +      /* Terminate the string.  */
6550 +      *d_ptr = '\0';
6551 +    }
6552 +  return c_ptr;
6553 +}
6554 +
6555 +# if NEED_PRINTF_LONG_DOUBLE
6556 +
6557 +/* Assuming x is finite and >= 0:
6558 +   write x as x = 2^e * m, where m is a bignum.
6559 +   Return the allocated memory in case of success, NULL in case of memory
6560 +   allocation failure.  */
6561 +static void *
6562 +decode_long_double (long double x, int *ep, mpn_t *mp)
6563 +{
6564 +  mpn_t m;
6565 +  int exp;
6566 +  long double y;
6567 +  size_t i;
6568 +
6569 +  /* Allocate memory for result.  */
6570 +  m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
6571 +  m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
6572 +  if (m.limbs == NULL)
6573 +    return NULL;
6574 +  /* Split into exponential part and mantissa.  */
6575 +  y = frexpl (x, &exp);
6576 +  if (!(y >= 0.0L && y < 1.0L))
6577 +    abort ();
6578 +  /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * LDBL_MANT_BIT), and the
6579 +     latter is an integer.  */
6580 +  /* Convert the mantissa (y * LDBL_MANT_BIT) to a sequence of limbs.
6581 +     I'm not sure whether it's safe to cast a 'long double' value between
6582 +     2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
6583 +     'long double' values between 0 and 2^16 (to 'unsigned int' or 'int',
6584 +     doesn't matter).  */
6585 +#  if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0
6586 +#   if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
6587 +    {
6588 +      mp_limb_t hi, lo;
6589 +      y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2));
6590 +      hi = (int) y;
6591 +      y -= hi;
6592 +      if (!(y >= 0.0L && y < 1.0L))
6593 +       abort ();
6594 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
6595 +      lo = (int) y;
6596 +      y -= lo;
6597 +      if (!(y >= 0.0L && y < 1.0L))
6598 +       abort ();
6599 +      m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
6600 +    }
6601 +#   else
6602 +    {
6603 +      mp_limb_t d;
6604 +      y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS);
6605 +      d = (int) y;
6606 +      y -= d;
6607 +      if (!(y >= 0.0L && y < 1.0L))
6608 +       abort ();
6609 +      m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d;
6610 +    }
6611 +#   endif
6612 +#  endif
6613 +  for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
6614 +    {
6615 +      mp_limb_t hi, lo;
6616 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
6617 +      hi = (int) y;
6618 +      y -= hi;
6619 +      if (!(y >= 0.0L && y < 1.0L))
6620 +       abort ();
6621 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
6622 +      lo = (int) y;
6623 +      y -= lo;
6624 +      if (!(y >= 0.0L && y < 1.0L))
6625 +       abort ();
6626 +      m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
6627 +    }
6628 +#if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
6629 +         precision.  */
6630 +  if (!(y == 0.0L))
6631 +    abort ();
6632 +#endif
6633 +  /* Normalise.  */
6634 +  while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
6635 +    m.nlimbs--;
6636 +  *mp = m;
6637 +  *ep = exp - LDBL_MANT_BIT;
6638 +  return m.limbs;
6639 +}
6640 +
6641 +# endif
6642 +
6643 +# if NEED_PRINTF_DOUBLE
6644 +
6645 +/* Assuming x is finite and >= 0:
6646 +   write x as x = 2^e * m, where m is a bignum.
6647 +   Return the allocated memory in case of success, NULL in case of memory
6648 +   allocation failure.  */
6649 +static void *
6650 +decode_double (double x, int *ep, mpn_t *mp)
6651 +{
6652 +  mpn_t m;
6653 +  int exp;
6654 +  double y;
6655 +  size_t i;
6656 +
6657 +  /* Allocate memory for result.  */
6658 +  m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
6659 +  m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
6660 +  if (m.limbs == NULL)
6661 +    return NULL;
6662 +  /* Split into exponential part and mantissa.  */
6663 +  y = frexp (x, &exp);
6664 +  if (!(y >= 0.0 && y < 1.0))
6665 +    abort ();
6666 +  /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the
6667 +     latter is an integer.  */
6668 +  /* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs.
6669 +     I'm not sure whether it's safe to cast a 'double' value between
6670 +     2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
6671 +     'double' values between 0 and 2^16 (to 'unsigned int' or 'int',
6672 +     doesn't matter).  */
6673 +#  if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0
6674 +#   if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
6675 +    {
6676 +      mp_limb_t hi, lo;
6677 +      y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2));
6678 +      hi = (int) y;
6679 +      y -= hi;
6680 +      if (!(y >= 0.0 && y < 1.0))
6681 +       abort ();
6682 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
6683 +      lo = (int) y;
6684 +      y -= lo;
6685 +      if (!(y >= 0.0 && y < 1.0))
6686 +       abort ();
6687 +      m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
6688 +    }
6689 +#   else
6690 +    {
6691 +      mp_limb_t d;
6692 +      y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS);
6693 +      d = (int) y;
6694 +      y -= d;
6695 +      if (!(y >= 0.0 && y < 1.0))
6696 +       abort ();
6697 +      m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d;
6698 +    }
6699 +#   endif
6700 +#  endif
6701 +  for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
6702 +    {
6703 +      mp_limb_t hi, lo;
6704 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
6705 +      hi = (int) y;
6706 +      y -= hi;
6707 +      if (!(y >= 0.0 && y < 1.0))
6708 +       abort ();
6709 +      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
6710 +      lo = (int) y;
6711 +      y -= lo;
6712 +      if (!(y >= 0.0 && y < 1.0))
6713 +       abort ();
6714 +      m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
6715 +    }
6716 +  if (!(y == 0.0))
6717 +    abort ();
6718 +  /* Normalise.  */
6719 +  while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
6720 +    m.nlimbs--;
6721 +  *mp = m;
6722 +  *ep = exp - DBL_MANT_BIT;
6723 +  return m.limbs;
6724 +}
6725 +
6726 +# endif
6727 +
6728 +/* Assuming x = 2^e * m is finite and >= 0, and n is an integer:
6729 +   Returns the decimal representation of round (x * 10^n).
6730 +   Return the allocated memory - containing the decimal digits in low-to-high
6731 +   order, terminated with a NUL character - in case of success, NULL in case
6732 +   of memory allocation failure.  */
6733 +static char *
6734 +scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
6735 +{
6736 +  int s;
6737 +  size_t extra_zeroes;
6738 +  unsigned int abs_n;
6739 +  unsigned int abs_s;
6740 +  mp_limb_t *pow5_ptr;
6741 +  size_t pow5_len;
6742 +  unsigned int s_limbs;
6743 +  unsigned int s_bits;
6744 +  mpn_t pow5;
6745 +  mpn_t z;
6746 +  void *z_memory;
6747 +  char *digits;
6748 +
6749 +  if (memory == NULL)
6750 +    return NULL;
6751 +  /* x = 2^e * m, hence
6752 +     y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m)
6753 +       = round (2^s * 5^n * m).  */
6754 +  s = e + n;
6755 +  extra_zeroes = 0;
6756 +  /* Factor out a common power of 10 if possible.  */
6757 +  if (s > 0 && n > 0)
6758 +    {
6759 +      extra_zeroes = (s < n ? s : n);
6760 +      s -= extra_zeroes;
6761 +      n -= extra_zeroes;
6762 +    }
6763 +  /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes.
6764 +     Before converting to decimal, we need to compute
6765 +     z = round (2^s * 5^n * m).  */
6766 +  /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same
6767 +     sign.  2.322 is slightly larger than log(5)/log(2).  */
6768 +  abs_n = (n >= 0 ? n : -n);
6769 +  abs_s = (s >= 0 ? s : -s);
6770 +  pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1
6771 +                                   + abs_s / GMP_LIMB_BITS + 1)
6772 +                                  * sizeof (mp_limb_t));
6773 +  if (pow5_ptr == NULL)
6774 +    {
6775 +      free (memory);
6776 +      return NULL;
6777 +    }
6778 +  /* Initialize with 1.  */
6779 +  pow5_ptr[0] = 1;
6780 +  pow5_len = 1;
6781 +  /* Multiply with 5^|n|.  */
6782 +  if (abs_n > 0)
6783 +    {
6784 +      static mp_limb_t const small_pow5[13 + 1] =
6785 +       {
6786 +         1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
6787 +         48828125, 244140625, 1220703125
6788 +       };
6789 +      unsigned int n13;
6790 +      for (n13 = 0; n13 <= abs_n; n13 += 13)
6791 +       {
6792 +         mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
6793 +         size_t j;
6794 +         mp_twolimb_t carry = 0;
6795 +         for (j = 0; j < pow5_len; j++)
6796 +           {
6797 +             mp_limb_t digit2 = pow5_ptr[j];
6798 +             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
6799 +             pow5_ptr[j] = (mp_limb_t) carry;
6800 +             carry = carry >> GMP_LIMB_BITS;
6801 +           }
6802 +         if (carry > 0)
6803 +           pow5_ptr[pow5_len++] = (mp_limb_t) carry;
6804 +       }
6805 +    }
6806 +  s_limbs = abs_s / GMP_LIMB_BITS;
6807 +  s_bits = abs_s % GMP_LIMB_BITS;
6808 +  if (n >= 0 ? s >= 0 : s <= 0)
6809 +    {
6810 +      /* Multiply with 2^|s|.  */
6811 +      if (s_bits > 0)
6812 +       {
6813 +         mp_limb_t *ptr = pow5_ptr;
6814 +         mp_twolimb_t accu = 0;
6815 +         size_t count;
6816 +         for (count = pow5_len; count > 0; count--)
6817 +           {
6818 +             accu += (mp_twolimb_t) *ptr << s_bits;
6819 +             *ptr++ = (mp_limb_t) accu;
6820 +             accu = accu >> GMP_LIMB_BITS;
6821 +           }
6822 +         if (accu > 0)
6823 +           {
6824 +             *ptr = (mp_limb_t) accu;
6825 +             pow5_len++;
6826 +           }
6827 +       }
6828 +      if (s_limbs > 0)
6829 +       {
6830 +         size_t count;
6831 +         for (count = pow5_len; count > 0;)
6832 +           {
6833 +             count--;
6834 +             pow5_ptr[s_limbs + count] = pow5_ptr[count];
6835 +           }
6836 +         for (count = s_limbs; count > 0;)
6837 +           {
6838 +             count--;
6839 +             pow5_ptr[count] = 0;
6840 +           }
6841 +         pow5_len += s_limbs;
6842 +       }
6843 +      pow5.limbs = pow5_ptr;
6844 +      pow5.nlimbs = pow5_len;
6845 +      if (n >= 0)
6846 +       {
6847 +         /* Multiply m with pow5.  No division needed.  */
6848 +         z_memory = multiply (m, pow5, &z);
6849 +       }
6850 +      else
6851 +       {
6852 +         /* Divide m by pow5 and round.  */
6853 +         z_memory = divide (m, pow5, &z);
6854 +       }
6855 +    }
6856 +  else
6857 +    {
6858 +      pow5.limbs = pow5_ptr;
6859 +      pow5.nlimbs = pow5_len;
6860 +      if (n >= 0)
6861 +       {
6862 +         /* n >= 0, s < 0.
6863 +            Multiply m with pow5, then divide by 2^|s|.  */
6864 +         mpn_t numerator;
6865 +         mpn_t denominator;
6866 +         void *tmp_memory;
6867 +         tmp_memory = multiply (m, pow5, &numerator);
6868 +         if (tmp_memory == NULL)
6869 +           {
6870 +             free (pow5_ptr);
6871 +             free (memory);
6872 +             return NULL;
6873 +           }
6874 +         /* Construct 2^|s|.  */
6875 +         {
6876 +           mp_limb_t *ptr = pow5_ptr + pow5_len;
6877 +           size_t i;
6878 +           for (i = 0; i < s_limbs; i++)
6879 +             ptr[i] = 0;
6880 +           ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
6881 +           denominator.limbs = ptr;
6882 +           denominator.nlimbs = s_limbs + 1;
6883 +         }
6884 +         z_memory = divide (numerator, denominator, &z);
6885 +         free (tmp_memory);
6886 +       }
6887 +      else
6888 +       {
6889 +         /* n < 0, s > 0.
6890 +            Multiply m with 2^s, then divide by pow5.  */
6891 +         mpn_t numerator;
6892 +         mp_limb_t *num_ptr;
6893 +         num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
6894 +                                         * sizeof (mp_limb_t));
6895 +         if (num_ptr == NULL)
6896 +           {
6897 +             free (pow5_ptr);
6898 +             free (memory);
6899 +             return NULL;
6900 +           }
6901 +         {
6902 +           mp_limb_t *destptr = num_ptr;
6903 +           {
6904 +             size_t i;
6905 +             for (i = 0; i < s_limbs; i++)
6906 +               *destptr++ = 0;
6907 +           }
6908 +           if (s_bits > 0)
6909 +             {
6910 +               const mp_limb_t *sourceptr = m.limbs;
6911 +               mp_twolimb_t accu = 0;
6912 +               size_t count;
6913 +               for (count = m.nlimbs; count > 0; count--)
6914 +                 {
6915 +                   accu += (mp_twolimb_t) *sourceptr++ << s_bits;
6916 +                   *destptr++ = (mp_limb_t) accu;
6917 +                   accu = accu >> GMP_LIMB_BITS;
6918 +                 }
6919 +               if (accu > 0)
6920 +                 *destptr++ = (mp_limb_t) accu;
6921 +             }
6922 +           else
6923 +             {
6924 +               const mp_limb_t *sourceptr = m.limbs;
6925 +               size_t count;
6926 +               for (count = m.nlimbs; count > 0; count--)
6927 +                 *destptr++ = *sourceptr++;
6928 +             }
6929 +           numerator.limbs = num_ptr;
6930 +           numerator.nlimbs = destptr - num_ptr;
6931 +         }
6932 +         z_memory = divide (numerator, pow5, &z);
6933 +         free (num_ptr);
6934 +       }
6935 +    }
6936 +  free (pow5_ptr);
6937 +  free (memory);
6938 +
6939 +  /* Here y = round (x * 10^n) = z * 10^extra_zeroes.  */
6940 +
6941 +  if (z_memory == NULL)
6942 +    return NULL;
6943 +  digits = convert_to_decimal (z, extra_zeroes);
6944 +  free (z_memory);
6945 +  return digits;
6946 +}
6947 +
6948 +# if NEED_PRINTF_LONG_DOUBLE
6949 +
6950 +/* Assuming x is finite and >= 0, and n is an integer:
6951 +   Returns the decimal representation of round (x * 10^n).
6952 +   Return the allocated memory - containing the decimal digits in low-to-high
6953 +   order, terminated with a NUL character - in case of success, NULL in case
6954 +   of memory allocation failure.  */
6955 +static char *
6956 +scale10_round_decimal_long_double (long double x, int n)
6957 +{
6958 +  int e IF_LINT(= 0);
6959 +  mpn_t m;
6960 +  void *memory = decode_long_double (x, &e, &m);
6961 +  return scale10_round_decimal_decoded (e, m, memory, n);
6962 +}
6963 +
6964 +# endif
6965 +
6966 +# if NEED_PRINTF_DOUBLE
6967 +
6968 +/* Assuming x is finite and >= 0, and n is an integer:
6969 +   Returns the decimal representation of round (x * 10^n).
6970 +   Return the allocated memory - containing the decimal digits in low-to-high
6971 +   order, terminated with a NUL character - in case of success, NULL in case
6972 +   of memory allocation failure.  */
6973 +static char *
6974 +scale10_round_decimal_double (double x, int n)
6975 +{
6976 +  int e IF_LINT(= 0);
6977 +  mpn_t m;
6978 +  void *memory = decode_double (x, &e, &m);
6979 +  return scale10_round_decimal_decoded (e, m, memory, n);
6980 +}
6981 +
6982 +# endif
6983 +
6984 +# if NEED_PRINTF_LONG_DOUBLE
6985 +
6986 +/* Assuming x is finite and > 0:
6987 +   Return an approximation for n with 10^n <= x < 10^(n+1).
6988 +   The approximation is usually the right n, but may be off by 1 sometimes.  */
6989 +static int
6990 +floorlog10l (long double x)
6991 +{
6992 +  int exp;
6993 +  long double y;
6994 +  double z;
6995 +  double l;
6996 +
6997 +  /* Split into exponential part and mantissa.  */
6998 +  y = frexpl (x, &exp);
6999 +  if (!(y >= 0.0L && y < 1.0L))
7000 +    abort ();
7001 +  if (y == 0.0L)
7002 +    return INT_MIN;
7003 +  if (y < 0.5L)
7004 +    {
7005 +      while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
7006 +       {
7007 +         y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
7008 +         exp -= GMP_LIMB_BITS;
7009 +       }
7010 +      if (y < (1.0L / (1 << 16)))
7011 +       {
7012 +         y *= 1.0L * (1 << 16);
7013 +         exp -= 16;
7014 +       }
7015 +      if (y < (1.0L / (1 << 8)))
7016 +       {
7017 +         y *= 1.0L * (1 << 8);
7018 +         exp -= 8;
7019 +       }
7020 +      if (y < (1.0L / (1 << 4)))
7021 +       {
7022 +         y *= 1.0L * (1 << 4);
7023 +         exp -= 4;
7024 +       }
7025 +      if (y < (1.0L / (1 << 2)))
7026 +       {
7027 +         y *= 1.0L * (1 << 2);
7028 +         exp -= 2;
7029 +       }
7030 +      if (y < (1.0L / (1 << 1)))
7031 +       {
7032 +         y *= 1.0L * (1 << 1);
7033 +         exp -= 1;
7034 +       }
7035 +    }
7036 +  if (!(y >= 0.5L && y < 1.0L))
7037 +    abort ();
7038 +  /* Compute an approximation for l = log2(x) = exp + log2(y).  */
7039 +  l = exp;
7040 +  z = y;
7041 +  if (z < 0.70710678118654752444)
7042 +    {
7043 +      z *= 1.4142135623730950488;
7044 +      l -= 0.5;
7045 +    }
7046 +  if (z < 0.8408964152537145431)
7047 +    {
7048 +      z *= 1.1892071150027210667;
7049 +      l -= 0.25;
7050 +    }
7051 +  if (z < 0.91700404320467123175)
7052 +    {
7053 +      z *= 1.0905077326652576592;
7054 +      l -= 0.125;
7055 +    }
7056 +  if (z < 0.9576032806985736469)
7057 +    {
7058 +      z *= 1.0442737824274138403;
7059 +      l -= 0.0625;
7060 +    }
7061 +  /* Now 0.95 <= z <= 1.01.  */
7062 +  z = 1 - z;
7063 +  /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...)
7064 +     Four terms are enough to get an approximation with error < 10^-7.  */
7065 +  l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
7066 +  /* Finally multiply with log(2)/log(10), yields an approximation for
7067 +     log10(x).  */
7068 +  l *= 0.30102999566398119523;
7069 +  /* Round down to the next integer.  */
7070 +  return (int) l + (l < 0 ? -1 : 0);
7071 +}
7072 +
7073 +# endif
7074 +
7075 +# if NEED_PRINTF_DOUBLE
7076 +
7077 +/* Assuming x is finite and > 0:
7078 +   Return an approximation for n with 10^n <= x < 10^(n+1).
7079 +   The approximation is usually the right n, but may be off by 1 sometimes.  */
7080 +static int
7081 +floorlog10 (double x)
7082 +{
7083 +  int exp;
7084 +  double y;
7085 +  double z;
7086 +  double l;
7087 +
7088 +  /* Split into exponential part and mantissa.  */
7089 +  y = frexp (x, &exp);
7090 +  if (!(y >= 0.0 && y < 1.0))
7091 +    abort ();
7092 +  if (y == 0.0)
7093 +    return INT_MIN;
7094 +  if (y < 0.5)
7095 +    {
7096 +      while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
7097 +       {
7098 +         y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
7099 +         exp -= GMP_LIMB_BITS;
7100 +       }
7101 +      if (y < (1.0 / (1 << 16)))
7102 +       {
7103 +         y *= 1.0 * (1 << 16);
7104 +         exp -= 16;
7105 +       }
7106 +      if (y < (1.0 / (1 << 8)))
7107 +       {
7108 +         y *= 1.0 * (1 << 8);
7109 +         exp -= 8;
7110 +       }
7111 +      if (y < (1.0 / (1 << 4)))
7112 +       {
7113 +         y *= 1.0 * (1 << 4);
7114 +         exp -= 4;
7115 +       }
7116 +      if (y < (1.0 / (1 << 2)))
7117 +       {
7118 +         y *= 1.0 * (1 << 2);
7119 +         exp -= 2;
7120 +       }
7121 +      if (y < (1.0 / (1 << 1)))
7122 +       {
7123 +         y *= 1.0 * (1 << 1);
7124 +         exp -= 1;
7125 +       }
7126 +    }
7127 +  if (!(y >= 0.5 && y < 1.0))
7128 +    abort ();
7129 +  /* Compute an approximation for l = log2(x) = exp + log2(y).  */
7130 +  l = exp;
7131 +  z = y;
7132 +  if (z < 0.70710678118654752444)
7133 +    {
7134 +      z *= 1.4142135623730950488;
7135 +      l -= 0.5;
7136 +    }
7137 +  if (z < 0.8408964152537145431)
7138 +    {
7139 +      z *= 1.1892071150027210667;
7140 +      l -= 0.25;
7141 +    }
7142 +  if (z < 0.91700404320467123175)
7143 +    {
7144 +      z *= 1.0905077326652576592;
7145 +      l -= 0.125;
7146 +    }
7147 +  if (z < 0.9576032806985736469)
7148 +    {
7149 +      z *= 1.0442737824274138403;
7150 +      l -= 0.0625;
7151 +    }
7152 +  /* Now 0.95 <= z <= 1.01.  */
7153 +  z = 1 - z;
7154 +  /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...)
7155 +     Four terms are enough to get an approximation with error < 10^-7.  */
7156 +  l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
7157 +  /* Finally multiply with log(2)/log(10), yields an approximation for
7158 +     log10(x).  */
7159 +  l *= 0.30102999566398119523;
7160 +  /* Round down to the next integer.  */
7161 +  return (int) l + (l < 0 ? -1 : 0);
7162 +}
7163 +
7164 +# endif
7165 +
7166 +/* Tests whether a string of digits consists of exactly PRECISION zeroes and
7167 +   a single '1' digit.  */
7168 +static int
7169 +is_borderline (const char *digits, size_t precision)
7170 +{
7171 +  for (; precision > 0; precision--, digits++)
7172 +    if (*digits != '0')
7173 +      return 0;
7174 +  if (*digits != '1')
7175 +    return 0;
7176 +  digits++;
7177 +  return *digits == '\0';
7178 +}
7179 +
7180 +#endif
7181 +
7182 +DCHAR_T *
7183 +VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
7184 +           const FCHAR_T *format, va_list args)
7185 +{
7186 +  DIRECTIVES d;
7187 +  arguments a;
7188 +
7189 +  if (PRINTF_PARSE (format, &d, &a) < 0)
7190 +    /* errno is already set.  */
7191 +    return NULL;
7192 +
7193 +#define CLEANUP() \
7194 +  free (d.dir);                                                                \
7195 +  if (a.arg)                                                           \
7196 +    free (a.arg);
7197 +
7198 +  if (PRINTF_FETCHARGS (args, &a) < 0)
7199 +    {
7200 +      CLEANUP ();
7201 +      errno = EINVAL;
7202 +      return NULL;
7203 +    }
7204 +
7205 +  {
7206 +    size_t buf_neededlength;
7207 +    TCHAR_T *buf;
7208 +    TCHAR_T *buf_malloced;
7209 +    const FCHAR_T *cp;
7210 +    size_t i;
7211 +    DIRECTIVE *dp;
7212 +    /* Output string accumulator.  */
7213 +    DCHAR_T *result;
7214 +    size_t allocated;
7215 +    size_t length;
7216 +
7217 +    /* Allocate a small buffer that will hold a directive passed to
7218 +       sprintf or snprintf.  */
7219 +    buf_neededlength =
7220 +      xsum4 (7, d.max_width_length, d.max_precision_length, 6);
7221 +#if HAVE_ALLOCA
7222 +    if (buf_neededlength < 4000 / sizeof (TCHAR_T))
7223 +      {
7224 +       buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
7225 +       buf_malloced = NULL;
7226 +      }
7227 +    else
7228 +#endif
7229 +      {
7230 +       size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
7231 +       if (size_overflow_p (buf_memsize))
7232 +         goto out_of_memory_1;
7233 +       buf = (TCHAR_T *) malloc (buf_memsize);
7234 +       if (buf == NULL)
7235 +         goto out_of_memory_1;
7236 +       buf_malloced = buf;
7237 +      }
7238 +
7239 +    if (resultbuf != NULL)
7240 +      {
7241 +       result = resultbuf;
7242 +       allocated = *lengthp;
7243 +      }
7244 +    else
7245 +      {
7246 +       result = NULL;
7247 +       allocated = 0;
7248 +      }
7249 +    length = 0;
7250 +    /* Invariants:
7251 +       result is either == resultbuf or == NULL or malloc-allocated.
7252 +       If length > 0, then result != NULL.  */
7253 +
7254 +    /* Ensures that allocated >= needed.  Aborts through a jump to
7255 +       out_of_memory if needed is SIZE_MAX or otherwise too big.  */
7256 +#define ENSURE_ALLOCATION(needed) \
7257 +    if ((needed) > allocated)                                               \
7258 +      {                                                                             \
7259 +       size_t memory_size;                                                  \
7260 +       DCHAR_T *memory;                                                     \
7261 +                                                                            \
7262 +       allocated = (allocated > 0 ? xtimes (allocated, 2) : 12);            \
7263 +       if ((needed) > allocated)                                            \
7264 +         allocated = (needed);                                              \
7265 +       memory_size = xtimes (allocated, sizeof (DCHAR_T));                  \
7266 +       if (size_overflow_p (memory_size))                                   \
7267 +         goto out_of_memory;                                                \
7268 +       if (result == resultbuf || result == NULL)                           \
7269 +         memory = (DCHAR_T *) malloc (memory_size);                         \
7270 +       else                                                                 \
7271 +         memory = (DCHAR_T *) realloc (result, memory_size);                \
7272 +       if (memory == NULL)                                                  \
7273 +         goto out_of_memory;                                                \
7274 +       if (result == resultbuf && length > 0)                               \
7275 +         DCHAR_CPY (memory, result, length);                                \
7276 +       result = memory;                                                     \
7277 +      }
7278 +
7279 +    for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
7280 +      {
7281 +       if (cp != dp->dir_start)
7282 +         {
7283 +           size_t n = dp->dir_start - cp;
7284 +           size_t augmented_length = xsum (length, n);
7285 +
7286 +           ENSURE_ALLOCATION (augmented_length);
7287 +           /* This copies a piece of FCHAR_T[] into a DCHAR_T[].  Here we
7288 +              need that the format string contains only ASCII characters
7289 +              if FCHAR_T and DCHAR_T are not the same type.  */
7290 +           if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
7291 +             {
7292 +               DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
7293 +               length = augmented_length;
7294 +             }
7295 +           else
7296 +             {
7297 +               do
7298 +                 result[length++] = (unsigned char) *cp++;
7299 +               while (--n > 0);
7300 +             }
7301 +         }
7302 +       if (i == d.count)
7303 +         break;
7304 +
7305 +       /* Execute a single directive.  */
7306 +       if (dp->conversion == '%')
7307 +         {
7308 +           size_t augmented_length;
7309 +
7310 +           if (!(dp->arg_index == ARG_NONE))
7311 +             abort ();
7312 +           augmented_length = xsum (length, 1);
7313 +           ENSURE_ALLOCATION (augmented_length);
7314 +           result[length] = '%';
7315 +           length = augmented_length;
7316 +         }
7317 +       else
7318 +         {
7319 +           if (!(dp->arg_index != ARG_NONE))
7320 +             abort ();
7321 +
7322 +           if (dp->conversion == 'n')
7323 +             {
7324 +               switch (a.arg[dp->arg_index].type)
7325 +                 {
7326 +                 case TYPE_COUNT_SCHAR_POINTER:
7327 +                   *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
7328 +                   break;
7329 +                 case TYPE_COUNT_SHORT_POINTER:
7330 +                   *a.arg[dp->arg_index].a.a_count_short_pointer = length;
7331 +                   break;
7332 +                 case TYPE_COUNT_INT_POINTER:
7333 +                   *a.arg[dp->arg_index].a.a_count_int_pointer = length;
7334 +                   break;
7335 +                 case TYPE_COUNT_LONGINT_POINTER:
7336 +                   *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
7337 +                   break;
7338 +#if HAVE_LONG_LONG_INT
7339 +                 case TYPE_COUNT_LONGLONGINT_POINTER:
7340 +                   *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
7341 +                   break;
7342 +#endif
7343 +                 default:
7344 +                   abort ();
7345 +                 }
7346 +             }
7347 +#if ENABLE_UNISTDIO
7348 +           /* The unistdio extensions.  */
7349 +           else if (dp->conversion == 'U')
7350 +             {
7351 +               arg_type type = a.arg[dp->arg_index].type;
7352 +               int flags = dp->flags;
7353 +               int has_width;
7354 +               size_t width;
7355 +               int has_precision;
7356 +               size_t precision;
7357 +
7358 +               has_width = 0;
7359 +               width = 0;
7360 +               if (dp->width_start != dp->width_end)
7361 +                 {
7362 +                   if (dp->width_arg_index != ARG_NONE)
7363 +                     {
7364 +                       int arg;
7365 +
7366 +                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
7367 +                         abort ();
7368 +                       arg = a.arg[dp->width_arg_index].a.a_int;
7369 +                       if (arg < 0)
7370 +                         {
7371 +                           /* "A negative field width is taken as a '-' flag
7372 +                               followed by a positive field width."  */
7373 +                           flags |= FLAG_LEFT;
7374 +                           width = (unsigned int) (-arg);
7375 +                         }
7376 +                       else
7377 +                         width = arg;
7378 +                     }
7379 +                   else
7380 +                     {
7381 +                       const FCHAR_T *digitp = dp->width_start;
7382 +
7383 +                       do
7384 +                         width = xsum (xtimes (width, 10), *digitp++ - '0');
7385 +                       while (digitp != dp->width_end);
7386 +                     }
7387 +                   has_width = 1;
7388 +                 }
7389 +
7390 +               has_precision = 0;
7391 +               precision = 0;
7392 +               if (dp->precision_start != dp->precision_end)
7393 +                 {
7394 +                   if (dp->precision_arg_index != ARG_NONE)
7395 +                     {
7396 +                       int arg;
7397 +
7398 +                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
7399 +                         abort ();
7400 +                       arg = a.arg[dp->precision_arg_index].a.a_int;
7401 +                       /* "A negative precision is taken as if the precision
7402 +                           were omitted."  */
7403 +                       if (arg >= 0)
7404 +                         {
7405 +                           precision = arg;
7406 +                           has_precision = 1;
7407 +                         }
7408 +                     }
7409 +                   else
7410 +                     {
7411 +                       const FCHAR_T *digitp = dp->precision_start + 1;
7412 +
7413 +                       precision = 0;
7414 +                       while (digitp != dp->precision_end)
7415 +                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
7416 +                       has_precision = 1;
7417 +                     }
7418 +                 }
7419 +
7420 +               switch (type)
7421 +                 {
7422 +                 case TYPE_U8_STRING:
7423 +                   {
7424 +                     const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
7425 +                     const uint8_t *arg_end;
7426 +                     size_t characters;
7427 +
7428 +                     if (has_precision)
7429 +                       {
7430 +                         /* Use only PRECISION characters, from the left.  */
7431 +                         arg_end = arg;
7432 +                         characters = 0;
7433 +                         for (; precision > 0; precision--)
7434 +                           {
7435 +                             int count = u8_strmblen (arg_end);
7436 +                             if (count == 0)
7437 +                               break;
7438 +                             if (count < 0)
7439 +                               {
7440 +                                 if (!(result == resultbuf || result == NULL))
7441 +                                   free (result);
7442 +                                 if (buf_malloced != NULL)
7443 +                                   free (buf_malloced);
7444 +                                 CLEANUP ();
7445 +                                 errno = EILSEQ;
7446 +                                 return NULL;
7447 +                               }
7448 +                             arg_end += count;
7449 +                             characters++;
7450 +                           }
7451 +                       }
7452 +                     else if (has_width)
7453 +                       {
7454 +                         /* Use the entire string, and count the number of
7455 +                            characters.  */
7456 +                         arg_end = arg;
7457 +                         characters = 0;
7458 +                         for (;;)
7459 +                           {
7460 +                             int count = u8_strmblen (arg_end);
7461 +                             if (count == 0)
7462 +                               break;
7463 +                             if (count < 0)
7464 +                               {
7465 +                                 if (!(result == resultbuf || result == NULL))
7466 +                                   free (result);
7467 +                                 if (buf_malloced != NULL)
7468 +                                   free (buf_malloced);
7469 +                                 CLEANUP ();
7470 +                                 errno = EILSEQ;
7471 +                                 return NULL;
7472 +                               }
7473 +                             arg_end += count;
7474 +                             characters++;
7475 +                           }
7476 +                       }
7477 +                     else
7478 +                       {
7479 +                         /* Use the entire string.  */
7480 +                         arg_end = arg + u8_strlen (arg);
7481 +                         /* The number of characters doesn't matter.  */
7482 +                         characters = 0;
7483 +                       }
7484 +
7485 +                     if (has_width && width > characters
7486 +                         && !(dp->flags & FLAG_LEFT))
7487 +                       {
7488 +                         size_t n = width - characters;
7489 +                         ENSURE_ALLOCATION (xsum (length, n));
7490 +                         DCHAR_SET (result + length, ' ', n);
7491 +                         length += n;
7492 +                       }
7493 +
7494 +# if DCHAR_IS_UINT8_T
7495 +                     {
7496 +                       size_t n = arg_end - arg;
7497 +                       ENSURE_ALLOCATION (xsum (length, n));
7498 +                       DCHAR_CPY (result + length, arg, n);
7499 +                       length += n;
7500 +                     }
7501 +# else
7502 +                     { /* Convert.  */
7503 +                       DCHAR_T *converted = result + length;
7504 +                       size_t converted_len = allocated - length;
7505 +#  if DCHAR_IS_TCHAR
7506 +                       /* Convert from UTF-8 to locale encoding.  */
7507 +                       if (u8_conv_to_encoding (locale_charset (),
7508 +                                                iconveh_question_mark,
7509 +                                                arg, arg_end - arg, NULL,
7510 +                                                &converted, &converted_len)
7511 +                           < 0)
7512 +#  else
7513 +                       /* Convert from UTF-8 to UTF-16/UTF-32.  */
7514 +                       converted =
7515 +                         U8_TO_DCHAR (arg, arg_end - arg,
7516 +                                      converted, &converted_len);
7517 +                       if (converted == NULL)
7518 +#  endif
7519 +                         {
7520 +                           int saved_errno = errno;
7521 +                           if (!(result == resultbuf || result == NULL))
7522 +                             free (result);
7523 +                           if (buf_malloced != NULL)
7524 +                             free (buf_malloced);
7525 +                           CLEANUP ();
7526 +                           errno = saved_errno;
7527 +                           return NULL;
7528 +                         }
7529 +                       if (converted != result + length)
7530 +                         {
7531 +                           ENSURE_ALLOCATION (xsum (length, converted_len));
7532 +                           DCHAR_CPY (result + length, converted, converted_len);
7533 +                           free (converted);
7534 +                         }
7535 +                       length += converted_len;
7536 +                     }
7537 +# endif
7538 +
7539 +                     if (has_width && width > characters
7540 +                         && (dp->flags & FLAG_LEFT))
7541 +                       {
7542 +                         size_t n = width - characters;
7543 +                         ENSURE_ALLOCATION (xsum (length, n));
7544 +                         DCHAR_SET (result + length, ' ', n);
7545 +                         length += n;
7546 +                       }
7547 +                   }
7548 +                   break;
7549 +
7550 +                 case TYPE_U16_STRING:
7551 +                   {
7552 +                     const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string;
7553 +                     const uint16_t *arg_end;
7554 +                     size_t characters;
7555 +
7556 +                     if (has_precision)
7557 +                       {
7558 +                         /* Use only PRECISION characters, from the left.  */
7559 +                         arg_end = arg;
7560 +                         characters = 0;
7561 +                         for (; precision > 0; precision--)
7562 +                           {
7563 +                             int count = u16_strmblen (arg_end);
7564 +                             if (count == 0)
7565 +                               break;
7566 +                             if (count < 0)
7567 +                               {
7568 +                                 if (!(result == resultbuf || result == NULL))
7569 +                                   free (result);
7570 +                                 if (buf_malloced != NULL)
7571 +                                   free (buf_malloced);
7572 +                                 CLEANUP ();
7573 +                                 errno = EILSEQ;
7574 +                                 return NULL;
7575 +                               }
7576 +                             arg_end += count;
7577 +                             characters++;
7578 +                           }
7579 +                       }
7580 +                     else if (has_width)
7581 +                       {
7582 +                         /* Use the entire string, and count the number of
7583 +                            characters.  */
7584 +                         arg_end = arg;
7585 +                         characters = 0;
7586 +                         for (;;)
7587 +                           {
7588 +                             int count = u16_strmblen (arg_end);
7589 +                             if (count == 0)
7590 +                               break;
7591 +                             if (count < 0)
7592 +                               {
7593 +                                 if (!(result == resultbuf || result == NULL))
7594 +                                   free (result);
7595 +                                 if (buf_malloced != NULL)
7596 +                                   free (buf_malloced);
7597 +                                 CLEANUP ();
7598 +                                 errno = EILSEQ;
7599 +                                 return NULL;
7600 +                               }
7601 +                             arg_end += count;
7602 +                             characters++;
7603 +                           }
7604 +                       }
7605 +                     else
7606 +                       {
7607 +                         /* Use the entire string.  */
7608 +                         arg_end = arg + u16_strlen (arg);
7609 +                         /* The number of characters doesn't matter.  */
7610 +                         characters = 0;
7611 +                       }
7612 +
7613 +                     if (has_width && width > characters
7614 +                         && !(dp->flags & FLAG_LEFT))
7615 +                       {
7616 +                         size_t n = width - characters;
7617 +                         ENSURE_ALLOCATION (xsum (length, n));
7618 +                         DCHAR_SET (result + length, ' ', n);
7619 +                         length += n;
7620 +                       }
7621 +
7622 +# if DCHAR_IS_UINT16_T
7623 +                     {
7624 +                       size_t n = arg_end - arg;
7625 +                       ENSURE_ALLOCATION (xsum (length, n));
7626 +                       DCHAR_CPY (result + length, arg, n);
7627 +                       length += n;
7628 +                     }
7629 +# else
7630 +                     { /* Convert.  */
7631 +                       DCHAR_T *converted = result + length;
7632 +                       size_t converted_len = allocated - length;
7633 +#  if DCHAR_IS_TCHAR
7634 +                       /* Convert from UTF-16 to locale encoding.  */
7635 +                       if (u16_conv_to_encoding (locale_charset (),
7636 +                                                 iconveh_question_mark,
7637 +                                                 arg, arg_end - arg, NULL,
7638 +                                                 &converted, &converted_len)
7639 +                           < 0)
7640 +#  else
7641 +                       /* Convert from UTF-16 to UTF-8/UTF-32.  */
7642 +                       converted =
7643 +                         U16_TO_DCHAR (arg, arg_end - arg,
7644 +                                       converted, &converted_len);
7645 +                       if (converted == NULL)
7646 +#  endif
7647 +                         {
7648 +                           int saved_errno = errno;
7649 +                           if (!(result == resultbuf || result == NULL))
7650 +                             free (result);
7651 +                           if (buf_malloced != NULL)
7652 +                             free (buf_malloced);
7653 +                           CLEANUP ();
7654 +                           errno = saved_errno;
7655 +                           return NULL;
7656 +                         }
7657 +                       if (converted != result + length)
7658 +                         {
7659 +                           ENSURE_ALLOCATION (xsum (length, converted_len));
7660 +                           DCHAR_CPY (result + length, converted, converted_len);
7661 +                           free (converted);
7662 +                         }
7663 +                       length += converted_len;
7664 +                     }
7665 +# endif
7666 +
7667 +                     if (has_width && width > characters
7668 +                         && (dp->flags & FLAG_LEFT))
7669 +                       {
7670 +                         size_t n = width - characters;
7671 +                         ENSURE_ALLOCATION (xsum (length, n));
7672 +                         DCHAR_SET (result + length, ' ', n);
7673 +                         length += n;
7674 +                       }
7675 +                   }
7676 +                   break;
7677 +
7678 +                 case TYPE_U32_STRING:
7679 +                   {
7680 +                     const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string;
7681 +                     const uint32_t *arg_end;
7682 +                     size_t characters;
7683 +
7684 +                     if (has_precision)
7685 +                       {
7686 +                         /* Use only PRECISION characters, from the left.  */
7687 +                         arg_end = arg;
7688 +                         characters = 0;
7689 +                         for (; precision > 0; precision--)
7690 +                           {
7691 +                             int count = u32_strmblen (arg_end);
7692 +                             if (count == 0)
7693 +                               break;
7694 +                             if (count < 0)
7695 +                               {
7696 +                                 if (!(result == resultbuf || result == NULL))
7697 +                                   free (result);
7698 +                                 if (buf_malloced != NULL)
7699 +                                   free (buf_malloced);
7700 +                                 CLEANUP ();
7701 +                                 errno = EILSEQ;
7702 +                                 return NULL;
7703 +                               }
7704 +                             arg_end += count;
7705 +                             characters++;
7706 +                           }
7707 +                       }
7708 +                     else if (has_width)
7709 +                       {
7710 +                         /* Use the entire string, and count the number of
7711 +                            characters.  */
7712 +                         arg_end = arg;
7713 +                         characters = 0;
7714 +                         for (;;)
7715 +                           {
7716 +                             int count = u32_strmblen (arg_end);
7717 +                             if (count == 0)
7718 +                               break;
7719 +                             if (count < 0)
7720 +                               {
7721 +                                 if (!(result == resultbuf || result == NULL))
7722 +                                   free (result);
7723 +                                 if (buf_malloced != NULL)
7724 +                                   free (buf_malloced);
7725 +                                 CLEANUP ();
7726 +                                 errno = EILSEQ;
7727 +                                 return NULL;
7728 +                               }
7729 +                             arg_end += count;
7730 +                             characters++;
7731 +                           }
7732 +                       }
7733 +                     else
7734 +                       {
7735 +                         /* Use the entire string.  */
7736 +                         arg_end = arg + u32_strlen (arg);
7737 +                         /* The number of characters doesn't matter.  */
7738 +                         characters = 0;
7739 +                       }
7740 +
7741 +                     if (has_width && width > characters
7742 +                         && !(dp->flags & FLAG_LEFT))
7743 +                       {
7744 +                         size_t n = width - characters;
7745 +                         ENSURE_ALLOCATION (xsum (length, n));
7746 +                         DCHAR_SET (result + length, ' ', n);
7747 +                         length += n;
7748 +                       }
7749 +
7750 +# if DCHAR_IS_UINT32_T
7751 +                     {
7752 +                       size_t n = arg_end - arg;
7753 +                       ENSURE_ALLOCATION (xsum (length, n));
7754 +                       DCHAR_CPY (result + length, arg, n);
7755 +                       length += n;
7756 +                     }
7757 +# else
7758 +                     { /* Convert.  */
7759 +                       DCHAR_T *converted = result + length;
7760 +                       size_t converted_len = allocated - length;
7761 +#  if DCHAR_IS_TCHAR
7762 +                       /* Convert from UTF-32 to locale encoding.  */
7763 +                       if (u32_conv_to_encoding (locale_charset (),
7764 +                                                 iconveh_question_mark,
7765 +                                                 arg, arg_end - arg, NULL,
7766 +                                                 &converted, &converted_len)
7767 +                           < 0)
7768 +#  else
7769 +                       /* Convert from UTF-32 to UTF-8/UTF-16.  */
7770 +                       converted =
7771 +                         U32_TO_DCHAR (arg, arg_end - arg,
7772 +                                       converted, &converted_len);
7773 +                       if (converted == NULL)
7774 +#  endif
7775 +                         {
7776 +                           int saved_errno = errno;
7777 +                           if (!(result == resultbuf || result == NULL))
7778 +                             free (result);
7779 +                           if (buf_malloced != NULL)
7780 +                             free (buf_malloced);
7781 +                           CLEANUP ();
7782 +                           errno = saved_errno;
7783 +                           return NULL;
7784 +                         }
7785 +                       if (converted != result + length)
7786 +                         {
7787 +                           ENSURE_ALLOCATION (xsum (length, converted_len));
7788 +                           DCHAR_CPY (result + length, converted, converted_len);
7789 +                           free (converted);
7790 +                         }
7791 +                       length += converted_len;
7792 +                     }
7793 +# endif
7794 +
7795 +                     if (has_width && width > characters
7796 +                         && (dp->flags & FLAG_LEFT))
7797 +                       {
7798 +                         size_t n = width - characters;
7799 +                         ENSURE_ALLOCATION (xsum (length, n));
7800 +                         DCHAR_SET (result + length, ' ', n);
7801 +                         length += n;
7802 +                       }
7803 +                   }
7804 +                   break;
7805 +
7806 +                 default:
7807 +                   abort ();
7808 +                 }
7809 +             }
7810 +#endif
7811 +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
7812 +           else if ((dp->conversion == 'a' || dp->conversion == 'A')
7813 +# if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE))
7814 +                    && (0
7815 +#  if NEED_PRINTF_DOUBLE
7816 +                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
7817 +#  endif
7818 +#  if NEED_PRINTF_LONG_DOUBLE
7819 +                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
7820 +#  endif
7821 +                       )
7822 +# endif
7823 +                   )
7824 +             {
7825 +               arg_type type = a.arg[dp->arg_index].type;
7826 +               int flags = dp->flags;
7827 +               int has_width;
7828 +               size_t width;
7829 +               int has_precision;
7830 +               size_t precision;
7831 +               size_t tmp_length;
7832 +               DCHAR_T tmpbuf[700];
7833 +               DCHAR_T *tmp;
7834 +               DCHAR_T *pad_ptr;
7835 +               DCHAR_T *p;
7836 +
7837 +               has_width = 0;
7838 +               width = 0;
7839 +               if (dp->width_start != dp->width_end)
7840 +                 {
7841 +                   if (dp->width_arg_index != ARG_NONE)
7842 +                     {
7843 +                       int arg;
7844 +
7845 +                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
7846 +                         abort ();
7847 +                       arg = a.arg[dp->width_arg_index].a.a_int;
7848 +                       if (arg < 0)
7849 +                         {
7850 +                           /* "A negative field width is taken as a '-' flag
7851 +                               followed by a positive field width."  */
7852 +                           flags |= FLAG_LEFT;
7853 +                           width = (unsigned int) (-arg);
7854 +                         }
7855 +                       else
7856 +                         width = arg;
7857 +                     }
7858 +                   else
7859 +                     {
7860 +                       const FCHAR_T *digitp = dp->width_start;
7861 +
7862 +                       do
7863 +                         width = xsum (xtimes (width, 10), *digitp++ - '0');
7864 +                       while (digitp != dp->width_end);
7865 +                     }
7866 +                   has_width = 1;
7867 +                 }
7868 +
7869 +               has_precision = 0;
7870 +               precision = 0;
7871 +               if (dp->precision_start != dp->precision_end)
7872 +                 {
7873 +                   if (dp->precision_arg_index != ARG_NONE)
7874 +                     {
7875 +                       int arg;
7876 +
7877 +                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
7878 +                         abort ();
7879 +                       arg = a.arg[dp->precision_arg_index].a.a_int;
7880 +                       /* "A negative precision is taken as if the precision
7881 +                           were omitted."  */
7882 +                       if (arg >= 0)
7883 +                         {
7884 +                           precision = arg;
7885 +                           has_precision = 1;
7886 +                         }
7887 +                     }
7888 +                   else
7889 +                     {
7890 +                       const FCHAR_T *digitp = dp->precision_start + 1;
7891 +
7892 +                       precision = 0;
7893 +                       while (digitp != dp->precision_end)
7894 +                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
7895 +                       has_precision = 1;
7896 +                     }
7897 +                 }
7898 +
7899 +               /* Allocate a temporary buffer of sufficient size.  */
7900 +               if (type == TYPE_LONGDOUBLE)
7901 +                 tmp_length =
7902 +                   (unsigned int) ((LDBL_DIG + 1)
7903 +                                   * 0.831 /* decimal -> hexadecimal */
7904 +                                  )
7905 +                   + 1; /* turn floor into ceil */
7906 +               else
7907 +                 tmp_length =
7908 +                   (unsigned int) ((DBL_DIG + 1)
7909 +                                   * 0.831 /* decimal -> hexadecimal */
7910 +                                  )
7911 +                   + 1; /* turn floor into ceil */
7912 +               if (tmp_length < precision)
7913 +                 tmp_length = precision;
7914 +               /* Account for sign, decimal point etc. */
7915 +               tmp_length = xsum (tmp_length, 12);
7916 +
7917 +               if (tmp_length < width)
7918 +                 tmp_length = width;
7919 +
7920 +               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
7921 +
7922 +               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
7923 +                 tmp = tmpbuf;
7924 +               else
7925 +                 {
7926 +                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
7927 +
7928 +                   if (size_overflow_p (tmp_memsize))
7929 +                     /* Overflow, would lead to out of memory.  */
7930 +                     goto out_of_memory;
7931 +                   tmp = (DCHAR_T *) malloc (tmp_memsize);
7932 +                   if (tmp == NULL)
7933 +                     /* Out of memory.  */
7934 +                     goto out_of_memory;
7935 +                 }
7936 +
7937 +               pad_ptr = NULL;
7938 +               p = tmp;
7939 +               if (type == TYPE_LONGDOUBLE)
7940 +                 {
7941 +# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE
7942 +                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
7943 +
7944 +                   if (isnanl (arg))
7945 +                     {
7946 +                       if (dp->conversion == 'A')
7947 +                         {
7948 +                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
7949 +                         }
7950 +                       else
7951 +                         {
7952 +                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
7953 +                         }
7954 +                     }
7955 +                   else
7956 +                     {
7957 +                       int sign = 0;
7958 +                       DECL_LONG_DOUBLE_ROUNDING
7959 +
7960 +                       BEGIN_LONG_DOUBLE_ROUNDING ();
7961 +
7962 +                       if (signbit (arg)) /* arg < 0.0L or negative zero */
7963 +                         {
7964 +                           sign = -1;
7965 +                           arg = -arg;
7966 +                         }
7967 +
7968 +                       if (sign < 0)
7969 +                         *p++ = '-';
7970 +                       else if (flags & FLAG_SHOWSIGN)
7971 +                         *p++ = '+';
7972 +                       else if (flags & FLAG_SPACE)
7973 +                         *p++ = ' ';
7974 +
7975 +                       if (arg > 0.0L && arg + arg == arg)
7976 +                         {
7977 +                           if (dp->conversion == 'A')
7978 +                             {
7979 +                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
7980 +                             }
7981 +                           else
7982 +                             {
7983 +                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
7984 +                             }
7985 +                         }
7986 +                       else
7987 +                         {
7988 +                           int exponent;
7989 +                           long double mantissa;
7990 +
7991 +                           if (arg > 0.0L)
7992 +                             mantissa = printf_frexpl (arg, &exponent);
7993 +                           else
7994 +                             {
7995 +                               exponent = 0;
7996 +                               mantissa = 0.0L;
7997 +                             }
7998 +
7999 +                           if (has_precision
8000 +                               && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1)
8001 +                             {
8002 +                               /* Round the mantissa.  */
8003 +                               long double tail = mantissa;
8004 +                               size_t q;
8005 +
8006 +                               for (q = precision; ; q--)
8007 +                                 {
8008 +                                   int digit = (int) tail;
8009 +                                   tail -= digit;
8010 +                                   if (q == 0)
8011 +                                     {
8012 +                                       if (digit & 1 ? tail >= 0.5L : tail > 0.5L)
8013 +                                         tail = 1 - tail;
8014 +                                       else
8015 +                                         tail = - tail;
8016 +                                       break;
8017 +                                     }
8018 +                                   tail *= 16.0L;
8019 +                                 }
8020 +                               if (tail != 0.0L)
8021 +                                 for (q = precision; q > 0; q--)
8022 +                                   tail *= 0.0625L;
8023 +                               mantissa += tail;
8024 +                             }
8025 +
8026 +                           *p++ = '0';
8027 +                           *p++ = dp->conversion - 'A' + 'X';
8028 +                           pad_ptr = p;
8029 +                           {
8030 +                             int digit;
8031 +
8032 +                             digit = (int) mantissa;
8033 +                             mantissa -= digit;
8034 +                             *p++ = '0' + digit;
8035 +                             if ((flags & FLAG_ALT)
8036 +                                 || mantissa > 0.0L || precision > 0)
8037 +                               {
8038 +                                 *p++ = decimal_point_char ();
8039 +                                 /* This loop terminates because we assume
8040 +                                    that FLT_RADIX is a power of 2.  */
8041 +                                 while (mantissa > 0.0L)
8042 +                                   {
8043 +                                     mantissa *= 16.0L;
8044 +                                     digit = (int) mantissa;
8045 +                                     mantissa -= digit;
8046 +                                     *p++ = digit
8047 +                                            + (digit < 10
8048 +                                               ? '0'
8049 +                                               : dp->conversion - 10);
8050 +                                     if (precision > 0)
8051 +                                       precision--;
8052 +                                   }
8053 +                                 while (precision > 0)
8054 +                                   {
8055 +                                     *p++ = '0';
8056 +                                     precision--;
8057 +                                   }
8058 +                               }
8059 +                             }
8060 +                             *p++ = dp->conversion - 'A' + 'P';
8061 +#  if WIDE_CHAR_VERSION
8062 +                             {
8063 +                               static const wchar_t decimal_format[] =
8064 +                                 { '%', '+', 'd', '\0' };
8065 +                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
8066 +                             }
8067 +                             while (*p != '\0')
8068 +                               p++;
8069 +#  else
8070 +                             if (sizeof (DCHAR_T) == 1)
8071 +                               {
8072 +                                 sprintf ((char *) p, "%+d", exponent);
8073 +                                 while (*p != '\0')
8074 +                                   p++;
8075 +                               }
8076 +                             else
8077 +                               {
8078 +                                 char expbuf[6 + 1];
8079 +                                 const char *ep;
8080 +                                 sprintf (expbuf, "%+d", exponent);
8081 +                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
8082 +                                   p++;
8083 +                               }
8084 +#  endif
8085 +                         }
8086 +
8087 +                       END_LONG_DOUBLE_ROUNDING ();
8088 +                     }
8089 +# else
8090 +                   abort ();
8091 +# endif
8092 +                 }
8093 +               else
8094 +                 {
8095 +# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE
8096 +                   double arg = a.arg[dp->arg_index].a.a_double;
8097 +
8098 +                   if (isnand (arg))
8099 +                     {
8100 +                       if (dp->conversion == 'A')
8101 +                         {
8102 +                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
8103 +                         }
8104 +                       else
8105 +                         {
8106 +                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
8107 +                         }
8108 +                     }
8109 +                   else
8110 +                     {
8111 +                       int sign = 0;
8112 +
8113 +                       if (signbit (arg)) /* arg < 0.0 or negative zero */
8114 +                         {
8115 +                           sign = -1;
8116 +                           arg = -arg;
8117 +                         }
8118 +
8119 +                       if (sign < 0)
8120 +                         *p++ = '-';
8121 +                       else if (flags & FLAG_SHOWSIGN)
8122 +                         *p++ = '+';
8123 +                       else if (flags & FLAG_SPACE)
8124 +                         *p++ = ' ';
8125 +
8126 +                       if (arg > 0.0 && arg + arg == arg)
8127 +                         {
8128 +                           if (dp->conversion == 'A')
8129 +                             {
8130 +                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
8131 +                             }
8132 +                           else
8133 +                             {
8134 +                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
8135 +                             }
8136 +                         }
8137 +                       else
8138 +                         {
8139 +                           int exponent;
8140 +                           double mantissa;
8141 +
8142 +                           if (arg > 0.0)
8143 +                             mantissa = printf_frexp (arg, &exponent);
8144 +                           else
8145 +                             {
8146 +                               exponent = 0;
8147 +                               mantissa = 0.0;
8148 +                             }
8149 +
8150 +                           if (has_precision
8151 +                               && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1)
8152 +                             {
8153 +                               /* Round the mantissa.  */
8154 +                               double tail = mantissa;
8155 +                               size_t q;
8156 +
8157 +                               for (q = precision; ; q--)
8158 +                                 {
8159 +                                   int digit = (int) tail;
8160 +                                   tail -= digit;
8161 +                                   if (q == 0)
8162 +                                     {
8163 +                                       if (digit & 1 ? tail >= 0.5 : tail > 0.5)
8164 +                                         tail = 1 - tail;
8165 +                                       else
8166 +                                         tail = - tail;
8167 +                                       break;
8168 +                                     }
8169 +                                   tail *= 16.0;
8170 +                                 }
8171 +                               if (tail != 0.0)
8172 +                                 for (q = precision; q > 0; q--)
8173 +                                   tail *= 0.0625;
8174 +                               mantissa += tail;
8175 +                             }
8176 +
8177 +                           *p++ = '0';
8178 +                           *p++ = dp->conversion - 'A' + 'X';
8179 +                           pad_ptr = p;
8180 +                           {
8181 +                             int digit;
8182 +
8183 +                             digit = (int) mantissa;
8184 +                             mantissa -= digit;
8185 +                             *p++ = '0' + digit;
8186 +                             if ((flags & FLAG_ALT)
8187 +                                 || mantissa > 0.0 || precision > 0)
8188 +                               {
8189 +                                 *p++ = decimal_point_char ();
8190 +                                 /* This loop terminates because we assume
8191 +                                    that FLT_RADIX is a power of 2.  */
8192 +                                 while (mantissa > 0.0)
8193 +                                   {
8194 +                                     mantissa *= 16.0;
8195 +                                     digit = (int) mantissa;
8196 +                                     mantissa -= digit;
8197 +                                     *p++ = digit
8198 +                                            + (digit < 10
8199 +                                               ? '0'
8200 +                                               : dp->conversion - 10);
8201 +                                     if (precision > 0)
8202 +                                       precision--;
8203 +                                   }
8204 +                                 while (precision > 0)
8205 +                                   {
8206 +                                     *p++ = '0';
8207 +                                     precision--;
8208 +                                   }
8209 +                               }
8210 +                             }
8211 +                             *p++ = dp->conversion - 'A' + 'P';
8212 +#  if WIDE_CHAR_VERSION
8213 +                             {
8214 +                               static const wchar_t decimal_format[] =
8215 +                                 { '%', '+', 'd', '\0' };
8216 +                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
8217 +                             }
8218 +                             while (*p != '\0')
8219 +                               p++;
8220 +#  else
8221 +                             if (sizeof (DCHAR_T) == 1)
8222 +                               {
8223 +                                 sprintf ((char *) p, "%+d", exponent);
8224 +                                 while (*p != '\0')
8225 +                                   p++;
8226 +                               }
8227 +                             else
8228 +                               {
8229 +                                 char expbuf[6 + 1];
8230 +                                 const char *ep;
8231 +                                 sprintf (expbuf, "%+d", exponent);
8232 +                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
8233 +                                   p++;
8234 +                               }
8235 +#  endif
8236 +                         }
8237 +                     }
8238 +# else
8239 +                   abort ();
8240 +# endif
8241 +                 }
8242 +               /* The generated string now extends from tmp to p, with the
8243 +                  zero padding insertion point being at pad_ptr.  */
8244 +               if (has_width && p - tmp < width)
8245 +                 {
8246 +                   size_t pad = width - (p - tmp);
8247 +                   DCHAR_T *end = p + pad;
8248 +
8249 +                   if (flags & FLAG_LEFT)
8250 +                     {
8251 +                       /* Pad with spaces on the right.  */
8252 +                       for (; pad > 0; pad--)
8253 +                         *p++ = ' ';
8254 +                     }
8255 +                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
8256 +                     {
8257 +                       /* Pad with zeroes.  */
8258 +                       DCHAR_T *q = end;
8259 +
8260 +                       while (p > pad_ptr)
8261 +                         *--q = *--p;
8262 +                       for (; pad > 0; pad--)
8263 +                         *p++ = '0';
8264 +                     }
8265 +                   else
8266 +                     {
8267 +                       /* Pad with spaces on the left.  */
8268 +                       DCHAR_T *q = end;
8269 +
8270 +                       while (p > tmp)
8271 +                         *--q = *--p;
8272 +                       for (; pad > 0; pad--)
8273 +                         *p++ = ' ';
8274 +                     }
8275 +
8276 +                   p = end;
8277 +                 }
8278 +
8279 +               {
8280 +                 size_t count = p - tmp;
8281 +
8282 +                 if (count >= tmp_length)
8283 +                   /* tmp_length was incorrectly calculated - fix the
8284 +                      code above!  */
8285 +                   abort ();
8286 +
8287 +                 /* Make room for the result.  */
8288 +                 if (count >= allocated - length)
8289 +                   {
8290 +                     size_t n = xsum (length, count);
8291 +
8292 +                     ENSURE_ALLOCATION (n);
8293 +                   }
8294 +
8295 +                 /* Append the result.  */
8296 +                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
8297 +                 if (tmp != tmpbuf)
8298 +                   free (tmp);
8299 +                 length += count;
8300 +               }
8301 +             }
8302 +#endif
8303 +#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
8304 +           else if ((dp->conversion == 'f' || dp->conversion == 'F'
8305 +                     || dp->conversion == 'e' || dp->conversion == 'E'
8306 +                     || dp->conversion == 'g' || dp->conversion == 'G'
8307 +                     || dp->conversion == 'a' || dp->conversion == 'A')
8308 +                    && (0
8309 +# if NEED_PRINTF_DOUBLE
8310 +                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
8311 +# elif NEED_PRINTF_INFINITE_DOUBLE
8312 +                        || (a.arg[dp->arg_index].type == TYPE_DOUBLE
8313 +                            /* The systems (mingw) which produce wrong output
8314 +                               for Inf, -Inf, and NaN also do so for -0.0.
8315 +                               Therefore we treat this case here as well.  */
8316 +                            && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double))
8317 +# endif
8318 +# if NEED_PRINTF_LONG_DOUBLE
8319 +                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
8320 +# elif NEED_PRINTF_INFINITE_LONG_DOUBLE
8321 +                        || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
8322 +                            /* Some systems produce wrong output for Inf,
8323 +                               -Inf, and NaN.  Some systems in this category
8324 +                               (IRIX 5.3) also do so for -0.0.  Therefore we
8325 +                               treat this case here as well.  */
8326 +                            && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble))
8327 +# endif
8328 +                       ))
8329 +             {
8330 +# if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE)
8331 +               arg_type type = a.arg[dp->arg_index].type;
8332 +# endif
8333 +               int flags = dp->flags;
8334 +               int has_width;
8335 +               size_t width;
8336 +               int has_precision;
8337 +               size_t precision;
8338 +               size_t tmp_length;
8339 +               DCHAR_T tmpbuf[700];
8340 +               DCHAR_T *tmp;
8341 +               DCHAR_T *pad_ptr;
8342 +               DCHAR_T *p;
8343 +
8344 +               has_width = 0;
8345 +               width = 0;
8346 +               if (dp->width_start != dp->width_end)
8347 +                 {
8348 +                   if (dp->width_arg_index != ARG_NONE)
8349 +                     {
8350 +                       int arg;
8351 +
8352 +                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
8353 +                         abort ();
8354 +                       arg = a.arg[dp->width_arg_index].a.a_int;
8355 +                       if (arg < 0)
8356 +                         {
8357 +                           /* "A negative field width is taken as a '-' flag
8358 +                               followed by a positive field width."  */
8359 +                           flags |= FLAG_LEFT;
8360 +                           width = (unsigned int) (-arg);
8361 +                         }
8362 +                       else
8363 +                         width = arg;
8364 +                     }
8365 +                   else
8366 +                     {
8367 +                       const FCHAR_T *digitp = dp->width_start;
8368 +
8369 +                       do
8370 +                         width = xsum (xtimes (width, 10), *digitp++ - '0');
8371 +                       while (digitp != dp->width_end);
8372 +                     }
8373 +                   has_width = 1;
8374 +                 }
8375 +
8376 +               has_precision = 0;
8377 +               precision = 0;
8378 +               if (dp->precision_start != dp->precision_end)
8379 +                 {
8380 +                   if (dp->precision_arg_index != ARG_NONE)
8381 +                     {
8382 +                       int arg;
8383 +
8384 +                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
8385 +                         abort ();
8386 +                       arg = a.arg[dp->precision_arg_index].a.a_int;
8387 +                       /* "A negative precision is taken as if the precision
8388 +                           were omitted."  */
8389 +                       if (arg >= 0)
8390 +                         {
8391 +                           precision = arg;
8392 +                           has_precision = 1;
8393 +                         }
8394 +                     }
8395 +                   else
8396 +                     {
8397 +                       const FCHAR_T *digitp = dp->precision_start + 1;
8398 +
8399 +                       precision = 0;
8400 +                       while (digitp != dp->precision_end)
8401 +                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
8402 +                       has_precision = 1;
8403 +                     }
8404 +                 }
8405 +
8406 +               /* POSIX specifies the default precision to be 6 for %f, %F,
8407 +                  %e, %E, but not for %g, %G.  Implementations appear to use
8408 +                  the same default precision also for %g, %G.  But for %a, %A,
8409 +                  the default precision is 0.  */
8410 +               if (!has_precision)
8411 +                 if (!(dp->conversion == 'a' || dp->conversion == 'A'))
8412 +                   precision = 6;
8413 +
8414 +               /* Allocate a temporary buffer of sufficient size.  */
8415 +# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
8416 +               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1);
8417 +# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
8418 +               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
8419 +# elif NEED_PRINTF_LONG_DOUBLE
8420 +               tmp_length = LDBL_DIG + 1;
8421 +# elif NEED_PRINTF_DOUBLE
8422 +               tmp_length = DBL_DIG + 1;
8423 +# else
8424 +               tmp_length = 0;
8425 +# endif
8426 +               if (tmp_length < precision)
8427 +                 tmp_length = precision;
8428 +# if NEED_PRINTF_LONG_DOUBLE
8429 +#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
8430 +               if (type == TYPE_LONGDOUBLE)
8431 +#  endif
8432 +                 if (dp->conversion == 'f' || dp->conversion == 'F')
8433 +                   {
8434 +                     long double arg = a.arg[dp->arg_index].a.a_longdouble;
8435 +                     if (!(isnanl (arg) || arg + arg == arg))
8436 +                       {
8437 +                         /* arg is finite and nonzero.  */
8438 +                         int exponent = floorlog10l (arg < 0 ? -arg : arg);
8439 +                         if (exponent >= 0 && tmp_length < exponent + precision)
8440 +                           tmp_length = exponent + precision;
8441 +                       }
8442 +                   }
8443 +# endif
8444 +# if NEED_PRINTF_DOUBLE
8445 +#  if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
8446 +               if (type == TYPE_DOUBLE)
8447 +#  endif
8448 +                 if (dp->conversion == 'f' || dp->conversion == 'F')
8449 +                   {
8450 +                     double arg = a.arg[dp->arg_index].a.a_double;
8451 +                     if (!(isnand (arg) || arg + arg == arg))
8452 +                       {
8453 +                         /* arg is finite and nonzero.  */
8454 +                         int exponent = floorlog10 (arg < 0 ? -arg : arg);
8455 +                         if (exponent >= 0 && tmp_length < exponent + precision)
8456 +                           tmp_length = exponent + precision;
8457 +                       }
8458 +                   }
8459 +# endif
8460 +               /* Account for sign, decimal point etc. */
8461 +               tmp_length = xsum (tmp_length, 12);
8462 +
8463 +               if (tmp_length < width)
8464 +                 tmp_length = width;
8465 +
8466 +               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
8467 +
8468 +               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
8469 +                 tmp = tmpbuf;
8470 +               else
8471 +                 {
8472 +                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
8473 +
8474 +                   if (size_overflow_p (tmp_memsize))
8475 +                     /* Overflow, would lead to out of memory.  */
8476 +                     goto out_of_memory;
8477 +                   tmp = (DCHAR_T *) malloc (tmp_memsize);
8478 +                   if (tmp == NULL)
8479 +                     /* Out of memory.  */
8480 +                     goto out_of_memory;
8481 +                 }
8482 +
8483 +               pad_ptr = NULL;
8484 +               p = tmp;
8485 +
8486 +# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
8487 +#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
8488 +               if (type == TYPE_LONGDOUBLE)
8489 +#  endif
8490 +                 {
8491 +                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
8492 +
8493 +                   if (isnanl (arg))
8494 +                     {
8495 +                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
8496 +                         {
8497 +                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
8498 +                         }
8499 +                       else
8500 +                         {
8501 +                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
8502 +                         }
8503 +                     }
8504 +                   else
8505 +                     {
8506 +                       int sign = 0;
8507 +                       DECL_LONG_DOUBLE_ROUNDING
8508 +
8509 +                       BEGIN_LONG_DOUBLE_ROUNDING ();
8510 +
8511 +                       if (signbit (arg)) /* arg < 0.0L or negative zero */
8512 +                         {
8513 +                           sign = -1;
8514 +                           arg = -arg;
8515 +                         }
8516 +
8517 +                       if (sign < 0)
8518 +                         *p++ = '-';
8519 +                       else if (flags & FLAG_SHOWSIGN)
8520 +                         *p++ = '+';
8521 +                       else if (flags & FLAG_SPACE)
8522 +                         *p++ = ' ';
8523 +
8524 +                       if (arg > 0.0L && arg + arg == arg)
8525 +                         {
8526 +                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
8527 +                             {
8528 +                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
8529 +                             }
8530 +                           else
8531 +                             {
8532 +                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
8533 +                             }
8534 +                         }
8535 +                       else
8536 +                         {
8537 +#  if NEED_PRINTF_LONG_DOUBLE
8538 +                           pad_ptr = p;
8539 +
8540 +                           if (dp->conversion == 'f' || dp->conversion == 'F')
8541 +                             {
8542 +                               char *digits;
8543 +                               size_t ndigits;
8544 +
8545 +                               digits =
8546 +                                 scale10_round_decimal_long_double (arg, precision);
8547 +                               if (digits == NULL)
8548 +                                 {
8549 +                                   END_LONG_DOUBLE_ROUNDING ();
8550 +                                   goto out_of_memory;
8551 +                                 }
8552 +                               ndigits = strlen (digits);
8553 +
8554 +                               if (ndigits > precision)
8555 +                                 do
8556 +                                   {
8557 +                                     --ndigits;
8558 +                                     *p++ = digits[ndigits];
8559 +                                   }
8560 +                                 while (ndigits > precision);
8561 +                               else
8562 +                                 *p++ = '0';
8563 +                               /* Here ndigits <= precision.  */
8564 +                               if ((flags & FLAG_ALT) || precision > 0)
8565 +                                 {
8566 +                                   *p++ = decimal_point_char ();
8567 +                                   for (; precision > ndigits; precision--)
8568 +                                     *p++ = '0';
8569 +                                   while (ndigits > 0)
8570 +                                     {
8571 +                                       --ndigits;
8572 +                                       *p++ = digits[ndigits];
8573 +                                     }
8574 +                                 }
8575 +
8576 +                               free (digits);
8577 +                             }
8578 +                           else if (dp->conversion == 'e' || dp->conversion == 'E')
8579 +                             {
8580 +                               int exponent;
8581 +
8582 +                               if (arg == 0.0L)
8583 +                                 {
8584 +                                   exponent = 0;
8585 +                                   *p++ = '0';
8586 +                                   if ((flags & FLAG_ALT) || precision > 0)
8587 +                                     {
8588 +                                       *p++ = decimal_point_char ();
8589 +                                       for (; precision > 0; precision--)
8590 +                                         *p++ = '0';
8591 +                                     }
8592 +                                 }
8593 +                               else
8594 +                                 {
8595 +                                   /* arg > 0.0L.  */
8596 +                                   int adjusted;
8597 +                                   char *digits;
8598 +                                   size_t ndigits;
8599 +
8600 +                                   exponent = floorlog10l (arg);
8601 +                                   adjusted = 0;
8602 +                                   for (;;)
8603 +                                     {
8604 +                                       digits =
8605 +                                         scale10_round_decimal_long_double (arg,
8606 +                                                                            (int)precision - exponent);
8607 +                                       if (digits == NULL)
8608 +                                         {
8609 +                                           END_LONG_DOUBLE_ROUNDING ();
8610 +                                           goto out_of_memory;
8611 +                                         }
8612 +                                       ndigits = strlen (digits);
8613 +
8614 +                                       if (ndigits == precision + 1)
8615 +                                         break;
8616 +                                       if (ndigits < precision
8617 +                                           || ndigits > precision + 2)
8618 +                                         /* The exponent was not guessed
8619 +                                            precisely enough.  */
8620 +                                         abort ();
8621 +                                       if (adjusted)
8622 +                                         /* None of two values of exponent is
8623 +                                            the right one.  Prevent an endless
8624 +                                            loop.  */
8625 +                                         abort ();
8626 +                                       free (digits);
8627 +                                       if (ndigits == precision)
8628 +                                         exponent -= 1;
8629 +                                       else
8630 +                                         exponent += 1;
8631 +                                       adjusted = 1;
8632 +                                     }
8633 +                                   /* Here ndigits = precision+1.  */
8634 +                                   if (is_borderline (digits, precision))
8635 +                                     {
8636 +                                       /* Maybe the exponent guess was too high
8637 +                                          and a smaller exponent can be reached
8638 +                                          by turning a 10...0 into 9...9x.  */
8639 +                                       char *digits2 =
8640 +                                         scale10_round_decimal_long_double (arg,
8641 +                                                                            (int)precision - exponent + 1);
8642 +                                       if (digits2 == NULL)
8643 +                                         {
8644 +                                           free (digits);
8645 +                                           END_LONG_DOUBLE_ROUNDING ();
8646 +                                           goto out_of_memory;
8647 +                                         }
8648 +                                       if (strlen (digits2) == precision + 1)
8649 +                                         {
8650 +                                           free (digits);
8651 +                                           digits = digits2;
8652 +                                           exponent -= 1;
8653 +                                         }
8654 +                                       else
8655 +                                         free (digits2);
8656 +                                     }
8657 +                                   /* Here ndigits = precision+1.  */
8658 +
8659 +                                   *p++ = digits[--ndigits];
8660 +                                   if ((flags & FLAG_ALT) || precision > 0)
8661 +                                     {
8662 +                                       *p++ = decimal_point_char ();
8663 +                                       while (ndigits > 0)
8664 +                                         {
8665 +                                           --ndigits;
8666 +                                           *p++ = digits[ndigits];
8667 +                                         }
8668 +                                     }
8669 +
8670 +                                   free (digits);
8671 +                                 }
8672 +
8673 +                               *p++ = dp->conversion; /* 'e' or 'E' */
8674 +#   if WIDE_CHAR_VERSION
8675 +                               {
8676 +                                 static const wchar_t decimal_format[] =
8677 +                                   { '%', '+', '.', '2', 'd', '\0' };
8678 +                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
8679 +                               }
8680 +                               while (*p != '\0')
8681 +                                 p++;
8682 +#   else
8683 +                               if (sizeof (DCHAR_T) == 1)
8684 +                                 {
8685 +                                   sprintf ((char *) p, "%+.2d", exponent);
8686 +                                   while (*p != '\0')
8687 +                                     p++;
8688 +                                 }
8689 +                               else
8690 +                                 {
8691 +                                   char expbuf[6 + 1];
8692 +                                   const char *ep;
8693 +                                   sprintf (expbuf, "%+.2d", exponent);
8694 +                                   for (ep = expbuf; (*p = *ep) != '\0'; ep++)
8695 +                                     p++;
8696 +                                 }
8697 +#   endif
8698 +                             }
8699 +                           else if (dp->conversion == 'g' || dp->conversion == 'G')
8700 +                             {
8701 +                               if (precision == 0)
8702 +                                 precision = 1;
8703 +                               /* precision >= 1.  */
8704 +
8705 +                               if (arg == 0.0L)
8706 +                                 /* The exponent is 0, >= -4, < precision.
8707 +                                    Use fixed-point notation.  */
8708 +                                 {
8709 +                                   size_t ndigits = precision;
8710 +                                   /* Number of trailing zeroes that have to be
8711 +                                      dropped.  */
8712 +                                   size_t nzeroes =
8713 +                                     (flags & FLAG_ALT ? 0 : precision - 1);
8714 +
8715 +                                   --ndigits;
8716 +                                   *p++ = '0';
8717 +                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
8718 +                                     {
8719 +                                       *p++ = decimal_point_char ();
8720 +                                       while (ndigits > nzeroes)
8721 +                                         {
8722 +                                           --ndigits;
8723 +                                           *p++ = '0';
8724 +                                         }
8725 +                                     }
8726 +                                 }
8727 +                               else
8728 +                                 {
8729 +                                   /* arg > 0.0L.  */
8730 +                                   int exponent;
8731 +                                   int adjusted;
8732 +                                   char *digits;
8733 +                                   size_t ndigits;
8734 +                                   size_t nzeroes;
8735 +
8736 +                                   exponent = floorlog10l (arg);
8737 +                                   adjusted = 0;
8738 +                                   for (;;)
8739 +                                     {
8740 +                                       digits =
8741 +                                         scale10_round_decimal_long_double (arg,
8742 +                                                                            (int)(precision - 1) - exponent);
8743 +                                       if (digits == NULL)
8744 +                                         {
8745 +                                           END_LONG_DOUBLE_ROUNDING ();
8746 +                                           goto out_of_memory;
8747 +                                         }
8748 +                                       ndigits = strlen (digits);
8749 +
8750 +                                       if (ndigits == precision)
8751 +                                         break;
8752 +                                       if (ndigits < precision - 1
8753 +                                           || ndigits > precision + 1)
8754 +                                         /* The exponent was not guessed
8755 +                                            precisely enough.  */
8756 +                                         abort ();
8757 +                                       if (adjusted)
8758 +                                         /* None of two values of exponent is
8759 +                                            the right one.  Prevent an endless
8760 +                                            loop.  */
8761 +                                         abort ();
8762 +                                       free (digits);
8763 +                                       if (ndigits < precision)
8764 +                                         exponent -= 1;
8765 +                                       else
8766 +                                         exponent += 1;
8767 +                                       adjusted = 1;
8768 +                                     }
8769 +                                   /* Here ndigits = precision.  */
8770 +                                   if (is_borderline (digits, precision - 1))
8771 +                                     {
8772 +                                       /* Maybe the exponent guess was too high
8773 +                                          and a smaller exponent can be reached
8774 +                                          by turning a 10...0 into 9...9x.  */
8775 +                                       char *digits2 =
8776 +                                         scale10_round_decimal_long_double (arg,
8777 +                                                                            (int)(precision - 1) - exponent + 1);
8778 +                                       if (digits2 == NULL)
8779 +                                         {
8780 +                                           free (digits);
8781 +                                           END_LONG_DOUBLE_ROUNDING ();
8782 +                                           goto out_of_memory;
8783 +                                         }
8784 +                                       if (strlen (digits2) == precision)
8785 +                                         {
8786 +                                           free (digits);
8787 +                                           digits = digits2;
8788 +                                           exponent -= 1;
8789 +                                         }
8790 +                                       else
8791 +                                         free (digits2);
8792 +                                     }
8793 +                                   /* Here ndigits = precision.  */
8794 +
8795 +                                   /* Determine the number of trailing zeroes
8796 +                                      that have to be dropped.  */
8797 +                                   nzeroes = 0;
8798 +                                   if ((flags & FLAG_ALT) == 0)
8799 +                                     while (nzeroes < ndigits
8800 +                                            && digits[nzeroes] == '0')
8801 +                                       nzeroes++;
8802 +
8803 +                                   /* The exponent is now determined.  */
8804 +                                   if (exponent >= -4
8805 +                                       && exponent < (long)precision)
8806 +                                     {
8807 +                                       /* Fixed-point notation:
8808 +                                          max(exponent,0)+1 digits, then the
8809 +                                          decimal point, then the remaining
8810 +                                          digits without trailing zeroes.  */
8811 +                                       if (exponent >= 0)
8812 +                                         {
8813 +                                           size_t count = exponent + 1;
8814 +                                           /* Note: count <= precision = ndigits.  */
8815 +                                           for (; count > 0; count--)
8816 +                                             *p++ = digits[--ndigits];
8817 +                                           if ((flags & FLAG_ALT) || ndigits > nzeroes)
8818 +                                             {
8819 +                                               *p++ = decimal_point_char ();
8820 +                                               while (ndigits > nzeroes)
8821 +                                                 {
8822 +                                                   --ndigits;
8823 +                                                   *p++ = digits[ndigits];
8824 +                                                 }
8825 +                                             }
8826 +                                         }
8827 +                                       else
8828 +                                         {
8829 +                                           size_t count = -exponent - 1;
8830 +                                           *p++ = '0';
8831 +                                           *p++ = decimal_point_char ();
8832 +                                           for (; count > 0; count--)
8833 +                                             *p++ = '0';
8834 +                                           while (ndigits > nzeroes)
8835 +                                             {
8836 +                                               --ndigits;
8837 +                                               *p++ = digits[ndigits];
8838 +                                             }
8839 +                                         }
8840 +                                     }
8841 +                                   else
8842 +                                     {
8843 +                                       /* Exponential notation.  */
8844 +                                       *p++ = digits[--ndigits];
8845 +                                       if ((flags & FLAG_ALT) || ndigits > nzeroes)
8846 +                                         {
8847 +                                           *p++ = decimal_point_char ();
8848 +                                           while (ndigits > nzeroes)
8849 +                                             {
8850 +                                               --ndigits;
8851 +                                               *p++ = digits[ndigits];
8852 +                                             }
8853 +                                         }
8854 +                                       *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
8855 +#   if WIDE_CHAR_VERSION
8856 +                                       {
8857 +                                         static const wchar_t decimal_format[] =
8858 +                                           { '%', '+', '.', '2', 'd', '\0' };
8859 +                                         SNPRINTF (p, 6 + 1, decimal_format, exponent);
8860 +                                       }
8861 +                                       while (*p != '\0')
8862 +                                         p++;
8863 +#   else
8864 +                                       if (sizeof (DCHAR_T) == 1)
8865 +                                         {
8866 +                                           sprintf ((char *) p, "%+.2d", exponent);
8867 +                                           while (*p != '\0')
8868 +                                             p++;
8869 +                                         }
8870 +                                       else
8871 +                                         {
8872 +                                           char expbuf[6 + 1];
8873 +                                           const char *ep;
8874 +                                           sprintf (expbuf, "%+.2d", exponent);
8875 +                                           for (ep = expbuf; (*p = *ep) != '\0'; ep++)
8876 +                                             p++;
8877 +                                         }
8878 +#   endif
8879 +                                     }
8880 +
8881 +                                   free (digits);
8882 +                                 }
8883 +                             }
8884 +                           else
8885 +                             abort ();
8886 +#  else
8887 +                           /* arg is finite.  */
8888 +                           if (!(arg == 0.0L))
8889 +                             abort ();
8890 +
8891 +                           pad_ptr = p;
8892 +
8893 +                           if (dp->conversion == 'f' || dp->conversion == 'F')
8894 +                             {
8895 +                               *p++ = '0';
8896 +                               if ((flags & FLAG_ALT) || precision > 0)
8897 +                                 {
8898 +                                   *p++ = decimal_point_char ();
8899 +                                   for (; precision > 0; precision--)
8900 +                                     *p++ = '0';
8901 +                                 }
8902 +                             }
8903 +                           else if (dp->conversion == 'e' || dp->conversion == 'E')
8904 +                             {
8905 +                               *p++ = '0';
8906 +                               if ((flags & FLAG_ALT) || precision > 0)
8907 +                                 {
8908 +                                   *p++ = decimal_point_char ();
8909 +                                   for (; precision > 0; precision--)
8910 +                                     *p++ = '0';
8911 +                                 }
8912 +                               *p++ = dp->conversion; /* 'e' or 'E' */
8913 +                               *p++ = '+';
8914 +                               *p++ = '0';
8915 +                               *p++ = '0';
8916 +                             }
8917 +                           else if (dp->conversion == 'g' || dp->conversion == 'G')
8918 +                             {
8919 +                               *p++ = '0';
8920 +                               if (flags & FLAG_ALT)
8921 +                                 {
8922 +                                   size_t ndigits =
8923 +                                     (precision > 0 ? precision - 1 : 0);
8924 +                                   *p++ = decimal_point_char ();
8925 +                                   for (; ndigits > 0; --ndigits)
8926 +                                     *p++ = '0';
8927 +                                 }
8928 +                             }
8929 +                           else if (dp->conversion == 'a' || dp->conversion == 'A')
8930 +                             {
8931 +                               *p++ = '0';
8932 +                               *p++ = dp->conversion - 'A' + 'X';
8933 +                               pad_ptr = p;
8934 +                               *p++ = '0';
8935 +                               if ((flags & FLAG_ALT) || precision > 0)
8936 +                                 {
8937 +                                   *p++ = decimal_point_char ();
8938 +                                   for (; precision > 0; precision--)
8939 +                                     *p++ = '0';
8940 +                                 }
8941 +                               *p++ = dp->conversion - 'A' + 'P';
8942 +                               *p++ = '+';
8943 +                               *p++ = '0';
8944 +                             }
8945 +                           else
8946 +                             abort ();
8947 +#  endif
8948 +                         }
8949 +
8950 +                       END_LONG_DOUBLE_ROUNDING ();
8951 +                     }
8952 +                 }
8953 +#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
8954 +               else
8955 +#  endif
8956 +# endif
8957 +# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
8958 +                 {
8959 +                   double arg = a.arg[dp->arg_index].a.a_double;
8960 +
8961 +                   if (isnand (arg))
8962 +                     {
8963 +                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
8964 +                         {
8965 +                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
8966 +                         }
8967 +                       else
8968 +                         {
8969 +                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
8970 +                         }
8971 +                     }
8972 +                   else
8973 +                     {
8974 +                       int sign = 0;
8975 +
8976 +                       if (signbit (arg)) /* arg < 0.0 or negative zero */
8977 +                         {
8978 +                           sign = -1;
8979 +                           arg = -arg;
8980 +                         }
8981 +
8982 +                       if (sign < 0)
8983 +                         *p++ = '-';
8984 +                       else if (flags & FLAG_SHOWSIGN)
8985 +                         *p++ = '+';
8986 +                       else if (flags & FLAG_SPACE)
8987 +                         *p++ = ' ';
8988 +
8989 +                       if (arg > 0.0 && arg + arg == arg)
8990 +                         {
8991 +                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
8992 +                             {
8993 +                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
8994 +                             }
8995 +                           else
8996 +                             {
8997 +                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
8998 +                             }
8999 +                         }
9000 +                       else
9001 +                         {
9002 +#  if NEED_PRINTF_DOUBLE
9003 +                           pad_ptr = p;
9004 +
9005 +                           if (dp->conversion == 'f' || dp->conversion == 'F')
9006 +                             {
9007 +                               char *digits;
9008 +                               size_t ndigits;
9009 +
9010 +                               digits =
9011 +                                 scale10_round_decimal_double (arg, precision);
9012 +                               if (digits == NULL)
9013 +                                 goto out_of_memory;
9014 +                               ndigits = strlen (digits);
9015 +
9016 +                               if (ndigits > precision)
9017 +                                 do
9018 +                                   {
9019 +                                     --ndigits;
9020 +                                     *p++ = digits[ndigits];
9021 +                                   }
9022 +                                 while (ndigits > precision);
9023 +                               else
9024 +                                 *p++ = '0';
9025 +                               /* Here ndigits <= precision.  */
9026 +                               if ((flags & FLAG_ALT) || precision > 0)
9027 +                                 {
9028 +                                   *p++ = decimal_point_char ();
9029 +                                   for (; precision > ndigits; precision--)
9030 +                                     *p++ = '0';
9031 +                                   while (ndigits > 0)
9032 +                                     {
9033 +                                       --ndigits;
9034 +                                       *p++ = digits[ndigits];
9035 +                                     }
9036 +                                 }
9037 +
9038 +                               free (digits);
9039 +                             }
9040 +                           else if (dp->conversion == 'e' || dp->conversion == 'E')
9041 +                             {
9042 +                               int exponent;
9043 +
9044 +                               if (arg == 0.0)
9045 +                                 {
9046 +                                   exponent = 0;
9047 +                                   *p++ = '0';
9048 +                                   if ((flags & FLAG_ALT) || precision > 0)
9049 +                                     {
9050 +                                       *p++ = decimal_point_char ();
9051 +                                       for (; precision > 0; precision--)
9052 +                                         *p++ = '0';
9053 +                                     }
9054 +                                 }
9055 +                               else
9056 +                                 {
9057 +                                   /* arg > 0.0.  */
9058 +                                   int adjusted;
9059 +                                   char *digits;
9060 +                                   size_t ndigits;
9061 +
9062 +                                   exponent = floorlog10 (arg);
9063 +                                   adjusted = 0;
9064 +                                   for (;;)
9065 +                                     {
9066 +                                       digits =
9067 +                                         scale10_round_decimal_double (arg,
9068 +                                                                       (int)precision - exponent);
9069 +                                       if (digits == NULL)
9070 +                                         goto out_of_memory;
9071 +                                       ndigits = strlen (digits);
9072 +
9073 +                                       if (ndigits == precision + 1)
9074 +                                         break;
9075 +                                       if (ndigits < precision
9076 +                                           || ndigits > precision + 2)
9077 +                                         /* The exponent was not guessed
9078 +                                            precisely enough.  */
9079 +                                         abort ();
9080 +                                       if (adjusted)
9081 +                                         /* None of two values of exponent is
9082 +                                            the right one.  Prevent an endless
9083 +                                            loop.  */
9084 +                                         abort ();
9085 +                                       free (digits);
9086 +                                       if (ndigits == precision)
9087 +                                         exponent -= 1;
9088 +                                       else
9089 +                                         exponent += 1;
9090 +                                       adjusted = 1;
9091 +                                     }
9092 +                                   /* Here ndigits = precision+1.  */
9093 +                                   if (is_borderline (digits, precision))
9094 +                                     {
9095 +                                       /* Maybe the exponent guess was too high
9096 +                                          and a smaller exponent can be reached
9097 +                                          by turning a 10...0 into 9...9x.  */
9098 +                                       char *digits2 =
9099 +                                         scale10_round_decimal_double (arg,
9100 +                                                                       (int)precision - exponent + 1);
9101 +                                       if (digits2 == NULL)
9102 +                                         {
9103 +                                           free (digits);
9104 +                                           goto out_of_memory;
9105 +                                         }
9106 +                                       if (strlen (digits2) == precision + 1)
9107 +                                         {
9108 +                                           free (digits);
9109 +                                           digits = digits2;
9110 +                                           exponent -= 1;
9111 +                                         }
9112 +                                       else
9113 +                                         free (digits2);
9114 +                                     }
9115 +                                   /* Here ndigits = precision+1.  */
9116 +
9117 +                                   *p++ = digits[--ndigits];
9118 +                                   if ((flags & FLAG_ALT) || precision > 0)
9119 +                                     {
9120 +                                       *p++ = decimal_point_char ();
9121 +                                       while (ndigits > 0)
9122 +                                         {
9123 +                                           --ndigits;
9124 +                                           *p++ = digits[ndigits];
9125 +                                         }
9126 +                                     }
9127 +
9128 +                                   free (digits);
9129 +                                 }
9130 +
9131 +                               *p++ = dp->conversion; /* 'e' or 'E' */
9132 +#   if WIDE_CHAR_VERSION
9133 +                               {
9134 +                                 static const wchar_t decimal_format[] =
9135 +                                   /* Produce the same number of exponent digits
9136 +                                      as the native printf implementation.  */
9137 +#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9138 +                                   { '%', '+', '.', '3', 'd', '\0' };
9139 +#    else
9140 +                                   { '%', '+', '.', '2', 'd', '\0' };
9141 +#    endif
9142 +                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
9143 +                               }
9144 +                               while (*p != '\0')
9145 +                                 p++;
9146 +#   else
9147 +                               {
9148 +                                 static const char decimal_format[] =
9149 +                                   /* Produce the same number of exponent digits
9150 +                                      as the native printf implementation.  */
9151 +#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9152 +                                   "%+.3d";
9153 +#    else
9154 +                                   "%+.2d";
9155 +#    endif
9156 +                                 if (sizeof (DCHAR_T) == 1)
9157 +                                   {
9158 +                                     sprintf ((char *) p, decimal_format, exponent);
9159 +                                     while (*p != '\0')
9160 +                                       p++;
9161 +                                   }
9162 +                                 else
9163 +                                   {
9164 +                                     char expbuf[6 + 1];
9165 +                                     const char *ep;
9166 +                                     sprintf (expbuf, decimal_format, exponent);
9167 +                                     for (ep = expbuf; (*p = *ep) != '\0'; ep++)
9168 +                                       p++;
9169 +                                   }
9170 +                               }
9171 +#   endif
9172 +                             }
9173 +                           else if (dp->conversion == 'g' || dp->conversion == 'G')
9174 +                             {
9175 +                               if (precision == 0)
9176 +                                 precision = 1;
9177 +                               /* precision >= 1.  */
9178 +
9179 +                               if (arg == 0.0)
9180 +                                 /* The exponent is 0, >= -4, < precision.
9181 +                                    Use fixed-point notation.  */
9182 +                                 {
9183 +                                   size_t ndigits = precision;
9184 +                                   /* Number of trailing zeroes that have to be
9185 +                                      dropped.  */
9186 +                                   size_t nzeroes =
9187 +                                     (flags & FLAG_ALT ? 0 : precision - 1);
9188 +
9189 +                                   --ndigits;
9190 +                                   *p++ = '0';
9191 +                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
9192 +                                     {
9193 +                                       *p++ = decimal_point_char ();
9194 +                                       while (ndigits > nzeroes)
9195 +                                         {
9196 +                                           --ndigits;
9197 +                                           *p++ = '0';
9198 +                                         }
9199 +                                     }
9200 +                                 }
9201 +                               else
9202 +                                 {
9203 +                                   /* arg > 0.0.  */
9204 +                                   int exponent;
9205 +                                   int adjusted;
9206 +                                   char *digits;
9207 +                                   size_t ndigits;
9208 +                                   size_t nzeroes;
9209 +
9210 +                                   exponent = floorlog10 (arg);
9211 +                                   adjusted = 0;
9212 +                                   for (;;)
9213 +                                     {
9214 +                                       digits =
9215 +                                         scale10_round_decimal_double (arg,
9216 +                                                                       (int)(precision - 1) - exponent);
9217 +                                       if (digits == NULL)
9218 +                                         goto out_of_memory;
9219 +                                       ndigits = strlen (digits);
9220 +
9221 +                                       if (ndigits == precision)
9222 +                                         break;
9223 +                                       if (ndigits < precision - 1
9224 +                                           || ndigits > precision + 1)
9225 +                                         /* The exponent was not guessed
9226 +                                            precisely enough.  */
9227 +                                         abort ();
9228 +                                       if (adjusted)
9229 +                                         /* None of two values of exponent is
9230 +                                            the right one.  Prevent an endless
9231 +                                            loop.  */
9232 +                                         abort ();
9233 +                                       free (digits);
9234 +                                       if (ndigits < precision)
9235 +                                         exponent -= 1;
9236 +                                       else
9237 +                                         exponent += 1;
9238 +                                       adjusted = 1;
9239 +                                     }
9240 +                                   /* Here ndigits = precision.  */
9241 +                                   if (is_borderline (digits, precision - 1))
9242 +                                     {
9243 +                                       /* Maybe the exponent guess was too high
9244 +                                          and a smaller exponent can be reached
9245 +                                          by turning a 10...0 into 9...9x.  */
9246 +                                       char *digits2 =
9247 +                                         scale10_round_decimal_double (arg,
9248 +                                                                       (int)(precision - 1) - exponent + 1);
9249 +                                       if (digits2 == NULL)
9250 +                                         {
9251 +                                           free (digits);
9252 +                                           goto out_of_memory;
9253 +                                         }
9254 +                                       if (strlen (digits2) == precision)
9255 +                                         {
9256 +                                           free (digits);
9257 +                                           digits = digits2;
9258 +                                           exponent -= 1;
9259 +                                         }
9260 +                                       else
9261 +                                         free (digits2);
9262 +                                     }
9263 +                                   /* Here ndigits = precision.  */
9264 +
9265 +                                   /* Determine the number of trailing zeroes
9266 +                                      that have to be dropped.  */
9267 +                                   nzeroes = 0;
9268 +                                   if ((flags & FLAG_ALT) == 0)
9269 +                                     while (nzeroes < ndigits
9270 +                                            && digits[nzeroes] == '0')
9271 +                                       nzeroes++;
9272 +
9273 +                                   /* The exponent is now determined.  */
9274 +                                   if (exponent >= -4
9275 +                                       && exponent < (long)precision)
9276 +                                     {
9277 +                                       /* Fixed-point notation:
9278 +                                          max(exponent,0)+1 digits, then the
9279 +                                          decimal point, then the remaining
9280 +                                          digits without trailing zeroes.  */
9281 +                                       if (exponent >= 0)
9282 +                                         {
9283 +                                           size_t count = exponent + 1;
9284 +                                           /* Note: count <= precision = ndigits.  */
9285 +                                           for (; count > 0; count--)
9286 +                                             *p++ = digits[--ndigits];
9287 +                                           if ((flags & FLAG_ALT) || ndigits > nzeroes)
9288 +                                             {
9289 +                                               *p++ = decimal_point_char ();
9290 +                                               while (ndigits > nzeroes)
9291 +                                                 {
9292 +                                                   --ndigits;
9293 +                                                   *p++ = digits[ndigits];
9294 +                                                 }
9295 +                                             }
9296 +                                         }
9297 +                                       else
9298 +                                         {
9299 +                                           size_t count = -exponent - 1;
9300 +                                           *p++ = '0';
9301 +                                           *p++ = decimal_point_char ();
9302 +                                           for (; count > 0; count--)
9303 +                                             *p++ = '0';
9304 +                                           while (ndigits > nzeroes)
9305 +                                             {
9306 +                                               --ndigits;
9307 +                                               *p++ = digits[ndigits];
9308 +                                             }
9309 +                                         }
9310 +                                     }
9311 +                                   else
9312 +                                     {
9313 +                                       /* Exponential notation.  */
9314 +                                       *p++ = digits[--ndigits];
9315 +                                       if ((flags & FLAG_ALT) || ndigits > nzeroes)
9316 +                                         {
9317 +                                           *p++ = decimal_point_char ();
9318 +                                           while (ndigits > nzeroes)
9319 +                                             {
9320 +                                               --ndigits;
9321 +                                               *p++ = digits[ndigits];
9322 +                                             }
9323 +                                         }
9324 +                                       *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
9325 +#   if WIDE_CHAR_VERSION
9326 +                                       {
9327 +                                         static const wchar_t decimal_format[] =
9328 +                                           /* Produce the same number of exponent digits
9329 +                                              as the native printf implementation.  */
9330 +#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9331 +                                           { '%', '+', '.', '3', 'd', '\0' };
9332 +#    else
9333 +                                           { '%', '+', '.', '2', 'd', '\0' };
9334 +#    endif
9335 +                                         SNPRINTF (p, 6 + 1, decimal_format, exponent);
9336 +                                       }
9337 +                                       while (*p != '\0')
9338 +                                         p++;
9339 +#   else
9340 +                                       {
9341 +                                         static const char decimal_format[] =
9342 +                                           /* Produce the same number of exponent digits
9343 +                                              as the native printf implementation.  */
9344 +#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9345 +                                           "%+.3d";
9346 +#    else
9347 +                                           "%+.2d";
9348 +#    endif
9349 +                                         if (sizeof (DCHAR_T) == 1)
9350 +                                           {
9351 +                                             sprintf ((char *) p, decimal_format, exponent);
9352 +                                             while (*p != '\0')
9353 +                                               p++;
9354 +                                           }
9355 +                                         else
9356 +                                           {
9357 +                                             char expbuf[6 + 1];
9358 +                                             const char *ep;
9359 +                                             sprintf (expbuf, decimal_format, exponent);
9360 +                                             for (ep = expbuf; (*p = *ep) != '\0'; ep++)
9361 +                                               p++;
9362 +                                           }
9363 +                                       }
9364 +#   endif
9365 +                                     }
9366 +
9367 +                                   free (digits);
9368 +                                 }
9369 +                             }
9370 +                           else
9371 +                             abort ();
9372 +#  else
9373 +                           /* arg is finite.  */
9374 +                           if (!(arg == 0.0))
9375 +                             abort ();
9376 +
9377 +                           pad_ptr = p;
9378 +
9379 +                           if (dp->conversion == 'f' || dp->conversion == 'F')
9380 +                             {
9381 +                               *p++ = '0';
9382 +                               if ((flags & FLAG_ALT) || precision > 0)
9383 +                                 {
9384 +                                   *p++ = decimal_point_char ();
9385 +                                   for (; precision > 0; precision--)
9386 +                                     *p++ = '0';
9387 +                                 }
9388 +                             }
9389 +                           else if (dp->conversion == 'e' || dp->conversion == 'E')
9390 +                             {
9391 +                               *p++ = '0';
9392 +                               if ((flags & FLAG_ALT) || precision > 0)
9393 +                                 {
9394 +                                   *p++ = decimal_point_char ();
9395 +                                   for (; precision > 0; precision--)
9396 +                                     *p++ = '0';
9397 +                                 }
9398 +                               *p++ = dp->conversion; /* 'e' or 'E' */
9399 +                               *p++ = '+';
9400 +                               /* Produce the same number of exponent digits as
9401 +                                  the native printf implementation.  */
9402 +#   if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9403 +                               *p++ = '0';
9404 +#   endif
9405 +                               *p++ = '0';
9406 +                               *p++ = '0';
9407 +                             }
9408 +                           else if (dp->conversion == 'g' || dp->conversion == 'G')
9409 +                             {
9410 +                               *p++ = '0';
9411 +                               if (flags & FLAG_ALT)
9412 +                                 {
9413 +                                   size_t ndigits =
9414 +                                     (precision > 0 ? precision - 1 : 0);
9415 +                                   *p++ = decimal_point_char ();
9416 +                                   for (; ndigits > 0; --ndigits)
9417 +                                     *p++ = '0';
9418 +                                 }
9419 +                             }
9420 +                           else
9421 +                             abort ();
9422 +#  endif
9423 +                         }
9424 +                     }
9425 +                 }
9426 +# endif
9427 +
9428 +               /* The generated string now extends from tmp to p, with the
9429 +                  zero padding insertion point being at pad_ptr.  */
9430 +               if (has_width && p - tmp < width)
9431 +                 {
9432 +                   size_t pad = width - (p - tmp);
9433 +                   DCHAR_T *end = p + pad;
9434 +
9435 +                   if (flags & FLAG_LEFT)
9436 +                     {
9437 +                       /* Pad with spaces on the right.  */
9438 +                       for (; pad > 0; pad--)
9439 +                         *p++ = ' ';
9440 +                     }
9441 +                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
9442 +                     {
9443 +                       /* Pad with zeroes.  */
9444 +                       DCHAR_T *q = end;
9445 +
9446 +                       while (p > pad_ptr)
9447 +                         *--q = *--p;
9448 +                       for (; pad > 0; pad--)
9449 +                         *p++ = '0';
9450 +                     }
9451 +                   else
9452 +                     {
9453 +                       /* Pad with spaces on the left.  */
9454 +                       DCHAR_T *q = end;
9455 +
9456 +                       while (p > tmp)
9457 +                         *--q = *--p;
9458 +                       for (; pad > 0; pad--)
9459 +                         *p++ = ' ';
9460 +                     }
9461 +
9462 +                   p = end;
9463 +                 }
9464 +
9465 +               {
9466 +                 size_t count = p - tmp;
9467 +
9468 +                 if (count >= tmp_length)
9469 +                   /* tmp_length was incorrectly calculated - fix the
9470 +                      code above!  */
9471 +                   abort ();
9472 +
9473 +                 /* Make room for the result.  */
9474 +                 if (count >= allocated - length)
9475 +                   {
9476 +                     size_t n = xsum (length, count);
9477 +
9478 +                     ENSURE_ALLOCATION (n);
9479 +                   }
9480 +
9481 +                 /* Append the result.  */
9482 +                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
9483 +                 if (tmp != tmpbuf)
9484 +                   free (tmp);
9485 +                 length += count;
9486 +               }
9487 +             }
9488 +#endif
9489 +           else
9490 +             {
9491 +               arg_type type = a.arg[dp->arg_index].type;
9492 +               int flags = dp->flags;
9493 +#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
9494 +               int has_width;
9495 +               size_t width;
9496 +#endif
9497 +#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
9498 +               int has_precision;
9499 +               size_t precision;
9500 +#endif
9501 +#if NEED_PRINTF_UNBOUNDED_PRECISION
9502 +               int prec_ourselves;
9503 +#else
9504 +#              define prec_ourselves 0
9505 +#endif
9506 +#if NEED_PRINTF_FLAG_LEFTADJUST
9507 +#              define pad_ourselves 1
9508 +#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
9509 +               int pad_ourselves;
9510 +#else
9511 +#              define pad_ourselves 0
9512 +#endif
9513 +               TCHAR_T *fbp;
9514 +               unsigned int prefix_count;
9515 +               int prefixes[2] IF_LINT (= { 0 });
9516 +#if !USE_SNPRINTF
9517 +               size_t tmp_length;
9518 +               TCHAR_T tmpbuf[700];
9519 +               TCHAR_T *tmp;
9520 +#endif
9521 +
9522 +#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
9523 +               has_width = 0;
9524 +               width = 0;
9525 +               if (dp->width_start != dp->width_end)
9526 +                 {
9527 +                   if (dp->width_arg_index != ARG_NONE)
9528 +                     {
9529 +                       int arg;
9530 +
9531 +                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
9532 +                         abort ();
9533 +                       arg = a.arg[dp->width_arg_index].a.a_int;
9534 +                       if (arg < 0)
9535 +                         {
9536 +                           /* "A negative field width is taken as a '-' flag
9537 +                               followed by a positive field width."  */
9538 +                           flags |= FLAG_LEFT;
9539 +                           width = (unsigned int) (-arg);
9540 +                         }
9541 +                       else
9542 +                         width = arg;
9543 +                     }
9544 +                   else
9545 +                     {
9546 +                       const FCHAR_T *digitp = dp->width_start;
9547 +
9548 +                       do
9549 +                         width = xsum (xtimes (width, 10), *digitp++ - '0');
9550 +                       while (digitp != dp->width_end);
9551 +                     }
9552 +                   has_width = 1;
9553 +                 }
9554 +#endif
9555 +
9556 +#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
9557 +               has_precision = 0;
9558 +               precision = 6;
9559 +               if (dp->precision_start != dp->precision_end)
9560 +                 {
9561 +                   if (dp->precision_arg_index != ARG_NONE)
9562 +                     {
9563 +                       int arg;
9564 +
9565 +                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
9566 +                         abort ();
9567 +                       arg = a.arg[dp->precision_arg_index].a.a_int;
9568 +                       /* "A negative precision is taken as if the precision
9569 +                           were omitted."  */
9570 +                       if (arg >= 0)
9571 +                         {
9572 +                           precision = arg;
9573 +                           has_precision = 1;
9574 +                         }
9575 +                     }
9576 +                   else
9577 +                     {
9578 +                       const FCHAR_T *digitp = dp->precision_start + 1;
9579 +
9580 +                       precision = 0;
9581 +                       while (digitp != dp->precision_end)
9582 +                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
9583 +                       has_precision = 1;
9584 +                     }
9585 +                 }
9586 +#endif
9587 +
9588 +               /* Decide whether to handle the precision ourselves.  */
9589 +#if NEED_PRINTF_UNBOUNDED_PRECISION
9590 +               switch (dp->conversion)
9591 +                 {
9592 +                 case 'd': case 'i': case 'u':
9593 +                 case 'o':
9594 +                 case 'x': case 'X': case 'p':
9595 +                   prec_ourselves = has_precision && (precision > 0);
9596 +                   break;
9597 +                 default:
9598 +                   prec_ourselves = 0;
9599 +                   break;
9600 +                 }
9601 +#endif
9602 +
9603 +               /* Decide whether to perform the padding ourselves.  */
9604 +#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
9605 +               switch (dp->conversion)
9606 +                 {
9607 +# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
9608 +                 /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
9609 +                    to perform the padding after this conversion.  Functions
9610 +                    with unistdio extensions perform the padding based on
9611 +                    character count rather than element count.  */
9612 +                 case 'c': case 's':
9613 +# endif
9614 +# if NEED_PRINTF_FLAG_ZERO
9615 +                 case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
9616 +                 case 'a': case 'A':
9617 +# endif
9618 +                   pad_ourselves = 1;
9619 +                   break;
9620 +                 default:
9621 +                   pad_ourselves = prec_ourselves;
9622 +                   break;
9623 +                 }
9624 +#endif
9625 +
9626 +#if !USE_SNPRINTF
9627 +               /* Allocate a temporary buffer of sufficient size for calling
9628 +                  sprintf.  */
9629 +               {
9630 +                 switch (dp->conversion)
9631 +                   {
9632 +
9633 +                   case 'd': case 'i': case 'u':
9634 +# if HAVE_LONG_LONG_INT
9635 +                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
9636 +                       tmp_length =
9637 +                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
9638 +                                         * 0.30103 /* binary -> decimal */
9639 +                                        )
9640 +                         + 1; /* turn floor into ceil */
9641 +                     else
9642 +# endif
9643 +                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
9644 +                       tmp_length =
9645 +                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
9646 +                                         * 0.30103 /* binary -> decimal */
9647 +                                        )
9648 +                         + 1; /* turn floor into ceil */
9649 +                     else
9650 +                       tmp_length =
9651 +                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
9652 +                                         * 0.30103 /* binary -> decimal */
9653 +                                        )
9654 +                         + 1; /* turn floor into ceil */
9655 +                     if (tmp_length < precision)
9656 +                       tmp_length = precision;
9657 +                     /* Multiply by 2, as an estimate for FLAG_GROUP.  */
9658 +                     tmp_length = xsum (tmp_length, tmp_length);
9659 +                     /* Add 1, to account for a leading sign.  */
9660 +                     tmp_length = xsum (tmp_length, 1);
9661 +                     break;
9662 +
9663 +                   case 'o':
9664 +# if HAVE_LONG_LONG_INT
9665 +                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
9666 +                       tmp_length =
9667 +                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
9668 +                                         * 0.333334 /* binary -> octal */
9669 +                                        )
9670 +                         + 1; /* turn floor into ceil */
9671 +                     else
9672 +# endif
9673 +                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
9674 +                       tmp_length =
9675 +                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
9676 +                                         * 0.333334 /* binary -> octal */
9677 +                                        )
9678 +                         + 1; /* turn floor into ceil */
9679 +                     else
9680 +                       tmp_length =
9681 +                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
9682 +                                         * 0.333334 /* binary -> octal */
9683 +                                        )
9684 +                         + 1; /* turn floor into ceil */
9685 +                     if (tmp_length < precision)
9686 +                       tmp_length = precision;
9687 +                     /* Add 1, to account for a leading sign.  */
9688 +                     tmp_length = xsum (tmp_length, 1);
9689 +                     break;
9690 +
9691 +                   case 'x': case 'X':
9692 +# if HAVE_LONG_LONG_INT
9693 +                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
9694 +                       tmp_length =
9695 +                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
9696 +                                         * 0.25 /* binary -> hexadecimal */
9697 +                                        )
9698 +                         + 1; /* turn floor into ceil */
9699 +                     else
9700 +# endif
9701 +                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
9702 +                       tmp_length =
9703 +                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
9704 +                                         * 0.25 /* binary -> hexadecimal */
9705 +                                        )
9706 +                         + 1; /* turn floor into ceil */
9707 +                     else
9708 +                       tmp_length =
9709 +                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
9710 +                                         * 0.25 /* binary -> hexadecimal */
9711 +                                        )
9712 +                         + 1; /* turn floor into ceil */
9713 +                     if (tmp_length < precision)
9714 +                       tmp_length = precision;
9715 +                     /* Add 2, to account for a leading sign or alternate form.  */
9716 +                     tmp_length = xsum (tmp_length, 2);
9717 +                     break;
9718 +
9719 +                   case 'f': case 'F':
9720 +                     if (type == TYPE_LONGDOUBLE)
9721 +                       tmp_length =
9722 +                         (unsigned int) (LDBL_MAX_EXP
9723 +                                         * 0.30103 /* binary -> decimal */
9724 +                                         * 2 /* estimate for FLAG_GROUP */
9725 +                                        )
9726 +                         + 1 /* turn floor into ceil */
9727 +                         + 10; /* sign, decimal point etc. */
9728 +                     else
9729 +                       tmp_length =
9730 +                         (unsigned int) (DBL_MAX_EXP
9731 +                                         * 0.30103 /* binary -> decimal */
9732 +                                         * 2 /* estimate for FLAG_GROUP */
9733 +                                        )
9734 +                         + 1 /* turn floor into ceil */
9735 +                         + 10; /* sign, decimal point etc. */
9736 +                     tmp_length = xsum (tmp_length, precision);
9737 +                     break;
9738 +
9739 +                   case 'e': case 'E': case 'g': case 'G':
9740 +                     tmp_length =
9741 +                       12; /* sign, decimal point, exponent etc. */
9742 +                     tmp_length = xsum (tmp_length, precision);
9743 +                     break;
9744 +
9745 +                   case 'a': case 'A':
9746 +                     if (type == TYPE_LONGDOUBLE)
9747 +                       tmp_length =
9748 +                         (unsigned int) (LDBL_DIG
9749 +                                         * 0.831 /* decimal -> hexadecimal */
9750 +                                        )
9751 +                         + 1; /* turn floor into ceil */
9752 +                     else
9753 +                       tmp_length =
9754 +                         (unsigned int) (DBL_DIG
9755 +                                         * 0.831 /* decimal -> hexadecimal */
9756 +                                        )
9757 +                         + 1; /* turn floor into ceil */
9758 +                     if (tmp_length < precision)
9759 +                       tmp_length = precision;
9760 +                     /* Account for sign, decimal point etc. */
9761 +                     tmp_length = xsum (tmp_length, 12);
9762 +                     break;
9763 +
9764 +                   case 'c':
9765 +# if HAVE_WINT_T && !WIDE_CHAR_VERSION
9766 +                     if (type == TYPE_WIDE_CHAR)
9767 +                       tmp_length = MB_CUR_MAX;
9768 +                     else
9769 +# endif
9770 +                       tmp_length = 1;
9771 +                     break;
9772 +
9773 +                   case 's':
9774 +# if HAVE_WCHAR_T
9775 +                     if (type == TYPE_WIDE_STRING)
9776 +                       {
9777 +                         tmp_length =
9778 +                           local_wcslen (a.arg[dp->arg_index].a.a_wide_string);
9779 +
9780 +#  if !WIDE_CHAR_VERSION
9781 +                         tmp_length = xtimes (tmp_length, MB_CUR_MAX);
9782 +#  endif
9783 +                       }
9784 +                     else
9785 +# endif
9786 +                       tmp_length = strlen (a.arg[dp->arg_index].a.a_string);
9787 +                     break;
9788 +
9789 +                   case 'p':
9790 +                     tmp_length =
9791 +                       (unsigned int) (sizeof (void *) * CHAR_BIT
9792 +                                       * 0.25 /* binary -> hexadecimal */
9793 +                                      )
9794 +                         + 1 /* turn floor into ceil */
9795 +                         + 2; /* account for leading 0x */
9796 +                     break;
9797 +
9798 +                   default:
9799 +                     abort ();
9800 +                   }
9801 +
9802 +                 if (!pad_ourselves)
9803 +                   {
9804 +# if ENABLE_UNISTDIO
9805 +                     /* Padding considers the number of characters, therefore
9806 +                        the number of elements after padding may be
9807 +                          > max (tmp_length, width)
9808 +                        but is certainly
9809 +                          <= tmp_length + width.  */
9810 +                     tmp_length = xsum (tmp_length, width);
9811 +# else
9812 +                     /* Padding considers the number of elements,
9813 +                        says POSIX.  */
9814 +                     if (tmp_length < width)
9815 +                       tmp_length = width;
9816 +# endif
9817 +                   }
9818 +
9819 +                 tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
9820 +               }
9821 +
9822 +               if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
9823 +                 tmp = tmpbuf;
9824 +               else
9825 +                 {
9826 +                   size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
9827 +
9828 +                   if (size_overflow_p (tmp_memsize))
9829 +                     /* Overflow, would lead to out of memory.  */
9830 +                     goto out_of_memory;
9831 +                   tmp = (TCHAR_T *) malloc (tmp_memsize);
9832 +                   if (tmp == NULL)
9833 +                     /* Out of memory.  */
9834 +                     goto out_of_memory;
9835 +                 }
9836 +#endif
9837 +
9838 +               /* Construct the format string for calling snprintf or
9839 +                  sprintf.  */
9840 +               fbp = buf;
9841 +               *fbp++ = '%';
9842 +#if NEED_PRINTF_FLAG_GROUPING
9843 +               /* The underlying implementation doesn't support the ' flag.
9844 +                  Produce no grouping characters in this case; this is
9845 +                  acceptable because the grouping is locale dependent.  */
9846 +#else
9847 +               if (flags & FLAG_GROUP)
9848 +                 *fbp++ = '\'';
9849 +#endif
9850 +               if (flags & FLAG_LEFT)
9851 +                 *fbp++ = '-';
9852 +               if (flags & FLAG_SHOWSIGN)
9853 +                 *fbp++ = '+';
9854 +               if (flags & FLAG_SPACE)
9855 +                 *fbp++ = ' ';
9856 +               if (flags & FLAG_ALT)
9857 +                 *fbp++ = '#';
9858 +               if (!pad_ourselves)
9859 +                 {
9860 +                   if (flags & FLAG_ZERO)
9861 +                     *fbp++ = '0';
9862 +                   if (dp->width_start != dp->width_end)
9863 +                     {
9864 +                       size_t n = dp->width_end - dp->width_start;
9865 +                       /* The width specification is known to consist only
9866 +                          of standard ASCII characters.  */
9867 +                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
9868 +                         {
9869 +                           memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T));
9870 +                           fbp += n;
9871 +                         }
9872 +                       else
9873 +                         {
9874 +                           const FCHAR_T *mp = dp->width_start;
9875 +                           do
9876 +                             *fbp++ = (unsigned char) *mp++;
9877 +                           while (--n > 0);
9878 +                         }
9879 +                     }
9880 +                 }
9881 +               if (!prec_ourselves)
9882 +                 {
9883 +                   if (dp->precision_start != dp->precision_end)
9884 +                     {
9885 +                       size_t n = dp->precision_end - dp->precision_start;
9886 +                       /* The precision specification is known to consist only
9887 +                          of standard ASCII characters.  */
9888 +                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
9889 +                         {
9890 +                           memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
9891 +                           fbp += n;
9892 +                         }
9893 +                       else
9894 +                         {
9895 +                           const FCHAR_T *mp = dp->precision_start;
9896 +                           do
9897 +                             *fbp++ = (unsigned char) *mp++;
9898 +                           while (--n > 0);
9899 +                         }
9900 +                     }
9901 +                 }
9902 +
9903 +               switch (type)
9904 +                 {
9905 +#if HAVE_LONG_LONG_INT
9906 +                 case TYPE_LONGLONGINT:
9907 +                 case TYPE_ULONGLONGINT:
9908 +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
9909 +                   *fbp++ = 'I';
9910 +                   *fbp++ = '6';
9911 +                   *fbp++ = '4';
9912 +                   break;
9913 +# else
9914 +                   *fbp++ = 'l';
9915 +                   /*FALLTHROUGH*/
9916 +# endif
9917 +#endif
9918 +                 case TYPE_LONGINT:
9919 +                 case TYPE_ULONGINT:
9920 +#if HAVE_WINT_T
9921 +                 case TYPE_WIDE_CHAR:
9922 +#endif
9923 +#if HAVE_WCHAR_T
9924 +                 case TYPE_WIDE_STRING:
9925 +#endif
9926 +                   *fbp++ = 'l';
9927 +                   break;
9928 +                 case TYPE_LONGDOUBLE:
9929 +                   *fbp++ = 'L';
9930 +                   break;
9931 +                 default:
9932 +                   break;
9933 +                 }
9934 +#if NEED_PRINTF_DIRECTIVE_F
9935 +               if (dp->conversion == 'F')
9936 +                 *fbp = 'f';
9937 +               else
9938 +#endif
9939 +                 *fbp = dp->conversion;
9940 +#if USE_SNPRINTF
9941 +# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
9942 +               fbp[1] = '%';
9943 +               fbp[2] = 'n';
9944 +               fbp[3] = '\0';
9945 +# else
9946 +               /* On glibc2 systems from glibc >= 2.3 - probably also older
9947 +                  ones - we know that snprintf's returns value conforms to
9948 +                  ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
9949 +                  Therefore we can avoid using %n in this situation.
9950 +                  On glibc2 systems from 2004-10-18 or newer, the use of %n
9951 +                  in format strings in writable memory may crash the program
9952 +                  (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
9953 +                  in this situation.  */
9954 +               /* On native Win32 systems (such as mingw), we can avoid using
9955 +                  %n because:
9956 +                    - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
9957 +                      snprintf does not write more than the specified number
9958 +                      of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
9959 +                      '4', '5', '6' into buf, not '4', '5', '\0'.)
9960 +                    - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
9961 +                      allows us to recognize the case of an insufficient
9962 +                      buffer size: it returns -1 in this case.
9963 +                  On native Win32 systems (such as mingw) where the OS is
9964 +                  Windows Vista, the use of %n in format strings by default
9965 +                  crashes the program. See
9966 +                    <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
9967 +                    <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
9968 +                  So we should avoid %n in this situation.  */
9969 +               fbp[1] = '\0';
9970 +# endif
9971 +#else
9972 +               fbp[1] = '\0';
9973 +#endif
9974 +
9975 +               /* Construct the arguments for calling snprintf or sprintf.  */
9976 +               prefix_count = 0;
9977 +               if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
9978 +                 {
9979 +                   if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
9980 +                     abort ();
9981 +                   prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
9982 +                 }
9983 +               if (!prec_ourselves && dp->precision_arg_index != ARG_NONE)
9984 +                 {
9985 +                   if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
9986 +                     abort ();
9987 +                   prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
9988 +                 }
9989 +
9990 +#if USE_SNPRINTF
9991 +               /* The SNPRINTF result is appended after result[0..length].
9992 +                  The latter is an array of DCHAR_T; SNPRINTF appends an
9993 +                  array of TCHAR_T to it.  This is possible because
9994 +                  sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
9995 +                  alignof (TCHAR_T) <= alignof (DCHAR_T).  */
9996 +# define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T))
9997 +               /* Ensure that maxlen below will be >= 2.  Needed on BeOS,
9998 +                  where an snprintf() with maxlen==1 acts like sprintf().  */
9999 +               ENSURE_ALLOCATION (xsum (length,
10000 +                                        (2 + TCHARS_PER_DCHAR - 1)
10001 +                                        / TCHARS_PER_DCHAR));
10002 +               /* Prepare checking whether snprintf returns the count
10003 +                  via %n.  */
10004 +               *(TCHAR_T *) (result + length) = '\0';
10005 +#endif
10006 +
10007 +               for (;;)
10008 +                 {
10009 +                   int count = -1;
10010 +
10011 +#if USE_SNPRINTF
10012 +                   int retcount = 0;
10013 +                   size_t maxlen = allocated - length;
10014 +                   /* SNPRINTF can fail if its second argument is
10015 +                      > INT_MAX.  */
10016 +                   if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
10017 +                     maxlen = INT_MAX / TCHARS_PER_DCHAR;
10018 +                   maxlen = maxlen * TCHARS_PER_DCHAR;
10019 +# define SNPRINTF_BUF(arg) \
10020 +                   switch (prefix_count)                                   \
10021 +                     {                                                     \
10022 +                     case 0:                                               \
10023 +                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
10024 +                                            maxlen, buf,                   \
10025 +                                            arg, &count);                  \
10026 +                       break;                                              \
10027 +                     case 1:                                               \
10028 +                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
10029 +                                            maxlen, buf,                   \
10030 +                                            prefixes[0], arg, &count);     \
10031 +                       break;                                              \
10032 +                     case 2:                                               \
10033 +                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
10034 +                                            maxlen, buf,                   \
10035 +                                            prefixes[0], prefixes[1], arg, \
10036 +                                            &count);                       \
10037 +                       break;                                              \
10038 +                     default:                                              \
10039 +                       abort ();                                           \
10040 +                     }
10041 +#else
10042 +# define SNPRINTF_BUF(arg) \
10043 +                   switch (prefix_count)                                   \
10044 +                     {                                                     \
10045 +                     case 0:                                               \
10046 +                       count = sprintf (tmp, buf, arg);                    \
10047 +                       break;                                              \
10048 +                     case 1:                                               \
10049 +                       count = sprintf (tmp, buf, prefixes[0], arg);       \
10050 +                       break;                                              \
10051 +                     case 2:                                               \
10052 +                       count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
10053 +                                        arg);                              \
10054 +                       break;                                              \
10055 +                     default:                                              \
10056 +                       abort ();                                           \
10057 +                     }
10058 +#endif
10059 +
10060 +                   switch (type)
10061 +                     {
10062 +                     case TYPE_SCHAR:
10063 +                       {
10064 +                         int arg = a.arg[dp->arg_index].a.a_schar;
10065 +                         SNPRINTF_BUF (arg);
10066 +                       }
10067 +                       break;
10068 +                     case TYPE_UCHAR:
10069 +                       {
10070 +                         unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
10071 +                         SNPRINTF_BUF (arg);
10072 +                       }
10073 +                       break;
10074 +                     case TYPE_SHORT:
10075 +                       {
10076 +                         int arg = a.arg[dp->arg_index].a.a_short;
10077 +                         SNPRINTF_BUF (arg);
10078 +                       }
10079 +                       break;
10080 +                     case TYPE_USHORT:
10081 +                       {
10082 +                         unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
10083 +                         SNPRINTF_BUF (arg);
10084 +                       }
10085 +                       break;
10086 +                     case TYPE_INT:
10087 +                       {
10088 +                         int arg = a.arg[dp->arg_index].a.a_int;
10089 +                         SNPRINTF_BUF (arg);
10090 +                       }
10091 +                       break;
10092 +                     case TYPE_UINT:
10093 +                       {
10094 +                         unsigned int arg = a.arg[dp->arg_index].a.a_uint;
10095 +                         SNPRINTF_BUF (arg);
10096 +                       }
10097 +                       break;
10098 +                     case TYPE_LONGINT:
10099 +                       {
10100 +                         long int arg = a.arg[dp->arg_index].a.a_longint;
10101 +                         SNPRINTF_BUF (arg);
10102 +                       }
10103 +                       break;
10104 +                     case TYPE_ULONGINT:
10105 +                       {
10106 +                         unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
10107 +                         SNPRINTF_BUF (arg);
10108 +                       }
10109 +                       break;
10110 +#if HAVE_LONG_LONG_INT
10111 +                     case TYPE_LONGLONGINT:
10112 +                       {
10113 +                         long long int arg = a.arg[dp->arg_index].a.a_longlongint;
10114 +                         SNPRINTF_BUF (arg);
10115 +                       }
10116 +                       break;
10117 +                     case TYPE_ULONGLONGINT:
10118 +                       {
10119 +                         unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
10120 +                         SNPRINTF_BUF (arg);
10121 +                       }
10122 +                       break;
10123 +#endif
10124 +                     case TYPE_DOUBLE:
10125 +                       {
10126 +                         double arg = a.arg[dp->arg_index].a.a_double;
10127 +                         SNPRINTF_BUF (arg);
10128 +                       }
10129 +                       break;
10130 +                     case TYPE_LONGDOUBLE:
10131 +                       {
10132 +                         long double arg = a.arg[dp->arg_index].a.a_longdouble;
10133 +                         SNPRINTF_BUF (arg);
10134 +                       }
10135 +                       break;
10136 +                     case TYPE_CHAR:
10137 +                       {
10138 +                         int arg = a.arg[dp->arg_index].a.a_char;
10139 +                         SNPRINTF_BUF (arg);
10140 +                       }
10141 +                       break;
10142 +#if HAVE_WINT_T
10143 +                     case TYPE_WIDE_CHAR:
10144 +                       {
10145 +                         wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
10146 +                         SNPRINTF_BUF (arg);
10147 +                       }
10148 +                       break;
10149 +#endif
10150 +                     case TYPE_STRING:
10151 +                       {
10152 +                         const char *arg = a.arg[dp->arg_index].a.a_string;
10153 +                         SNPRINTF_BUF (arg);
10154 +                       }
10155 +                       break;
10156 +#if HAVE_WCHAR_T
10157 +                     case TYPE_WIDE_STRING:
10158 +                       {
10159 +                         const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
10160 +                         SNPRINTF_BUF (arg);
10161 +                       }
10162 +                       break;
10163 +#endif
10164 +                     case TYPE_POINTER:
10165 +                       {
10166 +                         void *arg = a.arg[dp->arg_index].a.a_pointer;
10167 +                         SNPRINTF_BUF (arg);
10168 +                       }
10169 +                       break;
10170 +                     default:
10171 +                       abort ();
10172 +                     }
10173 +
10174 +#if USE_SNPRINTF
10175 +                   /* Portability: Not all implementations of snprintf()
10176 +                      are ISO C 99 compliant.  Determine the number of
10177 +                      bytes that snprintf() has produced or would have
10178 +                      produced.  */
10179 +                   if (count >= 0)
10180 +                     {
10181 +                       /* Verify that snprintf() has NUL-terminated its
10182 +                          result.  */
10183 +                       if (count < maxlen
10184 +                           && ((TCHAR_T *) (result + length)) [count] != '\0')
10185 +                         abort ();
10186 +                       /* Portability hack.  */
10187 +                       if (retcount > count)
10188 +                         count = retcount;
10189 +                     }
10190 +                   else
10191 +                     {
10192 +                       /* snprintf() doesn't understand the '%n'
10193 +                          directive.  */
10194 +                       if (fbp[1] != '\0')
10195 +                         {
10196 +                           /* Don't use the '%n' directive; instead, look
10197 +                              at the snprintf() return value.  */
10198 +                           fbp[1] = '\0';
10199 +                           continue;
10200 +                         }
10201 +                       else
10202 +                         {
10203 +                           /* Look at the snprintf() return value.  */
10204 +                           if (retcount < 0)
10205 +                             {
10206 +                               /* HP-UX 10.20 snprintf() is doubly deficient:
10207 +                                  It doesn't understand the '%n' directive,
10208 +                                  *and* it returns -1 (rather than the length
10209 +                                  that would have been required) when the
10210 +                                  buffer is too small.  */
10211 +                               size_t bigger_need =
10212 +                                 xsum (xtimes (allocated, 2), 12);
10213 +                               ENSURE_ALLOCATION (bigger_need);
10214 +                               continue;
10215 +                             }
10216 +                           else
10217 +                             count = retcount;
10218 +                         }
10219 +                     }
10220 +#endif
10221 +
10222 +                   /* Attempt to handle failure.  */
10223 +                   if (count < 0)
10224 +                     {
10225 +                       if (!(result == resultbuf || result == NULL))
10226 +                         free (result);
10227 +                       if (buf_malloced != NULL)
10228 +                         free (buf_malloced);
10229 +                       CLEANUP ();
10230 +                       errno = EINVAL;
10231 +                       return NULL;
10232 +                     }
10233 +
10234 +#if USE_SNPRINTF
10235 +                   /* Handle overflow of the allocated buffer.
10236 +                      If such an overflow occurs, a C99 compliant snprintf()
10237 +                      returns a count >= maxlen.  However, a non-compliant
10238 +                      snprintf() function returns only count = maxlen - 1.  To
10239 +                      cover both cases, test whether count >= maxlen - 1.  */
10240 +                   if ((unsigned int) count + 1 >= maxlen)
10241 +                     {
10242 +                       /* If maxlen already has attained its allowed maximum,
10243 +                          allocating more memory will not increase maxlen.
10244 +                          Instead of looping, bail out.  */
10245 +                       if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
10246 +                         goto overflow;
10247 +                       else
10248 +                         {
10249 +                           /* Need at least (count + 1) * sizeof (TCHAR_T)
10250 +                              bytes.  (The +1 is for the trailing NUL.)
10251 +                              But ask for (count + 2) * sizeof (TCHAR_T)
10252 +                              bytes, so that in the next round, we likely get
10253 +                                maxlen > (unsigned int) count + 1
10254 +                              and so we don't get here again.
10255 +                              And allocate proportionally, to avoid looping
10256 +                              eternally if snprintf() reports a too small
10257 +                              count.  */
10258 +                           size_t n =
10259 +                             xmax (xsum (length,
10260 +                                         ((unsigned int) count + 2
10261 +                                          + TCHARS_PER_DCHAR - 1)
10262 +                                         / TCHARS_PER_DCHAR),
10263 +                                   xtimes (allocated, 2));
10264 +
10265 +                           ENSURE_ALLOCATION (n);
10266 +                           continue;
10267 +                         }
10268 +                     }
10269 +#endif
10270 +
10271 +#if NEED_PRINTF_UNBOUNDED_PRECISION
10272 +                   if (prec_ourselves)
10273 +                     {
10274 +                       /* Handle the precision.  */
10275 +                       TCHAR_T *prec_ptr =
10276 +# if USE_SNPRINTF
10277 +                         (TCHAR_T *) (result + length);
10278 +# else
10279 +                         tmp;
10280 +# endif
10281 +                       size_t prefix_count;
10282 +                       size_t move;
10283 +
10284 +                       prefix_count = 0;
10285 +                       /* Put the additional zeroes after the sign.  */
10286 +                       if (count >= 1
10287 +                           && (*prec_ptr == '-' || *prec_ptr == '+'
10288 +                               || *prec_ptr == ' '))
10289 +                         prefix_count = 1;
10290 +                       /* Put the additional zeroes after the 0x prefix if
10291 +                          (flags & FLAG_ALT) || (dp->conversion == 'p').  */
10292 +                       else if (count >= 2
10293 +                                && prec_ptr[0] == '0'
10294 +                                && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
10295 +                         prefix_count = 2;
10296 +
10297 +                       move = count - prefix_count;
10298 +                       if (precision > move)
10299 +                         {
10300 +                           /* Insert zeroes.  */
10301 +                           size_t insert = precision - move;
10302 +                           TCHAR_T *prec_end;
10303 +
10304 +# if USE_SNPRINTF
10305 +                           size_t n =
10306 +                             xsum (length,
10307 +                                   (count + insert + TCHARS_PER_DCHAR - 1)
10308 +                                   / TCHARS_PER_DCHAR);
10309 +                           length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
10310 +                           ENSURE_ALLOCATION (n);
10311 +                           length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
10312 +                           prec_ptr = (TCHAR_T *) (result + length);
10313 +# endif
10314 +
10315 +                           prec_end = prec_ptr + count;
10316 +                           prec_ptr += prefix_count;
10317 +
10318 +                           while (prec_end > prec_ptr)
10319 +                             {
10320 +                               prec_end--;
10321 +                               prec_end[insert] = prec_end[0];
10322 +                             }
10323 +
10324 +                           prec_end += insert;
10325 +                           do
10326 +                             *--prec_end = '0';
10327 +                           while (prec_end > prec_ptr);
10328 +
10329 +                           count += insert;
10330 +                         }
10331 +                     }
10332 +#endif
10333 +
10334 +#if !USE_SNPRINTF
10335 +                   if (count >= tmp_length)
10336 +                     /* tmp_length was incorrectly calculated - fix the
10337 +                        code above!  */
10338 +                     abort ();
10339 +#endif
10340 +
10341 +#if !DCHAR_IS_TCHAR
10342 +                   /* Convert from TCHAR_T[] to DCHAR_T[].  */
10343 +                   if (dp->conversion == 'c' || dp->conversion == 's')
10344 +                     {
10345 +                       /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING
10346 +                          TYPE_WIDE_STRING.
10347 +                          The result string is not certainly ASCII.  */
10348 +                       const TCHAR_T *tmpsrc;
10349 +                       DCHAR_T *tmpdst;
10350 +                       size_t tmpdst_len;
10351 +                       /* This code assumes that TCHAR_T is 'char'.  */
10352 +                       typedef int TCHAR_T_verify
10353 +                                   [2 * (sizeof (TCHAR_T) == 1) - 1];
10354 +# if USE_SNPRINTF
10355 +                       tmpsrc = (TCHAR_T *) (result + length);
10356 +# else
10357 +                       tmpsrc = tmp;
10358 +# endif
10359 +                       tmpdst = NULL;
10360 +                       tmpdst_len = 0;
10361 +                       if (DCHAR_CONV_FROM_ENCODING (locale_charset (),
10362 +                                                     iconveh_question_mark,
10363 +                                                     tmpsrc, count,
10364 +                                                     NULL,
10365 +                                                     &tmpdst, &tmpdst_len)
10366 +                           < 0)
10367 +                         {
10368 +                           int saved_errno = errno;
10369 +                           if (!(result == resultbuf || result == NULL))
10370 +                             free (result);
10371 +                           if (buf_malloced != NULL)
10372 +                             free (buf_malloced);
10373 +                           CLEANUP ();
10374 +                           errno = saved_errno;
10375 +                           return NULL;
10376 +                         }
10377 +                       ENSURE_ALLOCATION (xsum (length, tmpdst_len));
10378 +                       DCHAR_CPY (result + length, tmpdst, tmpdst_len);
10379 +                       free (tmpdst);
10380 +                       count = tmpdst_len;
10381 +                     }
10382 +                   else
10383 +                     {
10384 +                       /* The result string is ASCII.
10385 +                          Simple 1:1 conversion.  */
10386 +# if USE_SNPRINTF
10387 +                       /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
10388 +                          no-op conversion, in-place on the array starting
10389 +                          at (result + length).  */
10390 +                       if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
10391 +# endif
10392 +                         {
10393 +                           const TCHAR_T *tmpsrc;
10394 +                           DCHAR_T *tmpdst;
10395 +                           size_t n;
10396 +
10397 +# if USE_SNPRINTF
10398 +                           if (result == resultbuf)
10399 +                             {
10400 +                               tmpsrc = (TCHAR_T *) (result + length);
10401 +                               /* ENSURE_ALLOCATION will not move tmpsrc
10402 +                                  (because it's part of resultbuf).  */
10403 +                               ENSURE_ALLOCATION (xsum (length, count));
10404 +                             }
10405 +                           else
10406 +                             {
10407 +                               /* ENSURE_ALLOCATION will move the array
10408 +                                  (because it uses realloc().  */
10409 +                               ENSURE_ALLOCATION (xsum (length, count));
10410 +                               tmpsrc = (TCHAR_T *) (result + length);
10411 +                             }
10412 +# else
10413 +                           tmpsrc = tmp;
10414 +                           ENSURE_ALLOCATION (xsum (length, count));
10415 +# endif
10416 +                           tmpdst = result + length;
10417 +                           /* Copy backwards, because of overlapping.  */
10418 +                           tmpsrc += count;
10419 +                           tmpdst += count;
10420 +                           for (n = count; n > 0; n--)
10421 +                             *--tmpdst = (unsigned char) *--tmpsrc;
10422 +                         }
10423 +                     }
10424 +#endif
10425 +
10426 +#if DCHAR_IS_TCHAR && !USE_SNPRINTF
10427 +                   /* Make room for the result.  */
10428 +                   if (count > allocated - length)
10429 +                     {
10430 +                       /* Need at least count elements.  But allocate
10431 +                          proportionally.  */
10432 +                       size_t n =
10433 +                         xmax (xsum (length, count), xtimes (allocated, 2));
10434 +
10435 +                       ENSURE_ALLOCATION (n);
10436 +                     }
10437 +#endif
10438 +
10439 +                   /* Here count <= allocated - length.  */
10440 +
10441 +                   /* Perform padding.  */
10442 +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
10443 +                   if (pad_ourselves && has_width)
10444 +                     {
10445 +                       size_t w;
10446 +# if ENABLE_UNISTDIO
10447 +                       /* Outside POSIX, it's preferrable to compare the width
10448 +                          against the number of _characters_ of the converted
10449 +                          value.  */
10450 +                       w = DCHAR_MBSNLEN (result + length, count);
10451 +# else
10452 +                       /* The width is compared against the number of _bytes_
10453 +                          of the converted value, says POSIX.  */
10454 +                       w = count;
10455 +# endif
10456 +                       if (w < width)
10457 +                         {
10458 +                           size_t pad = width - w;
10459 +
10460 +                           /* Make room for the result.  */
10461 +                           if (xsum (count, pad) > allocated - length)
10462 +                             {
10463 +                               /* Need at least count + pad elements.  But
10464 +                                  allocate proportionally.  */
10465 +                               size_t n =
10466 +                                 xmax (xsum3 (length, count, pad),
10467 +                                       xtimes (allocated, 2));
10468 +
10469 +# if USE_SNPRINTF
10470 +                               length += count;
10471 +                               ENSURE_ALLOCATION (n);
10472 +                               length -= count;
10473 +# else
10474 +                               ENSURE_ALLOCATION (n);
10475 +# endif
10476 +                             }
10477 +                           /* Here count + pad <= allocated - length.  */
10478 +
10479 +                           {
10480 +# if !DCHAR_IS_TCHAR || USE_SNPRINTF
10481 +                             DCHAR_T * const rp = result + length;
10482 +# else
10483 +                             DCHAR_T * const rp = tmp;
10484 +# endif
10485 +                             DCHAR_T *p = rp + count;
10486 +                             DCHAR_T *end = p + pad;
10487 +                             DCHAR_T *pad_ptr;
10488 +# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
10489 +                             if (dp->conversion == 'c'
10490 +                                 || dp->conversion == 's')
10491 +                               /* No zero-padding for string directives.  */
10492 +                               pad_ptr = NULL;
10493 +                             else
10494 +# endif
10495 +                               {
10496 +                                 pad_ptr = (*rp == '-' ? rp + 1 : rp);
10497 +                                 /* No zero-padding of "inf" and "nan".  */
10498 +                                 if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
10499 +                                     || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
10500 +                                   pad_ptr = NULL;
10501 +                               }
10502 +                             /* The generated string now extends from rp to p,
10503 +                                with the zero padding insertion point being at
10504 +                                pad_ptr.  */
10505 +
10506 +                             count = count + pad; /* = end - rp */
10507 +
10508 +                             if (flags & FLAG_LEFT)
10509 +                               {
10510 +                                 /* Pad with spaces on the right.  */
10511 +                                 for (; pad > 0; pad--)
10512 +                                   *p++ = ' ';
10513 +                               }
10514 +                             else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
10515 +                               {
10516 +                                 /* Pad with zeroes.  */
10517 +                                 DCHAR_T *q = end;
10518 +
10519 +                                 while (p > pad_ptr)
10520 +                                   *--q = *--p;
10521 +                                 for (; pad > 0; pad--)
10522 +                                   *p++ = '0';
10523 +                               }
10524 +                             else
10525 +                               {
10526 +                                 /* Pad with spaces on the left.  */
10527 +                                 DCHAR_T *q = end;
10528 +
10529 +                                 while (p > rp)
10530 +                                   *--q = *--p;
10531 +                                 for (; pad > 0; pad--)
10532 +                                   *p++ = ' ';
10533 +                               }
10534 +                           }
10535 +                         }
10536 +                     }
10537 +#endif
10538 +
10539 +                   /* Here still count <= allocated - length.  */
10540 +
10541 +#if !DCHAR_IS_TCHAR || USE_SNPRINTF
10542 +                   /* The snprintf() result did fit.  */
10543 +#else
10544 +                   /* Append the sprintf() result.  */
10545 +                   memcpy (result + length, tmp, count * sizeof (DCHAR_T));
10546 +#endif
10547 +#if !USE_SNPRINTF
10548 +                   if (tmp != tmpbuf)
10549 +                     free (tmp);
10550 +#endif
10551 +
10552 +#if NEED_PRINTF_DIRECTIVE_F
10553 +                   if (dp->conversion == 'F')
10554 +                     {
10555 +                       /* Convert the %f result to upper case for %F.  */
10556 +                       DCHAR_T *rp = result + length;
10557 +                       size_t rc;
10558 +                       for (rc = count; rc > 0; rc--, rp++)
10559 +                         if (*rp >= 'a' && *rp <= 'z')
10560 +                           *rp = *rp - 'a' + 'A';
10561 +                     }
10562 +#endif
10563 +
10564 +                   length += count;
10565 +                   break;
10566 +                 }
10567 +             }
10568 +         }
10569 +      }
10570 +
10571 +    /* Add the final NUL.  */
10572 +    ENSURE_ALLOCATION (xsum (length, 1));
10573 +    result[length] = '\0';
10574 +
10575 +    if (result != resultbuf && length + 1 < allocated)
10576 +      {
10577 +       /* Shrink the allocated memory if possible.  */
10578 +       DCHAR_T *memory;
10579 +
10580 +       memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
10581 +       if (memory != NULL)
10582 +         result = memory;
10583 +      }
10584 +
10585 +    if (buf_malloced != NULL)
10586 +      free (buf_malloced);
10587 +    CLEANUP ();
10588 +    *lengthp = length;
10589 +    /* Note that we can produce a big string of a length > INT_MAX.  POSIX
10590 +       says that snprintf() fails with errno = EOVERFLOW in this case, but
10591 +       that's only because snprintf() returns an 'int'.  This function does
10592 +       not have this limitation.  */
10593 +    return result;
10594 +
10595 +#if USE_SNPRINTF
10596 +  overflow:
10597 +    if (!(result == resultbuf || result == NULL))
10598 +      free (result);
10599 +    if (buf_malloced != NULL)
10600 +      free (buf_malloced);
10601 +    CLEANUP ();
10602 +    errno = EOVERFLOW;
10603 +    return NULL;
10604 +#endif
10605 +
10606 +  out_of_memory:
10607 +    if (!(result == resultbuf || result == NULL))
10608 +      free (result);
10609 +    if (buf_malloced != NULL)
10610 +      free (buf_malloced);
10611 +  out_of_memory_1:
10612 +    CLEANUP ();
10613 +    errno = ENOMEM;
10614 +    return NULL;
10615 +  }
10616 +}
10617 +
10618 +#undef TCHARS_PER_DCHAR
10619 +#undef SNPRINTF
10620 +#undef USE_SNPRINTF
10621 +#undef DCHAR_CPY
10622 +#undef PRINTF_PARSE
10623 +#undef DIRECTIVES
10624 +#undef DIRECTIVE
10625 +#undef DCHAR_IS_TCHAR
10626 +#undef TCHAR_T
10627 +#undef DCHAR_T
10628 +#undef FCHAR_T
10629 +#undef VASNPRINTF
10630 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/vasnprintf.h gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.h
10631 --- gtk-vnc-0.3.7.mingw/gnulib/lib/vasnprintf.h 1970-01-01 01:00:00.000000000 +0100
10632 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.h        2008-10-09 12:24:39.000000000 +0100
10633 @@ -0,0 +1,81 @@
10634 +/* vsprintf with automatic memory allocation.
10635 +   Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
10636 +
10637 +   This program is free software; you can redistribute it and/or modify
10638 +   it under the terms of the GNU Lesser General Public License as published by
10639 +   the Free Software Foundation; either version 2.1, or (at your option)
10640 +   any later version.
10641 +
10642 +   This program is distributed in the hope that it will be useful,
10643 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
10644 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10645 +   GNU Lesser General Public License for more details.
10646 +
10647 +   You should have received a copy of the GNU Lesser General Public License along
10648 +   with this program; if not, write to the Free Software Foundation,
10649 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
10650 +
10651 +#ifndef _VASNPRINTF_H
10652 +#define _VASNPRINTF_H
10653 +
10654 +/* Get va_list.  */
10655 +#include <stdarg.h>
10656 +
10657 +/* Get size_t.  */
10658 +#include <stddef.h>
10659 +
10660 +#ifndef __attribute__
10661 +/* This feature is available in gcc versions 2.5 and later.  */
10662 +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
10663 +#  define __attribute__(Spec) /* empty */
10664 +# endif
10665 +/* The __-protected variants of `format' and `printf' attributes
10666 +   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
10667 +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
10668 +#  define __format__ format
10669 +#  define __printf__ printf
10670 +# endif
10671 +#endif
10672 +
10673 +#ifdef __cplusplus
10674 +extern "C" {
10675 +#endif
10676 +
10677 +/* Write formatted output to a string dynamically allocated with malloc().
10678 +   You can pass a preallocated buffer for the result in RESULTBUF and its
10679 +   size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
10680 +   If successful, return the address of the string (this may be = RESULTBUF
10681 +   if no dynamic memory allocation was necessary) and set *LENGTHP to the
10682 +   number of resulting bytes, excluding the trailing NUL.  Upon error, set
10683 +   errno and return NULL.
10684 +
10685 +   When dynamic memory allocation occurs, the preallocated buffer is left
10686 +   alone (with possibly modified contents).  This makes it possible to use
10687 +   a statically allocated or stack-allocated buffer, like this:
10688 +
10689 +          char buf[100];
10690 +          size_t len = sizeof (buf);
10691 +          char *output = vasnprintf (buf, &len, format, args);
10692 +          if (output == NULL)
10693 +            ... error handling ...;
10694 +          else
10695 +            {
10696 +              ... use the output string ...;
10697 +              if (output != buf)
10698 +                free (output);
10699 +            }
10700 +  */
10701 +#if REPLACE_VASNPRINTF
10702 +# define asnprintf rpl_asnprintf
10703 +# define vasnprintf rpl_vasnprintf
10704 +#endif
10705 +extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
10706 +       __attribute__ ((__format__ (__printf__, 3, 4)));
10707 +extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
10708 +       __attribute__ ((__format__ (__printf__, 3, 0)));
10709 +
10710 +#ifdef __cplusplus
10711 +}
10712 +#endif
10713 +
10714 +#endif /* _VASNPRINTF_H */
10715 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/wchar.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/wchar.in.h
10716 --- gtk-vnc-0.3.7.mingw/gnulib/lib/wchar.in.h   1970-01-01 01:00:00.000000000 +0100
10717 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/wchar.in.h  2008-10-09 12:24:39.000000000 +0100
10718 @@ -0,0 +1,99 @@
10719 +/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
10720 +
10721 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
10722 +
10723 +   This program is free software; you can redistribute it and/or modify
10724 +   it under the terms of the GNU Lesser General Public License as published by
10725 +   the Free Software Foundation; either version 2.1, or (at your option)
10726 +   any later version.
10727 +
10728 +   This program is distributed in the hope that it will be useful,
10729 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
10730 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10731 +   GNU Lesser General Public License for more details.
10732 +
10733 +   You should have received a copy of the GNU Lesser General Public License
10734 +   along with this program; if not, write to the Free Software Foundation,
10735 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
10736 +
10737 +/* Written by Eric Blake.  */
10738 +
10739 +/*
10740 + * ISO C 99 <wchar.h> for platforms that have issues.
10741 + * <http://www.opengroup.org/susv3xbd/wchar.h.html>
10742 + *
10743 + * For now, this just ensures proper prerequisite inclusion order and
10744 + * the declaration of wcwidth().
10745 + */
10746 +
10747 +@PRAGMA_SYSTEM_HEADER@
10748 +
10749 +#ifdef __need_mbstate_t
10750 +/* Special invocation convention inside uClibc header files.  */
10751 +
10752 +#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
10753 +
10754 +#else
10755 +/* Normal invocation convention.  */
10756 +
10757 +#ifndef _GL_WCHAR_H
10758 +
10759 +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
10760 +   <wchar.h>.
10761 +   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
10762 +   included before <wchar.h>.  */
10763 +#include <stddef.h>
10764 +#include <stdio.h>
10765 +#include <time.h>
10766 +
10767 +/* Include the original <wchar.h> if it exists.
10768 +   Some builds of uClibc lack it.  */
10769 +/* The include_next requires a split double-inclusion guard.  */
10770 +#if @HAVE_WCHAR_H@
10771 +# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
10772 +#endif
10773 +
10774 +#ifndef _GL_WCHAR_H
10775 +#define _GL_WCHAR_H
10776 +
10777 +/* The definition of GL_LINK_WARNING is copied here.  */
10778 +
10779 +#ifdef __cplusplus
10780 +extern "C" {
10781 +#endif
10782 +
10783 +
10784 +/* Define wint_t.  (Also done in wctype.in.h.)  */
10785 +#if !@HAVE_WINT_T@ && !defined wint_t
10786 +# define wint_t int
10787 +#endif
10788 +
10789 +
10790 +/* Return the number of screen columns needed for WC.  */
10791 +#if @GNULIB_WCWIDTH@
10792 +# if @REPLACE_WCWIDTH@
10793 +#  undef wcwidth
10794 +#  define wcwidth rpl_wcwidth
10795 +extern int wcwidth (wchar_t);
10796 +# else
10797 +#  if !defined wcwidth && !@HAVE_DECL_WCWIDTH@
10798 +/* wcwidth exists but is not declared.  */
10799 +extern int wcwidth (int /* actually wchar_t */);
10800 +#  endif
10801 +# endif
10802 +#elif defined GNULIB_POSIXCHECK
10803 +# undef wcwidth
10804 +# define wcwidth(w) \
10805 +    (GL_LINK_WARNING ("wcwidth is unportable - " \
10806 +                      "use gnulib module wcwidth for portability"), \
10807 +     wcwidth (w))
10808 +#endif
10809 +
10810 +
10811 +#ifdef __cplusplus
10812 +}
10813 +#endif
10814 +
10815 +#endif /* _GL_WCHAR_H */
10816 +#endif /* _GL_WCHAR_H */
10817 +#endif
10818 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/winsock.c gtk-vnc-0.3.7.gnulib/gnulib/lib/winsock.c
10819 --- gtk-vnc-0.3.7.mingw/gnulib/lib/winsock.c    1970-01-01 01:00:00.000000000 +0100
10820 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/winsock.c   2008-10-09 12:24:39.000000000 +0100
10821 @@ -0,0 +1,308 @@
10822 +/* winsock.c --- wrappers for Windows socket functions
10823 +
10824 +   Copyright (C) 2008 Free Software Foundation, Inc.
10825 +
10826 +   This program is free software: you can redistribute it and/or modify
10827 +   it under the terms of the GNU Lesser General Public License as published by
10828 +   the Free Software Foundation; either version 2.1 of the License, or
10829 +   (at your option) any later version.
10830 +
10831 +   This program is distributed in the hope that it will be useful,
10832 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
10833 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10834 +   GNU Lesser General Public License for more details.
10835 +
10836 +   You should have received a copy of the GNU Lesser General Public License
10837 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
10838 +
10839 +/* Written by Paolo Bonzini */
10840 +
10841 +#include <config.h>
10842 +#include <stdio.h>
10843 +#include <string.h>
10844 +#include <errno.h>
10845 +#include <fcntl.h>
10846 +#include <io.h>
10847 +#include <sys/socket.h>
10848 +
10849 +#undef close
10850 +#undef socket
10851 +#undef connect
10852 +#undef accept
10853 +#undef bind
10854 +#undef getpeername
10855 +#undef getsockname
10856 +#undef getsockopt
10857 +#undef listen
10858 +#undef recv
10859 +#undef send
10860 +#undef recvfrom
10861 +#undef sendto
10862 +#undef setsockopt
10863 +
10864 +# define FD_TO_SOCKET(fd)   ((SOCKET) _get_osfhandle ((fd)))
10865 +# define SOCKET_TO_FD(fh)   (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
10866 +
10867 +
10868 +/* Wrappers for libc functions.  */
10869 +
10870 +int
10871 +rpl_close (int fd)
10872 +{
10873 +  SOCKET sock = FD_TO_SOCKET (fd);
10874 +  WSANETWORKEVENTS ev;
10875 +
10876 +  ev.lNetworkEvents = 0xDEADBEEF;
10877 +  WSAEnumNetworkEvents (sock, NULL, &ev);
10878 +  if (ev.lNetworkEvents != 0xDEADBEEF)
10879 +    {
10880 +      /* FIXME: other applications, like squid, use an undocumented
10881 +        _free_osfhnd free function.  Instead, here we just close twice
10882 +        the file descriptor.  I could not get the former to work
10883 +        (pb, Sep 22 2008).  */
10884 +      int r = closesocket (sock);
10885 +      _close (fd);
10886 +      return r;
10887 +    }
10888 +  else
10889 +    return _close (fd);
10890 +}
10891 +
10892 +
10893 +/* Wrappers for WinSock functions.  */
10894 +
10895 +static inline void
10896 +set_winsock_errno (void)
10897 +{
10898 +  int err = WSAGetLastError ();
10899 +  WSASetLastError (0);
10900 +
10901 +  /* Map some WSAE* errors to the runtime library's error codes.  */
10902 +  switch (err)
10903 +    {
10904 +    case WSA_INVALID_HANDLE:
10905 +      errno = EBADF;
10906 +      break;
10907 +    case WSA_NOT_ENOUGH_MEMORY:
10908 +      errno = ENOMEM;
10909 +      break;
10910 +    case WSA_INVALID_PARAMETER:
10911 +      errno = EINVAL;
10912 +      break;
10913 +    case WSAEWOULDBLOCK:
10914 +      errno = EWOULDBLOCK;
10915 +      break;
10916 +    case WSAENAMETOOLONG:
10917 +      errno = ENAMETOOLONG;
10918 +      break;
10919 +    case WSAENOTEMPTY:
10920 +      errno = ENOTEMPTY;
10921 +      break;
10922 +    default:
10923 +      errno = (err > 10000 && err < 10025) ? err - 10000 : err;
10924 +      break;
10925 +    }
10926 +}
10927 +
10928 +#if GNULIB_SOCKET
10929 +int
10930 +rpl_socket (int domain, int type, int protocol)
10931 +{
10932 +  /* We have to use WSASocket() to create non-overlapped IO sockets.
10933 +     Overlapped IO sockets cannot be used with read/write.  */
10934 +  SOCKET fh = WSASocket (domain, type, protocol, NULL, 0, 0);
10935 +
10936 +  if (fh == INVALID_SOCKET)
10937 +    {
10938 +      set_winsock_errno ();
10939 +      return -1;
10940 +    }
10941 +  else
10942 +    return SOCKET_TO_FD (fh);
10943 +}
10944 +#endif
10945 +
10946 +#if GNULIB_CONNECT
10947 +int
10948 +rpl_connect (int fd, struct sockaddr *sockaddr, int len)
10949 +{
10950 +  SOCKET sock = FD_TO_SOCKET (fd);
10951 +  int r = connect (sock, sockaddr, len);
10952 +  if (r < 0)
10953 +    {
10954 +      /* EINPROGRESS is not returned by WinSock 2.0; for backwards
10955 +        compatibility, connect(2) uses EWOULDBLOCK.  */
10956 +      if (WSAGetLastError () == WSAEWOULDBLOCK)
10957 +        WSASetLastError (WSAEINPROGRESS);
10958 +
10959 +      set_winsock_errno ();
10960 +    }
10961 +
10962 +  return r;
10963 +}
10964 +#endif
10965 +
10966 +#if GNULIB_ACCEPT
10967 +int
10968 +rpl_accept (int fd, struct sockaddr *addr, int *addrlen)
10969 +{
10970 +  SOCKET fh = accept (FD_TO_SOCKET (fd), addr, addrlen);
10971 +  if (fh == INVALID_SOCKET)
10972 +    {
10973 +      set_winsock_errno ();
10974 +      return -1;
10975 +    }
10976 +  else
10977 +    return SOCKET_TO_FD (fh);
10978 +}
10979 +#endif
10980 +
10981 +#if GNULIB_BIND
10982 +int
10983 +rpl_bind (int fd, struct sockaddr *sockaddr, int len)
10984 +{
10985 +  SOCKET sock = FD_TO_SOCKET (fd);
10986 +  int r = bind (sock, sockaddr, len);
10987 +  if (r < 0)
10988 +    set_winsock_errno ();
10989 +
10990 +  return r;
10991 +}
10992 +#endif
10993 +
10994 +#if GNULIB_GETPEERNAME
10995 +int
10996 +rpl_getpeername (int fd, struct sockaddr *addr, int *addrlen)
10997 +{
10998 +  SOCKET sock = FD_TO_SOCKET (fd);
10999 +  int r = getpeername (sock, addr, addrlen);
11000 +  if (r < 0)
11001 +    set_winsock_errno ();
11002 +
11003 +  return r;
11004 +}
11005 +#endif
11006 +
11007 +#if GNULIB_GETSOCKNAME
11008 +int
11009 +rpl_getsockname (int fd, struct sockaddr *addr, int *addrlen)
11010 +{
11011 +  SOCKET sock = FD_TO_SOCKET (fd);
11012 +  int r = getsockname (sock, addr, addrlen);
11013 +  if (r < 0)
11014 +    set_winsock_errno ();
11015 +
11016 +  return r;
11017 +}
11018 +#endif
11019 +
11020 +#if GNULIB_GETSOCKOPT
11021 +int
11022 +rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen)
11023 +{
11024 +  SOCKET sock = FD_TO_SOCKET (fd);
11025 +  int r = getsockopt (sock, level, optname, optval, optlen);
11026 +  if (r < 0)
11027 +    set_winsock_errno ();
11028 +
11029 +  return r;
11030 +}
11031 +#endif
11032 +
11033 +#if GNULIB_LISTEN
11034 +int
11035 +rpl_listen (int fd, int backlog)
11036 +{
11037 +  SOCKET sock = FD_TO_SOCKET (fd);
11038 +  int r = listen (sock, backlog);
11039 +  if (r < 0)
11040 +    set_winsock_errno ();
11041 +
11042 +  return r;
11043 +}
11044 +#endif
11045 +
11046 +int
11047 +rpl_ioctl (int fd, unsigned long req, char *buf)
11048 +{
11049 +  SOCKET sock = FD_TO_SOCKET (fd);
11050 +  int r = ioctlsocket (sock, req, (void *) buf);
11051 +  if (r < 0)
11052 +    set_winsock_errno ();
11053 +
11054 +  return r;
11055 +}
11056 +
11057 +#if GNULIB_RECV
11058 +int
11059 +rpl_recv (int fd, void *buf, int len, int flags)
11060 +{
11061 +  SOCKET sock = FD_TO_SOCKET (fd);
11062 +  int r = recv (sock, buf, len, flags);
11063 +  if (r < 0)
11064 +    set_winsock_errno ();
11065 +
11066 +  return r;
11067 +}
11068 +#endif
11069 +
11070 +#if GNULIB_SEND
11071 +int
11072 +rpl_send (int fd, const void *buf, int len, int flags)
11073 +{
11074 +  SOCKET sock = FD_TO_SOCKET (fd);
11075 +  int r = send (sock, buf, len, flags);
11076 +  if (r < 0)
11077 +    set_winsock_errno ();
11078 +
11079 +  return r;
11080 +}
11081 +#endif
11082 +
11083 +#if GNULIB_RECVFROM
11084 +int
11085 +rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from,
11086 +             int *fromlen)
11087 +{
11088 +  int frombufsize = *fromlen;
11089 +  SOCKET sock = FD_TO_SOCKET (fd);
11090 +  int r = recvfrom (sock, buf, len, flags, from, fromlen);
11091 +
11092 +  if (r < 0)
11093 +    set_winsock_errno ();
11094 +
11095 +  /* Winsock recvfrom() only returns a valid 'from' when the socket is
11096 +     connectionless.  POSIX gives a valid 'from' for all types of sockets.  */
11097 +  else if (*fromlen == frombufsize)
11098 +    rpl_getpeername (fd, from, fromlen);
11099 +
11100 +  return r;
11101 +}
11102 +#endif
11103 +
11104 +#if GNULIB_SENDTO
11105 +int
11106 +rpl_sendto (int fd, const void *buf, int len, int flags,
11107 +           struct sockaddr *to, int tolen)
11108 +{
11109 +  SOCKET sock = FD_TO_SOCKET (fd);
11110 +  int r = sendto (sock, buf, len, flags, to, tolen);
11111 +  if (r < 0)
11112 +    set_winsock_errno ();
11113 +
11114 +  return r;
11115 +}
11116 +#endif
11117 +
11118 +#if GNULIB_SETSOCKOPT
11119 +int
11120 +rpl_setsockopt (int fd, int level, int optname, const void *optval, int optlen)
11121 +{
11122 +  SOCKET sock = FD_TO_SOCKET (fd);
11123 +  int r = setsockopt (sock, level, optname, optval, optlen);
11124 +  if (r < 0)
11125 +    set_winsock_errno ();
11126 +
11127 +  return r;
11128 +}
11129 +#endif
11130 diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/xsize.h gtk-vnc-0.3.7.gnulib/gnulib/lib/xsize.h
11131 --- gtk-vnc-0.3.7.mingw/gnulib/lib/xsize.h      1970-01-01 01:00:00.000000000 +0100
11132 +++ gtk-vnc-0.3.7.gnulib/gnulib/lib/xsize.h     2008-10-09 12:24:39.000000000 +0100
11133 @@ -0,0 +1,108 @@
11134 +/* xsize.h -- Checked size_t computations.
11135 +
11136 +   Copyright (C) 2003, 2008 Free Software Foundation, Inc.
11137 +
11138 +   This program is free software; you can redistribute it and/or modify
11139 +   it under the terms of the GNU Lesser General Public License as published by
11140 +   the Free Software Foundation; either version 2.1, or (at your option)
11141 +   any later version.
11142 +
11143 +   This program is distributed in the hope that it will be useful,
11144 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
11145 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11146 +   GNU Lesser General Public License for more details.
11147 +
11148 +   You should have received a copy of the GNU Lesser General Public License
11149 +   along with this program; if not, write to the Free Software Foundation,
11150 +   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
11151 +
11152 +#ifndef _XSIZE_H
11153 +#define _XSIZE_H
11154 +
11155 +/* Get size_t.  */
11156 +#include <stddef.h>
11157 +
11158 +/* Get SIZE_MAX.  */
11159 +#include <limits.h>
11160 +#if HAVE_STDINT_H
11161 +# include <stdint.h>
11162 +#endif
11163 +
11164 +/* The size of memory objects is often computed through expressions of
11165 +   type size_t. Example:
11166 +      void* p = malloc (header_size + n * element_size).
11167 +   These computations can lead to overflow.  When this happens, malloc()
11168 +   returns a piece of memory that is way too small, and the program then
11169 +   crashes while attempting to fill the memory.
11170 +   To avoid this, the functions and macros in this file check for overflow.
11171 +   The convention is that SIZE_MAX represents overflow.
11172 +   malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc
11173 +   implementation that uses mmap --, it's recommended to use size_overflow_p()
11174 +   or size_in_bounds_p() before invoking malloc().
11175 +   The example thus becomes:
11176 +      size_t size = xsum (header_size, xtimes (n, element_size));
11177 +      void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
11178 +*/
11179 +
11180 +/* Convert an arbitrary value >= 0 to type size_t.  */
11181 +#define xcast_size_t(N) \
11182 +  ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
11183 +
11184 +/* Sum of two sizes, with overflow check.  */
11185 +static inline size_t
11186 +#if __GNUC__ >= 3
11187 +__attribute__ ((__pure__))
11188 +#endif
11189 +xsum (size_t size1, size_t size2)
11190 +{
11191 +  size_t sum = size1 + size2;
11192 +  return (sum >= size1 ? sum : SIZE_MAX);
11193 +}
11194 +
11195 +/* Sum of three sizes, with overflow check.  */
11196 +static inline size_t
11197 +#if __GNUC__ >= 3
11198 +__attribute__ ((__pure__))
11199 +#endif
11200 +xsum3 (size_t size1, size_t size2, size_t size3)
11201 +{
11202 +  return xsum (xsum (size1, size2), size3);
11203 +}
11204 +
11205 +/* Sum of four sizes, with overflow check.  */
11206 +static inline size_t
11207 +#if __GNUC__ >= 3
11208 +__attribute__ ((__pure__))
11209 +#endif
11210 +xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
11211 +{
11212 +  return xsum (xsum (xsum (size1, size2), size3), size4);
11213 +}
11214 +
11215 +/* Maximum of two sizes, with overflow check.  */
11216 +static inline size_t
11217 +#if __GNUC__ >= 3
11218 +__attribute__ ((__pure__))
11219 +#endif
11220 +xmax (size_t size1, size_t size2)
11221 +{
11222 +  /* No explicit check is needed here, because for any n:
11223 +     max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX.  */
11224 +  return (size1 >= size2 ? size1 : size2);
11225 +}
11226 +
11227 +/* Multiplication of a count with an element size, with overflow check.
11228 +   The count must be >= 0 and the element size must be > 0.
11229 +   This is a macro, not an inline function, so that it works correctly even
11230 +   when N is of a wider type and N > SIZE_MAX.  */
11231 +#define xtimes(N, ELSIZE) \
11232 +  ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
11233 +
11234 +/* Check for overflow.  */
11235 +#define size_overflow_p(SIZE) \
11236 +  ((SIZE) == SIZE_MAX)
11237 +/* Check against overflow.  */
11238 +#define size_in_bounds_p(SIZE) \
11239 +  ((SIZE) != SIZE_MAX)
11240 +
11241 +#endif /* _XSIZE_H */
11242 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/alloca.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/alloca.m4
11243 --- gtk-vnc-0.3.7.mingw/gnulib/m4/alloca.m4     1970-01-01 01:00:00.000000000 +0100
11244 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/alloca.m4    2008-10-09 12:24:39.000000000 +0100
11245 @@ -0,0 +1,46 @@
11246 +# alloca.m4 serial 8
11247 +dnl Copyright (C) 2002-2004, 2006, 2007 Free Software Foundation, Inc.
11248 +dnl This file is free software; the Free Software Foundation
11249 +dnl gives unlimited permission to copy and/or distribute it,
11250 +dnl with or without modifications, as long as this notice is preserved.
11251 +
11252 +AC_DEFUN([gl_FUNC_ALLOCA],
11253 +[
11254 +  dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
11255 +  AC_REQUIRE([AC_PROG_CPP])
11256 +  AC_REQUIRE([AC_PROG_EGREP])
11257 +
11258 +  AC_REQUIRE([AC_FUNC_ALLOCA])
11259 +  if test $ac_cv_func_alloca_works = no; then
11260 +    gl_PREREQ_ALLOCA
11261 +  fi
11262 +
11263 +  # Define an additional variable used in the Makefile substitution.
11264 +  if test $ac_cv_working_alloca_h = yes; then
11265 +    AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [
11266 +      AC_EGREP_CPP([Need own alloca], [
11267 +#if defined __GNUC__ || defined _AIX || defined _MSC_VER
11268 +        Need own alloca
11269 +#endif
11270 +        ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no])
11271 +    ])
11272 +    if test $gl_cv_rpl_alloca = yes; then
11273 +      dnl OK, alloca can be implemented through a compiler built-in.
11274 +      AC_DEFINE([HAVE_ALLOCA], 1,
11275 +        [Define to 1 if you have 'alloca' after including <alloca.h>,
11276 +         a header that may be supplied by this distribution.])
11277 +      ALLOCA_H=alloca.h
11278 +    else
11279 +      dnl alloca exists as a library function, i.e. it is slow and probably
11280 +      dnl a memory leak. Don't define HAVE_ALLOCA in this case.
11281 +      ALLOCA_H=
11282 +    fi
11283 +  else
11284 +    ALLOCA_H=alloca.h
11285 +  fi
11286 +  AC_SUBST([ALLOCA_H])
11287 +])
11288 +
11289 +# Prerequisites of lib/alloca.c.
11290 +# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
11291 +AC_DEFUN([gl_PREREQ_ALLOCA], [:])
11292 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/arpa_inet_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/arpa_inet_h.m4
11293 --- gtk-vnc-0.3.7.mingw/gnulib/m4/arpa_inet_h.m4        1970-01-01 01:00:00.000000000 +0100
11294 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/arpa_inet_h.m4       2008-10-09 12:24:39.000000000 +0100
11295 @@ -0,0 +1,50 @@
11296 +# arpa_inet_h.m4 serial 5
11297 +dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc.
11298 +dnl This file is free software; the Free Software Foundation
11299 +dnl gives unlimited permission to copy and/or distribute it,
11300 +dnl with or without modifications, as long as this notice is preserved.
11301 +
11302 +dnl Written by Simon Josefsson and Bruno Haible
11303 +
11304 +AC_DEFUN([gl_HEADER_ARPA_INET],
11305 +[
11306 +  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
11307 +  dnl once only, before all statements that occur in other macros.
11308 +  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
11309 +
11310 +  AC_CHECK_HEADERS_ONCE([arpa/inet.h])
11311 +  if test $ac_cv_header_arpa_inet_h = yes; then
11312 +    HAVE_ARPA_INET_H=1
11313 +  else
11314 +    ARPA_INET_H='arpa/inet.h'
11315 +    HAVE_ARPA_INET_H=0
11316 +  fi
11317 +  AC_SUBST([HAVE_ARPA_INET_H])
11318 +  dnl Execute this unconditionally, because ARPA_INET_H may be set by other
11319 +  dnl modules, after this code is executed.
11320 +  gl_CHECK_NEXT_HEADERS([arpa/inet.h])
11321 +])
11322 +
11323 +dnl Unconditionally enables the replacement of <arpa/inet.h>.
11324 +AC_DEFUN([gl_REPLACE_ARPA_INET_H],
11325 +[
11326 +  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
11327 +  ARPA_INET_H='arpa/inet.h'
11328 +])
11329 +
11330 +AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
11331 +[
11332 +  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
11333 +  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
11334 +  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
11335 +])
11336 +
11337 +AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
11338 +[
11339 +  GNULIB_INET_NTOP=0;     AC_SUBST([GNULIB_INET_NTOP])
11340 +  GNULIB_INET_PTON=0;     AC_SUBST([GNULIB_INET_PTON])
11341 +  dnl Assume proper GNU behavior unless another module says otherwise.
11342 +  HAVE_DECL_INET_NTOP=1;  AC_SUBST([HAVE_DECL_INET_NTOP])
11343 +  HAVE_DECL_INET_PTON=1;  AC_SUBST([HAVE_DECL_INET_PTON])
11344 +  ARPA_INET_H='';         AC_SUBST([ARPA_INET_H])
11345 +])
11346 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/errno_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/errno_h.m4
11347 --- gtk-vnc-0.3.7.mingw/gnulib/m4/errno_h.m4    1970-01-01 01:00:00.000000000 +0100
11348 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/errno_h.m4   2008-10-09 12:24:39.000000000 +0100
11349 @@ -0,0 +1,113 @@
11350 +# errno_h.m4 serial 1
11351 +dnl Copyright (C) 2004, 2006, 2008 Free Software Foundation, Inc.
11352 +dnl This file is free software; the Free Software Foundation
11353 +dnl gives unlimited permission to copy and/or distribute it,
11354 +dnl with or without modifications, as long as this notice is preserved.
11355 +
11356 +AC_DEFUN([gl_HEADER_ERRNO_H],
11357 +[
11358 +  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
11359 +  dnl once only, before all statements that occur in other macros.
11360 +  AC_REQUIRE([gl_HEADER_ERRNO_H_BODY])
11361 +])
11362 +
11363 +AC_DEFUN([gl_HEADER_ERRNO_H_BODY],
11364 +[
11365 +  AC_REQUIRE([AC_PROG_CC])
11366 +  AC_CACHE_CHECK([for complete errno.h], gl_cv_header_errno_h_complete, [
11367 +    AC_EGREP_CPP(booboo,[
11368 +#include <errno.h>
11369 +#if !defined ENOMSG
11370 +booboo
11371 +#endif
11372 +#if !defined EIDRM
11373 +booboo
11374 +#endif
11375 +#if !defined ENOLINK
11376 +booboo
11377 +#endif
11378 +#if !defined EPROTO
11379 +booboo
11380 +#endif
11381 +#if !defined EMULTIHOP
11382 +booboo
11383 +#endif
11384 +#if !defined EBADMSG
11385 +booboo
11386 +#endif
11387 +#if !defined EOVERFLOW
11388 +booboo
11389 +#endif
11390 +#if !defined ENOTSUP
11391 +booboo
11392 +#endif
11393 +#if !defined ECANCELED
11394 +booboo
11395 +#endif
11396 +      ],
11397 +      [gl_cv_header_errno_h_complete=no],
11398 +      [gl_cv_header_errno_h_complete=yes])
11399 +  ])
11400 +  if test $gl_cv_header_errno_h_complete = yes; then
11401 +    ERRNO_H=''
11402 +  else
11403 +    gl_CHECK_NEXT_HEADERS([errno.h])
11404 +    ERRNO_H='errno.h'
11405 +  fi
11406 +  AC_SUBST([ERRNO_H])
11407 +  gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
11408 +  gl_REPLACE_ERRNO_VALUE([ENOLINK])
11409 +  gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
11410 +])
11411 +
11412 +# Assuming $1 = EOVERFLOW.
11413 +# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
11414 +# POSIX.  But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
11415 +# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
11416 +# Check for the value of EOVERFLOW.
11417 +# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
11418 +AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
11419 +[
11420 +  if test -n "$ERRNO_H"; then
11421 +    AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
11422 +      AC_EGREP_CPP(yes,[
11423 +#include <errno.h>
11424 +#ifdef ]$1[
11425 +yes
11426 +#endif
11427 +      ],
11428 +      [gl_cv_header_errno_h_]$1[=yes],
11429 +      [gl_cv_header_errno_h_]$1[=no])
11430 +      if test $gl_cv_header_errno_h_]$1[ = no; then
11431 +        AC_EGREP_CPP(yes,[
11432 +#define _XOPEN_SOURCE_EXTENDED 1
11433 +#include <errno.h>
11434 +#ifdef ]$1[
11435 +yes
11436 +#endif
11437 +          ], [gl_cv_header_errno_h_]$1[=hidden])
11438 +        if test $gl_cv_header_errno_h_]$1[ = hidden; then
11439 +          dnl The macro exists but is hidden.
11440 +          dnl Define it to the same value.
11441 +          AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
11442 +#define _XOPEN_SOURCE_EXTENDED 1
11443 +#include <errno.h>
11444 +/* The following two lines are a workaround against an autoconf-2.52 bug.  */
11445 +#include <stdio.h>
11446 +#include <stdlib.h>
11447 +])
11448 +        fi
11449 +      fi
11450 +    ])
11451 +    case $gl_cv_header_errno_h_]$1[ in
11452 +      yes | no)
11453 +        ]$1[_HIDDEN=0; ]$1[_VALUE=
11454 +        ;;
11455 +      *)
11456 +        ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
11457 +        ;;
11458 +    esac
11459 +    AC_SUBST($1[_HIDDEN])
11460 +    AC_SUBST($1[_VALUE])
11461 +  fi
11462 +])
11463 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/extensions.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/extensions.m4
11464 --- gtk-vnc-0.3.7.mingw/gnulib/m4/extensions.m4 1970-01-01 01:00:00.000000000 +0100
11465 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/extensions.m4        2008-10-09 12:24:39.000000000 +0100
11466 @@ -0,0 +1,82 @@
11467 +# serial 5  -*- Autoconf -*-
11468 +# Enable extensions on systems that normally disable them.
11469 +
11470 +# Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc.
11471 +# This file is free software; the Free Software Foundation
11472 +# gives unlimited permission to copy and/or distribute it,
11473 +# with or without modifications, as long as this notice is preserved.
11474 +
11475 +# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
11476 +# Autoconf.  Perhaps we can remove this once we can assume Autoconf
11477 +# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
11478 +# enough in this area it's likely we'll need to redefine
11479 +# AC_USE_SYSTEM_EXTENSIONS for quite some time.
11480 +
11481 +# AC_USE_SYSTEM_EXTENSIONS
11482 +# ------------------------
11483 +# Enable extensions on systems that normally disable them,
11484 +# typically due to standards-conformance issues.
11485 +# Remember that #undef in AH_VERBATIM gets replaced with #define by
11486 +# AC_DEFINE.  The goal here is to define all known feature-enabling
11487 +# macros, then, if reports of conflicts are made, disable macros that
11488 +# cause problems on some platforms (such as __EXTENSIONS__).
11489 +AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
11490 +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
11491 +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
11492 +
11493 +  AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
11494 +  if test "$MINIX" = yes; then
11495 +    AC_DEFINE([_POSIX_SOURCE], [1],
11496 +      [Define to 1 if you need to in order for `stat' and other
11497 +       things to work.])
11498 +    AC_DEFINE([_POSIX_1_SOURCE], [2],
11499 +      [Define to 2 if the system does not provide POSIX.1 features
11500 +       except with this defined.])
11501 +    AC_DEFINE([_MINIX], [1],
11502 +      [Define to 1 if on MINIX.])
11503 +  fi
11504 +
11505 +  AH_VERBATIM([__EXTENSIONS__],
11506 +[/* Enable extensions on AIX 3, Interix.  */
11507 +#ifndef _ALL_SOURCE
11508 +# undef _ALL_SOURCE
11509 +#endif
11510 +/* Enable GNU extensions on systems that have them.  */
11511 +#ifndef _GNU_SOURCE
11512 +# undef _GNU_SOURCE
11513 +#endif
11514 +/* Enable threading extensions on Solaris.  */
11515 +#ifndef _POSIX_PTHREAD_SEMANTICS
11516 +# undef _POSIX_PTHREAD_SEMANTICS
11517 +#endif
11518 +/* Enable extensions on HP NonStop.  */
11519 +#ifndef _TANDEM_SOURCE
11520 +# undef _TANDEM_SOURCE
11521 +#endif
11522 +/* Enable general extensions on Solaris.  */
11523 +#ifndef __EXTENSIONS__
11524 +# undef __EXTENSIONS__
11525 +#endif
11526 +])
11527 +  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
11528 +    [ac_cv_safe_to_define___extensions__],
11529 +    [AC_COMPILE_IFELSE(
11530 +       [AC_LANG_PROGRAM([[
11531 +#        define __EXTENSIONS__ 1
11532 +         ]AC_INCLUDES_DEFAULT])],
11533 +       [ac_cv_safe_to_define___extensions__=yes],
11534 +       [ac_cv_safe_to_define___extensions__=no])])
11535 +  test $ac_cv_safe_to_define___extensions__ = yes &&
11536 +    AC_DEFINE([__EXTENSIONS__])
11537 +  AC_DEFINE([_ALL_SOURCE])
11538 +  AC_DEFINE([_GNU_SOURCE])
11539 +  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
11540 +  AC_DEFINE([_TANDEM_SOURCE])
11541 +])# AC_USE_SYSTEM_EXTENSIONS
11542 +
11543 +# gl_USE_SYSTEM_EXTENSIONS
11544 +# ------------------------
11545 +# Enable extensions on systems that normally disable them,
11546 +# typically due to standards-conformance issues.
11547 +AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
11548 +  [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
11549 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/float_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/float_h.m4
11550 --- gtk-vnc-0.3.7.mingw/gnulib/m4/float_h.m4    1970-01-01 01:00:00.000000000 +0100
11551 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/float_h.m4   2008-10-09 12:24:39.000000000 +0100
11552 @@ -0,0 +1,19 @@
11553 +# float_h.m4 serial 3
11554 +dnl Copyright (C) 2007 Free Software Foundation, Inc.
11555 +dnl This file is free software; the Free Software Foundation
11556 +dnl gives unlimited permission to copy and/or distribute it,
11557 +dnl with or without modifications, as long as this notice is preserved.
11558 +
11559 +AC_DEFUN([gl_FLOAT_H],
11560 +[
11561 +  AC_REQUIRE([AC_PROG_CC])
11562 +  AC_REQUIRE([AC_CANONICAL_HOST])
11563 +  FLOAT_H=
11564 +  case "$host_os" in
11565 +    beos* | openbsd*)
11566 +      FLOAT_H=float.h
11567 +      gl_CHECK_NEXT_HEADERS([float.h])
11568 +      ;;
11569 +  esac
11570 +  AC_SUBST([FLOAT_H])
11571 +])
11572 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/getaddrinfo.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/getaddrinfo.m4
11573 --- gtk-vnc-0.3.7.mingw/gnulib/m4/getaddrinfo.m4        1970-01-01 01:00:00.000000000 +0100
11574 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/getaddrinfo.m4       2008-10-09 12:24:39.000000000 +0100
11575 @@ -0,0 +1,130 @@
11576 +# getaddrinfo.m4 serial 15
11577 +dnl Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
11578 +dnl This file is free software; the Free Software Foundation
11579 +dnl gives unlimited permission to copy and/or distribute it,
11580 +dnl with or without modifications, as long as this notice is preserved.
11581 +
11582 +AC_DEFUN([gl_GETADDRINFO],
11583 +[
11584 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
11585 +  AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo])
11586 +
11587 +  AC_CHECK_HEADERS_ONCE(netdb.h)
11588 +
11589 +  AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
11590 +  AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
11591 +    AC_TRY_LINK([
11592 +#include <sys/types.h>
11593 +#ifdef HAVE_SYS_SOCKET_H
11594 +#include <sys/socket.h>
11595 +#endif
11596 +#ifdef HAVE_NETDB_H
11597 +#include <netdb.h>
11598 +#endif
11599 +#include <stddef.h>
11600 +], [getaddrinfo("", "", NULL, NULL);],
11601 +      [gl_cv_func_getaddrinfo=yes],
11602 +      [gl_cv_func_getaddrinfo=no])])
11603 +  if test $gl_cv_func_getaddrinfo = no; then
11604 +    AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
11605 +                  gl_cv_w32_getaddrinfo, [
11606 +      gl_cv_w32_getaddrinfo=no
11607 +      am_save_LIBS="$LIBS"
11608 +      LIBS="$LIBS -lws2_32"
11609 +      AC_TRY_LINK([
11610 +#ifdef HAVE_WS2TCPIP_H
11611 +#include <ws2tcpip.h>
11612 +#endif
11613 +#include <stddef.h>
11614 +], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes)
11615 +    LIBS="$am_save_LIBS"])
11616 +    if test "$gl_cv_w32_getaddrinfo" = "yes"; then
11617 +      LIBS="$LIBS -lws2_32"
11618 +    else
11619 +      AC_LIBOBJ(getaddrinfo)
11620 +    fi
11621 +  fi
11622 +
11623 +  # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
11624 +  # inline function declared in ws2tcpip.h, so we need to get that
11625 +  # header included somehow.
11626 +  AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
11627 +    gl_cv_func_gai_strerror, [
11628 +      AC_TRY_LINK([
11629 +#include <sys/types.h>
11630 +#ifdef HAVE_SYS_SOCKET_H
11631 +#include <sys/socket.h>
11632 +#endif
11633 +#ifdef HAVE_NETDB_H
11634 +#include <netdb.h>
11635 +#endif
11636 +#ifdef HAVE_WS2TCPIP_H
11637 +#include <ws2tcpip.h>
11638 +#endif
11639 +#include <stddef.h>
11640 +], [gai_strerror (NULL);],
11641 +        [gl_cv_func_gai_strerror=yes],
11642 +        [gl_cv_func_gai_strerror=no])])
11643 +  if test $gl_cv_func_gai_strerror = no; then
11644 +    AC_LIBOBJ(gai_strerror)
11645 +  fi
11646 +
11647 +  gl_PREREQ_GETADDRINFO
11648 +])
11649 +
11650 +# Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c.
11651 +AC_DEFUN([gl_PREREQ_GETADDRINFO], [
11652 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
11653 +  AC_SEARCH_LIBS(gethostbyname, [inet nsl])
11654 +  AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
11655 +  AC_CHECK_FUNCS(gethostbyname,, [
11656 +    AC_CACHE_CHECK(for gethostbyname in winsock2.h and -lws2_32,
11657 +                  gl_cv_w32_gethostbyname, [
11658 +      gl_cv_w32_gethostbyname=no
11659 +      am_save_LIBS="$LIBS"
11660 +      LIBS="$LIBS -lws2_32"
11661 +      AC_TRY_LINK([
11662 +#ifdef HAVE_WINSOCK2_H
11663 +#include <winsock2.h>
11664 +#endif
11665 +#include <stddef.h>
11666 +], [gethostbyname(NULL);], gl_cv_w32_gethostbyname=yes)
11667 +    LIBS="$am_save_LIBS"])
11668 +    if test "$gl_cv_w32_gethostbyname" = "yes"; then
11669 +      LIBS="$LIBS -lws2_32"
11670 +    fi
11671 +    ])
11672 +  AC_REQUIRE([AC_C_RESTRICT])
11673 +  AC_REQUIRE([gl_SOCKET_FAMILIES])
11674 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
11675 +  AC_REQUIRE([AC_C_INLINE])
11676 +  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
11677 +  AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h)
11678 +  AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
11679 +  /* sys/types.h is not needed according to POSIX, but the
11680 +     sys/socket.h in i386-unknown-freebsd4.10 and
11681 +     powerpc-apple-darwin5.5 required it. */
11682 +#include <sys/types.h>
11683 +#ifdef HAVE_SYS_SOCKET_H
11684 +#include <sys/socket.h>
11685 +#endif
11686 +#ifdef HAVE_NETDB_H
11687 +#include <netdb.h>
11688 +#endif
11689 +#ifdef HAVE_WS2TCPIP_H
11690 +#include <ws2tcpip.h>
11691 +#endif
11692 +])
11693 +  AC_CHECK_TYPES([struct addrinfo],,,[
11694 +#include <sys/types.h>
11695 +#ifdef HAVE_SYS_SOCKET_H
11696 +#include <sys/socket.h>
11697 +#endif
11698 +#ifdef HAVE_NETDB_H
11699 +#include <netdb.h>
11700 +#endif
11701 +#ifdef HAVE_WS2TCPIP_H
11702 +#include <ws2tcpip.h>
11703 +#endif
11704 +])
11705 +])
11706 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-cache.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-cache.m4
11707 --- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-cache.m4       1970-01-01 01:00:00.000000000 +0100
11708 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-cache.m4      2008-10-09 12:33:42.000000000 +0100
11709 @@ -0,0 +1,42 @@
11710 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
11711 +#
11712 +# This file is free software, distributed under the terms of the GNU
11713 +# General Public License.  As a special exception to the GNU General
11714 +# Public License, this file may be distributed as part of a program
11715 +# that contains a configuration script generated by Autoconf, under
11716 +# the same distribution terms as the rest of that program.
11717 +#
11718 +# Generated by gnulib-tool.
11719 +#
11720 +# This file represents the specification of how gnulib-tool is used.
11721 +# It acts as a cache: It is written and read by gnulib-tool.
11722 +# In projects using CVS, this file is meant to be stored in CVS,
11723 +# like the configure.ac and various Makefile.am files.
11724 +
11725 +
11726 +# Specification in the form of a command-line invocation:
11727 +#   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 recv send socket vc-list-files
11728 +
11729 +# Specification in the form of a few gnulib-tool.m4 macro invocations:
11730 +gl_LOCAL_DIR([])
11731 +gl_MODULES([
11732 +  connect
11733 +  getaddrinfo
11734 +  recv
11735 +  send
11736 +  socket
11737 +  vc-list-files
11738 +])
11739 +gl_AVOID([])
11740 +gl_SOURCE_BASE([gnulib/lib])
11741 +gl_M4_BASE([gnulib/m4])
11742 +gl_PO_BASE([])
11743 +gl_DOC_BASE([doc])
11744 +gl_TESTS_BASE([gnulib/tests])
11745 +gl_WITH_TESTS
11746 +gl_LIB([libgnu])
11747 +gl_LGPL([2])
11748 +gl_MAKEFILE_NAME([])
11749 +gl_LIBTOOL
11750 +gl_MACRO_PREFIX([gl])
11751 +gl_PO_DOMAIN([])
11752 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-cache.m4~ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-cache.m4~
11753 --- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-cache.m4~      1970-01-01 01:00:00.000000000 +0100
11754 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-cache.m4~     2008-10-09 12:24:40.000000000 +0100
11755 @@ -0,0 +1,38 @@
11756 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
11757 +#
11758 +# This file is free software, distributed under the terms of the GNU
11759 +# General Public License.  As a special exception to the GNU General
11760 +# Public License, this file may be distributed as part of a program
11761 +# that contains a configuration script generated by Autoconf, under
11762 +# the same distribution terms as the rest of that program.
11763 +#
11764 +# Generated by gnulib-tool.
11765 +#
11766 +# This file represents the specification of how gnulib-tool is used.
11767 +# It acts as a cache: It is written and read by gnulib-tool.
11768 +# In projects using CVS, this file is meant to be stored in CVS,
11769 +# like the configure.ac and various Makefile.am files.
11770 +
11771 +
11772 +# Specification in the form of a command-line invocation:
11773 +#   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 getaddrinfo vc-list-files
11774 +
11775 +# Specification in the form of a few gnulib-tool.m4 macro invocations:
11776 +gl_LOCAL_DIR([])
11777 +gl_MODULES([
11778 +  getaddrinfo
11779 +  vc-list-files
11780 +])
11781 +gl_AVOID([])
11782 +gl_SOURCE_BASE([gnulib/lib])
11783 +gl_M4_BASE([gnulib/m4])
11784 +gl_PO_BASE([])
11785 +gl_DOC_BASE([doc])
11786 +gl_TESTS_BASE([gnulib/tests])
11787 +gl_WITH_TESTS
11788 +gl_LIB([libgnu])
11789 +gl_LGPL([2])
11790 +gl_MAKEFILE_NAME([])
11791 +gl_LIBTOOL
11792 +gl_MACRO_PREFIX([gl])
11793 +gl_PO_DOMAIN([])
11794 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-common.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-common.m4
11795 --- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-common.m4      1970-01-01 01:00:00.000000000 +0100
11796 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-common.m4     2008-10-09 12:24:39.000000000 +0100
11797 @@ -0,0 +1,91 @@
11798 +# gnulib-common.m4 serial 5
11799 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
11800 +dnl This file is free software; the Free Software Foundation
11801 +dnl gives unlimited permission to copy and/or distribute it,
11802 +dnl with or without modifications, as long as this notice is preserved.
11803 +
11804 +# gl_COMMON
11805 +# is expanded unconditionally through gnulib-tool magic.
11806 +AC_DEFUN([gl_COMMON], [
11807 +  dnl Use AC_REQUIRE here, so that the code is expanded once only.
11808 +  AC_REQUIRE([gl_COMMON_BODY])
11809 +])
11810 +AC_DEFUN([gl_COMMON_BODY], [
11811 +  AH_VERBATIM([isoc99_inline],
11812 +[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
11813 +   the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
11814 +   earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
11815 +   __APPLE__ && __MACH__ test for MacOS X.
11816 +   __APPLE_CC__ tests for the Apple compiler and its version.
11817 +   __STDC_VERSION__ tests for the C99 mode.  */
11818 +#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
11819 +# define __GNUC_STDC_INLINE__ 1
11820 +#endif])
11821 +])
11822 +
11823 +# gl_MODULE_INDICATOR([modulename])
11824 +# defines a C macro indicating the presence of the given module.
11825 +AC_DEFUN([gl_MODULE_INDICATOR],
11826 +[
11827 +  AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
11828 +    [Define to 1 when using the gnulib module ]$1[.])
11829 +])
11830 +
11831 +# m4_foreach_w
11832 +# is a backport of autoconf-2.59c's m4_foreach_w.
11833 +# Remove this macro when we can assume autoconf >= 2.60.
11834 +m4_ifndef([m4_foreach_w],
11835 +  [m4_define([m4_foreach_w],
11836 +    [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
11837 +
11838 +# AC_PROG_MKDIR_P
11839 +# is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
11840 +# Remove this macro when we can assume autoconf >= 2.60.
11841 +m4_ifdef([AC_PROG_MKDIR_P], [], [
11842 +  AC_DEFUN([AC_PROG_MKDIR_P],
11843 +    [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
11844 +     MKDIR_P='$(mkdir_p)'
11845 +     AC_SUBST([MKDIR_P])])])
11846 +
11847 +# AC_C_RESTRICT
11848 +# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
11849 +# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
11850 +# works.
11851 +# This definition can be removed once autoconf >= 2.62 can be assumed.
11852 +AC_DEFUN([AC_C_RESTRICT],
11853 +[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
11854 +  [ac_cv_c_restrict=no
11855 +   # The order here caters to the fact that C++ does not require restrict.
11856 +   for ac_kw in __restrict __restrict__ _Restrict restrict; do
11857 +     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
11858 +      [[typedef int * int_ptr;
11859 +       int foo (int_ptr $ac_kw ip) {
11860 +       return ip[0];
11861 +       }]],
11862 +      [[int s[1];
11863 +       int * $ac_kw t = s;
11864 +       t[0] = 0;
11865 +       return foo(t)]])],
11866 +      [ac_cv_c_restrict=$ac_kw])
11867 +     test "$ac_cv_c_restrict" != no && break
11868 +   done
11869 +  ])
11870 + AH_VERBATIM([restrict],
11871 +[/* Define to the equivalent of the C99 'restrict' keyword, or to
11872 +   nothing if this is not supported.  Do not define if restrict is
11873 +   supported directly.  */
11874 +#undef restrict
11875 +/* Work around a bug in Sun C++: it does not support _Restrict, even
11876 +   though the corresponding Sun C compiler does, which causes
11877 +   "#define restrict _Restrict" in the previous line.  Perhaps some future
11878 +   version of Sun C++ will work with _Restrict; if so, it'll probably
11879 +   define __RESTRICT, just as Sun C does.  */
11880 +#if defined __SUNPRO_CC && !defined __RESTRICT
11881 +# define _Restrict
11882 +#endif])
11883 + case $ac_cv_c_restrict in
11884 +   restrict) ;;
11885 +   no) AC_DEFINE([restrict], []) ;;
11886 +   *)  AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
11887 + esac
11888 +])
11889 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-comp.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-comp.m4
11890 --- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-comp.m4        1970-01-01 01:00:00.000000000 +0100
11891 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-comp.m4       2008-10-09 12:33:42.000000000 +0100
11892 @@ -0,0 +1,300 @@
11893 +# DO NOT EDIT! GENERATED AUTOMATICALLY!
11894 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
11895 +#
11896 +# This file is free software, distributed under the terms of the GNU
11897 +# General Public License.  As a special exception to the GNU General
11898 +# Public License, this file may be distributed as part of a program
11899 +# that contains a configuration script generated by Autoconf, under
11900 +# the same distribution terms as the rest of that program.
11901 +#
11902 +# Generated by gnulib-tool.
11903 +#
11904 +# This file represents the compiled summary of the specification in
11905 +# gnulib-cache.m4. It lists the computed macro invocations that need
11906 +# to be invoked from configure.ac.
11907 +# In projects using CVS, this file can be treated like other built files.
11908 +
11909 +
11910 +# This macro should be invoked from ./configure.ac, in the section
11911 +# "Checks for programs", right after AC_PROG_CC, and certainly before
11912 +# any checks for libraries, header files, types and library functions.
11913 +AC_DEFUN([gl_EARLY],
11914 +[
11915 +  m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
11916 +  m4_pattern_allow([^gl_ES$])dnl a valid locale name
11917 +  m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
11918 +  m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
11919 +  AC_REQUIRE([AC_PROG_RANLIB])
11920 +  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
11921 +])
11922 +
11923 +# This macro should be invoked from ./configure.ac, in the section
11924 +# "Check for header files, types and library functions".
11925 +AC_DEFUN([gl_INIT],
11926 +[
11927 +  AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
11928 +  gl_cond_libtool=true
11929 +  m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
11930 +  m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
11931 +  m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
11932 +  m4_pushdef([gl_LIBSOURCES_LIST], [])
11933 +  m4_pushdef([gl_LIBSOURCES_DIR], [])
11934 +  gl_COMMON
11935 +  gl_source_base='gnulib/lib'
11936 +  gl_FUNC_ALLOCA
11937 +  gl_HEADER_ARPA_INET
11938 +  AC_PROG_MKDIR_P
11939 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
11940 +  if test "$ac_cv_header_winsock2_h" = yes; then
11941 +    AC_LIBOBJ([winsock])
11942 +  fi
11943 +  gl_SYS_SOCKET_MODULE_INDICATOR([connect])
11944 +  gl_HEADER_ERRNO_H
11945 +  gl_FLOAT_H
11946 +  gl_GETADDRINFO
11947 +  AC_SUBST([LIBINTL])
11948 +  AC_SUBST([LTLIBINTL])
11949 +  gl_INET_NTOP
11950 +  gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
11951 +  gl_HEADER_NETINET_IN
11952 +  AC_PROG_MKDIR_P
11953 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
11954 +  if test "$ac_cv_header_winsock2_h" = yes; then
11955 +    AC_LIBOBJ([winsock])
11956 +  fi
11957 +  gl_SYS_SOCKET_MODULE_INDICATOR([recv])
11958 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
11959 +  if test "$ac_cv_header_winsock2_h" = yes; then
11960 +    AC_LIBOBJ([winsock])
11961 +  fi
11962 +  gl_SYS_SOCKET_MODULE_INDICATOR([send])
11963 +  gl_SIZE_MAX
11964 +  gl_FUNC_SNPRINTF
11965 +  gl_STDIO_MODULE_INDICATOR([snprintf])
11966 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
11967 +  if test "$ac_cv_header_winsock2_h" = yes; then
11968 +    AC_LIBOBJ([winsock])
11969 +  fi
11970 +  gl_SYS_SOCKET_MODULE_INDICATOR([socket])
11971 +  gl_TYPE_SOCKLEN_T
11972 +  AM_STDBOOL_H
11973 +  gl_STDINT_H
11974 +  gl_STDIO_H
11975 +  gl_HEADER_SYS_SOCKET
11976 +  AC_PROG_MKDIR_P
11977 +  gl_FUNC_VASNPRINTF
11978 +  gl_WCHAR_H
11979 +  gl_XSIZE
11980 +  m4_ifval(gl_LIBSOURCES_LIST, [
11981 +    m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
11982 +      for gl_file in ]gl_LIBSOURCES_LIST[ ; do
11983 +        if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then
11984 +          echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2
11985 +          exit 1
11986 +        fi
11987 +      done])dnl
11988 +      m4_if(m4_sysval, [0], [],
11989 +        [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
11990 +  ])
11991 +  m4_popdef([gl_LIBSOURCES_DIR])
11992 +  m4_popdef([gl_LIBSOURCES_LIST])
11993 +  m4_popdef([AC_LIBSOURCES])
11994 +  m4_popdef([AC_REPLACE_FUNCS])
11995 +  m4_popdef([AC_LIBOBJ])
11996 +  AC_CONFIG_COMMANDS_PRE([
11997 +    gl_libobjs=
11998 +    gl_ltlibobjs=
11999 +    if test -n "$gl_LIBOBJS"; then
12000 +      # Remove the extension.
12001 +      sed_drop_objext='s/\.o$//;s/\.obj$//'
12002 +      for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
12003 +        gl_libobjs="$gl_libobjs $i.$ac_objext"
12004 +        gl_ltlibobjs="$gl_ltlibobjs $i.lo"
12005 +      done
12006 +    fi
12007 +    AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
12008 +    AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
12009 +  ])
12010 +  gltests_libdeps=
12011 +  gltests_ltlibdeps=
12012 +  m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
12013 +  m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
12014 +  m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
12015 +  m4_pushdef([gltests_LIBSOURCES_LIST], [])
12016 +  m4_pushdef([gltests_LIBSOURCES_DIR], [])
12017 +  gl_COMMON
12018 +  gl_source_base='gnulib/tests'
12019 +  gt_TYPE_WCHAR_T
12020 +  gt_TYPE_WINT_T
12021 +  AC_CHECK_FUNCS([shutdown])
12022 +  abs_aux_dir=`cd "$ac_aux_dir"; pwd`
12023 +  AC_SUBST([abs_aux_dir])
12024 +  m4_ifval(gltests_LIBSOURCES_LIST, [
12025 +    m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
12026 +      for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
12027 +        if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then
12028 +          echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2
12029 +          exit 1
12030 +        fi
12031 +      done])dnl
12032 +      m4_if(m4_sysval, [0], [],
12033 +        [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
12034 +  ])
12035 +  m4_popdef([gltests_LIBSOURCES_DIR])
12036 +  m4_popdef([gltests_LIBSOURCES_LIST])
12037 +  m4_popdef([AC_LIBSOURCES])
12038 +  m4_popdef([AC_REPLACE_FUNCS])
12039 +  m4_popdef([AC_LIBOBJ])
12040 +  AC_CONFIG_COMMANDS_PRE([
12041 +    gltests_libobjs=
12042 +    gltests_ltlibobjs=
12043 +    if test -n "$gltests_LIBOBJS"; then
12044 +      # Remove the extension.
12045 +      sed_drop_objext='s/\.o$//;s/\.obj$//'
12046 +      for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
12047 +        gltests_libobjs="$gltests_libobjs $i.$ac_objext"
12048 +        gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
12049 +      done
12050 +    fi
12051 +    AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
12052 +    AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
12053 +  ])
12054 +  LIBTESTS_LIBDEPS="$gltests_libdeps"
12055 +  AC_SUBST([LIBTESTS_LIBDEPS])
12056 +])
12057 +
12058 +# Like AC_LIBOBJ, except that the module name goes
12059 +# into gl_LIBOBJS instead of into LIBOBJS.
12060 +AC_DEFUN([gl_LIBOBJ], [
12061 +  AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl
12062 +  gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
12063 +])
12064 +
12065 +# Like AC_REPLACE_FUNCS, except that the module name goes
12066 +# into gl_LIBOBJS instead of into LIBOBJS.
12067 +AC_DEFUN([gl_REPLACE_FUNCS], [
12068 +  m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
12069 +  AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])
12070 +])
12071 +
12072 +# Like AC_LIBSOURCES, except the directory where the source file is
12073 +# expected is derived from the gnulib-tool parameterization,
12074 +# and alloca is special cased (for the alloca-opt module).
12075 +# We could also entirely rely on EXTRA_lib..._SOURCES.
12076 +AC_DEFUN([gl_LIBSOURCES], [
12077 +  m4_foreach([_gl_NAME], [$1], [
12078 +    m4_if(_gl_NAME, [alloca.c], [], [
12079 +      m4_define([gl_LIBSOURCES_DIR], [gnulib/lib])
12080 +      m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ])
12081 +    ])
12082 +  ])
12083 +])
12084 +
12085 +# Like AC_LIBOBJ, except that the module name goes
12086 +# into gltests_LIBOBJS instead of into LIBOBJS.
12087 +AC_DEFUN([gltests_LIBOBJ], [
12088 +  AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl
12089 +  gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext"
12090 +])
12091 +
12092 +# Like AC_REPLACE_FUNCS, except that the module name goes
12093 +# into gltests_LIBOBJS instead of into LIBOBJS.
12094 +AC_DEFUN([gltests_REPLACE_FUNCS], [
12095 +  m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
12096 +  AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)])
12097 +])
12098 +
12099 +# Like AC_LIBSOURCES, except the directory where the source file is
12100 +# expected is derived from the gnulib-tool parameterization,
12101 +# and alloca is special cased (for the alloca-opt module).
12102 +# We could also entirely rely on EXTRA_lib..._SOURCES.
12103 +AC_DEFUN([gltests_LIBSOURCES], [
12104 +  m4_foreach([_gl_NAME], [$1], [
12105 +    m4_if(_gl_NAME, [alloca.c], [], [
12106 +      m4_define([gltests_LIBSOURCES_DIR], [gnulib/tests])
12107 +      m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ])
12108 +    ])
12109 +  ])
12110 +])
12111 +
12112 +# This macro records the list of files which have been installed by
12113 +# gnulib-tool and may be removed by future gnulib-tool invocations.
12114 +AC_DEFUN([gl_FILE_LIST], [
12115 +  build-aux/link-warning.h
12116 +  build-aux/vc-list-files
12117 +  lib/alloca.in.h
12118 +  lib/arpa_inet.in.h
12119 +  lib/asnprintf.c
12120 +  lib/dummy.c
12121 +  lib/errno.in.h
12122 +  lib/float+.h
12123 +  lib/float.in.h
12124 +  lib/gai_strerror.c
12125 +  lib/getaddrinfo.c
12126 +  lib/getaddrinfo.h
12127 +  lib/gettext.h
12128 +  lib/inet_ntop.c
12129 +  lib/netinet_in.in.h
12130 +  lib/printf-args.c
12131 +  lib/printf-args.h
12132 +  lib/printf-parse.c
12133 +  lib/printf-parse.h
12134 +  lib/size_max.h
12135 +  lib/snprintf.c
12136 +  lib/stdbool.in.h
12137 +  lib/stdint.in.h
12138 +  lib/stdio-write.c
12139 +  lib/stdio.in.h
12140 +  lib/sys_socket.in.h
12141 +  lib/vasnprintf.c
12142 +  lib/vasnprintf.h
12143 +  lib/wchar.in.h
12144 +  lib/winsock.c
12145 +  lib/xsize.h
12146 +  m4/alloca.m4
12147 +  m4/arpa_inet_h.m4
12148 +  m4/errno_h.m4
12149 +  m4/extensions.m4
12150 +  m4/float_h.m4
12151 +  m4/getaddrinfo.m4
12152 +  m4/gnulib-common.m4
12153 +  m4/include_next.m4
12154 +  m4/inet_ntop.m4
12155 +  m4/intmax_t.m4
12156 +  m4/inttypes_h.m4
12157 +  m4/longlong.m4
12158 +  m4/netinet_in_h.m4
12159 +  m4/onceonly.m4
12160 +  m4/printf.m4
12161 +  m4/size_max.m4
12162 +  m4/snprintf.m4
12163 +  m4/socklen.m4
12164 +  m4/sockpfaf.m4
12165 +  m4/stdbool.m4
12166 +  m4/stdint.m4
12167 +  m4/stdint_h.m4
12168 +  m4/stdio_h.m4
12169 +  m4/sys_socket_h.m4
12170 +  m4/vasnprintf.m4
12171 +  m4/wchar.m4
12172 +  m4/wchar_t.m4
12173 +  m4/wint_t.m4
12174 +  m4/xsize.m4
12175 +  tests/test-alloca-opt.c
12176 +  tests/test-arpa_inet.c
12177 +  tests/test-errno.c
12178 +  tests/test-getaddrinfo.c
12179 +  tests/test-netinet_in.c
12180 +  tests/test-snprintf.c
12181 +  tests/test-stdbool.c
12182 +  tests/test-stdint.c
12183 +  tests/test-stdio.c
12184 +  tests/test-sys_socket.c
12185 +  tests/test-vasnprintf.c
12186 +  tests/test-vc-list-files-cvs.sh
12187 +  tests/test-vc-list-files-git.sh
12188 +  tests/test-wchar.c
12189 +  tests=lib/dummy.c
12190 +  tests=lib/intprops.h
12191 +  tests=lib/verify.h
12192 +])
12193 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-comp.m4~ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-comp.m4~
12194 --- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-comp.m4~       1970-01-01 01:00:00.000000000 +0100
12195 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-comp.m4~      2008-10-09 12:24:40.000000000 +0100
12196 @@ -0,0 +1,280 @@
12197 +# DO NOT EDIT! GENERATED AUTOMATICALLY!
12198 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
12199 +#
12200 +# This file is free software, distributed under the terms of the GNU
12201 +# General Public License.  As a special exception to the GNU General
12202 +# Public License, this file may be distributed as part of a program
12203 +# that contains a configuration script generated by Autoconf, under
12204 +# the same distribution terms as the rest of that program.
12205 +#
12206 +# Generated by gnulib-tool.
12207 +#
12208 +# This file represents the compiled summary of the specification in
12209 +# gnulib-cache.m4. It lists the computed macro invocations that need
12210 +# to be invoked from configure.ac.
12211 +# In projects using CVS, this file can be treated like other built files.
12212 +
12213 +
12214 +# This macro should be invoked from ./configure.ac, in the section
12215 +# "Checks for programs", right after AC_PROG_CC, and certainly before
12216 +# any checks for libraries, header files, types and library functions.
12217 +AC_DEFUN([gl_EARLY],
12218 +[
12219 +  m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
12220 +  m4_pattern_allow([^gl_ES$])dnl a valid locale name
12221 +  m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
12222 +  m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
12223 +  AC_REQUIRE([AC_PROG_RANLIB])
12224 +  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12225 +])
12226 +
12227 +# This macro should be invoked from ./configure.ac, in the section
12228 +# "Check for header files, types and library functions".
12229 +AC_DEFUN([gl_INIT],
12230 +[
12231 +  AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
12232 +  gl_cond_libtool=true
12233 +  m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
12234 +  m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
12235 +  m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
12236 +  m4_pushdef([gl_LIBSOURCES_LIST], [])
12237 +  m4_pushdef([gl_LIBSOURCES_DIR], [])
12238 +  gl_COMMON
12239 +  gl_source_base='gnulib/lib'
12240 +  gl_FUNC_ALLOCA
12241 +  gl_HEADER_ARPA_INET
12242 +  AC_PROG_MKDIR_P
12243 +  gl_HEADER_ERRNO_H
12244 +  gl_FLOAT_H
12245 +  gl_GETADDRINFO
12246 +  AC_SUBST([LIBINTL])
12247 +  AC_SUBST([LTLIBINTL])
12248 +  gl_INET_NTOP
12249 +  gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
12250 +  gl_HEADER_NETINET_IN
12251 +  AC_PROG_MKDIR_P
12252 +  gl_SIZE_MAX
12253 +  gl_FUNC_SNPRINTF
12254 +  gl_STDIO_MODULE_INDICATOR([snprintf])
12255 +  gl_TYPE_SOCKLEN_T
12256 +  AM_STDBOOL_H
12257 +  gl_STDINT_H
12258 +  gl_STDIO_H
12259 +  gl_HEADER_SYS_SOCKET
12260 +  AC_PROG_MKDIR_P
12261 +  gl_FUNC_VASNPRINTF
12262 +  gl_WCHAR_H
12263 +  gl_XSIZE
12264 +  m4_ifval(gl_LIBSOURCES_LIST, [
12265 +    m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
12266 +      for gl_file in ]gl_LIBSOURCES_LIST[ ; do
12267 +        if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then
12268 +          echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2
12269 +          exit 1
12270 +        fi
12271 +      done])dnl
12272 +      m4_if(m4_sysval, [0], [],
12273 +        [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
12274 +  ])
12275 +  m4_popdef([gl_LIBSOURCES_DIR])
12276 +  m4_popdef([gl_LIBSOURCES_LIST])
12277 +  m4_popdef([AC_LIBSOURCES])
12278 +  m4_popdef([AC_REPLACE_FUNCS])
12279 +  m4_popdef([AC_LIBOBJ])
12280 +  AC_CONFIG_COMMANDS_PRE([
12281 +    gl_libobjs=
12282 +    gl_ltlibobjs=
12283 +    if test -n "$gl_LIBOBJS"; then
12284 +      # Remove the extension.
12285 +      sed_drop_objext='s/\.o$//;s/\.obj$//'
12286 +      for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
12287 +        gl_libobjs="$gl_libobjs $i.$ac_objext"
12288 +        gl_ltlibobjs="$gl_ltlibobjs $i.lo"
12289 +      done
12290 +    fi
12291 +    AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
12292 +    AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
12293 +  ])
12294 +  gltests_libdeps=
12295 +  gltests_ltlibdeps=
12296 +  m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
12297 +  m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
12298 +  m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
12299 +  m4_pushdef([gltests_LIBSOURCES_LIST], [])
12300 +  m4_pushdef([gltests_LIBSOURCES_DIR], [])
12301 +  gl_COMMON
12302 +  gl_source_base='gnulib/tests'
12303 +  gt_TYPE_WCHAR_T
12304 +  gt_TYPE_WINT_T
12305 +  AC_CHECK_FUNCS([shutdown])
12306 +  abs_aux_dir=`cd "$ac_aux_dir"; pwd`
12307 +  AC_SUBST([abs_aux_dir])
12308 +  m4_ifval(gltests_LIBSOURCES_LIST, [
12309 +    m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
12310 +      for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
12311 +        if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then
12312 +          echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2
12313 +          exit 1
12314 +        fi
12315 +      done])dnl
12316 +      m4_if(m4_sysval, [0], [],
12317 +        [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
12318 +  ])
12319 +  m4_popdef([gltests_LIBSOURCES_DIR])
12320 +  m4_popdef([gltests_LIBSOURCES_LIST])
12321 +  m4_popdef([AC_LIBSOURCES])
12322 +  m4_popdef([AC_REPLACE_FUNCS])
12323 +  m4_popdef([AC_LIBOBJ])
12324 +  AC_CONFIG_COMMANDS_PRE([
12325 +    gltests_libobjs=
12326 +    gltests_ltlibobjs=
12327 +    if test -n "$gltests_LIBOBJS"; then
12328 +      # Remove the extension.
12329 +      sed_drop_objext='s/\.o$//;s/\.obj$//'
12330 +      for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
12331 +        gltests_libobjs="$gltests_libobjs $i.$ac_objext"
12332 +        gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
12333 +      done
12334 +    fi
12335 +    AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
12336 +    AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
12337 +  ])
12338 +  LIBTESTS_LIBDEPS="$gltests_libdeps"
12339 +  AC_SUBST([LIBTESTS_LIBDEPS])
12340 +])
12341 +
12342 +# Like AC_LIBOBJ, except that the module name goes
12343 +# into gl_LIBOBJS instead of into LIBOBJS.
12344 +AC_DEFUN([gl_LIBOBJ], [
12345 +  AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl
12346 +  gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
12347 +])
12348 +
12349 +# Like AC_REPLACE_FUNCS, except that the module name goes
12350 +# into gl_LIBOBJS instead of into LIBOBJS.
12351 +AC_DEFUN([gl_REPLACE_FUNCS], [
12352 +  m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
12353 +  AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])
12354 +])
12355 +
12356 +# Like AC_LIBSOURCES, except the directory where the source file is
12357 +# expected is derived from the gnulib-tool parameterization,
12358 +# and alloca is special cased (for the alloca-opt module).
12359 +# We could also entirely rely on EXTRA_lib..._SOURCES.
12360 +AC_DEFUN([gl_LIBSOURCES], [
12361 +  m4_foreach([_gl_NAME], [$1], [
12362 +    m4_if(_gl_NAME, [alloca.c], [], [
12363 +      m4_define([gl_LIBSOURCES_DIR], [gnulib/lib])
12364 +      m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ])
12365 +    ])
12366 +  ])
12367 +])
12368 +
12369 +# Like AC_LIBOBJ, except that the module name goes
12370 +# into gltests_LIBOBJS instead of into LIBOBJS.
12371 +AC_DEFUN([gltests_LIBOBJ], [
12372 +  AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl
12373 +  gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext"
12374 +])
12375 +
12376 +# Like AC_REPLACE_FUNCS, except that the module name goes
12377 +# into gltests_LIBOBJS instead of into LIBOBJS.
12378 +AC_DEFUN([gltests_REPLACE_FUNCS], [
12379 +  m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
12380 +  AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)])
12381 +])
12382 +
12383 +# Like AC_LIBSOURCES, except the directory where the source file is
12384 +# expected is derived from the gnulib-tool parameterization,
12385 +# and alloca is special cased (for the alloca-opt module).
12386 +# We could also entirely rely on EXTRA_lib..._SOURCES.
12387 +AC_DEFUN([gltests_LIBSOURCES], [
12388 +  m4_foreach([_gl_NAME], [$1], [
12389 +    m4_if(_gl_NAME, [alloca.c], [], [
12390 +      m4_define([gltests_LIBSOURCES_DIR], [gnulib/tests])
12391 +      m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ])
12392 +    ])
12393 +  ])
12394 +])
12395 +
12396 +# This macro records the list of files which have been installed by
12397 +# gnulib-tool and may be removed by future gnulib-tool invocations.
12398 +AC_DEFUN([gl_FILE_LIST], [
12399 +  build-aux/link-warning.h
12400 +  build-aux/vc-list-files
12401 +  lib/alloca.in.h
12402 +  lib/arpa_inet.in.h
12403 +  lib/asnprintf.c
12404 +  lib/dummy.c
12405 +  lib/errno.in.h
12406 +  lib/float+.h
12407 +  lib/float.in.h
12408 +  lib/gai_strerror.c
12409 +  lib/getaddrinfo.c
12410 +  lib/getaddrinfo.h
12411 +  lib/gettext.h
12412 +  lib/inet_ntop.c
12413 +  lib/netinet_in.in.h
12414 +  lib/printf-args.c
12415 +  lib/printf-args.h
12416 +  lib/printf-parse.c
12417 +  lib/printf-parse.h
12418 +  lib/size_max.h
12419 +  lib/snprintf.c
12420 +  lib/stdbool.in.h
12421 +  lib/stdint.in.h
12422 +  lib/stdio-write.c
12423 +  lib/stdio.in.h
12424 +  lib/sys_socket.in.h
12425 +  lib/vasnprintf.c
12426 +  lib/vasnprintf.h
12427 +  lib/wchar.in.h
12428 +  lib/winsock.c
12429 +  lib/xsize.h
12430 +  m4/alloca.m4
12431 +  m4/arpa_inet_h.m4
12432 +  m4/errno_h.m4
12433 +  m4/extensions.m4
12434 +  m4/float_h.m4
12435 +  m4/getaddrinfo.m4
12436 +  m4/gnulib-common.m4
12437 +  m4/include_next.m4
12438 +  m4/inet_ntop.m4
12439 +  m4/intmax_t.m4
12440 +  m4/inttypes_h.m4
12441 +  m4/longlong.m4
12442 +  m4/netinet_in_h.m4
12443 +  m4/onceonly.m4
12444 +  m4/printf.m4
12445 +  m4/size_max.m4
12446 +  m4/snprintf.m4
12447 +  m4/socklen.m4
12448 +  m4/sockpfaf.m4
12449 +  m4/stdbool.m4
12450 +  m4/stdint.m4
12451 +  m4/stdint_h.m4
12452 +  m4/stdio_h.m4
12453 +  m4/sys_socket_h.m4
12454 +  m4/vasnprintf.m4
12455 +  m4/wchar.m4
12456 +  m4/wchar_t.m4
12457 +  m4/wint_t.m4
12458 +  m4/xsize.m4
12459 +  tests/test-alloca-opt.c
12460 +  tests/test-arpa_inet.c
12461 +  tests/test-errno.c
12462 +  tests/test-getaddrinfo.c
12463 +  tests/test-netinet_in.c
12464 +  tests/test-snprintf.c
12465 +  tests/test-stdbool.c
12466 +  tests/test-stdint.c
12467 +  tests/test-stdio.c
12468 +  tests/test-sys_socket.c
12469 +  tests/test-vasnprintf.c
12470 +  tests/test-vc-list-files-cvs.sh
12471 +  tests/test-vc-list-files-git.sh
12472 +  tests/test-wchar.c
12473 +  tests=lib/dummy.c
12474 +  tests=lib/intprops.h
12475 +  tests=lib/verify.h
12476 +])
12477 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-tool.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-tool.m4
12478 --- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-tool.m4        1970-01-01 01:00:00.000000000 +0100
12479 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-tool.m4       2008-10-09 12:24:39.000000000 +0100
12480 @@ -0,0 +1,57 @@
12481 +# gnulib-tool.m4 serial 2
12482 +dnl Copyright (C) 2004-2005 Free Software Foundation, Inc.
12483 +dnl This file is free software; the Free Software Foundation
12484 +dnl gives unlimited permission to copy and/or distribute it,
12485 +dnl with or without modifications, as long as this notice is preserved.
12486 +
12487 +dnl The following macros need not be invoked explicitly.
12488 +dnl Invoking them does nothing except to declare default arguments
12489 +dnl for "gnulib-tool --import".
12490 +
12491 +dnl Usage: gl_LOCAL_DIR([DIR])
12492 +AC_DEFUN([gl_LOCAL_DIR], [])
12493 +
12494 +dnl Usage: gl_MODULES([module1 module2 ...])
12495 +AC_DEFUN([gl_MODULES], [])
12496 +
12497 +dnl Usage: gl_AVOID([module1 module2 ...])
12498 +AC_DEFUN([gl_AVOID], [])
12499 +
12500 +dnl Usage: gl_SOURCE_BASE([DIR])
12501 +AC_DEFUN([gl_SOURCE_BASE], [])
12502 +
12503 +dnl Usage: gl_M4_BASE([DIR])
12504 +AC_DEFUN([gl_M4_BASE], [])
12505 +
12506 +dnl Usage: gl_PO_BASE([DIR])
12507 +AC_DEFUN([gl_PO_BASE], [])
12508 +
12509 +dnl Usage: gl_DOC_BASE([DIR])
12510 +AC_DEFUN([gl_DOC_BASE], [])
12511 +
12512 +dnl Usage: gl_TESTS_BASE([DIR])
12513 +AC_DEFUN([gl_TESTS_BASE], [])
12514 +
12515 +dnl Usage: gl_WITH_TESTS
12516 +AC_DEFUN([gl_WITH_TESTS], [])
12517 +
12518 +dnl Usage: gl_LIB([LIBNAME])
12519 +AC_DEFUN([gl_LIB], [])
12520 +
12521 +dnl Usage: gl_LGPL or gl_LGPL([VERSION])
12522 +AC_DEFUN([gl_LGPL], [])
12523 +
12524 +dnl Usage: gl_MAKEFILE_NAME([FILENAME])
12525 +AC_DEFUN([gl_MAKEFILE_NAME], [])
12526 +
12527 +dnl Usage: gl_LIBTOOL
12528 +AC_DEFUN([gl_LIBTOOL], [])
12529 +
12530 +dnl Usage: gl_MACRO_PREFIX([PREFIX])
12531 +AC_DEFUN([gl_MACRO_PREFIX], [])
12532 +
12533 +dnl Usage: gl_PO_DOMAIN([DOMAIN])
12534 +AC_DEFUN([gl_PO_DOMAIN], [])
12535 +
12536 +dnl Usage: gl_VC_FILES([BOOLEAN])
12537 +AC_DEFUN([gl_VC_FILES], [])
12538 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/include_next.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/include_next.m4
12539 --- gtk-vnc-0.3.7.mingw/gnulib/m4/include_next.m4       1970-01-01 01:00:00.000000000 +0100
12540 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/include_next.m4      2008-10-09 12:24:39.000000000 +0100
12541 @@ -0,0 +1,128 @@
12542 +# include_next.m4 serial 8
12543 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
12544 +dnl This file is free software; the Free Software Foundation
12545 +dnl gives unlimited permission to copy and/or distribute it,
12546 +dnl with or without modifications, as long as this notice is preserved.
12547 +
12548 +dnl From Paul Eggert and Derek Price.
12549 +
12550 +dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER.
12551 +dnl
12552 +dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to
12553 +dnl 'include' otherwise.
12554 +dnl
12555 +dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next,
12556 +dnl so as to avoid GCC warnings when the gcc option -pedantic is used.
12557 +dnl '#pragma GCC system_header' has the same effect as if the file was found
12558 +dnl through the include search path specified with '-isystem' options (as
12559 +dnl opposed to the search path specified with '-I' options). Namely, gcc
12560 +dnl does not warn about some things, and on some systems (Solaris and Interix)
12561 +dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
12562 +dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
12563 +dnl of plain '__STDC__'.
12564 +
12565 +AC_DEFUN([gl_INCLUDE_NEXT],
12566 +[
12567 +  AC_LANG_PREPROC_REQUIRE()
12568 +  AC_CACHE_CHECK([whether the preprocessor supports include_next],
12569 +    [gl_cv_have_include_next],
12570 +    [rm -rf conftestd1 conftestd2
12571 +     mkdir conftestd1 conftestd2
12572 +     dnl The include of <stdio.h> is because IBM C 9.0 on AIX 6.1 supports
12573 +     dnl include_next when used as first preprocessor directive in a file,
12574 +     dnl but not when preceded by another include directive.
12575 +     cat <<EOF > conftestd1/conftest.h
12576 +#define DEFINED_IN_CONFTESTD1
12577 +#include <stdio.h>
12578 +#include_next <conftest.h>
12579 +#ifdef DEFINED_IN_CONFTESTD2
12580 +int foo;
12581 +#else
12582 +#error "include_next doesn't work"
12583 +#endif
12584 +EOF
12585 +     cat <<EOF > conftestd2/conftest.h
12586 +#ifndef DEFINED_IN_CONFTESTD1
12587 +#error "include_next test doesn't work"
12588 +#endif
12589 +#define DEFINED_IN_CONFTESTD2
12590 +EOF
12591 +     save_CPPFLAGS="$CPPFLAGS"
12592 +     CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2"
12593 +     AC_COMPILE_IFELSE([#include <conftest.h>],
12594 +       [gl_cv_have_include_next=yes],
12595 +       [gl_cv_have_include_next=no])
12596 +     CPPFLAGS="$save_CPPFLAGS"
12597 +     rm -rf conftestd1 conftestd2
12598 +    ])
12599 +  PRAGMA_SYSTEM_HEADER=
12600 +  if test $gl_cv_have_include_next = yes; then
12601 +    INCLUDE_NEXT=include_next
12602 +    if test -n "$GCC"; then
12603 +      PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
12604 +    fi
12605 +  else
12606 +    INCLUDE_NEXT=include
12607 +  fi
12608 +  AC_SUBST([INCLUDE_NEXT])
12609 +  AC_SUBST([PRAGMA_SYSTEM_HEADER])
12610 +])
12611 +
12612 +# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
12613 +# ------------------------------------------
12614 +# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
12615 +# '<foo.h>'; otherwise define it to be
12616 +# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
12617 +# That way, a header file with the following line:
12618 +#      #@INCLUDE_NEXT@ @NEXT_FOO_H@
12619 +# behaves (after sed substitution) as if it contained
12620 +#      #include_next <foo.h>
12621 +# even if the compiler does not support include_next.
12622 +# The three "///" are to pacify Sun C 5.8, which otherwise would say
12623 +# "warning: #include of /usr/include/... may be non-portable".
12624 +# Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
12625 +# Note: This macro assumes that the header file is not empty after
12626 +# preprocessing, i.e. it does not only define preprocessor macros but also
12627 +# provides some type/enum definitions or function/variable declarations.
12628 +AC_DEFUN([gl_CHECK_NEXT_HEADERS],
12629 +[
12630 +  AC_REQUIRE([gl_INCLUDE_NEXT])
12631 +  AC_CHECK_HEADERS_ONCE([$1])
12632 +
12633 +  m4_foreach_w([gl_HEADER_NAME], [$1],
12634 +    [AS_VAR_PUSHDEF([gl_next_header],
12635 +                   [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
12636 +     if test $gl_cv_have_include_next = yes; then
12637 +       AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
12638 +     else
12639 +       AC_CACHE_CHECK(
12640 +        [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
12641 +        m4_quote(m4_defn([gl_next_header])),
12642 +        [AS_VAR_PUSHDEF([gl_header_exists],
12643 +                        [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))
12644 +         if test AS_VAR_GET(gl_header_exists) = yes; then
12645 +           AC_LANG_CONFTEST(
12646 +             [AC_LANG_SOURCE(
12647 +                [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
12648 +              )])
12649 +           dnl eval is necessary to expand ac_cpp.
12650 +           dnl Ultrix and Pyramid sh refuse to redirect output of eval,
12651 +           dnl so use subshell.
12652 +           AS_VAR_SET([gl_next_header],
12653 +             ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
12654 +              sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
12655 +                s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
12656 +                s#^/[^/]#//&#
12657 +                p
12658 +                q
12659 +              }'`'"'])
12660 +         else
12661 +           AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
12662 +         fi
12663 +         AS_VAR_POPDEF([gl_header_exists])])
12664 +     fi
12665 +     AC_SUBST(
12666 +       AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
12667 +       [AS_VAR_GET([gl_next_header])])
12668 +     AS_VAR_POPDEF([gl_next_header])])
12669 +])
12670 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/inet_ntop.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/inet_ntop.m4
12671 --- gtk-vnc-0.3.7.mingw/gnulib/m4/inet_ntop.m4  1970-01-01 01:00:00.000000000 +0100
12672 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/inet_ntop.m4 2008-10-09 12:24:39.000000000 +0100
12673 @@ -0,0 +1,26 @@
12674 +# inet_ntop.m4 serial 7
12675 +dnl Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
12676 +dnl This file is free software; the Free Software Foundation
12677 +dnl gives unlimited permission to copy and/or distribute it,
12678 +dnl with or without modifications, as long as this notice is preserved.
12679 +
12680 +AC_DEFUN([gl_INET_NTOP],
12681 +[
12682 +  dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
12683 +  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12684 +
12685 +  gl_REPLACE_ARPA_INET_H
12686 +
12687 +  AC_REPLACE_FUNCS(inet_ntop)
12688 +  gl_PREREQ_INET_NTOP
12689 +])
12690 +
12691 +# Prerequisites of lib/inet_ntop.c.
12692 +AC_DEFUN([gl_PREREQ_INET_NTOP], [
12693 +  AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
12694 +  if test $ac_cv_have_decl_inet_ntop = no; then
12695 +    HAVE_DECL_INET_NTOP=0
12696 +  fi
12697 +  AC_REQUIRE([gl_SOCKET_FAMILIES])
12698 +  AC_REQUIRE([AC_C_RESTRICT])
12699 +])
12700 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/intmax_t.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/intmax_t.m4
12701 --- gtk-vnc-0.3.7.mingw/gnulib/m4/intmax_t.m4   1970-01-01 01:00:00.000000000 +0100
12702 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/intmax_t.m4  2008-10-09 12:24:39.000000000 +0100
12703 @@ -0,0 +1,61 @@
12704 +# intmax_t.m4 serial 6
12705 +dnl Copyright (C) 1997-2004, 2006-2007 Free Software Foundation, Inc.
12706 +dnl This file is free software; the Free Software Foundation
12707 +dnl gives unlimited permission to copy and/or distribute it,
12708 +dnl with or without modifications, as long as this notice is preserved.
12709 +
12710 +dnl From Paul Eggert.
12711 +
12712 +AC_PREREQ(2.13)
12713 +
12714 +# Define intmax_t to 'long' or 'long long'
12715 +# if it is not already defined in <stdint.h> or <inttypes.h>.
12716 +
12717 +AC_DEFUN([gl_AC_TYPE_INTMAX_T],
12718 +[
12719 +  dnl For simplicity, we assume that a header file defines 'intmax_t' if and
12720 +  dnl only if it defines 'uintmax_t'.
12721 +  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
12722 +  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
12723 +  if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
12724 +    AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
12725 +    test $ac_cv_type_long_long_int = yes \
12726 +      && ac_type='long long' \
12727 +      || ac_type='long'
12728 +    AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
12729 +     [Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
12730 +  else
12731 +    AC_DEFINE(HAVE_INTMAX_T, 1,
12732 +      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
12733 +  fi
12734 +])
12735 +
12736 +dnl An alternative would be to explicitly test for 'intmax_t'.
12737 +
12738 +AC_DEFUN([gt_AC_TYPE_INTMAX_T],
12739 +[
12740 +  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
12741 +  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
12742 +  AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
12743 +    [AC_TRY_COMPILE([
12744 +#include <stddef.h>
12745 +#include <stdlib.h>
12746 +#if HAVE_STDINT_H_WITH_UINTMAX
12747 +#include <stdint.h>
12748 +#endif
12749 +#if HAVE_INTTYPES_H_WITH_UINTMAX
12750 +#include <inttypes.h>
12751 +#endif
12752 +], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
12753 +  if test $gt_cv_c_intmax_t = yes; then
12754 +    AC_DEFINE(HAVE_INTMAX_T, 1,
12755 +      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
12756 +  else
12757 +    AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
12758 +    test $ac_cv_type_long_long_int = yes \
12759 +      && ac_type='long long' \
12760 +      || ac_type='long'
12761 +    AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
12762 +     [Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
12763 +  fi
12764 +])
12765 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/inttypes_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/inttypes_h.m4
12766 --- gtk-vnc-0.3.7.mingw/gnulib/m4/inttypes_h.m4 1970-01-01 01:00:00.000000000 +0100
12767 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/inttypes_h.m4        2008-10-09 12:24:39.000000000 +0100
12768 @@ -0,0 +1,26 @@
12769 +# inttypes_h.m4 serial 7
12770 +dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc.
12771 +dnl This file is free software; the Free Software Foundation
12772 +dnl gives unlimited permission to copy and/or distribute it,
12773 +dnl with or without modifications, as long as this notice is preserved.
12774 +
12775 +dnl From Paul Eggert.
12776 +
12777 +# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
12778 +# doesn't clash with <sys/types.h>, and declares uintmax_t.
12779 +
12780 +AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
12781 +[
12782 +  AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h,
12783 +  [AC_TRY_COMPILE(
12784 +    [#include <sys/types.h>
12785 +#include <inttypes.h>],
12786 +    [uintmax_t i = (uintmax_t) -1; return !i;],
12787 +    gl_cv_header_inttypes_h=yes,
12788 +    gl_cv_header_inttypes_h=no)])
12789 +  if test $gl_cv_header_inttypes_h = yes; then
12790 +    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
12791 +      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
12792 +       and declares uintmax_t. ])
12793 +  fi
12794 +])
12795 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/longlong.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/longlong.m4
12796 --- gtk-vnc-0.3.7.mingw/gnulib/m4/longlong.m4   1970-01-01 01:00:00.000000000 +0100
12797 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/longlong.m4  2008-10-09 12:24:39.000000000 +0100
12798 @@ -0,0 +1,106 @@
12799 +# longlong.m4 serial 13
12800 +dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
12801 +dnl This file is free software; the Free Software Foundation
12802 +dnl gives unlimited permission to copy and/or distribute it,
12803 +dnl with or without modifications, as long as this notice is preserved.
12804 +
12805 +dnl From Paul Eggert.
12806 +
12807 +# Define HAVE_LONG_LONG_INT if 'long long int' works.
12808 +# This fixes a bug in Autoconf 2.61, but can be removed once we
12809 +# assume 2.62 everywhere.
12810 +
12811 +# Note: If the type 'long long int' exists but is only 32 bits large
12812 +# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
12813 +# defined. In this case you can treat 'long long int' like 'long int'.
12814 +
12815 +AC_DEFUN([AC_TYPE_LONG_LONG_INT],
12816 +[
12817 +  AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
12818 +    [AC_LINK_IFELSE(
12819 +       [_AC_TYPE_LONG_LONG_SNIPPET],
12820 +       [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
12821 +       dnl If cross compiling, assume the bug isn't important, since
12822 +       dnl nobody cross compiles for this platform as far as we know.
12823 +       AC_RUN_IFELSE(
12824 +         [AC_LANG_PROGRAM(
12825 +            [[@%:@include <limits.h>
12826 +              @%:@ifndef LLONG_MAX
12827 +              @%:@ define HALF \
12828 +                       (1LL << (sizeof (long long int) * CHAR_BIT - 2))
12829 +              @%:@ define LLONG_MAX (HALF - 1 + HALF)
12830 +              @%:@endif]],
12831 +            [[long long int n = 1;
12832 +              int i;
12833 +              for (i = 0; ; i++)
12834 +                {
12835 +                  long long int m = n << i;
12836 +                  if (m >> i != n)
12837 +                    return 1;
12838 +                  if (LLONG_MAX / 2 < m)
12839 +                    break;
12840 +                }
12841 +              return 0;]])],
12842 +         [ac_cv_type_long_long_int=yes],
12843 +         [ac_cv_type_long_long_int=no],
12844 +         [ac_cv_type_long_long_int=yes])],
12845 +       [ac_cv_type_long_long_int=no])])
12846 +  if test $ac_cv_type_long_long_int = yes; then
12847 +    AC_DEFINE([HAVE_LONG_LONG_INT], 1,
12848 +      [Define to 1 if the system has the type `long long int'.])
12849 +  fi
12850 +])
12851 +
12852 +# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
12853 +# This fixes a bug in Autoconf 2.61, but can be removed once we
12854 +# assume 2.62 everywhere.
12855 +
12856 +# Note: If the type 'unsigned long long int' exists but is only 32 bits
12857 +# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
12858 +# will not be defined. In this case you can treat 'unsigned long long int'
12859 +# like 'unsigned long int'.
12860 +
12861 +AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
12862 +[
12863 +  AC_CACHE_CHECK([for unsigned long long int],
12864 +    [ac_cv_type_unsigned_long_long_int],
12865 +    [AC_LINK_IFELSE(
12866 +       [_AC_TYPE_LONG_LONG_SNIPPET],
12867 +       [ac_cv_type_unsigned_long_long_int=yes],
12868 +       [ac_cv_type_unsigned_long_long_int=no])])
12869 +  if test $ac_cv_type_unsigned_long_long_int = yes; then
12870 +    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
12871 +      [Define to 1 if the system has the type `unsigned long long int'.])
12872 +  fi
12873 +])
12874 +
12875 +# Expands to a C program that can be used to test for simultaneous support
12876 +# of 'long long' and 'unsigned long long'. We don't want to say that
12877 +# 'long long' is available if 'unsigned long long' is not, or vice versa,
12878 +# because too many programs rely on the symmetry between signed and unsigned
12879 +# integer types (excluding 'bool').
12880 +AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
12881 +[
12882 +  AC_LANG_PROGRAM(
12883 +    [[/* For now, do not test the preprocessor; as of 2007 there are too many
12884 +        implementations with broken preprocessors.  Perhaps this can
12885 +        be revisited in 2012.  In the meantime, code should not expect
12886 +        #if to work with literals wider than 32 bits.  */
12887 +      /* Test literals.  */
12888 +      long long int ll = 9223372036854775807ll;
12889 +      long long int nll = -9223372036854775807LL;
12890 +      unsigned long long int ull = 18446744073709551615ULL;
12891 +      /* Test constant expressions.   */
12892 +      typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
12893 +                    ? 1 : -1)];
12894 +      typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
12895 +                    ? 1 : -1)];
12896 +      int i = 63;]],
12897 +    [[/* Test availability of runtime routines for shift and division.  */
12898 +      long long int llmax = 9223372036854775807ll;
12899 +      unsigned long long int ullmax = 18446744073709551615ull;
12900 +      return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
12901 +             | (llmax / ll) | (llmax % ll)
12902 +             | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
12903 +             | (ullmax / ull) | (ullmax % ull));]])
12904 +])
12905 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/netinet_in_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/netinet_in_h.m4
12906 --- gtk-vnc-0.3.7.mingw/gnulib/m4/netinet_in_h.m4       1970-01-01 01:00:00.000000000 +0100
12907 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/netinet_in_h.m4      2008-10-09 12:24:39.000000000 +0100
12908 @@ -0,0 +1,30 @@
12909 +# netinet_in_h.m4 serial 4
12910 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
12911 +dnl This file is free software; the Free Software Foundation
12912 +dnl gives unlimited permission to copy and/or distribute it,
12913 +dnl with or without modifications, as long as this notice is preserved.
12914 +
12915 +AC_DEFUN([gl_HEADER_NETINET_IN],
12916 +[
12917 +  AC_CACHE_CHECK([whether <netinet/in.h> is self-contained],
12918 +    [gl_cv_header_netinet_in_h_selfcontained],
12919 +    [
12920 +      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[]])],
12921 +        [gl_cv_header_netinet_in_h_selfcontained=yes],
12922 +        [gl_cv_header_netinet_in_h_selfcontained=no])
12923 +    ])
12924 +  if test $gl_cv_header_netinet_in_h_selfcontained = yes; then
12925 +    NETINET_IN_H=''
12926 +  else
12927 +    NETINET_IN_H='netinet/in.h'
12928 +    AC_CHECK_HEADERS([netinet/in.h])
12929 +    gl_CHECK_NEXT_HEADERS([netinet/in.h])
12930 +    if test $ac_cv_header_netinet_in_h = yes; then
12931 +      HAVE_NETINET_IN_H=1
12932 +    else
12933 +      HAVE_NETINET_IN_H=0
12934 +    fi
12935 +    AC_SUBST([HAVE_NETINET_IN_H])
12936 +  fi
12937 +  AC_SUBST([NETINET_IN_H])
12938 +])
12939 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/onceonly.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/onceonly.m4
12940 --- gtk-vnc-0.3.7.mingw/gnulib/m4/onceonly.m4   1970-01-01 01:00:00.000000000 +0100
12941 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/onceonly.m4  2008-10-09 12:24:39.000000000 +0100
12942 @@ -0,0 +1,90 @@
12943 +# onceonly.m4 serial 6
12944 +dnl Copyright (C) 2002-2003, 2005-2006, 2008 Free Software Foundation, Inc.
12945 +dnl This file is free software, distributed under the terms of the GNU
12946 +dnl General Public License.  As a special exception to the GNU General
12947 +dnl Public License, this file may be distributed as part of a program
12948 +dnl that contains a configuration script generated by Autoconf, under
12949 +dnl the same distribution terms as the rest of that program.
12950 +
12951 +dnl This file defines some "once only" variants of standard autoconf macros.
12952 +dnl   AC_CHECK_HEADERS_ONCE          like  AC_CHECK_HEADERS
12953 +dnl   AC_CHECK_FUNCS_ONCE            like  AC_CHECK_FUNCS
12954 +dnl   AC_CHECK_DECLS_ONCE            like  AC_CHECK_DECLS
12955 +dnl   AC_REQUIRE([AC_FUNC_STRCOLL])  like  AC_FUNC_STRCOLL
12956 +dnl The advantage is that the check for each of the headers/functions/decls
12957 +dnl will be put only once into the 'configure' file. It keeps the size of
12958 +dnl the 'configure' file down, and avoids redundant output when 'configure'
12959 +dnl is run.
12960 +dnl The drawback is that the checks cannot be conditionalized. If you write
12961 +dnl   if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
12962 +dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
12963 +dnl empty, and the check will be inserted before the body of the AC_DEFUNed
12964 +dnl function.
12965 +
12966 +dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE
12967 +dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to
12968 +dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested
12969 +dnl headers at once, thus reducing the size of 'configure'. It is known to work
12970 +dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%.
12971 +
12972 +dnl Autoconf version 2.59 plus gnulib is required; this file is not needed
12973 +dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of
12974 +dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first
12975 +dnl argument!
12976 +AC_PREREQ([2.59])
12977 +
12978 +# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
12979 +# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
12980 +AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
12981 +  :
12982 +  m4_foreach_w([gl_HEADER_NAME], [$1], [
12983 +    AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
12984 +                                                 [./-], [___])), [
12985 +      m4_divert_text([INIT_PREPARE],
12986 +        [gl_header_list="$gl_header_list gl_HEADER_NAME"])
12987 +      gl_HEADERS_EXPANSION
12988 +      AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
12989 +        [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
12990 +    ])
12991 +    AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
12992 +                                                   [./-], [___])))
12993 +  ])
12994 +])
12995 +m4_define([gl_HEADERS_EXPANSION], [
12996 +  m4_divert_text([DEFAULTS], [gl_header_list=])
12997 +  AC_CHECK_HEADERS([$gl_header_list])
12998 +  m4_define([gl_HEADERS_EXPANSION], [])
12999 +])
13000 +
13001 +# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
13002 +# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
13003 +AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
13004 +  :
13005 +  m4_foreach_w([gl_FUNC_NAME], [$1], [
13006 +    AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
13007 +      m4_divert_text([INIT_PREPARE],
13008 +        [gl_func_list="$gl_func_list gl_FUNC_NAME"])
13009 +      gl_FUNCS_EXPANSION
13010 +      AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
13011 +        [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
13012 +    ])
13013 +    AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
13014 +  ])
13015 +])
13016 +m4_define([gl_FUNCS_EXPANSION], [
13017 +  m4_divert_text([DEFAULTS], [gl_func_list=])
13018 +  AC_CHECK_FUNCS([$gl_func_list])
13019 +  m4_define([gl_FUNCS_EXPANSION], [])
13020 +])
13021 +
13022 +# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
13023 +# AC_CHECK_DECLS(DECL1, DECL2, ...).
13024 +AC_DEFUN([AC_CHECK_DECLS_ONCE], [
13025 +  :
13026 +  m4_foreach_w([gl_DECL_NAME], [$1], [
13027 +    AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
13028 +      AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
13029 +    ])
13030 +    AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
13031 +  ])
13032 +])
13033 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/printf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/printf.m4
13034 --- gtk-vnc-0.3.7.mingw/gnulib/m4/printf.m4     1970-01-01 01:00:00.000000000 +0100
13035 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/printf.m4    2008-10-09 12:24:39.000000000 +0100
13036 @@ -0,0 +1,1309 @@
13037 +# printf.m4 serial 23
13038 +dnl Copyright (C) 2003, 2007-2008 Free Software Foundation, Inc.
13039 +dnl This file is free software; the Free Software Foundation
13040 +dnl gives unlimited permission to copy and/or distribute it,
13041 +dnl with or without modifications, as long as this notice is preserved.
13042 +
13043 +dnl Test whether the *printf family of functions supports the 'j', 'z', 't',
13044 +dnl 'L' size specifiers. (ISO C99, POSIX:2001)
13045 +dnl Result is gl_cv_func_printf_sizes_c99.
13046 +
13047 +AC_DEFUN([gl_PRINTF_SIZES_C99],
13048 +[
13049 +  AC_REQUIRE([AC_PROG_CC])
13050 +  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
13051 +  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
13052 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13053 +  AC_CACHE_CHECK([whether printf supports size specifiers as in C99],
13054 +    [gl_cv_func_printf_sizes_c99],
13055 +    [
13056 +      AC_TRY_RUN([
13057 +#include <stddef.h>
13058 +#include <stdio.h>
13059 +#include <string.h>
13060 +#include <sys/types.h>
13061 +#if HAVE_STDINT_H_WITH_UINTMAX
13062 +# include <stdint.h>
13063 +#endif
13064 +#if HAVE_INTTYPES_H_WITH_UINTMAX
13065 +# include <inttypes.h>
13066 +#endif
13067 +static char buf[100];
13068 +int main ()
13069 +{
13070 +#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX
13071 +  buf[0] = '\0';
13072 +  if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
13073 +      || strcmp (buf, "12345671 33") != 0)
13074 +    return 1;
13075 +#endif
13076 +  buf[0] = '\0';
13077 +  if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
13078 +      || strcmp (buf, "12345672 33") != 0)
13079 +    return 1;
13080 +  buf[0] = '\0';
13081 +  if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0
13082 +      || strcmp (buf, "12345673 33") != 0)
13083 +    return 1;
13084 +  buf[0] = '\0';
13085 +  if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0
13086 +      || strcmp (buf, "1.5 33") != 0)
13087 +    return 1;
13088 +  return 0;
13089 +}], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no],
13090 +      [
13091 +changequote(,)dnl
13092 +       case "$host_os" in
13093 +                               # Guess yes on glibc systems.
13094 +         *-gnu*)               gl_cv_func_printf_sizes_c99="guessing yes";;
13095 +                               # Guess yes on FreeBSD >= 5.
13096 +         freebsd[1-4]*)        gl_cv_func_printf_sizes_c99="guessing no";;
13097 +         freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
13098 +                               # Guess yes on MacOS X >= 10.3.
13099 +         darwin[1-6].*)        gl_cv_func_printf_sizes_c99="guessing no";;
13100 +         darwin*)              gl_cv_func_printf_sizes_c99="guessing yes";;
13101 +                               # Guess yes on OpenBSD >= 3.9.
13102 +         openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
13103 +                               gl_cv_func_printf_sizes_c99="guessing no";;
13104 +         openbsd*)             gl_cv_func_printf_sizes_c99="guessing yes";;
13105 +                               # Guess yes on Solaris >= 2.10.
13106 +         solaris2.[0-9]*)      gl_cv_func_printf_sizes_c99="guessing no";;
13107 +         solaris*)             gl_cv_func_printf_sizes_c99="guessing yes";;
13108 +                               # Guess yes on NetBSD >= 3.
13109 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
13110 +                               gl_cv_func_printf_sizes_c99="guessing no";;
13111 +         netbsd*)              gl_cv_func_printf_sizes_c99="guessing yes";;
13112 +                               # If we don't know, assume the worst.
13113 +         *)                    gl_cv_func_printf_sizes_c99="guessing no";;
13114 +       esac
13115 +changequote([,])dnl
13116 +      ])
13117 +    ])
13118 +])
13119 +
13120 +dnl Test whether the *printf family of functions supports 'long double'
13121 +dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001)
13122 +dnl Result is gl_cv_func_printf_long_double.
13123 +
13124 +AC_DEFUN([gl_PRINTF_LONG_DOUBLE],
13125 +[
13126 +  AC_REQUIRE([AC_PROG_CC])
13127 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13128 +  AC_CACHE_CHECK([whether printf supports 'long double' arguments],
13129 +    [gl_cv_func_printf_long_double],
13130 +    [
13131 +      AC_TRY_RUN([
13132 +#include <stdio.h>
13133 +#include <string.h>
13134 +static char buf[10000];
13135 +int main ()
13136 +{
13137 +  buf[0] = '\0';
13138 +  if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0
13139 +      || strcmp (buf, "1.750000 33") != 0)
13140 +    return 1;
13141 +  buf[0] = '\0';
13142 +  if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0
13143 +      || strcmp (buf, "1.750000e+00 33") != 0)
13144 +    return 1;
13145 +  buf[0] = '\0';
13146 +  if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0
13147 +      || strcmp (buf, "1.75 33") != 0)
13148 +    return 1;
13149 +  return 0;
13150 +}], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no],
13151 +      [
13152 +changequote(,)dnl
13153 +       case "$host_os" in
13154 +         beos*)        gl_cv_func_printf_long_double="guessing no";;
13155 +         mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
13156 +         *)            gl_cv_func_printf_long_double="guessing yes";;
13157 +       esac
13158 +changequote([,])dnl
13159 +      ])
13160 +    ])
13161 +])
13162 +
13163 +dnl Test whether the *printf family of functions supports infinite and NaN
13164 +dnl 'double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001)
13165 +dnl Result is gl_cv_func_printf_infinite.
13166 +
13167 +AC_DEFUN([gl_PRINTF_INFINITE],
13168 +[
13169 +  AC_REQUIRE([AC_PROG_CC])
13170 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13171 +  AC_CACHE_CHECK([whether printf supports infinite 'double' arguments],
13172 +    [gl_cv_func_printf_infinite],
13173 +    [
13174 +      AC_TRY_RUN([
13175 +#include <stdio.h>
13176 +#include <string.h>
13177 +static int
13178 +strisnan (const char *string, size_t start_index, size_t end_index)
13179 +{
13180 +  if (start_index < end_index)
13181 +    {
13182 +      if (string[start_index] == '-')
13183 +        start_index++;
13184 +      if (start_index + 3 <= end_index
13185 +          && memcmp (string + start_index, "nan", 3) == 0)
13186 +        {
13187 +          start_index += 3;
13188 +          if (start_index == end_index
13189 +              || (string[start_index] == '(' && string[end_index - 1] == ')'))
13190 +            return 1;
13191 +        }
13192 +    }
13193 +  return 0;
13194 +}
13195 +static char buf[10000];
13196 +static double zero = 0.0;
13197 +int main ()
13198 +{
13199 +  if (sprintf (buf, "%f", 1.0 / 0.0) < 0
13200 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13201 +    return 1;
13202 +  if (sprintf (buf, "%f", -1.0 / 0.0) < 0
13203 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13204 +    return 1;
13205 +  if (sprintf (buf, "%f", zero / zero) < 0
13206 +      || !strisnan (buf, 0, strlen (buf)))
13207 +    return 1;
13208 +  if (sprintf (buf, "%e", 1.0 / 0.0) < 0
13209 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13210 +    return 1;
13211 +  if (sprintf (buf, "%e", -1.0 / 0.0) < 0
13212 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13213 +    return 1;
13214 +  if (sprintf (buf, "%e", zero / zero) < 0
13215 +      || !strisnan (buf, 0, strlen (buf)))
13216 +    return 1;
13217 +  if (sprintf (buf, "%g", 1.0 / 0.0) < 0
13218 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13219 +    return 1;
13220 +  if (sprintf (buf, "%g", -1.0 / 0.0) < 0
13221 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13222 +    return 1;
13223 +  if (sprintf (buf, "%g", zero / zero) < 0
13224 +      || !strisnan (buf, 0, strlen (buf)))
13225 +    return 1;
13226 +  return 0;
13227 +}], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no],
13228 +      [
13229 +changequote(,)dnl
13230 +       case "$host_os" in
13231 +                               # Guess yes on glibc systems.
13232 +         *-gnu*)               gl_cv_func_printf_infinite="guessing yes";;
13233 +                               # Guess yes on FreeBSD >= 6.
13234 +         freebsd[1-5]*)        gl_cv_func_printf_infinite="guessing no";;
13235 +         freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
13236 +                               # Guess yes on MacOS X >= 10.3.
13237 +         darwin[1-6].*)        gl_cv_func_printf_infinite="guessing no";;
13238 +         darwin*)              gl_cv_func_printf_infinite="guessing yes";;
13239 +                               # Guess yes on HP-UX >= 11.
13240 +         hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";;
13241 +         hpux*)                gl_cv_func_printf_infinite="guessing yes";;
13242 +                               # Guess yes on NetBSD >= 3.
13243 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
13244 +                               gl_cv_func_printf_infinite="guessing no";;
13245 +         netbsd*)              gl_cv_func_printf_infinite="guessing yes";;
13246 +                               # Guess yes on BeOS.
13247 +         beos*)                gl_cv_func_printf_infinite="guessing yes";;
13248 +                               # If we don't know, assume the worst.
13249 +         *)                    gl_cv_func_printf_infinite="guessing no";;
13250 +       esac
13251 +changequote([,])dnl
13252 +      ])
13253 +    ])
13254 +])
13255 +
13256 +dnl Test whether the *printf family of functions supports infinite and NaN
13257 +dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001)
13258 +dnl Result is gl_cv_func_printf_infinite_long_double.
13259 +
13260 +AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE],
13261 +[
13262 +  AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
13263 +  AC_REQUIRE([AC_PROG_CC])
13264 +  AC_REQUIRE([AC_C_BIGENDIAN])
13265 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13266 +  dnl The user can set or unset the variable gl_printf_safe to indicate
13267 +  dnl that he wishes a safe handling of non-IEEE-754 'long double' values.
13268 +  if test -n "$gl_printf_safe"; then
13269 +    AC_DEFINE([CHECK_PRINTF_SAFE], 1,
13270 +      [Define if you wish *printf() functions that have a safe handling of
13271 +       non-IEEE-754 'long double' values.])
13272 +  fi
13273 +  case "$gl_cv_func_printf_long_double" in
13274 +    *yes)
13275 +      AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments],
13276 +        [gl_cv_func_printf_infinite_long_double],
13277 +        [
13278 +          AC_TRY_RUN([
13279 +]GL_NOCRASH[
13280 +#include <float.h>
13281 +#include <stdio.h>
13282 +#include <string.h>
13283 +static int
13284 +strisnan (const char *string, size_t start_index, size_t end_index)
13285 +{
13286 +  if (start_index < end_index)
13287 +    {
13288 +      if (string[start_index] == '-')
13289 +        start_index++;
13290 +      if (start_index + 3 <= end_index
13291 +          && memcmp (string + start_index, "nan", 3) == 0)
13292 +        {
13293 +          start_index += 3;
13294 +          if (start_index == end_index
13295 +              || (string[start_index] == '(' && string[end_index - 1] == ')'))
13296 +            return 1;
13297 +        }
13298 +    }
13299 +  return 0;
13300 +}
13301 +static char buf[10000];
13302 +static long double zeroL = 0.0L;
13303 +int main ()
13304 +{
13305 +  nocrash_init();
13306 +  if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0
13307 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13308 +    return 1;
13309 +  if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0
13310 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13311 +    return 1;
13312 +  if (sprintf (buf, "%Lf", zeroL / zeroL) < 0
13313 +      || !strisnan (buf, 0, strlen (buf)))
13314 +    return 1;
13315 +  if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0
13316 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13317 +    return 1;
13318 +  if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0
13319 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13320 +    return 1;
13321 +  if (sprintf (buf, "%Le", zeroL / zeroL) < 0
13322 +      || !strisnan (buf, 0, strlen (buf)))
13323 +    return 1;
13324 +  if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0
13325 +      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
13326 +    return 1;
13327 +  if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0
13328 +      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
13329 +    return 1;
13330 +  if (sprintf (buf, "%Lg", zeroL / zeroL) < 0
13331 +      || !strisnan (buf, 0, strlen (buf)))
13332 +    return 1;
13333 +#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_))
13334 +/* Representation of an 80-bit 'long double' as an initializer for a sequence
13335 +   of 'unsigned int' words.  */
13336 +# ifdef WORDS_BIGENDIAN
13337 +#  define LDBL80_WORDS(exponent,manthi,mantlo) \
13338 +     { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
13339 +       ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16),    \
13340 +       (unsigned int) (mantlo) << 16                                        \
13341 +     }
13342 +# else
13343 +#  define LDBL80_WORDS(exponent,manthi,mantlo) \
13344 +     { mantlo, manthi, exponent }
13345 +# endif
13346 +  { /* Quiet NaN.  */
13347 +    static union { unsigned int word[4]; long double value; } x =
13348 +      { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
13349 +    if (sprintf (buf, "%Lf", x.value) < 0
13350 +        || !strisnan (buf, 0, strlen (buf)))
13351 +      return 1;
13352 +    if (sprintf (buf, "%Le", x.value) < 0
13353 +        || !strisnan (buf, 0, strlen (buf)))
13354 +      return 1;
13355 +    if (sprintf (buf, "%Lg", x.value) < 0
13356 +        || !strisnan (buf, 0, strlen (buf)))
13357 +      return 1;
13358 +  }
13359 +  {
13360 +    /* Signalling NaN.  */
13361 +    static union { unsigned int word[4]; long double value; } x =
13362 +      { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
13363 +    if (sprintf (buf, "%Lf", x.value) < 0
13364 +        || !strisnan (buf, 0, strlen (buf)))
13365 +      return 1;
13366 +    if (sprintf (buf, "%Le", x.value) < 0
13367 +        || !strisnan (buf, 0, strlen (buf)))
13368 +      return 1;
13369 +    if (sprintf (buf, "%Lg", x.value) < 0
13370 +        || !strisnan (buf, 0, strlen (buf)))
13371 +      return 1;
13372 +  }
13373 +  { /* Pseudo-NaN.  */
13374 +    static union { unsigned int word[4]; long double value; } x =
13375 +      { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
13376 +    if (sprintf (buf, "%Lf", x.value) < 0
13377 +        || !strisnan (buf, 0, strlen (buf)))
13378 +      return 1;
13379 +    if (sprintf (buf, "%Le", x.value) < 0
13380 +        || !strisnan (buf, 0, strlen (buf)))
13381 +      return 1;
13382 +    if (sprintf (buf, "%Lg", x.value) < 0
13383 +        || !strisnan (buf, 0, strlen (buf)))
13384 +      return 1;
13385 +  }
13386 +  { /* Pseudo-Infinity.  */
13387 +    static union { unsigned int word[4]; long double value; } x =
13388 +      { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
13389 +    if (sprintf (buf, "%Lf", x.value) < 0
13390 +        || !strisnan (buf, 0, strlen (buf)))
13391 +      return 1;
13392 +    if (sprintf (buf, "%Le", x.value) < 0
13393 +        || !strisnan (buf, 0, strlen (buf)))
13394 +      return 1;
13395 +    if (sprintf (buf, "%Lg", x.value) < 0
13396 +        || !strisnan (buf, 0, strlen (buf)))
13397 +      return 1;
13398 +  }
13399 +  { /* Pseudo-Zero.  */
13400 +    static union { unsigned int word[4]; long double value; } x =
13401 +      { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
13402 +    if (sprintf (buf, "%Lf", x.value) < 0
13403 +        || !strisnan (buf, 0, strlen (buf)))
13404 +      return 1;
13405 +    if (sprintf (buf, "%Le", x.value) < 0
13406 +        || !strisnan (buf, 0, strlen (buf)))
13407 +      return 1;
13408 +    if (sprintf (buf, "%Lg", x.value) < 0
13409 +        || !strisnan (buf, 0, strlen (buf)))
13410 +      return 1;
13411 +  }
13412 +  { /* Unnormalized number.  */
13413 +    static union { unsigned int word[4]; long double value; } x =
13414 +      { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
13415 +    if (sprintf (buf, "%Lf", x.value) < 0
13416 +        || !strisnan (buf, 0, strlen (buf)))
13417 +      return 1;
13418 +    if (sprintf (buf, "%Le", x.value) < 0
13419 +        || !strisnan (buf, 0, strlen (buf)))
13420 +      return 1;
13421 +    if (sprintf (buf, "%Lg", x.value) < 0
13422 +        || !strisnan (buf, 0, strlen (buf)))
13423 +      return 1;
13424 +  }
13425 +  { /* Pseudo-Denormal.  */
13426 +    static union { unsigned int word[4]; long double value; } x =
13427 +      { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
13428 +    if (sprintf (buf, "%Lf", x.value) < 0
13429 +        || !strisnan (buf, 0, strlen (buf)))
13430 +      return 1;
13431 +    if (sprintf (buf, "%Le", x.value) < 0
13432 +        || !strisnan (buf, 0, strlen (buf)))
13433 +      return 1;
13434 +    if (sprintf (buf, "%Lg", x.value) < 0
13435 +        || !strisnan (buf, 0, strlen (buf)))
13436 +      return 1;
13437 +  }
13438 +#endif
13439 +  return 0;
13440 +}],
13441 +          [gl_cv_func_printf_infinite_long_double=yes],
13442 +          [gl_cv_func_printf_infinite_long_double=no],
13443 +          [
13444 +changequote(,)dnl
13445 +           case "$host_cpu" in
13446 +                                   # Guess no on ia64, x86_64, i386.
13447 +             ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
13448 +             *)
13449 +               case "$host_os" in
13450 +                                       # Guess yes on glibc systems.
13451 +                 *-gnu*)               gl_cv_func_printf_infinite_long_double="guessing yes";;
13452 +                                       # Guess yes on FreeBSD >= 6.
13453 +                 freebsd[1-5]*)        gl_cv_func_printf_infinite_long_double="guessing no";;
13454 +                 freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
13455 +                                       # Guess yes on MacOS X >= 10.3.
13456 +                 darwin[1-6].*)        gl_cv_func_printf_infinite_long_double="guessing no";;
13457 +                 darwin*)              gl_cv_func_printf_infinite_long_double="guessing yes";;
13458 +                                       # Guess yes on HP-UX >= 11.
13459 +                 hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
13460 +                 hpux*)                gl_cv_func_printf_infinite_long_double="guessing yes";;
13461 +                                       # Guess yes on NetBSD >= 3.
13462 +                 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
13463 +                                       gl_cv_func_printf_infinite_long_double="guessing no";;
13464 +                 netbsd*)              gl_cv_func_printf_infinite_long_double="guessing yes";;
13465 +                                       # If we don't know, assume the worst.
13466 +                 *)                    gl_cv_func_printf_infinite_long_double="guessing no";;
13467 +               esac
13468 +               ;;
13469 +           esac
13470 +changequote([,])dnl
13471 +          ])
13472 +        ])
13473 +      ;;
13474 +    *)
13475 +      gl_cv_func_printf_infinite_long_double="irrelevant"
13476 +      ;;
13477 +  esac
13478 +])
13479 +
13480 +dnl Test whether the *printf family of functions supports the 'a' and 'A'
13481 +dnl conversion specifier for hexadecimal output of floating-point numbers.
13482 +dnl (ISO C99, POSIX:2001)
13483 +dnl Result is gl_cv_func_printf_directive_a.
13484 +
13485 +AC_DEFUN([gl_PRINTF_DIRECTIVE_A],
13486 +[
13487 +  AC_REQUIRE([AC_PROG_CC])
13488 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13489 +  AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives],
13490 +    [gl_cv_func_printf_directive_a],
13491 +    [
13492 +      AC_TRY_RUN([
13493 +#include <stdio.h>
13494 +#include <string.h>
13495 +static char buf[100];
13496 +int main ()
13497 +{
13498 +  if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
13499 +      || (strcmp (buf, "0x1.922p+1 33") != 0
13500 +          && strcmp (buf, "0x3.244p+0 33") != 0
13501 +          && strcmp (buf, "0x6.488p-1 33") != 0
13502 +          && strcmp (buf, "0xc.91p-2 33") != 0))
13503 +    return 1;
13504 +  if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0
13505 +      || (strcmp (buf, "-0X1.922P+1 33") != 0
13506 +          && strcmp (buf, "-0X3.244P+0 33") != 0
13507 +          && strcmp (buf, "-0X6.488P-1 33") != 0
13508 +          && strcmp (buf, "-0XC.91P-2 33") != 0))
13509 +    return 1;
13510 +  /* This catches a FreeBSD 6.1 bug: it doesn't round.  */
13511 +  if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
13512 +      || (strcmp (buf, "0x1.83p+0 33") != 0
13513 +          && strcmp (buf, "0x3.05p-1 33") != 0
13514 +          && strcmp (buf, "0x6.0ap-2 33") != 0
13515 +          && strcmp (buf, "0xc.14p-3 33") != 0))
13516 +    return 1;
13517 +  /* This catches a FreeBSD 6.1 bug.  See
13518 +     <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
13519 +  if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0
13520 +      || buf[0] == '0')
13521 +    return 1;
13522 +  /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug.  */
13523 +  if (sprintf (buf, "%.1a", 1.999) < 0
13524 +      || (strcmp (buf, "0x1.0p+1") != 0
13525 +          && strcmp (buf, "0x2.0p+0") != 0
13526 +          && strcmp (buf, "0x4.0p-1") != 0
13527 +          && strcmp (buf, "0x8.0p-2") != 0))
13528 +    return 1;
13529 +  /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a
13530 +     glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>.  */
13531 +  if (sprintf (buf, "%.1La", 1.999L) < 0
13532 +      || (strcmp (buf, "0x1.0p+1") != 0
13533 +          && strcmp (buf, "0x2.0p+0") != 0
13534 +          && strcmp (buf, "0x4.0p-1") != 0
13535 +          && strcmp (buf, "0x8.0p-2") != 0))
13536 +    return 1;
13537 +  return 0;
13538 +}], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no],
13539 +      [
13540 +       case "$host_os" in
13541 +                               # Guess yes on glibc >= 2.5 systems.
13542 +         *-gnu*)
13543 +           AC_EGREP_CPP([BZ2908], [
13544 +             #include <features.h>
13545 +             #ifdef __GNU_LIBRARY__
13546 +              #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)
13547 +               BZ2908
13548 +              #endif
13549 +             #endif
13550 +             ],
13551 +             [gl_cv_func_printf_directive_a="guessing yes"],
13552 +             [gl_cv_func_printf_directive_a="guessing no"])
13553 +           ;;
13554 +                               # If we don't know, assume the worst.
13555 +         *)                    gl_cv_func_printf_directive_a="guessing no";;
13556 +       esac
13557 +      ])
13558 +    ])
13559 +])
13560 +
13561 +dnl Test whether the *printf family of functions supports the %F format
13562 +dnl directive. (ISO C99, POSIX:2001)
13563 +dnl Result is gl_cv_func_printf_directive_f.
13564 +
13565 +AC_DEFUN([gl_PRINTF_DIRECTIVE_F],
13566 +[
13567 +  AC_REQUIRE([AC_PROG_CC])
13568 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13569 +  AC_CACHE_CHECK([whether printf supports the 'F' directive],
13570 +    [gl_cv_func_printf_directive_f],
13571 +    [
13572 +      AC_TRY_RUN([
13573 +#include <stdio.h>
13574 +#include <string.h>
13575 +static char buf[100];
13576 +int main ()
13577 +{
13578 +  if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0
13579 +      || strcmp (buf, "1234567.000000 33") != 0)
13580 +    return 1;
13581 +  if (sprintf (buf, "%F", 1.0 / 0.0) < 0
13582 +      || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0))
13583 +    return 1;
13584 +  /* This catches a Cygwin 2007 bug.  */
13585 +  if (sprintf (buf, "%.F", 1234.0) < 0
13586 +      || strcmp (buf, "1234") != 0)
13587 +    return 1;
13588 +  return 0;
13589 +}], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no],
13590 +      [
13591 +changequote(,)dnl
13592 +       case "$host_os" in
13593 +                               # Guess yes on glibc systems.
13594 +         *-gnu*)               gl_cv_func_printf_directive_f="guessing yes";;
13595 +                               # Guess yes on FreeBSD >= 6.
13596 +         freebsd[1-5]*)        gl_cv_func_printf_directive_f="guessing no";;
13597 +         freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
13598 +                               # Guess yes on MacOS X >= 10.3.
13599 +         darwin[1-6].*)        gl_cv_func_printf_directive_f="guessing no";;
13600 +         darwin*)              gl_cv_func_printf_directive_f="guessing yes";;
13601 +                               # Guess yes on Solaris >= 2.10.
13602 +         solaris2.[0-9]*)      gl_cv_func_printf_directive_f="guessing no";;
13603 +         solaris*)             gl_cv_func_printf_directive_f="guessing yes";;
13604 +                               # If we don't know, assume the worst.
13605 +         *)                    gl_cv_func_printf_directive_f="guessing no";;
13606 +       esac
13607 +changequote([,])dnl
13608 +      ])
13609 +    ])
13610 +])
13611 +
13612 +dnl Test whether the *printf family of functions supports the %n format
13613 +dnl directive. (ISO C99, POSIX:2001)
13614 +dnl Result is gl_cv_func_printf_directive_n.
13615 +
13616 +AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
13617 +[
13618 +  AC_REQUIRE([AC_PROG_CC])
13619 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13620 +  AC_CACHE_CHECK([whether printf supports the 'n' directive],
13621 +    [gl_cv_func_printf_directive_n],
13622 +    [
13623 +      AC_TRY_RUN([
13624 +#include <stdio.h>
13625 +#include <string.h>
13626 +static char fmtstring[10];
13627 +static char buf[100];
13628 +int main ()
13629 +{
13630 +  int count = -1;
13631 +  /* Copy the format string.  Some systems (glibc with _FORTIFY_SOURCE=2)
13632 +     support %n in format strings in read-only memory but not in writable
13633 +     memory.  */
13634 +  strcpy (fmtstring, "%d %n");
13635 +  if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0
13636 +      || strcmp (buf, "123 ") != 0
13637 +      || count != 4)
13638 +    return 1;
13639 +  return 0;
13640 +}], [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no],
13641 +      [
13642 +changequote(,)dnl
13643 +       case "$host_os" in
13644 +         *)     gl_cv_func_printf_directive_n="guessing yes";;
13645 +       esac
13646 +changequote([,])dnl
13647 +      ])
13648 +    ])
13649 +])
13650 +
13651 +dnl Test whether the *printf family of functions supports POSIX/XSI format
13652 +dnl strings with positions. (POSIX:2001)
13653 +dnl Result is gl_cv_func_printf_positions.
13654 +
13655 +AC_DEFUN([gl_PRINTF_POSITIONS],
13656 +[
13657 +  AC_REQUIRE([AC_PROG_CC])
13658 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13659 +  AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions],
13660 +    [gl_cv_func_printf_positions],
13661 +    [
13662 +      AC_TRY_RUN([
13663 +#include <stdio.h>
13664 +#include <string.h>
13665 +/* The string "%2$d %1$d", with dollar characters protected from the shell's
13666 +   dollar expansion (possibly an autoconf bug).  */
13667 +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
13668 +static char buf[100];
13669 +int main ()
13670 +{
13671 +  sprintf (buf, format, 33, 55);
13672 +  return (strcmp (buf, "55 33") != 0);
13673 +}], [gl_cv_func_printf_positions=yes], [gl_cv_func_printf_positions=no],
13674 +      [
13675 +changequote(,)dnl
13676 +       case "$host_os" in
13677 +         netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
13678 +                       gl_cv_func_printf_positions="guessing no";;
13679 +         beos*)        gl_cv_func_printf_positions="guessing no";;
13680 +         mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
13681 +         *)            gl_cv_func_printf_positions="guessing yes";;
13682 +       esac
13683 +changequote([,])dnl
13684 +      ])
13685 +    ])
13686 +])
13687 +
13688 +dnl Test whether the *printf family of functions supports POSIX/XSI format
13689 +dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001)
13690 +dnl Result is gl_cv_func_printf_flag_grouping.
13691 +
13692 +AC_DEFUN([gl_PRINTF_FLAG_GROUPING],
13693 +[
13694 +  AC_REQUIRE([AC_PROG_CC])
13695 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13696 +  AC_CACHE_CHECK([whether printf supports the grouping flag],
13697 +    [gl_cv_func_printf_flag_grouping],
13698 +    [
13699 +      AC_TRY_RUN([
13700 +#include <stdio.h>
13701 +#include <string.h>
13702 +static char buf[100];
13703 +int main ()
13704 +{
13705 +  if (sprintf (buf, "%'d %d", 1234567, 99) < 0
13706 +      || buf[strlen (buf) - 1] != '9')
13707 +    return 1;
13708 +  return 0;
13709 +}], [gl_cv_func_printf_flag_grouping=yes], [gl_cv_func_printf_flag_grouping=no],
13710 +      [
13711 +changequote(,)dnl
13712 +       case "$host_os" in
13713 +         cygwin*)      gl_cv_func_printf_flag_grouping="guessing no";;
13714 +         netbsd*)      gl_cv_func_printf_flag_grouping="guessing no";;
13715 +         mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
13716 +         *)            gl_cv_func_printf_flag_grouping="guessing yes";;
13717 +       esac
13718 +changequote([,])dnl
13719 +      ])
13720 +    ])
13721 +])
13722 +
13723 +dnl Test whether the *printf family of functions supports the - flag correctly.
13724 +dnl (ISO C99.) See
13725 +dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html>
13726 +dnl Result is gl_cv_func_printf_flag_leftadjust.
13727 +
13728 +AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
13729 +[
13730 +  AC_REQUIRE([AC_PROG_CC])
13731 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13732 +  AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly],
13733 +    [gl_cv_func_printf_flag_leftadjust],
13734 +    [
13735 +      AC_TRY_RUN([
13736 +#include <stdio.h>
13737 +#include <string.h>
13738 +static char buf[100];
13739 +int main ()
13740 +{
13741 +  /* Check that a '-' flag is not annihilated by a negative width.  */
13742 +  if (sprintf (buf, "a%-*sc", -3, "b") < 0
13743 +      || strcmp (buf, "ab  c") != 0)
13744 +    return 1;
13745 +  return 0;
13746 +}],
13747 +        [gl_cv_func_printf_flag_leftadjust=yes],
13748 +        [gl_cv_func_printf_flag_leftadjust=no],
13749 +        [
13750 +changequote(,)dnl
13751 +         case "$host_os" in
13752 +                    # Guess yes on HP-UX 11.
13753 +           hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
13754 +                    # Guess no on HP-UX 10 and older.
13755 +           hpux*)   gl_cv_func_printf_flag_leftadjust="guessing no";;
13756 +                    # Guess yes otherwise.
13757 +           *)       gl_cv_func_printf_flag_leftadjust="guessing yes";;
13758 +         esac
13759 +changequote([,])dnl
13760 +        ])
13761 +    ])
13762 +])
13763 +
13764 +dnl Test whether the *printf family of functions supports padding of non-finite
13765 +dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See
13766 +dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html>
13767 +dnl Result is gl_cv_func_printf_flag_zero.
13768 +
13769 +AC_DEFUN([gl_PRINTF_FLAG_ZERO],
13770 +[
13771 +  AC_REQUIRE([AC_PROG_CC])
13772 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13773 +  AC_CACHE_CHECK([whether printf supports the zero flag correctly],
13774 +    [gl_cv_func_printf_flag_zero],
13775 +    [
13776 +      AC_TRY_RUN([
13777 +#include <stdio.h>
13778 +#include <string.h>
13779 +static char buf[100];
13780 +int main ()
13781 +{
13782 +  if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0
13783 +      || (strcmp (buf, "       inf") != 0
13784 +          && strcmp (buf, "  infinity") != 0))
13785 +    return 1;
13786 +  return 0;
13787 +}], [gl_cv_func_printf_flag_zero=yes], [gl_cv_func_printf_flag_zero=no],
13788 +      [
13789 +changequote(,)dnl
13790 +       case "$host_os" in
13791 +                 # Guess yes on glibc systems.
13792 +         *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
13793 +                 # Guess yes on BeOS.
13794 +         beos*)  gl_cv_func_printf_flag_zero="guessing yes";;
13795 +                 # If we don't know, assume the worst.
13796 +         *)      gl_cv_func_printf_flag_zero="guessing no";;
13797 +       esac
13798 +changequote([,])dnl
13799 +      ])
13800 +    ])
13801 +])
13802 +
13803 +dnl Test whether the *printf family of functions supports large precisions.
13804 +dnl On mingw, precisions larger than 512 are treated like 512, in integer,
13805 +dnl floating-point or pointer output. On BeOS, precisions larger than 1044
13806 +dnl crash the program.
13807 +dnl Result is gl_cv_func_printf_precision.
13808 +
13809 +AC_DEFUN([gl_PRINTF_PRECISION],
13810 +[
13811 +  AC_REQUIRE([AC_PROG_CC])
13812 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13813 +  AC_CACHE_CHECK([whether printf supports large precisions],
13814 +    [gl_cv_func_printf_precision],
13815 +    [
13816 +      AC_TRY_RUN([
13817 +#include <stdio.h>
13818 +#include <string.h>
13819 +static char buf[5000];
13820 +int main ()
13821 +{
13822 +#ifdef __BEOS__
13823 +  /* On BeOS, this would crash and show a dialog box.  Avoid the crash.  */
13824 +  return 1;
13825 +#endif
13826 +  if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
13827 +    return 1;
13828 +  return 0;
13829 +}], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no],
13830 +      [
13831 +changequote(,)dnl
13832 +       case "$host_os" in
13833 +         # Guess no only on native Win32 and BeOS systems.
13834 +         mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
13835 +         beos*)        gl_cv_func_printf_precision="guessing no" ;;
13836 +         *)            gl_cv_func_printf_precision="guessing yes" ;;
13837 +       esac
13838 +changequote([,])dnl
13839 +      ])
13840 +    ])
13841 +])
13842 +
13843 +dnl Test whether the *printf family of functions recovers gracefully in case
13844 +dnl of an out-of-memory condition, or whether it crashes the entire program.
13845 +dnl Result is gl_cv_func_printf_enomem.
13846 +
13847 +AC_DEFUN([gl_PRINTF_ENOMEM],
13848 +[
13849 +  AC_REQUIRE([AC_PROG_CC])
13850 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13851 +  AC_CACHE_CHECK([whether printf survives out-of-memory conditions],
13852 +    [gl_cv_func_printf_enomem],
13853 +    [
13854 +      if test "$cross_compiling" = no; then
13855 +        AC_LANG_CONFTEST([AC_LANG_SOURCE([
13856 +]GL_NOCRASH[
13857 +changequote(,)dnl
13858 +#include <stdio.h>
13859 +#include <sys/types.h>
13860 +#include <sys/time.h>
13861 +#include <sys/resource.h>
13862 +#include <errno.h>
13863 +int main()
13864 +{
13865 +  struct rlimit limit;
13866 +  int ret;
13867 +  nocrash_init ();
13868 +  /* Some printf implementations allocate temporary space with malloc.  */
13869 +  /* On BSD systems, malloc() is limited by RLIMIT_DATA.  */
13870 +#ifdef RLIMIT_DATA
13871 +  if (getrlimit (RLIMIT_DATA, &limit) < 0)
13872 +    return 77;
13873 +  if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
13874 +    limit.rlim_max = 5000000;
13875 +  limit.rlim_cur = limit.rlim_max;
13876 +  if (setrlimit (RLIMIT_DATA, &limit) < 0)
13877 +    return 77;
13878 +#endif
13879 +  /* On Linux systems, malloc() is limited by RLIMIT_AS.  */
13880 +#ifdef RLIMIT_AS
13881 +  if (getrlimit (RLIMIT_AS, &limit) < 0)
13882 +    return 77;
13883 +  if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
13884 +    limit.rlim_max = 5000000;
13885 +  limit.rlim_cur = limit.rlim_max;
13886 +  if (setrlimit (RLIMIT_AS, &limit) < 0)
13887 +    return 77;
13888 +#endif
13889 +  /* Some printf implementations allocate temporary space on the stack.  */
13890 +#ifdef RLIMIT_STACK
13891 +  if (getrlimit (RLIMIT_STACK, &limit) < 0)
13892 +    return 77;
13893 +  if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
13894 +    limit.rlim_max = 5000000;
13895 +  limit.rlim_cur = limit.rlim_max;
13896 +  if (setrlimit (RLIMIT_STACK, &limit) < 0)
13897 +    return 77;
13898 +#endif
13899 +  ret = printf ("%.5000000f", 1.0);
13900 +  return !(ret == 5000002 || (ret < 0 && errno == ENOMEM));
13901 +}
13902 +changequote([,])dnl
13903 +          ])])
13904 +        if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
13905 +          (./conftest
13906 +           result=$?
13907 +           if test $result != 0 && test $result != 77; then result=1; fi
13908 +           exit $result
13909 +          ) >/dev/null 2>/dev/null
13910 +          case $? in
13911 +            0) gl_cv_func_printf_enomem="yes" ;;
13912 +            77) gl_cv_func_printf_enomem="guessing no" ;;
13913 +            *) gl_cv_func_printf_enomem="no" ;;
13914 +          esac
13915 +        else
13916 +          gl_cv_func_printf_enomem="guessing no"
13917 +        fi
13918 +        rm -fr conftest*
13919 +      else
13920 +changequote(,)dnl
13921 +        case "$host_os" in
13922 +                    # Guess yes on glibc systems.
13923 +          *-gnu*)   gl_cv_func_printf_enomem="guessing yes";;
13924 +                    # Guess yes on Solaris.
13925 +          solaris*) gl_cv_func_printf_enomem="guessing yes";;
13926 +                    # Guess yes on AIX.
13927 +          aix*)     gl_cv_func_printf_enomem="guessing yes";;
13928 +                    # Guess yes on HP-UX/hppa.
13929 +          hpux*)    case "$host_cpu" in
13930 +                      hppa*) gl_cv_func_printf_enomem="guessing yes";;
13931 +                      *)     gl_cv_func_printf_enomem="guessing no";;
13932 +                    esac
13933 +                    ;;
13934 +                    # Guess yes on IRIX.
13935 +          irix*)    gl_cv_func_printf_enomem="guessing yes";;
13936 +                    # Guess yes on OSF/1.
13937 +          osf*)     gl_cv_func_printf_enomem="guessing yes";;
13938 +                    # Guess yes on BeOS.
13939 +          beos*)    gl_cv_func_printf_enomem="guessing yes";;
13940 +                    # If we don't know, assume the worst.
13941 +          *)        gl_cv_func_printf_enomem="guessing no";;
13942 +        esac
13943 +changequote([,])dnl
13944 +      fi
13945 +    ])
13946 +])
13947 +
13948 +dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001)
13949 +dnl Result is ac_cv_func_snprintf.
13950 +
13951 +AC_DEFUN([gl_SNPRINTF_PRESENCE],
13952 +[
13953 +  AC_CHECK_FUNCS_ONCE([snprintf])
13954 +])
13955 +
13956 +dnl Test whether the string produced by the snprintf function is always NUL
13957 +dnl terminated. (ISO C99, POSIX:2001)
13958 +dnl Result is gl_cv_func_snprintf_truncation_c99.
13959 +
13960 +AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99],
13961 +[
13962 +  AC_REQUIRE([AC_PROG_CC])
13963 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13964 +  AC_CACHE_CHECK([whether snprintf truncates the result as in C99],
13965 +    [gl_cv_func_snprintf_truncation_c99],
13966 +    [
13967 +      AC_TRY_RUN([
13968 +#include <stdio.h>
13969 +#include <string.h>
13970 +static char buf[100];
13971 +int main ()
13972 +{
13973 +  strcpy (buf, "ABCDEF");
13974 +  snprintf (buf, 3, "%d %d", 4567, 89);
13975 +  if (memcmp (buf, "45\0DEF", 6) != 0)
13976 +    return 1;
13977 +  return 0;
13978 +}], [gl_cv_func_snprintf_truncation_c99=yes], [gl_cv_func_snprintf_truncation_c99=no],
13979 +      [
13980 +changequote(,)dnl
13981 +       case "$host_os" in
13982 +                               # Guess yes on glibc systems.
13983 +         *-gnu*)               gl_cv_func_snprintf_truncation_c99="guessing yes";;
13984 +                               # Guess yes on FreeBSD >= 5.
13985 +         freebsd[1-4]*)        gl_cv_func_snprintf_truncation_c99="guessing no";;
13986 +         freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
13987 +                               # Guess yes on MacOS X >= 10.3.
13988 +         darwin[1-6].*)        gl_cv_func_snprintf_truncation_c99="guessing no";;
13989 +         darwin*)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
13990 +                               # Guess yes on OpenBSD >= 3.9.
13991 +         openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
13992 +                               gl_cv_func_snprintf_truncation_c99="guessing no";;
13993 +         openbsd*)             gl_cv_func_snprintf_truncation_c99="guessing yes";;
13994 +                               # Guess yes on Solaris >= 2.6.
13995 +         solaris2.[0-5]*)      gl_cv_func_snprintf_truncation_c99="guessing no";;
13996 +         solaris*)             gl_cv_func_snprintf_truncation_c99="guessing yes";;
13997 +                               # Guess yes on AIX >= 4.
13998 +         aix[1-3]*)            gl_cv_func_snprintf_truncation_c99="guessing no";;
13999 +         aix*)                 gl_cv_func_snprintf_truncation_c99="guessing yes";;
14000 +                               # Guess yes on HP-UX >= 11.
14001 +         hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
14002 +         hpux*)                gl_cv_func_snprintf_truncation_c99="guessing yes";;
14003 +                               # Guess yes on IRIX >= 6.5.
14004 +         irix6.5)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
14005 +                               # Guess yes on OSF/1 >= 5.
14006 +         osf[3-4]*)            gl_cv_func_snprintf_truncation_c99="guessing no";;
14007 +         osf*)                 gl_cv_func_snprintf_truncation_c99="guessing yes";;
14008 +                               # Guess yes on NetBSD >= 3.
14009 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
14010 +                               gl_cv_func_snprintf_truncation_c99="guessing no";;
14011 +         netbsd*)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
14012 +                               # Guess yes on BeOS.
14013 +         beos*)                gl_cv_func_snprintf_truncation_c99="guessing yes";;
14014 +                               # If we don't know, assume the worst.
14015 +         *)                    gl_cv_func_snprintf_truncation_c99="guessing no";;
14016 +       esac
14017 +changequote([,])dnl
14018 +      ])
14019 +    ])
14020 +])
14021 +
14022 +dnl Test whether the return value of the snprintf function is the number
14023 +dnl of bytes (excluding the terminating NUL) that would have been produced
14024 +dnl if the buffer had been large enough. (ISO C99, POSIX:2001)
14025 +dnl For example, this test program fails on IRIX 6.5:
14026 +dnl     ---------------------------------------------------------------------
14027 +dnl     #include <stdio.h>
14028 +dnl     int main()
14029 +dnl     {
14030 +dnl       static char buf[8];
14031 +dnl       int retval = snprintf (buf, 3, "%d", 12345);
14032 +dnl       return retval >= 0 && retval < 3;
14033 +dnl     }
14034 +dnl     ---------------------------------------------------------------------
14035 +dnl Result is gl_cv_func_snprintf_retval_c99.
14036 +
14037 +AC_DEFUN([gl_SNPRINTF_RETVAL_C99],
14038 +[
14039 +  AC_REQUIRE([AC_PROG_CC])
14040 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14041 +  AC_CACHE_CHECK([whether snprintf returns a byte count as in C99],
14042 +    [gl_cv_func_snprintf_retval_c99],
14043 +    [
14044 +      AC_TRY_RUN([
14045 +#include <stdio.h>
14046 +#include <string.h>
14047 +static char buf[100];
14048 +int main ()
14049 +{
14050 +  strcpy (buf, "ABCDEF");
14051 +  if (snprintf (buf, 3, "%d %d", 4567, 89) != 7)
14052 +    return 1;
14053 +  return 0;
14054 +}], [gl_cv_func_snprintf_retval_c99=yes], [gl_cv_func_snprintf_retval_c99=no],
14055 +      [
14056 +changequote(,)dnl
14057 +       case "$host_os" in
14058 +                               # Guess yes on glibc systems.
14059 +         *-gnu*)               gl_cv_func_snprintf_retval_c99="guessing yes";;
14060 +                               # Guess yes on FreeBSD >= 5.
14061 +         freebsd[1-4]*)        gl_cv_func_snprintf_retval_c99="guessing no";;
14062 +         freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
14063 +                               # Guess yes on MacOS X >= 10.3.
14064 +         darwin[1-6].*)        gl_cv_func_snprintf_retval_c99="guessing no";;
14065 +         darwin*)              gl_cv_func_snprintf_retval_c99="guessing yes";;
14066 +                               # Guess yes on OpenBSD >= 3.9.
14067 +         openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
14068 +                               gl_cv_func_snprintf_retval_c99="guessing no";;
14069 +         openbsd*)             gl_cv_func_snprintf_retval_c99="guessing yes";;
14070 +                               # Guess yes on Solaris >= 2.6.
14071 +         solaris2.[0-5]*)      gl_cv_func_snprintf_retval_c99="guessing no";;
14072 +         solaris*)             gl_cv_func_snprintf_retval_c99="guessing yes";;
14073 +                               # Guess yes on AIX >= 4.
14074 +         aix[1-3]*)            gl_cv_func_snprintf_retval_c99="guessing no";;
14075 +         aix*)                 gl_cv_func_snprintf_retval_c99="guessing yes";;
14076 +                               # Guess yes on NetBSD >= 3.
14077 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
14078 +                               gl_cv_func_snprintf_retval_c99="guessing no";;
14079 +         netbsd*)              gl_cv_func_snprintf_retval_c99="guessing yes";;
14080 +                               # Guess yes on BeOS.
14081 +         beos*)                gl_cv_func_snprintf_retval_c99="guessing yes";;
14082 +                               # If we don't know, assume the worst.
14083 +         *)                    gl_cv_func_snprintf_retval_c99="guessing no";;
14084 +       esac
14085 +changequote([,])dnl
14086 +      ])
14087 +    ])
14088 +])
14089 +
14090 +dnl Test whether the snprintf function supports the %n format directive
14091 +dnl also in truncated portions of the format string. (ISO C99, POSIX:2001)
14092 +dnl Result is gl_cv_func_snprintf_directive_n.
14093 +
14094 +AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
14095 +[
14096 +  AC_REQUIRE([AC_PROG_CC])
14097 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14098 +  AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive],
14099 +    [gl_cv_func_snprintf_directive_n],
14100 +    [
14101 +      AC_TRY_RUN([
14102 +#include <stdio.h>
14103 +#include <string.h>
14104 +static char fmtstring[10];
14105 +static char buf[100];
14106 +int main ()
14107 +{
14108 +  int count = -1;
14109 +  /* Copy the format string.  Some systems (glibc with _FORTIFY_SOURCE=2)
14110 +     support %n in format strings in read-only memory but not in writable
14111 +     memory.  */
14112 +  strcpy (fmtstring, "%d %n");
14113 +  snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55);
14114 +  if (count != 6)
14115 +    return 1;
14116 +  return 0;
14117 +}], [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no],
14118 +      [
14119 +changequote(,)dnl
14120 +       case "$host_os" in
14121 +                               # Guess yes on glibc systems.
14122 +         *-gnu*)               gl_cv_func_snprintf_directive_n="guessing yes";;
14123 +                               # Guess yes on FreeBSD >= 5.
14124 +         freebsd[1-4]*)        gl_cv_func_snprintf_directive_n="guessing no";;
14125 +         freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
14126 +                               # Guess yes on MacOS X >= 10.3.
14127 +         darwin[1-6].*)        gl_cv_func_snprintf_directive_n="guessing no";;
14128 +         darwin*)              gl_cv_func_snprintf_directive_n="guessing yes";;
14129 +                               # Guess yes on Solaris >= 2.6.
14130 +         solaris2.[0-5]*)      gl_cv_func_snprintf_directive_n="guessing no";;
14131 +         solaris*)             gl_cv_func_snprintf_directive_n="guessing yes";;
14132 +                               # Guess yes on AIX >= 4.
14133 +         aix[1-3]*)            gl_cv_func_snprintf_directive_n="guessing no";;
14134 +         aix*)                 gl_cv_func_snprintf_directive_n="guessing yes";;
14135 +                               # Guess yes on IRIX >= 6.5.
14136 +         irix6.5)              gl_cv_func_snprintf_directive_n="guessing yes";;
14137 +                               # Guess yes on OSF/1 >= 5.
14138 +         osf[3-4]*)            gl_cv_func_snprintf_directive_n="guessing no";;
14139 +         osf*)                 gl_cv_func_snprintf_directive_n="guessing yes";;
14140 +                               # Guess yes on NetBSD >= 3.
14141 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
14142 +                               gl_cv_func_snprintf_directive_n="guessing no";;
14143 +         netbsd*)              gl_cv_func_snprintf_directive_n="guessing yes";;
14144 +                               # Guess yes on BeOS.
14145 +         beos*)                gl_cv_func_snprintf_directive_n="guessing yes";;
14146 +                               # If we don't know, assume the worst.
14147 +         *)                    gl_cv_func_snprintf_directive_n="guessing no";;
14148 +       esac
14149 +changequote([,])dnl
14150 +      ])
14151 +    ])
14152 +])
14153 +
14154 +dnl Test whether the snprintf function, when passed a size = 1, writes any
14155 +dnl output without bounds in this case, behaving like sprintf. This is the
14156 +dnl case on Linux libc5.
14157 +dnl Result is gl_cv_func_snprintf_size1.
14158 +
14159 +AC_DEFUN([gl_SNPRINTF_SIZE1],
14160 +[
14161 +  AC_REQUIRE([AC_PROG_CC])
14162 +  AC_CACHE_CHECK([whether snprintf respects a size of 1],
14163 +    [gl_cv_func_snprintf_size1],
14164 +    [
14165 +      AC_TRY_RUN([
14166 +#include <stdio.h>
14167 +int main()
14168 +{
14169 +  static char buf[8] = "DEADBEEF";
14170 +  snprintf (buf, 1, "%d", 12345);
14171 +  return buf[1] != 'E';
14172 +}],
14173 +      [gl_cv_func_snprintf_size1=yes],
14174 +      [gl_cv_func_snprintf_size1=no],
14175 +      [gl_cv_func_snprintf_size1="guessing yes"])
14176 +    ])
14177 +])
14178 +
14179 +dnl Test whether the vsnprintf function, when passed a zero size, produces no
14180 +dnl output. (ISO C99, POSIX:2001)
14181 +dnl For example, snprintf nevertheless writes a NUL byte in this case
14182 +dnl on OSF/1 5.1:
14183 +dnl     ---------------------------------------------------------------------
14184 +dnl     #include <stdio.h>
14185 +dnl     int main()
14186 +dnl     {
14187 +dnl       static char buf[8] = "DEADBEEF";
14188 +dnl       snprintf (buf, 0, "%d", 12345);
14189 +dnl       return buf[0] != 'D';
14190 +dnl     }
14191 +dnl     ---------------------------------------------------------------------
14192 +dnl And vsnprintf writes any output without bounds in this case, behaving like
14193 +dnl vsprintf, on HP-UX 11 and OSF/1 5.1:
14194 +dnl     ---------------------------------------------------------------------
14195 +dnl     #include <stdarg.h>
14196 +dnl     #include <stdio.h>
14197 +dnl     static int my_snprintf (char *buf, int size, const char *format, ...)
14198 +dnl     {
14199 +dnl       va_list args;
14200 +dnl       int ret;
14201 +dnl       va_start (args, format);
14202 +dnl       ret = vsnprintf (buf, size, format, args);
14203 +dnl       va_end (args);
14204 +dnl       return ret;
14205 +dnl     }
14206 +dnl     int main()
14207 +dnl     {
14208 +dnl       static char buf[8] = "DEADBEEF";
14209 +dnl       my_snprintf (buf, 0, "%d", 12345);
14210 +dnl       return buf[0] != 'D';
14211 +dnl     }
14212 +dnl     ---------------------------------------------------------------------
14213 +dnl Result is gl_cv_func_vsnprintf_zerosize_c99.
14214 +
14215 +AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99],
14216 +[
14217 +  AC_REQUIRE([AC_PROG_CC])
14218 +  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14219 +  AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99],
14220 +    [gl_cv_func_vsnprintf_zerosize_c99],
14221 +    [
14222 +      AC_TRY_RUN([
14223 +#include <stdarg.h>
14224 +#include <stdio.h>
14225 +static int my_snprintf (char *buf, int size, const char *format, ...)
14226 +{
14227 +  va_list args;
14228 +  int ret;
14229 +  va_start (args, format);
14230 +  ret = vsnprintf (buf, size, format, args);
14231 +  va_end (args);
14232 +  return ret;
14233 +}
14234 +int main()
14235 +{
14236 +  static char buf[8] = "DEADBEEF";
14237 +  my_snprintf (buf, 0, "%d", 12345);
14238 +  return buf[0] != 'D';
14239 +}],
14240 +      [gl_cv_func_vsnprintf_zerosize_c99=yes],
14241 +      [gl_cv_func_vsnprintf_zerosize_c99=no],
14242 +      [
14243 +changequote(,)dnl
14244 +       case "$host_os" in
14245 +                               # Guess yes on glibc systems.
14246 +         *-gnu*)               gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14247 +                               # Guess yes on FreeBSD >= 5.
14248 +         freebsd[1-4]*)        gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14249 +         freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14250 +                               # Guess yes on MacOS X >= 10.3.
14251 +         darwin[1-6].*)        gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14252 +         darwin*)              gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14253 +                               # Guess yes on Cygwin.
14254 +         cygwin*)              gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14255 +                               # Guess yes on Solaris >= 2.6.
14256 +         solaris2.[0-5]*)      gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14257 +         solaris*)             gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14258 +                               # Guess yes on AIX >= 4.
14259 +         aix[1-3]*)            gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14260 +         aix*)                 gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14261 +                               # Guess yes on IRIX >= 6.5.
14262 +         irix6.5)              gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14263 +                               # Guess yes on NetBSD >= 3.
14264 +         netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
14265 +                               gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14266 +         netbsd*)              gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14267 +                               # Guess yes on BeOS.
14268 +         beos*)                gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14269 +                               # Guess yes on mingw.
14270 +         mingw* | pw*)         gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
14271 +                               # If we don't know, assume the worst.
14272 +         *)                    gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
14273 +       esac
14274 +changequote([,])dnl
14275 +      ])
14276 +    ])
14277 +])
14278 +
14279 +dnl The results of these tests on various platforms are:
14280 +dnl
14281 +dnl 1 = gl_PRINTF_SIZES_C99
14282 +dnl 2 = gl_PRINTF_LONG_DOUBLE
14283 +dnl 3 = gl_PRINTF_INFINITE
14284 +dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE
14285 +dnl 5 = gl_PRINTF_DIRECTIVE_A
14286 +dnl 6 = gl_PRINTF_DIRECTIVE_F
14287 +dnl 7 = gl_PRINTF_DIRECTIVE_N
14288 +dnl 8 = gl_PRINTF_POSITIONS
14289 +dnl 9 = gl_PRINTF_FLAG_GROUPING
14290 +dnl 10 = gl_PRINTF_FLAG_LEFTADJUST
14291 +dnl 11 = gl_PRINTF_FLAG_ZERO
14292 +dnl 12 = gl_PRINTF_PRECISION
14293 +dnl 13 = gl_PRINTF_ENOMEM
14294 +dnl 14 = gl_SNPRINTF_PRESENCE
14295 +dnl 15 = gl_SNPRINTF_TRUNCATION_C99
14296 +dnl 16 = gl_SNPRINTF_RETVAL_C99
14297 +dnl 17 = gl_SNPRINTF_DIRECTIVE_N
14298 +dnl 18 = gl_SNPRINTF_SIZE1
14299 +dnl 19 = gl_VSNPRINTF_ZEROSIZE_C99
14300 +dnl
14301 +dnl 1 = checking whether printf supports size specifiers as in C99...
14302 +dnl 2 = checking whether printf supports 'long double' arguments...
14303 +dnl 3 = checking whether printf supports infinite 'double' arguments...
14304 +dnl 4 = checking whether printf supports infinite 'long double' arguments...
14305 +dnl 5 = checking whether printf supports the 'a' and 'A' directives...
14306 +dnl 6 = checking whether printf supports the 'F' directive...
14307 +dnl 7 = checking whether printf supports the 'n' directive...
14308 +dnl 8 = checking whether printf supports POSIX/XSI format strings with positions...
14309 +dnl 9 = checking whether printf supports the grouping flag...
14310 +dnl 10 = checking whether printf supports the left-adjust flag correctly...
14311 +dnl 11 = checking whether printf supports the zero flag correctly...
14312 +dnl 12 = checking whether printf supports large precisions...
14313 +dnl 13 = checking whether printf survives out-of-memory conditions...
14314 +dnl 14 = checking for snprintf...
14315 +dnl 15 = checking whether snprintf truncates the result as in C99...
14316 +dnl 16 = checking whether snprintf returns a byte count as in C99...
14317 +dnl 17 = checking whether snprintf fully supports the 'n' directive...
14318 +dnl 18 = checking whether snprintf respects a size of 1...
14319 +dnl 19 = checking whether vsnprintf respects a zero size as in C99...
14320 +dnl
14321 +dnl . = yes, # = no.
14322 +dnl
14323 +dnl                                  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19
14324 +dnl   glibc 2.5                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
14325 +dnl   glibc 2.3.6                    .  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .
14326 +dnl   FreeBSD 5.4, 6.1               .  .  .  .  #  .  .  .  .  .  #  .  #  .  .  .  .  .  .
14327 +dnl   MacOS X 10.3.9                 .  .  .  .  #  .  .  .  .  .  #  .  #  .  .  .  .  .  .
14328 +dnl   OpenBSD 3.9, 4.0               .  .  #  #  #  #  .  .  #  .  #  .  #  .  .  .  .  .  .
14329 +dnl   Cygwin 2007 (= Cygwin 1.5.24)  .  .  .  .  #  #  .  .  .  ?  #  ?  ?  .  .  .  .  .  .
14330 +dnl   Cygwin 2006 (= Cygwin 1.5.19)  #  .  .  .  #  #  .  .  #  ?  #  ?  ?  .  .  .  .  .  .
14331 +dnl   Solaris 10                     .  .  #  #  #  .  .  .  .  .  #  .  .  .  .  .  .  .  .
14332 +dnl   Solaris 2.6 ... 9              #  .  #  #  #  #  .  .  .  .  #  .  .  .  .  .  .  .  .
14333 +dnl   Solaris 2.5.1                  #  .  #  #  #  #  .  .  .  .  #  .  .  #  #  #  #  #  #
14334 +dnl   AIX 5.2                        .  .  #  #  #  .  .  .  .  .  #  .  .  .  .  .  .  .  .
14335 +dnl   AIX 4.3.2, 5.1                 #  .  #  #  #  #  .  .  .  .  #  .  .  .  .  .  .  .  .
14336 +dnl   HP-UX 11.31                    .  .  .  .  #  .  .  .  .  .  #  .  .  .  .  #  #  .  .
14337 +dnl   HP-UX 11.{00,11,23}            #  .  .  .  #  #  .  .  .  .  #  .  .  .  .  #  #  .  #
14338 +dnl   HP-UX 10.20                    #  .  .  .  #  #  .  .  .  #  #  .  .  .  .  #  #  ?  #
14339 +dnl   IRIX 6.5                       #  .  #  #  #  #  .  .  .  .  #  .  .  .  .  #  .  .  .
14340 +dnl   OSF/1 5.1                      #  .  #  #  #  #  .  .  .  .  #  .  .  .  .  #  .  .  #
14341 +dnl   OSF/1 4.0d                     #  .  #  #  #  #  .  .  .  .  #  .  .  #  #  #  #  #  #
14342 +dnl   NetBSD 4.0                     .  ?  ?  ?  ?  ?  .  .  ?  ?  ?  ?  ?  .  .  .  ?  ?  ?
14343 +dnl   NetBSD 3.0                     .  .  .  .  #  #  .  #  #  ?  #  .  #  .  .  .  .  .  .
14344 +dnl   BeOS                           #  #  .  #  #  #  .  #  .  ?  .  #  ?  .  .  .  .  .  .
14345 +dnl   mingw                          #  #  #  #  #  #  .  #  #  .  #  #  ?  .  #  #  #  .  .
14346 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/size_max.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/size_max.m4
14347 --- gtk-vnc-0.3.7.mingw/gnulib/m4/size_max.m4   1970-01-01 01:00:00.000000000 +0100
14348 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/size_max.m4  2008-10-09 12:24:39.000000000 +0100
14349 @@ -0,0 +1,68 @@
14350 +# size_max.m4 serial 6
14351 +dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc.
14352 +dnl This file is free software; the Free Software Foundation
14353 +dnl gives unlimited permission to copy and/or distribute it,
14354 +dnl with or without modifications, as long as this notice is preserved.
14355 +
14356 +dnl From Bruno Haible.
14357 +
14358 +AC_DEFUN([gl_SIZE_MAX],
14359 +[
14360 +  AC_CHECK_HEADERS(stdint.h)
14361 +  dnl First test whether the system already has SIZE_MAX.
14362 +  AC_MSG_CHECKING([for SIZE_MAX])
14363 +  AC_CACHE_VAL([gl_cv_size_max], [
14364 +    gl_cv_size_max=
14365 +    AC_EGREP_CPP([Found it], [
14366 +#include <limits.h>
14367 +#if HAVE_STDINT_H
14368 +#include <stdint.h>
14369 +#endif
14370 +#ifdef SIZE_MAX
14371 +Found it
14372 +#endif
14373 +], gl_cv_size_max=yes)
14374 +    if test -z "$gl_cv_size_max"; then
14375 +      dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
14376 +      dnl than the type 'unsigned long'. Try hard to find a definition that can
14377 +      dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
14378 +      AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1],
14379 +        [#include <stddef.h>
14380 +#include <limits.h>], size_t_bits_minus_1=)
14381 +      AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)],
14382 +        [#include <stddef.h>], fits_in_uint=)
14383 +      if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
14384 +        if test $fits_in_uint = 1; then
14385 +          dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
14386 +          dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
14387 +          AC_TRY_COMPILE([#include <stddef.h>
14388 +            extern size_t foo;
14389 +            extern unsigned long foo;
14390 +            ], [], fits_in_uint=0)
14391 +        fi
14392 +        dnl We cannot use 'expr' to simplify this expression, because 'expr'
14393 +        dnl works only with 'long' integers in the host environment, while we
14394 +        dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
14395 +        if test $fits_in_uint = 1; then
14396 +          gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
14397 +        else
14398 +          gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
14399 +        fi
14400 +      else
14401 +        dnl Shouldn't happen, but who knows...
14402 +        gl_cv_size_max='((size_t)~(size_t)0)'
14403 +      fi
14404 +    fi
14405 +  ])
14406 +  AC_MSG_RESULT([$gl_cv_size_max])
14407 +  if test "$gl_cv_size_max" != yes; then
14408 +    AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max],
14409 +      [Define as the maximum value of type 'size_t', if the system doesn't define it.])
14410 +  fi
14411 +])
14412 +
14413 +dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
14414 +dnl Remove this when we can assume autoconf >= 2.61.
14415 +m4_ifdef([AC_COMPUTE_INT], [], [
14416 +  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
14417 +])
14418 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/snprintf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/snprintf.m4
14419 --- gtk-vnc-0.3.7.mingw/gnulib/m4/snprintf.m4   1970-01-01 01:00:00.000000000 +0100
14420 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/snprintf.m4  2008-10-09 12:24:39.000000000 +0100
14421 @@ -0,0 +1,40 @@
14422 +# snprintf.m4 serial 5
14423 +dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
14424 +dnl This file is free software; the Free Software Foundation
14425 +dnl gives unlimited permission to copy and/or distribute it,
14426 +dnl with or without modifications, as long as this notice is preserved.
14427 +
14428 +AC_DEFUN([gl_FUNC_SNPRINTF],
14429 +[
14430 +  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
14431 +  gl_cv_func_snprintf_usable=no
14432 +  AC_CHECK_FUNCS([snprintf])
14433 +  if test $ac_cv_func_snprintf = yes; then
14434 +    gl_SNPRINTF_SIZE1
14435 +    case "$gl_cv_func_snprintf_size1" in
14436 +      *yes)
14437 +        gl_cv_func_snprintf_usable=yes
14438 +        ;;
14439 +    esac
14440 +  fi
14441 +  if test $gl_cv_func_snprintf_usable = no; then
14442 +    gl_REPLACE_SNPRINTF
14443 +  fi
14444 +  AC_CHECK_DECLS_ONCE([snprintf])
14445 +  if test $ac_cv_have_decl_snprintf = no; then
14446 +    HAVE_DECL_SNPRINTF=0
14447 +  fi
14448 +])
14449 +
14450 +AC_DEFUN([gl_REPLACE_SNPRINTF],
14451 +[
14452 +  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
14453 +  AC_LIBOBJ([snprintf])
14454 +  if test $ac_cv_func_snprintf = yes; then
14455 +    REPLACE_SNPRINTF=1
14456 +  fi
14457 +  gl_PREREQ_SNPRINTF
14458 +])
14459 +
14460 +# Prerequisites of lib/snprintf.c.
14461 +AC_DEFUN([gl_PREREQ_SNPRINTF], [:])
14462 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/socklen.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/socklen.m4
14463 --- gtk-vnc-0.3.7.mingw/gnulib/m4/socklen.m4    1970-01-01 01:00:00.000000000 +0100
14464 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/socklen.m4   2008-10-09 12:24:39.000000000 +0100
14465 @@ -0,0 +1,52 @@
14466 +# socklen.m4 serial 6
14467 +dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
14468 +dnl This file is free software; the Free Software Foundation
14469 +dnl gives unlimited permission to copy and/or distribute it,
14470 +dnl with or without modifications, as long as this notice is preserved.
14471 +
14472 +dnl From Albert Chin, Windows fixes from Simon Josefsson.
14473 +
14474 +dnl Check for socklen_t: historically on BSD it is an int, and in
14475 +dnl POSIX 1g it is a type of its own, but some platforms use different
14476 +dnl types for the argument to getsockopt, getpeername, etc.  So we
14477 +dnl have to test to find something that will work.
14478 +
14479 +dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
14480 +dnl it there first.  That file is included by gnulib's sys_socket.in.h, which
14481 +dnl all users of this module should include.  Cygwin must not include
14482 +dnl ws2tcpip.h.
14483 +AC_DEFUN([gl_TYPE_SOCKLEN_T],
14484 +  [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl
14485 +   AC_CHECK_TYPE([socklen_t], ,
14486 +     [AC_MSG_CHECKING([for socklen_t equivalent])
14487 +      AC_CACHE_VAL([gl_cv_socklen_t_equiv],
14488 +       [# Systems have either "struct sockaddr *" or
14489 +        # "void *" as the second argument to getpeername
14490 +        gl_cv_socklen_t_equiv=
14491 +        for arg2 in "struct sockaddr" void; do
14492 +          for t in int size_t "unsigned int" "long int" "unsigned long int"; do
14493 +            AC_TRY_COMPILE(
14494 +              [#include <sys/types.h>
14495 +               #include <sys/socket.h>
14496 +
14497 +               int getpeername (int, $arg2 *, $t *);],
14498 +              [$t len;
14499 +               getpeername (0, 0, &len);],
14500 +              [gl_cv_socklen_t_equiv="$t"])
14501 +            test "$gl_cv_socklen_t_equiv" != "" && break
14502 +          done
14503 +          test "$gl_cv_socklen_t_equiv" != "" && break
14504 +        done
14505 +      ])
14506 +      if test "$gl_cv_socklen_t_equiv" = ""; then
14507 +       AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
14508 +      fi
14509 +      AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
14510 +      AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
14511 +       [type to use in place of socklen_t if not defined])],
14512 +     [#include <sys/types.h>
14513 +      #if HAVE_SYS_SOCKET_H
14514 +      # include <sys/socket.h>
14515 +      #elif HAVE_WS2TCPIP_H
14516 +      # include <ws2tcpip.h>
14517 +      #endif])])
14518 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/sockpfaf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/sockpfaf.m4
14519 --- gtk-vnc-0.3.7.mingw/gnulib/m4/sockpfaf.m4   1970-01-01 01:00:00.000000000 +0100
14520 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/sockpfaf.m4  2008-10-09 12:24:39.000000000 +0100
14521 @@ -0,0 +1,58 @@
14522 +# sockpfaf.m4 serial 5
14523 +dnl Copyright (C) 2004, 2006 Free Software Foundation, Inc.
14524 +dnl This file is free software; the Free Software Foundation
14525 +dnl gives unlimited permission to copy and/or distribute it,
14526 +dnl with or without modifications, as long as this notice is preserved.
14527 +
14528 +dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...)
14529 +dnl and some common address families (AF_INET, AF_INET6, ...).
14530 +dnl This test assumes that a system supports an address family if and only if
14531 +dnl it supports the corresponding protocol family.
14532 +
14533 +dnl From Bruno Haible.
14534 +
14535 +AC_DEFUN([gl_SOCKET_FAMILIES],
14536 +[
14537 +  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
14538 +  AC_CHECK_HEADERS_ONCE([netinet/in.h])
14539 +
14540 +  AC_MSG_CHECKING(for IPv4 sockets)
14541 +  AC_CACHE_VAL(gl_cv_socket_ipv4,
14542 +    [AC_TRY_COMPILE([#include <sys/types.h>
14543 +#ifdef HAVE_SYS_SOCKET_H
14544 +#include <sys/socket.h>
14545 +#endif
14546 +#ifdef HAVE_NETINET_IN_H
14547 +#include <netinet/in.h>
14548 +#endif
14549 +#ifdef HAVE_WINSOCK2_H
14550 +#include <winsock2.h>
14551 +#endif],
14552 +[int x = AF_INET; struct in_addr y; struct sockaddr_in z;
14553 + if (&x && &y && &z) return 0;],
14554 +       gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
14555 +  AC_MSG_RESULT($gl_cv_socket_ipv4)
14556 +  if test $gl_cv_socket_ipv4 = yes; then
14557 +    AC_DEFINE(HAVE_IPV4, 1, [Define to 1 if <sys/socket.h> defines AF_INET.])
14558 +  fi
14559 +
14560 +  AC_MSG_CHECKING(for IPv6 sockets)
14561 +  AC_CACHE_VAL(gl_cv_socket_ipv6,
14562 +    [AC_TRY_COMPILE([#include <sys/types.h>
14563 +#ifdef HAVE_SYS_SOCKET_H
14564 +#include <sys/socket.h>
14565 +#endif
14566 +#ifdef HAVE_NETINET_IN_H
14567 +#include <netinet/in.h>
14568 +#endif
14569 +#ifdef HAVE_WINSOCK2_H
14570 +#include <winsock2.h>
14571 +#endif],
14572 +[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
14573 + if (&x && &y && &z) return 0;],
14574 +       gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
14575 +  AC_MSG_RESULT($gl_cv_socket_ipv6)
14576 +  if test $gl_cv_socket_ipv6 = yes; then
14577 +    AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if <sys/socket.h> defines AF_INET6.])
14578 +  fi
14579 +])
14580 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/stdbool.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdbool.m4
14581 --- gtk-vnc-0.3.7.mingw/gnulib/m4/stdbool.m4    1970-01-01 01:00:00.000000000 +0100
14582 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdbool.m4   2008-10-09 12:24:39.000000000 +0100
14583 @@ -0,0 +1,115 @@
14584 +# Check for stdbool.h that conforms to C99.
14585 +
14586 +dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
14587 +dnl This file is free software; the Free Software Foundation
14588 +dnl gives unlimited permission to copy and/or distribute it,
14589 +dnl with or without modifications, as long as this notice is preserved.
14590 +
14591 +# Prepare for substituting <stdbool.h> if it is not supported.
14592 +
14593 +AC_DEFUN([AM_STDBOOL_H],
14594 +[
14595 +  AC_REQUIRE([AC_HEADER_STDBOOL])
14596 +
14597 +  # Define two additional variables used in the Makefile substitution.
14598 +
14599 +  if test "$ac_cv_header_stdbool_h" = yes; then
14600 +    STDBOOL_H=''
14601 +  else
14602 +    STDBOOL_H='stdbool.h'
14603 +  fi
14604 +  AC_SUBST([STDBOOL_H])
14605 +
14606 +  if test "$ac_cv_type__Bool" = yes; then
14607 +    HAVE__BOOL=1
14608 +  else
14609 +    HAVE__BOOL=0
14610 +  fi
14611 +  AC_SUBST([HAVE__BOOL])
14612 +])
14613 +
14614 +# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
14615 +AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
14616 +
14617 +# This macro is only needed in autoconf <= 2.59.  Newer versions of autoconf
14618 +# have this macro built-in.
14619 +
14620 +AC_DEFUN([AC_HEADER_STDBOOL],
14621 +  [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
14622 +     [ac_cv_header_stdbool_h],
14623 +     [AC_TRY_COMPILE(
14624 +       [
14625 +         #include <stdbool.h>
14626 +         #ifndef bool
14627 +          "error: bool is not defined"
14628 +         #endif
14629 +         #ifndef false
14630 +          "error: false is not defined"
14631 +         #endif
14632 +         #if false
14633 +          "error: false is not 0"
14634 +         #endif
14635 +         #ifndef true
14636 +          "error: true is not defined"
14637 +         #endif
14638 +         #if true != 1
14639 +          "error: true is not 1"
14640 +         #endif
14641 +         #ifndef __bool_true_false_are_defined
14642 +          "error: __bool_true_false_are_defined is not defined"
14643 +         #endif
14644 +
14645 +         struct s { _Bool s: 1; _Bool t; } s;
14646 +
14647 +         char a[true == 1 ? 1 : -1];
14648 +         char b[false == 0 ? 1 : -1];
14649 +         char c[__bool_true_false_are_defined == 1 ? 1 : -1];
14650 +         char d[(bool) 0.5 == true ? 1 : -1];
14651 +         bool e = &s;
14652 +         char f[(_Bool) 0.0 == false ? 1 : -1];
14653 +         char g[true];
14654 +         char h[sizeof (_Bool)];
14655 +         char i[sizeof s.t];
14656 +         enum { j = false, k = true, l = false * true, m = true * 256 };
14657 +         _Bool n[m];
14658 +         char o[sizeof n == m * sizeof n[0] ? 1 : -1];
14659 +         char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
14660 +         #if defined __xlc__ || defined __GNUC__
14661 +          /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
14662 +             reported by James Lemley on 2005-10-05; see
14663 +             http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
14664 +             This test is not quite right, since xlc is allowed to
14665 +             reject this program, as the initializer for xlcbug is
14666 +             not one of the forms that C requires support for.
14667 +             However, doing the test right would require a run-time
14668 +             test, and that would make cross-compilation harder.
14669 +             Let us hope that IBM fixes the xlc bug, and also adds
14670 +             support for this kind of constant expression.  In the
14671 +             meantime, this test will reject xlc, which is OK, since
14672 +             our stdbool.h substitute should suffice.  We also test
14673 +             this with GCC, where it should work, to detect more
14674 +             quickly whether someone messes up the test in the
14675 +             future.  */
14676 +          char digs[] = "0123456789";
14677 +          int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
14678 +         #endif
14679 +         /* Catch a bug in an HP-UX C compiler.  See
14680 +            http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
14681 +            http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
14682 +          */
14683 +         _Bool q = true;
14684 +         _Bool *pq = &q;
14685 +       ],
14686 +       [
14687 +         *pq |= q;
14688 +         *pq |= ! q;
14689 +         /* Refer to every declared value, to avoid compiler optimizations.  */
14690 +         return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
14691 +                 + !m + !n + !o + !p + !q + !pq);
14692 +       ],
14693 +       [ac_cv_header_stdbool_h=yes],
14694 +       [ac_cv_header_stdbool_h=no])])
14695 +   AC_CHECK_TYPES([_Bool])
14696 +   if test $ac_cv_header_stdbool_h = yes; then
14697 +     AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
14698 +   fi])
14699 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/stdint_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint_h.m4
14700 --- gtk-vnc-0.3.7.mingw/gnulib/m4/stdint_h.m4   1970-01-01 01:00:00.000000000 +0100
14701 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint_h.m4  2008-10-09 12:24:39.000000000 +0100
14702 @@ -0,0 +1,26 @@
14703 +# stdint_h.m4 serial 6
14704 +dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc.
14705 +dnl This file is free software; the Free Software Foundation
14706 +dnl gives unlimited permission to copy and/or distribute it,
14707 +dnl with or without modifications, as long as this notice is preserved.
14708 +
14709 +dnl From Paul Eggert.
14710 +
14711 +# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
14712 +# doesn't clash with <sys/types.h>, and declares uintmax_t.
14713 +
14714 +AC_DEFUN([gl_AC_HEADER_STDINT_H],
14715 +[
14716 +  AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h,
14717 +  [AC_TRY_COMPILE(
14718 +    [#include <sys/types.h>
14719 +#include <stdint.h>],
14720 +    [uintmax_t i = (uintmax_t) -1; return !i;],
14721 +    gl_cv_header_stdint_h=yes,
14722 +    gl_cv_header_stdint_h=no)])
14723 +  if test $gl_cv_header_stdint_h = yes; then
14724 +    AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
14725 +      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
14726 +       and declares uintmax_t. ])
14727 +  fi
14728 +])
14729 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/stdint.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint.m4
14730 --- gtk-vnc-0.3.7.mingw/gnulib/m4/stdint.m4     1970-01-01 01:00:00.000000000 +0100
14731 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint.m4    2008-10-09 12:24:39.000000000 +0100
14732 @@ -0,0 +1,395 @@
14733 +# stdint.m4 serial 31
14734 +dnl Copyright (C) 2001-2008 Free Software Foundation, Inc.
14735 +dnl This file is free software; the Free Software Foundation
14736 +dnl gives unlimited permission to copy and/or distribute it,
14737 +dnl with or without modifications, as long as this notice is preserved.
14738 +
14739 +dnl From Paul Eggert and Bruno Haible.
14740 +dnl Test whether <stdint.h> is supported or must be substituted.
14741 +
14742 +AC_DEFUN([gl_STDINT_H],
14743 +[
14744 +  AC_PREREQ(2.59)dnl
14745 +
14746 +  dnl Check for long long int and unsigned long long int.
14747 +  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
14748 +  if test $ac_cv_type_long_long_int = yes; then
14749 +    HAVE_LONG_LONG_INT=1
14750 +  else
14751 +    HAVE_LONG_LONG_INT=0
14752 +  fi
14753 +  AC_SUBST([HAVE_LONG_LONG_INT])
14754 +  AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
14755 +  if test $ac_cv_type_unsigned_long_long_int = yes; then
14756 +    HAVE_UNSIGNED_LONG_LONG_INT=1
14757 +  else
14758 +    HAVE_UNSIGNED_LONG_LONG_INT=0
14759 +  fi
14760 +  AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
14761 +
14762 +  dnl Check for <inttypes.h>.
14763 +  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
14764 +  if test $ac_cv_header_inttypes_h = yes; then
14765 +    HAVE_INTTYPES_H=1
14766 +  else
14767 +    HAVE_INTTYPES_H=0
14768 +  fi
14769 +  AC_SUBST([HAVE_INTTYPES_H])
14770 +
14771 +  dnl Check for <sys/types.h>.
14772 +  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
14773 +  if test $ac_cv_header_sys_types_h = yes; then
14774 +    HAVE_SYS_TYPES_H=1
14775 +  else
14776 +    HAVE_SYS_TYPES_H=0
14777 +  fi
14778 +  AC_SUBST([HAVE_SYS_TYPES_H])
14779 +
14780 +  gl_CHECK_NEXT_HEADERS([stdint.h])
14781 +  if test $ac_cv_header_stdint_h = yes; then
14782 +    HAVE_STDINT_H=1
14783 +  else
14784 +    HAVE_STDINT_H=0
14785 +  fi
14786 +  AC_SUBST([HAVE_STDINT_H])
14787 +
14788 +  dnl Now see whether we need a substitute <stdint.h>.
14789 +  if test $ac_cv_header_stdint_h = yes; then
14790 +    AC_CACHE_CHECK([whether stdint.h conforms to C99],
14791 +      [gl_cv_header_working_stdint_h],
14792 +      [gl_cv_header_working_stdint_h=no
14793 +       AC_COMPILE_IFELSE([
14794 +         AC_LANG_PROGRAM([[
14795 +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
14796 +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
14797 +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
14798 +#include <stdint.h>
14799 +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>.  */
14800 +#if !(defined WCHAR_MIN && defined WCHAR_MAX)
14801 +#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
14802 +#endif
14803 +]
14804 +gl_STDINT_INCLUDES
14805 +[
14806 +#ifdef INT8_MAX
14807 +int8_t a1 = INT8_MAX;
14808 +int8_t a1min = INT8_MIN;
14809 +#endif
14810 +#ifdef INT16_MAX
14811 +int16_t a2 = INT16_MAX;
14812 +int16_t a2min = INT16_MIN;
14813 +#endif
14814 +#ifdef INT32_MAX
14815 +int32_t a3 = INT32_MAX;
14816 +int32_t a3min = INT32_MIN;
14817 +#endif
14818 +#ifdef INT64_MAX
14819 +int64_t a4 = INT64_MAX;
14820 +int64_t a4min = INT64_MIN;
14821 +#endif
14822 +#ifdef UINT8_MAX
14823 +uint8_t b1 = UINT8_MAX;
14824 +#else
14825 +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
14826 +#endif
14827 +#ifdef UINT16_MAX
14828 +uint16_t b2 = UINT16_MAX;
14829 +#endif
14830 +#ifdef UINT32_MAX
14831 +uint32_t b3 = UINT32_MAX;
14832 +#endif
14833 +#ifdef UINT64_MAX
14834 +uint64_t b4 = UINT64_MAX;
14835 +#endif
14836 +int_least8_t c1 = INT8_C (0x7f);
14837 +int_least8_t c1max = INT_LEAST8_MAX;
14838 +int_least8_t c1min = INT_LEAST8_MIN;
14839 +int_least16_t c2 = INT16_C (0x7fff);
14840 +int_least16_t c2max = INT_LEAST16_MAX;
14841 +int_least16_t c2min = INT_LEAST16_MIN;
14842 +int_least32_t c3 = INT32_C (0x7fffffff);
14843 +int_least32_t c3max = INT_LEAST32_MAX;
14844 +int_least32_t c3min = INT_LEAST32_MIN;
14845 +int_least64_t c4 = INT64_C (0x7fffffffffffffff);
14846 +int_least64_t c4max = INT_LEAST64_MAX;
14847 +int_least64_t c4min = INT_LEAST64_MIN;
14848 +uint_least8_t d1 = UINT8_C (0xff);
14849 +uint_least8_t d1max = UINT_LEAST8_MAX;
14850 +uint_least16_t d2 = UINT16_C (0xffff);
14851 +uint_least16_t d2max = UINT_LEAST16_MAX;
14852 +uint_least32_t d3 = UINT32_C (0xffffffff);
14853 +uint_least32_t d3max = UINT_LEAST32_MAX;
14854 +uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
14855 +uint_least64_t d4max = UINT_LEAST64_MAX;
14856 +int_fast8_t e1 = INT_FAST8_MAX;
14857 +int_fast8_t e1min = INT_FAST8_MIN;
14858 +int_fast16_t e2 = INT_FAST16_MAX;
14859 +int_fast16_t e2min = INT_FAST16_MIN;
14860 +int_fast32_t e3 = INT_FAST32_MAX;
14861 +int_fast32_t e3min = INT_FAST32_MIN;
14862 +int_fast64_t e4 = INT_FAST64_MAX;
14863 +int_fast64_t e4min = INT_FAST64_MIN;
14864 +uint_fast8_t f1 = UINT_FAST8_MAX;
14865 +uint_fast16_t f2 = UINT_FAST16_MAX;
14866 +uint_fast32_t f3 = UINT_FAST32_MAX;
14867 +uint_fast64_t f4 = UINT_FAST64_MAX;
14868 +#ifdef INTPTR_MAX
14869 +intptr_t g = INTPTR_MAX;
14870 +intptr_t gmin = INTPTR_MIN;
14871 +#endif
14872 +#ifdef UINTPTR_MAX
14873 +uintptr_t h = UINTPTR_MAX;
14874 +#endif
14875 +intmax_t i = INTMAX_MAX;
14876 +uintmax_t j = UINTMAX_MAX;
14877 +
14878 +#include <limits.h> /* for CHAR_BIT */
14879 +#define TYPE_MINIMUM(t) \
14880 +  ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
14881 +#define TYPE_MAXIMUM(t) \
14882 +  ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
14883 +struct s {
14884 +  int check_PTRDIFF:
14885 +      PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
14886 +      && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
14887 +      ? 1 : -1;
14888 +  /* Detect bug in FreeBSD 6.0 / ia64.  */
14889 +  int check_SIG_ATOMIC:
14890 +      SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
14891 +      && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
14892 +      ? 1 : -1;
14893 +  int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
14894 +  int check_WCHAR:
14895 +      WCHAR_MIN == TYPE_MINIMUM (wchar_t)
14896 +      && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
14897 +      ? 1 : -1;
14898 +  /* Detect bug in mingw.  */
14899 +  int check_WINT:
14900 +      WINT_MIN == TYPE_MINIMUM (wint_t)
14901 +      && WINT_MAX == TYPE_MAXIMUM (wint_t)
14902 +      ? 1 : -1;
14903 +
14904 +  /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others.  */
14905 +  int check_UINT8_C:
14906 +        (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
14907 +  int check_UINT16_C:
14908 +        (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
14909 +
14910 +  /* Detect bugs in OpenBSD 3.9 stdint.h.  */
14911 +#ifdef UINT8_MAX
14912 +  int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
14913 +#endif
14914 +#ifdef UINT16_MAX
14915 +  int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
14916 +#endif
14917 +#ifdef UINT32_MAX
14918 +  int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
14919 +#endif
14920 +#ifdef UINT64_MAX
14921 +  int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
14922 +#endif
14923 +  int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
14924 +  int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
14925 +  int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
14926 +  int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
14927 +  int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
14928 +  int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
14929 +  int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
14930 +  int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
14931 +  int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
14932 +  int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
14933 +  int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
14934 +};
14935 +         ]])],
14936 +         [gl_cv_header_working_stdint_h=yes])])
14937 +  fi
14938 +  if test "$gl_cv_header_working_stdint_h" = yes; then
14939 +    STDINT_H=
14940 +  else
14941 +    dnl Check for <sys/inttypes.h>, and for
14942 +    dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
14943 +    AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
14944 +    if test $ac_cv_header_sys_inttypes_h = yes; then
14945 +      HAVE_SYS_INTTYPES_H=1
14946 +    else
14947 +      HAVE_SYS_INTTYPES_H=0
14948 +    fi
14949 +    AC_SUBST([HAVE_SYS_INTTYPES_H])
14950 +    if test $ac_cv_header_sys_bitypes_h = yes; then
14951 +      HAVE_SYS_BITYPES_H=1
14952 +    else
14953 +      HAVE_SYS_BITYPES_H=0
14954 +    fi
14955 +    AC_SUBST([HAVE_SYS_BITYPES_H])
14956 +
14957 +    dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
14958 +    dnl character support).
14959 +    AC_CHECK_HEADERS_ONCE([wchar.h])
14960 +
14961 +    gl_STDINT_TYPE_PROPERTIES
14962 +    STDINT_H=stdint.h
14963 +  fi
14964 +  AC_SUBST(STDINT_H)
14965 +])
14966 +
14967 +dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
14968 +dnl Determine the size of each of the given types in bits.
14969 +AC_DEFUN([gl_STDINT_BITSIZEOF],
14970 +[
14971 +  dnl Use a shell loop, to avoid bloating configure, and
14972 +  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
14973 +  dnl   config.h.in,
14974 +  dnl - extra AC_SUBST calls, so that the right substitutions are made.
14975 +  m4_foreach_w([gltype], [$1],
14976 +    [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
14977 +       [Define to the number of bits in type ']gltype['.])])
14978 +  for gltype in $1 ; do
14979 +    AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
14980 +      [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
14981 +         [$2
14982 +#include <limits.h>], [result=unknown])
14983 +       eval gl_cv_bitsizeof_${gltype}=\$result
14984 +      ])
14985 +    eval result=\$gl_cv_bitsizeof_${gltype}
14986 +    if test $result = unknown; then
14987 +      dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
14988 +      dnl do a syntax check even on unused #if conditions and give an error
14989 +      dnl on valid C code like this:
14990 +      dnl   #if 0
14991 +      dnl   # if  > 32
14992 +      dnl   # endif
14993 +      dnl   #endif
14994 +      result=0
14995 +    fi
14996 +    GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
14997 +    AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
14998 +    eval BITSIZEOF_${GLTYPE}=\$result
14999 +  done
15000 +  m4_foreach_w([gltype], [$1],
15001 +    [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
15002 +])
15003 +
15004 +dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
15005 +dnl Determine the signedness of each of the given types.
15006 +dnl Define HAVE_SIGNED_TYPE if type is signed.
15007 +AC_DEFUN([gl_CHECK_TYPES_SIGNED],
15008 +[
15009 +  dnl Use a shell loop, to avoid bloating configure, and
15010 +  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
15011 +  dnl   config.h.in,
15012 +  dnl - extra AC_SUBST calls, so that the right substitutions are made.
15013 +  m4_foreach_w([gltype], [$1],
15014 +    [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
15015 +       [Define to 1 if ']gltype[' is a signed integer type.])])
15016 +  for gltype in $1 ; do
15017 +    AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
15018 +      [AC_COMPILE_IFELSE(
15019 +         [AC_LANG_PROGRAM([$2[
15020 +            int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
15021 +         result=yes, result=no)
15022 +       eval gl_cv_type_${gltype}_signed=\$result
15023 +      ])
15024 +    eval result=\$gl_cv_type_${gltype}_signed
15025 +    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
15026 +    if test "$result" = yes; then
15027 +      AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], 1)
15028 +      eval HAVE_SIGNED_${GLTYPE}=1
15029 +    else
15030 +      eval HAVE_SIGNED_${GLTYPE}=0
15031 +    fi
15032 +  done
15033 +  m4_foreach_w([gltype], [$1],
15034 +    [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
15035 +])
15036 +
15037 +dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
15038 +dnl Determine the suffix to use for integer constants of the given types.
15039 +dnl Define t_SUFFIX for each such type.
15040 +AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
15041 +[
15042 +  dnl Use a shell loop, to avoid bloating configure, and
15043 +  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
15044 +  dnl   config.h.in,
15045 +  dnl - extra AC_SUBST calls, so that the right substitutions are made.
15046 +  m4_foreach_w([gltype], [$1],
15047 +    [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
15048 +       [Define to l, ll, u, ul, ull, etc., as suitable for
15049 +        constants of type ']gltype['.])])
15050 +  for gltype in $1 ; do
15051 +    AC_CACHE_CHECK([for $gltype integer literal suffix],
15052 +      [gl_cv_type_${gltype}_suffix],
15053 +      [eval gl_cv_type_${gltype}_suffix=no
15054 +       eval result=\$gl_cv_type_${gltype}_signed
15055 +       if test "$result" = yes; then
15056 +         glsufu=
15057 +       else
15058 +         glsufu=u
15059 +       fi
15060 +       for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
15061 +         case $glsuf in
15062 +           '')  gltype1='int';;
15063 +           l)  gltype1='long int';;
15064 +           ll) gltype1='long long int';;
15065 +           i64)        gltype1='__int64';;
15066 +           u)  gltype1='unsigned int';;
15067 +           ul) gltype1='unsigned long int';;
15068 +           ull)        gltype1='unsigned long long int';;
15069 +           ui64)gltype1='unsigned __int64';;
15070 +         esac
15071 +         AC_COMPILE_IFELSE(
15072 +           [AC_LANG_PROGRAM([$2[
15073 +              extern $gltype foo;
15074 +              extern $gltype1 foo;]])],
15075 +           [eval gl_cv_type_${gltype}_suffix=\$glsuf])
15076 +         eval result=\$gl_cv_type_${gltype}_suffix
15077 +         test "$result" != no && break
15078 +       done])
15079 +    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
15080 +    eval result=\$gl_cv_type_${gltype}_suffix
15081 +    test "$result" = no && result=
15082 +    eval ${GLTYPE}_SUFFIX=\$result
15083 +    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
15084 +  done
15085 +  m4_foreach_w([gltype], [$1],
15086 +    [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
15087 +])
15088 +
15089 +dnl gl_STDINT_INCLUDES
15090 +AC_DEFUN([gl_STDINT_INCLUDES],
15091 +[[
15092 +  /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
15093 +     included before <wchar.h>.  */
15094 +  #include <stddef.h>
15095 +  #include <signal.h>
15096 +  #if HAVE_WCHAR_H
15097 +  # include <stdio.h>
15098 +  # include <time.h>
15099 +  # include <wchar.h>
15100 +  #endif
15101 +]])
15102 +
15103 +dnl gl_STDINT_TYPE_PROPERTIES
15104 +dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
15105 +dnl of interest to stdint.in.h.
15106 +AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
15107 +[
15108 +  gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
15109 +    [gl_STDINT_INCLUDES])
15110 +  gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
15111 +    [gl_STDINT_INCLUDES])
15112 +  gl_cv_type_ptrdiff_t_signed=yes
15113 +  gl_cv_type_size_t_signed=no
15114 +  gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
15115 +    [gl_STDINT_INCLUDES])
15116 +])
15117 +
15118 +dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
15119 +dnl Remove this when we can assume autoconf >= 2.61.
15120 +m4_ifdef([AC_COMPUTE_INT], [], [
15121 +  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
15122 +])
15123 +
15124 +# Hey Emacs!
15125 +# Local Variables:
15126 +# indent-tabs-mode: nil
15127 +# End:
15128 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/stdio_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdio_h.m4
15129 --- gtk-vnc-0.3.7.mingw/gnulib/m4/stdio_h.m4    1970-01-01 01:00:00.000000000 +0100
15130 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdio_h.m4   2008-10-09 12:24:39.000000000 +0100
15131 @@ -0,0 +1,125 @@
15132 +# stdio_h.m4 serial 13
15133 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
15134 +dnl This file is free software; the Free Software Foundation
15135 +dnl gives unlimited permission to copy and/or distribute it,
15136 +dnl with or without modifications, as long as this notice is preserved.
15137 +
15138 +AC_DEFUN([gl_STDIO_H],
15139 +[
15140 +  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
15141 +  gl_CHECK_NEXT_HEADERS([stdio.h])
15142 +  dnl No need to create extra modules for these functions. Everyone who uses
15143 +  dnl <stdio.h> likely needs them.
15144 +  GNULIB_FPRINTF=1
15145 +  GNULIB_PRINTF=1
15146 +  GNULIB_VFPRINTF=1
15147 +  GNULIB_VPRINTF=1
15148 +  GNULIB_FPUTC=1
15149 +  GNULIB_PUTC=1
15150 +  GNULIB_PUTCHAR=1
15151 +  GNULIB_FPUTS=1
15152 +  GNULIB_PUTS=1
15153 +  GNULIB_FWRITE=1
15154 +  dnl This ifdef is just an optimization, to avoid performing a configure
15155 +  dnl check whose result is not used. It does not make the test of
15156 +  dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant.
15157 +  m4_ifdef([gl_SIGNAL_SIGPIPE], [
15158 +    gl_SIGNAL_SIGPIPE
15159 +    if test $gl_cv_header_signal_h_SIGPIPE != yes; then
15160 +      REPLACE_STDIO_WRITE_FUNCS=1
15161 +      AC_LIBOBJ([stdio-write])
15162 +    fi
15163 +  ])
15164 +])
15165 +
15166 +AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
15167 +[
15168 +  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
15169 +  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
15170 +  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
15171 +])
15172 +
15173 +AC_DEFUN([gl_STDIO_H_DEFAULTS],
15174 +[
15175 +  GNULIB_FPRINTF=0;              AC_SUBST([GNULIB_FPRINTF])
15176 +  GNULIB_FPRINTF_POSIX=0;        AC_SUBST([GNULIB_FPRINTF_POSIX])
15177 +  GNULIB_PRINTF=0;               AC_SUBST([GNULIB_PRINTF])
15178 +  GNULIB_PRINTF_POSIX=0;         AC_SUBST([GNULIB_PRINTF_POSIX])
15179 +  GNULIB_SNPRINTF=0;             AC_SUBST([GNULIB_SNPRINTF])
15180 +  GNULIB_SPRINTF_POSIX=0;        AC_SUBST([GNULIB_SPRINTF_POSIX])
15181 +  GNULIB_VFPRINTF=0;             AC_SUBST([GNULIB_VFPRINTF])
15182 +  GNULIB_VFPRINTF_POSIX=0;       AC_SUBST([GNULIB_VFPRINTF_POSIX])
15183 +  GNULIB_VPRINTF=0;              AC_SUBST([GNULIB_VPRINTF])
15184 +  GNULIB_VPRINTF_POSIX=0;        AC_SUBST([GNULIB_VPRINTF_POSIX])
15185 +  GNULIB_VSNPRINTF=0;            AC_SUBST([GNULIB_VSNPRINTF])
15186 +  GNULIB_VSPRINTF_POSIX=0;       AC_SUBST([GNULIB_VSPRINTF_POSIX])
15187 +  GNULIB_VASPRINTF=0;            AC_SUBST([GNULIB_VASPRINTF])
15188 +  GNULIB_OBSTACK_PRINTF=0;       AC_SUBST([GNULIB_OBSTACK_PRINTF])
15189 +  GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
15190 +  GNULIB_FOPEN=0;                AC_SUBST([GNULIB_FOPEN])
15191 +  GNULIB_FREOPEN=0;              AC_SUBST([GNULIB_FREOPEN])
15192 +  GNULIB_FSEEK=0;                AC_SUBST([GNULIB_FSEEK])
15193 +  GNULIB_FSEEKO=0;               AC_SUBST([GNULIB_FSEEKO])
15194 +  GNULIB_FTELL=0;                AC_SUBST([GNULIB_FTELL])
15195 +  GNULIB_FTELLO=0;               AC_SUBST([GNULIB_FTELLO])
15196 +  GNULIB_FFLUSH=0;               AC_SUBST([GNULIB_FFLUSH])
15197 +  GNULIB_FPUTC=0;                AC_SUBST([GNULIB_FPUTC])
15198 +  GNULIB_PUTC=0;                 AC_SUBST([GNULIB_PUTC])
15199 +  GNULIB_PUTCHAR=0;              AC_SUBST([GNULIB_PUTCHAR])
15200 +  GNULIB_FPUTS=0;                AC_SUBST([GNULIB_FPUTS])
15201 +  GNULIB_PUTS=0;                 AC_SUBST([GNULIB_PUTS])
15202 +  GNULIB_FWRITE=0;               AC_SUBST([GNULIB_FWRITE])
15203 +  GNULIB_GETDELIM=0;             AC_SUBST([GNULIB_GETDELIM])
15204 +  GNULIB_GETLINE=0;              AC_SUBST([GNULIB_GETLINE])
15205 +  GNULIB_PERROR=0;               AC_SUBST([GNULIB_PERROR])
15206 +  GNULIB_STDIO_H_SIGPIPE=0;      AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
15207 +  dnl Assume proper GNU behavior unless another module says otherwise.
15208 +  REPLACE_STDIO_WRITE_FUNCS=0;   AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
15209 +  REPLACE_FPRINTF=0;             AC_SUBST([REPLACE_FPRINTF])
15210 +  REPLACE_VFPRINTF=0;            AC_SUBST([REPLACE_VFPRINTF])
15211 +  REPLACE_PRINTF=0;              AC_SUBST([REPLACE_PRINTF])
15212 +  REPLACE_VPRINTF=0;             AC_SUBST([REPLACE_VPRINTF])
15213 +  REPLACE_SNPRINTF=0;            AC_SUBST([REPLACE_SNPRINTF])
15214 +  HAVE_DECL_SNPRINTF=1;          AC_SUBST([HAVE_DECL_SNPRINTF])
15215 +  REPLACE_VSNPRINTF=0;           AC_SUBST([REPLACE_VSNPRINTF])
15216 +  HAVE_DECL_VSNPRINTF=1;         AC_SUBST([HAVE_DECL_VSNPRINTF])
15217 +  REPLACE_SPRINTF=0;             AC_SUBST([REPLACE_SPRINTF])
15218 +  REPLACE_VSPRINTF=0;            AC_SUBST([REPLACE_VSPRINTF])
15219 +  HAVE_VASPRINTF=1;              AC_SUBST([HAVE_VASPRINTF])
15220 +  REPLACE_VASPRINTF=0;           AC_SUBST([REPLACE_VASPRINTF])
15221 +  HAVE_DECL_OBSTACK_PRINTF=1;    AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
15222 +  REPLACE_OBSTACK_PRINTF=0;      AC_SUBST([REPLACE_OBSTACK_PRINTF])
15223 +  REPLACE_FOPEN=0;               AC_SUBST([REPLACE_FOPEN])
15224 +  REPLACE_FREOPEN=0;             AC_SUBST([REPLACE_FREOPEN])
15225 +  HAVE_FSEEKO=1;                 AC_SUBST([HAVE_FSEEKO])
15226 +  REPLACE_FSEEKO=0;              AC_SUBST([REPLACE_FSEEKO])
15227 +  REPLACE_FSEEK=0;               AC_SUBST([REPLACE_FSEEK])
15228 +  HAVE_FTELLO=1;                 AC_SUBST([HAVE_FTELLO])
15229 +  REPLACE_FTELLO=0;              AC_SUBST([REPLACE_FTELLO])
15230 +  REPLACE_FTELL=0;               AC_SUBST([REPLACE_FTELL])
15231 +  REPLACE_FFLUSH=0;              AC_SUBST([REPLACE_FFLUSH])
15232 +  HAVE_DECL_GETDELIM=1;          AC_SUBST([HAVE_DECL_GETDELIM])
15233 +  HAVE_DECL_GETLINE=1;           AC_SUBST([HAVE_DECL_GETLINE])
15234 +  REPLACE_GETLINE=0;             AC_SUBST([REPLACE_GETLINE])
15235 +  REPLACE_PERROR=0;              AC_SUBST([REPLACE_PERROR])
15236 +])
15237 +
15238 +dnl Code shared by fseeko and ftello.  Determine if large files are supported,
15239 +dnl but stdin does not start as a large file by default.
15240 +AC_DEFUN([gl_STDIN_LARGE_OFFSET],
15241 +  [
15242 +    AC_CACHE_CHECK([whether stdin defaults to large file offsets],
15243 +      [gl_cv_var_stdin_large_offset],
15244 +      [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
15245 +[[#if defined __SL64 && defined __SCLE /* cygwin */
15246 +  /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
15247 +     fseeko/ftello needlessly fail.  This bug was fixed in 1.5.25, and
15248 +     it is easier to do a version check than building a runtime test.  */
15249 +# include <cygwin/version.h>
15250 +# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
15251 +  choke me
15252 +# endif
15253 +#endif]])],
15254 +       [gl_cv_var_stdin_large_offset=yes],
15255 +       [gl_cv_var_stdin_large_offset=no])])
15256 +])
15257 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/sys_socket_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/sys_socket_h.m4
15258 --- gtk-vnc-0.3.7.mingw/gnulib/m4/sys_socket_h.m4       1970-01-01 01:00:00.000000000 +0100
15259 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/sys_socket_h.m4      2008-10-09 12:24:39.000000000 +0100
15260 @@ -0,0 +1,113 @@
15261 +# sys_socket_h.m4 serial 8
15262 +dnl Copyright (C) 2005-2008 Free Software Foundation, Inc.
15263 +dnl This file is free software; the Free Software Foundation
15264 +dnl gives unlimited permission to copy and/or distribute it,
15265 +dnl with or without modifications, as long as this notice is preserved.
15266 +
15267 +dnl From Simon Josefsson.
15268 +
15269 +AC_DEFUN([gl_HEADER_SYS_SOCKET],
15270 +[
15271 +  AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
15272 +  AC_REQUIRE([AC_C_INLINE])
15273 +
15274 +  AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
15275 +    [gl_cv_header_sys_socket_h_selfcontained],
15276 +    [
15277 +      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[]])],
15278 +        [gl_cv_header_sys_socket_h_selfcontained=yes],
15279 +        [gl_cv_header_sys_socket_h_selfcontained=no])
15280 +    ])
15281 +  if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
15282 +    SYS_SOCKET_H=''
15283 +    dnl If the shutdown function exists, <sys/socket.h> should define
15284 +    dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
15285 +    AC_CHECK_FUNCS([shutdown])
15286 +    if test $ac_cv_func_shutdown = yes; then
15287 +      AC_CACHE_CHECK([whether <sys/socket.h> defines the SHUT_* macros],
15288 +        [gl_cv_header_sys_socket_h_shut],
15289 +        [
15290 +          AC_COMPILE_IFELSE(
15291 +            [AC_LANG_PROGRAM([[#include <sys/socket.h>]],
15292 +               [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])],
15293 +            [gl_cv_header_sys_socket_h_shut=yes],
15294 +            [gl_cv_header_sys_socket_h_shut=no])
15295 +        ])
15296 +      if test $gl_cv_header_sys_socket_h_shut = no; then
15297 +        SYS_SOCKET_H='sys/socket.h'
15298 +      fi
15299 +    fi
15300 +  else
15301 +    SYS_SOCKET_H='sys/socket.h'
15302 +  fi
15303 +  if test -n "$SYS_SOCKET_H"; then
15304 +    dnl Check prerequisites of the <sys/socket.h> replacement.
15305 +    gl_CHECK_NEXT_HEADERS([sys/socket.h])
15306 +    if test $ac_cv_header_sys_socket_h = yes; then
15307 +      HAVE_SYS_SOCKET_H=1
15308 +      HAVE_WS2TCPIP_H=0
15309 +    else
15310 +      HAVE_SYS_SOCKET_H=0
15311 +      dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
15312 +      dnl the check for those headers unconditional; yet cygwin reports
15313 +      dnl that the headers are present but cannot be compiled (since on
15314 +      dnl cygwin, all socket information should come from sys/socket.h).
15315 +      AC_CHECK_HEADERS([ws2tcpip.h])
15316 +      if test $ac_cv_header_ws2tcpip_h = yes; then
15317 +        HAVE_WS2TCPIP_H=1
15318 +      else
15319 +        HAVE_WS2TCPIP_H=0
15320 +      fi
15321 +    fi
15322 +    gl_PREREQ_SYS_H_WINSOCK2
15323 +    AC_SUBST([HAVE_SYS_SOCKET_H])
15324 +    AC_SUBST([HAVE_WS2TCPIP_H])
15325 +  fi
15326 +  AC_SUBST([SYS_SOCKET_H])
15327 +])
15328 +
15329 +# Common prerequisites of of the <sys/socket.h> replacement and of the
15330 +# <sys/select.h> replacement.
15331 +# Sets and substitutes HAVE_WINSOCK2_H.
15332 +AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
15333 +[
15334 +  AC_CHECK_HEADERS_ONCE([sys/socket.h])
15335 +  if test $ac_cv_header_sys_socket_h != yes; then
15336 +    dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
15337 +    dnl the check for those headers unconditional; yet cygwin reports
15338 +    dnl that the headers are present but cannot be compiled (since on
15339 +    dnl cygwin, all socket information should come from sys/socket.h).
15340 +    AC_CHECK_HEADERS([winsock2.h])
15341 +  fi
15342 +  if test "$ac_cv_header_winsock2_h" = yes; then
15343 +    HAVE_WINSOCK2_H=1
15344 +  else
15345 +    HAVE_WINSOCK2_H=0
15346 +  fi
15347 +  AC_SUBST([HAVE_WINSOCK2_H])
15348 +])
15349 +
15350 +AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
15351 +[
15352 +  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
15353 +  AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
15354 +  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
15355 +  gl_MODULE_INDICATOR([$1])
15356 +])
15357 +
15358 +AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
15359 +[
15360 +  GNULIB_SOCKET=0;      AC_SUBST([GNULIB_SOCKET])
15361 +  GNULIB_CONNECT=0;     AC_SUBST([GNULIB_CONNECT])
15362 +  GNULIB_ACCEPT=0;      AC_SUBST([GNULIB_ACCEPT])
15363 +  GNULIB_BIND=0;        AC_SUBST([GNULIB_BIND])
15364 +  GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME])
15365 +  GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME])
15366 +  GNULIB_GETSOCKOPT=0;  AC_SUBST([GNULIB_GETSOCKOPT])
15367 +  GNULIB_LISTEN=0;      AC_SUBST([GNULIB_LISTEN])
15368 +  GNULIB_RECV=0;        AC_SUBST([GNULIB_RECV])
15369 +  GNULIB_SEND=0;        AC_SUBST([GNULIB_SEND])
15370 +  GNULIB_RECVFROM=0;    AC_SUBST([GNULIB_RECVFROM])
15371 +  GNULIB_SENDTO=0;      AC_SUBST([GNULIB_SENDTO])
15372 +  GNULIB_SETSOCKOPT=0;  AC_SUBST([GNULIB_SETSOCKOPT])
15373 +])
15374 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/vasnprintf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/vasnprintf.m4
15375 --- gtk-vnc-0.3.7.mingw/gnulib/m4/vasnprintf.m4 1970-01-01 01:00:00.000000000 +0100
15376 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/vasnprintf.m4        2008-10-09 12:24:39.000000000 +0100
15377 @@ -0,0 +1,260 @@
15378 +# vasnprintf.m4 serial 25
15379 +dnl Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc.
15380 +dnl This file is free software; the Free Software Foundation
15381 +dnl gives unlimited permission to copy and/or distribute it,
15382 +dnl with or without modifications, as long as this notice is preserved.
15383 +
15384 +AC_DEFUN([gl_FUNC_VASNPRINTF],
15385 +[
15386 +  AC_CHECK_FUNCS_ONCE([vasnprintf])
15387 +  if test $ac_cv_func_vasnprintf = no; then
15388 +    gl_REPLACE_VASNPRINTF
15389 +  fi
15390 +])
15391 +
15392 +AC_DEFUN([gl_REPLACE_VASNPRINTF],
15393 +[
15394 +  AC_CHECK_FUNCS_ONCE([vasnprintf])
15395 +  AC_LIBOBJ([vasnprintf])
15396 +  AC_LIBOBJ([printf-args])
15397 +  AC_LIBOBJ([printf-parse])
15398 +  AC_LIBOBJ([asnprintf])
15399 +  if test $ac_cv_func_vasnprintf = yes; then
15400 +    AC_DEFINE([REPLACE_VASNPRINTF], 1,
15401 +      [Define if vasnprintf exists but is overridden by gnulib.])
15402 +  fi
15403 +  gl_PREREQ_PRINTF_ARGS
15404 +  gl_PREREQ_PRINTF_PARSE
15405 +  gl_PREREQ_VASNPRINTF
15406 +  gl_PREREQ_ASNPRINTF
15407 +])
15408 +
15409 +# Prequisites of lib/printf-args.h, lib/printf-args.c.
15410 +AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
15411 +[
15412 +  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
15413 +  AC_REQUIRE([gt_TYPE_WCHAR_T])
15414 +  AC_REQUIRE([gt_TYPE_WINT_T])
15415 +])
15416 +
15417 +# Prequisites of lib/printf-parse.h, lib/printf-parse.c.
15418 +AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
15419 +[
15420 +  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
15421 +  AC_REQUIRE([gt_TYPE_WCHAR_T])
15422 +  AC_REQUIRE([gt_TYPE_WINT_T])
15423 +  AC_REQUIRE([AC_TYPE_SIZE_T])
15424 +  AC_CHECK_TYPE([ptrdiff_t], ,
15425 +    [AC_DEFINE([ptrdiff_t], [long],
15426 +       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
15427 +    ])
15428 +  AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
15429 +])
15430 +
15431 +# Prerequisites of lib/vasnprintf.c.
15432 +AC_DEFUN([gl_PREREQ_VASNPRINTF],
15433 +[
15434 +  AC_REQUIRE([AC_FUNC_ALLOCA])
15435 +  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
15436 +  AC_REQUIRE([gt_TYPE_WCHAR_T])
15437 +  AC_REQUIRE([gt_TYPE_WINT_T])
15438 +  AC_CHECK_FUNCS(snprintf wcslen)
15439 +  dnl Use the _snprintf function only if it is declared (because on NetBSD it
15440 +  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
15441 +  AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>])
15442 +])
15443 +
15444 +# Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
15445 +# arguments.
15446 +AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
15447 +[
15448 +  AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
15449 +  case "$gl_cv_func_printf_long_double" in
15450 +    *yes)
15451 +      ;;
15452 +    *)
15453 +      AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
15454 +        [Define if the vasnprintf implementation needs special code for
15455 +         'long double' arguments.])
15456 +      ;;
15457 +  esac
15458 +])
15459 +
15460 +# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
15461 +# arguments.
15462 +AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
15463 +[
15464 +  AC_REQUIRE([gl_PRINTF_INFINITE])
15465 +  case "$gl_cv_func_printf_infinite" in
15466 +    *yes)
15467 +      ;;
15468 +    *)
15469 +      AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], 1,
15470 +        [Define if the vasnprintf implementation needs special code for
15471 +         infinite 'double' arguments.])
15472 +      ;;
15473 +  esac
15474 +])
15475 +
15476 +# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
15477 +# arguments.
15478 +AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
15479 +[
15480 +  AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
15481 +  dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
15482 +  dnl NEED_PRINTF_LONG_DOUBLE is already set.
15483 +  AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
15484 +  case "$gl_cv_func_printf_long_double" in
15485 +    *yes)
15486 +      case "$gl_cv_func_printf_infinite_long_double" in
15487 +        *yes)
15488 +          ;;
15489 +        *)
15490 +          AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], 1,
15491 +            [Define if the vasnprintf implementation needs special code for
15492 +             infinite 'long double' arguments.])
15493 +          ;;
15494 +      esac
15495 +      ;;
15496 +  esac
15497 +])
15498 +
15499 +# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
15500 +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
15501 +[
15502 +  AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
15503 +  case "$gl_cv_func_printf_directive_a" in
15504 +    *yes)
15505 +      ;;
15506 +    *)
15507 +      AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
15508 +        [Define if the vasnprintf implementation needs special code for
15509 +         the 'a' and 'A' directives.])
15510 +      AC_CHECK_FUNCS([nl_langinfo])
15511 +      ;;
15512 +  esac
15513 +])
15514 +
15515 +# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
15516 +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
15517 +[
15518 +  AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
15519 +  case "$gl_cv_func_printf_directive_f" in
15520 +    *yes)
15521 +      ;;
15522 +    *)
15523 +      AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], 1,
15524 +        [Define if the vasnprintf implementation needs special code for
15525 +         the 'F' directive.])
15526 +      ;;
15527 +  esac
15528 +])
15529 +
15530 +# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
15531 +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
15532 +[
15533 +  AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
15534 +  case "$gl_cv_func_printf_flag_grouping" in
15535 +    *yes)
15536 +      ;;
15537 +    *)
15538 +      AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], 1,
15539 +        [Define if the vasnprintf implementation needs special code for the
15540 +         ' flag.])
15541 +      ;;
15542 +  esac
15543 +])
15544 +
15545 +# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
15546 +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
15547 +[
15548 +  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
15549 +  case "$gl_cv_func_printf_flag_leftadjust" in
15550 +    *yes)
15551 +      ;;
15552 +    *)
15553 +      AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1,
15554 +        [Define if the vasnprintf implementation needs special code for the
15555 +         '-' flag.])
15556 +      ;;
15557 +  esac
15558 +])
15559 +
15560 +# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
15561 +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
15562 +[
15563 +  AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
15564 +  case "$gl_cv_func_printf_flag_zero" in
15565 +    *yes)
15566 +      ;;
15567 +    *)
15568 +      AC_DEFINE([NEED_PRINTF_FLAG_ZERO], 1,
15569 +        [Define if the vasnprintf implementation needs special code for the
15570 +         0 flag.])
15571 +      ;;
15572 +  esac
15573 +])
15574 +
15575 +# Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
15576 +AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
15577 +[
15578 +  AC_REQUIRE([gl_PRINTF_PRECISION])
15579 +  case "$gl_cv_func_printf_precision" in
15580 +    *yes)
15581 +      ;;
15582 +    *)
15583 +      AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1,
15584 +        [Define if the vasnprintf implementation needs special code for
15585 +         supporting large precisions without arbitrary bounds.])
15586 +      AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
15587 +        [Define if the vasnprintf implementation needs special code for
15588 +         'double' arguments.])
15589 +      AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
15590 +        [Define if the vasnprintf implementation needs special code for
15591 +         'long double' arguments.])
15592 +      ;;
15593 +  esac
15594 +])
15595 +
15596 +# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
15597 +# conditions.
15598 +AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
15599 +[
15600 +  AC_REQUIRE([gl_PRINTF_ENOMEM])
15601 +  case "$gl_cv_func_printf_enomem" in
15602 +    *yes)
15603 +      ;;
15604 +    *)
15605 +      AC_DEFINE([NEED_PRINTF_ENOMEM], 1,
15606 +        [Define if the vasnprintf implementation needs special code for
15607 +         surviving out-of-memory conditions.])
15608 +      AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
15609 +        [Define if the vasnprintf implementation needs special code for
15610 +         'double' arguments.])
15611 +      AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
15612 +        [Define if the vasnprintf implementation needs special code for
15613 +         'long double' arguments.])
15614 +      ;;
15615 +  esac
15616 +])
15617 +
15618 +# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
15619 +AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
15620 +[
15621 +  AC_REQUIRE([gl_PREREQ_VASNPRINTF])
15622 +  gl_PREREQ_VASNPRINTF_LONG_DOUBLE
15623 +  gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
15624 +  gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
15625 +  gl_PREREQ_VASNPRINTF_DIRECTIVE_A
15626 +  gl_PREREQ_VASNPRINTF_DIRECTIVE_F
15627 +  gl_PREREQ_VASNPRINTF_FLAG_GROUPING
15628 +  gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
15629 +  gl_PREREQ_VASNPRINTF_FLAG_ZERO
15630 +  gl_PREREQ_VASNPRINTF_PRECISION
15631 +  gl_PREREQ_VASNPRINTF_ENOMEM
15632 +])
15633 +
15634 +# Prerequisites of lib/asnprintf.c.
15635 +AC_DEFUN([gl_PREREQ_ASNPRINTF],
15636 +[
15637 +])
15638 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/wchar.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar.m4
15639 --- gtk-vnc-0.3.7.mingw/gnulib/m4/wchar.m4      1970-01-01 01:00:00.000000000 +0100
15640 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar.m4     2008-10-09 12:24:39.000000000 +0100
15641 @@ -0,0 +1,69 @@
15642 +dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
15643 +
15644 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
15645 +dnl This file is free software; the Free Software Foundation
15646 +dnl gives unlimited permission to copy and/or distribute it,
15647 +dnl with or without modifications, as long as this notice is preserved.
15648 +
15649 +dnl Written by Eric Blake.
15650 +
15651 +# wchar.m4 serial 6
15652 +
15653 +AC_DEFUN([gl_WCHAR_H],
15654 +[
15655 +  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
15656 +  AC_CACHE_CHECK([whether <wchar.h> is standalone],
15657 +    [gl_cv_header_wchar_h_standalone],
15658 +    [AC_COMPILE_IFELSE([[#include <wchar.h>
15659 +wchar_t w;]],
15660 +      [gl_cv_header_wchar_h_standalone=yes],
15661 +      [gl_cv_header_wchar_h_standalone=no])])
15662 +
15663 +  AC_REQUIRE([gt_TYPE_WINT_T])
15664 +  if test $gt_cv_c_wint_t = yes; then
15665 +    HAVE_WINT_T=1
15666 +  else
15667 +    HAVE_WINT_T=0
15668 +  fi
15669 +  AC_SUBST([HAVE_WINT_T])
15670 +
15671 +  if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then
15672 +    WCHAR_H=wchar.h
15673 +  fi
15674 +
15675 +  dnl Prepare for creating substitute <wchar.h>.
15676 +  dnl Do it always: WCHAR_H may be empty here but can be set later.
15677 +  dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
15678 +  dnl character support).
15679 +  AC_CHECK_HEADERS_ONCE([wchar.h])
15680 +  if test $ac_cv_header_wchar_h = yes; then
15681 +    HAVE_WCHAR_H=1
15682 +  else
15683 +    HAVE_WCHAR_H=0
15684 +  fi
15685 +  AC_SUBST([HAVE_WCHAR_H])
15686 +  gl_CHECK_NEXT_HEADERS([wchar.h])
15687 +])
15688 +
15689 +dnl Unconditionally enables the replacement of <wchar.h>.
15690 +AC_DEFUN([gl_REPLACE_WCHAR_H],
15691 +[
15692 +  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
15693 +  WCHAR_H=wchar.h
15694 +])
15695 +
15696 +AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
15697 +[
15698 +  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
15699 +  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
15700 +  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
15701 +])
15702 +
15703 +AC_DEFUN([gl_WCHAR_H_DEFAULTS],
15704 +[
15705 +  GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
15706 +  dnl Assume proper GNU behavior unless another module says otherwise.
15707 +  HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
15708 +  REPLACE_WCWIDTH=0;   AC_SUBST([REPLACE_WCWIDTH])
15709 +  WCHAR_H='';          AC_SUBST([WCHAR_H])
15710 +])
15711 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/wchar_t.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar_t.m4
15712 --- gtk-vnc-0.3.7.mingw/gnulib/m4/wchar_t.m4    1970-01-01 01:00:00.000000000 +0100
15713 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar_t.m4   2008-10-09 12:24:39.000000000 +0100
15714 @@ -0,0 +1,20 @@
15715 +# wchar_t.m4 serial 1 (gettext-0.12)
15716 +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
15717 +dnl This file is free software; the Free Software Foundation
15718 +dnl gives unlimited permission to copy and/or distribute it,
15719 +dnl with or without modifications, as long as this notice is preserved.
15720 +
15721 +dnl From Bruno Haible.
15722 +dnl Test whether <stddef.h> has the 'wchar_t' type.
15723 +dnl Prerequisite: AC_PROG_CC
15724 +
15725 +AC_DEFUN([gt_TYPE_WCHAR_T],
15726 +[
15727 +  AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
15728 +    [AC_TRY_COMPILE([#include <stddef.h>
15729 +       wchar_t foo = (wchar_t)'\0';], ,
15730 +       gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
15731 +  if test $gt_cv_c_wchar_t = yes; then
15732 +    AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
15733 +  fi
15734 +])
15735 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/wint_t.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/wint_t.m4
15736 --- gtk-vnc-0.3.7.mingw/gnulib/m4/wint_t.m4     1970-01-01 01:00:00.000000000 +0100
15737 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/wint_t.m4    2008-10-09 12:24:39.000000000 +0100
15738 @@ -0,0 +1,28 @@
15739 +# wint_t.m4 serial 2 (gettext-0.17)
15740 +dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
15741 +dnl This file is free software; the Free Software Foundation
15742 +dnl gives unlimited permission to copy and/or distribute it,
15743 +dnl with or without modifications, as long as this notice is preserved.
15744 +
15745 +dnl From Bruno Haible.
15746 +dnl Test whether <wchar.h> has the 'wint_t' type.
15747 +dnl Prerequisite: AC_PROG_CC
15748 +
15749 +AC_DEFUN([gt_TYPE_WINT_T],
15750 +[
15751 +  AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
15752 +    [AC_TRY_COMPILE([
15753 +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
15754 +   <wchar.h>.
15755 +   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
15756 +   before <wchar.h>.  */
15757 +#include <stddef.h>
15758 +#include <stdio.h>
15759 +#include <time.h>
15760 +#include <wchar.h>
15761 +       wint_t foo = (wchar_t)'\0';], ,
15762 +       gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
15763 +  if test $gt_cv_c_wint_t = yes; then
15764 +    AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
15765 +  fi
15766 +])
15767 diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/xsize.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/xsize.m4
15768 --- gtk-vnc-0.3.7.mingw/gnulib/m4/xsize.m4      1970-01-01 01:00:00.000000000 +0100
15769 +++ gtk-vnc-0.3.7.gnulib/gnulib/m4/xsize.m4     2008-10-09 12:24:39.000000000 +0100
15770 @@ -0,0 +1,13 @@
15771 +# xsize.m4 serial 3
15772 +dnl Copyright (C) 2003-2004 Free Software Foundation, Inc.
15773 +dnl This file is free software; the Free Software Foundation
15774 +dnl gives unlimited permission to copy and/or distribute it,
15775 +dnl with or without modifications, as long as this notice is preserved.
15776 +
15777 +AC_DEFUN([gl_XSIZE],
15778 +[
15779 +  dnl Prerequisites of lib/xsize.h.
15780 +  AC_REQUIRE([gl_SIZE_MAX])
15781 +  AC_REQUIRE([AC_C_INLINE])
15782 +  AC_CHECK_HEADERS(stdint.h)
15783 +])
15784 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/dummy.c gtk-vnc-0.3.7.gnulib/gnulib/tests/dummy.c
15785 --- gtk-vnc-0.3.7.mingw/gnulib/tests/dummy.c    1970-01-01 01:00:00.000000000 +0100
15786 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/dummy.c   2008-10-09 12:24:39.000000000 +0100
15787 @@ -0,0 +1,42 @@
15788 +/* A dummy file, to prevent empty libraries from breaking builds.
15789 +   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
15790 +
15791 +   This program is free software: you can redistribute it and/or modify
15792 +   it under the terms of the GNU General Public License as published by
15793 +   the Free Software Foundation; either version 3 of the License, or
15794 +   (at your option) any later version.
15795 +
15796 +   This program is distributed in the hope that it will be useful,
15797 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
15798 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15799 +   GNU General Public License for more details.
15800 +
15801 +   You should have received a copy of the GNU General Public License
15802 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
15803 +
15804 +/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
15805 +   libraries without any object files.  You might get an error like:
15806 +
15807 +   > ar cru .libs/libgl.a
15808 +   > ar: no archive members specified
15809 +
15810 +   Compiling this file, and adding its object file to the library, will
15811 +   prevent the library from being empty.  */
15812 +
15813 +/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
15814 +   that don't export any symbol.  You might get an error like:
15815 +
15816 +   > cc ... libgnu.a
15817 +   > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
15818 +
15819 +   Compiling this file, and adding its object file to the library, will
15820 +   prevent the library from exporting no symbols.  */
15821 +
15822 +#ifdef __sun
15823 +/* This declaration ensures that the library will export at least 1 symbol.  */
15824 +int gl_dummy_symbol;
15825 +#else
15826 +/* This declaration is solely to ensure that after preprocessing
15827 +   this file is never empty.  */
15828 +typedef int dummy;
15829 +#endif
15830 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/intprops.h gtk-vnc-0.3.7.gnulib/gnulib/tests/intprops.h
15831 --- gtk-vnc-0.3.7.mingw/gnulib/tests/intprops.h 1970-01-01 01:00:00.000000000 +0100
15832 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/intprops.h        2008-10-09 12:24:39.000000000 +0100
15833 @@ -0,0 +1,77 @@
15834 +/* intprops.h -- properties of integer types
15835 +
15836 +   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
15837 +
15838 +   This program is free software: you can redistribute it and/or modify
15839 +   it under the terms of the GNU General Public License as published by
15840 +   the Free Software Foundation; either version 3 of the License, or
15841 +   (at your option) any later version.
15842 +
15843 +   This program is distributed in the hope that it will be useful,
15844 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
15845 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15846 +   GNU General Public License for more details.
15847 +
15848 +   You should have received a copy of the GNU General Public License
15849 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
15850 +
15851 +/* Written by Paul Eggert.  */
15852 +
15853 +#include <limits.h>
15854 +
15855 +/* The extra casts in the following macros work around compiler bugs,
15856 +   e.g., in Cray C 5.0.3.0.  */
15857 +
15858 +/* True if the arithmetic type T is an integer type.  bool counts as
15859 +   an integer.  */
15860 +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
15861 +
15862 +/* True if negative values of the signed integer type T use two's
15863 +   complement, ones' complement, or signed magnitude representation,
15864 +   respectively.  Much GNU code assumes two's complement, but some
15865 +   people like to be portable to all possible C hosts.  */
15866 +#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
15867 +#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
15868 +#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
15869 +
15870 +/* True if the arithmetic type T is signed.  */
15871 +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
15872 +
15873 +/* The maximum and minimum values for the integer type T.  These
15874 +   macros have undefined behavior if T is signed and has padding bits.
15875 +   If this is a problem for you, please let us know how to fix it for
15876 +   your host.  */
15877 +#define TYPE_MINIMUM(t) \
15878 +  ((t) (! TYPE_SIGNED (t) \
15879 +       ? (t) 0 \
15880 +       : TYPE_SIGNED_MAGNITUDE (t) \
15881 +       ? ~ (t) 0 \
15882 +       : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
15883 +#define TYPE_MAXIMUM(t) \
15884 +  ((t) (! TYPE_SIGNED (t) \
15885 +       ? (t) -1 \
15886 +       : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
15887 +
15888 +/* Return zero if T can be determined to be an unsigned type.
15889 +   Otherwise, return 1.
15890 +   When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a
15891 +   tighter bound.  Otherwise, it overestimates the true bound by one byte
15892 +   when applied to unsigned types of size 2, 4, 16, ... bytes.
15893 +   The symbol signed_type_or_expr__ is private to this header file.  */
15894 +#if __GNUC__ >= 2
15895 +# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
15896 +#else
15897 +# define signed_type_or_expr__(t) 1
15898 +#endif
15899 +
15900 +/* Bound on length of the string representing an integer type or expression T.
15901 +   Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
15902 +   add 1 for integer division truncation; add 1 more for a minus sign
15903 +   if needed.  */
15904 +#define INT_STRLEN_BOUND(t) \
15905 +  ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
15906 +   + signed_type_or_expr__ (t) + 1)
15907 +
15908 +/* Bound on buffer size needed to represent an integer type or expression T,
15909 +   including the terminating null.  */
15910 +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
15911 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/Makefile.am gtk-vnc-0.3.7.gnulib/gnulib/tests/Makefile.am
15912 --- gtk-vnc-0.3.7.mingw/gnulib/tests/Makefile.am        1970-01-01 01:00:00.000000000 +0100
15913 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/Makefile.am       2008-10-09 12:24:40.000000000 +0100
15914 @@ -0,0 +1,192 @@
15915 +## DO NOT EDIT! GENERATED AUTOMATICALLY!
15916 +## Process this file with automake to produce Makefile.in.
15917 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
15918 +#
15919 +# This file is free software, distributed under the terms of the GNU
15920 +# General Public License.  As a special exception to the GNU General
15921 +# Public License, this file may be distributed as part of a program
15922 +# that contains a configuration script generated by Autoconf, under
15923 +# the same distribution terms as the rest of that program.
15924 +#
15925 +# Generated by gnulib-tool.
15926 +
15927 +AUTOMAKE_OPTIONS = 1.5 foreign
15928 +
15929 +SUBDIRS =
15930 +TESTS =
15931 +TESTS_ENVIRONMENT =
15932 +noinst_PROGRAMS =
15933 +check_PROGRAMS =
15934 +noinst_HEADERS =
15935 +noinst_LIBRARIES =
15936 +check_LIBRARIES = libtests.a
15937 +EXTRA_DIST =
15938 +BUILT_SOURCES =
15939 +SUFFIXES =
15940 +MOSTLYCLEANFILES = core *.stackdump
15941 +MOSTLYCLEANDIRS =
15942 +CLEANFILES =
15943 +DISTCLEANFILES =
15944 +MAINTAINERCLEANFILES =
15945 +
15946 +AM_CPPFLAGS = \
15947 +  -I. -I$(srcdir) \
15948 +  -I../.. -I$(srcdir)/../.. \
15949 +  -I../../gnulib/lib -I$(srcdir)/../../gnulib/lib
15950 +
15951 +LDADD = libtests.a ../../gnulib/lib/libgnu.la libtests.a $(LIBTESTS_LIBDEPS)
15952 +
15953 +libtests_a_SOURCES =
15954 +libtests_a_LIBADD = $(gltests_LIBOBJS)
15955 +libtests_a_DEPENDENCIES = $(gltests_LIBOBJS)
15956 +EXTRA_libtests_a_SOURCES =
15957 +AM_LIBTOOLFLAGS = --preserve-dup-deps
15958 +
15959 +## begin gnulib module alloca-opt-tests
15960 +
15961 +TESTS += test-alloca-opt
15962 +check_PROGRAMS += test-alloca-opt
15963 +
15964 +EXTRA_DIST += test-alloca-opt.c
15965 +
15966 +## end   gnulib module alloca-opt-tests
15967 +
15968 +## begin gnulib module arpa_inet-tests
15969 +
15970 +TESTS += test-arpa_inet
15971 +check_PROGRAMS += test-arpa_inet
15972 +
15973 +EXTRA_DIST += test-arpa_inet.c
15974 +
15975 +## end   gnulib module arpa_inet-tests
15976 +
15977 +## begin gnulib module errno-tests
15978 +
15979 +TESTS += test-errno
15980 +check_PROGRAMS += test-errno
15981 +
15982 +EXTRA_DIST += test-errno.c
15983 +
15984 +## end   gnulib module errno-tests
15985 +
15986 +## begin gnulib module getaddrinfo-tests
15987 +
15988 +TESTS += test-getaddrinfo
15989 +check_PROGRAMS += test-getaddrinfo
15990 +test_getaddrinfo_LDADD = $(LDADD) @LIBINTL@
15991 +
15992 +EXTRA_DIST += test-getaddrinfo.c
15993 +
15994 +## end   gnulib module getaddrinfo-tests
15995 +
15996 +## begin gnulib module intprops
15997 +
15998 +
15999 +EXTRA_DIST += intprops.h
16000 +
16001 +## end   gnulib module intprops
16002 +
16003 +## begin gnulib module netinet_in-tests
16004 +
16005 +TESTS += test-netinet_in
16006 +check_PROGRAMS += test-netinet_in
16007 +
16008 +EXTRA_DIST += test-netinet_in.c
16009 +
16010 +## end   gnulib module netinet_in-tests
16011 +
16012 +## begin gnulib module snprintf-tests
16013 +
16014 +TESTS += test-snprintf
16015 +check_PROGRAMS += test-snprintf
16016 +
16017 +EXTRA_DIST += test-snprintf.c
16018 +
16019 +## end   gnulib module snprintf-tests
16020 +
16021 +## begin gnulib module stdbool-tests
16022 +
16023 +TESTS += test-stdbool
16024 +check_PROGRAMS += test-stdbool
16025 +
16026 +EXTRA_DIST += test-stdbool.c
16027 +
16028 +## end   gnulib module stdbool-tests
16029 +
16030 +## begin gnulib module stdint-tests
16031 +
16032 +TESTS += test-stdint
16033 +check_PROGRAMS += test-stdint
16034 +
16035 +EXTRA_DIST += test-stdint.c
16036 +
16037 +## end   gnulib module stdint-tests
16038 +
16039 +## begin gnulib module stdio-tests
16040 +
16041 +TESTS += test-stdio
16042 +check_PROGRAMS += test-stdio
16043 +
16044 +EXTRA_DIST += test-stdio.c
16045 +
16046 +## end   gnulib module stdio-tests
16047 +
16048 +## begin gnulib module sys_socket-tests
16049 +
16050 +TESTS += test-sys_socket
16051 +check_PROGRAMS += test-sys_socket
16052 +
16053 +EXTRA_DIST += test-sys_socket.c
16054 +
16055 +## end   gnulib module sys_socket-tests
16056 +
16057 +## begin gnulib module vasnprintf-tests
16058 +
16059 +TESTS += test-vasnprintf
16060 +check_PROGRAMS += test-vasnprintf
16061 +
16062 +EXTRA_DIST += test-vasnprintf.c
16063 +
16064 +## end   gnulib module vasnprintf-tests
16065 +
16066 +## begin gnulib module vc-list-files-tests
16067 +
16068 +TESTS += test-vc-list-files-git.sh
16069 +TESTS += test-vc-list-files-cvs.sh
16070 +TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)':"$$PATH"
16071 +EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh
16072 +
16073 +## end   gnulib module vc-list-files-tests
16074 +
16075 +## begin gnulib module verify
16076 +
16077 +libtests_a_SOURCES += verify.h
16078 +
16079 +## end   gnulib module verify
16080 +
16081 +## begin gnulib module wchar-tests
16082 +
16083 +TESTS += test-wchar
16084 +check_PROGRAMS += test-wchar
16085 +
16086 +EXTRA_DIST += test-wchar.c
16087 +
16088 +## end   gnulib module wchar-tests
16089 +
16090 +## begin gnulib module dummy
16091 +
16092 +libtests_a_SOURCES += dummy.c
16093 +
16094 +## end   gnulib module dummy
16095 +
16096 +# Clean up after Solaris cc.
16097 +clean-local:
16098 +       rm -rf SunWS_cache
16099 +
16100 +mostlyclean-local: mostlyclean-generic
16101 +       @for dir in '' $(MOSTLYCLEANDIRS); do \
16102 +         if test -n "$$dir" && test -d $$dir; then \
16103 +           echo "rmdir $$dir"; rmdir $$dir; \
16104 +         fi; \
16105 +       done; \
16106 +       :
16107 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-alloca-opt.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-alloca-opt.c
16108 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-alloca-opt.c  1970-01-01 01:00:00.000000000 +0100
16109 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-alloca-opt.c 2008-10-09 12:24:39.000000000 +0100
16110 @@ -0,0 +1,62 @@
16111 +/* Test of optional automatic memory allocation.
16112 +   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
16113 +
16114 +   This program is free software: you can redistribute it and/or modify
16115 +   it under the terms of the GNU General Public License as published by
16116 +   the Free Software Foundation; either version 3 of the License, or
16117 +   (at your option) any later version.
16118 +
16119 +   This program is distributed in the hope that it will be useful,
16120 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16121 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16122 +   GNU General Public License for more details.
16123 +
16124 +   You should have received a copy of the GNU General Public License
16125 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16126 +
16127 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
16128 +
16129 +#include <config.h>
16130 +
16131 +#include <alloca.h>
16132 +
16133 +#if HAVE_ALLOCA
16134 +
16135 +static void
16136 +do_allocation (int n)
16137 +{
16138 +  void *ptr = alloca (n);
16139 +  (void) ptr;
16140 +}
16141 +
16142 +void (*func) (int) = do_allocation;
16143 +
16144 +#endif
16145 +
16146 +int
16147 +main ()
16148 +{
16149 +#if HAVE_ALLOCA
16150 +  int i;
16151 +
16152 +  /* Repeat a lot of times, to make sure there's no memory leak.  */
16153 +  for (i = 0; i < 100000; i++)
16154 +    {
16155 +      /* Try various values.
16156 +         n = 0 gave a crash on Alpha with gcc-2.5.8.
16157 +         Some versions of MacOS X have a stack size limit of 512 KB.  */
16158 +      func (34);
16159 +      func (134);
16160 +      func (399);
16161 +      func (510823);
16162 +      func (129321);
16163 +      func (0);
16164 +      func (4070);
16165 +      func (4095);
16166 +      func (1);
16167 +      func (16582);
16168 +    }
16169 +#endif
16170 +
16171 +  return 0;
16172 +}
16173 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-arpa_inet.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-arpa_inet.c
16174 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-arpa_inet.c   1970-01-01 01:00:00.000000000 +0100
16175 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-arpa_inet.c  2008-10-09 12:24:39.000000000 +0100
16176 @@ -0,0 +1,27 @@
16177 +/* Test of <arpa/inet.h> substitute.
16178 +   Copyright (C) 2007 Free Software Foundation, Inc.
16179 +
16180 +   This program is free software: you can redistribute it and/or modify
16181 +   it under the terms of the GNU General Public License as published by
16182 +   the Free Software Foundation; either version 3 of the License, or
16183 +   (at your option) any later version.
16184 +
16185 +   This program is distributed in the hope that it will be useful,
16186 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16187 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16188 +   GNU General Public License for more details.
16189 +
16190 +   You should have received a copy of the GNU General Public License
16191 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16192 +
16193 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
16194 +
16195 +#include <config.h>
16196 +
16197 +#include <arpa/inet.h>
16198 +
16199 +int
16200 +main ()
16201 +{
16202 +  return 0;
16203 +}
16204 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-errno.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-errno.c
16205 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-errno.c       1970-01-01 01:00:00.000000000 +0100
16206 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-errno.c      2008-10-09 12:24:39.000000000 +0100
16207 @@ -0,0 +1,117 @@
16208 +/* Test of <errno.h> substitute.
16209 +   Copyright (C) 2008 Free Software Foundation, Inc.
16210 +
16211 +   This program is free software: you can redistribute it and/or modify
16212 +   it under the terms of the GNU General Public License as published by
16213 +   the Free Software Foundation; either version 3 of the License, or
16214 +   (at your option) any later version.
16215 +
16216 +   This program is distributed in the hope that it will be useful,
16217 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16218 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16219 +   GNU General Public License for more details.
16220 +
16221 +   You should have received a copy of the GNU General Public License
16222 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16223 +
16224 +/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
16225 +
16226 +#include <config.h>
16227 +
16228 +#include <errno.h>
16229 +
16230 +/* Verify that the POSIX mandated errno values exist and can be used as
16231 +   initializers outside of a function.
16232 +   The variable names happen to match the Linux/x86 error numbers.  */
16233 +int e1 = EPERM;
16234 +int e2 = ENOENT;
16235 +int e3 = ESRCH;
16236 +int e4 = EINTR;
16237 +int e5 = EIO;
16238 +int e6 = ENXIO;
16239 +int e7 = E2BIG;
16240 +int e8 = ENOEXEC;
16241 +int e9 = EBADF;
16242 +int e10 = ECHILD;
16243 +int e11 = EAGAIN;
16244 +int e11a = EWOULDBLOCK;
16245 +int e12 = ENOMEM;
16246 +int e13 = EACCES;
16247 +int e14 = EFAULT;
16248 +int e16 = EBUSY;
16249 +int e17 = EEXIST;
16250 +int e18 = EXDEV;
16251 +int e19 = ENODEV;
16252 +int e20 = ENOTDIR;
16253 +int e21 = EISDIR;
16254 +int e22 = EINVAL;
16255 +int e23 = ENFILE;
16256 +int e24 = EMFILE;
16257 +int e25 = ENOTTY;
16258 +int e26 = ETXTBSY;
16259 +int e27 = EFBIG;
16260 +int e28 = ENOSPC;
16261 +int e29 = ESPIPE;
16262 +int e30 = EROFS;
16263 +int e31 = EMLINK;
16264 +int e32 = EPIPE;
16265 +int e33 = EDOM;
16266 +int e34 = ERANGE;
16267 +int e35 = EDEADLK;
16268 +int e36 = ENAMETOOLONG;
16269 +int e37 = ENOLCK;
16270 +int e38 = ENOSYS;
16271 +int e39 = ENOTEMPTY;
16272 +int e40 = ELOOP;
16273 +int e42 = ENOMSG;
16274 +int e43 = EIDRM;
16275 +int e67 = ENOLINK;
16276 +int e71 = EPROTO;
16277 +int e72 = EMULTIHOP;
16278 +int e74 = EBADMSG;
16279 +int e75 = EOVERFLOW;
16280 +int e84 = EILSEQ;
16281 +int e88 = ENOTSOCK;
16282 +int e89 = EDESTADDRREQ;
16283 +int e90 = EMSGSIZE;
16284 +int e91 = EPROTOTYPE;
16285 +int e92 = ENOPROTOOPT;
16286 +int e93 = EPROTONOSUPPORT;
16287 +int e95 = EOPNOTSUPP;
16288 +int e95a = ENOTSUP;
16289 +int e97 = EAFNOSUPPORT;
16290 +int e98 = EADDRINUSE;
16291 +int e99 = EADDRNOTAVAIL;
16292 +int e100 = ENETDOWN;
16293 +int e101 = ENETUNREACH;
16294 +int e102 = ENETRESET;
16295 +int e103 = ECONNABORTED;
16296 +int e104 = ECONNRESET;
16297 +int e105 = ENOBUFS;
16298 +int e106 = EISCONN;
16299 +int e107 = ENOTCONN;
16300 +int e110 = ETIMEDOUT;
16301 +int e111 = ECONNREFUSED;
16302 +int e113 = EHOSTUNREACH;
16303 +int e114 = EALREADY;
16304 +int e115 = EINPROGRESS;
16305 +int e116 = ESTALE;
16306 +int e122 = EDQUOT;
16307 +int e125 = ECANCELED;
16308 +
16309 +/* Don't verify that these errno values are all different, except for possibly
16310 +   EWOULDBLOCK == EAGAIN.  Even Linux/x86 does not pass this check: it has
16311 +   ENOTSUP == EOPNOTSUPP.  */
16312 +
16313 +int
16314 +main ()
16315 +{
16316 +  /* Verify that errno can be assigned.  */
16317 +  errno = EOVERFLOW;
16318 +
16319 +  /* snprintf() callers want to distinguish EINVAL and EOVERFLOW.  */
16320 +  if (errno == EINVAL)
16321 +    return 1;
16322 +
16323 +  return 0;
16324 +}
16325 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-getaddrinfo.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-getaddrinfo.c
16326 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-getaddrinfo.c 1970-01-01 01:00:00.000000000 +0100
16327 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-getaddrinfo.c        2008-10-09 12:24:39.000000000 +0100
16328 @@ -0,0 +1,155 @@
16329 +/* Test the getaddrinfo module.
16330 +
16331 +   Copyright (C) 2006-2008 Free Software Foundation, Inc.
16332 +
16333 +   This program is free software: you can redistribute it and/or modify
16334 +   it under the terms of the GNU General Public License as published by
16335 +   the Free Software Foundation; either version 3 of the License, or
16336 +   (at your option) any later version.
16337 +
16338 +   This program is distributed in the hope that it will be useful,
16339 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16340 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16341 +   GNU General Public License for more details.
16342 +
16343 +   You should have received a copy of the GNU General Public License
16344 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16345 +
16346 +/* Written by Simon Josefsson.  */
16347 +
16348 +#include <config.h>
16349 +#include "getaddrinfo.h"
16350 +#include <arpa/inet.h>
16351 +#include <netinet/in.h>
16352 +#include <stdio.h>
16353 +#include <string.h>
16354 +
16355 +/* Whether to print debugging messages.  */
16356 +#define ENABLE_DEBUGGING 0
16357 +
16358 +#if ENABLE_DEBUGGING
16359 +# define dbgprintf printf
16360 +#else
16361 +# define dbgprintf if (0) printf
16362 +#endif
16363 +
16364 +/* BeOS does not have AF_UNSPEC.  */
16365 +#ifndef AF_UNSPEC
16366 +# define AF_UNSPEC 0
16367 +#endif
16368 +
16369 +#ifndef EAI_SERVICE
16370 +# define EAI_SERVICE 0
16371 +#endif
16372 +
16373 +int simple (char *host, char *service)
16374 +{
16375 +  char buf[BUFSIZ];
16376 +  struct addrinfo hints;
16377 +  struct addrinfo *ai0, *ai;
16378 +  int res;
16379 +
16380 +  dbgprintf ("Finding %s service %s...\n", host, service);
16381 +
16382 +  /* This initializes "hints" but does not use it.  Is there a reason
16383 +     for this?  If so, please fix this comment.  */
16384 +  memset (&hints, 0, sizeof (hints));
16385 +  hints.ai_flags = AI_CANONNAME;
16386 +  hints.ai_family = AF_UNSPEC;
16387 +  hints.ai_socktype = SOCK_STREAM;
16388 +
16389 +  res = getaddrinfo (host, service, 0, &ai0);
16390 +
16391 +  dbgprintf ("res %d: %s\n", res, gai_strerror (res));
16392 +
16393 +  if (res != 0)
16394 +    {
16395 +      /* IRIX reports EAI_NONAME for "https".  Don't fail the test
16396 +        merely because of this.  */
16397 +      if (res == EAI_NONAME)
16398 +       return 0;
16399 +      /* Solaris reports EAI_SERVICE for "http" and "https".  Don't
16400 +         fail the test merely because of this.  */
16401 +      if (res == EAI_SERVICE)
16402 +       return 0;
16403 +      /* AIX reports EAI_NODATA for "https".  Don't fail the test
16404 +        merely because of this.  */
16405 +      if (res == EAI_NODATA)
16406 +       return 0;
16407 +
16408 +      return 1;
16409 +    }
16410 +
16411 +  for (ai = ai0; ai; ai = ai->ai_next)
16412 +    {
16413 +      dbgprintf ("\tflags %x\n", ai->ai_flags);
16414 +      dbgprintf ("\tfamily %x\n", ai->ai_family);
16415 +      dbgprintf ("\tsocktype %x\n", ai->ai_socktype);
16416 +      dbgprintf ("\tprotocol %x\n", ai->ai_protocol);
16417 +      dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen);
16418 +      dbgprintf ("\tFound %s\n",
16419 +                inet_ntop (ai->ai_family,
16420 +                           &((struct sockaddr_in *)
16421 +                             ai->ai_addr)->sin_addr,
16422 +                           buf, sizeof (buf) - 1));
16423 +      if (ai->ai_canonname)
16424 +       dbgprintf ("\tFound %s...\n", ai->ai_canonname);
16425 +
16426 +      {
16427 +       char ipbuf[BUFSIZ];
16428 +       char portbuf[BUFSIZ];
16429 +
16430 +       res = getnameinfo (ai->ai_addr, ai->ai_addrlen,
16431 +                          ipbuf, sizeof (ipbuf) - 1,
16432 +                          portbuf, sizeof (portbuf) - 1,
16433 +                          NI_NUMERICHOST|NI_NUMERICSERV);
16434 +       dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res));
16435 +       if (res == 0)
16436 +         {
16437 +           dbgprintf ("\t\tip %s\n", ipbuf);
16438 +           dbgprintf ("\t\tport %s\n", portbuf);
16439 +         }
16440 +      }
16441 +
16442 +    }
16443 +
16444 +  freeaddrinfo (ai0);
16445 +
16446 +  return 0;
16447 +}
16448 +
16449 +#define HOST1 "www.gnu.org"
16450 +#define SERV1 "http"
16451 +#define HOST2 "www.ibm.com"
16452 +#define SERV2 "https"
16453 +#define HOST3 "microsoft.com"
16454 +#define SERV3 "http"
16455 +#define HOST4 "google.org"
16456 +#define SERV4 "ldap"
16457 +
16458 +int main (void)
16459 +{
16460 +#if _WIN32
16461 +  {
16462 +    WORD requested;
16463 +    WSADATA data;
16464 +    int err;
16465 +
16466 +    requested = MAKEWORD (1, 1);
16467 +    err = WSAStartup (requested, &data);
16468 +    if (err != 0)
16469 +      return 1;
16470 +
16471 +    if (data.wVersion < requested)
16472 +      {
16473 +       WSACleanup ();
16474 +       return 2;
16475 +      }
16476 +  }
16477 +#endif
16478 +
16479 +  return simple (HOST1, SERV1)
16480 +    + simple (HOST2, SERV2)
16481 +    + simple (HOST3, SERV3)
16482 +    + simple (HOST4, SERV4);
16483 +}
16484 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-netinet_in.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-netinet_in.c
16485 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-netinet_in.c  1970-01-01 01:00:00.000000000 +0100
16486 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-netinet_in.c 2008-10-09 12:24:39.000000000 +0100
16487 @@ -0,0 +1,27 @@
16488 +/* Test of <netinet/in.h> substitute.
16489 +   Copyright (C) 2007 Free Software Foundation, Inc.
16490 +
16491 +   This program is free software: you can redistribute it and/or modify
16492 +   it under the terms of the GNU General Public License as published by
16493 +   the Free Software Foundation; either version 3 of the License, or
16494 +   (at your option) any later version.
16495 +
16496 +   This program is distributed in the hope that it will be useful,
16497 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16498 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16499 +   GNU General Public License for more details.
16500 +
16501 +   You should have received a copy of the GNU General Public License
16502 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16503 +
16504 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
16505 +
16506 +#include <config.h>
16507 +
16508 +#include <netinet/in.h>
16509 +
16510 +int
16511 +main ()
16512 +{
16513 +  return 0;
16514 +}
16515 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-snprintf.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-snprintf.c
16516 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-snprintf.c    1970-01-01 01:00:00.000000000 +0100
16517 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-snprintf.c   2008-10-09 12:24:39.000000000 +0100
16518 @@ -0,0 +1,72 @@
16519 +/* Test of snprintf() function.
16520 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
16521 +
16522 +   This program is free software: you can redistribute it and/or modify
16523 +   it under the terms of the GNU General Public License as published by
16524 +   the Free Software Foundation; either version 3 of the License, or
16525 +   (at your option) any later version.
16526 +
16527 +   This program is distributed in the hope that it will be useful,
16528 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16529 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16530 +   GNU General Public License for more details.
16531 +
16532 +   You should have received a copy of the GNU General Public License
16533 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16534 +
16535 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
16536 +
16537 +#include <config.h>
16538 +
16539 +#include <stdio.h>
16540 +
16541 +#include <stdlib.h>
16542 +#include <string.h>
16543 +
16544 +#define ASSERT(expr) \
16545 +  do                                                                        \
16546 +    {                                                                       \
16547 +      if (!(expr))                                                          \
16548 +        {                                                                   \
16549 +          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
16550 +          fflush (stderr);                                                  \
16551 +          abort ();                                                         \
16552 +        }                                                                   \
16553 +    }                                                                       \
16554 +  while (0)
16555 +
16556 +int
16557 +main (int argc, char *argv[])
16558 +{
16559 +  char buf[8];
16560 +  int size;
16561 +  int retval;
16562 +
16563 +  for (size = 0; size <= 8; size++)
16564 +    {
16565 +      memcpy (buf, "DEADBEEF", 8);
16566 +      retval = snprintf (buf, size, "%d", 12345);
16567 +      if (size < 6)
16568 +       {
16569 +#if CHECK_SNPRINTF_POSIX
16570 +         ASSERT (retval < 0 || retval >= size);
16571 +#endif
16572 +         if (size > 0)
16573 +           {
16574 +             ASSERT (memcmp (buf, "12345", size - 1) == 0);
16575 +             ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
16576 +           }
16577 +#if !CHECK_SNPRINTF_POSIX
16578 +         if (size > 0)
16579 +#endif
16580 +           ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
16581 +       }
16582 +      else
16583 +       {
16584 +         ASSERT (retval == 5);
16585 +         ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
16586 +       }
16587 +    }
16588 +
16589 +  return 0;
16590 +}
16591 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdbool.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdbool.c
16592 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdbool.c     1970-01-01 01:00:00.000000000 +0100
16593 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdbool.c    2008-10-09 12:24:39.000000000 +0100
16594 @@ -0,0 +1,95 @@
16595 +/* Test of <stdbool.h> substitute.
16596 +   Copyright (C) 2002-2007 Free Software Foundation, Inc.
16597 +
16598 +   This program is free software: you can redistribute it and/or modify
16599 +   it under the terms of the GNU General Public License as published by
16600 +   the Free Software Foundation; either version 3 of the License, or
16601 +   (at your option) any later version.
16602 +
16603 +   This program is distributed in the hope that it will be useful,
16604 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16605 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16606 +   GNU General Public License for more details.
16607 +
16608 +   You should have received a copy of the GNU General Public License
16609 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16610 +
16611 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
16612 +
16613 +#include <config.h>
16614 +
16615 +#include <stdbool.h>
16616 +
16617 +#ifndef bool
16618 + "error: bool is not defined"
16619 +#endif
16620 +#ifndef false
16621 + "error: false is not defined"
16622 +#endif
16623 +#if false
16624 + "error: false is not 0"
16625 +#endif
16626 +#ifndef true
16627 + "error: true is not defined"
16628 +#endif
16629 +#if true != 1
16630 + "error: true is not 1"
16631 +#endif
16632 +#ifndef __bool_true_false_are_defined
16633 + "error: __bool_true_false_are_defined is not defined"
16634 +#endif
16635 +
16636 +#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>.  */
16637 +struct s { _Bool s: 1; _Bool t; } s;
16638 +#endif
16639 +
16640 +char a[true == 1 ? 1 : -1];
16641 +char b[false == 0 ? 1 : -1];
16642 +char c[__bool_true_false_are_defined == 1 ? 1 : -1];
16643 +#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>.  */
16644 +char d[(bool) 0.5 == true ? 1 : -1];
16645 +bool e = &s;
16646 +#endif
16647 +char f[(_Bool) 0.0 == false ? 1 : -1];
16648 +char g[true];
16649 +char h[sizeof (_Bool)];
16650 +#if 0 /* See above.  */
16651 +char i[sizeof s.t];
16652 +#endif
16653 +enum { j = false, k = true, l = false * true, m = true * 256 };
16654 +_Bool n[m];
16655 +char o[sizeof n == m * sizeof n[0] ? 1 : -1];
16656 +char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
16657 +#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>.  */
16658 +#if defined __xlc__ || defined __GNUC__
16659 + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
16660 +    reported by James Lemley on 2005-10-05; see
16661 +    http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
16662 +    This test is not quite right, since xlc is allowed to
16663 +    reject this program, as the initializer for xlcbug is
16664 +    not one of the forms that C requires support for.
16665 +    However, doing the test right would require a run-time
16666 +    test, and that would make cross-compilation harder.
16667 +    Let us hope that IBM fixes the xlc bug, and also adds
16668 +    support for this kind of constant expression.  In the
16669 +    meantime, this test will reject xlc, which is OK, since
16670 +    our stdbool.h substitute should suffice.  We also test
16671 +    this with GCC, where it should work, to detect more
16672 +    quickly whether someone messes up the test in the
16673 +    future.  */
16674 + char digs[] = "0123456789";
16675 + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
16676 +#endif
16677 +#endif
16678 +/* Catch a bug in an HP-UX C compiler.  See
16679 +   http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
16680 +   http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
16681 + */
16682 +_Bool q = true;
16683 +_Bool *pq = &q;
16684 +
16685 +int
16686 +main ()
16687 +{
16688 +  return 0;
16689 +}
16690 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdint.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdint.c
16691 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdint.c      1970-01-01 01:00:00.000000000 +0100
16692 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdint.c     2008-10-09 12:24:39.000000000 +0100
16693 @@ -0,0 +1,360 @@
16694 +/* Test of <stdint.h> substitute.
16695 +   Copyright (C) 2006-2008 Free Software Foundation, Inc.
16696 +
16697 +   This program is free software: you can redistribute it and/or modify
16698 +   it under the terms of the GNU General Public License as published by
16699 +   the Free Software Foundation; either version 3 of the License, or
16700 +   (at your option) any later version.
16701 +
16702 +   This program is distributed in the hope that it will be useful,
16703 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16704 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16705 +   GNU General Public License for more details.
16706 +
16707 +   You should have received a copy of the GNU General Public License
16708 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16709 +
16710 +/* Written by Bruno Haible <bruno@clisp.org>, 2006.  */
16711 +
16712 +#include <config.h>
16713 +
16714 +/* Whether to enable pedantic checks. */
16715 +#define DO_PEDANTIC 0
16716 +
16717 +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
16718 +#include <stdint.h>
16719 +
16720 +#include "verify.h"
16721 +#include "intprops.h"
16722 +
16723 +#if __GNUC__ >= 2 && DO_PEDANTIC
16724 +# define verify_same_types(expr1,expr2)  \
16725 +    extern void _verify_func(__LINE__) (__typeof__ (expr1) *); \
16726 +    extern void _verify_func(__LINE__) (__typeof__ (expr2) *);
16727 +# define _verify_func(line) _verify_func2(line)
16728 +# define _verify_func2(line) verify_func_ ## line
16729 +#else
16730 +# define verify_same_types(expr1,expr2) extern void verify_func (int)
16731 +#endif
16732 +
16733 +/* 7.18.1.1. Exact-width integer types */
16734 +/* 7.18.2.1. Limits of exact-width integer types */
16735 +
16736 +int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX };
16737 +verify (TYPE_MINIMUM (int8_t) == INT8_MIN);
16738 +verify (TYPE_MAXIMUM (int8_t) == INT8_MAX);
16739 +verify_same_types (INT8_MIN, (int8_t) 0 + 0);
16740 +verify_same_types (INT8_MAX, (int8_t) 0 + 0);
16741 +
16742 +int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX };
16743 +verify (TYPE_MINIMUM (int16_t) == INT16_MIN);
16744 +verify (TYPE_MAXIMUM (int16_t) == INT16_MAX);
16745 +verify_same_types (INT16_MIN, (int16_t) 0 + 0);
16746 +verify_same_types (INT16_MAX, (int16_t) 0 + 0);
16747 +
16748 +int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX };
16749 +verify (TYPE_MINIMUM (int32_t) == INT32_MIN);
16750 +verify (TYPE_MAXIMUM (int32_t) == INT32_MAX);
16751 +verify_same_types (INT32_MIN, (int32_t) 0 + 0);
16752 +verify_same_types (INT32_MAX, (int32_t) 0 + 0);
16753 +
16754 +#ifdef INT64_MAX
16755 +int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX };
16756 +verify (TYPE_MINIMUM (int64_t) == INT64_MIN);
16757 +verify (TYPE_MAXIMUM (int64_t) == INT64_MAX);
16758 +verify_same_types (INT64_MIN, (int64_t) 0 + 0);
16759 +verify_same_types (INT64_MAX, (int64_t) 0 + 0);
16760 +#endif
16761 +
16762 +uint8_t b1[2] = { UINT8_C (17), UINT8_MAX };
16763 +verify (TYPE_MAXIMUM (uint8_t) == UINT8_MAX);
16764 +verify_same_types (UINT8_MAX, (uint8_t) 0 + 0);
16765 +
16766 +uint16_t b2[2] = { UINT16_C (17), UINT16_MAX };
16767 +verify (TYPE_MAXIMUM (uint16_t) == UINT16_MAX);
16768 +verify_same_types (UINT16_MAX, (uint16_t) 0 + 0);
16769 +
16770 +uint32_t b3[2] = { UINT32_C (17), UINT32_MAX };
16771 +verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX);
16772 +verify_same_types (UINT32_MAX, (uint32_t) 0 + 0);
16773 +
16774 +#ifdef UINT64_MAX
16775 +uint64_t b4[2] = { UINT64_C (17), UINT64_MAX };
16776 +verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX);
16777 +verify_same_types (UINT64_MAX, (uint64_t) 0 + 0);
16778 +#endif
16779 +
16780 +#if INT8_MIN && INT8_MAX && INT16_MIN && INT16_MAX && INT32_MIN && INT32_MAX
16781 +/* ok */
16782 +#else
16783 +err or;
16784 +#endif
16785 +
16786 +#if UINT8_MAX && UINT16_MAX && UINT32_MAX
16787 +/* ok */
16788 +#else
16789 +err or;
16790 +#endif
16791 +
16792 +/* 7.18.1.2. Minimum-width integer types */
16793 +/* 7.18.2.2. Limits of minimum-width integer types */
16794 +
16795 +int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX };
16796 +verify (TYPE_MINIMUM (int_least8_t) == INT_LEAST8_MIN);
16797 +verify (TYPE_MAXIMUM (int_least8_t) == INT_LEAST8_MAX);
16798 +verify_same_types (INT_LEAST8_MIN, (int_least8_t) 0 + 0);
16799 +verify_same_types (INT_LEAST8_MAX, (int_least8_t) 0 + 0);
16800 +
16801 +int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX };
16802 +verify (TYPE_MINIMUM (int_least16_t) == INT_LEAST16_MIN);
16803 +verify (TYPE_MAXIMUM (int_least16_t) == INT_LEAST16_MAX);
16804 +verify_same_types (INT_LEAST16_MIN, (int_least16_t) 0 + 0);
16805 +verify_same_types (INT_LEAST16_MAX, (int_least16_t) 0 + 0);
16806 +
16807 +int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX };
16808 +verify (TYPE_MINIMUM (int_least32_t) == INT_LEAST32_MIN);
16809 +verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX);
16810 +verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0);
16811 +verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0);
16812 +
16813 +#ifdef INT_LEAST64_MAX
16814 +int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX };
16815 +verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN);
16816 +verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX);
16817 +verify_same_types (INT_LEAST64_MIN, (int_least64_t) 0 + 0);
16818 +verify_same_types (INT_LEAST64_MAX, (int_least64_t) 0 + 0);
16819 +#endif
16820 +
16821 +uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX };
16822 +verify (TYPE_MAXIMUM (uint_least8_t) == UINT_LEAST8_MAX);
16823 +verify_same_types (UINT_LEAST8_MAX, (uint_least8_t) 0 + 0);
16824 +
16825 +uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX };
16826 +verify (TYPE_MAXIMUM (uint_least16_t) == UINT_LEAST16_MAX);
16827 +verify_same_types (UINT_LEAST16_MAX, (uint_least16_t) 0 + 0);
16828 +
16829 +uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX };
16830 +verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX);
16831 +verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0);
16832 +
16833 +#ifdef UINT_LEAST64_MAX
16834 +uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX };
16835 +verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX);
16836 +verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0);
16837 +#endif
16838 +
16839 +#if INT_LEAST8_MIN && INT_LEAST8_MAX && INT_LEAST16_MIN && INT_LEAST16_MAX && INT_LEAST32_MIN && INT_LEAST32_MAX
16840 +/* ok */
16841 +#else
16842 +err or;
16843 +#endif
16844 +
16845 +#if UINT_LEAST8_MAX && UINT_LEAST16_MAX && UINT_LEAST32_MAX
16846 +/* ok */
16847 +#else
16848 +err or;
16849 +#endif
16850 +
16851 +/* 7.18.1.3. Fastest minimum-width integer types */
16852 +/* 7.18.2.3. Limits of fastest minimum-width integer types */
16853 +
16854 +int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX };
16855 +verify (TYPE_MINIMUM (int_fast8_t) == INT_FAST8_MIN);
16856 +verify (TYPE_MAXIMUM (int_fast8_t) == INT_FAST8_MAX);
16857 +verify_same_types (INT_FAST8_MIN, (int_fast8_t) 0 + 0);
16858 +verify_same_types (INT_FAST8_MAX, (int_fast8_t) 0 + 0);
16859 +
16860 +int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX };
16861 +verify (TYPE_MINIMUM (int_fast16_t) == INT_FAST16_MIN);
16862 +verify (TYPE_MAXIMUM (int_fast16_t) == INT_FAST16_MAX);
16863 +verify_same_types (INT_FAST16_MIN, (int_fast16_t) 0 + 0);
16864 +verify_same_types (INT_FAST16_MAX, (int_fast16_t) 0 + 0);
16865 +
16866 +int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX };
16867 +verify (TYPE_MINIMUM (int_fast32_t) == INT_FAST32_MIN);
16868 +verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX);
16869 +verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0);
16870 +verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0);
16871 +
16872 +#ifdef INT_FAST64_MAX
16873 +int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX };
16874 +verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN);
16875 +verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX);
16876 +verify_same_types (INT_FAST64_MIN, (int_fast64_t) 0 + 0);
16877 +verify_same_types (INT_FAST64_MAX, (int_fast64_t) 0 + 0);
16878 +#endif
16879 +
16880 +uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX };
16881 +verify (TYPE_MAXIMUM (uint_fast8_t) == UINT_FAST8_MAX);
16882 +verify_same_types (UINT_FAST8_MAX, (uint_fast8_t) 0 + 0);
16883 +
16884 +uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX };
16885 +verify (TYPE_MAXIMUM (uint_fast16_t) == UINT_FAST16_MAX);
16886 +verify_same_types (UINT_FAST16_MAX, (uint_fast16_t) 0 + 0);
16887 +
16888 +uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX };
16889 +verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX);
16890 +verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0);
16891 +
16892 +#ifdef UINT_FAST64_MAX
16893 +uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX };
16894 +verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX);
16895 +verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0);
16896 +#endif
16897 +
16898 +#if INT_FAST8_MIN && INT_FAST8_MAX && INT_FAST16_MIN && INT_FAST16_MAX && INT_FAST32_MIN && INT_FAST32_MAX
16899 +/* ok */
16900 +#else
16901 +err or;
16902 +#endif
16903 +
16904 +#if UINT_FAST8_MAX && UINT_FAST16_MAX && UINT_FAST32_MAX
16905 +/* ok */
16906 +#else
16907 +err or;
16908 +#endif
16909 +
16910 +/* 7.18.1.4. Integer types capable of holding object pointers */
16911 +/* 7.18.2.4. Limits of integer types capable of holding object pointers */
16912 +
16913 +intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX };
16914 +verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN);
16915 +verify (TYPE_MAXIMUM (intptr_t) == INTPTR_MAX);
16916 +verify_same_types (INTPTR_MIN, (intptr_t) 0 + 0);
16917 +verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0);
16918 +
16919 +uintptr_t h[2] = { 17, UINTPTR_MAX };
16920 +verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX);
16921 +verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0);
16922 +
16923 +#if INTPTR_MIN && INTPTR_MAX && UINTPTR_MAX
16924 +/* ok */
16925 +#else
16926 +err or;
16927 +#endif
16928 +
16929 +/* 7.18.1.5. Greatest-width integer types */
16930 +/* 7.18.2.5. Limits of greatest-width integer types */
16931 +
16932 +intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX };
16933 +verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN);
16934 +verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX);
16935 +verify_same_types (INTMAX_MIN, (intmax_t) 0 + 0);
16936 +verify_same_types (INTMAX_MAX, (intmax_t) 0 + 0);
16937 +
16938 +uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX };
16939 +verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX);
16940 +verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0);
16941 +
16942 +/* As of 2007, Sun C and HP-UX 10.20 cc don't support 'long long' constants in
16943 +   the preprocessor.  */
16944 +#if !(defined __SUNPRO_C || (defined __hpux && !defined __GNUC__))
16945 +#if INTMAX_MIN && INTMAX_MAX && UINTMAX_MAX
16946 +/* ok */
16947 +#else
16948 +err or;
16949 +#endif
16950 +#endif
16951 +
16952 +/* 7.18.3. Limits of other integer types */
16953 +
16954 +#include <stddef.h>
16955 +
16956 +verify (TYPE_MINIMUM (ptrdiff_t) == PTRDIFF_MIN);
16957 +verify (TYPE_MAXIMUM (ptrdiff_t) == PTRDIFF_MAX);
16958 +verify_same_types (PTRDIFF_MIN, (ptrdiff_t) 0 + 0);
16959 +verify_same_types (PTRDIFF_MAX, (ptrdiff_t) 0 + 0);
16960 +
16961 +#if PTRDIFF_MIN && PTRDIFF_MAX
16962 +/* ok */
16963 +#else
16964 +err or;
16965 +#endif
16966 +
16967 +#include <signal.h>
16968 +
16969 +verify (TYPE_MINIMUM (sig_atomic_t) == SIG_ATOMIC_MIN);
16970 +verify (TYPE_MAXIMUM (sig_atomic_t) == SIG_ATOMIC_MAX);
16971 +verify_same_types (SIG_ATOMIC_MIN, (sig_atomic_t) 0 + 0);
16972 +verify_same_types (SIG_ATOMIC_MAX, (sig_atomic_t) 0 + 0);
16973 +
16974 +#if SIG_ATOMIC_MIN != 17 && SIG_ATOMIC_MAX
16975 +/* ok */
16976 +#else
16977 +err or;
16978 +#endif
16979 +
16980 +verify (TYPE_MAXIMUM (size_t) == SIZE_MAX);
16981 +verify_same_types (SIZE_MAX, (size_t) 0 + 0);
16982 +
16983 +#if SIZE_MAX
16984 +/* ok */
16985 +#else
16986 +err or;
16987 +#endif
16988 +
16989 +#if HAVE_WCHAR_T
16990 +verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN);
16991 +verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX);
16992 +verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0);
16993 +verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0);
16994 +
16995 +# if WCHAR_MIN != 17 && WCHAR_MAX
16996 +/* ok */
16997 +# else
16998 +err or;
16999 +# endif
17000 +#endif
17001 +
17002 +#if HAVE_WINT_T
17003 +# include <wchar.h>
17004 +
17005 +verify (TYPE_MINIMUM (wint_t) == WINT_MIN);
17006 +verify (TYPE_MAXIMUM (wint_t) == WINT_MAX);
17007 +verify_same_types (WINT_MIN, (wint_t) 0 + 0);
17008 +verify_same_types (WINT_MAX, (wint_t) 0 + 0);
17009 +
17010 +# if WINT_MIN != 17 && WINT_MAX
17011 +/* ok */
17012 +# else
17013 +err or;
17014 +# endif
17015 +#endif
17016 +
17017 +/* 7.18.4. Macros for integer constants */
17018 +
17019 +verify (INT8_C (17) == 17);
17020 +verify_same_types (INT8_C (17), (int_least8_t)0 + 0);
17021 +verify (UINT8_C (17) == 17);
17022 +verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0);
17023 +
17024 +verify (INT16_C (17) == 17);
17025 +verify_same_types (INT16_C (17), (int_least16_t)0 + 0);
17026 +verify (UINT16_C (17) == 17);
17027 +verify_same_types (UINT16_C (17), (uint_least16_t)0 + 0);
17028 +
17029 +verify (INT32_C (17) == 17);
17030 +verify_same_types (INT32_C (17), (int_least32_t)0 + 0);
17031 +verify (UINT32_C (17) == 17);
17032 +verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0);
17033 +
17034 +#ifdef INT64_C
17035 +verify (INT64_C (17) == 17);
17036 +verify_same_types (INT64_C (17), (int_least64_t)0 + 0);
17037 +#endif
17038 +#ifdef UINT64_C
17039 +verify (UINT64_C (17) == 17);
17040 +verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0);
17041 +#endif
17042 +
17043 +verify (INTMAX_C (17) == 17);
17044 +verify_same_types (INTMAX_C (17), (intmax_t)0 + 0);
17045 +verify (UINTMAX_C (17) == 17);
17046 +verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
17047 +
17048 +
17049 +int
17050 +main ()
17051 +{
17052 +  return 0;
17053 +}
17054 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdio.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdio.c
17055 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdio.c       1970-01-01 01:00:00.000000000 +0100
17056 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdio.c      2008-10-09 12:24:39.000000000 +0100
17057 @@ -0,0 +1,30 @@
17058 +/* Test of <stdio.h> substitute.
17059 +   Copyright (C) 2007 Free Software Foundation, Inc.
17060 +
17061 +   This program is free software: you can redistribute it and/or modify
17062 +   it under the terms of the GNU General Public License as published by
17063 +   the Free Software Foundation; either version 3 of the License, or
17064 +   (at your option) any later version.
17065 +
17066 +   This program is distributed in the hope that it will be useful,
17067 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17068 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17069 +   GNU General Public License for more details.
17070 +
17071 +   You should have received a copy of the GNU General Public License
17072 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17073 +
17074 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
17075 +
17076 +#include <config.h>
17077 +
17078 +#include <stdio.h>
17079 +
17080 +/* Check that the various SEEK_* macros are defined.  */
17081 +int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
17082 +
17083 +int
17084 +main ()
17085 +{
17086 +  return 0;
17087 +}
17088 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-sys_socket.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-sys_socket.c
17089 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-sys_socket.c  1970-01-01 01:00:00.000000000 +0100
17090 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-sys_socket.c 2008-10-09 12:24:39.000000000 +0100
17091 @@ -0,0 +1,47 @@
17092 +/* Test of <sys/socket.h> substitute.
17093 +   Copyright (C) 2007 Free Software Foundation, Inc.
17094 +
17095 +   This program is free software: you can redistribute it and/or modify
17096 +   it under the terms of the GNU General Public License as published by
17097 +   the Free Software Foundation; either version 3 of the License, or
17098 +   (at your option) any later version.
17099 +
17100 +   This program is distributed in the hope that it will be useful,
17101 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17102 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17103 +   GNU General Public License for more details.
17104 +
17105 +   You should have received a copy of the GNU General Public License
17106 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17107 +
17108 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
17109 +
17110 +#include <config.h>
17111 +
17112 +#include <sys/socket.h>
17113 +
17114 +#include <errno.h>
17115 +
17116 +#if HAVE_SHUTDOWN
17117 +/* Check some integer constant expressions.  */
17118 +int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
17119 +#endif
17120 +
17121 +int
17122 +main ()
17123 +{
17124 +  /* Check some errno values.  */
17125 +  switch (0)
17126 +    {
17127 +    case ENOTSOCK:
17128 +    case EADDRINUSE:
17129 +    case ENETRESET:
17130 +    case ECONNABORTED:
17131 +    case ECONNRESET:
17132 +    case ENOTCONN:
17133 +    case ESHUTDOWN:
17134 +      break;
17135 +    }
17136 +
17137 +  return 0;
17138 +}
17139 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-vasnprintf.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vasnprintf.c
17140 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-vasnprintf.c  1970-01-01 01:00:00.000000000 +0100
17141 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vasnprintf.c 2008-10-09 12:24:39.000000000 +0100
17142 @@ -0,0 +1,128 @@
17143 +/* Test of vasnprintf() and asnprintf() functions.
17144 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
17145 +
17146 +   This program is free software: you can redistribute it and/or modify
17147 +   it under the terms of the GNU General Public License as published by
17148 +   the Free Software Foundation; either version 3 of the License, or
17149 +   (at your option) any later version.
17150 +
17151 +   This program is distributed in the hope that it will be useful,
17152 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17153 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17154 +   GNU General Public License for more details.
17155 +
17156 +   You should have received a copy of the GNU General Public License
17157 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17158 +
17159 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
17160 +
17161 +#include <config.h>
17162 +
17163 +#include "vasnprintf.h"
17164 +
17165 +#include <stdarg.h>
17166 +#include <stdio.h>
17167 +#include <stdlib.h>
17168 +#include <string.h>
17169 +
17170 +#define ASSERT(expr) \
17171 +  do                                                                        \
17172 +    {                                                                       \
17173 +      if (!(expr))                                                          \
17174 +        {                                                                   \
17175 +          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
17176 +          fflush (stderr);                                                  \
17177 +          abort ();                                                         \
17178 +        }                                                                   \
17179 +    }                                                                       \
17180 +  while (0)
17181 +
17182 +static char *
17183 +my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
17184 +{
17185 +  va_list args;
17186 +  char *ret;
17187 +
17188 +  va_start (args, format);
17189 +  ret = vasnprintf (resultbuf, lengthp, format, args);
17190 +  va_end (args);
17191 +  return ret;
17192 +}
17193 +
17194 +static void
17195 +test_vasnprintf ()
17196 +{
17197 +  char buf[8];
17198 +  int size;
17199 +
17200 +  for (size = 0; size <= 8; size++)
17201 +    {
17202 +      size_t length = size;
17203 +      char *result = my_asnprintf (NULL, &length, "%d", 12345);
17204 +      ASSERT (result != NULL);
17205 +      ASSERT (strcmp (result, "12345") == 0);
17206 +      ASSERT (length == 5);
17207 +      free (result);
17208 +    }
17209 +
17210 +  for (size = 0; size <= 8; size++)
17211 +    {
17212 +      size_t length;
17213 +      char *result;
17214 +
17215 +      memcpy (buf, "DEADBEEF", 8);
17216 +      length = size;
17217 +      result = my_asnprintf (buf, &length, "%d", 12345);
17218 +      ASSERT (result != NULL);
17219 +      ASSERT (strcmp (result, "12345") == 0);
17220 +      ASSERT (length == 5);
17221 +      if (size < 6)
17222 +       ASSERT (result != buf);
17223 +      ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
17224 +      if (result != buf)
17225 +       free (result);
17226 +    }
17227 +}
17228 +
17229 +static void
17230 +test_asnprintf ()
17231 +{
17232 +  char buf[8];
17233 +  int size;
17234 +
17235 +  for (size = 0; size <= 8; size++)
17236 +    {
17237 +      size_t length = size;
17238 +      char *result = asnprintf (NULL, &length, "%d", 12345);
17239 +      ASSERT (result != NULL);
17240 +      ASSERT (strcmp (result, "12345") == 0);
17241 +      ASSERT (length == 5);
17242 +      free (result);
17243 +    }
17244 +
17245 +  for (size = 0; size <= 8; size++)
17246 +    {
17247 +      size_t length;
17248 +      char *result;
17249 +
17250 +      memcpy (buf, "DEADBEEF", 8);
17251 +      length = size;
17252 +      result = asnprintf (buf, &length, "%d", 12345);
17253 +      ASSERT (result != NULL);
17254 +      ASSERT (strcmp (result, "12345") == 0);
17255 +      ASSERT (length == 5);
17256 +      if (size < 6)
17257 +       ASSERT (result != buf);
17258 +      ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
17259 +      if (result != buf)
17260 +       free (result);
17261 +    }
17262 +}
17263 +
17264 +int
17265 +main (int argc, char *argv[])
17266 +{
17267 +  test_vasnprintf ();
17268 +  test_asnprintf ();
17269 +  return 0;
17270 +}
17271 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-vc-list-files-cvs.sh gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-cvs.sh
17272 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-vc-list-files-cvs.sh  1970-01-01 01:00:00.000000000 +0100
17273 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-cvs.sh 2008-10-09 12:24:39.000000000 +0100
17274 @@ -0,0 +1,62 @@
17275 +#!/bin/sh
17276 +# Unit tests for vc-list-files
17277 +# Copyright (C) 2008 Free Software Foundation, Inc.
17278 +# This file is part of the GNUlib Library.
17279 +#
17280 +# This program is free software: you can redistribute it and/or modify
17281 +# it under the terms of the GNU General Public License as published by
17282 +# the Free Software Foundation; either version 3 of the License, or
17283 +# (at your option) any later version.
17284 +#
17285 +# This program is distributed in the hope that it will be useful,
17286 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
17287 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17288 +# GNU General Public License for more details.
17289 +#
17290 +# You should have received a copy of the GNU General Public License
17291 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17292 +
17293 +tmpdir=vc-cvs-$$
17294 +trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0
17295 +trap '(exit $?); exit $?' 1 2 13 15
17296 +
17297 +if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
17298 +  compare() { diff -u "$@"; }
17299 +elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
17300 +  compare() { cmp -s "$@"; }
17301 +else
17302 +  compare() { cmp "$@"; }
17303 +fi
17304 +
17305 +repo=`pwd`/$tmpdir/repo
17306 +
17307 +fail=0
17308 +for i in with-cvsu without; do
17309 +  # On the first iteration, test using cvsu, if it's in your path.
17310 +  # On the second iteration, ensure that cvsu fails, so we'll
17311 +  # exercise the awk-using code.
17312 +  if test $i = without; then
17313 +    printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu
17314 +    chmod a+x cvsu
17315 +    PATH=`pwd`:$PATH
17316 +    export PATH
17317 +  fi
17318 +  ok=0
17319 +  mkdir $tmpdir && cd $tmpdir &&
17320 +    # without cvs, skip the test
17321 +    # The double use of 'exit' is needed for the reference to $? inside the trap.
17322 +    { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \
17323 +      || { echo "Skipping test: cvs not found in PATH"; (exit 77); exit 77; }; } &&
17324 +    mkdir w && cd w &&
17325 +    mkdir d &&
17326 +    touch d/a b c &&
17327 +    cvs -Q -d "$repo" import -m imp m M M0 &&
17328 +    cvs -Q -d "$repo" co m && cd m &&
17329 +    printf '%s\n' b c d/a > expected &&
17330 +    vc-list-files | sort > actual &&
17331 +    compare expected actual &&
17332 +    ok=1
17333 +  test $ok = 0 && fail=1
17334 +done
17335 +
17336 +(exit $fail); exit $fail
17337 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-vc-list-files-git.sh gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-git.sh
17338 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-vc-list-files-git.sh  1970-01-01 01:00:00.000000000 +0100
17339 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-git.sh 2008-10-09 12:24:39.000000000 +0100
17340 @@ -0,0 +1,46 @@
17341 +#!/bin/sh
17342 +# Unit tests for vc-list-files
17343 +# Copyright (C) 2008 Free Software Foundation, Inc.
17344 +# This file is part of the GNUlib Library.
17345 +#
17346 +# This program is free software: you can redistribute it and/or modify
17347 +# it under the terms of the GNU General Public License as published by
17348 +# the Free Software Foundation; either version 3 of the License, or
17349 +# (at your option) any later version.
17350 +#
17351 +# This program is distributed in the hope that it will be useful,
17352 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
17353 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17354 +# GNU General Public License for more details.
17355 +#
17356 +# You should have received a copy of the GNU General Public License
17357 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17358 +
17359 +if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
17360 +  compare() { diff -u "$@"; }
17361 +elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
17362 +  compare() { cmp -s "$@"; }
17363 +else
17364 +  compare() { cmp "$@"; }
17365 +fi
17366 +
17367 +tmpdir=vc-git-$$
17368 +trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0
17369 +trap '(exit $?); exit $?' 1 2 13 15
17370 +
17371 +fail=1
17372 +mkdir $tmpdir && cd $tmpdir &&
17373 +  # without git, skip the test
17374 +  # The double use of 'exit' is needed for the reference to $? inside the trap.
17375 +  { ( git init -q ) > /dev/null 2>&1 \
17376 +    || { echo "Skipping test: git not found in PATH"; (exit 77); exit 77; }; } &&
17377 +  mkdir d &&
17378 +  touch d/a b c &&
17379 +  git add . > /dev/null &&
17380 +  git commit -q -a -m log &&
17381 +  printf '%s\n' b c d/a > expected &&
17382 +  vc-list-files > actual &&
17383 +  compare expected actual &&
17384 +  fail=0
17385 +
17386 +(exit $fail); exit $fail
17387 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-wchar.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-wchar.c
17388 --- gtk-vnc-0.3.7.mingw/gnulib/tests/test-wchar.c       1970-01-01 01:00:00.000000000 +0100
17389 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-wchar.c      2008-10-09 12:24:39.000000000 +0100
17390 @@ -0,0 +1,31 @@
17391 +/* Test of <wchar.h> substitute.
17392 +   Copyright (C) 2007-2008 Free Software Foundation, Inc.
17393 +
17394 +   This program is free software: you can redistribute it and/or modify
17395 +   it under the terms of the GNU General Public License as published by
17396 +   the Free Software Foundation; either version 3 of the License, or
17397 +   (at your option) any later version.
17398 +
17399 +   This program is distributed in the hope that it will be useful,
17400 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17401 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17402 +   GNU General Public License for more details.
17403 +
17404 +   You should have received a copy of the GNU General Public License
17405 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17406 +
17407 +/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
17408 +
17409 +#include <config.h>
17410 +
17411 +#include <wchar.h>
17412 +
17413 +/* Check that the types wchar_t and wint_t are defined.  */
17414 +wchar_t a = 'c';
17415 +wint_t b = 'x';
17416 +
17417 +int
17418 +main ()
17419 +{
17420 +  return 0;
17421 +}
17422 diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/verify.h gtk-vnc-0.3.7.gnulib/gnulib/tests/verify.h
17423 --- gtk-vnc-0.3.7.mingw/gnulib/tests/verify.h   1970-01-01 01:00:00.000000000 +0100
17424 +++ gtk-vnc-0.3.7.gnulib/gnulib/tests/verify.h  2008-10-09 12:24:39.000000000 +0100
17425 @@ -0,0 +1,140 @@
17426 +/* Compile-time assert-like macros.
17427 +
17428 +   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
17429 +
17430 +   This program is free software: you can redistribute it and/or modify
17431 +   it under the terms of the GNU General Public License as published by
17432 +   the Free Software Foundation; either version 3 of the License, or
17433 +   (at your option) any later version.
17434 +
17435 +   This program is distributed in the hope that it will be useful,
17436 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
17437 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17438 +   GNU General Public License for more details.
17439 +
17440 +   You should have received a copy of the GNU General Public License
17441 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17442 +
17443 +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
17444 +
17445 +#ifndef VERIFY_H
17446 +# define VERIFY_H 1
17447 +
17448 +/* Each of these macros verifies that its argument R is nonzero.  To
17449 +   be portable, R should be an integer constant expression.  Unlike
17450 +   assert (R), there is no run-time overhead.
17451 +
17452 +   There are two macros, since no single macro can be used in all
17453 +   contexts in C.  verify_true (R) is for scalar contexts, including
17454 +   integer constant expression contexts.  verify (R) is for declaration
17455 +   contexts, e.g., the top level.
17456 +
17457 +   Symbols ending in "__" are private to this header.
17458 +
17459 +   The code below uses several ideas.
17460 +
17461 +   * The first step is ((R) ? 1 : -1).  Given an expression R, of
17462 +     integral or boolean or floating-point type, this yields an
17463 +     expression of integral type, whose value is later verified to be
17464 +     constant and nonnegative.
17465 +
17466 +   * Next this expression W is wrapped in a type
17467 +     struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }.
17468 +     If W is negative, this yields a compile-time error.  No compiler can
17469 +     deal with a bit-field of negative size.
17470 +
17471 +     One might think that an array size check would have the same
17472 +     effect, that is, that the type struct { unsigned int dummy[W]; }
17473 +     would work as well.  However, inside a function, some compilers
17474 +     (such as C++ compilers and GNU C) allow local parameters and
17475 +     variables inside array size expressions.  With these compilers,
17476 +     an array size check would not properly diagnose this misuse of
17477 +     the verify macro:
17478 +
17479 +       void function (int n) { verify (n < 0); }
17480 +
17481 +   * For the verify macro, the struct verify_type__ will need to
17482 +     somehow be embedded into a declaration.  To be portable, this
17483 +     declaration must declare an object, a constant, a function, or a
17484 +     typedef name.  If the declared entity uses the type directly,
17485 +     such as in
17486 +
17487 +       struct dummy {...};
17488 +       typedef struct {...} dummy;
17489 +       extern struct {...} *dummy;
17490 +       extern void dummy (struct {...} *);
17491 +       extern struct {...} *dummy (void);
17492 +
17493 +     two uses of the verify macro would yield colliding declarations
17494 +     if the entity names are not disambiguated.  A workaround is to
17495 +     attach the current line number to the entity name:
17496 +
17497 +       #define GL_CONCAT0(x, y) x##y
17498 +       #define GL_CONCAT(x, y) GL_CONCAT0 (x, y)
17499 +       extern struct {...} * GL_CONCAT(dummy,__LINE__);
17500 +
17501 +     But this has the problem that two invocations of verify from
17502 +     within the same macro would collide, since the __LINE__ value
17503 +     would be the same for both invocations.
17504 +
17505 +     A solution is to use the sizeof operator.  It yields a number,
17506 +     getting rid of the identity of the type.  Declarations like
17507 +
17508 +       extern int dummy [sizeof (struct {...})];
17509 +       extern void dummy (int [sizeof (struct {...})]);
17510 +       extern int (*dummy (void)) [sizeof (struct {...})];
17511 +
17512 +     can be repeated.
17513 +
17514 +   * Should the implementation use a named struct or an unnamed struct?
17515 +     Which of the following alternatives can be used?
17516 +
17517 +       extern int dummy [sizeof (struct {...})];
17518 +       extern int dummy [sizeof (struct verify_type__ {...})];
17519 +       extern void dummy (int [sizeof (struct {...})]);
17520 +       extern void dummy (int [sizeof (struct verify_type__ {...})]);
17521 +       extern int (*dummy (void)) [sizeof (struct {...})];
17522 +       extern int (*dummy (void)) [sizeof (struct verify_type__ {...})];
17523 +
17524 +     In the second and sixth case, the struct type is exported to the
17525 +     outer scope; two such declarations therefore collide.  GCC warns
17526 +     about the first, third, and fourth cases.  So the only remaining
17527 +     possibility is the fifth case:
17528 +
17529 +       extern int (*dummy (void)) [sizeof (struct {...})];
17530 +
17531 +   * This implementation exploits the fact that GCC does not warn about
17532 +     the last declaration mentioned above.  If a future version of GCC
17533 +     introduces a warning for this, the problem could be worked around
17534 +     by using code specialized to GCC, e.g.,:
17535 +
17536 +       #if 4 <= __GNUC__
17537 +       # define verify(R) \
17538 +          extern int (* verify_function__ (void)) \
17539 +                     [__builtin_constant_p (R) && (R) ? 1 : -1]
17540 +       #endif
17541 +
17542 +   * In C++, any struct definition inside sizeof is invalid.
17543 +     Use a template type to work around the problem.  */
17544 +
17545 +
17546 +/* Verify requirement R at compile-time, as an integer constant expression.
17547 +   Return 1.  */
17548 +
17549 +# ifdef __cplusplus
17550 +template <int w>
17551 +  struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
17552 +#  define verify_true(R) \
17553 +     (!!sizeof (verify_type__<(R) ? 1 : -1>))
17554 +# else
17555 +#  define verify_true(R) \
17556 +     (!!sizeof \
17557 +      (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
17558 +# endif
17559 +
17560 +/* Verify requirement R at compile-time, as a declaration without a
17561 +   trailing ';'.  */
17562 +
17563 +# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)]
17564 +
17565 +#endif
17566 diff -urN gtk-vnc-0.3.7.mingw/link-warning.h gtk-vnc-0.3.7.gnulib/link-warning.h
17567 --- gtk-vnc-0.3.7.mingw/link-warning.h  1970-01-01 01:00:00.000000000 +0100
17568 +++ gtk-vnc-0.3.7.gnulib/link-warning.h 2008-10-09 12:24:39.000000000 +0100
17569 @@ -0,0 +1,28 @@
17570 +/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
17571 +   a linker warning on most glibc systems.
17572 +   We use a linker warning rather than a preprocessor warning, because
17573 +   #warning cannot be used inside macros.  */
17574 +#ifndef GL_LINK_WARNING
17575 +  /* This works on platforms with GNU ld and ELF object format.
17576 +     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
17577 +     Testing __ELF__ guarantees the ELF object format.
17578 +     Testing __GNUC__ is necessary for the compound expression syntax.  */
17579 +# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
17580 +#  define GL_LINK_WARNING(message) \
17581 +     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
17582 +#  define GL_LINK_WARNING1(file, line, message) \
17583 +     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
17584 +#  define GL_LINK_WARNING2(file, line, message) \
17585 +     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
17586 +#  define GL_LINK_WARNING3(message) \
17587 +     ({ static const char warning[sizeof (message)]            \
17588 +          __attribute__ ((__unused__,                          \
17589 +                          __section__ (".gnu.warning"),                \
17590 +                          __aligned__ (1)))                    \
17591 +          = message "\n";                                      \
17592 +        (void)0;                                               \
17593 +     })
17594 +# else
17595 +#  define GL_LINK_WARNING(message) ((void) 0)
17596 +# endif
17597 +#endif