diff --git a/packages/mediacenter/xbmc/build b/packages/mediacenter/xbmc/build index 64b233ce3e..0b2b41e2d2 100755 --- a/packages/mediacenter/xbmc/build +++ b/packages/mediacenter/xbmc/build @@ -257,6 +257,7 @@ cd $PKG_BUILD # autoreconf BOOTSTRAP_STANDALONE=1 make -f bootstrap.mk +export gl_cv_func_gettimeofday_clobber=no ./configure --host=$TARGET_NAME \ --build=$HOST_NAME \ --with-arch=$TARGET_ARCH \ diff --git a/packages/mediacenter/xbmc/patches/74fa128/xbmc-999.07-PR2572.patch b/packages/mediacenter/xbmc/patches/74fa128/xbmc-999.07-PR2572.patch new file mode 100644 index 0000000000..215bf2ecc3 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/74fa128/xbmc-999.07-PR2572.patch @@ -0,0 +1,45663 @@ +From 3b4fe28467d1beaa0ca572c40204c46652c96dde Mon Sep 17 00:00:00 2001 +From: t-nelson +Date: Mon, 8 Apr 2013 23:35:09 -0400 +Subject: [PATCH 1/3] Call AC_COMPILE_IFELSE correctly in RSXS m4 script + +This silences the last block of warnings in RSXS bootstrap. Newer gnulib +enforces calling AC_COMPILE_IFELSE with the AC_LANG_SOURCE macro wrapping +the source to be compiled. See (1). + +(1) http://lists.gnu.org/archive/html/bug-autoconf/2010-09/msg00091.html +--- + xbmc/screensavers/rsxs-0.9/acinclude.m4 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xbmc/screensavers/rsxs-0.9/acinclude.m4 b/xbmc/screensavers/rsxs-0.9/acinclude.m4 +index 013ac77..e6874b5 100644 +--- a/xbmc/screensavers/rsxs-0.9/acinclude.m4 ++++ b/xbmc/screensavers/rsxs-0.9/acinclude.m4 +@@ -516,12 +516,12 @@ AC_DEFUN([MAC_PKG_PNG], [ + AC_CACHE_CHECK( + [whether libpng supports setjmp], + mac_cv_libpng_supports_setjmp, [ +- AC_COMPILE_IFELSE([ ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + @%:@include + @%:@if !defined PNG_SETJMP_SUPPORTED + @%:@error PNG_SETJMP_SUPPORTED not defined + @%:@endif +- ], [mac_cv_libpng_supports_setjmp=yes], [mac_cv_libpng_supports_setjmp=no] ++ ])], [mac_cv_libpng_supports_setjmp=yes], [mac_cv_libpng_supports_setjmp=no] + ) + ] + ) +-- +1.8.1.5 + + +From 95dc49a17f7db5436e02cdb55495080deecf4a13 Mon Sep 17 00:00:00 2001 +From: t-nelson +Date: Tue, 9 Apr 2013 13:36:23 -0400 +Subject: [PATCH 2/3] Update RSXS gnulib m4 macros + +This fixes a large body of warnings due to dependency order changes +with newer gnulib. See (1). + +(1) +http://lists.gnu.org/archive/html/bug-autoconf/2007-10/msg00017.html +--- + xbmc/screensavers/rsxs-0.9/Makefile.am | 2 +- + xbmc/screensavers/rsxs-0.9/lib/Makefile.am | 1263 +++- + xbmc/screensavers/rsxs-0.9/lib/alloca.c | 177 +- + xbmc/screensavers/rsxs-0.9/lib/alloca.in.h | 56 + + xbmc/screensavers/rsxs-0.9/lib/arg-nonnull.h | 10 + + xbmc/screensavers/rsxs-0.9/lib/argp-ba.c | 25 +- + xbmc/screensavers/rsxs-0.9/lib/argp-eexst.c | 13 +- + xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.c | 452 +- + xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.h | 141 +- + xbmc/screensavers/rsxs-0.9/lib/argp-fs-xinl.c | 13 +- + xbmc/screensavers/rsxs-0.9/lib/argp-help.c | 1324 +++-- + xbmc/screensavers/rsxs-0.9/lib/argp-namefrob.h | 62 +- + xbmc/screensavers/rsxs-0.9/lib/argp-parse.c | 511 +- + xbmc/screensavers/rsxs-0.9/lib/argp-pin.c | 13 +- + xbmc/screensavers/rsxs-0.9/lib/argp-pv.c | 26 +- + xbmc/screensavers/rsxs-0.9/lib/argp-pvh.c | 14 +- + xbmc/screensavers/rsxs-0.9/lib/argp-xinl.c | 15 +- + xbmc/screensavers/rsxs-0.9/lib/argp.h | 236 +- + xbmc/screensavers/rsxs-0.9/lib/argz.c | 489 +- + xbmc/screensavers/rsxs-0.9/lib/argz.in.h | 160 + + xbmc/screensavers/rsxs-0.9/lib/asnprintf.c | 8 +- + xbmc/screensavers/rsxs-0.9/lib/basename-lgpl.c | 75 + + xbmc/screensavers/rsxs-0.9/lib/c++defs.h | 255 + + xbmc/screensavers/rsxs-0.9/lib/dirname-lgpl.c | 86 + + xbmc/screensavers/rsxs-0.9/lib/dirname.h | 54 +- + xbmc/screensavers/rsxs-0.9/lib/dosname.h | 53 + + xbmc/screensavers/rsxs-0.9/lib/errno.in.h | 233 + + xbmc/screensavers/rsxs-0.9/lib/float+.h | 148 + + xbmc/screensavers/rsxs-0.9/lib/float.c | 33 + + xbmc/screensavers/rsxs-0.9/lib/float.in.h | 188 + + xbmc/screensavers/rsxs-0.9/lib/getopt.c | 1366 +++-- + xbmc/screensavers/rsxs-0.9/lib/getopt.in.h | 253 + + xbmc/screensavers/rsxs-0.9/lib/getopt1.c | 158 +- + xbmc/screensavers/rsxs-0.9/lib/getopt_int.h | 120 +- + xbmc/screensavers/rsxs-0.9/lib/gettext.h | 228 +- + xbmc/screensavers/rsxs-0.9/lib/gettimeofday.c | 145 +- + xbmc/screensavers/rsxs-0.9/lib/intprops.h | 319 + + xbmc/screensavers/rsxs-0.9/lib/itold.c | 28 + + xbmc/screensavers/rsxs-0.9/lib/malloc.c | 57 + + xbmc/screensavers/rsxs-0.9/lib/memchr.c | 223 +- + xbmc/screensavers/rsxs-0.9/lib/memchr.valgrind | 14 + + xbmc/screensavers/rsxs-0.9/lib/mempcpy.c | 8 +- + xbmc/screensavers/rsxs-0.9/lib/printf-args.c | 203 +- + xbmc/screensavers/rsxs-0.9/lib/printf-args.h | 101 +- + xbmc/screensavers/rsxs-0.9/lib/printf-parse.c | 1007 ++-- + xbmc/screensavers/rsxs-0.9/lib/printf-parse.h | 146 +- + xbmc/screensavers/rsxs-0.9/lib/rawmemchr.c | 136 + + xbmc/screensavers/rsxs-0.9/lib/rawmemchr.valgrind | 12 + + xbmc/screensavers/rsxs-0.9/lib/size_max.h | 4 +- + xbmc/screensavers/rsxs-0.9/lib/sleep.c | 76 + + xbmc/screensavers/rsxs-0.9/lib/stdalign.h | 90 + + xbmc/screensavers/rsxs-0.9/lib/stdalign.in.h | 89 + + xbmc/screensavers/rsxs-0.9/lib/stdbool.in.h | 122 + + xbmc/screensavers/rsxs-0.9/lib/stddef.in.h | 87 + + xbmc/screensavers/rsxs-0.9/lib/stdint.in.h | 606 ++ + xbmc/screensavers/rsxs-0.9/lib/stdio.h | 1662 ++++++ + xbmc/screensavers/rsxs-0.9/lib/stdio.in.h | 1350 +++++ + xbmc/screensavers/rsxs-0.9/lib/stdlib.h | 1126 ++++ + xbmc/screensavers/rsxs-0.9/lib/stdlib.in.h | 804 +++ + xbmc/screensavers/rsxs-0.9/lib/stpcpy.c | 49 + + xbmc/screensavers/rsxs-0.9/lib/str-two-way.h | 453 ++ + xbmc/screensavers/rsxs-0.9/lib/strcasecmp.c | 94 +- + xbmc/screensavers/rsxs-0.9/lib/strchrnul.c | 134 +- + xbmc/screensavers/rsxs-0.9/lib/strchrnul.valgrind | 12 + + xbmc/screensavers/rsxs-0.9/lib/strerror-override.c | 289 + + xbmc/screensavers/rsxs-0.9/lib/strerror-override.h | 52 + + xbmc/screensavers/rsxs-0.9/lib/strerror.c | 70 + + xbmc/screensavers/rsxs-0.9/lib/string.h | 1323 +++++ + xbmc/screensavers/rsxs-0.9/lib/string.in.h | 1011 ++++ + xbmc/screensavers/rsxs-0.9/lib/strings.h | 435 ++ + xbmc/screensavers/rsxs-0.9/lib/strings.in.h | 123 + + xbmc/screensavers/rsxs-0.9/lib/stripslash.c | 16 +- + xbmc/screensavers/rsxs-0.9/lib/strncasecmp.c | 20 +- + xbmc/screensavers/rsxs-0.9/lib/strndup.c | 45 +- + xbmc/screensavers/rsxs-0.9/lib/strnlen.c | 10 +- + xbmc/screensavers/rsxs-0.9/lib/strstr.c | 83 + + xbmc/screensavers/rsxs-0.9/lib/sys/time.h | 512 ++ + xbmc/screensavers/rsxs-0.9/lib/sys/types.h | 41 + + xbmc/screensavers/rsxs-0.9/lib/sys_time.in.h | 200 + + xbmc/screensavers/rsxs-0.9/lib/sys_types.in.h | 40 + + xbmc/screensavers/rsxs-0.9/lib/sysexits.in.h | 72 + + xbmc/screensavers/rsxs-0.9/lib/unistd.h | 1783 ++++++ + xbmc/screensavers/rsxs-0.9/lib/unistd.in.h | 1471 +++++ + xbmc/screensavers/rsxs-0.9/lib/vasnprintf.c | 6276 +++++++++++++++++--- + xbmc/screensavers/rsxs-0.9/lib/vasnprintf.h | 37 +- + xbmc/screensavers/rsxs-0.9/lib/verify.h | 243 + + xbmc/screensavers/rsxs-0.9/lib/vsnprintf.c | 37 +- + xbmc/screensavers/rsxs-0.9/lib/warn-on-use.h | 46 + + xbmc/screensavers/rsxs-0.9/lib/wchar.h | 1318 ++++ + xbmc/screensavers/rsxs-0.9/lib/wchar.in.h | 1006 ++++ + xbmc/screensavers/rsxs-0.9/lib/xsize.h | 6 +- + xbmc/screensavers/rsxs-0.9/m4/00gnulib.m4 | 30 + + xbmc/screensavers/rsxs-0.9/m4/alloca.m4 | 115 +- + xbmc/screensavers/rsxs-0.9/m4/argp.m4 | 54 +- + xbmc/screensavers/rsxs-0.9/m4/argz.m4 | 60 +- + xbmc/screensavers/rsxs-0.9/m4/dirname.m4 | 14 +- + xbmc/screensavers/rsxs-0.9/m4/double-slash-root.m4 | 57 +- + xbmc/screensavers/rsxs-0.9/m4/errno_h.m4 | 125 + + xbmc/screensavers/rsxs-0.9/m4/exponentd.m4 | 115 + + xbmc/screensavers/rsxs-0.9/m4/extensions.m4 | 115 +- + xbmc/screensavers/rsxs-0.9/m4/float_h.m4 | 98 + + xbmc/screensavers/rsxs-0.9/m4/getopt.m4 | 362 +- + xbmc/screensavers/rsxs-0.9/m4/gettimeofday.m4 | 153 +- + xbmc/screensavers/rsxs-0.9/m4/gnulib-cache.m4 | 50 + + xbmc/screensavers/rsxs-0.9/m4/gnulib-common.m4 | 372 ++ + xbmc/screensavers/rsxs-0.9/m4/gnulib-comp.m4 | 536 +- + xbmc/screensavers/rsxs-0.9/m4/gnulib-tool.m4 | 57 + + xbmc/screensavers/rsxs-0.9/m4/include_next.m4 | 270 + + xbmc/screensavers/rsxs-0.9/m4/intmax_t.m4 | 34 +- + xbmc/screensavers/rsxs-0.9/m4/inttypes_h.m4 | 23 +- + xbmc/screensavers/rsxs-0.9/m4/longlong.m4 | 119 +- + xbmc/screensavers/rsxs-0.9/m4/malloc.m4 | 60 + + xbmc/screensavers/rsxs-0.9/m4/math_h.m4 | 243 + + xbmc/screensavers/rsxs-0.9/m4/memchr.m4 | 84 +- + xbmc/screensavers/rsxs-0.9/m4/mempcpy.m4 | 17 +- + xbmc/screensavers/rsxs-0.9/m4/mmap-anon.m4 | 55 + + xbmc/screensavers/rsxs-0.9/m4/multiarch.m4 | 62 + + xbmc/screensavers/rsxs-0.9/m4/nocrash.m4 | 130 + + xbmc/screensavers/rsxs-0.9/m4/onceonly.m4 | 104 + + xbmc/screensavers/rsxs-0.9/m4/printf.m4 | 1569 +++++ + xbmc/screensavers/rsxs-0.9/m4/rawmemchr.m4 | 20 + + xbmc/screensavers/rsxs-0.9/m4/size_max.m4 | 95 +- + xbmc/screensavers/rsxs-0.9/m4/sleep.m4 | 52 + + xbmc/screensavers/rsxs-0.9/m4/ssize_t.m4 | 23 + + xbmc/screensavers/rsxs-0.9/m4/stdalign.m4 | 37 + + xbmc/screensavers/rsxs-0.9/m4/stdbool.m4 | 141 +- + xbmc/screensavers/rsxs-0.9/m4/stddef_h.m4 | 47 + + xbmc/screensavers/rsxs-0.9/m4/stdint.m4 | 488 ++ + xbmc/screensavers/rsxs-0.9/m4/stdint_h.m4 | 21 +- + xbmc/screensavers/rsxs-0.9/m4/stdio_h.m4 | 195 + + xbmc/screensavers/rsxs-0.9/m4/stdlib_h.m4 | 110 + + xbmc/screensavers/rsxs-0.9/m4/stpcpy.m4 | 25 + + xbmc/screensavers/rsxs-0.9/m4/strcase.m4 | 28 +- + xbmc/screensavers/rsxs-0.9/m4/strchrnul.m4 | 41 +- + xbmc/screensavers/rsxs-0.9/m4/strerror.m4 | 78 + + xbmc/screensavers/rsxs-0.9/m4/string_h.m4 | 120 + + xbmc/screensavers/rsxs-0.9/m4/strings_h.m4 | 52 + + xbmc/screensavers/rsxs-0.9/m4/strndup.m4 | 69 +- + xbmc/screensavers/rsxs-0.9/m4/strnlen.m4 | 33 +- + xbmc/screensavers/rsxs-0.9/m4/strstr.m4 | 124 + + xbmc/screensavers/rsxs-0.9/m4/sys_socket_h.m4 | 177 + + xbmc/screensavers/rsxs-0.9/m4/sys_time_h.m4 | 78 + + xbmc/screensavers/rsxs-0.9/m4/sys_types_h.m4 | 21 + + xbmc/screensavers/rsxs-0.9/m4/sysexits.m4 | 41 +- + xbmc/screensavers/rsxs-0.9/m4/unistd_h.m4 | 181 +- + xbmc/screensavers/rsxs-0.9/m4/vasnprintf.m4 | 276 +- + xbmc/screensavers/rsxs-0.9/m4/vsnprintf.m4 | 47 +- + xbmc/screensavers/rsxs-0.9/m4/warn-on-use.m4 | 47 + + xbmc/screensavers/rsxs-0.9/m4/wchar_h.m4 | 225 + + xbmc/screensavers/rsxs-0.9/m4/wchar_t.m4 | 18 +- + xbmc/screensavers/rsxs-0.9/m4/wint_t.m4 | 26 +- + xbmc/screensavers/rsxs-0.9/m4/xsize.m4 | 6 +- + xbmc/screensavers/rsxs-0.9/snippet/_Noreturn.h | 10 + + xbmc/screensavers/rsxs-0.9/snippet/arg-nonnull.h | 26 + + xbmc/screensavers/rsxs-0.9/snippet/c++defs.h | 271 + + xbmc/screensavers/rsxs-0.9/snippet/warn-on-use.h | 109 + + 156 files changed, 37543 insertions(+), 4880 deletions(-) + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/alloca.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/arg-nonnull.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/argz.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/basename-lgpl.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/c++defs.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/dirname-lgpl.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/dosname.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/errno.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/float+.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/float.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/float.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/getopt.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/intprops.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/itold.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/malloc.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/memchr.valgrind + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/rawmemchr.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/rawmemchr.valgrind + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/sleep.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/stdalign.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/stdalign.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/stdbool.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/stddef.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/stdint.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/stdio.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/stdio.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/stdlib.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/stdlib.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/stpcpy.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/str-two-way.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/strchrnul.valgrind + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/strerror-override.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/strerror-override.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/strerror.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/string.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/string.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/strings.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/strings.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/strstr.c + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/sys/time.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/sys/types.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/sys_time.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/sys_types.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/sysexits.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/unistd.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/unistd.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/verify.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/warn-on-use.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/wchar.h + create mode 100644 xbmc/screensavers/rsxs-0.9/lib/wchar.in.h + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/00gnulib.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/errno_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/exponentd.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/float_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/gnulib-cache.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/gnulib-common.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/gnulib-tool.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/include_next.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/malloc.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/math_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/mmap-anon.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/multiarch.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/nocrash.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/onceonly.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/printf.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/rawmemchr.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/sleep.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/ssize_t.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/stdalign.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/stddef_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/stdint.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/stdio_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/stdlib_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/stpcpy.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/strerror.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/string_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/strings_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/strstr.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/sys_socket_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/sys_time_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/sys_types_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/warn-on-use.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/m4/wchar_h.m4 + create mode 100644 xbmc/screensavers/rsxs-0.9/snippet/_Noreturn.h + create mode 100644 xbmc/screensavers/rsxs-0.9/snippet/arg-nonnull.h + create mode 100644 xbmc/screensavers/rsxs-0.9/snippet/c++defs.h + create mode 100644 xbmc/screensavers/rsxs-0.9/snippet/warn-on-use.h + +diff --git a/xbmc/screensavers/rsxs-0.9/Makefile.am b/xbmc/screensavers/rsxs-0.9/Makefile.am +index ace2169..a862919 100644 +--- a/xbmc/screensavers/rsxs-0.9/Makefile.am ++++ b/xbmc/screensavers/rsxs-0.9/Makefile.am +@@ -1,7 +1,7 @@ + ## Process this file with automake to produce Makefile.in + + SUBDIRS = lib libltdl src config +-EXTRA_DIST = scripts THANKS ++EXTRA_DIST = scripts THANKS m4/gnulib-cache.m4 + DISTCHECK_CONFIGURE_FLAGS = --without-xscreensaver + ACLOCAL_AMFLAGS = -I m4 + +diff --git a/xbmc/screensavers/rsxs-0.9/lib/Makefile.am b/xbmc/screensavers/rsxs-0.9/lib/Makefile.am +index 4335323..9a6a5ff 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/Makefile.am ++++ b/xbmc/screensavers/rsxs-0.9/lib/Makefile.am +@@ -1,51 +1,85 @@ ++## DO NOT EDIT! GENERATED AUTOMATICALLY! + ## Process this file with automake to produce Makefile.in. +-# Copyright (C) 2004-2006 Free Software Foundation, Inc. ++# Copyright (C) 2002-2011 Free Software Foundation, Inc. + # +-# This file is free software, distributed under the terms of the GNU +-# General Public License. As a special exception to the GNU General +-# Public License, this file may be distributed as part of a program +-# that contains a configuration script generated by Autoconf, under ++# This file is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This file is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this file. If not, see . ++# ++# As a special exception to the GNU General Public License, ++# this file may be distributed as part of a program that ++# contains a configuration script generated by Autoconf, under + # the same distribution terms as the rest of that program. + # + # Generated by gnulib-tool. +-# Reproduce by: gnulib-tool --import --dir=. --lib=libmisc --source-base=lib --m4-base=m4 --aux-dir=. --macro-prefix=gl argp argz gettimeofday unistd +- +-AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies ++# Reproduce by: gnulib-tool --import --dir=. --lib=libmisc --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl argp argz gettimeofday unistd + +-noinst_LIBRARIES = libmisc.a ++AUTOMAKE_OPTIONS = 1.5 gnits + +-libmisc_a_SOURCES = +-libmisc_a_LIBADD = @LIBOBJS@ ++SUBDIRS = + noinst_HEADERS = ++noinst_LIBRARIES = ++noinst_LTLIBRARIES = + EXTRA_DIST = + BUILT_SOURCES = + SUFFIXES = +-MOSTLYCLEANFILES = ++MOSTLYCLEANFILES = core *.stackdump + MOSTLYCLEANDIRS = + CLEANFILES = + DISTCLEANFILES = + MAINTAINERCLEANFILES = + + AM_CPPFLAGS = ++AM_CFLAGS = ++ ++noinst_LIBRARIES += libmisc.a ++ ++libmisc_a_SOURCES = ++libmisc_a_LIBADD = $(gl_LIBOBJS) ++libmisc_a_DEPENDENCIES = $(gl_LIBOBJS) ++EXTRA_libmisc_a_SOURCES = + + ## begin gnulib module alloca + + + libmisc_a_LIBADD += @ALLOCA@ ++libmisc_a_DEPENDENCIES += @ALLOCA@ ++EXTRA_DIST += alloca.c ++ ++EXTRA_libmisc_a_SOURCES += alloca.c ++ + ## end gnulib module alloca + + ## begin gnulib module alloca-opt + + BUILT_SOURCES += $(ALLOCA_H) +-EXTRA_DIST += alloca_.h + + # We need the following in order to create when the system + # doesn't have one that works with the given compiler. +-alloca.h: alloca_.h +- cp $(srcdir)/alloca_.h $@-t +- mv $@-t $@ ++if GL_GENERATE_ALLOCA_H ++alloca.h: alloca.in.h $(top_builddir)/config.status ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ cat $(srcdir)/alloca.in.h; \ ++ } > $@-t && \ ++ mv -f $@-t $@ ++else ++alloca.h: $(top_builddir)/config.status ++ rm -f $@ ++endif + MOSTLYCLEANFILES += alloca.h alloca.h-t + ++EXTRA_DIST += alloca.in.h ++ + ## end gnulib module alloca-opt + + ## begin gnulib module argp +@@ -60,42 +94,134 @@ libmisc_a_SOURCES += argp.h argp-ba.c argp-eexst.c \ + ## begin gnulib module argz + + BUILT_SOURCES += $(ARGZ_H) +-EXTRA_DIST += argz_.h + + # We need the following in order to create when the system + # doesn't have one that works with the given compiler. +-argz.h: argz_.h +- cp $(srcdir)/argz_.h $@-t +- mv $@-t $@ ++if GL_GENERATE_ARGZ_H ++argz.h: argz.in.h $(top_builddir)/config.status ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ cat $(srcdir)/argz.in.h; \ ++ } > $@-t && \ ++ mv -f $@-t $@ ++else ++argz.h: $(top_builddir)/config.status ++ rm -f $@ ++endif + MOSTLYCLEANFILES += argz.h argz.h-t + ++EXTRA_DIST += argz.c argz.in.h ++ ++EXTRA_libmisc_a_SOURCES += argz.c ++ + ## end gnulib module argz + +-## begin gnulib module dirname ++## begin gnulib module dirname-lgpl ++ ++libmisc_a_SOURCES += dirname-lgpl.c basename-lgpl.c stripslash.c ++ ++EXTRA_DIST += dirname.h + +-libmisc_a_SOURCES += basename.c stripslash.c ++## end gnulib module dirname-lgpl + +-## end gnulib module dirname ++## begin gnulib module dosname + +-## begin gnulib module exit + +-libmisc_a_SOURCES += exit.h ++EXTRA_DIST += dosname.h + +-## end gnulib module exit ++## end gnulib module dosname + +-## begin gnulib module getopt ++## begin gnulib module errno ++ ++BUILT_SOURCES += $(ERRNO_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that is POSIX compliant. ++if GL_GENERATE_ERRNO_H ++errno.h: errno.in.h $(top_builddir)/config.status ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ ++ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ ++ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ ++ -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ ++ -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ ++ -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ ++ -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ ++ < $(srcdir)/errno.in.h; \ ++ } > $@-t && \ ++ mv $@-t $@ ++else ++errno.h: $(top_builddir)/config.status ++ rm -f $@ ++endif ++MOSTLYCLEANFILES += errno.h errno.h-t ++ ++EXTRA_DIST += errno.in.h ++ ++## end gnulib module errno ++ ++## begin gnulib module float ++ ++BUILT_SOURCES += $(FLOAT_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++if GL_GENERATE_FLOAT_H ++float.h: float.in.h $(top_builddir)/config.status ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ ++ -e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \ ++ < $(srcdir)/float.in.h; \ ++ } > $@-t && \ ++ mv $@-t $@ ++else ++float.h: $(top_builddir)/config.status ++ rm -f $@ ++endif ++MOSTLYCLEANFILES += float.h float.h-t ++ ++EXTRA_DIST += float.c float.in.h itold.c ++ ++EXTRA_libmisc_a_SOURCES += float.c itold.c ++ ++## end gnulib module float ++ ++## begin gnulib module getopt-posix + + BUILT_SOURCES += $(GETOPT_H) +-EXTRA_DIST += getopt_.h getopt_int.h + + # We need the following in order to create when the system + # doesn't have one that works with the given compiler. +-getopt.h: getopt_.h +- cp $(srcdir)/getopt_.h $@-t +- mv $@-t $@ ++getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \ ++ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ ++ < $(srcdir)/getopt.in.h; \ ++ } > $@-t && \ ++ mv -f $@-t $@ + MOSTLYCLEANFILES += getopt.h getopt.h-t + +-## end gnulib module getopt ++EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h ++ ++EXTRA_libmisc_a_SOURCES += getopt.c getopt1.c ++ ++## end gnulib module getopt-posix + + ## begin gnulib module gettext-h + +@@ -103,23 +229,66 @@ libmisc_a_SOURCES += gettext.h + + ## end gnulib module gettext-h + +-## begin gnulib module mbchar ++## begin gnulib module gettimeofday ++ ++ ++EXTRA_DIST += gettimeofday.c ++ ++EXTRA_libmisc_a_SOURCES += gettimeofday.c ++ ++## end gnulib module gettimeofday ++ ++## begin gnulib module intprops ++ ++ ++EXTRA_DIST += intprops.h ++ ++## end gnulib module intprops ++ ++## begin gnulib module malloc-gnu ++ ++ ++EXTRA_DIST += malloc.c ++ ++EXTRA_libmisc_a_SOURCES += malloc.c ++ ++## end gnulib module malloc-gnu ++ ++## begin gnulib module malloc-posix ++ ++ ++EXTRA_DIST += malloc.c ++ ++EXTRA_libmisc_a_SOURCES += malloc.c + +-libmisc_a_SOURCES += mbchar.h ++## end gnulib module malloc-posix + +-## end gnulib module mbchar ++## begin gnulib module memchr + +-## begin gnulib module mbuiter + +-libmisc_a_SOURCES += mbuiter.h ++EXTRA_DIST += memchr.c memchr.valgrind + +-## end gnulib module mbuiter ++EXTRA_libmisc_a_SOURCES += memchr.c + +-## begin gnulib module minmax ++## end gnulib module memchr + +-libmisc_a_SOURCES += minmax.h ++## begin gnulib module mempcpy + +-## end gnulib module minmax ++ ++EXTRA_DIST += mempcpy.c ++ ++EXTRA_libmisc_a_SOURCES += mempcpy.c ++ ++## end gnulib module mempcpy ++ ++## begin gnulib module rawmemchr ++ ++ ++EXTRA_DIST += rawmemchr.c rawmemchr.valgrind ++ ++EXTRA_libmisc_a_SOURCES += rawmemchr.c ++ ++## end gnulib module rawmemchr + + ## begin gnulib module size_max + +@@ -127,107 +296,1037 @@ libmisc_a_SOURCES += size_max.h + + ## end gnulib module size_max + ++## begin gnulib module sleep ++ ++ ++EXTRA_DIST += sleep.c ++ ++EXTRA_libmisc_a_SOURCES += sleep.c ++ ++## end gnulib module sleep ++ ++## begin gnulib module snippet/_Noreturn ++ ++# Because this Makefile snippet defines a variable used by other ++# gnulib Makefile snippets, it must be present in all Makefile.am that ++# need it. This is ensured by the applicability 'all' defined above. ++ ++_NORETURN_H=$(top_srcdir)/./snippet/_Noreturn.h ++ ++EXTRA_DIST += $(top_srcdir)/./snippet/_Noreturn.h ++ ++## end gnulib module snippet/_Noreturn ++ ++## begin gnulib module snippet/arg-nonnull ++ ++# The BUILT_SOURCES created by this Makefile snippet are not used via #include ++# statements but through direct file reference. Therefore this snippet must be ++# present in all Makefile.am that need it. This is ensured by the applicability ++# 'all' defined above. ++ ++BUILT_SOURCES += arg-nonnull.h ++# The arg-nonnull.h that gets inserted into generated .h files is the same as ++# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut ++# off. ++arg-nonnull.h: $(top_srcdir)/./snippet/arg-nonnull.h ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ sed -n -e '/GL_ARG_NONNULL/,$$p' \ ++ < $(top_srcdir)/./snippet/arg-nonnull.h \ ++ > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t ++ ++ARG_NONNULL_H=arg-nonnull.h ++ ++EXTRA_DIST += $(top_srcdir)/./snippet/arg-nonnull.h ++ ++## end gnulib module snippet/arg-nonnull ++ ++## begin gnulib module snippet/c++defs ++ ++# The BUILT_SOURCES created by this Makefile snippet are not used via #include ++# statements but through direct file reference. Therefore this snippet must be ++# present in all Makefile.am that need it. This is ensured by the applicability ++# 'all' defined above. ++ ++BUILT_SOURCES += c++defs.h ++# The c++defs.h that gets inserted into generated .h files is the same as ++# build-aux/snippet/c++defs.h, except that it has the copyright header cut off. ++c++defs.h: $(top_srcdir)/./snippet/c++defs.h ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ sed -n -e '/_GL_CXXDEFS/,$$p' \ ++ < $(top_srcdir)/./snippet/c++defs.h \ ++ > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += c++defs.h c++defs.h-t ++ ++CXXDEFS_H=c++defs.h ++ ++EXTRA_DIST += $(top_srcdir)/./snippet/c++defs.h ++ ++## end gnulib module snippet/c++defs ++ ++## begin gnulib module snippet/warn-on-use ++ ++BUILT_SOURCES += warn-on-use.h ++# The warn-on-use.h that gets inserted into generated .h files is the same as ++# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut ++# off. ++warn-on-use.h: $(top_srcdir)/./snippet/warn-on-use.h ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ sed -n -e '/^.ifndef/,$$p' \ ++ < $(top_srcdir)/./snippet/warn-on-use.h \ ++ > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t ++ ++WARN_ON_USE_H=warn-on-use.h ++ ++EXTRA_DIST += $(top_srcdir)/./snippet/warn-on-use.h ++ ++## end gnulib module snippet/warn-on-use ++ ++## begin gnulib module stdalign ++ ++BUILT_SOURCES += $(STDALIGN_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works. ++if GL_GENERATE_STDALIGN_H ++stdalign.h: stdalign.in.h $(top_builddir)/config.status ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ cat $(srcdir)/stdalign.in.h; \ ++ } > $@-t && \ ++ mv $@-t $@ ++else ++stdalign.h: $(top_builddir)/config.status ++ rm -f $@ ++endif ++MOSTLYCLEANFILES += stdalign.h stdalign.h-t ++ ++EXTRA_DIST += stdalign.in.h ++ ++## end gnulib module stdalign ++ + ## begin gnulib module stdbool + + BUILT_SOURCES += $(STDBOOL_H) +-EXTRA_DIST += stdbool_.h + + # We need the following in order to create when the system + # doesn't have one that works. +-stdbool.h: stdbool_.h +- sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t ++if GL_GENERATE_STDBOOL_H ++stdbool.h: stdbool.in.h $(top_builddir)/config.status ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ ++ } > $@-t && \ + mv $@-t $@ ++else ++stdbool.h: $(top_builddir)/config.status ++ rm -f $@ ++endif + MOSTLYCLEANFILES += stdbool.h stdbool.h-t + ++EXTRA_DIST += stdbool.in.h ++ + ## end gnulib module stdbool + ++## begin gnulib module stddef ++ ++BUILT_SOURCES += $(STDDEF_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++if GL_GENERATE_STDDEF_H ++stddef.h: stddef.in.h $(top_builddir)/config.status ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ ++ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ ++ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ ++ < $(srcdir)/stddef.in.h; \ ++ } > $@-t && \ ++ mv $@-t $@ ++else ++stddef.h: $(top_builddir)/config.status ++ rm -f $@ ++endif ++MOSTLYCLEANFILES += stddef.h stddef.h-t ++ ++EXTRA_DIST += stddef.in.h ++ ++## end gnulib module stddef ++ ++## begin gnulib module stdint ++ ++BUILT_SOURCES += $(STDINT_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++if GL_GENERATE_STDINT_H ++stdint.h: stdint.in.h $(top_builddir)/config.status ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ ++ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ ++ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ ++ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ ++ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ ++ -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ ++ -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ ++ -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ ++ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ ++ -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ ++ -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ ++ -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ ++ -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ ++ -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ ++ -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ ++ -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ ++ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ ++ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ ++ < $(srcdir)/stdint.in.h; \ ++ } > $@-t && \ ++ mv $@-t $@ ++else ++stdint.h: $(top_builddir)/config.status ++ rm -f $@ ++endif ++MOSTLYCLEANFILES += stdint.h stdint.h-t ++ ++EXTRA_DIST += stdint.in.h ++ ++## end gnulib module stdint ++ ++## begin gnulib module stdio ++ ++BUILT_SOURCES += stdio.h ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ ++ -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \ ++ -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \ ++ -e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \ ++ -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \ ++ -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \ ++ -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \ ++ -e 's/@''GNULIB_FOPEN''@/$(GNULIB_FOPEN)/g' \ ++ -e 's/@''GNULIB_FPRINTF''@/$(GNULIB_FPRINTF)/g' \ ++ -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GNULIB_FPRINTF_POSIX)/g' \ ++ -e 's/@''GNULIB_FPURGE''@/$(GNULIB_FPURGE)/g' \ ++ -e 's/@''GNULIB_FPUTC''@/$(GNULIB_FPUTC)/g' \ ++ -e 's/@''GNULIB_FPUTS''@/$(GNULIB_FPUTS)/g' \ ++ -e 's/@''GNULIB_FREAD''@/$(GNULIB_FREAD)/g' \ ++ -e 's/@''GNULIB_FREOPEN''@/$(GNULIB_FREOPEN)/g' \ ++ -e 's/@''GNULIB_FSCANF''@/$(GNULIB_FSCANF)/g' \ ++ -e 's/@''GNULIB_FSEEK''@/$(GNULIB_FSEEK)/g' \ ++ -e 's/@''GNULIB_FSEEKO''@/$(GNULIB_FSEEKO)/g' \ ++ -e 's/@''GNULIB_FTELL''@/$(GNULIB_FTELL)/g' \ ++ -e 's/@''GNULIB_FTELLO''@/$(GNULIB_FTELLO)/g' \ ++ -e 's/@''GNULIB_FWRITE''@/$(GNULIB_FWRITE)/g' \ ++ -e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \ ++ -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \ ++ -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \ ++ -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \ ++ -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \ ++ -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \ ++ -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \ ++ -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \ ++ -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \ ++ -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \ ++ -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \ ++ -e 's/@''GNULIB_PRINTF_POSIX''@/$(GNULIB_PRINTF_POSIX)/g' \ ++ -e 's/@''GNULIB_PUTC''@/$(GNULIB_PUTC)/g' \ ++ -e 's/@''GNULIB_PUTCHAR''@/$(GNULIB_PUTCHAR)/g' \ ++ -e 's/@''GNULIB_PUTS''@/$(GNULIB_PUTS)/g' \ ++ -e 's/@''GNULIB_REMOVE''@/$(GNULIB_REMOVE)/g' \ ++ -e 's/@''GNULIB_RENAME''@/$(GNULIB_RENAME)/g' \ ++ -e 's/@''GNULIB_RENAMEAT''@/$(GNULIB_RENAMEAT)/g' \ ++ -e 's/@''GNULIB_SCANF''@/$(GNULIB_SCANF)/g' \ ++ -e 's/@''GNULIB_SNPRINTF''@/$(GNULIB_SNPRINTF)/g' \ ++ -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GNULIB_SPRINTF_POSIX)/g' \ ++ -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GNULIB_STDIO_H_NONBLOCKING)/g' \ ++ -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GNULIB_STDIO_H_SIGPIPE)/g' \ ++ -e 's/@''GNULIB_TMPFILE''@/$(GNULIB_TMPFILE)/g' \ ++ -e 's/@''GNULIB_VASPRINTF''@/$(GNULIB_VASPRINTF)/g' \ ++ -e 's/@''GNULIB_VDPRINTF''@/$(GNULIB_VDPRINTF)/g' \ ++ -e 's/@''GNULIB_VFPRINTF''@/$(GNULIB_VFPRINTF)/g' \ ++ -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GNULIB_VFPRINTF_POSIX)/g' \ ++ -e 's/@''GNULIB_VFSCANF''@/$(GNULIB_VFSCANF)/g' \ ++ -e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/g' \ ++ -e 's/@''GNULIB_VPRINTF''@/$(GNULIB_VPRINTF)/g' \ ++ -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GNULIB_VPRINTF_POSIX)/g' \ ++ -e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \ ++ -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \ ++ < $(srcdir)/stdio.in.h | \ ++ sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ ++ -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ ++ -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \ ++ -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ ++ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ ++ -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ ++ -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ ++ -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ ++ -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ ++ -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ ++ -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ ++ -e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \ ++ -e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \ ++ -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ ++ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ ++ -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ ++ -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ ++ -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ ++ -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \ ++ -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ ++ -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ ++ -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ ++ -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \ ++ -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ ++ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ ++ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ ++ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ ++ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ ++ -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \ ++ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ ++ -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ ++ -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ ++ -e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \ ++ -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ ++ -e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \ ++ -e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \ ++ -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \ ++ -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ ++ -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ ++ -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \ ++ -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ ++ -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \ ++ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ ++ -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \ ++ -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ ++ -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ ++ -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ ++ -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ ++ -e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \ ++ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ ++ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ ++ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ ++ } > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += stdio.h stdio.h-t ++ ++EXTRA_DIST += stdio.in.h ++ ++## end gnulib module stdio ++ ++## begin gnulib module stdlib ++ ++BUILT_SOURCES += stdlib.h ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ ++ $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ ++ -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \ ++ -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \ ++ -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \ ++ -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \ ++ -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \ ++ -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \ ++ -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \ ++ -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \ ++ -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \ ++ -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \ ++ -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \ ++ -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \ ++ -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \ ++ -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \ ++ -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \ ++ -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ ++ -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \ ++ -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ ++ -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ ++ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ ++ -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ ++ -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ ++ -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ ++ -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ ++ -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ ++ -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ ++ -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ ++ -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \ ++ -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \ ++ -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \ ++ < $(srcdir)/stdlib.in.h | \ ++ sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ ++ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ ++ -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ ++ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ ++ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ ++ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ ++ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ ++ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ ++ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ ++ -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ ++ -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ ++ -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \ ++ -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ ++ -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \ ++ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ ++ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ ++ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ ++ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ ++ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ ++ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ ++ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ ++ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ ++ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ ++ -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ ++ -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ ++ -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ ++ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ ++ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ ++ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ ++ -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ ++ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ ++ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ ++ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ ++ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ ++ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ ++ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ ++ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ ++ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ ++ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ ++ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ ++ -e '/definition of _Noreturn/r $(_NORETURN_H)' \ ++ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ ++ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ ++ } > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += stdlib.h stdlib.h-t ++ ++EXTRA_DIST += stdlib.in.h ++ ++## end gnulib module stdlib ++ ++## begin gnulib module stpcpy ++ ++ ++EXTRA_DIST += stpcpy.c ++ ++EXTRA_libmisc_a_SOURCES += stpcpy.c ++ ++## end gnulib module stpcpy ++ + ## begin gnulib module strcase + +-libmisc_a_SOURCES += strcase.h ++ ++EXTRA_DIST += strcasecmp.c strncasecmp.c ++ ++EXTRA_libmisc_a_SOURCES += strcasecmp.c strncasecmp.c + + ## end gnulib module strcase + + ## begin gnulib module strchrnul + +-libmisc_a_SOURCES += strchrnul.h ++ ++EXTRA_DIST += strchrnul.c strchrnul.valgrind ++ ++EXTRA_libmisc_a_SOURCES += strchrnul.c + + ## end gnulib module strchrnul + +-## begin gnulib module strnlen1 ++## begin gnulib module strerror ++ ++ ++EXTRA_DIST += strerror.c ++ ++EXTRA_libmisc_a_SOURCES += strerror.c ++ ++## end gnulib module strerror ++ ++## begin gnulib module strerror-override ++ ++ ++EXTRA_DIST += strerror-override.c strerror-override.h ++ ++EXTRA_libmisc_a_SOURCES += strerror-override.c ++ ++## end gnulib module strerror-override ++ ++## begin gnulib module string ++ ++BUILT_SOURCES += string.h ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ ++ -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ ++ -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ ++ -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ ++ -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \ ++ -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \ ++ -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \ ++ -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \ ++ -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \ ++ -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \ ++ -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \ ++ -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \ ++ -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \ ++ -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \ ++ -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \ ++ -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \ ++ -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \ ++ -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \ ++ -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \ ++ -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \ ++ -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \ ++ -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \ ++ -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \ ++ -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \ ++ -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \ ++ -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \ ++ -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \ ++ -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \ ++ -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \ ++ -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \ ++ -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \ ++ -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \ ++ -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \ ++ -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \ ++ -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \ ++ -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \ ++ -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ ++ -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ ++ < $(srcdir)/string.in.h | \ ++ sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ ++ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ ++ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ ++ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ ++ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ ++ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ ++ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ ++ -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ ++ -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ ++ -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ ++ -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ ++ -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ ++ -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ ++ -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ ++ -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ ++ -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ ++ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ ++ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ ++ -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ ++ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ ++ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ ++ -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ ++ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ ++ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ ++ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ ++ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ ++ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ ++ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ ++ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ ++ -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ ++ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ ++ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ ++ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ ++ -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ ++ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ ++ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ ++ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ ++ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ ++ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ ++ < $(srcdir)/string.in.h; \ ++ } > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += string.h string.h-t ++ ++EXTRA_DIST += string.in.h ++ ++## end gnulib module string ++ ++## begin gnulib module strings + +-libmisc_a_SOURCES += strnlen1.h strnlen1.c ++BUILT_SOURCES += strings.h + +-## end gnulib module strnlen1 ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ ++ -e 's|@''GNULIB_FFS''@|$(GNULIB_FFS)|g' \ ++ -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \ ++ -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ ++ -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ ++ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ ++ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ ++ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ ++ < $(srcdir)/strings.in.h; \ ++ } > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += strings.h strings.h-t ++ ++EXTRA_DIST += strings.in.h ++ ++## end gnulib module strings ++ ++## begin gnulib module strndup ++ ++ ++EXTRA_DIST += strndup.c ++ ++EXTRA_libmisc_a_SOURCES += strndup.c ++ ++## end gnulib module strndup ++ ++## begin gnulib module strnlen ++ ++ ++EXTRA_DIST += strnlen.c ++ ++EXTRA_libmisc_a_SOURCES += strnlen.c ++ ++## end gnulib module strnlen ++ ++## begin gnulib module strstr-simple ++ ++ ++EXTRA_DIST += str-two-way.h strstr.c ++ ++EXTRA_libmisc_a_SOURCES += strstr.c ++ ++## end gnulib module strstr-simple ++ ++## begin gnulib module sys_time ++ ++BUILT_SOURCES += sys/time.h ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) ++ $(AM_V_at)$(MKDIR_P) sys ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \ ++ -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \ ++ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ ++ -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \ ++ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \ ++ -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \ ++ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ ++ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ ++ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ ++ < $(srcdir)/sys_time.in.h; \ ++ } > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += sys/time.h sys/time.h-t ++ ++EXTRA_DIST += sys_time.in.h ++ ++## end gnulib module sys_time ++ ++## begin gnulib module sys_types ++ ++BUILT_SOURCES += sys/types.h ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++sys/types.h: sys_types.in.h $(top_builddir)/config.status ++ $(AM_V_at)$(MKDIR_P) sys ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ ++ < $(srcdir)/sys_types.in.h; \ ++ } > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += sys/types.h sys/types.h-t ++ ++EXTRA_DIST += sys_types.in.h ++ ++## end gnulib module sys_types + + ## begin gnulib module sysexits + + BUILT_SOURCES += $(SYSEXITS_H) +-EXTRA_DIST += sysexit_.h + + # We need the following in order to create when the system + # doesn't have one that works with the given compiler. +-sysexits.h: sysexit_.h +- cp $(srcdir)/sysexit_.h sysexits.h-t +- mv sysexits.h-t sysexits.h ++if GL_GENERATE_SYSEXITS_H ++sysexits.h: sysexits.in.h $(top_builddir)/config.status ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''HAVE_SYSEXITS_H''@|$(HAVE_SYSEXITS_H)|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_SYSEXITS_H''@|$(NEXT_SYSEXITS_H)|g' \ ++ < $(srcdir)/sysexits.in.h; \ ++ } > $@-t && \ ++ mv -f $@-t $@ ++else ++sysexits.h: $(top_builddir)/config.status ++ rm -f $@ ++endif + MOSTLYCLEANFILES += sysexits.h sysexits.h-t + ++EXTRA_DIST += sysexits.in.h ++ + ## end gnulib module sysexits + + ## begin gnulib module unistd + +-BUILT_SOURCES += $(UNISTD_H) ++BUILT_SOURCES += unistd.h + + # We need the following in order to create an empty placeholder for + # when the system doesn't have one. +-unistd.h: +- echo '/* Empty placeholder for $@. */' >$@ +-MOSTLYCLEANFILES += unistd.h ++unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ ++ -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ ++ -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ ++ -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ ++ -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \ ++ -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ ++ -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ ++ -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \ ++ -e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \ ++ -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \ ++ -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \ ++ -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \ ++ -e 's/@''GNULIB_FDATASYNC''@/$(GNULIB_FDATASYNC)/g' \ ++ -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \ ++ -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \ ++ -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \ ++ -e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \ ++ -e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \ ++ -e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \ ++ -e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \ ++ -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \ ++ -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \ ++ -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \ ++ -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \ ++ -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \ ++ -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \ ++ -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \ ++ -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \ ++ -e 's/@''GNULIB_LSEEK''@/$(GNULIB_LSEEK)/g' \ ++ -e 's/@''GNULIB_PIPE''@/$(GNULIB_PIPE)/g' \ ++ -e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \ ++ -e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \ ++ -e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \ ++ -e 's/@''GNULIB_READ''@/$(GNULIB_READ)/g' \ ++ -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \ ++ -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \ ++ -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \ ++ -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ ++ -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ ++ -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ ++ -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ ++ -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \ ++ -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ ++ -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \ ++ -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \ ++ -e 's/@''GNULIB_UNLINKAT''@/$(GNULIB_UNLINKAT)/g' \ ++ -e 's/@''GNULIB_USLEEP''@/$(GNULIB_USLEEP)/g' \ ++ -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ ++ < $(srcdir)/unistd.in.h | \ ++ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ ++ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ ++ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ ++ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ ++ -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ ++ -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ ++ -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ ++ -e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \ ++ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ ++ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ ++ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ ++ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ ++ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ ++ -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ ++ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ ++ -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ ++ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ ++ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ ++ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ ++ -e 's|@''HAVE_PIPE''@|$(HAVE_PIPE)|g' \ ++ -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ ++ -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ ++ -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ ++ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ ++ -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ ++ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ ++ -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ ++ -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ ++ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ ++ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ ++ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ ++ -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ ++ -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ ++ -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ ++ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ ++ -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ ++ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ ++ -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ ++ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ ++ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ ++ | \ ++ sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ ++ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ ++ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ ++ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ ++ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ ++ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ ++ -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ ++ -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ ++ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ ++ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ ++ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ ++ -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ ++ -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ ++ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ ++ -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ ++ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ ++ -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ ++ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ ++ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ ++ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ ++ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ ++ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ ++ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ ++ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ ++ -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \ ++ -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ ++ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ ++ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ ++ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ ++ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ ++ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ ++ } > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += unistd.h unistd.h-t ++ ++EXTRA_DIST += unistd.in.h + + ## end gnulib module unistd + + ## begin gnulib module vasnprintf + +-libmisc_a_SOURCES += printf-args.h printf-parse.h vasnprintf.h + +-## end gnulib module vasnprintf ++EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h + +-## begin gnulib module vsnprintf ++EXTRA_libmisc_a_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c + +-libmisc_a_SOURCES += vsnprintf.h ++## end gnulib module vasnprintf + +-## end gnulib module vsnprintf ++## begin gnulib module verify + +-## begin gnulib module wcwidth + +-libmisc_a_SOURCES += wcwidth.h ++EXTRA_DIST += verify.h + +-## end gnulib module wcwidth ++## end gnulib module verify + +-## begin gnulib module xalloc-die ++## begin gnulib module vsnprintf + +-libmisc_a_SOURCES += xalloc-die.c + +-## end gnulib module xalloc-die ++EXTRA_DIST += vsnprintf.c + +-## begin gnulib module xsize ++EXTRA_libmisc_a_SOURCES += vsnprintf.c + +-libmisc_a_SOURCES += xsize.h ++## end gnulib module vsnprintf + +-## end gnulib module xsize ++## begin gnulib module wchar ++ ++BUILT_SOURCES += wchar.h ++ ++# We need the following in order to create when the system ++# version does not work standalone. ++wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) ++ $(AM_V_GEN)rm -f $@-t $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ ++ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ ++ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ ++ -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \ ++ -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \ ++ -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \ ++ -e 's/@''GNULIB_MBRTOWC''@/$(GNULIB_MBRTOWC)/g' \ ++ -e 's/@''GNULIB_MBRLEN''@/$(GNULIB_MBRLEN)/g' \ ++ -e 's/@''GNULIB_MBSRTOWCS''@/$(GNULIB_MBSRTOWCS)/g' \ ++ -e 's/@''GNULIB_MBSNRTOWCS''@/$(GNULIB_MBSNRTOWCS)/g' \ ++ -e 's/@''GNULIB_WCRTOMB''@/$(GNULIB_WCRTOMB)/g' \ ++ -e 's/@''GNULIB_WCSRTOMBS''@/$(GNULIB_WCSRTOMBS)/g' \ ++ -e 's/@''GNULIB_WCSNRTOMBS''@/$(GNULIB_WCSNRTOMBS)/g' \ ++ -e 's/@''GNULIB_WCWIDTH''@/$(GNULIB_WCWIDTH)/g' \ ++ -e 's/@''GNULIB_WMEMCHR''@/$(GNULIB_WMEMCHR)/g' \ ++ -e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \ ++ -e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \ ++ -e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \ ++ -e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \ ++ -e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \ ++ -e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \ ++ -e 's/@''GNULIB_WCSCPY''@/$(GNULIB_WCSCPY)/g' \ ++ -e 's/@''GNULIB_WCPCPY''@/$(GNULIB_WCPCPY)/g' \ ++ -e 's/@''GNULIB_WCSNCPY''@/$(GNULIB_WCSNCPY)/g' \ ++ -e 's/@''GNULIB_WCPNCPY''@/$(GNULIB_WCPNCPY)/g' \ ++ -e 's/@''GNULIB_WCSCAT''@/$(GNULIB_WCSCAT)/g' \ ++ -e 's/@''GNULIB_WCSNCAT''@/$(GNULIB_WCSNCAT)/g' \ ++ -e 's/@''GNULIB_WCSCMP''@/$(GNULIB_WCSCMP)/g' \ ++ -e 's/@''GNULIB_WCSNCMP''@/$(GNULIB_WCSNCMP)/g' \ ++ -e 's/@''GNULIB_WCSCASECMP''@/$(GNULIB_WCSCASECMP)/g' \ ++ -e 's/@''GNULIB_WCSNCASECMP''@/$(GNULIB_WCSNCASECMP)/g' \ ++ -e 's/@''GNULIB_WCSCOLL''@/$(GNULIB_WCSCOLL)/g' \ ++ -e 's/@''GNULIB_WCSXFRM''@/$(GNULIB_WCSXFRM)/g' \ ++ -e 's/@''GNULIB_WCSDUP''@/$(GNULIB_WCSDUP)/g' \ ++ -e 's/@''GNULIB_WCSCHR''@/$(GNULIB_WCSCHR)/g' \ ++ -e 's/@''GNULIB_WCSRCHR''@/$(GNULIB_WCSRCHR)/g' \ ++ -e 's/@''GNULIB_WCSCSPN''@/$(GNULIB_WCSCSPN)/g' \ ++ -e 's/@''GNULIB_WCSSPN''@/$(GNULIB_WCSSPN)/g' \ ++ -e 's/@''GNULIB_WCSPBRK''@/$(GNULIB_WCSPBRK)/g' \ ++ -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \ ++ -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \ ++ -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \ ++ < $(srcdir)/wchar.in.h | \ ++ sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ ++ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ ++ -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ ++ -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ ++ -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \ ++ -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \ ++ -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \ ++ -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \ ++ -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \ ++ -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \ ++ -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \ ++ -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \ ++ -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \ ++ -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \ ++ -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \ ++ -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \ ++ -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \ ++ -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \ ++ -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \ ++ -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \ ++ -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \ ++ -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \ ++ -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \ ++ -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \ ++ -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \ ++ -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \ ++ -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \ ++ -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \ ++ -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \ ++ -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \ ++ -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \ ++ -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \ ++ -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \ ++ -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \ ++ -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \ ++ -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \ ++ -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ ++ -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ ++ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ ++ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ ++ | \ ++ sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ ++ -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \ ++ -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \ ++ -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \ ++ -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \ ++ -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \ ++ -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \ ++ -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \ ++ -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \ ++ -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ ++ -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ ++ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ ++ -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ ++ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ ++ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ ++ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ ++ } > $@-t && \ ++ mv $@-t $@ ++MOSTLYCLEANFILES += wchar.h wchar.h-t ++ ++EXTRA_DIST += wchar.in.h + +-## begin gnulib module xstrndup ++## end gnulib module wchar + +-libmisc_a_SOURCES += xstrndup.h xstrndup.c ++## begin gnulib module xsize + +-## end gnulib module xstrndup ++libmisc_a_SOURCES += xsize.h + ++## end gnulib module xsize + +-mostlyclean-local: +- @test -z "$(MOSTLYCLEANDIRS)" || \ +- for dir in $(MOSTLYCLEANDIRS); do \ +- if test -d $$dir; then \ +- echo "rmdir $$dir"; rmdir $$dir; \ +- fi; \ +- done + +-# Makefile.am ends here ++mostlyclean-local: mostlyclean-generic ++ @for dir in '' $(MOSTLYCLEANDIRS); do \ ++ if test -n "$$dir" && test -d $$dir; then \ ++ echo "rmdir $$dir"; rmdir $$dir; \ ++ fi; \ ++ done; \ ++ : +diff --git a/xbmc/screensavers/rsxs-0.9/lib/alloca.c b/xbmc/screensavers/rsxs-0.9/lib/alloca.c +index d1d5447..06b12a7 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/alloca.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/alloca.c +@@ -21,9 +21,7 @@ + allocating any. It is a good idea to use alloca(0) in + your main control loop, etc. to force garbage collection. */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif ++#include + + #include + +@@ -83,38 +81,27 @@ + STACK_DIRECTION = 0 => direction of growth unknown */ + + # ifndef STACK_DIRECTION +-# define STACK_DIRECTION 0 /* Direction unknown. */ ++# define STACK_DIRECTION 0 /* Direction unknown. */ + # endif + + # if STACK_DIRECTION != 0 + +-# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ ++# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ + + # else /* STACK_DIRECTION == 0; need run-time code. */ + +-static int stack_dir; /* 1 or -1 once known. */ +-# define STACK_DIR stack_dir ++static int stack_dir; /* 1 or -1 once known. */ ++# define STACK_DIR stack_dir + +-static void +-find_stack_direction (void) ++static int ++find_stack_direction (int *addr, int depth) + { +- static char *addr = NULL; /* Address of first `dummy', once known. */ +- auto char dummy; /* To get stack address. */ +- +- if (addr == NULL) +- { /* Initial entry. */ +- addr = ADDRESS_FUNCTION (dummy); +- +- find_stack_direction (); /* Recurse once. */ +- } +- else +- { +- /* Second entry. */ +- if (ADDRESS_FUNCTION (dummy) > addr) +- stack_dir = 1; /* Stack grew upward. */ +- else +- stack_dir = -1; /* Stack grew downward. */ +- } ++ int dir, dummy = 0; ++ if (! addr) ++ addr = &dummy; ++ *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; ++ dir = depth ? find_stack_direction (addr, depth - 1) : 0; ++ return dir + dummy; + } + + # endif /* STACK_DIRECTION == 0 */ +@@ -126,21 +113,21 @@ + It is very important that sizeof(header) agree with malloc + alignment chunk size. The following default should work okay. */ + +-# ifndef ALIGN_SIZE +-# define ALIGN_SIZE sizeof(double) ++# ifndef ALIGN_SIZE ++# define ALIGN_SIZE sizeof(double) + # endif + + typedef union hdr + { +- char align[ALIGN_SIZE]; /* To force sizeof(header). */ ++ char align[ALIGN_SIZE]; /* To force sizeof(header). */ + struct + { +- union hdr *next; /* For chaining headers. */ +- char *deep; /* For stack depth measure. */ ++ union hdr *next; /* For chaining headers. */ ++ char *deep; /* For stack depth measure. */ + } h; + } header; + +-static header *last_alloca_header = NULL; /* -> last alloca header. */ ++static header *last_alloca_header = NULL; /* -> last alloca header. */ + + /* Return a pointer to at least SIZE bytes of storage, + which will be automatically reclaimed upon exit from +@@ -152,19 +139,19 @@ + void * + alloca (size_t size) + { +- auto char probe; /* Probes stack depth: */ ++ auto char probe; /* Probes stack depth: */ + register char *depth = ADDRESS_FUNCTION (probe); + + # if STACK_DIRECTION == 0 +- if (STACK_DIR == 0) /* Unknown growth direction. */ +- find_stack_direction (); ++ if (STACK_DIR == 0) /* Unknown growth direction. */ ++ STACK_DIR = find_stack_direction (NULL, (size & 1) + 20); + # endif + + /* Reclaim garbage, defined as all alloca'd storage that + was allocated from deeper in the stack than currently. */ + + { +- register header *hp; /* Traverses linked list. */ ++ register header *hp; /* Traverses linked list. */ + + # ifdef emacs + BLOCK_INPUT; +@@ -172,18 +159,18 @@ + + for (hp = last_alloca_header; hp != NULL;) + if ((STACK_DIR > 0 && hp->h.deep > depth) +- || (STACK_DIR < 0 && hp->h.deep < depth)) +- { +- register header *np = hp->h.next; ++ || (STACK_DIR < 0 && hp->h.deep < depth)) ++ { ++ register header *np = hp->h.next; + +- free (hp); /* Collect garbage. */ ++ free (hp); /* Collect garbage. */ + +- hp = np; /* -> next header. */ +- } ++ hp = np; /* -> next header. */ ++ } + else +- break; /* Rest are not deeper. */ ++ break; /* Rest are not deeper. */ + +- last_alloca_header = hp; /* -> last valid storage. */ ++ last_alloca_header = hp; /* -> last valid storage. */ + + # ifdef emacs + UNBLOCK_INPUT; +@@ -191,7 +178,7 @@ + } + + if (size == 0) +- return NULL; /* No allocation required. */ ++ return NULL; /* No allocation required. */ + + /* Allocate combined header + user data storage. */ + +@@ -231,10 +218,10 @@ + /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ + struct stack_control_header + { +- long shgrow:32; /* Number of times stack has grown. */ +- long shaseg:32; /* Size of increments to stack. */ +- long shhwm:32; /* High water mark of stack. */ +- long shsize:32; /* Current size of stack (all segments). */ ++ long shgrow:32; /* Number of times stack has grown. */ ++ long shaseg:32; /* Size of increments to stack. */ ++ long shhwm:32; /* High water mark of stack. */ ++ long shsize:32; /* Current size of stack (all segments). */ + }; + + /* The stack segment linkage control information occurs at +@@ -246,21 +233,21 @@ struct stack_control_header + + struct stack_segment_linkage + { +- long ss[0200]; /* 0200 overflow words. */ +- long sssize:32; /* Number of words in this segment. */ +- long ssbase:32; /* Offset to stack base. */ ++ long ss[0200]; /* 0200 overflow words. */ ++ long sssize:32; /* Number of words in this segment. */ ++ long ssbase:32; /* Offset to stack base. */ + long:32; +- long sspseg:32; /* Offset to linkage control of previous +- segment of stack. */ ++ long sspseg:32; /* Offset to linkage control of previous ++ segment of stack. */ + long:32; +- long sstcpt:32; /* Pointer to task common address block. */ +- long sscsnm; /* Private control structure number for +- microtasking. */ +- long ssusr1; /* Reserved for user. */ +- long ssusr2; /* Reserved for user. */ +- long sstpid; /* Process ID for pid based multi-tasking. */ +- long ssgvup; /* Pointer to multitasking thread giveup. */ +- long sscray[7]; /* Reserved for Cray Research. */ ++ long sstcpt:32; /* Pointer to task common address block. */ ++ long sscsnm; /* Private control structure number for ++ microtasking. */ ++ long ssusr1; /* Reserved for user. */ ++ long ssusr2; /* Reserved for user. */ ++ long sstpid; /* Process ID for pid based multi-tasking. */ ++ long ssgvup; /* Pointer to multitasking thread giveup. */ ++ long sscray[7]; /* Reserved for Cray Research. */ + long ssa0; + long ssa1; + long ssa2; +@@ -284,27 +271,27 @@ struct stack_segment_linkage + returned by the STKSTAT library routine. */ + struct stk_stat + { +- long now; /* Current total stack size. */ +- long maxc; /* Amount of contiguous space which would +- be required to satisfy the maximum +- stack demand to date. */ +- long high_water; /* Stack high-water mark. */ +- long overflows; /* Number of stack overflow ($STKOFEN) calls. */ +- long hits; /* Number of internal buffer hits. */ +- long extends; /* Number of block extensions. */ +- long stko_mallocs; /* Block allocations by $STKOFEN. */ +- long underflows; /* Number of stack underflow calls ($STKRETN). */ +- long stko_free; /* Number of deallocations by $STKRETN. */ +- long stkm_free; /* Number of deallocations by $STKMRET. */ +- long segments; /* Current number of stack segments. */ +- long maxs; /* Maximum number of stack segments so far. */ +- long pad_size; /* Stack pad size. */ +- long current_address; /* Current stack segment address. */ +- long current_size; /* Current stack segment size. This +- number is actually corrupted by STKSTAT to +- include the fifteen word trailer area. */ +- long initial_address; /* Address of initial segment. */ +- long initial_size; /* Size of initial segment. */ ++ long now; /* Current total stack size. */ ++ long maxc; /* Amount of contiguous space which would ++ be required to satisfy the maximum ++ stack demand to date. */ ++ long high_water; /* Stack high-water mark. */ ++ long overflows; /* Number of stack overflow ($STKOFEN) calls. */ ++ long hits; /* Number of internal buffer hits. */ ++ long extends; /* Number of block extensions. */ ++ long stko_mallocs; /* Block allocations by $STKOFEN. */ ++ long underflows; /* Number of stack underflow calls ($STKRETN). */ ++ long stko_free; /* Number of deallocations by $STKRETN. */ ++ long stkm_free; /* Number of deallocations by $STKMRET. */ ++ long segments; /* Current number of stack segments. */ ++ long maxs; /* Maximum number of stack segments so far. */ ++ long pad_size; /* Stack pad size. */ ++ long current_address; /* Current stack segment address. */ ++ long current_size; /* Current stack segment size. This ++ number is actually corrupted by STKSTAT to ++ include the fifteen word trailer area. */ ++ long initial_address; /* Address of initial segment. */ ++ long initial_size; /* Size of initial segment. */ + }; + + /* The following structure describes the data structure which trails +@@ -313,13 +300,13 @@ struct stk_stat + + struct stk_trailer + { +- long this_address; /* Address of this block. */ +- long this_size; /* Size of this block (does not include +- this trailer). */ ++ long this_address; /* Address of this block. */ ++ long this_size; /* Size of this block (does not include ++ this trailer). */ + long unknown2; + long unknown3; +- long link; /* Address of trailer block of previous +- segment. */ ++ long link; /* Address of trailer block of previous ++ segment. */ + long unknown5; + long unknown6; + long unknown7; +@@ -357,8 +344,8 @@ struct stk_trailer + /* Set up the iteration. */ + + trailer = (struct stk_trailer *) (status.current_address +- + status.current_size +- - 15); ++ + status.current_size ++ - 15); + + /* There must be at least one stack segment. Therefore it is + a fatal error if "trailer" is null. */ +@@ -373,10 +360,10 @@ struct stk_trailer + block = (long *) trailer->this_address; + size = trailer->this_size; + if (block == 0 || size == 0) +- abort (); ++ abort (); + trailer = (struct stk_trailer *) trailer->link; + if ((block <= address) && (address < (block + size))) +- break; ++ break; + } + + /* Set the result to the offset in this segment and add the sizes +@@ -392,7 +379,7 @@ struct stk_trailer + do + { + if (trailer->this_size <= 0) +- abort (); ++ abort (); + result += trailer->this_size; + trailer = (struct stk_trailer *) trailer->link; + } +@@ -455,7 +442,7 @@ struct stk_trailer + fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); + # endif + if (pseg == 0) +- break; ++ break; + stkl = stkl - pseg; + ssptr = (struct stack_segment_linkage *) stkl; + size = ssptr->sssize; +@@ -488,4 +475,4 @@ struct stk_trailer + # endif /* CRAY */ + + # endif /* no alloca */ +-#endif /* not GCC version 2 */ ++#endif /* not GCC version 3 */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/alloca.in.h b/xbmc/screensavers/rsxs-0.9/lib/alloca.in.h +new file mode 100644 +index 0000000..5b69c6c +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/alloca.in.h +@@ -0,0 +1,56 @@ ++/* Memory allocation on the stack. ++ ++ Copyright (C) 1995, 1999, 2001-2004, 2006-2011 Free Software Foundation, ++ Inc. ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public ++ License along with this program; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++ USA. */ ++ ++/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H ++ means there is a real alloca function. */ ++#ifndef _GL_ALLOCA_H ++#define _GL_ALLOCA_H ++ ++/* alloca (N) returns a pointer to N bytes of memory ++ allocated on the stack, which will last until the function returns. ++ Use of alloca should be avoided: ++ - inside arguments of function calls - undefined behaviour, ++ - in inline functions - the allocation may actually last until the ++ calling function returns, ++ - for huge N (say, N >= 65536) - you never know how large (or small) ++ the stack is, and when the stack cannot fulfill the memory allocation ++ request, the program just crashes. ++ */ ++ ++#ifndef alloca ++# ifdef __GNUC__ ++# define alloca __builtin_alloca ++# elif defined _AIX ++# define alloca __alloca ++# elif defined _MSC_VER ++# include ++# define alloca _alloca ++# elif defined __DECC && defined __VMS ++# define alloca __ALLOCA ++# else ++# include ++# ifdef __cplusplus ++extern "C" ++# endif ++void *alloca (size_t); ++# endif ++#endif ++ ++#endif /* _GL_ALLOCA_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/arg-nonnull.h b/xbmc/screensavers/rsxs-0.9/lib/arg-nonnull.h +new file mode 100644 +index 0000000..f0dbac7 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/arg-nonnull.h +@@ -0,0 +1,10 @@ ++/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools ++ that the values passed as arguments n, ..., m must be non-NULL pointers. ++ n = 1 stands for the first argument, n = 2 for the second argument etc. */ ++#ifndef _GL_ARG_NONNULL ++# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 ++# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) ++# else ++# define _GL_ARG_NONNULL(params) ++# endif ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-ba.c b/xbmc/screensavers/rsxs-0.9/lib/argp-ba.c +index 8bb7309..a03b134 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-ba.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-ba.c +@@ -1,25 +1,34 @@ + /* Default definition for ARGP_PROGRAM_BUG_ADDRESS. +- Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. ++ Copyright (C) 1996-1997, 1999, 2009-2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + /* If set by the user program, it should point to string that is the + bug-reporting address for the program. It will be printed by argp_help if + the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help + messages), embedded in a sentence that says something like `Report bugs to + ADDR.'. */ +-const char *argp_program_bug_address; ++const char *argp_program_bug_address ++/* This variable should be zero-initialized. On most systems, putting it into ++ BSS is sufficient. Not so on MacOS X 10.3 and 10.4, see ++ ++ . */ ++#if defined __ELF__ ++ /* On ELF systems, variables in BSS behave well. */ ++#else ++ = (const char *) 0 ++#endif ++ ; +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-eexst.c b/xbmc/screensavers/rsxs-0.9/lib/argp-eexst.c +index bcab1c0..1082a39 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-eexst.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-eexst.c +@@ -1,21 +1,20 @@ + /* Default definition for ARGP_ERR_EXIT_STATUS +- Copyright (C) 1997 Free Software Foundation, Inc. ++ Copyright (C) 1997, 2009-2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + #ifdef HAVE_CONFIG_H + # include +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.c b/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.c +index 0dd9256..c308eb6 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.c +@@ -1,21 +1,21 @@ + /* Word-wrapping and line-truncating streams +- Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc. ++ Copyright (C) 1997-1999, 2001-2003, 2005, 2009-2011 Free Software ++ Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + /* This package emulates glibc `line_wrap_stream' semantics for systems that + don't have that. */ +@@ -56,7 +56,7 @@ + Returns NULL if there was an error. */ + argp_fmtstream_t + __argp_make_fmtstream (FILE *stream, +- size_t lmargin, size_t rmargin, ssize_t wmargin) ++ size_t lmargin, size_t rmargin, ssize_t wmargin) + { + argp_fmtstream_t fs; + +@@ -73,15 +73,15 @@ + + fs->buf = (char *) malloc (INIT_BUF_SIZE); + if (! fs->buf) +- { +- free (fs); +- fs = 0; +- } ++ { ++ free (fs); ++ fs = 0; ++ } + else +- { +- fs->p = fs->buf; +- fs->end = fs->buf + INIT_BUF_SIZE; +- } ++ { ++ fs->p = fs->buf; ++ fs->end = fs->buf + INIT_BUF_SIZE; ++ } + } + + return fs; +@@ -131,214 +131,214 @@ + size_t r; + + if (fs->point_col == 0 && fs->lmargin != 0) +- { +- /* We are starting a new line. Print spaces to the left margin. */ +- const size_t pad = fs->lmargin; +- if (fs->p + pad < fs->end) +- { +- /* We can fit in them in the buffer by moving the +- buffer text up and filling in the beginning. */ +- memmove (buf + pad, buf, fs->p - buf); +- fs->p += pad; /* Compensate for bigger buffer. */ +- memset (buf, ' ', pad); /* Fill in the spaces. */ +- buf += pad; /* Don't bother searching them. */ +- } +- else +- { +- /* No buffer space for spaces. Must flush. */ +- size_t i; +- for (i = 0; i < pad; i++) +- { ++ { ++ /* We are starting a new line. Print spaces to the left margin. */ ++ const size_t pad = fs->lmargin; ++ if (fs->p + pad < fs->end) ++ { ++ /* We can fit in them in the buffer by moving the ++ buffer text up and filling in the beginning. */ ++ memmove (buf + pad, buf, fs->p - buf); ++ fs->p += pad; /* Compensate for bigger buffer. */ ++ memset (buf, ' ', pad); /* Fill in the spaces. */ ++ buf += pad; /* Don't bother searching them. */ ++ } ++ else ++ { ++ /* No buffer space for spaces. Must flush. */ ++ size_t i; ++ for (i = 0; i < pad; i++) ++ { + #ifdef USE_IN_LIBIO +- if (_IO_fwide (fs->stream, 0) > 0) +- putwc_unlocked (L' ', fs->stream); +- else ++ if (_IO_fwide (fs->stream, 0) > 0) ++ putwc_unlocked (L' ', fs->stream); ++ else + #endif +- putc_unlocked (' ', fs->stream); +- } +- } +- fs->point_col = pad; +- } ++ putc_unlocked (' ', fs->stream); ++ } ++ } ++ fs->point_col = pad; ++ } + + len = fs->p - buf; + nl = memchr (buf, '\n', len); + + if (fs->point_col < 0) +- fs->point_col = 0; ++ fs->point_col = 0; + + if (!nl) +- { +- /* The buffer ends in a partial line. */ +- +- if (fs->point_col + len < fs->rmargin) +- { +- /* The remaining buffer text is a partial line and fits +- within the maximum line width. Advance point for the +- characters to be written and stop scanning. */ +- fs->point_col += len; +- break; +- } +- else +- /* Set the end-of-line pointer for the code below to +- the end of the buffer. */ +- nl = fs->p; +- } ++ { ++ /* The buffer ends in a partial line. */ ++ ++ if (fs->point_col + len < fs->rmargin) ++ { ++ /* The remaining buffer text is a partial line and fits ++ within the maximum line width. Advance point for the ++ characters to be written and stop scanning. */ ++ fs->point_col += len; ++ break; ++ } ++ else ++ /* Set the end-of-line pointer for the code below to ++ the end of the buffer. */ ++ nl = fs->p; ++ } + else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin) +- { +- /* The buffer contains a full line that fits within the maximum +- line width. Reset point and scan the next line. */ +- fs->point_col = 0; +- buf = nl + 1; +- continue; +- } ++ { ++ /* The buffer contains a full line that fits within the maximum ++ line width. Reset point and scan the next line. */ ++ fs->point_col = 0; ++ buf = nl + 1; ++ continue; ++ } + + /* This line is too long. */ + r = fs->rmargin - 1; + + if (fs->wmargin < 0) +- { +- /* Truncate the line by overwriting the excess with the +- newline and anything after it in the buffer. */ +- if (nl < fs->p) +- { +- memmove (buf + (r - fs->point_col), nl, fs->p - nl); +- fs->p -= buf + (r - fs->point_col) - nl; +- /* Reset point for the next line and start scanning it. */ +- fs->point_col = 0; +- buf += r + 1; /* Skip full line plus \n. */ +- } +- else +- { +- /* The buffer ends with a partial line that is beyond the +- maximum line width. Advance point for the characters +- written, and discard those past the max from the buffer. */ +- fs->point_col += len; +- fs->p -= fs->point_col - r; +- break; +- } +- } ++ { ++ /* Truncate the line by overwriting the excess with the ++ newline and anything after it in the buffer. */ ++ if (nl < fs->p) ++ { ++ memmove (buf + (r - fs->point_col), nl, fs->p - nl); ++ fs->p -= buf + (r - fs->point_col) - nl; ++ /* Reset point for the next line and start scanning it. */ ++ fs->point_col = 0; ++ buf += r + 1; /* Skip full line plus \n. */ ++ } ++ else ++ { ++ /* The buffer ends with a partial line that is beyond the ++ maximum line width. Advance point for the characters ++ written, and discard those past the max from the buffer. */ ++ fs->point_col += len; ++ fs->p -= fs->point_col - r; ++ break; ++ } ++ } + else +- { +- /* Do word wrap. Go to the column just past the maximum line +- width and scan back for the beginning of the word there. +- Then insert a line break. */ +- +- char *p, *nextline; +- int i; +- +- p = buf + (r + 1 - fs->point_col); +- while (p >= buf && !isblank (*p)) +- --p; +- nextline = p + 1; /* This will begin the next line. */ +- +- if (nextline > buf) +- { +- /* Swallow separating blanks. */ +- if (p >= buf) +- do +- --p; +- while (p >= buf && isblank (*p)); +- nl = p + 1; /* The newline will replace the first blank. */ +- } +- else +- { +- /* A single word that is greater than the maximum line width. +- Oh well. Put it on an overlong line by itself. */ +- p = buf + (r + 1 - fs->point_col); +- /* Find the end of the long word. */ +- if (p < nl) +- do +- ++p; +- while (p < nl && !isblank (*p)); +- if (p == nl) +- { +- /* It already ends a line. No fussing required. */ +- fs->point_col = 0; +- buf = nl + 1; +- continue; +- } +- /* We will move the newline to replace the first blank. */ +- nl = p; +- /* Swallow separating blanks. */ +- do +- ++p; +- while (isblank (*p)); +- /* The next line will start here. */ +- nextline = p; +- } +- +- /* Note: There are a bunch of tests below for +- NEXTLINE == BUF + LEN + 1; this case is where NL happens to fall +- at the end of the buffer, and NEXTLINE is in fact empty (and so +- we need not be careful to maintain its contents). */ +- +- if ((nextline == buf + len + 1 +- ? fs->end - nl < fs->wmargin + 1 +- : nextline - (nl + 1) < fs->wmargin) +- && fs->p > nextline) +- { +- /* The margin needs more blanks than we removed. */ +- if (fs->end - fs->p > fs->wmargin + 1) +- /* Make some space for them. */ +- { +- size_t mv = fs->p - nextline; +- memmove (nl + 1 + fs->wmargin, nextline, mv); +- nextline = nl + 1 + fs->wmargin; +- len = nextline + mv - buf; +- *nl++ = '\n'; +- } +- else +- /* Output the first line so we can use the space. */ +- { ++ { ++ /* Do word wrap. Go to the column just past the maximum line ++ width and scan back for the beginning of the word there. ++ Then insert a line break. */ ++ ++ char *p, *nextline; ++ int i; ++ ++ p = buf + (r + 1 - fs->point_col); ++ while (p >= buf && !isblank ((unsigned char) *p)) ++ --p; ++ nextline = p + 1; /* This will begin the next line. */ ++ ++ if (nextline > buf) ++ { ++ /* Swallow separating blanks. */ ++ if (p >= buf) ++ do ++ --p; ++ while (p >= buf && isblank ((unsigned char) *p)); ++ nl = p + 1; /* The newline will replace the first blank. */ ++ } ++ else ++ { ++ /* A single word that is greater than the maximum line width. ++ Oh well. Put it on an overlong line by itself. */ ++ p = buf + (r + 1 - fs->point_col); ++ /* Find the end of the long word. */ ++ if (p < nl) ++ do ++ ++p; ++ while (p < nl && !isblank ((unsigned char) *p)); ++ if (p == nl) ++ { ++ /* It already ends a line. No fussing required. */ ++ fs->point_col = 0; ++ buf = nl + 1; ++ continue; ++ } ++ /* We will move the newline to replace the first blank. */ ++ nl = p; ++ /* Swallow separating blanks. */ ++ do ++ ++p; ++ while (isblank ((unsigned char) *p)); ++ /* The next line will start here. */ ++ nextline = p; ++ } ++ ++ /* Note: There are a bunch of tests below for ++ NEXTLINE == BUF + LEN + 1; this case is where NL happens to fall ++ at the end of the buffer, and NEXTLINE is in fact empty (and so ++ we need not be careful to maintain its contents). */ ++ ++ if ((nextline == buf + len + 1 ++ ? fs->end - nl < fs->wmargin + 1 ++ : nextline - (nl + 1) < fs->wmargin) ++ && fs->p > nextline) ++ { ++ /* The margin needs more blanks than we removed. */ ++ if (fs->end - fs->p > fs->wmargin + 1) ++ /* Make some space for them. */ ++ { ++ size_t mv = fs->p - nextline; ++ memmove (nl + 1 + fs->wmargin, nextline, mv); ++ nextline = nl + 1 + fs->wmargin; ++ len = nextline + mv - buf; ++ *nl++ = '\n'; ++ } ++ else ++ /* Output the first line so we can use the space. */ ++ { + #ifdef _LIBC +- __fxprintf (fs->stream, "%.*s\n", +- (int) (nl - fs->buf), fs->buf); ++ __fxprintf (fs->stream, "%.*s\n", ++ (int) (nl - fs->buf), fs->buf); + #else +- if (nl > fs->buf) +- fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream); +- putc_unlocked ('\n', fs->stream); ++ if (nl > fs->buf) ++ fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream); ++ putc_unlocked ('\n', fs->stream); + #endif + +- len += buf - fs->buf; +- nl = buf = fs->buf; +- } +- } +- else +- /* We can fit the newline and blanks in before +- the next word. */ +- *nl++ = '\n'; +- +- if (nextline - nl >= fs->wmargin +- || (nextline == buf + len + 1 && fs->end - nextline >= fs->wmargin)) +- /* Add blanks up to the wrap margin column. */ +- for (i = 0; i < fs->wmargin; ++i) +- *nl++ = ' '; +- else +- for (i = 0; i < fs->wmargin; ++i) ++ len += buf - fs->buf; ++ nl = buf = fs->buf; ++ } ++ } ++ else ++ /* We can fit the newline and blanks in before ++ the next word. */ ++ *nl++ = '\n'; ++ ++ if (nextline - nl >= fs->wmargin ++ || (nextline == buf + len + 1 && fs->end - nextline >= fs->wmargin)) ++ /* Add blanks up to the wrap margin column. */ ++ for (i = 0; i < fs->wmargin; ++i) ++ *nl++ = ' '; ++ else ++ for (i = 0; i < fs->wmargin; ++i) + #ifdef USE_IN_LIBIO +- if (_IO_fwide (fs->stream, 0) > 0) +- putwc_unlocked (L' ', fs->stream); +- else ++ if (_IO_fwide (fs->stream, 0) > 0) ++ putwc_unlocked (L' ', fs->stream); ++ else + #endif +- putc_unlocked (' ', fs->stream); ++ putc_unlocked (' ', fs->stream); + +- /* Copy the tail of the original buffer into the current buffer +- position. */ +- if (nl < nextline) +- memmove (nl, nextline, buf + len - nextline); +- len -= nextline - buf; ++ /* Copy the tail of the original buffer into the current buffer ++ position. */ ++ if (nl < nextline) ++ memmove (nl, nextline, buf + len - nextline); ++ len -= nextline - buf; + +- /* Continue the scan on the remaining lines in the buffer. */ +- buf = nl; ++ /* Continue the scan on the remaining lines in the buffer. */ ++ buf = nl; + +- /* Restore bufp to include all the remaining text. */ +- fs->p = nl + len; ++ /* Restore bufp to include all the remaining text. */ ++ fs->p = nl + len; + +- /* Reset the counter of what has been output this line. If wmargin +- is 0, we want to avoid the lmargin getting added, so we set +- point_col to a magic value of -1 in that case. */ +- fs->point_col = fs->wmargin ? fs->wmargin : -1; +- } ++ /* Reset the counter of what has been output this line. If wmargin ++ is 0, we want to avoid the lmargin getting added, so we set ++ point_col to a magic value of -1 in that case. */ ++ fs->point_col = fs->wmargin ? fs->wmargin : -1; ++ } + } + + /* Remember that we've scanned as far as the end of the buffer. */ +@@ -364,35 +364,35 @@ + wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); + #endif + if (wrote == fs->p - fs->buf) +- { +- fs->p = fs->buf; +- fs->point_offs = 0; +- } ++ { ++ fs->p = fs->buf; ++ fs->point_offs = 0; ++ } + else +- { +- fs->p -= wrote; +- fs->point_offs -= wrote; +- memmove (fs->buf, fs->buf + wrote, fs->p - fs->buf); +- return 0; +- } ++ { ++ fs->p -= wrote; ++ fs->point_offs -= wrote; ++ memmove (fs->buf, fs->buf + wrote, fs->p - fs->buf); ++ return 0; ++ } + + if ((size_t) (fs->end - fs->buf) < amount) +- /* Gotta grow the buffer. */ +- { +- size_t old_size = fs->end - fs->buf; +- size_t new_size = old_size + amount; +- char *new_buf; +- +- if (new_size < old_size || ! (new_buf = realloc (fs->buf, new_size))) +- { +- __set_errno (ENOMEM); +- return 0; +- } +- +- fs->buf = new_buf; +- fs->end = new_buf + new_size; +- fs->p = fs->buf; +- } ++ /* Gotta grow the buffer. */ ++ { ++ size_t old_size = fs->end - fs->buf; ++ size_t new_size = old_size + amount; ++ char *new_buf; ++ ++ if (new_size < old_size || ! (new_buf = realloc (fs->buf, new_size))) ++ { ++ __set_errno (ENOMEM); ++ return 0; ++ } ++ ++ fs->buf = new_buf; ++ fs->end = new_buf + new_size; ++ fs->p = fs->buf; ++ } + } + + return 1; +@@ -410,14 +410,14 @@ + va_list args; + + if (! __argp_fmtstream_ensure (fs, size_guess)) +- return -1; ++ return -1; + + va_start (args, fmt); + avail = fs->end - fs->p; + out = __vsnprintf (fs->p, avail, fmt, args); + va_end (args); + if ((size_t) out >= avail) +- size_guess = out + 1; ++ size_guess = out + 1; + } + while ((size_t) out >= avail); + +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.h b/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.h +index e045a72..f664254 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.h +@@ -1,21 +1,20 @@ + /* Word-wrapping and line-truncating streams. +- Copyright (C) 1997, 2006 Free Software Foundation, Inc. ++ Copyright (C) 1997, 2006-2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + /* This package emulates glibc `line_wrap_stream' semantics for systems that + don't have that. If the system does have it, it is just a wrapper for +@@ -29,17 +28,16 @@ + #include + #include + +-#ifndef __attribute__ +-/* This feature is available in gcc versions 2.5 and later. */ +-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +-# define __attribute__(Spec) /* empty */ +-# endif +-/* The __-protected variants of `format' and `printf' attributes +- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || __STRICT_ANSI__ +-# define __format__ format +-# define __printf__ printf +-# endif ++/* The __attribute__ feature is available in gcc versions 2.5 and later. ++ The __-protected variants of the attributes 'format' and 'printf' are ++ accepted by gcc versions 2.6.4 (effectively 2.7) and later. ++ We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because ++ gnulib and libintl do '#define printf __printf__' when they override ++ the 'printf' function. */ ++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) ++# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) ++#else ++# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ + #endif + + #if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \ +@@ -92,19 +90,19 @@ + + struct argp_fmtstream + { +- FILE *stream; /* The stream we're outputting to. */ ++ FILE *stream; /* The stream we're outputting to. */ + +- size_t lmargin, rmargin; /* Left and right margins. */ +- ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */ ++ size_t lmargin, rmargin; /* Left and right margins. */ ++ ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */ + + /* Point in buffer to which we've processed for wrapping, but not output. */ + size_t point_offs; + /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin. */ + ssize_t point_col; + +- char *buf; /* Output buffer. */ +- char *p; /* Current end of text in BUF. */ +- char *end; /* Absolute end of BUF. */ ++ char *buf; /* Output buffer. */ ++ char *p; /* Current end of text in BUF. */ ++ char *end; /* Absolute end of BUF. */ + }; + + typedef struct argp_fmtstream *argp_fmtstream_t; +@@ -116,25 +114,26 @@ struct argp_fmtstream + Otherwise, chars beyond RMARGIN are simply dropped until a newline. + Returns NULL if there was an error. */ + extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream, +- size_t __lmargin, +- size_t __rmargin, +- ssize_t __wmargin); ++ size_t __lmargin, ++ size_t __rmargin, ++ ssize_t __wmargin); + extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream, +- size_t __lmargin, +- size_t __rmargin, +- ssize_t __wmargin); ++ size_t __lmargin, ++ size_t __rmargin, ++ ssize_t __wmargin); + + /* Flush __FS to its stream, and free it (but don't close the stream). */ + extern void __argp_fmtstream_free (argp_fmtstream_t __fs); + extern void argp_fmtstream_free (argp_fmtstream_t __fs); + + extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs, +- const char *__fmt, ...) +- __attribute__ ((__format__ (printf, 2, 3))); ++ const char *__fmt, ...) ++ _GL_ATTRIBUTE_FORMAT ((printf, 2, 3)); + extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs, +- const char *__fmt, ...) +- __attribute__ ((__format__ (printf, 2, 3))); ++ const char *__fmt, ...) ++ _GL_ATTRIBUTE_FORMAT ((printf, 2, 3)); + ++#if _LIBC || !defined __OPTIMIZE__ + extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); + extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); + +@@ -142,9 +141,10 @@ extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs, + extern int argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str); + + extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs, +- const char *__str, size_t __len); ++ const char *__str, size_t __len); + extern size_t argp_fmtstream_write (argp_fmtstream_t __fs, +- const char *__str, size_t __len); ++ const char *__str, size_t __len); ++#endif + + /* Access macros for various bits of state. */ + #define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin) +@@ -154,27 +154,29 @@ extern size_t argp_fmtstream_write (argp_fmtstream_t __fs, + #define __argp_fmtstream_rmargin argp_fmtstream_rmargin + #define __argp_fmtstream_wmargin argp_fmtstream_wmargin + ++#if _LIBC || !defined __OPTIMIZE__ + /* Set __FS's left margin to LMARGIN and return the old value. */ + extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, +- size_t __lmargin); ++ size_t __lmargin); + extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, +- size_t __lmargin); ++ size_t __lmargin); + + /* Set __FS's right margin to __RMARGIN and return the old value. */ + extern size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, +- size_t __rmargin); ++ size_t __rmargin); + extern size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, +- size_t __rmargin); ++ size_t __rmargin); + + /* Set __FS's wrap margin to __WMARGIN and return the old value. */ + extern size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, +- size_t __wmargin); ++ size_t __wmargin); + extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, +- size_t __wmargin); ++ size_t __wmargin); + + /* Return the column number of the current output point in __FS. */ + extern size_t argp_fmtstream_point (argp_fmtstream_t __fs); + extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs); ++#endif + + /* Internal routines. */ + extern void _argp_fmtstream_update (argp_fmtstream_t __fs); +@@ -198,12 +200,63 @@ extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, + #endif + + #ifndef ARGP_FS_EI +-#define ARGP_FS_EI extern inline ++# ifdef __GNUC__ ++ /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 ++ inline semantics, unless -fgnu89-inline is used. It defines a macro ++ __GNUC_STDC_INLINE__ to indicate this situation or a macro ++ __GNUC_GNU_INLINE__ to indicate the opposite situation. ++ ++ GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline ++ semantics but warns, unless -fgnu89-inline is used: ++ warning: C99 inline functions are not supported; using GNU89 ++ warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute ++ It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. ++ ++ Whereas Apple GCC 4.0.1 build 5479 without -std=c99 or -std=gnu99 ++ implements the GNU C inline semantics and defines the macro ++ __GNUC_GNU_INLINE__, but it does not warn and does not support ++ __attribute__ ((__gnu_inline__)). ++ ++ All in all, these are the possible combinations. For every compiler, ++ we need to choose ARGP_FS_EI so that the corresponding table cell ++ contains an "ok". ++ ++ \ ARGP_FS_EI inline extern extern ++ \ inline inline ++ CC \ __attribute__ ++ ((gnu_inline)) ++ ++ gcc 4.3.0 error ok ok ++ gcc 4.3.0 -std=gnu99 -fgnu89-inline error ok ok ++ gcc 4.3.0 -std=gnu99 ok error ok ++ ++ gcc 4.2.2 error ok ok ++ gcc 4.2.2 -std=gnu99 -fgnu89-inline error ok ok ++ gcc 4.2.2 -std=gnu99 error warning ok ++ ++ gcc 4.1.2 error ok warning ++ gcc 4.1.2 -std=gnu99 error ok warning ++ ++ Apple gcc 4.0.1 error ok warning ++ Apple gcc 4.0.1 -std=gnu99 ok error warning ++ */ ++# if defined __GNUC_STDC_INLINE__ ++# define ARGP_FS_EI inline ++# elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) ++# define ARGP_FS_EI extern inline __attribute__ ((__gnu_inline__)) ++# else ++# define ARGP_FS_EI extern inline ++# endif ++# else ++ /* With other compilers, assume the ISO C99 meaning of 'inline', if ++ the compiler supports 'inline' at all. */ ++# define ARGP_FS_EI inline ++# endif + #endif + + ARGP_FS_EI size_t + __argp_fmtstream_write (argp_fmtstream_t __fs, +- const char *__str, size_t __len) ++ const char *__str, size_t __len) + { + if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len)) + { +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-fs-xinl.c b/xbmc/screensavers/rsxs-0.9/lib/argp-fs-xinl.c +index 3b4c917..8dd679c 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-fs-xinl.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-fs-xinl.c +@@ -1,21 +1,20 @@ + /* Real definitions for extern inline functions in argp-fmtstream.h +- Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc. ++ Copyright (C) 1997, 2003-2004, 2009-2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + #ifdef HAVE_CONFIG_H + # include +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-help.c b/xbmc/screensavers/rsxs-0.9/lib/argp-help.c +index 0dce126..ec7fcda 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-help.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-help.c +@@ -1,24 +1,23 @@ + /* Hierarchial argument parsing help output +- Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc. ++ Copyright (C) 1995-2005, 2007, 2009-2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + #ifndef _GNU_SOURCE +-# define _GNU_SOURCE 1 ++# define _GNU_SOURCE 1 + #endif + + #ifdef HAVE_CONFIG_H +@@ -63,15 +62,15 @@ + UPARAM_NAMES vector, below. */ + + /* Default parameters. */ +-#define DUP_ARGS 0 /* True if option argument can be duplicated. */ +-#define DUP_ARGS_NOTE 1 /* True to print a note about duplicate args. */ +-#define SHORT_OPT_COL 2 /* column in which short options start */ +-#define LONG_OPT_COL 6 /* column in which long options start */ +-#define DOC_OPT_COL 2 /* column in which doc options start */ +-#define OPT_DOC_COL 29 /* column in which option text starts */ +-#define HEADER_COL 1 /* column in which group headers are printed */ +-#define USAGE_INDENT 12 /* indentation of wrapped usage lines */ +-#define RMARGIN 79 /* right margin used for wrapping */ ++#define DUP_ARGS 0 /* True if option argument can be duplicated. */ ++#define DUP_ARGS_NOTE 1 /* True to print a note about duplicate args. */ ++#define SHORT_OPT_COL 2 /* column in which short options start */ ++#define LONG_OPT_COL 6 /* column in which long options start */ ++#define DOC_OPT_COL 2 /* column in which doc options start */ ++#define OPT_DOC_COL 29 /* column in which option text starts */ ++#define HEADER_COL 1 /* column in which group headers are printed */ ++#define USAGE_INDENT 12 /* indentation of wrapped usage lines */ ++#define RMARGIN 79 /* right margin used for wrapping */ + + /* User-selectable (using an environment variable) formatting parameters. + They must all be of type `int' for the parsing code to work. */ +@@ -89,15 +88,15 @@ struct uparams + int dup_args_note; + + /* Various output columns. */ +- int short_opt_col; /* column in which short options start */ +- int long_opt_col; /* column in which long options start */ ++ int short_opt_col; /* column in which short options start */ ++ int long_opt_col; /* column in which long options start */ + int doc_opt_col; /* column in which doc options start */ + int opt_doc_col; /* column in which option text starts */ +- int header_col; /* column in which group headers are printed */ ++ int header_col; /* column in which group headers are printed */ + int usage_indent; /* indentation of wrapped usage lines */ + int rmargin; /* right margin used for wrapping */ + +- int valid; /* True when the values in here are valid. */ ++ int valid; /* True when the values in here are valid. */ + }; + + /* This is a global variable, as user options are only ever read once. */ +@@ -111,9 +110,9 @@ struct uparams + /* A particular uparam, and what the user name is. */ + struct uparam_name + { +- const char *name; /* User name. */ +- int is_bool; /* Whether it's `boolean'. */ +- size_t uparams_offs; /* Location of the (int) field in UPARAMS. */ ++ const char *name; /* User name. */ ++ int is_bool; /* Whether it's `boolean'. */ ++ size_t uparams_offs; /* Location of the (int) field in UPARAMS. */ + }; + + /* The name-field mappings we know about. */ +@@ -139,17 +138,17 @@ struct uparam_name + for (up = uparam_names; up->name; up++) + { + if (up->is_bool +- || up->uparams_offs == offsetof (struct uparams, rmargin)) +- continue; ++ || up->uparams_offs == offsetof (struct uparams, rmargin)) ++ continue; + if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin) +- { +- __argp_failure (state, 0, 0, +- dgettext (state->root_argp->argp_domain, +- "\ ++ { ++ __argp_failure (state, 0, 0, ++ dgettext (state->root_argp->argp_domain, ++ "\ + ARGP_HELP_FMT: %s value is less than or equal to %s"), +- "rmargin", up->name); +- return; +- } ++ "rmargin", up->name); ++ return; ++ } + } + uparams = *upptr; + uparams.valid = 1; +@@ -161,94 +160,94 @@ struct uparam_name + { + const char *var = getenv ("ARGP_HELP_FMT"); + struct uparams new_params = uparams; +- +-#define SKIPWS(p) do { while (isspace (*p)) p++; } while (0); ++ ++#define SKIPWS(p) do { while (isspace ((unsigned char) *p)) p++; } while (0); + + if (var) + { + /* Parse var. */ + while (*var) +- { +- SKIPWS (var); +- +- if (isalpha (*var)) +- { +- size_t var_len; +- const struct uparam_name *un; +- int unspec = 0, val = 0; +- const char *arg = var; +- +- while (isalnum (*arg) || *arg == '-' || *arg == '_') +- arg++; +- var_len = arg - var; +- +- SKIPWS (arg); +- +- if (*arg == '\0' || *arg == ',') +- unspec = 1; +- else if (*arg == '=') +- { +- arg++; +- SKIPWS (arg); +- } +- +- if (unspec) +- { +- if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') +- { +- val = 0; +- var += 3; +- var_len -= 3; +- } +- else +- val = 1; +- } +- else if (isdigit (*arg)) +- { +- val = atoi (arg); +- while (isdigit (*arg)) +- arg++; +- SKIPWS (arg); +- } +- +- for (un = uparam_names; un->name; un++) +- if (strlen (un->name) == var_len +- && strncmp (var, un->name, var_len) == 0) +- { +- if (unspec && !un->is_bool) +- __argp_failure (state, 0, 0, +- dgettext (state->root_argp->argp_domain, +- "\ ++ { ++ SKIPWS (var); ++ ++ if (isalpha ((unsigned char) *var)) ++ { ++ size_t var_len; ++ const struct uparam_name *un; ++ int unspec = 0, val = 0; ++ const char *arg = var; ++ ++ while (isalnum ((unsigned char) *arg) || *arg == '-' || *arg == '_') ++ arg++; ++ var_len = arg - var; ++ ++ SKIPWS (arg); ++ ++ if (*arg == '\0' || *arg == ',') ++ unspec = 1; ++ else if (*arg == '=') ++ { ++ arg++; ++ SKIPWS (arg); ++ } ++ ++ if (unspec) ++ { ++ if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') ++ { ++ val = 0; ++ var += 3; ++ var_len -= 3; ++ } ++ else ++ val = 1; ++ } ++ else if (isdigit ((unsigned char) *arg)) ++ { ++ val = atoi (arg); ++ while (isdigit ((unsigned char) *arg)) ++ arg++; ++ SKIPWS (arg); ++ } ++ ++ for (un = uparam_names; un->name; un++) ++ if (strlen (un->name) == var_len ++ && strncmp (var, un->name, var_len) == 0) ++ { ++ if (unspec && !un->is_bool) ++ __argp_failure (state, 0, 0, ++ dgettext (state->root_argp->argp_domain, ++ "\ + %.*s: ARGP_HELP_FMT parameter requires a value"), +- (int) var_len, var); +- else if (val < 0) +- __argp_failure (state, 0, 0, +- dgettext (state->root_argp->argp_domain, +- "\ ++ (int) var_len, var); ++ else if (val < 0) ++ __argp_failure (state, 0, 0, ++ dgettext (state->root_argp->argp_domain, ++ "\ + %.*s: ARGP_HELP_FMT parameter must be positive"), +- (int) var_len, var); +- else +- *(int *)((char *)&new_params + un->uparams_offs) = val; +- break; +- } +- if (! un->name) +- __argp_failure (state, 0, 0, +- dgettext (state->root_argp->argp_domain, "\ ++ (int) var_len, var); ++ else ++ *(int *)((char *)&new_params + un->uparams_offs) = val; ++ break; ++ } ++ if (! un->name) ++ __argp_failure (state, 0, 0, ++ dgettext (state->root_argp->argp_domain, "\ + %.*s: Unknown ARGP_HELP_FMT parameter"), +- (int) var_len, var); +- +- var = arg; +- if (*var == ',') +- var++; +- } +- else if (*var) +- { +- __argp_failure (state, 0, 0, +- dgettext (state->root_argp->argp_domain, +- "Garbage in ARGP_HELP_FMT: %s"), var); +- break; +- } +- } ++ (int) var_len, var); ++ ++ var = arg; ++ if (*var == ',') ++ var++; ++ } ++ else if (*var) ++ { ++ __argp_failure (state, 0, 0, ++ dgettext (state->root_argp->argp_domain, ++ "Garbage in ARGP_HELP_FMT: %s"), var); ++ break; ++ } ++ } + validate_uparams (state, &new_params); + } + } +@@ -260,7 +259,7 @@ struct uparam_name + /* Returns true if OPT is an alias for an earlier option. */ + #define oalias(opt) ((opt)->flags & OPTION_ALIAS) + +-/* Returns true if OPT is an documentation-only entry. */ ++/* Returns true if OPT is a documentation-only entry. */ + #define odoc(opt) ((opt)->flags & OPTION_DOC) + + /* Returns true if OPT should not be translated */ +@@ -288,22 +287,22 @@ struct uparam_name + For example, the following output (from ps): + + -p PID, --pid=PID List the process PID +- --pgrp=PGRP List processes in the process group PGRP ++ --pgrp=PGRP List processes in the process group PGRP + -P, -x, --no-parent Include processes without parents + -Q, --all-fields Don't elide unusable fields (normally if there's +- some reason ps can't print a field for any +- process, it's removed from the output entirely) ++ some reason ps can't print a field for any ++ process, it's removed from the output entirely) + -r, --reverse, --gratuitously-long-reverse-option +- Reverse the order of any sort +- --session[=SID] Add the processes from the session SID (which +- defaults to the sid of the current process) ++ Reverse the order of any sort ++ --session[=SID] Add the processes from the session SID (which ++ defaults to the sid of the current process) + + Here are some more options: + -f ZOT, --foonly=ZOT Glork a foonly + -z, --zaza Snit a zar + + -?, --help Give this help list +- --usage Give a short usage message ++ --usage Give a short usage message + -V, --version Print program version + + The struct argp_option array for the above could look like: +@@ -311,18 +310,18 @@ struct uparam_name + { + {"pid", 'p', "PID", 0, "List the process PID"}, + {"pgrp", OPT_PGRP, "PGRP", 0, "List processes in the process group PGRP"}, +- {"no-parent", 'P', 0, 0, "Include processes without parents"}, ++ {"no-parent", 'P', 0, 0, "Include processes without parents"}, + {0, 'x', 0, OPTION_ALIAS}, + {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally" + " if there's some reason ps can't" +- " print a field for any process, it's" ++ " print a field for any process, it's" + " removed from the output entirely)" }, + {"reverse", 'r', 0, 0, "Reverse the order of any sort"}, + {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS}, + {"session", OPT_SESS, "SID", OPTION_ARG_OPTIONAL, + "Add the processes from the session" +- " SID (which defaults to the sid of" +- " the current process)" }, ++ " SID (which defaults to the sid of" ++ " the current process)" }, + + {0,0,0,0, "Here are some more options:"}, + {"foonly", 'f', "ZOT", 0, "Glork a foonly"}, +@@ -348,7 +347,7 @@ struct uparam_name + return 0; + } + +-struct hol_cluster; /* fwd decl */ ++struct hol_cluster; /* fwd decl */ + + struct hol_entry + { +@@ -360,7 +359,7 @@ struct hol_entry + /* A pointers into the HOL's short_options field, to the first short option + letter for this entry. The order of the characters following this point + corresponds to the order of options pointed to by OPT, and there are at +- most NUM. A short option recorded in a option following OPT is only ++ most NUM. A short option recorded in an option following OPT is only + valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's + probably been shadowed by some other entry). */ + char *short_options; +@@ -375,6 +374,9 @@ struct hol_entry + + /* The argp from which this option came. */ + const struct argp *argp; ++ ++ /* Position in the array */ ++ unsigned ord; + }; + + /* A cluster of entries to reflect the argp tree structure. */ +@@ -450,47 +452,47 @@ struct hol + + /* Calculate the space needed. */ + for (o = opts; ! oend (o); o++) +- { +- if (! oalias (o)) +- hol->num_entries++; +- if (oshort (o)) +- num_short_options++; /* This is an upper bound. */ +- } ++ { ++ if (! oalias (o)) ++ hol->num_entries++; ++ if (oshort (o)) ++ num_short_options++; /* This is an upper bound. */ ++ } + + hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries); + hol->short_options = malloc (num_short_options + 1); + + assert (hol->entries && hol->short_options); + if (SIZE_MAX <= UINT_MAX) +- assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry)); ++ assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry)); + + /* Fill in the entries. */ + so = hol->short_options; + for (o = opts, entry = hol->entries; ! oend (o); entry++) +- { +- entry->opt = o; +- entry->num = 0; +- entry->short_options = so; +- entry->group = cur_group = +- o->group +- ? o->group +- : ((!o->name && !o->key) +- ? cur_group + 1 +- : cur_group); +- entry->cluster = cluster; +- entry->argp = argp; +- +- do +- { +- entry->num++; +- if (oshort (o) && ! find_char (o->key, hol->short_options, so)) +- /* O has a valid short option which hasn't already been used.*/ +- *so++ = o->key; +- o++; +- } +- while (! oend (o) && oalias (o)); +- } +- *so = '\0'; /* null terminated so we can find the length */ ++ { ++ entry->opt = o; ++ entry->num = 0; ++ entry->short_options = so; ++ entry->group = cur_group = ++ o->group ++ ? o->group ++ : ((!o->name && !o->key) ++ ? cur_group + 1 ++ : cur_group); ++ entry->cluster = cluster; ++ entry->argp = argp; ++ ++ do ++ { ++ entry->num++; ++ if (oshort (o) && ! find_char (o->key, hol->short_options, so)) ++ /* O has a valid short option which hasn't already been used.*/ ++ *so++ = o->key; ++ o++; ++ } ++ while (! oend (o) && oalias (o)); ++ } ++ *so = '\0'; /* null terminated so we can find the length */ + } + + return hol; +@@ -501,7 +503,7 @@ struct hol + to it. ARGP is the argp that this cluster results from. */ + static struct hol_cluster * + hol_add_cluster (struct hol *hol, int group, const char *header, int index, +- struct hol_cluster *parent, const struct argp *argp) ++ struct hol_cluster *parent, const struct argp *argp) + { + struct hol_cluster *cl = malloc (sizeof (struct hol_cluster)); + if (cl) +@@ -544,10 +546,10 @@ struct hol + + static int + hol_entry_short_iterate (const struct hol_entry *entry, +- int (*func)(const struct argp_option *opt, +- const struct argp_option *real, +- const char *domain, void *cookie), +- const char *domain, void *cookie) ++ int (*func)(const struct argp_option *opt, ++ const struct argp_option *real, ++ const char *domain, void *cookie), ++ const char *domain, void *cookie) + { + unsigned nopts; + int val = 0; +@@ -557,23 +559,25 @@ struct hol + for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--) + if (oshort (opt) && *so == opt->key) + { +- if (!oalias (opt)) +- real = opt; +- if (ovisible (opt)) +- val = (*func)(opt, real, domain, cookie); +- so++; ++ if (!oalias (opt)) ++ real = opt; ++ if (ovisible (opt)) ++ val = (*func)(opt, real, domain, cookie); ++ so++; + } + + return val; + } + + static inline int ++#if __GNUC__ >= 3 + __attribute__ ((always_inline)) ++#endif + hol_entry_long_iterate (const struct hol_entry *entry, +- int (*func)(const struct argp_option *opt, +- const struct argp_option *real, +- const char *domain, void *cookie), +- const char *domain, void *cookie) ++ int (*func)(const struct argp_option *opt, ++ const struct argp_option *real, ++ const char *domain, void *cookie), ++ const char *domain, void *cookie) + { + unsigned nopts; + int val = 0; +@@ -582,19 +586,19 @@ struct hol + for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--) + if (opt->name) + { +- if (!oalias (opt)) +- real = opt; +- if (ovisible (opt)) +- val = (*func)(opt, real, domain, cookie); ++ if (!oalias (opt)) ++ real = opt; ++ if (ovisible (opt)) ++ val = (*func)(opt, real, domain, cookie); + } + + return val; + } + + /* Iterator that returns true for the first short option. */ +-static inline int ++static int + until_short (const struct argp_option *opt, const struct argp_option *real, +- const char *domain, void *cookie) ++ const char *domain, void *cookie) + { + return oshort (opt) ? opt->key : 0; + } +@@ -604,7 +608,7 @@ struct hol + hol_entry_first_short (const struct hol_entry *entry) + { + return hol_entry_short_iterate (entry, until_short, +- entry->argp->argp_domain, 0); ++ entry->argp->argp_domain, 0); + } + + /* Returns the first valid long option in ENTRY, or 0 if there is none. */ +@@ -633,10 +637,10 @@ struct hol + unsigned num_opts = entry->num; + + while (num_opts-- > 0) +- if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0) +- return entry; +- else +- opt++; ++ if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0) ++ return entry; ++ else ++ opt++; + + entry++; + } +@@ -673,10 +677,12 @@ struct hol + hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2) + { + /* If one cluster is deeper than the other, use its ancestor at the same +- level, so that finding the common ancestor is straightforward. */ +- while (cl1->depth < cl2->depth) ++ level, so that finding the common ancestor is straightforward. ++ ++ clN->depth > 0 means that clN->parent != NULL (see hol_add_cluster) */ ++ while (cl1->depth > cl2->depth) + cl1 = cl1->parent; +- while (cl2->depth < cl1->depth) ++ while (cl2->depth > cl1->depth) + cl2 = cl2->parent; + + /* Now reduce both clusters to their ancestors at the point where both have +@@ -700,14 +706,14 @@ struct hol + /* Return true if CL1 is a child of CL2. */ + static int + hol_cluster_is_child (const struct hol_cluster *cl1, +- const struct hol_cluster *cl2) ++ const struct hol_cluster *cl2) + { + while (cl1 && cl1 != cl2) + cl1 = cl1->parent; + return cl1 == cl2; + } + +-/* Given the name of a OPTION_DOC option, modifies NAME to start at the tail ++/* Given the name of an OPTION_DOC option, modifies NAME to start at the tail + that should be used for comparisons, and returns true iff it should be + treated as a non-option. */ + static int +@@ -720,43 +726,47 @@ struct hol + else + { + /* Skip initial whitespace. */ +- while (isspace (**name)) +- (*name)++; ++ while (isspace ((unsigned char) **name)) ++ (*name)++; + /* Decide whether this looks like an option (leading `-') or not. */ + non_opt = (**name != '-'); + /* Skip until part of name used for sorting. */ +- while (**name && !isalnum (**name)) +- (*name)++; ++ while (**name && !isalnum ((unsigned char) **name)) ++ (*name)++; + } + return non_opt; + } + ++#define HOL_ENTRY_PTRCMP(a,b) ((a)->ord < (b)->ord ? -1 : 1) ++ + /* Order ENTRY1 & ENTRY2 by the order which they should appear in a help + listing. */ + static int + hol_entry_cmp (const struct hol_entry *entry1, +- const struct hol_entry *entry2) ++ const struct hol_entry *entry2) + { + /* The group numbers by which the entries should be ordered; if either is + in a cluster, then this is just the group within the cluster. */ + int group1 = entry1->group, group2 = entry2->group; ++ int rc; + + if (entry1->cluster != entry2->cluster) + { + /* The entries are not within the same cluster, so we can't compare them +- directly, we have to use the appropiate clustering level too. */ ++ directly, we have to use the appropiate clustering level too. */ + if (! entry1->cluster) +- /* ENTRY1 is at the `base level', not in a cluster, so we have to +- compare it's group number with that of the base cluster in which +- ENTRY2 resides. Note that if they're in the same group, the +- clustered option always comes laster. */ +- return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1); ++ /* ENTRY1 is at the `base level', not in a cluster, so we have to ++ compare it's group number with that of the base cluster in which ++ ENTRY2 resides. Note that if they're in the same group, the ++ clustered option always comes laster. */ ++ return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1); + else if (! entry2->cluster) +- /* Likewise, but ENTRY2's not in a cluster. */ +- return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1); ++ /* Likewise, but ENTRY2's not in a cluster. */ ++ return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1); + else +- /* Both entries are in clusters, we can just compare the clusters. */ +- return hol_cluster_cmp (entry1->cluster, entry2->cluster); ++ /* Both entries are in clusters, we can just compare the clusters. */ ++ return (rc = hol_cluster_cmp (entry1->cluster, entry2->cluster)) ? ++ rc : HOL_ENTRY_PTRCMP (entry1, entry2); + } + else if (group1 == group2) + /* The entries are both in the same cluster and group, so compare them +@@ -770,40 +780,41 @@ struct hol + const char *long2 = hol_entry_first_long (entry2); + + if (doc1) +- doc1 = canon_doc_option (&long1); ++ doc1 = canon_doc_option (&long1); + if (doc2) +- doc2 = canon_doc_option (&long2); ++ doc2 = canon_doc_option (&long2); + + if (doc1 != doc2) +- /* `documentation' options always follow normal options (or +- documentation options that *look* like normal options). */ +- return doc1 - doc2; ++ /* `documentation' options always follow normal options (or ++ documentation options that *look* like normal options). */ ++ return doc1 - doc2; + else if (!short1 && !short2 && long1 && long2) +- /* Only long options. */ +- return __strcasecmp (long1, long2); ++ /* Only long options. */ ++ return (rc = __strcasecmp (long1, long2)) ? ++ rc : HOL_ENTRY_PTRCMP (entry1, entry2); + else +- /* Compare short/short, long/short, short/long, using the first +- character of long options. Entries without *any* valid +- options (such as options with OPTION_HIDDEN set) will be put +- first, but as they're not displayed, it doesn't matter where +- they are. */ +- { +- char first1 = short1 ? short1 : long1 ? *long1 : 0; +- char first2 = short2 ? short2 : long2 ? *long2 : 0; +-#ifdef _tolower +- int lower_cmp = _tolower (first1) - _tolower (first2); +-#else +- int lower_cmp = tolower (first1) - tolower (first2); +-#endif +- /* Compare ignoring case, except when the options are both the +- same letter, in which case lower-case always comes first. */ +- return lower_cmp ? lower_cmp : first2 - first1; +- } ++ /* Compare short/short, long/short, short/long, using the first ++ character of long options. Entries without *any* valid ++ options (such as options with OPTION_HIDDEN set) will be put ++ first, but as they're not displayed, it doesn't matter where ++ they are. */ ++ { ++ unsigned char first1 = short1 ? short1 : long1 ? *long1 : 0; ++ unsigned char first2 = short2 ? short2 : long2 ? *long2 : 0; ++ /* Use tolower, not _tolower, since only the former is ++ guaranteed to work on something already lower case. */ ++ int lower_cmp = tolower (first1) - tolower (first2); ++ /* Compare ignoring case, except when the options are both the ++ same letter, in which case lower-case always comes first. */ ++ return lower_cmp ? lower_cmp : ++ (rc = first2 - first1) ? ++ rc : HOL_ENTRY_PTRCMP (entry1, entry2); ++ } + } + else + /* Within the same cluster, but not the same group, so just compare + groups. */ +- return group_cmp (group1, group2, 0); ++ return group_cmp (group1, group2, HOL_ENTRY_PTRCMP (entry1, entry2)); + } + + /* Version of hol_entry_cmp with correct signature for qsort. */ +@@ -820,8 +831,14 @@ struct hol + hol_sort (struct hol *hol) + { + if (hol->num_entries > 0) +- qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry), +- hol_entry_qcmp); ++ { ++ unsigned i; ++ struct hol_entry *e; ++ for (i = 0, e = hol->entries; i < hol->num_entries; i++, e++) ++ e->ord = i; ++ qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry), ++ hol_entry_qcmp); ++ } + } + + /* Append MORE to HOL, destroying MORE in the process. Options in HOL shadow +@@ -841,77 +858,78 @@ struct hol + if (more->num_entries > 0) + { + if (hol->num_entries == 0) +- { +- hol->num_entries = more->num_entries; +- hol->entries = more->entries; +- hol->short_options = more->short_options; +- more->num_entries = 0; /* Mark MORE's fields as invalid. */ +- } ++ { ++ hol->num_entries = more->num_entries; ++ hol->entries = more->entries; ++ hol->short_options = more->short_options; ++ more->num_entries = 0; /* Mark MORE's fields as invalid. */ ++ } + else +- /* Append the entries in MORE to those in HOL, taking care to only add +- non-shadowed SHORT_OPTIONS values. */ +- { +- unsigned left; +- char *so, *more_so; +- struct hol_entry *e; +- unsigned num_entries = hol->num_entries + more->num_entries; +- struct hol_entry *entries = +- malloc (num_entries * sizeof (struct hol_entry)); +- unsigned hol_so_len = strlen (hol->short_options); +- char *short_options = +- malloc (hol_so_len + strlen (more->short_options) + 1); +- +- assert (entries && short_options); +- if (SIZE_MAX <= UINT_MAX) +- assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry)); +- +- __mempcpy (__mempcpy (entries, hol->entries, +- hol->num_entries * sizeof (struct hol_entry)), +- more->entries, +- more->num_entries * sizeof (struct hol_entry)); +- +- __mempcpy (short_options, hol->short_options, hol_so_len); +- +- /* Fix up the short options pointers from HOL. */ +- for (e = entries, left = hol->num_entries; left > 0; e++, left--) +- e->short_options += (short_options - hol->short_options); +- +- /* Now add the short options from MORE, fixing up its entries +- too. */ +- so = short_options + hol_so_len; +- more_so = more->short_options; +- for (left = more->num_entries; left > 0; e++, left--) +- { +- int opts_left; +- const struct argp_option *opt; +- +- e->short_options = so; +- +- for (opts_left = e->num, opt = e->opt; opts_left; opt++, opts_left--) +- { +- int ch = *more_so; +- if (oshort (opt) && ch == opt->key) +- /* The next short option in MORE_SO, CH, is from OPT. */ +- { +- if (! find_char (ch, short_options, +- short_options + hol_so_len)) +- /* The short option CH isn't shadowed by HOL's options, +- so add it to the sum. */ +- *so++ = ch; +- more_so++; +- } +- } +- } +- +- *so = '\0'; +- +- free (hol->entries); +- free (hol->short_options); +- +- hol->entries = entries; +- hol->num_entries = num_entries; +- hol->short_options = short_options; +- } ++ /* Append the entries in MORE to those in HOL, taking care to only add ++ non-shadowed SHORT_OPTIONS values. */ ++ { ++ unsigned left; ++ char *so, *more_so; ++ struct hol_entry *e; ++ unsigned num_entries = hol->num_entries + more->num_entries; ++ struct hol_entry *entries = ++ malloc (num_entries * sizeof (struct hol_entry)); ++ unsigned hol_so_len = strlen (hol->short_options); ++ char *short_options = ++ malloc (hol_so_len + strlen (more->short_options) + 1); ++ ++ assert (entries && short_options); ++ if (SIZE_MAX <= UINT_MAX) ++ assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry)); ++ ++ __mempcpy (__mempcpy (entries, hol->entries, ++ hol->num_entries * sizeof (struct hol_entry)), ++ more->entries, ++ more->num_entries * sizeof (struct hol_entry)); ++ ++ __mempcpy (short_options, hol->short_options, hol_so_len); ++ ++ /* Fix up the short options pointers from HOL. */ ++ for (e = entries, left = hol->num_entries; left > 0; e++, left--) ++ e->short_options = ++ short_options + (e->short_options - hol->short_options); ++ ++ /* Now add the short options from MORE, fixing up its entries ++ too. */ ++ so = short_options + hol_so_len; ++ more_so = more->short_options; ++ for (left = more->num_entries; left > 0; e++, left--) ++ { ++ int opts_left; ++ const struct argp_option *opt; ++ ++ e->short_options = so; ++ ++ for (opts_left = e->num, opt = e->opt; opts_left; opt++, opts_left--) ++ { ++ int ch = *more_so; ++ if (oshort (opt) && ch == opt->key) ++ /* The next short option in MORE_SO, CH, is from OPT. */ ++ { ++ if (! find_char (ch, short_options, ++ short_options + hol_so_len)) ++ /* The short option CH isn't shadowed by HOL's options, ++ so add it to the sum. */ ++ *so++ = ch; ++ more_so++; ++ } ++ } ++ } ++ ++ *so = '\0'; ++ ++ free (hol->entries); ++ free (hol->short_options); ++ ++ hol->entries = entries; ++ hol->num_entries = num_entries; ++ hol->short_options = short_options; ++ } + } + + hol_free (more); +@@ -948,11 +966,11 @@ struct hol + if (real->arg) + { + if (real->flags & OPTION_ARG_OPTIONAL) +- __argp_fmtstream_printf (stream, opt_fmt, +- dgettext (domain, real->arg)); ++ __argp_fmtstream_printf (stream, opt_fmt, ++ dgettext (domain, real->arg)); + else +- __argp_fmtstream_printf (stream, req_fmt, +- dgettext (domain, real->arg)); ++ __argp_fmtstream_printf (stream, req_fmt, ++ dgettext (domain, real->arg)); + } + } + +@@ -992,7 +1010,7 @@ struct pentry_state + /* If a user doc filter should be applied to DOC, do so. */ + static const char * + filter_doc (const char *doc, int key, const struct argp *argp, +- const struct argp_state *state) ++ const struct argp_state *state) + { + if (argp->help_filter) + /* We must apply a user filter to this output. */ +@@ -1012,7 +1030,7 @@ struct pentry_state + to 0. */ + static void + print_header (const char *str, const struct argp *argp, +- struct pentry_state *pest) ++ struct pentry_state *pest) + { + const char *tstr = dgettext (argp->argp_domain, str); + const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest->state); +@@ -1020,17 +1038,17 @@ struct pentry_state + if (fstr) + { + if (*fstr) +- { +- if (pest->hhstate->prev_entry) +- /* Precede with a blank line. */ +- __argp_fmtstream_putc (pest->stream, '\n'); +- indent_to (pest->stream, uparams.header_col); +- __argp_fmtstream_set_lmargin (pest->stream, uparams.header_col); +- __argp_fmtstream_set_wmargin (pest->stream, uparams.header_col); +- __argp_fmtstream_puts (pest->stream, fstr); +- __argp_fmtstream_set_lmargin (pest->stream, 0); +- __argp_fmtstream_putc (pest->stream, '\n'); +- } ++ { ++ if (pest->hhstate->prev_entry) ++ /* Precede with a blank line. */ ++ __argp_fmtstream_putc (pest->stream, '\n'); ++ indent_to (pest->stream, uparams.header_col); ++ __argp_fmtstream_set_lmargin (pest->stream, uparams.header_col); ++ __argp_fmtstream_set_wmargin (pest->stream, uparams.header_col); ++ __argp_fmtstream_puts (pest->stream, fstr); ++ __argp_fmtstream_set_lmargin (pest->stream, 0); ++ __argp_fmtstream_putc (pest->stream, '\n'); ++ } + + pest->hhstate->sep_groups = 1; /* Separate subsequent groups. */ + } +@@ -1052,21 +1070,21 @@ struct pentry_state + const struct hol_cluster *cl = pest->entry->cluster; + + if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group) +- __argp_fmtstream_putc (pest->stream, '\n'); ++ __argp_fmtstream_putc (pest->stream, '\n'); + + if (cl && cl->header && *cl->header +- && (!pe +- || (pe->cluster != cl +- && !hol_cluster_is_child (pe->cluster, cl)))) +- /* If we're changing clusters, then this must be the start of the +- ENTRY's cluster unless that is an ancestor of the previous one +- (in which case we had just popped into a sub-cluster for a bit). +- If so, then print the cluster's header line. */ +- { +- int old_wm = __argp_fmtstream_wmargin (pest->stream); +- print_header (cl->header, cl->argp, pest); +- __argp_fmtstream_set_wmargin (pest->stream, old_wm); +- } ++ && (!pe ++ || (pe->cluster != cl ++ && !hol_cluster_is_child (pe->cluster, cl)))) ++ /* If we're changing clusters, then this must be the start of the ++ ENTRY's cluster unless that is an ancestor of the previous one ++ (in which case we had just popped into a sub-cluster for a bit). ++ If so, then print the cluster's header line. */ ++ { ++ int old_wm = __argp_fmtstream_wmargin (pest->stream); ++ print_header (cl->header, cl->argp, pest); ++ __argp_fmtstream_set_wmargin (pest->stream, old_wm); ++ } + + pest->first = 0; + } +@@ -1079,12 +1097,12 @@ struct pentry_state + /* Print help for ENTRY to STREAM. */ + static void + hol_entry_help (struct hol_entry *entry, const struct argp_state *state, +- argp_fmtstream_t stream, struct hol_help_state *hhstate) ++ argp_fmtstream_t stream, struct hol_help_state *hhstate) + { + unsigned num; + const struct argp_option *real = entry->opt, *opt; + char *so = entry->short_options; +- int have_long_opt = 0; /* We have any long options. */ ++ int have_long_opt = 0; /* We have any long options. */ + /* Saved margins. */ + int old_lm = __argp_fmtstream_set_lmargin (stream, 0); + int old_wm = __argp_fmtstream_wmargin (stream); +@@ -1101,10 +1119,10 @@ struct pentry_state + if (! odoc (real)) + for (opt = real, num = entry->num; num > 0; opt++, num--) + if (opt->name && ovisible (opt)) +- { +- have_long_opt = 1; +- break; +- } ++ { ++ have_long_opt = 1; ++ break; ++ } + + /* First emit short options. */ + __argp_fmtstream_set_wmargin (stream, uparams.short_opt_col); /* For truly bizarre cases. */ +@@ -1112,17 +1130,17 @@ struct pentry_state + if (oshort (opt) && opt->key == *so) + /* OPT has a valid (non shadowed) short option. */ + { +- if (ovisible (opt)) +- { +- comma (uparams.short_opt_col, &pest); +- __argp_fmtstream_putc (stream, '-'); +- __argp_fmtstream_putc (stream, *so); +- if (!have_long_opt || uparams.dup_args) +- arg (real, " %s", "[%s]", state->root_argp->argp_domain, stream); +- else if (real->arg) +- hhstate->suppressed_dup_arg = 1; +- } +- so++; ++ if (ovisible (opt)) ++ { ++ comma (uparams.short_opt_col, &pest); ++ __argp_fmtstream_putc (stream, '-'); ++ __argp_fmtstream_putc (stream, *so); ++ if (!have_long_opt || uparams.dup_args) ++ arg (real, " %s", "[%s]", state->root_argp->argp_domain, stream); ++ else if (real->arg) ++ hhstate->suppressed_dup_arg = 1; ++ } ++ so++; + } + + /* Now, long options. */ +@@ -1131,18 +1149,18 @@ struct pentry_state + { + __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col); + for (opt = real, num = entry->num; num > 0; opt++, num--) +- if (opt->name && *opt->name && ovisible (opt)) +- { +- comma (uparams.doc_opt_col, &pest); +- /* Calling dgettext here isn't quite right, since sorting will +- have been done on the original; but documentation options +- should be pretty rare anyway... */ +- __argp_fmtstream_puts (stream, +- onotrans (opt) ? +- opt->name : +- dgettext (state->root_argp->argp_domain, +- opt->name)); +- } ++ if (opt->name && *opt->name && ovisible (opt)) ++ { ++ comma (uparams.doc_opt_col, &pest); ++ /* Calling dgettext here isn't quite right, since sorting will ++ have been done on the original; but documentation options ++ should be pretty rare anyway... */ ++ __argp_fmtstream_puts (stream, ++ onotrans (opt) ? ++ opt->name : ++ dgettext (state->root_argp->argp_domain, ++ opt->name)); ++ } + } + else + /* A real long option. */ +@@ -1151,16 +1169,16 @@ struct pentry_state + + __argp_fmtstream_set_wmargin (stream, uparams.long_opt_col); + for (opt = real, num = entry->num; num > 0; opt++, num--) +- if (opt->name && ovisible (opt)) +- { +- comma (uparams.long_opt_col, &pest); +- __argp_fmtstream_printf (stream, "--%s", opt->name); +- if (first_long_opt || uparams.dup_args) +- arg (real, "=%s", "[=%s]", state->root_argp->argp_domain, +- stream); +- else if (real->arg) +- hhstate->suppressed_dup_arg = 1; +- } ++ if (opt->name && ovisible (opt)) ++ { ++ comma (uparams.long_opt_col, &pest); ++ __argp_fmtstream_printf (stream, "--%s", opt->name); ++ if (first_long_opt || uparams.dup_args) ++ arg (real, "=%s", "[=%s]", state->root_argp->argp_domain, ++ stream); ++ else if (real->arg) ++ hhstate->suppressed_dup_arg = 1; ++ } + } + + /* Next, documentation strings. */ +@@ -1170,35 +1188,35 @@ struct pentry_state + { + /* Didn't print any switches, what's up? */ + if (!oshort (real) && !real->name) +- /* This is a group header, print it nicely. */ +- print_header (real->doc, entry->argp, &pest); ++ /* This is a group header, print it nicely. */ ++ print_header (real->doc, entry->argp, &pest); + else +- /* Just a totally shadowed option or null header; print nothing. */ +- goto cleanup; /* Just return, after cleaning up. */ ++ /* Just a totally shadowed option or null header; print nothing. */ ++ goto cleanup; /* Just return, after cleaning up. */ + } + else + { + const char *tstr = real->doc ? dgettext (state->root_argp->argp_domain, +- real->doc) : 0; ++ real->doc) : 0; + const char *fstr = filter_doc (tstr, real->key, entry->argp, state); + if (fstr && *fstr) +- { +- unsigned int col = __argp_fmtstream_point (stream); ++ { ++ unsigned int col = __argp_fmtstream_point (stream); + +- __argp_fmtstream_set_lmargin (stream, uparams.opt_doc_col); +- __argp_fmtstream_set_wmargin (stream, uparams.opt_doc_col); ++ __argp_fmtstream_set_lmargin (stream, uparams.opt_doc_col); ++ __argp_fmtstream_set_wmargin (stream, uparams.opt_doc_col); + +- if (col > (unsigned int) (uparams.opt_doc_col + 3)) +- __argp_fmtstream_putc (stream, '\n'); +- else if (col >= (unsigned int) uparams.opt_doc_col) +- __argp_fmtstream_puts (stream, " "); +- else +- indent_to (stream, uparams.opt_doc_col); ++ if (col > (unsigned int) (uparams.opt_doc_col + 3)) ++ __argp_fmtstream_putc (stream, '\n'); ++ else if (col >= (unsigned int) uparams.opt_doc_col) ++ __argp_fmtstream_puts (stream, " "); ++ else ++ indent_to (stream, uparams.opt_doc_col); + +- __argp_fmtstream_puts (stream, fstr); +- } ++ __argp_fmtstream_puts (stream, fstr); ++ } + if (fstr && fstr != tstr) +- free ((char *) fstr); ++ free ((char *) fstr); + + /* Reset the left margin. */ + __argp_fmtstream_set_lmargin (stream, 0); +@@ -1215,7 +1233,7 @@ struct pentry_state + /* Output a long help message about the options in HOL to STREAM. */ + static void + hol_help (struct hol *hol, const struct argp_state *state, +- argp_fmtstream_t stream) ++ argp_fmtstream_t stream) + { + unsigned num; + struct hol_entry *entry; +@@ -1230,15 +1248,15 @@ struct pentry_state + Mandatory or optional arguments to long options are also mandatory or \ + optional for any corresponding short options."); + const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE, +- state ? state->root_argp : 0, state); ++ state ? state->root_argp : 0, state); + if (fstr && *fstr) +- { +- __argp_fmtstream_putc (stream, '\n'); +- __argp_fmtstream_puts (stream, fstr); +- __argp_fmtstream_putc (stream, '\n'); +- } ++ { ++ __argp_fmtstream_putc (stream, '\n'); ++ __argp_fmtstream_puts (stream, fstr); ++ __argp_fmtstream_putc (stream, '\n'); ++ } + if (fstr && fstr != tstr) +- free ((char *) fstr); ++ free ((char *) fstr); + } + } + +@@ -1248,8 +1266,8 @@ struct pentry_state + pointer pointer to by COOKIE, and advance the pointer. */ + static int + add_argless_short_opt (const struct argp_option *opt, +- const struct argp_option *real, +- const char *domain, void *cookie) ++ const struct argp_option *real, ++ const char *domain, void *cookie) + { + char **snao_end = cookie; + if (!(opt->arg || real->arg) +@@ -1262,8 +1280,8 @@ struct pentry_state + stream pointed at by COOKIE. */ + static int + usage_argful_short_opt (const struct argp_option *opt, +- const struct argp_option *real, +- const char *domain, void *cookie) ++ const struct argp_option *real, ++ const char *domain, void *cookie) + { + argp_fmtstream_t stream = cookie; + const char *arg = opt->arg; +@@ -1277,14 +1295,14 @@ struct pentry_state + arg = dgettext (domain, arg); + + if (flags & OPTION_ARG_OPTIONAL) +- __argp_fmtstream_printf (stream, " [-%c[%s]]", opt->key, arg); ++ __argp_fmtstream_printf (stream, " [-%c[%s]]", opt->key, arg); + else +- { +- /* Manually do line wrapping so that it (probably) won't +- get wrapped at the embedded space. */ +- space (stream, 6 + strlen (arg)); +- __argp_fmtstream_printf (stream, "[-%c %s]", opt->key, arg); +- } ++ { ++ /* Manually do line wrapping so that it (probably) won't ++ get wrapped at the embedded space. */ ++ space (stream, 6 + strlen (arg)); ++ __argp_fmtstream_printf (stream, "[-%c %s]", opt->key, arg); ++ } + } + + return 0; +@@ -1294,8 +1312,8 @@ struct pentry_state + COOKIE. */ + static int + usage_long_opt (const struct argp_option *opt, +- const struct argp_option *real, +- const char *domain, void *cookie) ++ const struct argp_option *real, ++ const char *domain, void *cookie) + { + argp_fmtstream_t stream = cookie; + const char *arg = opt->arg; +@@ -1307,15 +1325,15 @@ struct pentry_state + if (! (flags & OPTION_NO_USAGE) && !odoc (opt)) + { + if (arg) +- { +- arg = dgettext (domain, arg); +- if (flags & OPTION_ARG_OPTIONAL) +- __argp_fmtstream_printf (stream, " [--%s[=%s]]", opt->name, arg); +- else +- __argp_fmtstream_printf (stream, " [--%s=%s]", opt->name, arg); +- } ++ { ++ arg = dgettext (domain, arg); ++ if (flags & OPTION_ARG_OPTIONAL) ++ __argp_fmtstream_printf (stream, " [--%s[=%s]]", opt->name, arg); ++ else ++ __argp_fmtstream_printf (stream, " [--%s=%s]", opt->name, arg); ++ } + else +- __argp_fmtstream_printf (stream, " [--%s]", opt->name); ++ __argp_fmtstream_printf (stream, " [--%s]", opt->name); + } + + return 0; +@@ -1334,29 +1352,29 @@ struct pentry_state + + /* First we put a list of short options without arguments. */ + for (entry = hol->entries, nentries = hol->num_entries +- ; nentries > 0 +- ; entry++, nentries--) +- hol_entry_short_iterate (entry, add_argless_short_opt, +- entry->argp->argp_domain, &snao_end); ++ ; nentries > 0 ++ ; entry++, nentries--) ++ hol_entry_short_iterate (entry, add_argless_short_opt, ++ entry->argp->argp_domain, &snao_end); + if (snao_end > short_no_arg_opts) +- { +- *snao_end++ = 0; +- __argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts); +- } ++ { ++ *snao_end++ = 0; ++ __argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts); ++ } + + /* Now a list of short options *with* arguments. */ + for (entry = hol->entries, nentries = hol->num_entries +- ; nentries > 0 +- ; entry++, nentries--) +- hol_entry_short_iterate (entry, usage_argful_short_opt, +- entry->argp->argp_domain, stream); ++ ; nentries > 0 ++ ; entry++, nentries--) ++ hol_entry_short_iterate (entry, usage_argful_short_opt, ++ entry->argp->argp_domain, stream); + + /* Finally, a list of long options (whew!). */ + for (entry = hol->entries, nentries = hol->num_entries +- ; nentries > 0 +- ; entry++, nentries--) +- hol_entry_long_iterate (entry, usage_long_opt, +- entry->argp->argp_domain, stream); ++ ; nentries > 0 ++ ; entry++, nentries--) ++ hol_entry_long_iterate (entry, usage_long_opt, ++ entry->argp->argp_domain, stream); + } + } + +@@ -1370,15 +1388,15 @@ struct pentry_state + if (child) + while (child->argp) + { +- struct hol_cluster *child_cluster = +- ((child->group || child->header) +- /* Put CHILD->argp within its own cluster. */ +- ? hol_add_cluster (hol, child->group, child->header, +- child - argp->children, cluster, argp) +- /* Just merge it into the parent's cluster. */ +- : cluster); +- hol_append (hol, argp_hol (child->argp, child_cluster)) ; +- child++; ++ struct hol_cluster *child_cluster = ++ ((child->group || child->header) ++ /* Put CHILD->argp within its own cluster. */ ++ ? hol_add_cluster (hol, child->group, child->header, ++ child - argp->children, cluster, argp) ++ /* Just merge it into the parent's cluster. */ ++ : cluster); ++ hol_append (hol, argp_hol (child->argp, child_cluster)) ; ++ child++; + } + return hol; + } +@@ -1408,7 +1426,7 @@ struct pentry_state + returned as long as there are more patterns to output. */ + static int + argp_args_usage (const struct argp *argp, const struct argp_state *state, +- char **levels, int advance, argp_fmtstream_t stream) ++ char **levels, int advance, argp_fmtstream_t stream) + { + char *our_level = *levels; + int multiple = 0; +@@ -1421,24 +1439,24 @@ struct pentry_state + const char *cp = fdoc; + nl = __strchrnul (cp, '\n'); + if (*nl != '\0') +- /* This is a `multi-level' args doc; advance to the correct position +- as determined by our state in LEVELS, and update LEVELS. */ +- { +- int i; +- multiple = 1; +- for (i = 0; i < *our_level; i++) +- cp = nl + 1, nl = __strchrnul (cp, '\n'); +- (*levels)++; +- } ++ /* This is a `multi-level' args doc; advance to the correct position ++ as determined by our state in LEVELS, and update LEVELS. */ ++ { ++ int i; ++ multiple = 1; ++ for (i = 0; i < *our_level; i++) ++ cp = nl + 1, nl = __strchrnul (cp, '\n'); ++ (*levels)++; ++ } + + /* Manually do line wrapping so that it (probably) won't get wrapped at +- any embedded spaces. */ ++ any embedded spaces. */ + space (stream, 1 + nl - cp); + + __argp_fmtstream_write (stream, cp, nl - cp); + } + if (fdoc && fdoc != tdoc) +- free ((char *)fdoc); /* Free user's modified doc string. */ ++ free ((char *)fdoc); /* Free user's modified doc string. */ + + if (child) + while (child->argp) +@@ -1448,14 +1466,14 @@ struct pentry_state + { + /* Need to increment our level. */ + if (*nl) +- /* There's more we can do here. */ +- { +- (*our_level)++; +- advance = 0; /* Our parent shouldn't advance also. */ +- } ++ /* There's more we can do here. */ ++ { ++ (*our_level)++; ++ advance = 0; /* Our parent shouldn't advance also. */ ++ } + else if (*our_level > 0) +- /* We had multiple levels, but used them up; reset to zero. */ +- *our_level = 0; ++ /* We had multiple levels, but used them up; reset to zero. */ ++ *our_level = 0; + } + + return !advance; +@@ -1470,86 +1488,92 @@ struct pentry_state + occurrence is output. Returns true if anything was output. */ + static int + argp_doc (const struct argp *argp, const struct argp_state *state, +- int post, int pre_blank, int first_only, +- argp_fmtstream_t stream) ++ int post, int pre_blank, int first_only, ++ argp_fmtstream_t stream) + { + const char *text; + const char *inp_text; ++ size_t inp_text_len = 0; ++ const char *trans_text; + void *input = 0; + int anything = 0; +- size_t inp_text_limit = 0; +- const char *doc = dgettext (argp->argp_domain, argp->doc); + const struct argp_child *child = argp->children; + +- if (doc) ++ if (argp->doc) + { +- char *vt = strchr (doc, '\v'); +- inp_text = post ? (vt ? vt + 1 : 0) : doc; +- inp_text_limit = (!post && vt) ? (vt - doc) : 0; ++ char *vt = strchr (argp->doc, '\v'); ++ if (vt) ++ { ++ if (post) ++ inp_text = vt + 1; ++ else ++ { ++ inp_text_len = vt - argp->doc; ++ inp_text = __strndup (argp->doc, inp_text_len); ++ } ++ } ++ else ++ inp_text = post ? 0 : argp->doc; ++ trans_text = inp_text ? dgettext (argp->argp_domain, inp_text) : NULL; + } + else +- inp_text = 0; ++ trans_text = inp_text = 0; + + if (argp->help_filter) + /* We have to filter the doc strings. */ + { +- if (inp_text_limit) +- /* Copy INP_TEXT so that it's nul-terminated. */ +- inp_text = __strndup (inp_text, inp_text_limit); + input = __argp_input (argp, state); + text = +- (*argp->help_filter) (post +- ? ARGP_KEY_HELP_POST_DOC +- : ARGP_KEY_HELP_PRE_DOC, +- inp_text, input); ++ (*argp->help_filter) (post ++ ? ARGP_KEY_HELP_POST_DOC ++ : ARGP_KEY_HELP_PRE_DOC, ++ trans_text, input); + } + else +- text = (const char *) inp_text; ++ text = (const char *) trans_text; + + if (text) + { + if (pre_blank) +- __argp_fmtstream_putc (stream, '\n'); ++ __argp_fmtstream_putc (stream, '\n'); + +- if (text == inp_text && inp_text_limit) +- __argp_fmtstream_write (stream, inp_text, inp_text_limit); +- else +- __argp_fmtstream_puts (stream, text); ++ __argp_fmtstream_puts (stream, text); + + if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream)) +- __argp_fmtstream_putc (stream, '\n'); ++ __argp_fmtstream_putc (stream, '\n'); + + anything = 1; + } + +- if (text && text != inp_text) +- free ((char *) text); /* Free TEXT returned from the help filter. */ +- if (inp_text && inp_text_limit && argp->help_filter) +- free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */ ++ if (text && text != trans_text) ++ free ((char *) text); /* Free TEXT returned from the help filter. */ ++ ++ if (inp_text && inp_text_len) ++ free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */ + + if (post && argp->help_filter) +- /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */ ++ /* Now see if we have to output an ARGP_KEY_HELP_EXTRA text. */ + { + text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input); + if (text) +- { +- if (anything || pre_blank) +- __argp_fmtstream_putc (stream, '\n'); +- __argp_fmtstream_puts (stream, text); +- free ((char *) text); +- if (__argp_fmtstream_point (stream) +- > __argp_fmtstream_lmargin (stream)) +- __argp_fmtstream_putc (stream, '\n'); +- anything = 1; +- } ++ { ++ if (anything || pre_blank) ++ __argp_fmtstream_putc (stream, '\n'); ++ __argp_fmtstream_puts (stream, text); ++ free ((char *) text); ++ if (__argp_fmtstream_point (stream) ++ > __argp_fmtstream_lmargin (stream)) ++ __argp_fmtstream_putc (stream, '\n'); ++ anything = 1; ++ } + } + + if (child) + while (child->argp && !(first_only && anything)) + anything |= +- argp_doc ((child++)->argp, state, +- post, anything || pre_blank, first_only, +- stream); ++ argp_doc ((child++)->argp, state, ++ post, anything || pre_blank, first_only, ++ stream); + + return anything; + } +@@ -1562,7 +1586,7 @@ struct pentry_state + _help (const struct argp *argp, const struct argp_state *state, FILE *stream, + unsigned flags, char *name) + { +- int anything = 0; /* Whether we've output anything. */ ++ int anything = 0; /* Whether we've output anything. */ + struct hol *hol = 0; + argp_fmtstream_t fs; + +@@ -1606,48 +1630,48 @@ struct pentry_state + memset (pattern_levels, 0, num_pattern_levels); + + do +- { +- int old_lm; +- int old_wm = __argp_fmtstream_set_wmargin (fs, uparams.usage_indent); +- char *levels = pattern_levels; +- +- if (first_pattern) +- __argp_fmtstream_printf (fs, "%s %s", +- dgettext (argp->argp_domain, "Usage:"), +- name); +- else +- __argp_fmtstream_printf (fs, "%s %s", +- dgettext (argp->argp_domain, " or: "), +- name); +- +- /* We set the lmargin as well as the wmargin, because hol_usage +- manually wraps options with newline to avoid annoying breaks. */ +- old_lm = __argp_fmtstream_set_lmargin (fs, uparams.usage_indent); +- +- if (flags & ARGP_HELP_SHORT_USAGE) +- /* Just show where the options go. */ +- { +- if (hol->num_entries > 0) +- __argp_fmtstream_puts (fs, dgettext (argp->argp_domain, +- " [OPTION...]")); +- } +- else +- /* Actually print the options. */ +- { +- hol_usage (hol, fs); +- flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */ +- } +- +- more_patterns = argp_args_usage (argp, state, &levels, 1, fs); +- +- __argp_fmtstream_set_wmargin (fs, old_wm); +- __argp_fmtstream_set_lmargin (fs, old_lm); +- +- __argp_fmtstream_putc (fs, '\n'); +- anything = 1; +- +- first_pattern = 0; +- } ++ { ++ int old_lm; ++ int old_wm = __argp_fmtstream_set_wmargin (fs, uparams.usage_indent); ++ char *levels = pattern_levels; ++ ++ if (first_pattern) ++ __argp_fmtstream_printf (fs, "%s %s", ++ dgettext (argp->argp_domain, "Usage:"), ++ name); ++ else ++ __argp_fmtstream_printf (fs, "%s %s", ++ dgettext (argp->argp_domain, " or: "), ++ name); ++ ++ /* We set the lmargin as well as the wmargin, because hol_usage ++ manually wraps options with newline to avoid annoying breaks. */ ++ old_lm = __argp_fmtstream_set_lmargin (fs, uparams.usage_indent); ++ ++ if (flags & ARGP_HELP_SHORT_USAGE) ++ /* Just show where the options go. */ ++ { ++ if (hol->num_entries > 0) ++ __argp_fmtstream_puts (fs, dgettext (argp->argp_domain, ++ " [OPTION...]")); ++ } ++ else ++ /* Actually print the options. */ ++ { ++ hol_usage (hol, fs); ++ flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */ ++ } ++ ++ more_patterns = argp_args_usage (argp, state, &levels, 1, fs); ++ ++ __argp_fmtstream_set_wmargin (fs, old_wm); ++ __argp_fmtstream_set_lmargin (fs, old_lm); ++ ++ __argp_fmtstream_putc (fs, '\n'); ++ anything = 1; ++ ++ first_pattern = 0; ++ } + while (more_patterns); + } + +@@ -1658,7 +1682,7 @@ struct pentry_state + { + __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "\ + Try `%s --help' or `%s --usage' for more information.\n"), +- name, name); ++ name, name); + anything = 1; + } + +@@ -1667,12 +1691,12 @@ struct pentry_state + { + /* Print info about all the options. */ + if (hol->num_entries > 0) +- { +- if (anything) +- __argp_fmtstream_putc (fs, '\n'); +- hol_help (hol, state, fs); +- anything = 1; +- } ++ { ++ if (anything) ++ __argp_fmtstream_putc (fs, '\n'); ++ hol_help (hol, state, fs); ++ anything = 1; ++ } + } + + if (flags & ARGP_HELP_POST_DOC) +@@ -1682,10 +1706,10 @@ struct pentry_state + if ((flags & ARGP_HELP_BUG_ADDR) && argp_program_bug_address) + { + if (anything) +- __argp_fmtstream_putc (fs, '\n'); ++ __argp_fmtstream_putc (fs, '\n'); + __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, +- "Report bugs to %s.\n"), +- argp_program_bug_address); ++ "Report bugs to %s.\n"), ++ argp_program_bug_address); + anything = 1; + } + +@@ -1702,7 +1726,7 @@ struct pentry_state + /* Output a usage message for ARGP to STREAM. FLAGS are from the set + ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */ + void __argp_help (const struct argp *argp, FILE *stream, +- unsigned flags, char *name) ++ unsigned flags, char *name) + { + struct argp_state state; + memset (&state, 0, sizeof state); +@@ -1739,18 +1763,18 @@ void __argp_help (const struct argp *argp, FILE *stream, + if ((!state || ! (state->flags & ARGP_NO_ERRS)) && stream) + { + if (state && (state->flags & ARGP_LONG_ONLY)) +- flags |= ARGP_HELP_LONG_ONLY; ++ flags |= ARGP_HELP_LONG_ONLY; + + _help (state ? state->root_argp : 0, state, stream, flags, +- state ? state->name : __argp_short_program_name ()); ++ state ? state->name : __argp_short_program_name ()); + + if (!state || ! (state->flags & ARGP_NO_EXIT)) +- { +- if (flags & ARGP_HELP_EXIT_ERR) +- exit (argp_err_exit_status); +- if (flags & ARGP_HELP_EXIT_OK) +- exit (0); +- } ++ { ++ if (flags & ARGP_HELP_EXIT_ERR) ++ exit (argp_err_exit_status); ++ if (flags & ARGP_HELP_EXIT_OK) ++ exit (0); ++ } + } + } + #ifdef weak_alias +@@ -1768,51 +1792,51 @@ void __argp_help (const struct argp *argp, FILE *stream, + FILE *stream = state ? state->err_stream : stderr; + + if (stream) +- { +- va_list ap; ++ { ++ va_list ap; + + #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) +- __flockfile (stream); ++ __flockfile (stream); + #endif + +- va_start (ap, fmt); ++ va_start (ap, fmt); + + #ifdef USE_IN_LIBIO +- if (_IO_fwide (stream, 0) > 0) +- { +- char *buf; ++ if (_IO_fwide (stream, 0) > 0) ++ { ++ char *buf; + +- if (__asprintf (&buf, fmt, ap) < 0) +- buf = NULL; ++ if (__asprintf (&buf, fmt, ap) < 0) ++ buf = NULL; + +- __fwprintf (stream, L"%s: %s\n", +- state ? state->name : __argp_short_program_name (), +- buf); ++ __fwprintf (stream, L"%s: %s\n", ++ state ? state->name : __argp_short_program_name (), ++ buf); + +- free (buf); +- } +- else ++ free (buf); ++ } ++ else + #endif +- { +- fputs_unlocked (state +- ? state->name : __argp_short_program_name (), +- stream); +- putc_unlocked (':', stream); +- putc_unlocked (' ', stream); ++ { ++ fputs_unlocked (state ++ ? state->name : __argp_short_program_name (), ++ stream); ++ putc_unlocked (':', stream); ++ putc_unlocked (' ', stream); + +- vfprintf (stream, fmt, ap); ++ vfprintf (stream, fmt, ap); + +- putc_unlocked ('\n', stream); +- } ++ putc_unlocked ('\n', stream); ++ } + +- __argp_state_help (state, stream, ARGP_HELP_STD_ERR); ++ __argp_state_help (state, stream, ARGP_HELP_STD_ERR); + +- va_end (ap); ++ va_end (ap); + + #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) +- __funlockfile (stream); ++ __funlockfile (stream); + #endif +- } ++ } + } + } + #ifdef weak_alias +@@ -1829,100 +1853,100 @@ void __argp_help (const struct argp *argp, FILE *stream, + parsing but don't reflect a (syntactic) problem with the input. */ + void + __argp_failure (const struct argp_state *state, int status, int errnum, +- const char *fmt, ...) ++ const char *fmt, ...) + { + if (!state || !(state->flags & ARGP_NO_ERRS)) + { + FILE *stream = state ? state->err_stream : stderr; + + if (stream) +- { ++ { + #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) +- __flockfile (stream); ++ __flockfile (stream); + #endif + + #ifdef USE_IN_LIBIO +- if (_IO_fwide (stream, 0) > 0) +- __fwprintf (stream, L"%s", +- state ? state->name : __argp_short_program_name ()); +- else ++ if (_IO_fwide (stream, 0) > 0) ++ __fwprintf (stream, L"%s", ++ state ? state->name : __argp_short_program_name ()); ++ else + #endif +- fputs_unlocked (state +- ? state->name : __argp_short_program_name (), +- stream); ++ fputs_unlocked (state ++ ? state->name : __argp_short_program_name (), ++ stream); + +- if (fmt) +- { +- va_list ap; ++ if (fmt) ++ { ++ va_list ap; + +- va_start (ap, fmt); ++ va_start (ap, fmt); + #ifdef USE_IN_LIBIO +- if (_IO_fwide (stream, 0) > 0) +- { +- char *buf; ++ if (_IO_fwide (stream, 0) > 0) ++ { ++ char *buf; + +- if (__asprintf (&buf, fmt, ap) < 0) +- buf = NULL; ++ if (__asprintf (&buf, fmt, ap) < 0) ++ buf = NULL; + +- __fwprintf (stream, L": %s", buf); ++ __fwprintf (stream, L": %s", buf); + +- free (buf); +- } +- else ++ free (buf); ++ } ++ else + #endif +- { +- putc_unlocked (':', stream); +- putc_unlocked (' ', stream); ++ { ++ putc_unlocked (':', stream); ++ putc_unlocked (' ', stream); + +- vfprintf (stream, fmt, ap); +- } ++ vfprintf (stream, fmt, ap); ++ } + +- va_end (ap); +- } ++ va_end (ap); ++ } + +- if (errnum) +- { +- char buf[200]; ++ if (errnum) ++ { ++ char buf[200]; + + #ifdef USE_IN_LIBIO +- if (_IO_fwide (stream, 0) > 0) +- __fwprintf (stream, L": %s", +- __strerror_r (errnum, buf, sizeof (buf))); +- else ++ if (_IO_fwide (stream, 0) > 0) ++ __fwprintf (stream, L": %s", ++ __strerror_r (errnum, buf, sizeof (buf))); ++ else + #endif +- { +- char const *s = NULL; +- putc_unlocked (':', stream); +- putc_unlocked (' ', stream); +-#if _LIBC || (HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P) +- s = __strerror_r (errnum, buf, sizeof buf); ++ { ++ char const *s = NULL; ++ putc_unlocked (':', stream); ++ putc_unlocked (' ', stream); ++#if _LIBC || (HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P && !defined strerror_r) ++ s = __strerror_r (errnum, buf, sizeof buf); + #elif HAVE_DECL_STRERROR_R +- if (__strerror_r (errnum, buf, sizeof buf) == 0) +- s = buf; ++ if (__strerror_r (errnum, buf, sizeof buf) == 0) ++ s = buf; + #endif + #if !_LIBC +- if (! s && ! (s = strerror (errnum))) +- s = dgettext (state->root_argp->argp_domain, +- "Unknown system error"); ++ if (! s && ! (s = strerror (errnum))) ++ s = dgettext (state->root_argp->argp_domain, ++ "Unknown system error"); + #endif +- fputs (s, stream); +- } +- } ++ fputs (s, stream); ++ } ++ } + + #ifdef USE_IN_LIBIO +- if (_IO_fwide (stream, 0) > 0) +- putwc_unlocked (L'\n', stream); +- else ++ if (_IO_fwide (stream, 0) > 0) ++ putwc_unlocked (L'\n', stream); ++ else + #endif +- putc_unlocked ('\n', stream); ++ putc_unlocked ('\n', stream); + + #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) +- __funlockfile (stream); ++ __funlockfile (stream); + #endif + +- if (status && (!state || !(state->flags & ARGP_NO_EXIT))) +- exit (status); +- } ++ if (status && (!state || !(state->flags & ARGP_NO_EXIT))) ++ exit (status); ++ } + } + } + #ifdef weak_alias +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-namefrob.h b/xbmc/screensavers/rsxs-0.9/lib/argp-namefrob.h +index ea308645..5f6b020 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-namefrob.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-namefrob.h +@@ -1,21 +1,20 @@ + /* Name frobnication for compiling argp outside of glibc +- Copyright (C) 1997, 2003 Free Software Foundation, Inc. ++ Copyright (C) 1997, 2003, 2007, 2009-2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + #if !_LIBC + /* This code is written for inclusion in gnu-libc, and uses names in the +@@ -76,11 +75,6 @@ + #undef __argp_fmtstream_wmargin + #define __argp_fmtstream_wmargin argp_fmtstream_wmargin + +-#include "mempcpy.h" +-#include "strcase.h" +-#include "strchrnul.h" +-#include "strndup.h" +- + /* normal libc functions we call */ + #undef __flockfile + #define __flockfile flockfile +@@ -106,72 +100,58 @@ + #endif + #if defined(HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED + # define feof_unlocked(x) feof (x) +-# endif ++#endif + #if defined(HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED + # define ferror_unlocked(x) ferror (x) +-# endif ++#endif + #if defined(HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED + # define fflush_unlocked(x) fflush (x) +-# endif ++#endif + #if defined(HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED + # define fgets_unlocked(x,y,z) fgets (x,y,z) +-# endif ++#endif + #if defined(HAVE_DECL_FPUTC_UNLOCKED) && !HAVE_DECL_FPUTC_UNLOCKED + # define fputc_unlocked(x,y) fputc (x,y) +-# endif ++#endif + #if defined(HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED + # define fputs_unlocked(x,y) fputs (x,y) +-# endif ++#endif + #if defined(HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED + # define fread_unlocked(w,x,y,z) fread (w,x,y,z) +-# endif ++#endif + #if defined(HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED + # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) +-# endif ++#endif + #if defined(HAVE_DECL_GETC_UNLOCKED) && !HAVE_DECL_GETC_UNLOCKED + # define getc_unlocked(x) getc (x) +-# endif ++#endif + #if defined(HAVE_DECL_GETCHAR_UNLOCKED) && !HAVE_DECL_GETCHAR_UNLOCKED + # define getchar_unlocked() getchar () +-# endif ++#endif + #if defined(HAVE_DECL_PUTC_UNLOCKED) && !HAVE_DECL_PUTC_UNLOCKED + # define putc_unlocked(x,y) putc (x,y) +-# endif ++#endif + #if defined(HAVE_DECL_PUTCHAR_UNLOCKED) && !HAVE_DECL_PUTCHAR_UNLOCKED + # define putchar_unlocked(x) putchar (x) +-# endif +- +-/* GNULIB makes sure both program_invocation_name and +- program_invocation_short_name are available */ +-#ifdef GNULIB_PROGRAM_INVOCATION_NAME +-extern char *program_invocation_name; +-# undef HAVE_DECL_PROGRAM_INVOCATION_NAME +-# define HAVE_DECL_PROGRAM_INVOCATION_NAME 1 +-#endif +- +-#ifdef GNULIB_PROGRAM_INVOCATION_SHORT_NAME +-extern char *program_invocation_short_name; +-# undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME +-# define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1 + #endif + + #endif /* !_LIBC */ + + #ifndef __set_errno +-#define __set_errno(e) (errno = (e)) ++# define __set_errno(e) (errno = (e)) + #endif + + #if defined GNULIB_ARGP_DISABLE_DIRNAME + # define __argp_base_name(arg) arg + #elif defined GNULIB_ARGP_EXTERN_BASENAME +-extern char *__argp_base_name(const char *arg); ++extern char *__argp_base_name (const char *arg); + #else + # include "dirname.h" +-# define __argp_base_name base_name ++# define __argp_base_name last_component + #endif + + #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME +-# define __argp_short_program_name() (program_invocation_short_name) ++# define __argp_short_program_name() (program_invocation_short_name) + #else + extern char *__argp_short_program_name (void); + #endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-parse.c b/xbmc/screensavers/rsxs-0.9/lib/argp-parse.c +index 2d3241e..64360be 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-parse.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-parse.c +@@ -1,27 +1,27 @@ + /* Hierarchial argument parsing, layered over getopt +- Copyright (C) 1995-2000, 2002, 2003, 2004 Free Software Foundation, Inc. ++ Copyright (C) 1995-2000, 2002-2004, 2009-2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + #ifdef HAVE_CONFIG_H + # include + #endif + + #include ++#include + #include + #include + #include +@@ -42,18 +42,13 @@ + + #include "argp.h" + #include "argp-namefrob.h" +-#ifdef __APPLE__ +- const char *argp_program_version; +- const char *argp_program_bug_address; +-#endif + +-#define alignof(type) offsetof (struct { char c; type x; }, x) + #define alignto(n, d) ((((n) + (d) - 1) / (d)) * (d)) + + /* Getopt return values. */ +-#define KEY_END (-1) /* The end of the options. */ +-#define KEY_ARG 1 /* A non-option argument. */ +-#define KEY_ERR '?' /* An error parsing the options. */ ++#define KEY_END (-1) /* The end of the options. */ ++#define KEY_ARG 1 /* A non-option argument. */ ++#define KEY_ERR '?' /* An error parsing the options. */ + + /* The meta-argument used to prevent any further arguments being interpreted + as options. */ +@@ -77,16 +72,16 @@ + it to 0 yourself. */ + static volatile int _argp_hang; + +-#define OPT_PROGNAME -2 +-#define OPT_USAGE -3 +-#define OPT_HANG -4 ++#define OPT_PROGNAME -2 ++#define OPT_USAGE -3 ++#define OPT_HANG -4 + + static const struct argp_option argp_default_options[] = + { +- {"help", '?', 0, 0, N_("give this help list"), -1}, +- {"usage", OPT_USAGE, 0, 0, N_("give a short usage message"), 0}, ++ {"help", '?', 0, 0, N_("give this help list"), -1}, ++ {"usage", OPT_USAGE, 0, 0, N_("give a short usage message"), 0}, + {"program-name",OPT_PROGNAME,N_("NAME"), OPTION_HIDDEN, N_("set the program name"), 0}, +- {"HANG", OPT_HANG, N_("SECS"), OPTION_ARG_OPTIONAL | OPTION_HIDDEN, ++ {"HANG", OPT_HANG, N_("SECS"), OPTION_ARG_OPTIONAL | OPTION_HIDDEN, + N_("hang for SECS seconds (default 3600)"), 0}, + {NULL, 0, 0, 0, NULL, 0} + }; +@@ -101,16 +96,16 @@ + break; + case OPT_USAGE: + __argp_state_help (state, state->out_stream, +- ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK); ++ ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK); + break; + +- case OPT_PROGNAME: /* Set the program name. */ ++ case OPT_PROGNAME: /* Set the program name. */ + #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_NAME + program_invocation_name = arg; + #endif + /* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka +- __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined +- to be that, so we have to be a bit careful here.] */ ++ __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined ++ to be that, so we have to be a bit careful here.] */ + + /* Update what we use for messages. */ + state->name = __argp_base_name (arg); +@@ -120,16 +115,16 @@ + #endif + + if ((state->flags & (ARGP_PARSE_ARGV0 | ARGP_NO_ERRS)) +- == ARGP_PARSE_ARGV0) +- /* Update what getopt uses too. */ +- state->argv[0] = arg; ++ == ARGP_PARSE_ARGV0) ++ /* Update what getopt uses too. */ ++ state->argv[0] = arg; + + break; + + case OPT_HANG: + _argp_hang = atoi (arg ? arg : "3600"); + while (_argp_hang-- > 0) +- __sleep (1); ++ __sleep (1); + break; + + default: +@@ -144,7 +139,7 @@ + + static const struct argp_option argp_version_options[] = + { +- {"version", 'V', 0, 0, N_("print program version"), -1}, ++ {"version", 'V', 0, 0, N_("print program version"), -1}, + {NULL, 0, 0, 0, NULL, 0} + }; + +@@ -155,14 +150,14 @@ + { + case 'V': + if (argp_program_version_hook) +- (*argp_program_version_hook) (state->out_stream, state); ++ (*argp_program_version_hook) (state->out_stream, state); + else if (argp_program_version) +- fprintf (state->out_stream, "%s\n", argp_program_version); ++ fprintf (state->out_stream, "%s\n", argp_program_version); + else +- __argp_error (state, dgettext (state->root_argp->argp_domain, +- "(PROGRAM ERROR) No version known!?")); ++ __argp_error (state, dgettext (state->root_argp->argp_domain, ++ "(PROGRAM ERROR) No version known!?")); + if (! (state->flags & ARGP_NO_EXIT)) +- exit (0); ++ exit (0); + break; + default: + return EBADKEY; +@@ -213,7 +208,7 @@ struct group + + /* This group's parser's parent's group. */ + struct group *parent; +- unsigned parent_index; /* And the our position in the parent. */ ++ unsigned parent_index; /* And the our position in the parent. */ + + /* These fields are swapped into and out of the state structure when + calling this group's parser. */ +@@ -259,7 +254,7 @@ struct parser + struct group *groups; + /* The end of the GROUPS array. */ + struct group *egroup; +- /* An vector containing storage for the CHILD_INPUTS field in all groups. */ ++ /* A vector containing storage for the CHILD_INPUTS field in all groups. */ + void **child_inputs; + + /* True if we think using getopt is still useful; if false, then +@@ -291,8 +286,8 @@ struct parser_convert_state + next unused group entry. CVT holds state used during the conversion. */ + static struct group * + convert_options (const struct argp *argp, +- struct group *parent, unsigned parent_index, +- struct group *group, struct parser_convert_state *cvt) ++ struct group *parent, unsigned parent_index, ++ struct group *group, struct parser_convert_state *cvt) + { + /* REAL is the most recent non-alias value of OPT. */ + const struct argp_option *real = argp->options; +@@ -303,55 +298,55 @@ struct parser_convert_state + const struct argp_option *opt; + + if (real) +- for (opt = real; !__option_is_end (opt); opt++) +- { +- if (! (opt->flags & OPTION_ALIAS)) +- /* OPT isn't an alias, so we can use values from it. */ +- real = opt; +- +- if (! (real->flags & OPTION_DOC)) +- /* A real option (not just documentation). */ +- { +- if (__option_is_short (opt)) +- /* OPT can be used as a short option. */ +- { +- *cvt->short_end++ = opt->key; +- if (real->arg) +- { +- *cvt->short_end++ = ':'; +- if (real->flags & OPTION_ARG_OPTIONAL) +- *cvt->short_end++ = ':'; +- } +- *cvt->short_end = '\0'; /* keep 0 terminated */ +- } +- +- if (opt->name +- && find_long_option (cvt->parser->long_opts, opt->name) < 0) +- /* OPT can be used as a long option. */ +- { +- cvt->long_end->name = opt->name; +- cvt->long_end->has_arg = +- (real->arg +- ? (real->flags & OPTION_ARG_OPTIONAL +- ? optional_argument +- : required_argument) +- : no_argument); +- cvt->long_end->flag = 0; +- /* we add a disambiguating code to all the user's +- values (which is removed before we actually call +- the function to parse the value); this means that +- the user loses use of the high 8 bits in all his +- values (the sign of the lower bits is preserved +- however)... */ +- cvt->long_end->val = +- ((opt->key | real->key) & USER_MASK) +- + (((group - cvt->parser->groups) + 1) << USER_BITS); +- +- /* Keep the LONG_OPTS list terminated. */ +- (++cvt->long_end)->name = NULL; +- } +- } +- } ++ for (opt = real; !__option_is_end (opt); opt++) ++ { ++ if (! (opt->flags & OPTION_ALIAS)) ++ /* OPT isn't an alias, so we can use values from it. */ ++ real = opt; ++ ++ if (! (real->flags & OPTION_DOC)) ++ /* A real option (not just documentation). */ ++ { ++ if (__option_is_short (opt)) ++ /* OPT can be used as a short option. */ ++ { ++ *cvt->short_end++ = opt->key; ++ if (real->arg) ++ { ++ *cvt->short_end++ = ':'; ++ if (real->flags & OPTION_ARG_OPTIONAL) ++ *cvt->short_end++ = ':'; ++ } ++ *cvt->short_end = '\0'; /* keep 0 terminated */ ++ } ++ ++ if (opt->name ++ && find_long_option (cvt->parser->long_opts, opt->name) < 0) ++ /* OPT can be used as a long option. */ ++ { ++ cvt->long_end->name = opt->name; ++ cvt->long_end->has_arg = ++ (real->arg ++ ? (real->flags & OPTION_ARG_OPTIONAL ++ ? optional_argument ++ : required_argument) ++ : no_argument); ++ cvt->long_end->flag = 0; ++ /* we add a disambiguating code to all the user's ++ values (which is removed before we actually call ++ the function to parse the value); this means that ++ the user loses use of the high 8 bits in all his ++ values (the sign of the lower bits is preserved ++ however)... */ ++ cvt->long_end->val = ++ ((opt->key ? opt->key : real->key) & USER_MASK) ++ + (((group - cvt->parser->groups) + 1) << USER_BITS); ++ ++ /* Keep the LONG_OPTS list terminated. */ ++ (++cvt->long_end)->name = NULL; ++ } ++ } ++ } + + group->parser = argp->parser; + group->argp = argp; +@@ -364,15 +359,15 @@ struct parser_convert_state + group->child_inputs = 0; + + if (children) +- /* Assign GROUP's CHILD_INPUTS field some space from ++ /* Assign GROUP's CHILD_INPUTS field some space from + CVT->child_inputs_end.*/ +- { +- unsigned num_children = 0; +- while (children[num_children].argp) +- num_children++; +- group->child_inputs = cvt->child_inputs_end; +- cvt->child_inputs_end += num_children; +- } ++ { ++ unsigned num_children = 0; ++ while (children[num_children].argp) ++ num_children++; ++ group->child_inputs = cvt->child_inputs_end; ++ cvt->child_inputs_end += num_children; ++ } + + parent = group++; + } +@@ -383,8 +378,8 @@ struct parser_convert_state + { + unsigned index = 0; + while (children->argp) +- group = +- convert_options (children++->argp, parent, index++, group, cvt); ++ group = ++ convert_options (children++->argp, parent, index++, group, cvt); + } + + return group; +@@ -420,10 +415,10 @@ struct parser_convert_state + /* Lengths of various parser fields which we will allocated. */ + struct parser_sizes + { +- size_t short_len; /* Getopt short options string. */ +- size_t long_len; /* Getopt long options vector. */ +- size_t num_groups; /* Group structures we allocate. */ +- size_t num_child_inputs; /* Child input slots. */ ++ size_t short_len; /* Getopt short options string. */ ++ size_t long_len; /* Getopt long options vector. */ ++ size_t num_groups; /* Group structures we allocate. */ ++ size_t num_child_inputs; /* Child input slots. */ + }; + + /* For ARGP, increments the NUM_GROUPS field in SZS by the total number of +@@ -440,27 +435,27 @@ struct parser_sizes + { + szs->num_groups++; + if (opt) +- { +- int num_opts = 0; +- while (!__option_is_end (opt++)) +- num_opts++; +- szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */ +- szs->long_len += num_opts; +- } ++ { ++ int num_opts = 0; ++ while (!__option_is_end (opt++)) ++ num_opts++; ++ szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */ ++ szs->long_len += num_opts; ++ } + } + + if (child) + while (child->argp) + { +- calc_sizes ((child++)->argp, szs); +- szs->num_child_inputs++; ++ calc_sizes ((child++)->argp, szs); ++ szs->num_child_inputs++; + } + } + + /* Initializes PARSER to parse ARGP in a manner described by FLAGS. */ + static error_t + parser_init (struct parser *parser, const struct argp *argp, +- int argc, char **argv, int flags, void *input) ++ int argc, char **argv, int flags, void *input) + { + error_t err = 0; + struct group *group; +@@ -517,7 +512,7 @@ struct parser_sizes + parser->state.flags = flags; + parser->state.err_stream = stderr; + parser->state.out_stream = stdout; +- parser->state.next = 0; /* Tell getopt to initialize. */ ++ parser->state.next = 0; /* Tell getopt to initialize. */ + parser->state.pstate = parser; + + parser->try_getopt = 1; +@@ -531,20 +526,20 @@ struct parser_sizes + group++) + { + if (group->parent) +- /* If a child parser, get the initial input value from the parent. */ +- group->input = group->parent->child_inputs[group->parent_index]; ++ /* If a child parser, get the initial input value from the parent. */ ++ group->input = group->parent->child_inputs[group->parent_index]; + + if (!group->parser +- && group->argp->children && group->argp->children->argp) +- /* For the special case where no parsing function is supplied for an +- argp, propagate its input to its first child, if any (this just +- makes very simple wrapper argps more convenient). */ +- group->child_inputs[0] = group->input; ++ && group->argp->children && group->argp->children->argp) ++ /* For the special case where no parsing function is supplied for an ++ argp, propagate its input to its first child, if any (this just ++ makes very simple wrapper argps more convenient). */ ++ group->child_inputs[0] = group->input; + + err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0); + } + if (err == EBADKEY) +- err = 0; /* Some parser didn't understand. */ ++ err = 0; /* Some parser didn't understand. */ + + if (err) + return err; +@@ -553,12 +548,12 @@ struct parser_sizes + { + parser->opt_data.opterr = 0; + if (parser->state.flags & ARGP_PARSE_ARGV0) +- /* getopt always skips ARGV[0], so we have to fake it out. As long +- as OPTERR is 0, then it shouldn't actually try to access it. */ +- parser->state.argv--, parser->state.argc++; ++ /* getopt always skips ARGV[0], so we have to fake it out. As long ++ as OPTERR is 0, then it shouldn't actually try to access it. */ ++ parser->state.argv--, parser->state.argc++; + } + else +- parser->opt_data.opterr = 1; /* Print error messages. */ ++ parser->opt_data.opterr = 1; /* Print error messages. */ + + if (parser->state.argv == argv && argv[0]) + /* There's an argv[0]; use it for messages. */ +@@ -572,7 +567,7 @@ struct parser_sizes + /* Free any storage consumed by PARSER (but not PARSER itself). */ + static error_t + parser_finalize (struct parser *parser, +- error_t err, int arg_ebadkey, int *end_index) ++ error_t err, int arg_ebadkey, int *end_index) + { + struct group *group; + +@@ -583,40 +578,40 @@ struct parser_sizes + if (! err) + { + if (parser->state.next == parser->state.argc) +- /* We successfully parsed all arguments! Call all the parsers again, +- just a few more times... */ +- { +- for (group = parser->groups; +- group < parser->egroup && (!err || err==EBADKEY); +- group++) +- if (group->args_processed == 0) +- err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0); +- for (group = parser->egroup - 1; +- group >= parser->groups && (!err || err==EBADKEY); +- group--) +- err = group_parse (group, &parser->state, ARGP_KEY_END, 0); +- +- if (err == EBADKEY) +- err = 0; /* Some parser didn't understand. */ +- +- /* Tell the user that all arguments are parsed. */ +- if (end_index) +- *end_index = parser->state.next; +- } ++ /* We successfully parsed all arguments! Call all the parsers again, ++ just a few more times... */ ++ { ++ for (group = parser->groups; ++ group < parser->egroup && (!err || err==EBADKEY); ++ group++) ++ if (group->args_processed == 0) ++ err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0); ++ for (group = parser->egroup - 1; ++ group >= parser->groups && (!err || err==EBADKEY); ++ group--) ++ err = group_parse (group, &parser->state, ARGP_KEY_END, 0); ++ ++ if (err == EBADKEY) ++ err = 0; /* Some parser didn't understand. */ ++ ++ /* Tell the user that all arguments are parsed. */ ++ if (end_index) ++ *end_index = parser->state.next; ++ } + else if (end_index) +- /* Return any remaining arguments to the user. */ +- *end_index = parser->state.next; ++ /* Return any remaining arguments to the user. */ ++ *end_index = parser->state.next; + else +- /* No way to return the remaining arguments, they must be bogus. */ +- { +- if (!(parser->state.flags & ARGP_NO_ERRS) +- && parser->state.err_stream) +- fprintf (parser->state.err_stream, +- dgettext (parser->argp->argp_domain, +- "%s: Too many arguments\n"), +- parser->state.name); +- err = EBADKEY; +- } ++ /* No way to return the remaining arguments, they must be bogus. */ ++ { ++ if (!(parser->state.flags & ARGP_NO_ERRS) ++ && parser->state.err_stream) ++ fprintf (parser->state.err_stream, ++ dgettext (parser->argp->argp_domain, ++ "%s: Too many arguments\n"), ++ parser->state.name); ++ err = EBADKEY; ++ } + } + + /* Okay, we're all done, with either an error or success; call the parsers +@@ -626,27 +621,27 @@ struct parser_sizes + { + /* Maybe print an error message. */ + if (err == EBADKEY) +- /* An appropriate message describing what the error was should have +- been printed earlier. */ +- __argp_state_help (&parser->state, parser->state.err_stream, +- ARGP_HELP_STD_ERR); ++ /* An appropriate message describing what the error was should have ++ been printed earlier. */ ++ __argp_state_help (&parser->state, parser->state.err_stream, ++ ARGP_HELP_STD_ERR); + + /* Since we didn't exit, give each parser an error indication. */ + for (group = parser->groups; group < parser->egroup; group++) +- group_parse (group, &parser->state, ARGP_KEY_ERROR, 0); ++ group_parse (group, &parser->state, ARGP_KEY_ERROR, 0); + } + else + /* Notify parsers of success, and propagate back values from parsers. */ + { + /* We pass over the groups in reverse order so that child groups are +- given a chance to do there processing before passing back a value to +- the parent. */ ++ given a chance to do there processing before passing back a value to ++ the parent. */ + for (group = parser->egroup - 1 +- ; group >= parser->groups && (!err || err == EBADKEY) +- ; group--) +- err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0); ++ ; group >= parser->groups && (!err || err == EBADKEY) ++ ; group--) ++ err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0); + if (err == EBADKEY) +- err = 0; /* Some parser didn't understand. */ ++ err = 0; /* Some parser didn't understand. */ + } + + /* Call parsers once more, to do any final cleanup. Errors are ignored. */ +@@ -674,42 +669,42 @@ struct parser_sizes + int index = --parser->state.next; + error_t err = EBADKEY; + struct group *group; +- int key = 0; /* Which of ARGP_KEY_ARG[S] we used. */ ++ int key = 0; /* Which of ARGP_KEY_ARG[S] we used. */ + + /* Try to parse the argument in each parser. */ + for (group = parser->groups + ; group < parser->egroup && err == EBADKEY + ; group++) + { +- parser->state.next++; /* For ARGP_KEY_ARG, consume the arg. */ ++ parser->state.next++; /* For ARGP_KEY_ARG, consume the arg. */ + key = ARGP_KEY_ARG; + err = group_parse (group, &parser->state, key, val); + + if (err == EBADKEY) +- /* This parser doesn't like ARGP_KEY_ARG; try ARGP_KEY_ARGS instead. */ +- { +- parser->state.next--; /* For ARGP_KEY_ARGS, put back the arg. */ +- key = ARGP_KEY_ARGS; +- err = group_parse (group, &parser->state, key, 0); +- } ++ /* This parser doesn't like ARGP_KEY_ARG; try ARGP_KEY_ARGS instead. */ ++ { ++ parser->state.next--; /* For ARGP_KEY_ARGS, put back the arg. */ ++ key = ARGP_KEY_ARGS; ++ err = group_parse (group, &parser->state, key, 0); ++ } + } + + if (! err) + { + if (key == ARGP_KEY_ARGS) +- /* The default for ARGP_KEY_ARGS is to assume that if NEXT isn't +- changed by the user, *all* arguments should be considered +- consumed. */ +- parser->state.next = parser->state.argc; ++ /* The default for ARGP_KEY_ARGS is to assume that if NEXT isn't ++ changed by the user, *all* arguments should be considered ++ consumed. */ ++ parser->state.next = parser->state.argc; + + if (parser->state.next > index) +- /* Remember that we successfully processed a non-option +- argument -- but only if the user hasn't gotten tricky and set +- the clock back. */ +- (--group)->args_processed += (parser->state.next - index); ++ /* Remember that we successfully processed a non-option ++ argument -- but only if the user hasn't gotten tricky and set ++ the clock back. */ ++ (--group)->args_processed += (parser->state.next - index); + else +- /* The user wants to reparse some args, give getopt another try. */ +- parser->try_getopt = 1; ++ /* The user wants to reparse some args, give getopt another try. */ ++ parser->try_getopt = 1; + } + + return err; +@@ -734,21 +729,21 @@ struct parser_sizes + char *short_index = strchr (parser->short_opts, opt); + + if (short_index) +- for (group = parser->groups; group < parser->egroup; group++) +- if (group->short_end > short_index) +- { +- err = group_parse (group, &parser->state, opt, +- parser->opt_data.optarg); +- break; +- } ++ for (group = parser->groups; group < parser->egroup; group++) ++ if (group->short_end > short_index) ++ { ++ err = group_parse (group, &parser->state, opt, ++ parser->opt_data.optarg); ++ break; ++ } + } + else + /* A long option. We use shifts instead of masking for extracting + the user value in order to preserve the sign. */ + err = + group_parse (&parser->groups[group_key - 1], &parser->state, +- (opt << GROUP_BITS) >> GROUP_BITS, +- parser->opt_data.optarg); ++ (opt << GROUP_BITS) >> GROUP_BITS, ++ parser->opt_data.optarg); + + if (err == EBADKEY) + /* At least currently, an option not recognized is an error in the +@@ -756,19 +751,19 @@ struct parser_sizes + with each option. */ + { + static const char bad_key_err[] = +- N_("(PROGRAM ERROR) Option should have been recognized!?"); ++ N_("(PROGRAM ERROR) Option should have been recognized!?"); + if (group_key == 0) +- __argp_error (&parser->state, "-%c: %s", opt, +- dgettext (parser->argp->argp_domain, bad_key_err)); ++ __argp_error (&parser->state, "-%c: %s", opt, ++ dgettext (parser->argp->argp_domain, bad_key_err)); + else +- { +- struct option *long_opt = parser->long_opts; +- while (long_opt->val != opt && long_opt->name) +- long_opt++; +- __argp_error (&parser->state, "--%s: %s", +- long_opt->name ? long_opt->name : "???", +- dgettext (parser->argp->argp_domain, bad_key_err)); +- } ++ { ++ struct option *long_opt = parser->long_opts; ++ while (long_opt->val != opt && long_opt->name) ++ long_opt++; ++ __argp_error (&parser->state, "--%s: %s", ++ long_opt->name ? long_opt->name : "???", ++ dgettext (parser->argp->argp_domain, bad_key_err)); ++ } + } + + return err; +@@ -799,38 +794,38 @@ struct parser_sizes + /* Distinguish KEY_ERR from a real option. */ + parser->opt_data.optopt = KEY_END; + if (parser->state.flags & ARGP_LONG_ONLY) +- opt = _getopt_long_only_r (parser->state.argc, parser->state.argv, +- parser->short_opts, parser->long_opts, 0, +- &parser->opt_data); ++ opt = _getopt_long_only_r (parser->state.argc, parser->state.argv, ++ parser->short_opts, parser->long_opts, 0, ++ &parser->opt_data); + else +- opt = _getopt_long_r (parser->state.argc, parser->state.argv, +- parser->short_opts, parser->long_opts, 0, +- &parser->opt_data); ++ opt = _getopt_long_r (parser->state.argc, parser->state.argv, ++ parser->short_opts, parser->long_opts, 0, ++ &parser->opt_data); + /* And see what getopt did. */ + parser->state.next = parser->opt_data.optind; + + if (opt == KEY_END) +- /* Getopt says there are no more options, so stop using +- getopt; we'll continue if necessary on our own. */ +- { +- parser->try_getopt = 0; +- if (parser->state.next > 1 +- && strcmp (parser->state.argv[parser->state.next - 1], QUOTE) +- == 0) +- /* Not only is this the end of the options, but it's a +- `quoted' region, which may have args that *look* like +- options, so we definitely shouldn't try to use getopt past +- here, whatever happens. */ +- parser->state.quoted = parser->state.next; +- } ++ /* Getopt says there are no more options, so stop using ++ getopt; we'll continue if necessary on our own. */ ++ { ++ parser->try_getopt = 0; ++ if (parser->state.next > 1 ++ && strcmp (parser->state.argv[parser->state.next - 1], QUOTE) ++ == 0) ++ /* Not only is this the end of the options, but it's a ++ `quoted' region, which may have args that *look* like ++ options, so we definitely shouldn't try to use getopt past ++ here, whatever happens. */ ++ parser->state.quoted = parser->state.next; ++ } + else if (opt == KEY_ERR && parser->opt_data.optopt != KEY_END) +- /* KEY_ERR can have the same value as a valid user short +- option, but in the case of a real error, getopt sets OPTOPT +- to the offending character, which can never be KEY_END. */ +- { +- *arg_ebadkey = 0; +- return EBADKEY; +- } ++ /* KEY_ERR can have the same value as a valid user short ++ option, but in the case of a real error, getopt sets OPTOPT ++ to the offending character, which can never be KEY_END. */ ++ { ++ *arg_ebadkey = 0; ++ return EBADKEY; ++ } + } + else + opt = KEY_END; +@@ -839,18 +834,18 @@ struct parser_sizes + { + /* We're past what getopt considers the options. */ + if (parser->state.next >= parser->state.argc +- || (parser->state.flags & ARGP_NO_ARGS)) +- /* Indicate that we're done. */ +- { +- *arg_ebadkey = 1; +- return EBADKEY; +- } ++ || (parser->state.flags & ARGP_NO_ARGS)) ++ /* Indicate that we're done. */ ++ { ++ *arg_ebadkey = 1; ++ return EBADKEY; ++ } + else +- /* A non-option arg; simulate what getopt might have done. */ +- { +- opt = KEY_ARG; +- parser->opt_data.optarg = parser->state.argv[parser->state.next++]; +- } ++ /* A non-option arg; simulate what getopt might have done. */ ++ { ++ opt = KEY_ARG; ++ parser->opt_data.optarg = parser->state.argv[parser->state.next++]; ++ } + } + + if (opt == KEY_ARG) +@@ -872,7 +867,7 @@ struct parser_sizes + returned a non-zero value, it is returned; otherwise 0 is returned. */ + error_t + __argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags, +- int *end_index, void *input) ++ int *end_index, void *input) + { + error_t err; + struct parser parser; +@@ -881,6 +876,20 @@ struct parser_sizes + to be parsed (which in some cases isn't actually an error). */ + int arg_ebadkey = 0; + ++#ifndef _LIBC ++ if (!(flags & ARGP_PARSE_ARGV0)) ++ { ++#ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME ++ if (!program_invocation_name) ++ program_invocation_name = argv[0]; ++#endif ++#ifdef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME ++ if (!program_invocation_short_name) ++ program_invocation_short_name = __argp_base_name (argv[0]); ++#endif ++ } ++#endif ++ + if (! (flags & ARGP_NO_HELP)) + /* Add our own options. */ + { +@@ -888,17 +897,17 @@ struct parser_sizes + struct argp *top_argp = alloca (sizeof (struct argp)); + + /* TOP_ARGP has no options, it just serves to group the user & default +- argps. */ ++ argps. */ + memset (top_argp, 0, sizeof (*top_argp)); + top_argp->children = child; + + memset (child, 0, 4 * sizeof (struct argp_child)); + + if (argp) +- (child++)->argp = argp; ++ (child++)->argp = argp; + (child++)->argp = &argp_default_argp; + if (argp_program_version || argp_program_version_hook) +- (child++)->argp = &argp_version_argp; ++ (child++)->argp = &argp_version_argp; + child->argp = 0; + + argp = top_argp; +@@ -911,7 +920,7 @@ struct parser_sizes + /* Parse! */ + { + while (! err) +- err = parser_parse_next (&parser, &arg_ebadkey); ++ err = parser_parse_next (&parser, &arg_ebadkey); + err = parser_finalize (&parser, err, arg_ebadkey, end_index); + } + +@@ -932,8 +941,8 @@ struct parser_sizes + struct parser *parser = state->pstate; + + for (group = parser->groups; group < parser->egroup; group++) +- if (group->argp == argp) +- return group->input; ++ if (group->argp == argp) ++ return group->input; + } + + return 0; +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-pin.c b/xbmc/screensavers/rsxs-0.9/lib/argp-pin.c +index 852c6d6..c966756 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-pin.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-pin.c +@@ -1,19 +1,18 @@ + /* Full and short program names for argp module +- Copyright (C) 2005 Free Software Foundation, Inc. ++ Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc. + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + #ifdef HAVE_CONFIG_H + # include +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-pv.c b/xbmc/screensavers/rsxs-0.9/lib/argp-pv.c +index a11298b..7a8cba7 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-pv.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-pv.c +@@ -1,24 +1,34 @@ + /* Default definition for ARGP_PROGRAM_VERSION. +- Copyright (C) 1996, 1997, 1999, 2006 Free Software Foundation, Inc. ++ Copyright (C) 1996-1997, 1999, 2006, 2009-2011 Free Software Foundation, ++ Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + /* If set by the user program to a non-zero value, then a default option + --version is added (unless the ARGP_NO_HELP flag is used), which will + print this string followed by a newline and exit (unless the + ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ +-const char *argp_program_version; ++const char *argp_program_version ++/* This variable should be zero-initialized. On most systems, putting it into ++ BSS is sufficient. Not so on MacOS X 10.3 and 10.4, see ++ ++ . */ ++#if defined __ELF__ ++ /* On ELF systems, variables in BSS behave well. */ ++#else ++ = (const char *) 0 ++#endif ++ ; +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-pvh.c b/xbmc/screensavers/rsxs-0.9/lib/argp-pvh.c +index 6bf7c49..04f6603 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-pvh.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-pvh.c +@@ -1,21 +1,21 @@ + /* Default definition for ARGP_PROGRAM_VERSION_HOOK. +- Copyright (C) 1996, 1997, 1999, 2004 Free Software Foundation, Inc. ++ Copyright (C) 1996-1997, 1999, 2004, 2009-2011 Free Software Foundation, ++ Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + #ifdef HAVE_CONFIG_H + # include +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-xinl.c b/xbmc/screensavers/rsxs-0.9/lib/argp-xinl.c +index a6afb1f..5b1f6fb 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-xinl.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-xinl.c +@@ -1,21 +1,20 @@ + /* Real definitions for extern inline functions in argp.h +- Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc. ++ Copyright (C) 1997-1998, 2004, 2009-2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + #ifdef HAVE_CONFIG_H + # include +@@ -26,7 +25,7 @@ + #endif + + #ifndef __USE_EXTERN_INLINES +-# define __USE_EXTERN_INLINES 1 ++# define __USE_EXTERN_INLINES 1 + #endif + #define ARGP_EI + #undef __OPTIMIZE__ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp.h b/xbmc/screensavers/rsxs-0.9/lib/argp.h +index ae7fa04..c0483ab 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp.h +@@ -1,21 +1,20 @@ + /* Hierarchial argument parsing, layered over getopt. +- Copyright (C) 1995-1999,2003-2006 Free Software Foundation, Inc. ++ Copyright (C) 1995-1999, 2003-2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader . + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + #ifndef _ARGP_H + #define _ARGP_H +@@ -35,24 +34,25 @@ + # define __NTH(fct) fct __THROW + #endif + +-#ifndef __attribute__ +-/* This feature is available in gcc versions 2.5 and later. */ +-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +-# define __attribute__(Spec) /* empty */ +-# endif +-/* The __-protected variants of `format' and `printf' attributes +- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || __STRICT_ANSI__ +-# define __format__ format +-# define __printf__ printf +-# endif ++/* The __attribute__ feature is available in gcc versions 2.5 and later. ++ The __-protected variants of the attributes 'format' and 'printf' are ++ accepted by gcc versions 2.6.4 (effectively 2.7) and later. ++ We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because ++ gnulib and libintl do '#define printf __printf__' when they override ++ the 'printf' function. */ ++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) ++# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) ++#else ++# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ + #endif + + /* GCC 2.95 and later have "__restrict"; C99 compilers have +- "restrict", and "configure" may have defined "restrict". */ ++ "restrict", and "configure" may have defined "restrict". ++ Other compilers use __restrict, __restrict__, and _Restrict, and ++ 'configure' might #define 'restrict' to those words. */ + #ifndef __restrict + # if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) +-# if defined restrict || 199901L <= __STDC_VERSION__ ++# if 199901L <= __STDC_VERSION__ + # define __restrict restrict + # else + # define __restrict +@@ -94,7 +94,10 @@ struct argp_option + /* The doc string for this option. If both NAME and KEY are 0, This string + will be printed outdented from the normal option column, making it + useful as a group header (it will be the first thing printed in its +- group); in this usage, it's conventional to end the string with a `:'. */ ++ group); in this usage, it's conventional to end the string with a `:'. ++ ++ Write the initial value as N_("TEXT") if you want xgettext to collect ++ it into a POT file. */ + const char *doc; + + /* The group this option is in. In a long help message, options are sorted +@@ -108,15 +111,15 @@ struct argp_option + }; + + /* The argument associated with this option is optional. */ +-#define OPTION_ARG_OPTIONAL 0x1 ++#define OPTION_ARG_OPTIONAL 0x1 + + /* This option isn't displayed in any help messages. */ +-#define OPTION_HIDDEN 0x2 ++#define OPTION_HIDDEN 0x2 + + /* This option is an alias for the closest previous non-alias option. This + means that it will be displayed in the same help entry, and will inherit + fields other than NAME and KEY from the aliased option. */ +-#define OPTION_ALIAS 0x4 ++#define OPTION_ALIAS 0x4 + + /* This option isn't actually an option (and so should be ignored by the + actual option parser), but rather an arbitrary piece of documentation that +@@ -129,7 +132,7 @@ struct argp_option + ignored, except that if the first non-whitespace character is not `-', this + entry is displayed after all options (and OPTION_DOC entries with a leading + `-') in the same group. */ +-#define OPTION_DOC 0x8 ++#define OPTION_DOC 0x8 + + /* This option shouldn't be included in `long' usage messages (but is still + included in help messages). This is mainly intended for options that are +@@ -138,27 +141,27 @@ struct argp_option + if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to + distinguish these two cases, -x should probably be marked + OPTION_NO_USAGE. */ +-#define OPTION_NO_USAGE 0x10 ++#define OPTION_NO_USAGE 0x10 + + /* Valid only in conjunction with OPTION_DOC. This option disables translation + of option name. */ + #define OPTION_NO_TRANS 0x20 + + +-struct argp; /* fwd declare this type */ +-struct argp_state; /* " */ +-struct argp_child; /* " */ ++struct argp; /* fwd declare this type */ ++struct argp_state; /* " */ ++struct argp_child; /* " */ + + /* The type of a pointer to an argp parsing function. */ + typedef error_t (*argp_parser_t) (int key, char *arg, +- struct argp_state *state); ++ struct argp_state *state); + + /* What to return for unrecognized keys. For special ARGP_KEY_ keys, such + returns will simply be ignored. For user keys, this error will be turned + into EINVAL (if the call to argp_parse is such that errors are propagated + back to the user instead of exiting); returning EINVAL itself would result + in an immediate stop to parsing in *all* cases. */ +-#define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */ ++#define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */ + + /* Special values for the KEY argument to an argument parsing function. + ARGP_ERR_UNKNOWN should be returned if they aren't understood. +@@ -186,32 +189,32 @@ typedef error_t (*argp_parser_t) (int key, char *arg, + passed, the option won't be considered processed; this is to allow you to + actually modify the argument (perhaps into an option), and have it + processed again. */ +-#define ARGP_KEY_ARG 0 ++#define ARGP_KEY_ARG 0 + /* There are remaining arguments not parsed by any parser, which may be found + starting at (STATE->argv + STATE->next). If success is returned, but + STATE->next left untouched, it's assumed that all arguments were consume, + otherwise, the parser should adjust STATE->next to reflect any arguments + consumed. */ +-#define ARGP_KEY_ARGS 0x1000006 ++#define ARGP_KEY_ARGS 0x1000006 + /* There are no more command line arguments at all. */ +-#define ARGP_KEY_END 0x1000001 ++#define ARGP_KEY_END 0x1000001 + /* Because it's common to want to do some special processing if there aren't + any non-option args, user parsers are called with this key if they didn't + successfully process any non-option arguments. Called just before + ARGP_KEY_END (where more general validity checks on previously parsed + arguments can take place). */ +-#define ARGP_KEY_NO_ARGS 0x1000002 ++#define ARGP_KEY_NO_ARGS 0x1000002 + /* Passed in before any parsing is done. Afterwards, the values of each + element of the CHILD_INPUT field, if any, in the state structure is + copied to each child's state to be the initial value of the INPUT field. */ +-#define ARGP_KEY_INIT 0x1000003 ++#define ARGP_KEY_INIT 0x1000003 + /* Use after all other keys, including SUCCESS & END. */ +-#define ARGP_KEY_FINI 0x1000007 ++#define ARGP_KEY_FINI 0x1000007 + /* Passed in when parsing has successfully been completed (even if there are + still arguments remaining). */ +-#define ARGP_KEY_SUCCESS 0x1000004 ++#define ARGP_KEY_SUCCESS 0x1000004 + /* Passed in if an error occurs. */ +-#define ARGP_KEY_ERROR 0x1000005 ++#define ARGP_KEY_ERROR 0x1000005 + + /* An argp structure contains a set of options declarations, a function to + deal with parsing one, documentation string, a possible vector of child +@@ -243,7 +246,9 @@ struct argp + + /* If non-NULL, a string containing extra text to be printed before and + after the options in a long help message (separated by a vertical tab +- `\v' character). */ ++ `\v' character). ++ Write the initial value as N_("BEFORE-TEXT") "\v" N_("AFTER-TEXT") if ++ you want xgettext to collect the two pieces of text into a POT file. */ + const char *doc; + + /* A vector of argp_children structures, terminated by a member with a 0 +@@ -273,15 +278,15 @@ struct argp + }; + + /* Possible KEY arguments to a help filter function. */ +-#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */ +-#define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ +-#define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ +-#define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; +- TEXT is NULL for this key. */ ++#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */ ++#define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ ++#define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ ++#define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; ++ TEXT is NULL for this key. */ + /* Explanatory note emitted when duplicate option arguments have been + suppressed. */ + #define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005 +-#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */ ++#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */ + + /* When an argp has a non-zero CHILDREN field, it should point to a vector of + argp_child structures, each of which describes a subsidiary argp. */ +@@ -350,10 +355,10 @@ struct argp_state + char *name; + + /* Streams used when argp prints something. */ +- FILE *err_stream; /* For errors; initialized to stderr. */ +- FILE *out_stream; /* For information; initialized to stdout. */ ++ FILE *err_stream; /* For errors; initialized to stderr. */ ++ FILE *out_stream; /* For information; initialized to stdout. */ + +- void *pstate; /* Private, for use by argp. */ ++ void *pstate; /* Private, for use by argp. */ + }; + + /* Flags for argp_parse (note that the defaults are those that are +@@ -369,7 +374,7 @@ struct argp_state + is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program + name in the error messages. This flag implies ARGP_NO_EXIT (on the + assumption that silent exiting upon errors is bad behaviour). */ +-#define ARGP_NO_ERRS 0x02 ++#define ARGP_NO_ERRS 0x02 + + /* Don't parse any non-option args. Normally non-option args are parsed by + calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg +@@ -381,21 +386,21 @@ struct argp_state + last time with a key of ARGP_KEY_END. This flag needn't normally be set, + as the normal behavior is to stop parsing as soon as some argument can't + be handled. */ +-#define ARGP_NO_ARGS 0x04 ++#define ARGP_NO_ARGS 0x04 + + /* Parse options and arguments in the same order they occur on the command + line -- normally they're rearranged so that all options come first. */ +-#define ARGP_IN_ORDER 0x08 ++#define ARGP_IN_ORDER 0x08 + + /* Don't provide the standard long option --help, which causes usage and + option help information to be output to stdout, and exit (0) called. */ +-#define ARGP_NO_HELP 0x10 ++#define ARGP_NO_HELP 0x10 + + /* Don't exit on errors (they may still result in error messages). */ +-#define ARGP_NO_EXIT 0x20 ++#define ARGP_NO_EXIT 0x20 + + /* Use the gnu getopt `long-only' rules for parsing arguments. */ +-#define ARGP_LONG_ONLY 0x40 ++#define ARGP_LONG_ONLY 0x40 + + /* Turns off any message-printing/exiting options. */ + #define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP) +@@ -408,16 +413,30 @@ struct argp_state + returned. This function may also call exit unless the ARGP_NO_HELP flag + is set. INPUT is a pointer to a value to be passed in to the parser. */ + extern error_t argp_parse (const struct argp *__restrict __argp, +- int __argc, char **__restrict __argv, +- unsigned __flags, int *__restrict __arg_index, +- void *__restrict __input); ++ int /*argc*/, char **__restrict /*argv*/, ++ unsigned __flags, int *__restrict __arg_index, ++ void *__restrict __input); + extern error_t __argp_parse (const struct argp *__restrict __argp, +- int __argc, char **__restrict __argv, +- unsigned __flags, int *__restrict __arg_index, +- void *__restrict __input); ++ int /*argc*/, char **__restrict /*argv*/, ++ unsigned __flags, int *__restrict __arg_index, ++ void *__restrict __input); + + /* Global variables. */ + ++/* GNULIB makes sure both program_invocation_name and ++ program_invocation_short_name are available */ ++#ifdef GNULIB_PROGRAM_INVOCATION_NAME ++extern char *program_invocation_name; ++# undef HAVE_DECL_PROGRAM_INVOCATION_NAME ++# define HAVE_DECL_PROGRAM_INVOCATION_NAME 1 ++#endif ++ ++#ifdef GNULIB_PROGRAM_INVOCATION_SHORT_NAME ++extern char *program_invocation_short_name; ++# undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME ++# define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1 ++#endif ++ + /* If defined or set by the user program to a non-zero value, then a default + option --version is added (unless the ARGP_NO_HELP flag is used), which + will print this string followed by a newline and exit (unless the +@@ -430,8 +449,8 @@ extern error_t __argp_parse (const struct argp *__restrict __argp, + the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is + used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ + extern void (*argp_program_version_hook) (FILE *__restrict __stream, +- struct argp_state *__restrict +- __state); ++ struct argp_state *__restrict ++ __state); + + /* If defined or set by the user program, it should point to string that is + the bug-reporting address for the program. It will be printed by +@@ -446,20 +465,20 @@ extern void (*argp_program_version_hook) (FILE *__restrict __stream, + extern error_t argp_err_exit_status; + + /* Flags for argp_help. */ +-#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */ +-#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */ +-#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */ +-#define ARGP_HELP_LONG 0x08 /* a long help message. */ +-#define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */ +-#define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */ +-#define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC) +-#define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */ +-#define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to +- reflect ARGP_LONG_ONLY mode. */ ++#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */ ++#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */ ++#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */ ++#define ARGP_HELP_LONG 0x08 /* a long help message. */ ++#define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */ ++#define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */ ++#define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC) ++#define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */ ++#define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to ++ reflect ARGP_LONG_ONLY mode. */ + + /* These ARGP_HELP flags are only understood by argp_state_help. */ +-#define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */ +-#define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */ ++#define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */ ++#define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */ + + /* The standard thing to do after a program command line parsing error, if an + error message has already been printed. */ +@@ -477,11 +496,11 @@ extern void (*argp_program_version_hook) (FILE *__restrict __stream, + /* Output a usage message for ARGP to STREAM. FLAGS are from the set + ARGP_HELP_*. */ + extern void argp_help (const struct argp *__restrict __argp, +- FILE *__restrict __stream, +- unsigned __flags, char *__restrict __name); ++ FILE *__restrict __stream, ++ unsigned __flags, char *__restrict __name); + extern void __argp_help (const struct argp *__restrict __argp, +- FILE *__restrict __stream, unsigned __flags, +- char *__name); ++ FILE *__restrict __stream, unsigned __flags, ++ char *__name); + + /* The following routines are intended to be called from within an argp + parsing routine (thus taking an argp_state structure as the first +@@ -494,25 +513,27 @@ extern void __argp_help (const struct argp *__restrict __argp, + /* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are + from the set ARGP_HELP_*. */ + extern void argp_state_help (const struct argp_state *__restrict __state, +- FILE *__restrict __stream, +- unsigned int __flags); ++ FILE *__restrict __stream, ++ unsigned int __flags); + extern void __argp_state_help (const struct argp_state *__restrict __state, +- FILE *__restrict __stream, +- unsigned int __flags); ++ FILE *__restrict __stream, ++ unsigned int __flags); + ++#if _LIBC || !defined __USE_EXTERN_INLINES + /* Possibly output the standard usage message for ARGP to stderr and exit. */ + extern void argp_usage (const struct argp_state *__state); + extern void __argp_usage (const struct argp_state *__state); ++#endif + + /* If appropriate, print the printf string FMT and following args, preceded + by the program name and `:', to stderr, and followed by a `Try ... --help' + message, then exit (1). */ + extern void argp_error (const struct argp_state *__restrict __state, +- const char *__restrict __fmt, ...) +- __attribute__ ((__format__ (__printf__, 2, 3))); ++ const char *__restrict __fmt, ...) ++ _GL_ATTRIBUTE_FORMAT ((__printf__, 2, 3)); + extern void __argp_error (const struct argp_state *__restrict __state, +- const char *__restrict __fmt, ...) +- __attribute__ ((__format__ (__printf__, 2, 3))); ++ const char *__restrict __fmt, ...) ++ _GL_ATTRIBUTE_FORMAT ((__printf__, 2, 3)); + + /* Similar to the standard gnu error-reporting function error(), but will + respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print +@@ -523,14 +544,15 @@ extern void __argp_error (const struct argp_state *__restrict __state, + *parsing errors*, and the former is for other problems that occur during + parsing but don't reflect a (syntactic) problem with the input. */ + extern void argp_failure (const struct argp_state *__restrict __state, +- int __status, int __errnum, +- const char *__restrict __fmt, ...) +- __attribute__ ((__format__ (__printf__, 4, 5))); ++ int __status, int __errnum, ++ const char *__restrict __fmt, ...) ++ _GL_ATTRIBUTE_FORMAT ((__printf__, 4, 5)); + extern void __argp_failure (const struct argp_state *__restrict __state, +- int __status, int __errnum, +- const char *__restrict __fmt, ...) +- __attribute__ ((__format__ (__printf__, 4, 5))); ++ int __status, int __errnum, ++ const char *__restrict __fmt, ...) ++ _GL_ATTRIBUTE_FORMAT ((__printf__, 4, 5)); + ++#if _LIBC || !defined __USE_EXTERN_INLINES + /* Returns true if the option OPT is a valid short option. */ + extern int _option_is_short (const struct argp_option *__opt) __THROW; + extern int __option_is_short (const struct argp_option *__opt) __THROW; +@@ -539,14 +561,15 @@ extern void __argp_failure (const struct argp_state *__restrict __state, + options array. */ + extern int _option_is_end (const struct argp_option *__opt) __THROW; + extern int __option_is_end (const struct argp_option *__opt) __THROW; ++#endif + + /* Return the input field for ARGP in the parser corresponding to STATE; used + by the help routines. */ + extern void *_argp_input (const struct argp *__restrict __argp, +- const struct argp_state *__restrict __state) ++ const struct argp_state *__restrict __state) + __THROW; + extern void *__argp_input (const struct argp *__restrict __argp, +- const struct argp_state *__restrict __state) ++ const struct argp_state *__restrict __state) + __THROW; + + #ifdef __USE_EXTERN_INLINES +@@ -559,7 +582,28 @@ extern void *__argp_input (const struct argp *__restrict __argp, + # endif + + # ifndef ARGP_EI +-# define ARGP_EI extern __inline__ ++# ifdef __GNUC__ ++ /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 ++ inline semantics, unless -fgnu89-inline is used. It defines a macro ++ __GNUC_STDC_INLINE__ to indicate this situation or a macro ++ __GNUC_GNU_INLINE__ to indicate the opposite situation. ++ GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline ++ semantics but warns, unless -fgnu89-inline is used: ++ warning: C99 inline functions are not supported; using GNU89 ++ warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute ++ It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. */ ++# if defined __GNUC_STDC_INLINE__ ++# define ARGP_EI __inline__ ++# elif defined __GNUC_GNU_INLINE__ ++# define ARGP_EI extern __inline__ __attribute__ ((__gnu_inline__)) ++# else ++# define ARGP_EI extern __inline__ ++# endif ++# else ++ /* With other compilers, assume the ISO C99 meaning of 'inline', if ++ the compiler supports 'inline' at all. */ ++# define ARGP_EI inline ++# endif + # endif + + ARGP_EI void +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argz.c b/xbmc/screensavers/rsxs-0.9/lib/argz.c +index 316579a..ccb16f2 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argz.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/argz.c +@@ -1,13 +1,11 @@ +-/* argz.c -- argz implementation for non-glibc systems +- Copyright (C) 2004 Free Software Foundation, Inc. +- Originally by Gary V. Vaughan +- +- NOTE: The canonical source of this file is maintained with the +- GNU Libtool package. Report bugs to bug-libtool@gnu.org. ++/* Functions for dealing with '\0' separated arg vectors. ++ Copyright (C) 1995-1998, 2000-2002, 2006, 2008-2011 Free Software ++ Foundation, Inc. ++ This file is part of the GNU C Library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -19,208 +17,391 @@ + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +-#if defined(HAVE_CONFIG_H) +-# if defined(LTDL) && defined LT_CONFIG_H +-# include LT_CONFIG_H +-# else +-# include +-# endif +-#endif ++#include + + #include +- +-#include +-#include +-#include +-#include + #include ++#include ++#include + +-#if defined(HAVE_STRING_H) +-# include +-#elif defined(HAVE_STRINGS_H) +-# include +-#endif +-#if defined(HAVE_MEMORY_H) +-# include +-#endif + +-#define EOS_CHAR '\0' + ++/* Add BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */ + error_t +-argz_append (char **pargz, size_t *pargz_len, const char *buf, size_t buf_len) ++argz_append (char **argz, size_t *argz_len, const char *buf, size_t buf_len) + { +- size_t argz_len; +- char *argz; ++ size_t new_argz_len = *argz_len + buf_len; ++ char *new_argz = realloc (*argz, new_argz_len); ++ if (new_argz) ++ { ++ memcpy (new_argz + *argz_len, buf, buf_len); ++ *argz = new_argz; ++ *argz_len = new_argz_len; ++ return 0; ++ } ++ else ++ return ENOMEM; ++} + +- assert (pargz); +- assert (pargz_len); +- assert ((*pargz && *pargz_len) || (!*pargz && !*pargz_len)); ++/* Add STR to the argz vector in ARGZ & ARGZ_LEN. This should be moved into ++ argz.c in libshouldbelibc. */ ++error_t ++argz_add (char **argz, size_t *argz_len, const char *str) ++{ ++ return argz_append (argz, argz_len, str, strlen (str) + 1); ++} + +- /* If nothing needs to be appended, no more work is required. */ +- if (buf_len == 0) +- return 0; + +- /* Ensure there is enough room to append BUF_LEN. */ +- argz_len = *pargz_len + buf_len; +- argz = (char *) realloc (*pargz, argz_len); +- if (!argz) +- return ENOMEM; + +- /* Copy characters from BUF after terminating '\0' in ARGZ. */ +- memcpy (argz + *pargz_len, buf, buf_len); ++error_t ++argz_add_sep (char **argz, size_t *argz_len, const char *string, int delim) ++{ ++ size_t nlen = strlen (string) + 1; + +- /* Assign new values. */ +- *pargz = argz; +- *pargz_len = argz_len; ++ if (nlen > 1) ++ { ++ const char *rp; ++ char *wp; ++ ++ *argz = (char *) realloc (*argz, *argz_len + nlen); ++ if (*argz == NULL) ++ return ENOMEM; ++ ++ wp = *argz + *argz_len; ++ rp = string; ++ do ++ if (*rp == delim) ++ { ++ if (wp > *argz && wp[-1] != '\0') ++ *wp++ = '\0'; ++ else ++ --nlen; ++ } ++ else ++ *wp++ = *rp; ++ while (*rp++ != '\0'); ++ ++ *argz_len += nlen; ++ } + + return 0; + } + + ++ + error_t +-argz_create_sep (const char *str, int delim, char **pargz, size_t *pargz_len) ++argz_create_sep (const char *string, int delim, char **argz, size_t *len) + { +- size_t argz_len; +- char *argz = 0; +- +- assert (str); +- assert (pargz); +- assert (pargz_len); ++ size_t nlen = strlen (string) + 1; + +- /* Make a copy of STR, but replacing each occurrence of +- DELIM with '\0'. */ +- argz_len = 1+ strlen (str); +- if (argz_len) ++ if (nlen > 1) + { +- const char *p; +- char *q; +- +- argz = (char *) malloc (argz_len); +- if (!argz) +- return ENOMEM; +- +- for (p = str, q = argz; *p != EOS_CHAR; ++p) +- { +- if (*p == delim) +- { +- /* Ignore leading delimiters, and fold consecutive +- delimiters in STR into a single '\0' in ARGZ. */ +- if ((q > argz) && (q[-1] != EOS_CHAR)) +- *q++ = EOS_CHAR; +- else +- --argz_len; +- } +- else +- *q++ = *p; +- } +- /* Copy terminating EOS_CHAR. */ +- *q = *p; ++ const char *rp; ++ char *wp; ++ ++ *argz = (char *) malloc (nlen); ++ if (*argz == NULL) ++ return ENOMEM; ++ ++ rp = string; ++ wp = *argz; ++ do ++ if (*rp == delim) ++ { ++ if (wp > *argz && wp[-1] != '\0') ++ *wp++ = '\0'; ++ else ++ --nlen; ++ } ++ else ++ *wp++ = *rp; ++ while (*rp++ != '\0'); ++ ++ if (nlen == 0) ++ { ++ free (*argz); ++ *argz = NULL; ++ *len = 0; ++ } ++ ++ *len = nlen; ++ } ++ else ++ { ++ *argz = NULL; ++ *len = 0; + } +- +- /* If ARGZ_LEN has shrunk to nothing, release ARGZ's memory. */ +- if (!argz_len) +- argz = (free (argz), (char *) 0); +- +- /* Assign new values. */ +- *pargz = argz; +- *pargz_len = argz_len; + + return 0; + } + + ++/* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an ++ existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end. ++ Since ARGZ's first entry is the same as ARGZ, argz_insert (ARGZ, ARGZ_LEN, ++ ARGZ, ENTRY) will insert ENTRY at the beginning of ARGZ. If BEFORE is not ++ in ARGZ, EINVAL is returned, else if memory can't be allocated for the new ++ ARGZ, ENOMEM is returned, else 0. */ + error_t +-argz_insert (char **pargz, size_t *pargz_len, char *before, const char *entry) ++argz_insert (char **argz, size_t *argz_len, char *before, const char *entry) + { +- assert (pargz); +- assert (pargz_len); +- assert (entry && *entry); ++ if (! before) ++ return argz_add (argz, argz_len, entry); + +- /* No BEFORE address indicates ENTRY should be inserted after the +- current last element. */ +- if (!before) +- return argz_append (pargz, pargz_len, entry, 1+ strlen (entry)); ++ if (before < *argz || before >= *argz + *argz_len) ++ return EINVAL; + +- /* This probably indicates a programmer error, but to preserve +- semantics, scan back to the start of an entry if BEFORE points +- into the middle of it. */ +- while ((before > *pargz) && (before[-1] != EOS_CHAR)) +- --before; ++ if (before > *argz) ++ /* Make sure before is actually the beginning of an entry. */ ++ while (before[-1]) ++ before--; + + { +- size_t entry_len = 1+ strlen (entry); +- size_t argz_len = *pargz_len + entry_len; +- size_t offset = before - *pargz; +- char *argz = (char *) realloc (*pargz, argz_len); +- +- if (!argz) ++ size_t after_before = *argz_len - (before - *argz); ++ size_t entry_len = strlen (entry) + 1; ++ size_t new_argz_len = *argz_len + entry_len; ++ char *new_argz = realloc (*argz, new_argz_len); ++ ++ if (new_argz) ++ { ++ before = new_argz + (before - *argz); ++ memmove (before + entry_len, before, after_before); ++ memmove (before, entry, entry_len); ++ *argz = new_argz; ++ *argz_len = new_argz_len; ++ return 0; ++ } ++ else + return ENOMEM; ++ } ++} + +- /* Make BEFORE point to the equivalent offset in ARGZ that it +- used to have in *PARGZ incase realloc() moved the block. */ +- before = argz + offset; + +- /* Move the ARGZ entries starting at BEFORE up into the new +- space at the end -- making room to copy ENTRY into the +- resulting gap. */ +- memmove (before + entry_len, before, *pargz_len - offset); +- memcpy (before, entry, entry_len); ++char * ++argz_next (const char *argz, size_t argz_len, const char *entry) ++{ ++ if (entry) ++ { ++ if (entry < argz + argz_len) ++ entry = strchr (entry, '\0') + 1; + +- /* Assign new values. */ +- *pargz = argz; +- *pargz_len = argz_len; +- } ++ return entry >= argz + argz_len ? NULL : (char *) entry; ++ } ++ else ++ if (argz_len > 0) ++ return (char *) argz; ++ else ++ return NULL; ++} + +- return 0; ++ ++/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's ++ except the last into the character SEP. */ ++void ++argz_stringify (char *argz, size_t len, int sep) ++{ ++ if (len > 0) ++ while (1) ++ { ++ size_t part_len = strnlen (argz, len); ++ argz += part_len; ++ len -= part_len; ++ if (len-- <= 1) /* includes final '\0' we want to stop at */ ++ break; ++ *argz++ = sep; ++ } + } + + +-char * +-argz_next (char *argz, size_t argz_len, const char *entry) ++/* Returns the number of strings in ARGZ. */ ++size_t ++argz_count (const char *argz, size_t len) + { +- assert ((argz && argz_len) || (!argz && !argz_len)); ++ size_t count = 0; ++ while (len > 0) ++ { ++ size_t part_len = strlen (argz); ++ argz += part_len + 1; ++ len -= part_len + 1; ++ count++; ++ } ++ return count; ++} + +- if (entry) ++ ++/* Puts pointers to each string in ARGZ, plus a terminating 0 element, into ++ ARGV, which must be large enough to hold them all. */ ++void ++argz_extract (const char *argz, size_t len, char **argv) ++{ ++ while (len > 0) + { +- /* Either ARGZ/ARGZ_LEN is empty, or ENTRY points into an address +- within the ARGZ vector. */ +- assert ((!argz && !argz_len) +- || ((argz <= entry) && (entry < (argz + argz_len)))); +- +- /* Move to the char immediately after the terminating +- '\0' of ENTRY. */ +- entry = 1+ strchr (entry, EOS_CHAR); +- +- /* Return either the new ENTRY, or else NULL if ARGZ is +- exhausted. */ +- return (entry >= argz + argz_len) ? 0 : (char *) entry; ++ size_t part_len = strlen (argz); ++ *argv++ = (char *) argz; ++ argz += part_len + 1; ++ len -= part_len + 1; + } ++ *argv = 0; ++} ++ ++ ++/* Make a '\0' separated arg vector from a unix argv vector, returning it in ++ ARGZ, and the total length in LEN. If a memory allocation error occurs, ++ ENOMEM is returned, otherwise 0. */ ++error_t ++argz_create (char *const argv[], char **argz, size_t *len) ++{ ++ int argc; ++ size_t tlen = 0; ++ char *const *ap; ++ char *p; ++ ++ for (argc = 0; argv[argc] != NULL; ++argc) ++ tlen += strlen (argv[argc]) + 1; ++ ++ if (tlen == 0) ++ *argz = NULL; + else + { +- /* This should probably be flagged as a programmer error, +- since starting an argz_next loop with the iterator set +- to ARGZ is safer. To preserve semantics, handle the NULL +- case by returning the start of ARGZ (if any). */ +- if (argz_len > 0) +- return argz; +- else +- return 0; ++ *argz = malloc (tlen); ++ if (*argz == NULL) ++ return ENOMEM; ++ ++ for (p = *argz, ap = argv; *ap; ++ap, ++p) ++ p = stpcpy (p, *ap); + } ++ *len = tlen; ++ ++ return 0; + } + + ++/* Delete ENTRY from ARGZ & ARGZ_LEN, if any. */ + void +-argz_stringify (char *argz, size_t argz_len, int sep) ++argz_delete (char **argz, size_t *argz_len, char *entry) + { +- assert ((argz && argz_len) || (!argz && !argz_len)); ++ if (entry) ++ /* Get rid of the old value for NAME. */ ++ { ++ size_t entry_len = strlen (entry) + 1; ++ *argz_len -= entry_len; ++ memmove (entry, entry + entry_len, *argz_len - (entry - *argz)); ++ if (*argz_len == 0) ++ { ++ free (*argz); ++ *argz = 0; ++ } ++ } ++} ++ ++ ++/* Append BUF, of length BUF_LEN to *TO, of length *TO_LEN, reallocating and ++ updating *TO & *TO_LEN appropriately. If an allocation error occurs, ++ *TO's old value is freed, and *TO is set to 0. */ ++static void ++str_append (char **to, size_t *to_len, const char *buf, const size_t buf_len) ++{ ++ size_t new_len = *to_len + buf_len; ++ char *new_to = realloc (*to, new_len + 1); ++ ++ if (new_to) ++ { ++ *((char *) mempcpy (new_to + *to_len, buf, buf_len)) = '\0'; ++ *to = new_to; ++ *to_len = new_len; ++ } ++ else ++ { ++ free (*to); ++ *to = 0; ++ } ++} + +- if (sep) ++/* Replace any occurrences of the string STR in ARGZ with WITH, reallocating ++ ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be ++ incremented by number of replacements performed. */ ++error_t ++argz_replace (char **argz, size_t *argz_len, const char *str, const char *with, ++ unsigned *replace_count) ++{ ++ error_t err = 0; ++ ++ if (str && *str) + { +- --argz_len; /* don't stringify the terminating EOS */ +- while (--argz_len > 0) +- { +- if (argz[argz_len] == EOS_CHAR) +- argz[argz_len] = sep; +- } ++ char *arg = 0; ++ char *src = *argz; ++ size_t src_len = *argz_len; ++ char *dst = 0; ++ size_t dst_len = 0; ++ int delayed_copy = 1; /* True while we've avoided copying anything. */ ++ size_t str_len = strlen (str), with_len = strlen (with); ++ ++ while (!err && (arg = argz_next (src, src_len, arg))) ++ { ++ char *match = strstr (arg, str); ++ if (match) ++ { ++ char *from = match + str_len; ++ size_t to_len = match - arg; ++ char *to = strndup (arg, to_len); ++ ++ while (to && from) ++ { ++ str_append (&to, &to_len, with, with_len); ++ if (to) ++ { ++ match = strstr (from, str); ++ if (match) ++ { ++ str_append (&to, &to_len, from, match - from); ++ from = match + str_len; ++ } ++ else ++ { ++ str_append (&to, &to_len, from, strlen (from)); ++ from = 0; ++ } ++ } ++ } ++ ++ if (to) ++ { ++ if (delayed_copy) ++ /* We avoided copying SRC to DST until we found a match; ++ now that we've done so, copy everything from the start ++ of SRC. */ ++ { ++ if (arg > src) ++ err = argz_append (&dst, &dst_len, src, (arg - src)); ++ delayed_copy = 0; ++ } ++ if (! err) ++ err = argz_add (&dst, &dst_len, to); ++ free (to); ++ } ++ else ++ err = ENOMEM; ++ ++ if (replace_count) ++ (*replace_count)++; ++ } ++ else if (! delayed_copy) ++ err = argz_add (&dst, &dst_len, arg); ++ } ++ ++ if (! err) ++ { ++ if (! delayed_copy) ++ /* We never found any instances of str. */ ++ { ++ free (src); ++ *argz = dst; ++ *argz_len = dst_len; ++ } ++ } ++ else if (dst_len > 0) ++ free (dst); + } ++ ++ return err; + } +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argz.in.h b/xbmc/screensavers/rsxs-0.9/lib/argz.in.h +new file mode 100644 +index 0000000..d769350 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/argz.in.h +@@ -0,0 +1,160 @@ ++/* Routines for dealing with '\0' separated arg vectors. ++ Copyright (C) 1995-2000, 2004, 2007, 2009-2011 Free Software Foundation, ++ Inc. ++ This file is part of the GNU C Library. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#ifndef _ARGZ_H ++#define _ARGZ_H 1 ++ ++ ++#define __need_error_t ++#include ++#include /* Need size_t, and strchr is called below. */ ++ ++#ifndef const ++# define const const ++#endif ++ ++#ifndef __error_t_defined ++typedef int error_t; ++#endif ++ ++ ++ ++/* Make a '\0' separated arg vector from a unix argv vector, returning it in ++ ARGZ, and the total length in LEN. If a memory allocation error occurs, ++ ENOMEM is returned, otherwise 0. The result can be destroyed using free. */ ++ ++extern error_t argz_create (char *const __argv[], char **restrict __argz, ++ size_t *restrict __len); ++ ++/* Make a '\0' separated arg vector from a SEP separated list in ++ STRING, returning it in ARGZ, and the total length in LEN. If a ++ memory allocation error occurs, ENOMEM is returned, otherwise 0. ++ The result can be destroyed using free. */ ++ ++extern error_t argz_create_sep (const char *restrict string, ++ int __sep, char **restrict __argz, ++ size_t *restrict __len); ++ ++/* Returns the number of strings in ARGZ. */ ++ ++extern size_t argz_count (const char *__argz, size_t __len) ++; ++ ++/* Puts pointers to each string in ARGZ into ARGV, which must be large enough ++ to hold them all. */ ++ ++extern void argz_extract (const char *restrict __argz, size_t __len, ++ char **restrict __argv); ++ ++/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's ++ except the last into the character SEP. */ ++ ++extern void argz_stringify (char *__argz, size_t __len, int __sep); ++ ++/* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */ ++ ++extern error_t argz_append (char **restrict __argz, ++ size_t *restrict __argz_len, ++ const char *restrict __buf, size_t __buf_len) ++; ++ ++/* Append STR to the argz vector in ARGZ & ARGZ_LEN. */ ++ ++extern error_t argz_add (char **restrict __argz, ++ size_t *restrict __argz_len, ++ const char *restrict str); ++ ++/* Append SEP separated list in STRING to the argz vector in ARGZ & ++ ARGZ_LEN. */ ++ ++extern error_t argz_add_sep (char **restrict __argz, ++ size_t *restrict __argz_len, ++ const char *restrict string, int __delim) ++; ++ ++/* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */ ++ ++extern void argz_delete (char **restrict __argz, ++ size_t *restrict __argz_len, ++ char *restrict __entry); ++ ++/* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an ++ existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end. ++ Since ARGZ's first entry is the same as ARGZ, argz_insert (ARGZ, ARGZ_LEN, ++ ARGZ, ENTRY) will insert ENTRY at the beginning of ARGZ. If BEFORE is not ++ in ARGZ, EINVAL is returned, else if memory can't be allocated for the new ++ ARGZ, ENOMEM is returned, else 0. */ ++ ++extern error_t argz_insert (char **restrict __argz, ++ size_t *restrict __argz_len, ++ char *restrict __before, ++ const char *restrict __entry); ++ ++/* Replace any occurrences of the string STR in ARGZ with WITH, reallocating ++ ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be ++ incremented by number of replacements performed. */ ++ ++extern error_t argz_replace (char **restrict __argz, ++ size_t *restrict __argz_len, ++ const char *restrict str, ++ const char *restrict __with, ++ unsigned int *restrict __replace_count); ++ ++/* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there ++ are no more. If entry is NULL, then the first entry is returned. This ++ behavior allows two convenient iteration styles: ++ ++ char *entry = 0; ++ while ((entry = argz_next (argz, argz_len, entry))) ++ ...; ++ ++ or ++ ++ char *entry; ++ for (entry = argz; entry; entry = argz_next (argz, argz_len, entry)) ++ ...; ++*/ ++ ++extern char *argz_next (const char *restrict __argz, size_t __argz_len, ++ const char *restrict __entry); ++ ++#ifdef __USE_EXTERN_INLINES ++__extern_inline char * ++__NTH (argz_next (const char *__argz, size_t __argz_len, ++ const char *__entry)) ++{ ++ if (__entry) ++ { ++ if (__entry < __argz + __argz_len) ++ __entry = strchr (__entry, '\0') + 1; ++ ++ return __entry >= __argz + __argz_len ? (char *) NULL : (char *) __entry; ++ } ++ else ++ return __argz_len > 0 ? (char *) __argz : 0; ++} ++__extern_inline char * ++__NTH (argz_next (const char *__argz, size_t __argz_len, ++ const char *__entry)) ++{ ++ return argz_next (__argz, __argz_len, __entry); ++} ++#endif /* Use extern inlines. */ ++ ++ ++#endif /* argz.h */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/asnprintf.c b/xbmc/screensavers/rsxs-0.9/lib/asnprintf.c +index 1b7f4ba..e4fd95c 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/asnprintf.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/asnprintf.c +@@ -1,9 +1,9 @@ + /* Formatted output to strings. +- Copyright (C) 1999, 2002 Free Software Foundation, Inc. ++ Copyright (C) 1999, 2002, 2006, 2009-2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -15,9 +15,7 @@ + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif ++#include + + /* Specification. */ + #include "vasnprintf.h" +diff --git a/xbmc/screensavers/rsxs-0.9/lib/basename-lgpl.c b/xbmc/screensavers/rsxs-0.9/lib/basename-lgpl.c +new file mode 100644 +index 0000000..529bc35 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/basename-lgpl.c +@@ -0,0 +1,75 @@ ++/* basename.c -- return the last element in a file name ++ ++ Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2011 Free Software ++ Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++#include "dirname.h" ++ ++#include ++ ++/* Return the address of the last file name component of NAME. If ++ NAME has no relative file name components because it is a file ++ system root, return the empty string. */ ++ ++char * ++last_component (char const *name) ++{ ++ char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); ++ char const *p; ++ bool saw_slash = false; ++ ++ while (ISSLASH (*base)) ++ base++; ++ ++ for (p = base; *p; p++) ++ { ++ if (ISSLASH (*p)) ++ saw_slash = true; ++ else if (saw_slash) ++ { ++ base = p; ++ saw_slash = false; ++ } ++ } ++ ++ return (char *) base; ++} ++ ++/* Return the length of the basename NAME. Typically NAME is the ++ value returned by base_name or last_component. Act like strlen ++ (NAME), except omit all trailing slashes. */ ++ ++size_t ++base_len (char const *name) ++{ ++ size_t len; ++ size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); ++ ++ for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) ++ continue; ++ ++ if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1 ++ && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) ++ return 2; ++ ++ if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len ++ && len == prefix_len && ISSLASH (name[prefix_len])) ++ return prefix_len + 1; ++ ++ return len; ++} +diff --git a/xbmc/screensavers/rsxs-0.9/lib/c++defs.h b/xbmc/screensavers/rsxs-0.9/lib/c++defs.h +new file mode 100644 +index 0000000..3fd6322 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/c++defs.h +@@ -0,0 +1,255 @@ ++#ifndef _GL_CXXDEFS_H ++#define _GL_CXXDEFS_H ++ ++/* The three most frequent use cases of these macros are: ++ ++ * For providing a substitute for a function that is missing on some ++ platforms, but is declared and works fine on the platforms on which ++ it exists: ++ ++ #if @GNULIB_FOO@ ++ # if !@HAVE_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on all platforms, ++ but is broken/insufficient and needs to be replaced on some platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on some platforms ++ but is broken/insufficient and needs to be replaced on some of them and ++ is additionally either missing or undeclared on some other platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++*/ ++ ++/* _GL_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#if defined __cplusplus ++# define _GL_EXTERN_C extern "C" ++#else ++# define _GL_EXTERN_C extern ++#endif ++ ++/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); ++ declares a replacement function, named rpl_func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ ++ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) ++#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype rpl_func parameters_and_attributes ++ ++/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); ++ declares the system function, named func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype func parameters_and_attributes ++ ++/* _GL_CXXALIAS_RPL (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. ++ Example: ++ _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); ++ */ ++#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ ++ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = ::rpl_func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); ++ is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); ++ except that the C function rpl_func may have a slightly different ++ declaration. A cast is used to silence the "invalid conversion" error ++ that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = \ ++ reinterpret_cast(::rpl_func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to the system provided function func, if GNULIB_NAMESPACE ++ is defined. ++ Example: ++ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); ++ */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* If we were to write ++ rettype (*const func) parameters = ::func; ++ like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls ++ better (remove an indirection through a 'static' pointer variable), ++ but then the _GL_CXXALIASWARN macro below would cause a warning not only ++ for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = ::func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function func may have a slightly different declaration. ++ A cast is used to silence the "invalid conversion" error that would ++ otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast(::func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function is picked among a set of overloaded functions, ++ namely the one with rettype2 and parameters2. Two consecutive casts ++ are used to silence the "cannot find a match" and "invalid conversion" ++ errors that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* The outer cast must be a reinterpret_cast. ++ The inner cast: When the function is defined as a set of overloaded ++ functions, it works as a static_cast<>, choosing the designated variant. ++ When the function is defined as a single variant, it works as a ++ reinterpret_cast<>. The parenthesized cast syntax works both ways. */ ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast( \ ++ (rettype2(*)parameters2)(::func)); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN (func); ++ causes a warning to be emitted when ::func is used but not when ++ GNULIB_NAMESPACE::func is used. func must be defined without overloaded ++ variants. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN(func) \ ++ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN_1(func,namespace) \ ++ _GL_CXXALIASWARN_2 (func, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_WARN_ON_USE (func, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN(func) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); ++ causes a warning to be emitted when the given overloaded variant of ::func ++ is used but not when GNULIB_NAMESPACE::func is used. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ ++ GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++#endif /* _GL_CXXDEFS_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/dirname-lgpl.c b/xbmc/screensavers/rsxs-0.9/lib/dirname-lgpl.c +new file mode 100644 +index 0000000..f5b0c0f +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/dirname-lgpl.c +@@ -0,0 +1,86 @@ ++/* dirname.c -- return all but the last element in a file name ++ ++ Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2011 Free Software ++ Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++#include "dirname.h" ++ ++#include ++#include ++ ++/* Return the length of the prefix of FILE that will be used by ++ dir_name. If FILE is in the working directory, this returns zero ++ even though `dir_name (FILE)' will return ".". Works properly even ++ if there are trailing slashes (by effectively ignoring them). */ ++ ++size_t ++dir_len (char const *file) ++{ ++ size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); ++ size_t length; ++ ++ /* Advance prefix_length beyond important leading slashes. */ ++ prefix_length += (prefix_length != 0 ++ ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE ++ && ISSLASH (file[prefix_length])) ++ : (ISSLASH (file[0]) ++ ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT ++ && ISSLASH (file[1]) && ! ISSLASH (file[2]) ++ ? 2 : 1)) ++ : 0)); ++ ++ /* Strip the basename and any redundant slashes before it. */ ++ for (length = last_component (file) - file; ++ prefix_length < length; length--) ++ if (! ISSLASH (file[length - 1])) ++ break; ++ return length; ++} ++ ++ ++/* In general, we can't use the builtin `dirname' function if available, ++ since it has different meanings in different environments. ++ In some environments the builtin `dirname' modifies its argument. ++ ++ Return the leading directories part of FILE, allocated with malloc. ++ Works properly even if there are trailing slashes (by effectively ++ ignoring them). Return NULL on failure. ++ ++ If lstat (FILE) would succeed, then { chdir (dir_name (FILE)); ++ lstat (base_name (FILE)); } will access the same file. Likewise, ++ if the sequence { chdir (dir_name (FILE)); ++ rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE ++ to "foo" in the same directory FILE was in. */ ++ ++char * ++mdir_name (char const *file) ++{ ++ size_t length = dir_len (file); ++ bool append_dot = (length == 0 ++ || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE ++ && length == FILE_SYSTEM_PREFIX_LEN (file) ++ && file[2] != '\0' && ! ISSLASH (file[2]))); ++ char *dir = malloc (length + append_dot + 1); ++ if (!dir) ++ return NULL; ++ memcpy (dir, file, length); ++ if (append_dot) ++ dir[length++] = '.'; ++ dir[length] = '\0'; ++ return dir; ++} +diff --git a/xbmc/screensavers/rsxs-0.9/lib/dirname.h b/xbmc/screensavers/rsxs-0.9/lib/dirname.h +index f9189c3..ba9c56e 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/dirname.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/dirname.h +@@ -1,11 +1,12 @@ + /* Take file names apart into directory and base names. + +- Copyright (C) 1998, 2001, 2003-2006 Free Software Foundation, Inc. ++ Copyright (C) 1998, 2001, 2003-2006, 2009-2011 Free Software Foundation, ++ Inc. + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +@@ -13,57 +14,32 @@ + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License +- along with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ along with this program. If not, see . */ + + #ifndef DIRNAME_H_ + # define DIRNAME_H_ 1 + + # include + # include ++# include "dosname.h" + + # ifndef DIRECTORY_SEPARATOR + # define DIRECTORY_SEPARATOR '/' + # endif + +-# ifndef ISSLASH +-# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) +-# endif +- +-# ifndef FILE_SYSTEM_PREFIX_LEN +-# if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX +- /* This internal macro assumes ASCII, but all hosts that support drive +- letters use ASCII. */ +-# define _IS_DRIVE_LETTER(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' \ +- <= 'z' - 'a') +-# define FILE_SYSTEM_PREFIX_LEN(Filename) \ +- (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) +-# else +-# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 +-# endif +-# endif +- +-# ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +-# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 +-# endif +- + # ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT +-# define DOUBLE_SLASH_IS_DISTINCT_ROOT 1 +-# endif +- +-# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +-# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) +-# else +-# define IS_ABSOLUTE_FILE_NAME(F) \ +- (ISSLASH ((F)[0]) || 0 < FILE_SYSTEM_PREFIX_LEN (F)) ++# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 + # endif +-# define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) + ++# if GNULIB_DIRNAME + char *base_name (char const *file); + char *dir_name (char const *file); +-size_t base_len (char const *file); +-size_t dir_len (char const *file); +-char *last_component (char const *file); ++# endif ++ ++char *mdir_name (char const *file); ++size_t base_len (char const *file) _GL_ATTRIBUTE_PURE; ++size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE; ++char *last_component (char const *file) _GL_ATTRIBUTE_PURE; + + bool strip_trailing_slashes (char *file); + +diff --git a/xbmc/screensavers/rsxs-0.9/lib/dosname.h b/xbmc/screensavers/rsxs-0.9/lib/dosname.h +new file mode 100644 +index 0000000..acdd03b +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/dosname.h +@@ -0,0 +1,53 @@ ++/* File names on MS-DOS/Windows systems. ++ ++ Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++ ++ From Paul Eggert and Jim Meyering. */ ++ ++#ifndef _DOSNAME_H ++#define _DOSNAME_H ++ ++#if (defined _WIN32 || defined __WIN32__ || \ ++ defined __MSDOS__ || defined __CYGWIN__ || \ ++ defined __EMX__ || defined __DJGPP__) ++ /* This internal macro assumes ASCII, but all hosts that support drive ++ letters use ASCII. */ ++# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \ ++ <= 'z' - 'a') ++# define FILE_SYSTEM_PREFIX_LEN(Filename) \ ++ (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) ++# ifndef __CYGWIN__ ++# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 ++# endif ++# define ISSLASH(C) ((C) == '/' || (C) == '\\') ++#else ++# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 ++# define ISSLASH(C) ((C) == '/') ++#endif ++ ++#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE ++# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 ++#endif ++ ++#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE ++# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) ++# else ++# define IS_ABSOLUTE_FILE_NAME(F) \ ++ (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0) ++#endif ++#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) ++ ++#endif /* DOSNAME_H_ */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/errno.in.h b/xbmc/screensavers/rsxs-0.9/lib/errno.in.h +new file mode 100644 +index 0000000..b6014b4 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/errno.in.h +@@ -0,0 +1,233 @@ ++/* A POSIX-like . ++ ++ Copyright (C) 2008-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _@GUARD_PREFIX@_ERRNO_H ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++/* The include_next requires a split double-inclusion guard. */ ++#@INCLUDE_NEXT@ @NEXT_ERRNO_H@ ++ ++#ifndef _@GUARD_PREFIX@_ERRNO_H ++#define _@GUARD_PREFIX@_ERRNO_H ++ ++ ++/* On native Windows platforms, many macros are not defined. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ ++/* These are the same values as defined by MSVC 10, for interoperability. */ ++ ++# ifndef ENOMSG ++# define ENOMSG 122 ++# define GNULIB_defined_ENOMSG 1 ++# endif ++ ++# ifndef EIDRM ++# define EIDRM 111 ++# define GNULIB_defined_EIDRM 1 ++# endif ++ ++# ifndef ENOLINK ++# define ENOLINK 121 ++# define GNULIB_defined_ENOLINK 1 ++# endif ++ ++# ifndef EPROTO ++# define EPROTO 134 ++# define GNULIB_defined_EPROTO 1 ++# endif ++ ++# ifndef EBADMSG ++# define EBADMSG 104 ++# define GNULIB_defined_EBADMSG 1 ++# endif ++ ++# ifndef EOVERFLOW ++# define EOVERFLOW 132 ++# define GNULIB_defined_EOVERFLOW 1 ++# endif ++ ++# ifndef ENOTSUP ++# define ENOTSUP 129 ++# define GNULIB_defined_ENOTSUP 1 ++# endif ++ ++# ifndef ENETRESET ++# define ENETRESET 117 ++# define GNULIB_defined_ENETRESET 1 ++# endif ++ ++# ifndef ECONNABORTED ++# define ECONNABORTED 106 ++# define GNULIB_defined_ECONNABORTED 1 ++# endif ++ ++# ifndef ECANCELED ++# define ECANCELED 105 ++# define GNULIB_defined_ECANCELED 1 ++# endif ++ ++# ifndef EINPROGRESS ++# define EINPROGRESS 112 ++# define EALREADY 103 ++# define ENOTSOCK 128 ++# define EDESTADDRREQ 109 ++# define EMSGSIZE 115 ++# define EPROTOTYPE 136 ++# define ENOPROTOOPT 123 ++# define EPROTONOSUPPORT 135 ++# define EOPNOTSUPP 130 ++# define EAFNOSUPPORT 102 ++# define EADDRINUSE 100 ++# define EADDRNOTAVAIL 101 ++# define ENETDOWN 116 ++# define ENETUNREACH 118 ++# define ECONNRESET 108 ++# define ENOBUFS 119 ++# define EISCONN 113 ++# define ENOTCONN 126 ++# define ETIMEDOUT 138 ++# define ECONNREFUSED 107 ++# define ELOOP 114 ++# define EHOSTUNREACH 110 ++# define EWOULDBLOCK 140 ++# define ETXTBSY 139 ++# define ENODATA 120 /* not required by POSIX */ ++# define ENOSR 124 /* not required by POSIX */ ++# define ENOSTR 125 /* not required by POSIX */ ++# define ENOTRECOVERABLE 127 /* not required by POSIX */ ++# define EOWNERDEAD 133 /* not required by POSIX */ ++# define ETIME 137 /* not required by POSIX */ ++# define EOTHER 131 /* not required by POSIX */ ++# define GNULIB_defined_ESOCK 1 ++# endif ++ ++/* These are intentionally the same values as the WSA* error numbers, defined ++ in . */ ++# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */ ++# define EPFNOSUPPORT 10046 /* not required by POSIX */ ++# define ESHUTDOWN 10058 /* not required by POSIX */ ++# define ETOOMANYREFS 10059 /* not required by POSIX */ ++# define EHOSTDOWN 10064 /* not required by POSIX */ ++# define EPROCLIM 10067 /* not required by POSIX */ ++# define EUSERS 10068 /* not required by POSIX */ ++# define EDQUOT 10069 ++# define ESTALE 10070 ++# define EREMOTE 10071 /* not required by POSIX */ ++# define GNULIB_defined_EWINSOCK 1 ++ ++# endif ++ ++ ++/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros ++ EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */ ++# if @EMULTIHOP_HIDDEN@ ++# define EMULTIHOP @EMULTIHOP_VALUE@ ++# define GNULIB_defined_EMULTIHOP 1 ++# endif ++# if @ENOLINK_HIDDEN@ ++# define ENOLINK @ENOLINK_VALUE@ ++# define GNULIB_defined_ENOLINK 1 ++# endif ++# if @EOVERFLOW_HIDDEN@ ++# define EOVERFLOW @EOVERFLOW_VALUE@ ++# define GNULIB_defined_EOVERFLOW 1 ++# endif ++ ++ ++/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK, ++ EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined. ++ Likewise, on NonStop Kernel, EDQUOT is not defined. ++ Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151, ++ HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133. ++ ++ Note: When one of these systems defines some of these macros some day, ++ binaries will have to be recompiled so that they recognizes the new ++ errno values from the system. */ ++ ++# ifndef ENOMSG ++# define ENOMSG 2000 ++# define GNULIB_defined_ENOMSG 1 ++# endif ++ ++# ifndef EIDRM ++# define EIDRM 2001 ++# define GNULIB_defined_EIDRM 1 ++# endif ++ ++# ifndef ENOLINK ++# define ENOLINK 2002 ++# define GNULIB_defined_ENOLINK 1 ++# endif ++ ++# ifndef EPROTO ++# define EPROTO 2003 ++# define GNULIB_defined_EPROTO 1 ++# endif ++ ++# ifndef EMULTIHOP ++# define EMULTIHOP 2004 ++# define GNULIB_defined_EMULTIHOP 1 ++# endif ++ ++# ifndef EBADMSG ++# define EBADMSG 2005 ++# define GNULIB_defined_EBADMSG 1 ++# endif ++ ++# ifndef EOVERFLOW ++# define EOVERFLOW 2006 ++# define GNULIB_defined_EOVERFLOW 1 ++# endif ++ ++# ifndef ENOTSUP ++# define ENOTSUP 2007 ++# define GNULIB_defined_ENOTSUP 1 ++# endif ++ ++# ifndef ENETRESET ++# define ENETRESET 2011 ++# define GNULIB_defined_ENETRESET 1 ++# endif ++ ++# ifndef ECONNABORTED ++# define ECONNABORTED 2012 ++# define GNULIB_defined_ECONNABORTED 1 ++# endif ++ ++# ifndef ESTALE ++# define ESTALE 2009 ++# define GNULIB_defined_ESTALE 1 ++# endif ++ ++# ifndef EDQUOT ++# define EDQUOT 2010 ++# define GNULIB_defined_EDQUOT 1 ++# endif ++ ++# ifndef ECANCELED ++# define ECANCELED 2008 ++# define GNULIB_defined_ECANCELED 1 ++# endif ++ ++ ++#endif /* _@GUARD_PREFIX@_ERRNO_H */ ++#endif /* _@GUARD_PREFIX@_ERRNO_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/float+.h b/xbmc/screensavers/rsxs-0.9/lib/float+.h +new file mode 100644 +index 0000000..2e84489 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/float+.h +@@ -0,0 +1,148 @@ ++/* Supplemental information about the floating-point formats. ++ Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2007. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _FLOATPLUS_H ++#define _FLOATPLUS_H ++ ++#include ++#include ++ ++/* Number of bits in the mantissa of a floating-point number, including the ++ "hidden bit". */ ++#if FLT_RADIX == 2 ++# define FLT_MANT_BIT FLT_MANT_DIG ++# define DBL_MANT_BIT DBL_MANT_DIG ++# define LDBL_MANT_BIT LDBL_MANT_DIG ++#elif FLT_RADIX == 4 ++# define FLT_MANT_BIT (FLT_MANT_DIG * 2) ++# define DBL_MANT_BIT (DBL_MANT_DIG * 2) ++# define LDBL_MANT_BIT (LDBL_MANT_DIG * 2) ++#elif FLT_RADIX == 16 ++# define FLT_MANT_BIT (FLT_MANT_DIG * 4) ++# define DBL_MANT_BIT (DBL_MANT_DIG * 4) ++# define LDBL_MANT_BIT (LDBL_MANT_DIG * 4) ++#endif ++ ++/* Bit mask that can be used to mask the exponent, as an unsigned number. */ ++#define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7) ++#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7) ++#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7) ++ ++/* Number of bits used for the exponent of a floating-point number, including ++ the exponent's sign. */ ++#define FLT_EXP_BIT \ ++ (FLT_EXP_MASK < 0x100 ? 8 : \ ++ FLT_EXP_MASK < 0x200 ? 9 : \ ++ FLT_EXP_MASK < 0x400 ? 10 : \ ++ FLT_EXP_MASK < 0x800 ? 11 : \ ++ FLT_EXP_MASK < 0x1000 ? 12 : \ ++ FLT_EXP_MASK < 0x2000 ? 13 : \ ++ FLT_EXP_MASK < 0x4000 ? 14 : \ ++ FLT_EXP_MASK < 0x8000 ? 15 : \ ++ FLT_EXP_MASK < 0x10000 ? 16 : \ ++ FLT_EXP_MASK < 0x20000 ? 17 : \ ++ FLT_EXP_MASK < 0x40000 ? 18 : \ ++ FLT_EXP_MASK < 0x80000 ? 19 : \ ++ FLT_EXP_MASK < 0x100000 ? 20 : \ ++ FLT_EXP_MASK < 0x200000 ? 21 : \ ++ FLT_EXP_MASK < 0x400000 ? 22 : \ ++ FLT_EXP_MASK < 0x800000 ? 23 : \ ++ FLT_EXP_MASK < 0x1000000 ? 24 : \ ++ FLT_EXP_MASK < 0x2000000 ? 25 : \ ++ FLT_EXP_MASK < 0x4000000 ? 26 : \ ++ FLT_EXP_MASK < 0x8000000 ? 27 : \ ++ FLT_EXP_MASK < 0x10000000 ? 28 : \ ++ FLT_EXP_MASK < 0x20000000 ? 29 : \ ++ FLT_EXP_MASK < 0x40000000 ? 30 : \ ++ FLT_EXP_MASK <= 0x7fffffff ? 31 : \ ++ 32) ++#define DBL_EXP_BIT \ ++ (DBL_EXP_MASK < 0x100 ? 8 : \ ++ DBL_EXP_MASK < 0x200 ? 9 : \ ++ DBL_EXP_MASK < 0x400 ? 10 : \ ++ DBL_EXP_MASK < 0x800 ? 11 : \ ++ DBL_EXP_MASK < 0x1000 ? 12 : \ ++ DBL_EXP_MASK < 0x2000 ? 13 : \ ++ DBL_EXP_MASK < 0x4000 ? 14 : \ ++ DBL_EXP_MASK < 0x8000 ? 15 : \ ++ DBL_EXP_MASK < 0x10000 ? 16 : \ ++ DBL_EXP_MASK < 0x20000 ? 17 : \ ++ DBL_EXP_MASK < 0x40000 ? 18 : \ ++ DBL_EXP_MASK < 0x80000 ? 19 : \ ++ DBL_EXP_MASK < 0x100000 ? 20 : \ ++ DBL_EXP_MASK < 0x200000 ? 21 : \ ++ DBL_EXP_MASK < 0x400000 ? 22 : \ ++ DBL_EXP_MASK < 0x800000 ? 23 : \ ++ DBL_EXP_MASK < 0x1000000 ? 24 : \ ++ DBL_EXP_MASK < 0x2000000 ? 25 : \ ++ DBL_EXP_MASK < 0x4000000 ? 26 : \ ++ DBL_EXP_MASK < 0x8000000 ? 27 : \ ++ DBL_EXP_MASK < 0x10000000 ? 28 : \ ++ DBL_EXP_MASK < 0x20000000 ? 29 : \ ++ DBL_EXP_MASK < 0x40000000 ? 30 : \ ++ DBL_EXP_MASK <= 0x7fffffff ? 31 : \ ++ 32) ++#define LDBL_EXP_BIT \ ++ (LDBL_EXP_MASK < 0x100 ? 8 : \ ++ LDBL_EXP_MASK < 0x200 ? 9 : \ ++ LDBL_EXP_MASK < 0x400 ? 10 : \ ++ LDBL_EXP_MASK < 0x800 ? 11 : \ ++ LDBL_EXP_MASK < 0x1000 ? 12 : \ ++ LDBL_EXP_MASK < 0x2000 ? 13 : \ ++ LDBL_EXP_MASK < 0x4000 ? 14 : \ ++ LDBL_EXP_MASK < 0x8000 ? 15 : \ ++ LDBL_EXP_MASK < 0x10000 ? 16 : \ ++ LDBL_EXP_MASK < 0x20000 ? 17 : \ ++ LDBL_EXP_MASK < 0x40000 ? 18 : \ ++ LDBL_EXP_MASK < 0x80000 ? 19 : \ ++ LDBL_EXP_MASK < 0x100000 ? 20 : \ ++ LDBL_EXP_MASK < 0x200000 ? 21 : \ ++ LDBL_EXP_MASK < 0x400000 ? 22 : \ ++ LDBL_EXP_MASK < 0x800000 ? 23 : \ ++ LDBL_EXP_MASK < 0x1000000 ? 24 : \ ++ LDBL_EXP_MASK < 0x2000000 ? 25 : \ ++ LDBL_EXP_MASK < 0x4000000 ? 26 : \ ++ LDBL_EXP_MASK < 0x8000000 ? 27 : \ ++ LDBL_EXP_MASK < 0x10000000 ? 28 : \ ++ LDBL_EXP_MASK < 0x20000000 ? 29 : \ ++ LDBL_EXP_MASK < 0x40000000 ? 30 : \ ++ LDBL_EXP_MASK <= 0x7fffffff ? 31 : \ ++ 32) ++ ++/* Number of bits used for a floating-point number: the mantissa (not ++ counting the "hidden bit", since it may or may not be explicit), the ++ exponent, and the sign. */ ++#define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1) ++#define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1) ++#define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1) ++ ++/* Number of bytes used for a floating-point number. ++ This can be smaller than the 'sizeof'. For example, on i386 systems, ++ 'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence ++ LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but ++ sizeof (long double) = 12 or = 16. */ ++#define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) ++#define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) ++#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) ++ ++/* Verify that SIZEOF_FLT <= sizeof (float) etc. */ ++typedef int verify_sizeof_flt[SIZEOF_FLT <= sizeof (float) ? 1 : -1]; ++typedef int verify_sizeof_dbl[SIZEOF_DBL <= sizeof (double) ? 1 : - 1]; ++typedef int verify_sizeof_ldbl[SIZEOF_LDBL <= sizeof (long double) ? 1 : - 1]; ++ ++#endif /* _FLOATPLUS_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/float.c b/xbmc/screensavers/rsxs-0.9/lib/float.c +new file mode 100644 +index 0000000..b05b40c +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/float.c +@@ -0,0 +1,33 @@ ++/* Auxiliary definitions for . ++ Copyright (C) 2011 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2011. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++/* Specification. */ ++#include ++ ++#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ ++const union gl_long_double_union gl_LDBL_MAX = ++ { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } }; ++#elif defined __i386__ ++const union gl_long_double_union gl_LDBL_MAX = ++ { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } }; ++#else ++/* This declaration is solely to ensure that after preprocessing ++ this file is never empty. */ ++typedef int dummy; ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/float.in.h b/xbmc/screensavers/rsxs-0.9/lib/float.in.h +new file mode 100644 +index 0000000..d5b2258 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/float.in.h +@@ -0,0 +1,188 @@ ++/* A correct . ++ ++ Copyright (C) 2007-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#ifndef _@GUARD_PREFIX@_FLOAT_H ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++/* The include_next requires a split double-inclusion guard. */ ++#@INCLUDE_NEXT@ @NEXT_FLOAT_H@ ++ ++#ifndef _@GUARD_PREFIX@_FLOAT_H ++#define _@GUARD_PREFIX@_FLOAT_H ++ ++/* 'long double' properties. */ ++ ++#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) ++/* Number of mantissa units, in base FLT_RADIX. */ ++# undef LDBL_MANT_DIG ++# define LDBL_MANT_DIG 64 ++/* Number of decimal digits that is sufficient for representing a number. */ ++# undef LDBL_DIG ++# define LDBL_DIG 18 ++/* x-1 where x is the smallest representable number > 1. */ ++# undef LDBL_EPSILON ++# define LDBL_EPSILON 1.0842021724855044340E-19L ++/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */ ++# undef LDBL_MIN_EXP ++# define LDBL_MIN_EXP (-16381) ++/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */ ++# undef LDBL_MAX_EXP ++# define LDBL_MAX_EXP 16384 ++/* Minimum positive normalized number. */ ++# undef LDBL_MIN ++# define LDBL_MIN 3.3621031431120935063E-4932L ++/* Maximum representable finite number. */ ++# undef LDBL_MAX ++# define LDBL_MAX 1.1897314953572317650E+4932L ++/* Minimum e such that 10^e is in the range of normalized numbers. */ ++# undef LDBL_MIN_10_EXP ++# define LDBL_MIN_10_EXP (-4931) ++/* Maximum e such that 10^e is in the range of representable finite numbers. */ ++# undef LDBL_MAX_10_EXP ++# define LDBL_MAX_10_EXP 4932 ++#endif ++ ++/* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of ++ precision in the compiler but 64 bits of precision at runtime. See ++ . */ ++#if defined __i386__ && defined __FreeBSD__ ++/* Number of mantissa units, in base FLT_RADIX. */ ++# undef LDBL_MANT_DIG ++# define LDBL_MANT_DIG 64 ++/* Number of decimal digits that is sufficient for representing a number. */ ++# undef LDBL_DIG ++# define LDBL_DIG 18 ++/* x-1 where x is the smallest representable number > 1. */ ++# undef LDBL_EPSILON ++# define LDBL_EPSILON 1.084202172485504434007452800869941711426e-19L /* 2^-63 */ ++/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */ ++# undef LDBL_MIN_EXP ++# define LDBL_MIN_EXP (-16381) ++/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */ ++# undef LDBL_MAX_EXP ++# define LDBL_MAX_EXP 16384 ++/* Minimum positive normalized number. */ ++# undef LDBL_MIN ++# define LDBL_MIN 3.3621031431120935E-4932L /* = 0x1p-16382L */ ++/* Maximum representable finite number. */ ++# undef LDBL_MAX ++/* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }. ++ But the largest literal that GCC allows us to write is ++ 0x0.fffffffffffff8p16384L = { 0xFFFFF800, 0xFFFFFFFF, 32766 }. ++ So, define it like this through a reference to an external variable ++ ++ const unsigned int LDBL_MAX[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }; ++ extern const long double LDBL_MAX; ++ ++ Unfortunately, this is not a constant expression. */ ++union gl_long_double_union ++ { ++ struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd; ++ long double ld; ++ }; ++extern const union gl_long_double_union gl_LDBL_MAX; ++# define LDBL_MAX (gl_LDBL_MAX.ld) ++/* Minimum e such that 10^e is in the range of normalized numbers. */ ++# undef LDBL_MIN_10_EXP ++# define LDBL_MIN_10_EXP (-4931) ++/* Maximum e such that 10^e is in the range of representable finite numbers. */ ++# undef LDBL_MAX_10_EXP ++# define LDBL_MAX_10_EXP 4932 ++#endif ++ ++/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are ++ wrong. ++ On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong. */ ++#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ ++# undef LDBL_MIN_EXP ++# define LDBL_MIN_EXP DBL_MIN_EXP ++# undef LDBL_MIN_10_EXP ++# define LDBL_MIN_10_EXP DBL_MIN_10_EXP ++# undef LDBL_MIN ++# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ ++#endif ++#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ ++# undef LDBL_MAX ++/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }. ++ It is not easy to define: ++ #define LDBL_MAX 1.79769313486231580793728971405302307166e308L ++ is too small, whereas ++ #define LDBL_MAX 1.79769313486231580793728971405302307167e308L ++ is too large. Apparently a bug in GCC decimal-to-binary conversion. ++ Also, I can't get values larger than ++ #define LDBL63 ((long double) (1ULL << 63)) ++ #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) ++ #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) ++ #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) ++ #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL) ++ which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }. ++ So, define it like this through a reference to an external variable ++ ++ const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }; ++ extern const long double LDBL_MAX; ++ ++ or through a pointer cast ++ ++ #define LDBL_MAX \ ++ (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }) ++ ++ Unfortunately, this is not a constant expression, and the latter expression ++ does not work well when GCC is optimizing.. */ ++union gl_long_double_union ++ { ++ struct { double hi; double lo; } dd; ++ long double ld; ++ }; ++extern const union gl_long_double_union gl_LDBL_MAX; ++# define LDBL_MAX (gl_LDBL_MAX.ld) ++#endif ++ ++/* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong. ++ On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON ++ are wrong. */ ++#if defined __sgi && (LDBL_MANT_DIG >= 106) ++# undef LDBL_MANT_DIG ++# define LDBL_MANT_DIG 106 ++# if defined __GNUC__ ++# undef LDBL_MIN_EXP ++# define LDBL_MIN_EXP DBL_MIN_EXP ++# undef LDBL_MIN_10_EXP ++# define LDBL_MIN_10_EXP DBL_MIN_10_EXP ++# undef LDBL_MIN ++# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ ++# undef LDBL_EPSILON ++# define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */ ++# endif ++#endif ++ ++#if @REPLACE_ITOLD@ ++/* Pull in a function that fixes the 'int' to 'long double' conversion ++ of glibc 2.7. */ ++extern ++# ifdef __cplusplus ++"C" ++# endif ++void _Qp_itoq (long double *, int); ++static void (*_gl_float_fix_itold) (long double *, int) = _Qp_itoq; ++#endif ++ ++#endif /* _@GUARD_PREFIX@_FLOAT_H */ ++#endif /* _@GUARD_PREFIX@_FLOAT_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/getopt.c b/xbmc/screensavers/rsxs-0.9/lib/getopt.c +index f37a837..7c9f704 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/getopt.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/getopt.c +@@ -1,26 +1,25 @@ + /* Getopt for GNU. +- NOTE: getopt is now part of the C library, so if you don't know what ++ NOTE: getopt is part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to drepper@gnu.org + before changing it! +- Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006 +- Free Software Foundation, Inc. ++ Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2011 Free Software ++ Foundation, Inc. + This file is part of the GNU C Library. + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + +-#ifdef HAVE_CONFIG_H ++#ifndef _LIBC + # include + #endif + +@@ -31,10 +30,6 @@ + #include + #include + +-#ifdef __VMS +-# include +-#endif +- + #ifdef _LIBC + # include + #else +@@ -46,12 +41,9 @@ + # include + #endif + +-#ifndef attribute_hidden +-# define attribute_hidden +-#endif +- +-/* Unlike standard Unix `getopt', functions like `getopt_long' +- let the user intersperse the options with the other arguments. ++/* This version of `getopt' appears to the caller like standard Unix `getopt' ++ but it behaves differently for the user, since it allows the user ++ to intersperse the options with the other arguments. + + As `getopt_long' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus +@@ -59,7 +51,7 @@ + + Using `getopt' or setting the environment variable POSIXLY_CORRECT + disables permutation. +- Then the application's behavior is completely standard. ++ Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ +@@ -126,18 +118,18 @@ + + # ifdef USE_NONOPTION_FLAGS + # define SWAP_FLAGS(ch1, ch2) \ +- if (d->__nonoption_flags_len > 0) \ +- { \ +- char __tmp = __getopt_nonoption_flags[ch1]; \ +- __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ +- __getopt_nonoption_flags[ch2] = __tmp; \ ++ if (d->__nonoption_flags_len > 0) \ ++ { \ ++ char __tmp = __getopt_nonoption_flags[ch1]; \ ++ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ ++ __getopt_nonoption_flags[ch2] = __tmp; \ + } + # else + # define SWAP_FLAGS(ch1, ch2) + # endif +-#else /* !_LIBC */ ++#else /* !_LIBC */ + # define SWAP_FLAGS(ch1, ch2) +-#endif /* _LIBC */ ++#endif /* _LIBC */ + + /* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) +@@ -168,57 +160,57 @@ + if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) + { + /* We must extend the array. The user plays games with us and +- presents new arguments. */ ++ presents new arguments. */ + char *new_str = malloc (top + 1); + if (new_str == NULL) +- d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0; ++ d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0; + else +- { +- memset (__mempcpy (new_str, __getopt_nonoption_flags, +- d->__nonoption_flags_max_len), +- '\0', top + 1 - d->__nonoption_flags_max_len); +- d->__nonoption_flags_max_len = top + 1; +- __getopt_nonoption_flags = new_str; +- } ++ { ++ memset (__mempcpy (new_str, __getopt_nonoption_flags, ++ d->__nonoption_flags_max_len), ++ '\0', top + 1 - d->__nonoption_flags_max_len); ++ d->__nonoption_flags_max_len = top + 1; ++ __getopt_nonoption_flags = new_str; ++ } + } + #endif + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) +- { +- /* Bottom segment is the short one. */ +- int len = middle - bottom; +- register int i; +- +- /* Swap it with the top part of the top segment. */ +- for (i = 0; i < len; i++) +- { +- tem = argv[bottom + i]; +- argv[bottom + i] = argv[top - (middle - bottom) + i]; +- argv[top - (middle - bottom) + i] = tem; +- SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); +- } +- /* Exclude the moved bottom segment from further swapping. */ +- top -= len; +- } ++ { ++ /* Bottom segment is the short one. */ ++ int len = middle - bottom; ++ register int i; ++ ++ /* Swap it with the top part of the top segment. */ ++ for (i = 0; i < len; i++) ++ { ++ tem = argv[bottom + i]; ++ argv[bottom + i] = argv[top - (middle - bottom) + i]; ++ argv[top - (middle - bottom) + i] = tem; ++ SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); ++ } ++ /* Exclude the moved bottom segment from further swapping. */ ++ top -= len; ++ } + else +- { +- /* Top segment is the short one. */ +- int len = top - middle; +- register int i; +- +- /* Swap it with the bottom part of the bottom segment. */ +- for (i = 0; i < len; i++) +- { +- tem = argv[bottom + i]; +- argv[bottom + i] = argv[middle + i]; +- argv[middle + i] = tem; +- SWAP_FLAGS (bottom + i, middle + i); +- } +- /* Exclude the moved top segment from further swapping. */ +- bottom += len; +- } ++ { ++ /* Top segment is the short one. */ ++ int len = top - middle; ++ register int i; ++ ++ /* Swap it with the bottom part of the bottom segment. */ ++ for (i = 0; i < len; i++) ++ { ++ tem = argv[bottom + i]; ++ argv[bottom + i] = argv[middle + i]; ++ argv[middle + i] = tem; ++ SWAP_FLAGS (bottom + i, middle + i); ++ } ++ /* Exclude the moved top segment from further swapping. */ ++ bottom += len; ++ } + } + + /* Update records for the slots the non-options now occupy. */ +@@ -230,8 +222,9 @@ + /* Initialize the internal data when the first call is made. */ + + static const char * +-_getopt_initialize (int argc, char **argv, const char *optstring, +- int posixly_correct, struct _getopt_data *d) ++_getopt_initialize (int argc _GL_UNUSED, ++ char **argv _GL_UNUSED, const char *optstring, ++ struct _getopt_data *d, int posixly_correct) + { + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped +@@ -265,25 +258,25 @@ + && argc == __libc_argc && argv == __libc_argv) + { + if (d->__nonoption_flags_max_len == 0) +- { +- if (__getopt_nonoption_flags == NULL +- || __getopt_nonoption_flags[0] == '\0') +- d->__nonoption_flags_max_len = -1; +- else +- { +- const char *orig_str = __getopt_nonoption_flags; +- int len = d->__nonoption_flags_max_len = strlen (orig_str); +- if (d->__nonoption_flags_max_len < argc) +- d->__nonoption_flags_max_len = argc; +- __getopt_nonoption_flags = +- (char *) malloc (d->__nonoption_flags_max_len); +- if (__getopt_nonoption_flags == NULL) +- d->__nonoption_flags_max_len = -1; +- else +- memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), +- '\0', d->__nonoption_flags_max_len - len); +- } +- } ++ { ++ if (__getopt_nonoption_flags == NULL ++ || __getopt_nonoption_flags[0] == '\0') ++ d->__nonoption_flags_max_len = -1; ++ else ++ { ++ const char *orig_str = __getopt_nonoption_flags; ++ int len = d->__nonoption_flags_max_len = strlen (orig_str); ++ if (d->__nonoption_flags_max_len < argc) ++ d->__nonoption_flags_max_len = argc; ++ __getopt_nonoption_flags = ++ (char *) malloc (d->__nonoption_flags_max_len); ++ if (__getopt_nonoption_flags == NULL) ++ d->__nonoption_flags_max_len = -1; ++ else ++ memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), ++ '\0', d->__nonoption_flags_max_len - len); ++ } ++ } + d->__nonoption_flags_len = d->__nonoption_flags_max_len; + } + else +@@ -335,6 +328,10 @@ + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + ++ The elements of ARGV aren't really const, because we permute them. ++ But we pretend they're const in the prototype to be compatible ++ with other systems. ++ + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + +@@ -343,19 +340,14 @@ + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce +- long-named options. +- +- If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT +- environment variable were set. */ ++ long-named options. */ + + int + _getopt_internal_r (int argc, char **argv, const char *optstring, +- const struct option *longopts, int *longind, +- int long_only, int posixly_correct, struct _getopt_data *d) ++ const struct option *longopts, int *longind, ++ int long_only, struct _getopt_data *d, int posixly_correct) + { + int print_errors = d->opterr; +- if (optstring[0] == ':') +- print_errors = 0; + + if (argc < 1) + return -1; +@@ -365,11 +357,15 @@ + if (d->optind == 0 || !d->__initialized) + { + if (d->optind == 0) +- d->optind = 1; /* Don't scan ARGV[0], the program name. */ +- optstring = _getopt_initialize (argc, argv, optstring, +- posixly_correct, d); ++ d->optind = 1; /* Don't scan ARGV[0], the program name. */ ++ optstring = _getopt_initialize (argc, argv, optstring, d, ++ posixly_correct); + d->__initialized = 1; + } ++ else if (optstring[0] == '-' || optstring[0] == '+') ++ optstring++; ++ if (optstring[0] == ':') ++ print_errors = 0; + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag +@@ -377,8 +373,8 @@ + is only used when the used in the GNU libc. */ + #if defined _LIBC && defined USE_NONOPTION_FLAGS + # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \ +- || (d->optind < d->__nonoption_flags_len \ +- && __getopt_nonoption_flags[d->optind] == '1')) ++ || (d->optind < d->__nonoption_flags_len \ ++ && __getopt_nonoption_flags[d->optind] == '1')) + #else + # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') + #endif +@@ -388,78 +384,78 @@ + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been +- moved back by the user (who may also have changed the arguments). */ ++ moved back by the user (who may also have changed the arguments). */ + if (d->__last_nonopt > d->optind) +- d->__last_nonopt = d->optind; ++ d->__last_nonopt = d->optind; + if (d->__first_nonopt > d->optind) +- d->__first_nonopt = d->optind; ++ d->__first_nonopt = d->optind; + + if (d->__ordering == PERMUTE) +- { +- /* If we have just processed some options following some non-options, +- exchange them so that the options come first. */ ++ { ++ /* If we have just processed some options following some non-options, ++ exchange them so that the options come first. */ + +- if (d->__first_nonopt != d->__last_nonopt +- && d->__last_nonopt != d->optind) +- exchange ((char **) argv, d); +- else if (d->__last_nonopt != d->optind) +- d->__first_nonopt = d->optind; ++ if (d->__first_nonopt != d->__last_nonopt ++ && d->__last_nonopt != d->optind) ++ exchange ((char **) argv, d); ++ else if (d->__last_nonopt != d->optind) ++ d->__first_nonopt = d->optind; + +- /* Skip any additional non-options +- and extend the range of non-options previously skipped. */ ++ /* Skip any additional non-options ++ and extend the range of non-options previously skipped. */ + +- while (d->optind < argc && NONOPTION_P) +- d->optind++; +- d->__last_nonopt = d->optind; +- } ++ while (d->optind < argc && NONOPTION_P) ++ d->optind++; ++ d->__last_nonopt = d->optind; ++ } + + /* The special ARGV-element `--' means premature end of options. +- Skip it like a null option, +- then exchange with previous non-options as if it were an option, +- then skip everything else like a non-option. */ ++ Skip it like a null option, ++ then exchange with previous non-options as if it were an option, ++ then skip everything else like a non-option. */ + + if (d->optind != argc && !strcmp (argv[d->optind], "--")) +- { +- d->optind++; ++ { ++ d->optind++; + +- if (d->__first_nonopt != d->__last_nonopt +- && d->__last_nonopt != d->optind) +- exchange ((char **) argv, d); +- else if (d->__first_nonopt == d->__last_nonopt) +- d->__first_nonopt = d->optind; +- d->__last_nonopt = argc; ++ if (d->__first_nonopt != d->__last_nonopt ++ && d->__last_nonopt != d->optind) ++ exchange ((char **) argv, d); ++ else if (d->__first_nonopt == d->__last_nonopt) ++ d->__first_nonopt = d->optind; ++ d->__last_nonopt = argc; + +- d->optind = argc; +- } ++ d->optind = argc; ++ } + + /* If we have done all the ARGV-elements, stop the scan +- and back over any non-options that we skipped and permuted. */ ++ and back over any non-options that we skipped and permuted. */ + + if (d->optind == argc) +- { +- /* Set the next-arg-index to point at the non-options +- that we previously skipped, so the caller will digest them. */ +- if (d->__first_nonopt != d->__last_nonopt) +- d->optind = d->__first_nonopt; +- return -1; +- } ++ { ++ /* Set the next-arg-index to point at the non-options ++ that we previously skipped, so the caller will digest them. */ ++ if (d->__first_nonopt != d->__last_nonopt) ++ d->optind = d->__first_nonopt; ++ return -1; ++ } + + /* If we have come to a non-option and did not permute it, +- either stop the scan or describe it to the caller and pass it by. */ ++ either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) +- { +- if (d->__ordering == REQUIRE_ORDER) +- return -1; +- d->optarg = argv[d->optind++]; +- return 1; +- } ++ { ++ if (d->__ordering == REQUIRE_ORDER) ++ return -1; ++ d->optarg = argv[d->optind++]; ++ return 1; ++ } + + /* We have found another option-ARGV-element. +- Skip the initial punctuation. */ ++ Skip the initial punctuation. */ + + d->__nextchar = (argv[d->optind] + 1 +- + (longopts != NULL && argv[d->optind][1] == '-')); ++ + (longopts != NULL && argv[d->optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ +@@ -479,606 +475,650 @@ + + if (longopts != NULL + && (argv[d->optind][1] == '-' +- || (long_only && (argv[d->optind][2] +- || !strchr (optstring, argv[d->optind][1]))))) ++ || (long_only && (argv[d->optind][2] ++ || !strchr (optstring, argv[d->optind][1]))))) + { + char *nameend; ++ unsigned int namelen; + const struct option *p; + const struct option *pfound = NULL; ++ struct option_list ++ { ++ const struct option *p; ++ struct option_list *next; ++ } *ambig_list = NULL; + int exact = 0; +- int ambig = 0; + int indfound = -1; + int option_index; + + for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) +- /* Do nothing. */ ; ++ /* Do nothing. */ ; ++ namelen = nameend - d->__nextchar; + + /* Test all long options for either exact match +- or abbreviated matches. */ ++ or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) +- if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) +- { +- if ((unsigned int) (nameend - d->__nextchar) +- == (unsigned int) strlen (p->name)) +- { +- /* Exact match found. */ +- pfound = p; +- indfound = option_index; +- exact = 1; +- break; +- } +- else if (pfound == NULL) +- { +- /* First nonexact match found. */ +- pfound = p; +- indfound = option_index; +- } +- else if (long_only +- || pfound->has_arg != p->has_arg +- || pfound->flag != p->flag +- || pfound->val != p->val) +- /* Second or later nonexact match found. */ +- ambig = 1; +- } +- +- if (ambig && !exact) +- { +- if (print_errors) +- { ++ if (!strncmp (p->name, d->__nextchar, namelen)) ++ { ++ if (namelen == (unsigned int) strlen (p->name)) ++ { ++ /* Exact match found. */ ++ pfound = p; ++ indfound = option_index; ++ exact = 1; ++ break; ++ } ++ else if (pfound == NULL) ++ { ++ /* First nonexact match found. */ ++ pfound = p; ++ indfound = option_index; ++ } ++ else if (long_only ++ || pfound->has_arg != p->has_arg ++ || pfound->flag != p->flag ++ || pfound->val != p->val) ++ { ++ /* Second or later nonexact match found. */ ++ struct option_list *newp = malloc (sizeof (*newp)); ++ newp->p = p; ++ newp->next = ambig_list; ++ ambig_list = newp; ++ } ++ } ++ ++ if (ambig_list != NULL && !exact) ++ { ++ if (print_errors) ++ { ++ struct option_list first; ++ first.p = pfound; ++ first.next = ambig_list; ++ ambig_list = &first; ++ + #if defined _LIBC && defined USE_IN_LIBIO +- char *buf; ++ char *buf = NULL; ++ size_t buflen = 0; + +- if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), +- argv[0], argv[d->optind]) >= 0) +- { +- _IO_flockfile (stderr); ++ FILE *fp = open_memstream (&buf, &buflen); ++ if (fp != NULL) ++ { ++ fprintf (fp, ++ _("%s: option '%s' is ambiguous; possibilities:"), ++ argv[0], argv[d->optind]); + +- int old_flags2 = ((_IO_FILE *) stderr)->_flags2; +- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; ++ do ++ { ++ fprintf (fp, " '--%s'", ambig_list->p->name); ++ ambig_list = ambig_list->next; ++ } ++ while (ambig_list != NULL); + +- __fxprintf (NULL, "%s", buf); ++ fputc_unlocked ('\n', fp); + +- ((_IO_FILE *) stderr)->_flags2 = old_flags2; +- _IO_funlockfile (stderr); ++ if (__builtin_expect (fclose (fp) != EOF, 1)) ++ { ++ _IO_flockfile (stderr); + +- free (buf); +- } ++ int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ++ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; ++ ++ __fxprintf (NULL, "%s", buf); ++ ++ ((_IO_FILE *) stderr)->_flags2 = old_flags2; ++ _IO_funlockfile (stderr); ++ ++ free (buf); ++ } ++ } + #else +- fprintf (stderr, _("%s: option `%s' is ambiguous\n"), +- argv[0], argv[d->optind]); ++ fprintf (stderr, ++ _("%s: option '%s' is ambiguous; possibilities:"), ++ argv[0], argv[d->optind]); ++ do ++ { ++ fprintf (stderr, " '--%s'", ambig_list->p->name); ++ ambig_list = ambig_list->next; ++ } ++ while (ambig_list != NULL); ++ ++ fputc ('\n', stderr); + #endif +- } +- d->__nextchar += strlen (d->__nextchar); +- d->optind++; +- d->optopt = 0; +- return '?'; +- } ++ } ++ d->__nextchar += strlen (d->__nextchar); ++ d->optind++; ++ d->optopt = 0; ++ return '?'; ++ } ++ ++ while (ambig_list != NULL) ++ { ++ struct option_list *pn = ambig_list->next; ++ free (ambig_list); ++ ambig_list = pn; ++ } + + if (pfound != NULL) +- { +- option_index = indfound; +- d->optind++; +- if (*nameend) +- { +- /* Don't test has_arg with >, because some C compilers don't +- allow it to be used on enums. */ +- if (pfound->has_arg) +- d->optarg = nameend + 1; +- else +- { +- if (print_errors) +- { ++ { ++ option_index = indfound; ++ d->optind++; ++ if (*nameend) ++ { ++ /* Don't test has_arg with >, because some C compilers don't ++ allow it to be used on enums. */ ++ if (pfound->has_arg) ++ d->optarg = nameend + 1; ++ else ++ { ++ if (print_errors) ++ { + #if defined _LIBC && defined USE_IN_LIBIO +- char *buf; +- int n; ++ char *buf; ++ int n; + #endif + +- if (argv[d->optind - 1][1] == '-') +- { +- /* --option */ ++ if (argv[d->optind - 1][1] == '-') ++ { ++ /* --option */ + #if defined _LIBC && defined USE_IN_LIBIO +- n = __asprintf (&buf, _("\ +-%s: option `--%s' doesn't allow an argument\n"), +- argv[0], pfound->name); ++ n = __asprintf (&buf, _("\ ++%s: option '--%s' doesn't allow an argument\n"), ++ argv[0], pfound->name); + #else +- fprintf (stderr, _("\ +-%s: option `--%s' doesn't allow an argument\n"), +- argv[0], pfound->name); ++ fprintf (stderr, _("\ ++%s: option '--%s' doesn't allow an argument\n"), ++ argv[0], pfound->name); + #endif +- } +- else +- { +- /* +option or -option */ ++ } ++ else ++ { ++ /* +option or -option */ + #if defined _LIBC && defined USE_IN_LIBIO +- n = __asprintf (&buf, _("\ +-%s: option `%c%s' doesn't allow an argument\n"), +- argv[0], argv[d->optind - 1][0], +- pfound->name); ++ n = __asprintf (&buf, _("\ ++%s: option '%c%s' doesn't allow an argument\n"), ++ argv[0], argv[d->optind - 1][0], ++ pfound->name); + #else +- fprintf (stderr, _("\ +-%s: option `%c%s' doesn't allow an argument\n"), +- argv[0], argv[d->optind - 1][0], +- pfound->name); ++ fprintf (stderr, _("\ ++%s: option '%c%s' doesn't allow an argument\n"), ++ argv[0], argv[d->optind - 1][0], ++ pfound->name); + #endif +- } ++ } + + #if defined _LIBC && defined USE_IN_LIBIO +- if (n >= 0) +- { +- _IO_flockfile (stderr); ++ if (n >= 0) ++ { ++ _IO_flockfile (stderr); + +- int old_flags2 = ((_IO_FILE *) stderr)->_flags2; +- ((_IO_FILE *) stderr)->_flags2 +- |= _IO_FLAGS2_NOTCANCEL; ++ int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ++ ((_IO_FILE *) stderr)->_flags2 ++ |= _IO_FLAGS2_NOTCANCEL; + +- __fxprintf (NULL, "%s", buf); ++ __fxprintf (NULL, "%s", buf); + +- ((_IO_FILE *) stderr)->_flags2 = old_flags2; +- _IO_funlockfile (stderr); ++ ((_IO_FILE *) stderr)->_flags2 = old_flags2; ++ _IO_funlockfile (stderr); + +- free (buf); +- } ++ free (buf); ++ } + #endif +- } +- +- d->__nextchar += strlen (d->__nextchar); +- +- d->optopt = pfound->val; +- return '?'; +- } +- } +- else if (pfound->has_arg == 1) +- { +- if (d->optind < argc) +- d->optarg = argv[d->optind++]; +- else +- { +- if (print_errors) +- { ++ } ++ ++ d->__nextchar += strlen (d->__nextchar); ++ ++ d->optopt = pfound->val; ++ return '?'; ++ } ++ } ++ else if (pfound->has_arg == 1) ++ { ++ if (d->optind < argc) ++ d->optarg = argv[d->optind++]; ++ else ++ { ++ if (print_errors) ++ { + #if defined _LIBC && defined USE_IN_LIBIO +- char *buf; ++ char *buf; + +- if (__asprintf (&buf, _("\ +-%s: option `%s' requires an argument\n"), +- argv[0], argv[d->optind - 1]) >= 0) +- { +- _IO_flockfile (stderr); ++ if (__asprintf (&buf, _("\ ++%s: option '--%s' requires an argument\n"), ++ argv[0], pfound->name) >= 0) ++ { ++ _IO_flockfile (stderr); + +- int old_flags2 = ((_IO_FILE *) stderr)->_flags2; +- ((_IO_FILE *) stderr)->_flags2 +- |= _IO_FLAGS2_NOTCANCEL; ++ int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ++ ((_IO_FILE *) stderr)->_flags2 ++ |= _IO_FLAGS2_NOTCANCEL; + +- __fxprintf (NULL, "%s", buf); ++ __fxprintf (NULL, "%s", buf); + +- ((_IO_FILE *) stderr)->_flags2 = old_flags2; +- _IO_funlockfile (stderr); ++ ((_IO_FILE *) stderr)->_flags2 = old_flags2; ++ _IO_funlockfile (stderr); + +- free (buf); +- } ++ free (buf); ++ } + #else +- fprintf (stderr, +- _("%s: option `%s' requires an argument\n"), +- argv[0], argv[d->optind - 1]); ++ fprintf (stderr, ++ _("%s: option '--%s' requires an argument\n"), ++ argv[0], pfound->name); + #endif +- } +- d->__nextchar += strlen (d->__nextchar); +- d->optopt = pfound->val; +- return optstring[0] == ':' ? ':' : '?'; +- } +- } +- d->__nextchar += strlen (d->__nextchar); +- if (longind != NULL) +- *longind = option_index; +- if (pfound->flag) +- { +- *(pfound->flag) = pfound->val; +- return 0; +- } +- return pfound->val; +- } ++ } ++ d->__nextchar += strlen (d->__nextchar); ++ d->optopt = pfound->val; ++ return optstring[0] == ':' ? ':' : '?'; ++ } ++ } ++ d->__nextchar += strlen (d->__nextchar); ++ if (longind != NULL) ++ *longind = option_index; ++ if (pfound->flag) ++ { ++ *(pfound->flag) = pfound->val; ++ return 0; ++ } ++ return pfound->val; ++ } + + /* Can't find it as a long option. If this is not getopt_long_only, +- or the option starts with '--' or is not a valid short +- option, then it's an error. +- Otherwise interpret it as a short option. */ ++ or the option starts with '--' or is not a valid short ++ option, then it's an error. ++ Otherwise interpret it as a short option. */ + if (!long_only || argv[d->optind][1] == '-' +- || strchr (optstring, *d->__nextchar) == NULL) +- { +- if (print_errors) +- { ++ || strchr (optstring, *d->__nextchar) == NULL) ++ { ++ if (print_errors) ++ { + #if defined _LIBC && defined USE_IN_LIBIO +- char *buf; +- int n; ++ char *buf; ++ int n; + #endif + +- if (argv[d->optind][1] == '-') +- { +- /* --option */ ++ if (argv[d->optind][1] == '-') ++ { ++ /* --option */ + #if defined _LIBC && defined USE_IN_LIBIO +- n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), +- argv[0], d->__nextchar); ++ n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"), ++ argv[0], d->__nextchar); + #else +- fprintf (stderr, _("%s: unrecognized option `--%s'\n"), +- argv[0], d->__nextchar); ++ fprintf (stderr, _("%s: unrecognized option '--%s'\n"), ++ argv[0], d->__nextchar); + #endif +- } +- else +- { +- /* +option or -option */ ++ } ++ else ++ { ++ /* +option or -option */ + #if defined _LIBC && defined USE_IN_LIBIO +- n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), +- argv[0], argv[d->optind][0], d->__nextchar); ++ n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"), ++ argv[0], argv[d->optind][0], d->__nextchar); + #else +- fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), +- argv[0], argv[d->optind][0], d->__nextchar); ++ fprintf (stderr, _("%s: unrecognized option '%c%s'\n"), ++ argv[0], argv[d->optind][0], d->__nextchar); + #endif +- } ++ } + + #if defined _LIBC && defined USE_IN_LIBIO +- if (n >= 0) +- { +- _IO_flockfile (stderr); ++ if (n >= 0) ++ { ++ _IO_flockfile (stderr); + +- int old_flags2 = ((_IO_FILE *) stderr)->_flags2; +- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; ++ int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ++ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + +- __fxprintf (NULL, "%s", buf); ++ __fxprintf (NULL, "%s", buf); + +- ((_IO_FILE *) stderr)->_flags2 = old_flags2; +- _IO_funlockfile (stderr); ++ ((_IO_FILE *) stderr)->_flags2 = old_flags2; ++ _IO_funlockfile (stderr); + +- free (buf); +- } ++ free (buf); ++ } + #endif +- } +- d->__nextchar = (char *) ""; +- d->optind++; +- d->optopt = 0; +- return '?'; +- } ++ } ++ d->__nextchar = (char *) ""; ++ d->optind++; ++ d->optopt = 0; ++ return '?'; ++ } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *d->__nextchar++; +- char *temp = strchr (optstring, c); ++ const char *temp = strchr (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*d->__nextchar == '\0') + ++d->optind; + +- if (temp == NULL || c == ':') ++ if (temp == NULL || c == ':' || c == ';') + { +- if (print_errors) +- { ++ if (print_errors) ++ { + #if defined _LIBC && defined USE_IN_LIBIO +- char *buf; +- int n; ++ char *buf; ++ int n; + #endif + +- if (d->__posixly_correct) +- { +- /* 1003.2 specifies the format of this message. */ +-#if defined _LIBC && defined USE_IN_LIBIO +- n = __asprintf (&buf, _("%s: illegal option -- %c\n"), +- argv[0], c); +-#else +- fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); +-#endif +- } +- else +- { + #if defined _LIBC && defined USE_IN_LIBIO +- n = __asprintf (&buf, _("%s: invalid option -- %c\n"), +- argv[0], c); ++ n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"), ++ argv[0], c); + #else +- fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); ++ fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c); + #endif +- } + + #if defined _LIBC && defined USE_IN_LIBIO +- if (n >= 0) +- { +- _IO_flockfile (stderr); ++ if (n >= 0) ++ { ++ _IO_flockfile (stderr); + +- int old_flags2 = ((_IO_FILE *) stderr)->_flags2; +- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; ++ int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ++ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + +- __fxprintf (NULL, "%s", buf); ++ __fxprintf (NULL, "%s", buf); + +- ((_IO_FILE *) stderr)->_flags2 = old_flags2; +- _IO_funlockfile (stderr); ++ ((_IO_FILE *) stderr)->_flags2 = old_flags2; ++ _IO_funlockfile (stderr); + +- free (buf); +- } ++ free (buf); ++ } + #endif +- } +- d->optopt = c; +- return '?'; ++ } ++ d->optopt = c; ++ return '?'; + } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { +- char *nameend; +- const struct option *p; +- const struct option *pfound = NULL; +- int exact = 0; +- int ambig = 0; +- int indfound = 0; +- int option_index; +- +- /* This is an option that requires an argument. */ +- if (*d->__nextchar != '\0') +- { +- d->optarg = d->__nextchar; +- /* If we end this ARGV-element by taking the rest as an arg, +- we must advance to the next element now. */ +- d->optind++; +- } +- else if (d->optind == argc) +- { +- if (print_errors) +- { +- /* 1003.2 specifies the format of this message. */ ++ char *nameend; ++ const struct option *p; ++ const struct option *pfound = NULL; ++ int exact = 0; ++ int ambig = 0; ++ int indfound = 0; ++ int option_index; ++ ++ if (longopts == NULL) ++ goto no_longs; ++ ++ /* This is an option that requires an argument. */ ++ if (*d->__nextchar != '\0') ++ { ++ d->optarg = d->__nextchar; ++ /* If we end this ARGV-element by taking the rest as an arg, ++ we must advance to the next element now. */ ++ d->optind++; ++ } ++ else if (d->optind == argc) ++ { ++ if (print_errors) ++ { + #if defined _LIBC && defined USE_IN_LIBIO +- char *buf; ++ char *buf; + +- if (__asprintf (&buf, +- _("%s: option requires an argument -- %c\n"), +- argv[0], c) >= 0) +- { +- _IO_flockfile (stderr); ++ if (__asprintf (&buf, ++ _("%s: option requires an argument -- '%c'\n"), ++ argv[0], c) >= 0) ++ { ++ _IO_flockfile (stderr); + +- int old_flags2 = ((_IO_FILE *) stderr)->_flags2; +- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; ++ int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ++ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + +- __fxprintf (NULL, "%s", buf); ++ __fxprintf (NULL, "%s", buf); + +- ((_IO_FILE *) stderr)->_flags2 = old_flags2; +- _IO_funlockfile (stderr); ++ ((_IO_FILE *) stderr)->_flags2 = old_flags2; ++ _IO_funlockfile (stderr); + +- free (buf); +- } ++ free (buf); ++ } + #else +- fprintf (stderr, _("%s: option requires an argument -- %c\n"), +- argv[0], c); ++ fprintf (stderr, ++ _("%s: option requires an argument -- '%c'\n"), ++ argv[0], c); + #endif +- } +- d->optopt = c; +- if (optstring[0] == ':') +- c = ':'; +- else +- c = '?'; +- return c; +- } +- else +- /* We already incremented `d->optind' once; +- increment it again when taking next ARGV-elt as argument. */ +- d->optarg = argv[d->optind++]; +- +- /* optarg is now the argument, see if it's in the +- table of longopts. */ +- +- for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '='; +- nameend++) +- /* Do nothing. */ ; +- +- /* Test all long options for either exact match +- or abbreviated matches. */ +- for (p = longopts, option_index = 0; p->name; p++, option_index++) +- if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) +- { +- if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) +- { +- /* Exact match found. */ +- pfound = p; +- indfound = option_index; +- exact = 1; +- break; +- } +- else if (pfound == NULL) +- { +- /* First nonexact match found. */ +- pfound = p; +- indfound = option_index; +- } +- else +- /* Second or later nonexact match found. */ +- ambig = 1; +- } +- if (ambig && !exact) +- { +- if (print_errors) +- { ++ } ++ d->optopt = c; ++ if (optstring[0] == ':') ++ c = ':'; ++ else ++ c = '?'; ++ return c; ++ } ++ else ++ /* We already incremented `d->optind' once; ++ increment it again when taking next ARGV-elt as argument. */ ++ d->optarg = argv[d->optind++]; ++ ++ /* optarg is now the argument, see if it's in the ++ table of longopts. */ ++ ++ for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '='; ++ nameend++) ++ /* Do nothing. */ ; ++ ++ /* Test all long options for either exact match ++ or abbreviated matches. */ ++ for (p = longopts, option_index = 0; p->name; p++, option_index++) ++ if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) ++ { ++ if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) ++ { ++ /* Exact match found. */ ++ pfound = p; ++ indfound = option_index; ++ exact = 1; ++ break; ++ } ++ else if (pfound == NULL) ++ { ++ /* First nonexact match found. */ ++ pfound = p; ++ indfound = option_index; ++ } ++ else if (long_only ++ || pfound->has_arg != p->has_arg ++ || pfound->flag != p->flag ++ || pfound->val != p->val) ++ /* Second or later nonexact match found. */ ++ ambig = 1; ++ } ++ if (ambig && !exact) ++ { ++ if (print_errors) ++ { + #if defined _LIBC && defined USE_IN_LIBIO +- char *buf; ++ char *buf; + +- if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), +- argv[0], argv[d->optind]) >= 0) +- { +- _IO_flockfile (stderr); ++ if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"), ++ argv[0], d->optarg) >= 0) ++ { ++ _IO_flockfile (stderr); + +- int old_flags2 = ((_IO_FILE *) stderr)->_flags2; +- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; ++ int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ++ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + +- __fxprintf (NULL, "%s", buf); ++ __fxprintf (NULL, "%s", buf); + +- ((_IO_FILE *) stderr)->_flags2 = old_flags2; +- _IO_funlockfile (stderr); ++ ((_IO_FILE *) stderr)->_flags2 = old_flags2; ++ _IO_funlockfile (stderr); + +- free (buf); +- } ++ free (buf); ++ } + #else +- fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), +- argv[0], argv[d->optind]); ++ fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"), ++ argv[0], d->optarg); + #endif +- } +- d->__nextchar += strlen (d->__nextchar); +- d->optind++; +- return '?'; +- } +- if (pfound != NULL) +- { +- option_index = indfound; +- if (*nameend) +- { +- /* Don't test has_arg with >, because some C compilers don't +- allow it to be used on enums. */ +- if (pfound->has_arg) +- d->optarg = nameend + 1; +- else +- { +- if (print_errors) +- { ++ } ++ d->__nextchar += strlen (d->__nextchar); ++ d->optind++; ++ return '?'; ++ } ++ if (pfound != NULL) ++ { ++ option_index = indfound; ++ if (*nameend) ++ { ++ /* Don't test has_arg with >, because some C compilers don't ++ allow it to be used on enums. */ ++ if (pfound->has_arg) ++ d->optarg = nameend + 1; ++ else ++ { ++ if (print_errors) ++ { + #if defined _LIBC && defined USE_IN_LIBIO +- char *buf; ++ char *buf; + +- if (__asprintf (&buf, _("\ +-%s: option `-W %s' doesn't allow an argument\n"), +- argv[0], pfound->name) >= 0) +- { +- _IO_flockfile (stderr); ++ if (__asprintf (&buf, _("\ ++%s: option '-W %s' doesn't allow an argument\n"), ++ argv[0], pfound->name) >= 0) ++ { ++ _IO_flockfile (stderr); + +- int old_flags2 = ((_IO_FILE *) stderr)->_flags2; +- ((_IO_FILE *) stderr)->_flags2 +- |= _IO_FLAGS2_NOTCANCEL; ++ int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ++ ((_IO_FILE *) stderr)->_flags2 ++ |= _IO_FLAGS2_NOTCANCEL; + +- __fxprintf (NULL, "%s", buf); ++ __fxprintf (NULL, "%s", buf); + +- ((_IO_FILE *) stderr)->_flags2 = old_flags2; +- _IO_funlockfile (stderr); ++ ((_IO_FILE *) stderr)->_flags2 = old_flags2; ++ _IO_funlockfile (stderr); + +- free (buf); +- } ++ free (buf); ++ } + #else +- fprintf (stderr, _("\ +-%s: option `-W %s' doesn't allow an argument\n"), +- argv[0], pfound->name); ++ fprintf (stderr, _("\ ++%s: option '-W %s' doesn't allow an argument\n"), ++ argv[0], pfound->name); + #endif +- } +- +- d->__nextchar += strlen (d->__nextchar); +- return '?'; +- } +- } +- else if (pfound->has_arg == 1) +- { +- if (d->optind < argc) +- d->optarg = argv[d->optind++]; +- else +- { +- if (print_errors) +- { ++ } ++ ++ d->__nextchar += strlen (d->__nextchar); ++ return '?'; ++ } ++ } ++ else if (pfound->has_arg == 1) ++ { ++ if (d->optind < argc) ++ d->optarg = argv[d->optind++]; ++ else ++ { ++ if (print_errors) ++ { + #if defined _LIBC && defined USE_IN_LIBIO +- char *buf; ++ char *buf; + +- if (__asprintf (&buf, _("\ +-%s: option `%s' requires an argument\n"), +- argv[0], argv[d->optind - 1]) >= 0) +- { +- _IO_flockfile (stderr); ++ if (__asprintf (&buf, _("\ ++%s: option '-W %s' requires an argument\n"), ++ argv[0], pfound->name) >= 0) ++ { ++ _IO_flockfile (stderr); + +- int old_flags2 = ((_IO_FILE *) stderr)->_flags2; +- ((_IO_FILE *) stderr)->_flags2 +- |= _IO_FLAGS2_NOTCANCEL; ++ int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ++ ((_IO_FILE *) stderr)->_flags2 ++ |= _IO_FLAGS2_NOTCANCEL; + +- __fxprintf (NULL, "%s", buf); ++ __fxprintf (NULL, "%s", buf); + +- ((_IO_FILE *) stderr)->_flags2 = old_flags2; +- _IO_funlockfile (stderr); ++ ((_IO_FILE *) stderr)->_flags2 = old_flags2; ++ _IO_funlockfile (stderr); + +- free (buf); +- } ++ free (buf); ++ } + #else +- fprintf (stderr, +- _("%s: option `%s' requires an argument\n"), +- argv[0], argv[d->optind - 1]); ++ fprintf (stderr, _("\ ++%s: option '-W %s' requires an argument\n"), ++ argv[0], pfound->name); + #endif +- } +- d->__nextchar += strlen (d->__nextchar); +- return optstring[0] == ':' ? ':' : '?'; +- } +- } +- d->__nextchar += strlen (d->__nextchar); +- if (longind != NULL) +- *longind = option_index; +- if (pfound->flag) +- { +- *(pfound->flag) = pfound->val; +- return 0; +- } +- return pfound->val; +- } +- d->__nextchar = NULL; +- return 'W'; /* Let the application handle it. */ ++ } ++ d->__nextchar += strlen (d->__nextchar); ++ return optstring[0] == ':' ? ':' : '?'; ++ } ++ } ++ else ++ d->optarg = NULL; ++ d->__nextchar += strlen (d->__nextchar); ++ if (longind != NULL) ++ *longind = option_index; ++ if (pfound->flag) ++ { ++ *(pfound->flag) = pfound->val; ++ return 0; ++ } ++ return pfound->val; ++ } ++ ++ no_longs: ++ d->__nextchar = NULL; ++ return 'W'; /* Let the application handle it. */ + } + if (temp[1] == ':') + { +- if (temp[2] == ':') +- { +- /* This is an option that accepts an argument optionally. */ +- if (*d->__nextchar != '\0') +- { +- d->optarg = d->__nextchar; +- d->optind++; +- } +- else +- d->optarg = NULL; +- d->__nextchar = NULL; +- } +- else +- { +- /* This is an option that requires an argument. */ +- if (*d->__nextchar != '\0') +- { +- d->optarg = d->__nextchar; +- /* If we end this ARGV-element by taking the rest as an arg, +- we must advance to the next element now. */ +- d->optind++; +- } +- else if (d->optind == argc) +- { +- if (print_errors) +- { +- /* 1003.2 specifies the format of this message. */ ++ if (temp[2] == ':') ++ { ++ /* This is an option that accepts an argument optionally. */ ++ if (*d->__nextchar != '\0') ++ { ++ d->optarg = d->__nextchar; ++ d->optind++; ++ } ++ else ++ d->optarg = NULL; ++ d->__nextchar = NULL; ++ } ++ else ++ { ++ /* This is an option that requires an argument. */ ++ if (*d->__nextchar != '\0') ++ { ++ d->optarg = d->__nextchar; ++ /* If we end this ARGV-element by taking the rest as an arg, ++ we must advance to the next element now. */ ++ d->optind++; ++ } ++ else if (d->optind == argc) ++ { ++ if (print_errors) ++ { + #if defined _LIBC && defined USE_IN_LIBIO +- char *buf; ++ char *buf; + +- if (__asprintf (&buf, _("\ +-%s: option requires an argument -- %c\n"), +- argv[0], c) >= 0) +- { +- _IO_flockfile (stderr); ++ if (__asprintf (&buf, _("\ ++%s: option requires an argument -- '%c'\n"), ++ argv[0], c) >= 0) ++ { ++ _IO_flockfile (stderr); + +- int old_flags2 = ((_IO_FILE *) stderr)->_flags2; +- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; ++ int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ++ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + +- __fxprintf (NULL, "%s", buf); ++ __fxprintf (NULL, "%s", buf); + +- ((_IO_FILE *) stderr)->_flags2 = old_flags2; +- _IO_funlockfile (stderr); ++ ((_IO_FILE *) stderr)->_flags2 = old_flags2; ++ _IO_funlockfile (stderr); + +- free (buf); +- } ++ free (buf); ++ } + #else +- fprintf (stderr, +- _("%s: option requires an argument -- %c\n"), +- argv[0], c); ++ fprintf (stderr, ++ _("%s: option requires an argument -- '%c'\n"), ++ argv[0], c); + #endif +- } +- d->optopt = c; +- if (optstring[0] == ':') +- c = ':'; +- else +- c = '?'; +- } +- else +- /* We already incremented `optind' once; +- increment it again when taking next ARGV-elt as argument. */ +- d->optarg = argv[d->optind++]; +- d->__nextchar = NULL; +- } ++ } ++ d->optopt = c; ++ if (optstring[0] == ':') ++ c = ':'; ++ else ++ c = '?'; ++ } ++ else ++ /* We already incremented `optind' once; ++ increment it again when taking next ARGV-elt as argument. */ ++ d->optarg = argv[d->optind++]; ++ d->__nextchar = NULL; ++ } + } + return c; + } +@@ -1086,16 +1126,17 @@ + + int + _getopt_internal (int argc, char **argv, const char *optstring, +- const struct option *longopts, int *longind, +- int long_only, int posixly_correct) ++ const struct option *longopts, int *longind, int long_only, ++ int posixly_correct) + { + int result; + + getopt_data.optind = optind; + getopt_data.opterr = opterr; + +- result = _getopt_internal_r (argc, argv, optstring, longopts, longind, +- long_only, posixly_correct, &getopt_data); ++ result = _getopt_internal_r (argc, argv, optstring, longopts, ++ longind, long_only, &getopt_data, ++ posixly_correct); + + optind = getopt_data.optind; + optarg = getopt_data.optarg; +@@ -1115,10 +1156,23 @@ + int + getopt (int argc, char *const *argv, const char *optstring) + { +- return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, +- POSIXLY_CORRECT); ++ return _getopt_internal (argc, (char **) argv, optstring, ++ (const struct option *) 0, ++ (int *) 0, ++ 0, POSIXLY_CORRECT); + } + ++#ifdef _LIBC ++int ++__posix_getopt (int argc, char *const *argv, const char *optstring) ++{ ++ return _getopt_internal (argc, argv, optstring, ++ (const struct option *) 0, ++ (int *) 0, ++ 0, 1); ++} ++#endif ++ + + #ifdef TEST + +@@ -1137,51 +1191,51 @@ + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == -1) +- break; ++ break; + + switch (c) +- { +- case '0': +- case '1': +- case '2': +- case '3': +- case '4': +- case '5': +- case '6': +- case '7': +- case '8': +- case '9': +- if (digit_optind != 0 && digit_optind != this_option_optind) +- printf ("digits occur in two different argv-elements.\n"); +- digit_optind = this_option_optind; +- printf ("option %c\n", c); +- break; +- +- case 'a': +- printf ("option a\n"); +- break; +- +- case 'b': +- printf ("option b\n"); +- break; +- +- case 'c': +- printf ("option c with value `%s'\n", optarg); +- break; +- +- case '?': +- break; +- +- default: +- printf ("?? getopt returned character code 0%o ??\n", c); +- } ++ { ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ if (digit_optind != 0 && digit_optind != this_option_optind) ++ printf ("digits occur in two different argv-elements.\n"); ++ digit_optind = this_option_optind; ++ printf ("option %c\n", c); ++ break; ++ ++ case 'a': ++ printf ("option a\n"); ++ break; ++ ++ case 'b': ++ printf ("option b\n"); ++ break; ++ ++ case 'c': ++ printf ("option c with value '%s'\n", optarg); ++ break; ++ ++ case '?': ++ break; ++ ++ default: ++ printf ("?? getopt returned character code 0%o ??\n", c); ++ } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) +- printf ("%s ", argv[optind++]); ++ printf ("%s ", argv[optind++]); + printf ("\n"); + } + +diff --git a/xbmc/screensavers/rsxs-0.9/lib/getopt.in.h b/xbmc/screensavers/rsxs-0.9/lib/getopt.in.h +new file mode 100644 +index 0000000..0f3918a +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/getopt.in.h +@@ -0,0 +1,253 @@ ++/* Declarations for getopt. ++ Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2011 Free Software ++ Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#ifndef _@GUARD_PREFIX@_GETOPT_H ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++/* The include_next requires a split double-inclusion guard. We must ++ also inform the replacement unistd.h to not recursively use ++ ; our definitions will be present soon enough. */ ++#if @HAVE_GETOPT_H@ ++# define _GL_SYSTEM_GETOPT ++# @INCLUDE_NEXT@ @NEXT_GETOPT_H@ ++# undef _GL_SYSTEM_GETOPT ++#endif ++ ++#ifndef _@GUARD_PREFIX@_GETOPT_H ++ ++#ifndef __need_getopt ++# define _@GUARD_PREFIX@_GETOPT_H 1 ++#endif ++ ++/* Standalone applications should #define __GETOPT_PREFIX to an ++ identifier that prefixes the external functions and variables ++ defined in this header. When this happens, include the ++ headers that might declare getopt so that they will not cause ++ confusion if included after this file (if the system had , ++ we have already included it). Then systematically rename ++ identifiers so that they do not collide with the system functions ++ and variables. Renaming avoids problems with some compilers and ++ linkers. */ ++#if defined __GETOPT_PREFIX && !defined __need_getopt ++# if !@HAVE_GETOPT_H@ ++# include ++# include ++# include ++# endif ++# undef __need_getopt ++# undef getopt ++# undef getopt_long ++# undef getopt_long_only ++# undef optarg ++# undef opterr ++# undef optind ++# undef optopt ++# undef option ++# define __GETOPT_CONCAT(x, y) x ## y ++# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) ++# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) ++# define getopt __GETOPT_ID (getopt) ++# define getopt_long __GETOPT_ID (getopt_long) ++# define getopt_long_only __GETOPT_ID (getopt_long_only) ++# define optarg __GETOPT_ID (optarg) ++# define opterr __GETOPT_ID (opterr) ++# define optind __GETOPT_ID (optind) ++# define optopt __GETOPT_ID (optopt) ++# define option __GETOPT_ID (option) ++# define _getopt_internal __GETOPT_ID (getopt_internal) ++#endif ++ ++/* Standalone applications get correct prototypes for getopt_long and ++ getopt_long_only; they declare "char **argv". libc uses prototypes ++ with "char *const *argv" that are incorrect because getopt_long and ++ getopt_long_only can permute argv; this is required for backward ++ compatibility (e.g., for LSB 2.0.1). ++ ++ This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', ++ but it caused redefinition warnings if both unistd.h and getopt.h were ++ included, since unistd.h includes getopt.h having previously defined ++ __need_getopt. ++ ++ The only place where __getopt_argv_const is used is in definitions ++ of getopt_long and getopt_long_only below, but these are visible ++ only if __need_getopt is not defined, so it is quite safe to rewrite ++ the conditional as follows: ++*/ ++#if !defined __need_getopt ++# if defined __GETOPT_PREFIX ++# define __getopt_argv_const /* empty */ ++# else ++# define __getopt_argv_const const ++# endif ++#endif ++ ++/* If __GNU_LIBRARY__ is not already defined, either we are being used ++ standalone, or this is the first header included in the source file. ++ If we are being used with glibc, we need to include , but ++ that does not exist if we are standalone. So: if __GNU_LIBRARY__ is ++ not defined, include , which will pull in for us ++ if it's from glibc. (Why ctype.h? It's guaranteed to exist and it ++ doesn't flood the namespace with stuff the way some other headers do.) */ ++#if !defined __GNU_LIBRARY__ ++# include ++#endif ++ ++#ifndef __THROW ++# ifndef __GNUC_PREREQ ++# define __GNUC_PREREQ(maj, min) (0) ++# endif ++# if defined __cplusplus && __GNUC_PREREQ (2,8) ++# define __THROW throw () ++# else ++# define __THROW ++# endif ++#endif ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/* For communication from `getopt' to the caller. ++ When `getopt' finds an option that takes an argument, ++ the argument value is returned here. ++ Also, when `ordering' is RETURN_IN_ORDER, ++ each non-option ARGV-element is returned here. */ ++ ++extern char *optarg; ++ ++/* Index in ARGV of the next element to be scanned. ++ This is used for communication to and from the caller ++ and for communication between successive calls to `getopt'. ++ ++ On entry to `getopt', zero means this is the first call; initialize. ++ ++ When `getopt' returns -1, this is the index of the first of the ++ non-option elements that the caller should itself scan. ++ ++ Otherwise, `optind' communicates from one call to the next ++ how much of ARGV has been scanned so far. */ ++ ++extern int optind; ++ ++/* Callers store zero here to inhibit the error message `getopt' prints ++ for unrecognized options. */ ++ ++extern int opterr; ++ ++/* Set to an option character which was unrecognized. */ ++ ++extern int optopt; ++ ++#ifndef __need_getopt ++/* Describe the long-named options requested by the application. ++ The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector ++ of `struct option' terminated by an element containing a name which is ++ zero. ++ ++ The field `has_arg' is: ++ no_argument (or 0) if the option does not take an argument, ++ required_argument (or 1) if the option requires an argument, ++ optional_argument (or 2) if the option takes an optional argument. ++ ++ If the field `flag' is not NULL, it points to a variable that is set ++ to the value given in the field `val' when the option is found, but ++ left unchanged if the option is not found. ++ ++ To have a long-named option do something other than set an `int' to ++ a compiled-in constant, such as set a value from `optarg', set the ++ option's `flag' field to zero and its `val' field to a nonzero ++ value (the equivalent single-letter option character, if there is ++ one). For long options that have a zero `flag' field, `getopt' ++ returns the contents of the `val' field. */ ++ ++# if !GNULIB_defined_struct_option ++struct option ++{ ++ const char *name; ++ /* has_arg can't be an enum because some compilers complain about ++ type mismatches in all the code that assumes it is an int. */ ++ int has_arg; ++ int *flag; ++ int val; ++}; ++# define GNULIB_defined_struct_option 1 ++# endif ++ ++/* Names for the values of the `has_arg' field of `struct option'. */ ++ ++# define no_argument 0 ++# define required_argument 1 ++# define optional_argument 2 ++#endif /* need getopt */ ++ ++ ++/* Get definitions and prototypes for functions to process the ++ arguments in ARGV (ARGC of them, minus the program name) for ++ options given in OPTS. ++ ++ Return the option character from OPTS just read. Return -1 when ++ there are no more options. For unrecognized options, or options ++ missing arguments, `optopt' is set to the option letter, and '?' is ++ returned. ++ ++ The OPTS string is a list of characters which are recognized option ++ letters, optionally followed by colons, specifying that that letter ++ takes an argument, to be placed in `optarg'. ++ ++ If a letter in OPTS is followed by two colons, its argument is ++ optional. This behavior is specific to the GNU `getopt'. ++ ++ The argument `--' causes premature termination of argument ++ scanning, explicitly telling `getopt' that there are no more ++ options. ++ ++ If OPTS begins with `-', then non-option arguments are treated as ++ arguments to the option '\1'. This behavior is specific to the GNU ++ `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in ++ the environment, then do not permute arguments. */ ++ ++extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) ++ __THROW _GL_ARG_NONNULL ((2, 3)); ++ ++#ifndef __need_getopt ++extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, ++ const char *__shortopts, ++ const struct option *__longopts, int *__longind) ++ __THROW _GL_ARG_NONNULL ((2, 3)); ++extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, ++ const char *__shortopts, ++ const struct option *__longopts, int *__longind) ++ __THROW _GL_ARG_NONNULL ((2, 3)); ++ ++#endif ++ ++#ifdef __cplusplus ++} ++#endif ++ ++/* Make sure we later can get all the definitions and declarations. */ ++#undef __need_getopt ++ ++#endif /* _@GUARD_PREFIX@_GETOPT_H */ ++#endif /* _@GUARD_PREFIX@_GETOPT_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/getopt1.c b/xbmc/screensavers/rsxs-0.9/lib/getopt1.c +index 25d7926..3656802 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/getopt1.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/getopt1.c +@@ -1,29 +1,25 @@ + /* getopt_long and getopt_long_only entry points for GNU getopt. +- Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004 +- Free Software Foundation, Inc. ++ Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2011 Free Software ++ Foundation, Inc. + This file is part of the GNU C Library. + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif +- + #ifdef _LIBC + # include + #else ++# include + # include "getopt.h" + #endif + #include "getopt_int.h" +@@ -36,25 +32,25 @@ + #include + #endif + +-#ifndef NULL ++#ifndef NULL + #define NULL 0 + #endif + + int + getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, +- const struct option *long_options, int *opt_index) ++ const struct option *long_options, int *opt_index) + { + return _getopt_internal (argc, (char **) argv, options, long_options, +- opt_index, 0, 0); ++ opt_index, 0, 0); + } + + int + _getopt_long_r (int argc, char **argv, const char *options, +- const struct option *long_options, int *opt_index, +- struct _getopt_data *d) ++ const struct option *long_options, int *opt_index, ++ struct _getopt_data *d) + { + return _getopt_internal_r (argc, argv, options, long_options, opt_index, +- 0, 0, d); ++ 0, d, 0); + } + + /* Like getopt_long, but '-' as well as '--' can indicate a long option. +@@ -64,20 +60,20 @@ + + int + getopt_long_only (int argc, char *__getopt_argv_const *argv, +- const char *options, +- const struct option *long_options, int *opt_index) ++ const char *options, ++ const struct option *long_options, int *opt_index) + { + return _getopt_internal (argc, (char **) argv, options, long_options, +- opt_index, 1, 0); ++ opt_index, 1, 0); + } + + int + _getopt_long_only_r (int argc, char **argv, const char *options, +- const struct option *long_options, int *opt_index, +- struct _getopt_data *d) ++ const struct option *long_options, int *opt_index, ++ struct _getopt_data *d) + { + return _getopt_internal_r (argc, argv, options, long_options, opt_index, +- 1, 0, d); ++ 1, d, 0); + } + + +@@ -95,76 +91,76 @@ + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; +- static struct option long_options[] = ++ static const struct option long_options[] = + { +- {"add", 1, 0, 0}, +- {"append", 0, 0, 0}, +- {"delete", 1, 0, 0}, +- {"verbose", 0, 0, 0}, +- {"create", 0, 0, 0}, +- {"file", 1, 0, 0}, +- {0, 0, 0, 0} ++ {"add", 1, 0, 0}, ++ {"append", 0, 0, 0}, ++ {"delete", 1, 0, 0}, ++ {"verbose", 0, 0, 0}, ++ {"create", 0, 0, 0}, ++ {"file", 1, 0, 0}, ++ {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", +- long_options, &option_index); ++ long_options, &option_index); + if (c == -1) +- break; ++ break; + + switch (c) +- { +- case 0: +- printf ("option %s", long_options[option_index].name); +- if (optarg) +- printf (" with arg %s", optarg); +- printf ("\n"); +- break; +- +- case '0': +- case '1': +- case '2': +- case '3': +- case '4': +- case '5': +- case '6': +- case '7': +- case '8': +- case '9': +- if (digit_optind != 0 && digit_optind != this_option_optind) +- printf ("digits occur in two different argv-elements.\n"); +- digit_optind = this_option_optind; +- printf ("option %c\n", c); +- break; +- +- case 'a': +- printf ("option a\n"); +- break; +- +- case 'b': +- printf ("option b\n"); +- break; +- +- case 'c': +- printf ("option c with value `%s'\n", optarg); +- break; +- +- case 'd': +- printf ("option d with value `%s'\n", optarg); +- break; +- +- case '?': +- break; +- +- default: +- printf ("?? getopt returned character code 0%o ??\n", c); +- } ++ { ++ case 0: ++ printf ("option %s", long_options[option_index].name); ++ if (optarg) ++ printf (" with arg %s", optarg); ++ printf ("\n"); ++ break; ++ ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ if (digit_optind != 0 && digit_optind != this_option_optind) ++ printf ("digits occur in two different argv-elements.\n"); ++ digit_optind = this_option_optind; ++ printf ("option %c\n", c); ++ break; ++ ++ case 'a': ++ printf ("option a\n"); ++ break; ++ ++ case 'b': ++ printf ("option b\n"); ++ break; ++ ++ case 'c': ++ printf ("option c with value `%s'\n", optarg); ++ break; ++ ++ case 'd': ++ printf ("option d with value `%s'\n", optarg); ++ break; ++ ++ case '?': ++ break; ++ ++ default: ++ printf ("?? getopt returned character code 0%o ??\n", c); ++ } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) +- printf ("%s ", argv[optind++]); ++ printf ("%s ", argv[optind++]); + printf ("\n"); + } + +diff --git a/xbmc/screensavers/rsxs-0.9/lib/getopt_int.h b/xbmc/screensavers/rsxs-0.9/lib/getopt_int.h +index 401579f..9f0c713 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/getopt_int.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/getopt_int.h +@@ -1,34 +1,69 @@ + /* Internal declarations for getopt. +- Copyright (C) 1989-1994,1996-1999,2001,2003,2004 +- Free Software Foundation, Inc. ++ Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2011 Free Software ++ Foundation, Inc. + This file is part of the GNU C Library. + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ + + #ifndef _GETOPT_INT_H +-#define _GETOPT_INT_H 1 ++#define _GETOPT_INT_H 1 ++ ++#include + + extern int _getopt_internal (int ___argc, char **___argv, +- const char *__shortopts, +- const struct option *__longopts, int *__longind, +- int __long_only, int __posixly_correct); ++ const char *__shortopts, ++ const struct option *__longopts, int *__longind, ++ int __long_only, int __posixly_correct); + + + /* Reentrant versions which can handle parsing multiple argument + vectors at the same time. */ + ++/* Describe how to deal with options that follow non-option ARGV-elements. ++ ++ If the caller did not specify anything, ++ the default is REQUIRE_ORDER if the environment variable ++ POSIXLY_CORRECT is defined, PERMUTE otherwise. ++ ++ REQUIRE_ORDER means don't recognize them as options; ++ stop option processing when the first non-option is seen. ++ This is what Unix does. ++ This mode of operation is selected by either setting the environment ++ variable POSIXLY_CORRECT, or using `+' as the first character ++ of the list of option characters, or by calling getopt. ++ ++ PERMUTE is the default. We permute the contents of ARGV as we ++ scan, so that eventually all the non-options are at the end. ++ This allows options to be given in any order, even with programs ++ that were not written to expect this. ++ ++ RETURN_IN_ORDER is an option available to programs that were ++ written to expect options and other ARGV-elements in any order ++ and that care about the ordering of the two. We describe each ++ non-option ARGV-element as if it were the argument of an option ++ with character code 1. Using `-' as the first character of the ++ list of option characters selects this mode of operation. ++ ++ The special argument `--' forces an end of option-scanning regardless ++ of the value of `ordering'. In the case of RETURN_IN_ORDER, only ++ `--' can cause `getopt' to return -1 with `optind' != ARGC. */ ++ ++enum __ord ++ { ++ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER ++ }; ++ + /* Data type for reentrant functions. */ + struct _getopt_data + { +@@ -53,39 +88,8 @@ struct _getopt_data + by advancing to the next ARGV-element. */ + char *__nextchar; + +- /* Describe how to deal with options that follow non-option ARGV-elements. +- +- If the caller did not specify anything, +- the default is REQUIRE_ORDER if the environment variable +- POSIXLY_CORRECT is defined, PERMUTE otherwise. +- +- REQUIRE_ORDER means don't recognize them as options; +- stop option processing when the first non-option is seen. +- This is what Unix does. +- This mode of operation is selected by either setting the environment +- variable POSIXLY_CORRECT, or using `+' as the first character +- of the list of option characters, or by calling getopt. +- +- PERMUTE is the default. We permute the contents of ARGV as we +- scan, so that eventually all the non-options are at the end. +- This allows options to be given in any order, even with programs +- that were not written to expect this. +- +- RETURN_IN_ORDER is an option available to programs that were +- written to expect options and other ARGV-elements in any order +- and that care about the ordering of the two. We describe each +- non-option ARGV-element as if it were the argument of an option +- with character code 1. Using `-' as the first character of the +- list of option characters selects this mode of operation. +- +- The special argument `--' forces an end of option-scanning regardless +- of the value of `ordering'. In the case of RETURN_IN_ORDER, only +- `--' can cause `getopt' to return -1 with `optind' != ARGC. */ +- +- enum +- { +- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +- } __ordering; ++ /* See __ord above. */ ++ enum __ord __ordering; + + /* If the POSIXLY_CORRECT environment variable is set + or getopt was called. */ +@@ -104,28 +108,28 @@ struct _getopt_data + #if defined _LIBC && defined USE_NONOPTION_FLAGS + int __nonoption_flags_max_len; + int __nonoption_flags_len; +-# endif ++#endif + }; + + /* The initializer is necessary to set OPTIND and OPTERR to their + default values and to clear the initialization flag. */ +-#define _GETOPT_DATA_INITIALIZER { 1, 1 } ++#define _GETOPT_DATA_INITIALIZER { 1, 1 } + + extern int _getopt_internal_r (int ___argc, char **___argv, +- const char *__shortopts, +- const struct option *__longopts, int *__longind, +- int __long_only, int __posixly_correct, +- struct _getopt_data *__data); ++ const char *__shortopts, ++ const struct option *__longopts, int *__longind, ++ int __long_only, struct _getopt_data *__data, ++ int __posixly_correct); + + extern int _getopt_long_r (int ___argc, char **___argv, +- const char *__shortopts, +- const struct option *__longopts, int *__longind, +- struct _getopt_data *__data); ++ const char *__shortopts, ++ const struct option *__longopts, int *__longind, ++ struct _getopt_data *__data); + + extern int _getopt_long_only_r (int ___argc, char **___argv, +- const char *__shortopts, +- const struct option *__longopts, +- int *__longind, +- struct _getopt_data *__data); ++ const char *__shortopts, ++ const struct option *__longopts, ++ int *__longind, ++ struct _getopt_data *__data); + + #endif /* getopt_int.h */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/gettext.h b/xbmc/screensavers/rsxs-0.9/lib/gettext.h +index 285cb31..792e506 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/gettext.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/gettext.h +@@ -1,9 +1,10 @@ + /* Convenience header for conditional use of GNU . +- Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc. ++ Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software ++ Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -24,6 +25,18 @@ + /* Get declarations of GNU message catalog functions. */ + # include + ++/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by ++ the gettext() and ngettext() macros. This is an alternative to calling ++ textdomain(), and is useful for libraries. */ ++# ifdef DEFAULT_TEXT_DOMAIN ++# undef gettext ++# define gettext(Msgid) \ ++ dgettext (DEFAULT_TEXT_DOMAIN, Msgid) ++# undef ngettext ++# define ngettext(Msgid1, Msgid2, N) \ ++ dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) ++# endif ++ + #else + + /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which +@@ -41,7 +54,7 @@ + it now, to make later inclusions of a NOP. */ + #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) + # include +-# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H ++# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H + # include + # endif + #endif +@@ -51,21 +64,41 @@ + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ ++# undef gettext + # define gettext(Msgid) ((const char *) (Msgid)) +-# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) +-# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) ++# undef dgettext ++# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) ++# undef dcgettext ++# define dcgettext(Domainname, Msgid, Category) \ ++ ((void) (Category), dgettext (Domainname, Msgid)) ++# undef ngettext + # define ngettext(Msgid1, Msgid2, N) \ +- ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) ++ ((N) == 1 \ ++ ? ((void) (Msgid2), (const char *) (Msgid1)) \ ++ : ((void) (Msgid1), (const char *) (Msgid2))) ++# undef dngettext + # define dngettext(Domainname, Msgid1, Msgid2, N) \ +- ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) ++ ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) ++# undef dcngettext + # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ +- ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) ++ ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) ++# undef textdomain + # define textdomain(Domainname) ((const char *) (Domainname)) +-# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) +-# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) ++# undef bindtextdomain ++# define bindtextdomain(Domainname, Dirname) \ ++ ((void) (Domainname), (const char *) (Dirname)) ++# undef bind_textdomain_codeset ++# define bind_textdomain_codeset(Domainname, Codeset) \ ++ ((void) (Domainname), (const char *) (Codeset)) + + #endif + ++/* Prefer gnulib's setlocale override over libintl's setlocale override. */ ++#ifdef GNULIB_defined_setlocale ++# undef setlocale ++# define setlocale rpl_setlocale ++#endif ++ + /* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. +@@ -75,4 +108,179 @@ + initializer for static 'char[]' or 'const char[]' variables. */ + #define gettext_noop(String) String + ++/* The separator between msgctxt and msgid in a .mo file. */ ++#define GETTEXT_CONTEXT_GLUE "\004" ++ ++/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a ++ MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be ++ short and rarely need to change. ++ The letter 'p' stands for 'particular' or 'special'. */ ++#ifdef DEFAULT_TEXT_DOMAIN ++# define pgettext(Msgctxt, Msgid) \ ++ pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) ++#else ++# define pgettext(Msgctxt, Msgid) \ ++ pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) ++#endif ++#define dpgettext(Domainname, Msgctxt, Msgid) \ ++ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) ++#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ ++ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) ++#ifdef DEFAULT_TEXT_DOMAIN ++# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ ++ npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) ++#else ++# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ ++ npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) ++#endif ++#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ ++ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) ++#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ ++ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) ++ ++#ifdef __GNUC__ ++__inline ++#else ++#ifdef __cplusplus ++inline ++#endif ++#endif ++static const char * ++pgettext_aux (const char *domain, ++ const char *msg_ctxt_id, const char *msgid, ++ int category) ++{ ++ const char *translation = dcgettext (domain, msg_ctxt_id, category); ++ if (translation == msg_ctxt_id) ++ return msgid; ++ else ++ return translation; ++} ++ ++#ifdef __GNUC__ ++__inline ++#else ++#ifdef __cplusplus ++inline ++#endif ++#endif ++static const char * ++npgettext_aux (const char *domain, ++ const char *msg_ctxt_id, const char *msgid, ++ const char *msgid_plural, unsigned long int n, ++ int category) ++{ ++ const char *translation = ++ dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); ++ if (translation == msg_ctxt_id || translation == msgid_plural) ++ return (n == 1 ? msgid : msgid_plural); ++ else ++ return translation; ++} ++ ++/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID ++ can be arbitrary expressions. But for string literals these macros are ++ less efficient than those above. */ ++ ++#include ++ ++#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ ++ (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ ++ /* || __STDC_VERSION__ >= 199901L */ ) ++ ++#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS ++#include ++#endif ++ ++#define pgettext_expr(Msgctxt, Msgid) \ ++ dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) ++#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ ++ dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) ++ ++#ifdef __GNUC__ ++__inline ++#else ++#ifdef __cplusplus ++inline ++#endif ++#endif ++static const char * ++dcpgettext_expr (const char *domain, ++ const char *msgctxt, const char *msgid, ++ int category) ++{ ++ size_t msgctxt_len = strlen (msgctxt) + 1; ++ size_t msgid_len = strlen (msgid) + 1; ++ const char *translation; ++#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS ++ char msg_ctxt_id[msgctxt_len + msgid_len]; ++#else ++ char buf[1024]; ++ char *msg_ctxt_id = ++ (msgctxt_len + msgid_len <= sizeof (buf) ++ ? buf ++ : (char *) malloc (msgctxt_len + msgid_len)); ++ if (msg_ctxt_id != NULL) ++#endif ++ { ++ memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); ++ msg_ctxt_id[msgctxt_len - 1] = '\004'; ++ memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); ++ translation = dcgettext (domain, msg_ctxt_id, category); ++#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS ++ if (msg_ctxt_id != buf) ++ free (msg_ctxt_id); ++#endif ++ if (translation != msg_ctxt_id) ++ return translation; ++ } ++ return msgid; ++} ++ ++#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ ++ dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) ++#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ ++ dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) ++ ++#ifdef __GNUC__ ++__inline ++#else ++#ifdef __cplusplus ++inline ++#endif ++#endif ++static const char * ++dcnpgettext_expr (const char *domain, ++ const char *msgctxt, const char *msgid, ++ const char *msgid_plural, unsigned long int n, ++ int category) ++{ ++ size_t msgctxt_len = strlen (msgctxt) + 1; ++ size_t msgid_len = strlen (msgid) + 1; ++ const char *translation; ++#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS ++ char msg_ctxt_id[msgctxt_len + msgid_len]; ++#else ++ char buf[1024]; ++ char *msg_ctxt_id = ++ (msgctxt_len + msgid_len <= sizeof (buf) ++ ? buf ++ : (char *) malloc (msgctxt_len + msgid_len)); ++ if (msg_ctxt_id != NULL) ++#endif ++ { ++ memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); ++ msg_ctxt_id[msgctxt_len - 1] = '\004'; ++ memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); ++ translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); ++#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS ++ if (msg_ctxt_id != buf) ++ free (msg_ctxt_id); ++#endif ++ if (!(translation == msg_ctxt_id || translation == msgid_plural)) ++ return translation; ++ } ++ return (n == 1 ? msgid : msgid_plural); ++} ++ + #endif /* _LIBGETTEXT_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/gettimeofday.c b/xbmc/screensavers/rsxs-0.9/lib/gettimeofday.c +index eb6de94..adfb51f 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/gettimeofday.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/gettimeofday.c +@@ -1,12 +1,10 @@ +-/* Work around the bug in some systems whereby gettimeofday clobbers the +- static buffer that localtime uses for it's return value. The gettimeofday +- function from Mac OS X 10.0.4, i.e. Darwin 1.3.7 has this problem. +- The tzset replacement is necessary for at least Solaris 2.5, 2.5.1, and 2.6. +- Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++/* Provide gettimeofday for systems that don't have it or for which it's broken. ++ ++ Copyright (C) 2001-2003, 2005-2007, 2009-2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -20,33 +18,33 @@ + + /* written by Jim Meyering */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif ++#include + +-/* Disable the definitions of these functions (from config.h) +- so we can use the library versions here. */ +-#undef gettimeofday +-#undef gmtime +-#undef localtime +-#undef tzset ++/* Specification. */ ++#include + +-#include ++#include + +-#if TIME_WITH_SYS_TIME +-# include +-# include +-#else +-# if HAVE_SYS_TIME_H +-# include +-# else +-# include +-# endif ++#if HAVE_SYS_TIMEB_H ++# include + #endif + +-#include ++#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME ++ ++/* Work around the bug in some systems whereby gettimeofday clobbers ++ the static buffer that localtime uses for its return value. The ++ gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has ++ this problem. The tzset replacement is necessary for at least ++ Solaris 2.5, 2.5.1, and 2.6. */ ++ ++static struct tm tm_zero_buffer; ++static struct tm *localtime_buffer_addr = &tm_zero_buffer; + +-static struct tm *localtime_buffer_addr; ++# undef localtime ++extern struct tm *localtime (time_t const *); ++ ++# undef gmtime ++extern struct tm *gmtime (time_t const *); + + /* This is a wrapper for localtime. It is used only on systems for which + gettimeofday clobbers the static buffer used for localtime's result. +@@ -55,11 +53,11 @@ + localtime uses for its result. */ + + struct tm * +-rpl_localtime (const time_t *timep) ++rpl_localtime (time_t const *timep) + { + struct tm *tm = localtime (timep); + +- if (! localtime_buffer_addr) ++ if (localtime_buffer_addr == &tm_zero_buffer) + localtime_buffer_addr = tm; + + return tm; +@@ -67,57 +65,80 @@ struct tm * + + /* Same as above, since gmtime and localtime use the same buffer. */ + struct tm * +-rpl_gmtime (const time_t *timep) ++rpl_gmtime (time_t const *timep) + { + struct tm *tm = gmtime (timep); + +- if (! localtime_buffer_addr) ++ if (localtime_buffer_addr == &tm_zero_buffer) + localtime_buffer_addr = tm; + + return tm; + } + +-/* This is a wrapper for gettimeofday. It is used only on systems for which +- gettimeofday clobbers the static buffer used for localtime's result. ++#endif /* GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME */ ++ ++#if TZSET_CLOBBERS_LOCALTIME ++ ++# undef tzset ++extern void tzset (void); ++ ++/* This is a wrapper for tzset, for systems on which tzset may clobber ++ the static buffer used for localtime's result. */ ++void ++rpl_tzset (void) ++{ ++ /* Save and restore the contents of the buffer used for localtime's ++ result around the call to tzset. */ ++ struct tm save = *localtime_buffer_addr; ++ tzset (); ++ *localtime_buffer_addr = save; ++} ++#endif + +- Save and restore the contents of the buffer used for localtime's result +- around the call to gettimeofday. */ ++/* This is a wrapper for gettimeofday. It is used only on systems ++ that lack this function, or whose implementation of this function ++ causes problems. */ + + int +-rpl_gettimeofday (struct timeval *tv, struct timezone *tz) ++gettimeofday (struct timeval *restrict tv, void *restrict tz) + { +- struct tm save; +- int result; ++#undef gettimeofday ++#if HAVE_GETTIMEOFDAY ++# if GETTIMEOFDAY_CLOBBERS_LOCALTIME ++ /* Save and restore the contents of the buffer used for localtime's ++ result around the call to gettimeofday. */ ++ struct tm save = *localtime_buffer_addr; ++# endif + +- if (! localtime_buffer_addr) +- { +- time_t t = 0; +- localtime_buffer_addr = localtime (&t); +- } ++ int result = gettimeofday (tv, (struct timezone *) tz); + +- save = *localtime_buffer_addr; +- result = gettimeofday (tv, tz); ++# if GETTIMEOFDAY_CLOBBERS_LOCALTIME + *localtime_buffer_addr = save; ++# endif + + return result; +-} + +-/* This is a wrapper for tzset. It is used only on systems for which +- tzset may clobber the static buffer used for localtime's result. +- Save and restore the contents of the buffer used for localtime's +- result around the call to tzset. */ +-void +-rpl_tzset (void) +-{ +- struct tm save; ++#else + +- if (! localtime_buffer_addr) +- { +- time_t t = 0; +- localtime_buffer_addr = localtime (&t); +- } ++# if HAVE__FTIME + +- save = *localtime_buffer_addr; +- tzset (); +- *localtime_buffer_addr = save; ++ struct _timeb timebuf; ++ _ftime (&timebuf); ++ tv->tv_sec = timebuf.time; ++ tv->tv_usec = timebuf.millitm * 1000; ++ ++# else ++ ++# if !defined OK_TO_USE_1S_CLOCK ++# error "Only 1-second nominal clock resolution found. Is that intended?" \ ++ "If so, compile with the -DOK_TO_USE_1S_CLOCK option." ++# endif ++ tv->tv_sec = time (NULL); ++ tv->tv_usec = 0; ++ ++# endif ++ ++ return 0; ++ ++#endif + } +diff --git a/xbmc/screensavers/rsxs-0.9/lib/intprops.h b/xbmc/screensavers/rsxs-0.9/lib/intprops.h +new file mode 100644 +index 0000000..1f6a539 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/intprops.h +@@ -0,0 +1,319 @@ ++/* intprops.h -- properties of integer types ++ ++ Copyright (C) 2001-2005, 2009-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Paul Eggert. */ ++ ++#ifndef _GL_INTPROPS_H ++#define _GL_INTPROPS_H ++ ++#include ++ ++/* Return an integer value, converted to the same type as the integer ++ expression E after integer type promotion. V is the unconverted value. */ ++#define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) ++ ++/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see ++ . */ ++#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v)) ++ ++/* The extra casts in the following macros work around compiler bugs, ++ e.g., in Cray C 5.0.3.0. */ ++ ++/* True if the arithmetic type T is an integer type. bool counts as ++ an integer. */ ++#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) ++ ++/* True if negative values of the signed integer type T use two's ++ complement, ones' complement, or signed magnitude representation, ++ respectively. Much GNU code assumes two's complement, but some ++ people like to be portable to all possible C hosts. */ ++#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) ++#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) ++#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) ++ ++/* True if the signed integer expression E uses two's complement. */ ++#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1) ++ ++/* True if the arithmetic type T is signed. */ ++#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) ++ ++/* Return 1 if the integer expression E, after integer promotion, has ++ a signed type. */ ++#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) ++ ++ ++/* Minimum and maximum values for integer types and expressions. These ++ macros have undefined behavior if T is signed and has padding bits. ++ If this is a problem for you, please let us know how to fix it for ++ your host. */ ++ ++/* The maximum and minimum values for the integer type T. */ ++#define TYPE_MINIMUM(t) \ ++ ((t) (! TYPE_SIGNED (t) \ ++ ? (t) 0 \ ++ : TYPE_SIGNED_MAGNITUDE (t) \ ++ ? ~ (t) 0 \ ++ : ~ TYPE_MAXIMUM (t))) ++#define TYPE_MAXIMUM(t) \ ++ ((t) (! TYPE_SIGNED (t) \ ++ ? (t) -1 \ ++ : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) ++ ++/* The maximum and minimum values for the type of the expression E, ++ after integer promotion. E should not have side effects. */ ++#define _GL_INT_MINIMUM(e) \ ++ (_GL_INT_SIGNED (e) \ ++ ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e) \ ++ : _GL_INT_CONVERT (e, 0)) ++#define _GL_INT_MAXIMUM(e) \ ++ (_GL_INT_SIGNED (e) \ ++ ? _GL_SIGNED_INT_MAXIMUM (e) \ ++ : _GL_INT_NEGATE_CONVERT (e, 1)) ++#define _GL_SIGNED_INT_MAXIMUM(e) \ ++ (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1) ++ ++ ++/* Return 1 if the __typeof__ keyword works. This could be done by ++ 'configure', but for now it's easier to do it by hand. */ ++#if 2 <= __GNUC__ || 0x5110 <= __SUNPRO_C ++# define _GL_HAVE___TYPEOF__ 1 ++#else ++# define _GL_HAVE___TYPEOF__ 0 ++#endif ++ ++/* Return 1 if the integer type or expression T might be signed. Return 0 ++ if it is definitely unsigned. This macro does not evaluate its argument, ++ and expands to an integer constant expression. */ ++#if _GL_HAVE___TYPEOF__ ++# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t)) ++#else ++# define _GL_SIGNED_TYPE_OR_EXPR(t) 1 ++#endif ++ ++/* Bound on length of the string representing an unsigned integer ++ value representable in B bits. log10 (2.0) < 146/485. The ++ smallest value of B where this bound is not tight is 2621. */ ++#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) ++ ++/* Bound on length of the string representing an integer type or expression T. ++ Subtract 1 for the sign bit if T is signed, and then add 1 more for ++ a minus sign if needed. ++ ++ Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is ++ signed, this macro may overestimate the true bound by one byte when ++ applied to unsigned types of size 2, 4, 16, ... bytes. */ ++#define INT_STRLEN_BOUND(t) \ ++ (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \ ++ - _GL_SIGNED_TYPE_OR_EXPR (t)) \ ++ + _GL_SIGNED_TYPE_OR_EXPR (t)) ++ ++/* Bound on buffer size needed to represent an integer type or expression T, ++ including the terminating null. */ ++#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) ++ ++ ++/* Range overflow checks. ++ ++ The INT__RANGE_OVERFLOW macros return 1 if the corresponding C ++ operators might not yield numerically correct answers due to ++ arithmetic overflow. They do not rely on undefined or ++ implementation-defined behavior. Their implementations are simple ++ and straightforward, but they are a bit harder to use than the ++ INT__OVERFLOW macros described below. ++ ++ Example usage: ++ ++ long int i = ...; ++ long int j = ...; ++ if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX)) ++ printf ("multiply would overflow"); ++ else ++ printf ("product is %ld", i * j); ++ ++ Restrictions on *_RANGE_OVERFLOW macros: ++ ++ These macros do not check for all possible numerical problems or ++ undefined or unspecified behavior: they do not check for division ++ by zero, for bad shift counts, or for shifting negative numbers. ++ ++ These macros may evaluate their arguments zero or multiple times, ++ so the arguments should not have side effects. The arithmetic ++ arguments (including the MIN and MAX arguments) must be of the same ++ integer type after the usual arithmetic conversions, and the type ++ must have minimum value MIN and maximum MAX. Unsigned types should ++ use a zero MIN of the proper type. ++ ++ These macros are tuned for constant MIN and MAX. For commutative ++ operations such as A + B, they are also tuned for constant B. */ ++ ++/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic. ++ See above for restrictions. */ ++#define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \ ++ ((b) < 0 \ ++ ? (a) < (min) - (b) \ ++ : (max) - (b) < (a)) ++ ++/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic. ++ See above for restrictions. */ ++#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \ ++ ((b) < 0 \ ++ ? (max) + (b) < (a) \ ++ : (a) < (min) + (b)) ++ ++/* Return 1 if - A would overflow in [MIN,MAX] arithmetic. ++ See above for restrictions. */ ++#define INT_NEGATE_RANGE_OVERFLOW(a, min, max) \ ++ ((min) < 0 \ ++ ? (a) < - (max) \ ++ : 0 < (a)) ++ ++/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. ++ See above for restrictions. Avoid && and || as they tickle ++ bugs in Sun C 5.11 2010/08/13 and other compilers; see ++ . */ ++#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ ++ ((b) < 0 \ ++ ? ((a) < 0 \ ++ ? (a) < (max) / (b) \ ++ : (b) == -1 \ ++ ? 0 \ ++ : (min) / (b) < (a)) \ ++ : (b) == 0 \ ++ ? 0 \ ++ : ((a) < 0 \ ++ ? (a) < (min) / (b) \ ++ : (max) / (b) < (a))) ++ ++/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic. ++ See above for restrictions. Do not check for division by zero. */ ++#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \ ++ ((min) < 0 && (b) == -1 && (a) < - (max)) ++ ++/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic. ++ See above for restrictions. Do not check for division by zero. ++ Mathematically, % should never overflow, but on x86-like hosts ++ INT_MIN % -1 traps, and the C standard permits this, so treat this ++ as an overflow too. */ ++#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \ ++ INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max) ++ ++/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic. ++ See above for restrictions. Here, MIN and MAX are for A only, and B need ++ not be of the same type as the other arguments. The C standard says that ++ behavior is undefined for shifts unless 0 <= B < wordwidth, and that when ++ A is negative then A << B has undefined behavior and A >> B has ++ implementation-defined behavior, but do not check these other ++ restrictions. */ ++#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \ ++ ((a) < 0 \ ++ ? (a) < (min) >> (b) \ ++ : (max) >> (b) < (a)) ++ ++ ++/* The _GL*_OVERFLOW macros have the same restrictions as the ++ *_RANGE_OVERFLOW macros, except that they do not assume that operands ++ (e.g., A and B) have the same type as MIN and MAX. Instead, they assume ++ that the result (e.g., A + B) has that type. */ ++#define _GL_ADD_OVERFLOW(a, b, min, max) \ ++ ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ ++ : (a) < 0 ? (b) <= (a) + (b) \ ++ : (b) < 0 ? (a) <= (a) + (b) \ ++ : (a) + (b) < (b)) ++#define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ ++ ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ ++ : (a) < 0 ? 1 \ ++ : (b) < 0 ? (a) - (b) <= (a) \ ++ : (a) < (b)) ++#define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ ++ (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ ++ || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) ++#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ ++ ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ ++ : (a) < 0 ? (b) <= (a) + (b) - 1 \ ++ : (b) < 0 && (a) + (b) <= (a)) ++#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ ++ ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ ++ : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \ ++ : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max)) ++ ++/* Return a nonzero value if A is a mathematical multiple of B, where ++ A is unsigned, B is negative, and MAX is the maximum value of A's ++ type. A's type must be the same as (A % B)'s type. Normally (A % ++ -B == 0) suffices, but things get tricky if -B would overflow. */ ++#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \ ++ (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \ ++ ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \ ++ ? (a) \ ++ : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \ ++ : (a) % - (b)) \ ++ == 0) ++ ++ ++/* Integer overflow checks. ++ ++ The INT__OVERFLOW macros return 1 if the corresponding C operators ++ might not yield numerically correct answers due to arithmetic overflow. ++ They work correctly on all known practical hosts, and do not rely ++ on undefined behavior due to signed arithmetic overflow. ++ ++ Example usage: ++ ++ long int i = ...; ++ long int j = ...; ++ if (INT_MULTIPLY_OVERFLOW (i, j)) ++ printf ("multiply would overflow"); ++ else ++ printf ("product is %ld", i * j); ++ ++ These macros do not check for all possible numerical problems or ++ undefined or unspecified behavior: they do not check for division ++ by zero, for bad shift counts, or for shifting negative numbers. ++ ++ These macros may evaluate their arguments zero or multiple times, so the ++ arguments should not have side effects. ++ ++ These macros are tuned for their last argument being a constant. ++ ++ Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, ++ A % B, and A << B would overflow, respectively. */ ++ ++#define INT_ADD_OVERFLOW(a, b) \ ++ _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) ++#define INT_SUBTRACT_OVERFLOW(a, b) \ ++ _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) ++#define INT_NEGATE_OVERFLOW(a) \ ++ INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) ++#define INT_MULTIPLY_OVERFLOW(a, b) \ ++ _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW) ++#define INT_DIVIDE_OVERFLOW(a, b) \ ++ _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW) ++#define INT_REMAINDER_OVERFLOW(a, b) \ ++ _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW) ++#define INT_LEFT_SHIFT_OVERFLOW(a, b) \ ++ INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \ ++ _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) ++ ++/* Return 1 if the expression A B would overflow, ++ where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test, ++ assuming MIN and MAX are the minimum and maximum for the result type. ++ Arguments should be free of side effects. */ ++#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \ ++ op_result_overflow (a, b, \ ++ _GL_INT_MINIMUM (0 * (b) + (a)), \ ++ _GL_INT_MAXIMUM (0 * (b) + (a))) ++ ++#endif /* _GL_INTPROPS_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/itold.c b/xbmc/screensavers/rsxs-0.9/lib/itold.c +new file mode 100644 +index 0000000..0236f33 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/itold.c +@@ -0,0 +1,28 @@ ++/* Replacement for 'int' to 'long double' conversion routine. ++ Copyright (C) 2011 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2011. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++/* Specification. */ ++#include ++ ++void ++_Qp_itoq (long double *result, int a) ++{ ++ /* Convert from 'int' to 'double', then from 'double' to 'long double'. */ ++ *result = (double) a; ++} +diff --git a/xbmc/screensavers/rsxs-0.9/lib/malloc.c b/xbmc/screensavers/rsxs-0.9/lib/malloc.c +new file mode 100644 +index 0000000..da45618 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/malloc.c +@@ -0,0 +1,57 @@ ++/* malloc() function that is glibc compatible. ++ ++ Copyright (C) 1997-1998, 2006-2007, 2009-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* written by Jim Meyering and Bruno Haible */ ++ ++#define _GL_USE_STDLIB_ALLOC 1 ++#include ++/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ ++#ifdef malloc ++# define NEED_MALLOC_GNU 1 ++# undef malloc ++/* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */ ++#elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU ++# define NEED_MALLOC_GNU 1 ++#endif ++ ++#include ++ ++#include ++ ++/* Allocate an N-byte block of memory from the heap. ++ If N is zero, allocate a 1-byte block. */ ++ ++void * ++rpl_malloc (size_t n) ++{ ++ void *result; ++ ++#if NEED_MALLOC_GNU ++ if (n == 0) ++ n = 1; ++#endif ++ ++ result = malloc (n); ++ ++#if !HAVE_MALLOC_POSIX ++ if (result == NULL) ++ errno = ENOMEM; ++#endif ++ ++ return result; ++} +diff --git a/xbmc/screensavers/rsxs-0.9/lib/memchr.c b/xbmc/screensavers/rsxs-0.9/lib/memchr.c +index 3c5ecfd..6d903b1 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/memchr.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/memchr.c +@@ -1,5 +1,5 @@ +-/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004 Free +- Software Foundation, Inc. ++/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2011 ++ Free Software Foundation, Inc. + + Based on strlen implementation by Torbjorn Granlund (tege@sics.se), + with help from Dan Sahlin (dan@sics.se) and +@@ -10,9 +10,9 @@ + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@prep.ai.mit.edu. + +-This program is free software; you can redistribute it and/or modify it ++This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the +-Free Software Foundation; either version 2, or (at your option) any ++Free Software Foundation; either version 3 of the License, or any + later version. + + This program is distributed in the hope that it will be useful, +@@ -21,10 +21,9 @@ + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License +-along with this program; if not, write to the Free Software Foundation, +-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++along with this program. If not, see . */ + +-#ifdef HAVE_CONFIG_H ++#ifndef _LIBC + # include + #endif + +@@ -46,155 +45,127 @@ + # define BP_SYM(sym) sym + #endif + +-#undef memchr + #undef __memchr ++#ifdef _LIBC ++# undef memchr ++#endif ++ ++#ifndef weak_alias ++# define __memchr memchr ++#endif + + /* Search no more than N bytes of S for C. */ + void * + __memchr (void const *s, int c_in, size_t n) + { ++ /* On 32-bit hardware, choosing longword to be a 32-bit unsigned ++ long instead of a 64-bit uintmax_t tends to give better ++ performance. On 64-bit hardware, unsigned long is generally 64 ++ bits already. Change this typedef to experiment with ++ performance. */ ++ typedef unsigned long int longword; ++ + const unsigned char *char_ptr; +- const unsigned long int *longword_ptr; +- unsigned long int longword, magic_bits, charmask; ++ const longword *longword_ptr; ++ longword repeated_one; ++ longword repeated_c; + unsigned reg_char c; +- int i; + + c = (unsigned char) c_in; + +- /* Handle the first few characters by reading one character at a time. ++ /* Handle the first few bytes by reading one byte at a time. + Do this until CHAR_PTR is aligned on a longword boundary. */ + for (char_ptr = (const unsigned char *) s; +- n > 0 && (size_t) char_ptr % sizeof longword != 0; ++ n > 0 && (size_t) char_ptr % sizeof (longword) != 0; + --n, ++char_ptr) + if (*char_ptr == c) + return (void *) char_ptr; + ++ longword_ptr = (const longword *) char_ptr; ++ + /* All these elucidatory comments refer to 4-byte longwords, + but the theory applies equally well to any size longwords. */ + +- longword_ptr = (const unsigned long int *) char_ptr; +- +- /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits +- the "holes." Note that there is a hole just to the left of +- each byte, with an extra at the end: +- +- bits: 01111110 11111110 11111110 11111111 +- bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD +- +- The 1-bits make sure that carries propagate to the next 0-bit. +- The 0-bits provide holes for carries to fall into. */ +- +- /* Set MAGIC_BITS to be this pattern of 1 and 0 bits. +- Set CHARMASK to be a longword, each of whose bytes is C. */ +- +- magic_bits = 0xfefefefe; +- charmask = c | (c << 8); +- charmask |= charmask << 16; +-#if 0xffffffffU < ULONG_MAX +- magic_bits |= magic_bits << 32; +- charmask |= charmask << 32; +- if (8 < sizeof longword) +- for (i = 64; i < sizeof longword * 8; i *= 2) +- { +- magic_bits |= magic_bits << i; +- charmask |= charmask << i; +- } +-#endif +- magic_bits = (ULONG_MAX >> 1) & (magic_bits | 1); ++ /* Compute auxiliary longword values: ++ repeated_one is a value which has a 1 in every byte. ++ repeated_c has c in every byte. */ ++ repeated_one = 0x01010101; ++ repeated_c = c | (c << 8); ++ repeated_c |= repeated_c << 16; ++ if (0xffffffffU < (longword) -1) ++ { ++ repeated_one |= repeated_one << 31 << 1; ++ repeated_c |= repeated_c << 31 << 1; ++ if (8 < sizeof (longword)) ++ { ++ size_t i; ++ ++ for (i = 64; i < sizeof (longword) * 8; i *= 2) ++ { ++ repeated_one |= repeated_one << i; ++ repeated_c |= repeated_c << i; ++ } ++ } ++ } + +- /* Instead of the traditional loop which tests each character, +- we will test a longword at a time. The tricky part is testing +- if *any of the four* bytes in the longword in question are zero. */ +- while (n >= sizeof longword) ++ /* Instead of the traditional loop which tests each byte, we will test a ++ longword at a time. The tricky part is testing if *any of the four* ++ bytes in the longword in question are equal to c. We first use an xor ++ with repeated_c. This reduces the task to testing whether *any of the ++ four* bytes in longword1 is zero. ++ ++ We compute tmp = ++ ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). ++ That is, we perform the following operations: ++ 1. Subtract repeated_one. ++ 2. & ~longword1. ++ 3. & a mask consisting of 0x80 in every byte. ++ Consider what happens in each byte: ++ - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, ++ and step 3 transforms it into 0x80. A carry can also be propagated ++ to more significant bytes. ++ - If a byte of longword1 is nonzero, let its lowest 1 bit be at ++ position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, ++ the byte ends in a single bit of value 0 and k bits of value 1. ++ After step 2, the result is just k bits of value 1: 2^k - 1. After ++ step 3, the result is 0. And no carry is produced. ++ So, if longword1 has only non-zero bytes, tmp is zero. ++ Whereas if longword1 has a zero byte, call j the position of the least ++ significant zero byte. Then the result has a zero at positions 0, ..., ++ j-1 and a 0x80 at position j. We cannot predict the result at the more ++ significant bytes (positions j+1..3), but it does not matter since we ++ already have a non-zero bit at position 8*j+7. ++ ++ So, the test whether any byte in longword1 is zero is equivalent to ++ testing whether tmp is nonzero. */ ++ ++ while (n >= sizeof (longword)) + { +- /* We tentatively exit the loop if adding MAGIC_BITS to +- LONGWORD fails to change any of the hole bits of LONGWORD. +- +- 1) Is this safe? Will it catch all the zero bytes? +- Suppose there is a byte with all zeros. Any carry bits +- propagating from its left will fall into the hole at its +- least significant bit and stop. Since there will be no +- carry from its most significant bit, the LSB of the +- byte to the left will be unchanged, and the zero will be +- detected. +- +- 2) Is this worthwhile? Will it ignore everything except +- zero bytes? Suppose every byte of LONGWORD has a bit set +- somewhere. There will be a carry into bit 8. If bit 8 +- is set, this will carry into bit 16. If bit 8 is clear, +- one of bits 9-15 must be set, so there will be a carry +- into bit 16. Similarly, there will be a carry into bit +- 24. If one of bits 24-30 is set, there will be a carry +- into bit 31, so all of the hole bits will be changed. +- +- The one misfire occurs when bits 24-30 are clear and bit +- 31 is set; in this case, the hole at bit 31 is not +- changed. If we had access to the processor carry flag, +- we could close this loophole by putting the fourth hole +- at bit 32! +- +- So it ignores everything except 128's, when they're aligned +- properly. +- +- 3) But wait! Aren't we looking for C, not zero? +- Good point. So what we do is XOR LONGWORD with a longword, +- each of whose bytes is C. This turns each byte that is C +- into a zero. */ +- +- longword = *longword_ptr++ ^ charmask; +- +- /* Add MAGIC_BITS to LONGWORD. */ +- if ((((longword + magic_bits) +- +- /* Set those bits that were unchanged by the addition. */ +- ^ ~longword) +- +- /* Look at only the hole bits. If any of the hole bits +- are unchanged, most likely one of the bytes was a +- zero. */ +- & ~magic_bits) != 0) +- { +- /* Which of the bytes was C? If none of them were, it was +- a misfire; continue the search. */ +- +- const unsigned char *cp = (const unsigned char *) (longword_ptr - 1); +- +- if (cp[0] == c) +- return (void *) cp; +- if (cp[1] == c) +- return (void *) &cp[1]; +- if (cp[2] == c) +- return (void *) &cp[2]; +- if (cp[3] == c) +- return (void *) &cp[3]; +- if (4 < sizeof longword && cp[4] == c) +- return (void *) &cp[4]; +- if (5 < sizeof longword && cp[5] == c) +- return (void *) &cp[5]; +- if (6 < sizeof longword && cp[6] == c) +- return (void *) &cp[6]; +- if (7 < sizeof longword && cp[7] == c) +- return (void *) &cp[7]; +- if (8 < sizeof longword) +- for (i = 8; i < sizeof longword; i++) +- if (cp[i] == c) +- return (void *) &cp[i]; +- } +- +- n -= sizeof longword; ++ longword longword1 = *longword_ptr ^ repeated_c; ++ ++ if ((((longword1 - repeated_one) & ~longword1) ++ & (repeated_one << 7)) != 0) ++ break; ++ longword_ptr++; ++ n -= sizeof (longword); + } + + char_ptr = (const unsigned char *) longword_ptr; + +- while (n-- > 0) ++ /* At this point, we know that either n < sizeof (longword), or one of the ++ sizeof (longword) bytes starting at char_ptr is == c. On little-endian ++ machines, we could determine the first such byte without any further ++ memory accesses, just by looking at the tmp result from the last loop ++ iteration. But this does not work on big-endian machines. Choose code ++ that works in both cases. */ ++ ++ for (; n > 0; --n, ++char_ptr) + { + if (*char_ptr == c) +- return (void *) char_ptr; +- else +- ++char_ptr; ++ return (void *) char_ptr; + } + +- return 0; ++ return NULL; + } + #ifdef weak_alias + weak_alias (__memchr, BP_SYM (memchr)) +diff --git a/xbmc/screensavers/rsxs-0.9/lib/memchr.valgrind b/xbmc/screensavers/rsxs-0.9/lib/memchr.valgrind +new file mode 100644 +index 0000000..60f247e +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/memchr.valgrind +@@ -0,0 +1,14 @@ ++# Suppress a valgrind message about use of uninitialized memory in memchr(). ++# POSIX states that when the character is found, memchr must not read extra ++# bytes in an overestimated length (for example, where memchr is used to ++# implement strnlen). However, we use a safe word read to provide a speedup. ++{ ++ memchr-value4 ++ Memcheck:Value4 ++ fun:rpl_memchr ++} ++{ ++ memchr-value8 ++ Memcheck:Value8 ++ fun:rpl_memchr ++} +diff --git a/xbmc/screensavers/rsxs-0.9/lib/mempcpy.c b/xbmc/screensavers/rsxs-0.9/lib/mempcpy.c +index 3502da2..6a148a9 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/mempcpy.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/mempcpy.c +@@ -1,9 +1,9 @@ + /* Copy memory area and return pointer after last written byte. +- Copyright (C) 2003 Free Software Foundation, Inc. ++ Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -15,9 +15,9 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +-/* Specification. */ +-#include "mempcpy.h" ++#include + ++/* Specification. */ + #include + + /* Copy N bytes of SRC to DEST, return pointer to bytes after the +diff --git a/xbmc/screensavers/rsxs-0.9/lib/printf-args.c b/xbmc/screensavers/rsxs-0.9/lib/printf-args.c +index 615858c..8f3727b 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/printf-args.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/printf-args.c +@@ -1,9 +1,10 @@ + /* Decomposed printf argument list. +- Copyright (C) 1999, 2002-2003, 2006 Free Software Foundation, Inc. ++ Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2011 Free Software ++ Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -15,18 +16,25 @@ + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +-#ifdef HAVE_CONFIG_H ++/* This file can be parametrized with the following macros: ++ ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. ++ PRINTF_FETCHARGS Name of the function to be defined. ++ STATIC Set to 'static' to declare the function static. */ ++ ++#ifndef PRINTF_FETCHARGS + # include + #endif + + /* Specification. */ +-#include "printf-args.h" ++#ifndef PRINTF_FETCHARGS ++# include "printf-args.h" ++#endif + + #ifdef STATIC + STATIC + #endif + int +-printf_fetchargs (va_list args, arguments *a) ++PRINTF_FETCHARGS (va_list args, arguments *a) + { + size_t i; + argument *ap; +@@ -35,103 +43,146 @@ + switch (ap->type) + { + case TYPE_SCHAR: +- ap->a.a_schar = va_arg (args, /*signed char*/ int); +- break; ++ ap->a.a_schar = va_arg (args, /*signed char*/ int); ++ break; + case TYPE_UCHAR: +- ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); +- break; ++ ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); ++ break; + case TYPE_SHORT: +- ap->a.a_short = va_arg (args, /*short*/ int); +- break; ++ ap->a.a_short = va_arg (args, /*short*/ int); ++ break; + case TYPE_USHORT: +- ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); +- break; ++ ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); ++ break; + case TYPE_INT: +- ap->a.a_int = va_arg (args, int); +- break; ++ ap->a.a_int = va_arg (args, int); ++ break; + case TYPE_UINT: +- ap->a.a_uint = va_arg (args, unsigned int); +- break; ++ ap->a.a_uint = va_arg (args, unsigned int); ++ break; + case TYPE_LONGINT: +- ap->a.a_longint = va_arg (args, long int); +- break; ++ ap->a.a_longint = va_arg (args, long int); ++ break; + case TYPE_ULONGINT: +- ap->a.a_ulongint = va_arg (args, unsigned long int); +- break; +-#ifdef HAVE_LONG_LONG ++ ap->a.a_ulongint = va_arg (args, unsigned long int); ++ break; ++#if HAVE_LONG_LONG_INT + case TYPE_LONGLONGINT: +- ap->a.a_longlongint = va_arg (args, long long int); +- break; ++ ap->a.a_longlongint = va_arg (args, long long int); ++ break; + case TYPE_ULONGLONGINT: +- ap->a.a_ulonglongint = va_arg (args, unsigned long long int); +- break; ++ ap->a.a_ulonglongint = va_arg (args, unsigned long long int); ++ break; + #endif + case TYPE_DOUBLE: +- ap->a.a_double = va_arg (args, double); +- break; +-#ifdef HAVE_LONG_DOUBLE ++ ap->a.a_double = va_arg (args, double); ++ break; + case TYPE_LONGDOUBLE: +- ap->a.a_longdouble = va_arg (args, long double); +- break; +-#endif ++ ap->a.a_longdouble = va_arg (args, long double); ++ break; + case TYPE_CHAR: +- ap->a.a_char = va_arg (args, int); +- break; +-#ifdef HAVE_WINT_T ++ ap->a.a_char = va_arg (args, int); ++ break; ++#if HAVE_WINT_T + case TYPE_WIDE_CHAR: +- ap->a.a_wide_char = va_arg (args, wint_t); +- break; ++ /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by ++ default argument promotions", this is not the case in mingw32, ++ where wint_t is 'unsigned short'. */ ++ ap->a.a_wide_char = ++ (sizeof (wint_t) < sizeof (int) ++ ? (wint_t) va_arg (args, int) ++ : va_arg (args, wint_t)); ++ break; + #endif + case TYPE_STRING: +- ap->a.a_string = va_arg (args, const char *); +- /* A null pointer is an invalid argument for "%s", but in practice +- it occurs quite frequently in printf statements that produce +- debug output. Use a fallback in this case. */ +- if (ap->a.a_string == NULL) +- ap->a.a_string = "(NULL)"; +- break; +-#ifdef HAVE_WCHAR_T ++ ap->a.a_string = va_arg (args, const char *); ++ /* A null pointer is an invalid argument for "%s", but in practice ++ it occurs quite frequently in printf statements that produce ++ debug output. Use a fallback in this case. */ ++ if (ap->a.a_string == NULL) ++ ap->a.a_string = "(NULL)"; ++ break; ++#if HAVE_WCHAR_T + case TYPE_WIDE_STRING: +- ap->a.a_wide_string = va_arg (args, const wchar_t *); +- /* A null pointer is an invalid argument for "%ls", but in practice +- it occurs quite frequently in printf statements that produce +- debug output. Use a fallback in this case. */ +- if (ap->a.a_wide_string == NULL) +- { +- static const wchar_t wide_null_string[] = +- { +- (wchar_t)'(', +- (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', +- (wchar_t)')', +- (wchar_t)0 +- }; +- ap->a.a_wide_string = wide_null_string; +- } +- break; ++ ap->a.a_wide_string = va_arg (args, const wchar_t *); ++ /* A null pointer is an invalid argument for "%ls", but in practice ++ it occurs quite frequently in printf statements that produce ++ debug output. Use a fallback in this case. */ ++ if (ap->a.a_wide_string == NULL) ++ { ++ static const wchar_t wide_null_string[] = ++ { ++ (wchar_t)'(', ++ (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', ++ (wchar_t)')', ++ (wchar_t)0 ++ }; ++ ap->a.a_wide_string = wide_null_string; ++ } ++ break; + #endif + case TYPE_POINTER: +- ap->a.a_pointer = va_arg (args, void *); +- break; ++ ap->a.a_pointer = va_arg (args, void *); ++ break; + case TYPE_COUNT_SCHAR_POINTER: +- ap->a.a_count_schar_pointer = va_arg (args, signed char *); +- break; ++ ap->a.a_count_schar_pointer = va_arg (args, signed char *); ++ break; + case TYPE_COUNT_SHORT_POINTER: +- ap->a.a_count_short_pointer = va_arg (args, short *); +- break; ++ ap->a.a_count_short_pointer = va_arg (args, short *); ++ break; + case TYPE_COUNT_INT_POINTER: +- ap->a.a_count_int_pointer = va_arg (args, int *); +- break; ++ ap->a.a_count_int_pointer = va_arg (args, int *); ++ break; + case TYPE_COUNT_LONGINT_POINTER: +- ap->a.a_count_longint_pointer = va_arg (args, long int *); +- break; +-#ifdef HAVE_LONG_LONG ++ ap->a.a_count_longint_pointer = va_arg (args, long int *); ++ break; ++#if HAVE_LONG_LONG_INT + case TYPE_COUNT_LONGLONGINT_POINTER: +- ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); +- break; ++ ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); ++ break; ++#endif ++#if ENABLE_UNISTDIO ++ /* The unistdio extensions. */ ++ case TYPE_U8_STRING: ++ ap->a.a_u8_string = va_arg (args, const uint8_t *); ++ /* A null pointer is an invalid argument for "%U", but in practice ++ it occurs quite frequently in printf statements that produce ++ debug output. Use a fallback in this case. */ ++ if (ap->a.a_u8_string == NULL) ++ { ++ static const uint8_t u8_null_string[] = ++ { '(', 'N', 'U', 'L', 'L', ')', 0 }; ++ ap->a.a_u8_string = u8_null_string; ++ } ++ break; ++ case TYPE_U16_STRING: ++ ap->a.a_u16_string = va_arg (args, const uint16_t *); ++ /* A null pointer is an invalid argument for "%lU", but in practice ++ it occurs quite frequently in printf statements that produce ++ debug output. Use a fallback in this case. */ ++ if (ap->a.a_u16_string == NULL) ++ { ++ static const uint16_t u16_null_string[] = ++ { '(', 'N', 'U', 'L', 'L', ')', 0 }; ++ ap->a.a_u16_string = u16_null_string; ++ } ++ break; ++ case TYPE_U32_STRING: ++ ap->a.a_u32_string = va_arg (args, const uint32_t *); ++ /* A null pointer is an invalid argument for "%llU", but in practice ++ it occurs quite frequently in printf statements that produce ++ debug output. Use a fallback in this case. */ ++ if (ap->a.a_u32_string == NULL) ++ { ++ static const uint32_t u32_null_string[] = ++ { '(', 'N', 'U', 'L', 'L', ')', 0 }; ++ ap->a.a_u32_string = u32_null_string; ++ } ++ break; + #endif + default: +- /* Unknown type. */ +- return -1; ++ /* Unknown type. */ ++ return -1; + } + return 0; + } +diff --git a/xbmc/screensavers/rsxs-0.9/lib/printf-args.h b/xbmc/screensavers/rsxs-0.9/lib/printf-args.h +index cec1cc6..70cca4f 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/printf-args.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/printf-args.h +@@ -1,9 +1,10 @@ + /* Decomposed printf argument list. +- Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. ++ Copyright (C) 1999, 2002-2003, 2006-2007, 2011 Free Software ++ Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -18,16 +19,26 @@ + #ifndef _PRINTF_ARGS_H + #define _PRINTF_ARGS_H + ++/* This file can be parametrized with the following macros: ++ ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. ++ PRINTF_FETCHARGS Name of the function to be declared. ++ STATIC Set to 'static' to declare the function static. */ ++ ++/* Default parameters. */ ++#ifndef PRINTF_FETCHARGS ++# define PRINTF_FETCHARGS printf_fetchargs ++#endif ++ + /* Get size_t. */ + #include + + /* Get wchar_t. */ +-#ifdef HAVE_WCHAR_T ++#if HAVE_WCHAR_T + # include + #endif + + /* Get wint_t. */ +-#ifdef HAVE_WINT_T ++#if HAVE_WINT_T + # include + #endif + +@@ -47,20 +58,18 @@ + TYPE_UINT, + TYPE_LONGINT, + TYPE_ULONGINT, +-#ifdef HAVE_LONG_LONG ++#if HAVE_LONG_LONG_INT + TYPE_LONGLONGINT, + TYPE_ULONGLONGINT, + #endif + TYPE_DOUBLE, +-#ifdef HAVE_LONG_DOUBLE + TYPE_LONGDOUBLE, +-#endif + TYPE_CHAR, +-#ifdef HAVE_WINT_T ++#if HAVE_WINT_T + TYPE_WIDE_CHAR, + #endif + TYPE_STRING, +-#ifdef HAVE_WCHAR_T ++#if HAVE_WCHAR_T + TYPE_WIDE_STRING, + #endif + TYPE_POINTER, +@@ -68,9 +77,15 @@ + TYPE_COUNT_SHORT_POINTER, + TYPE_COUNT_INT_POINTER, + TYPE_COUNT_LONGINT_POINTER +-#ifdef HAVE_LONG_LONG ++#if HAVE_LONG_LONG_INT + , TYPE_COUNT_LONGLONGINT_POINTER + #endif ++#if ENABLE_UNISTDIO ++ /* The unistdio extensions. */ ++, TYPE_U8_STRING ++, TYPE_U16_STRING ++, TYPE_U32_STRING ++#endif + } arg_type; + + /* Polymorphic argument */ +@@ -79,48 +94,56 @@ + arg_type type; + union + { +- signed char a_schar; +- unsigned char a_uchar; +- short a_short; +- unsigned short a_ushort; +- int a_int; +- unsigned int a_uint; +- long int a_longint; +- unsigned long int a_ulongint; +-#ifdef HAVE_LONG_LONG +- long long int a_longlongint; +- unsigned long long int a_ulonglongint; ++ signed char a_schar; ++ unsigned char a_uchar; ++ short a_short; ++ unsigned short a_ushort; ++ int a_int; ++ unsigned int a_uint; ++ long int a_longint; ++ unsigned long int a_ulongint; ++#if HAVE_LONG_LONG_INT ++ long long int a_longlongint; ++ unsigned long long int a_ulonglongint; + #endif +- float a_float; +- double a_double; +-#ifdef HAVE_LONG_DOUBLE +- long double a_longdouble; ++ float a_float; ++ double a_double; ++ long double a_longdouble; ++ int a_char; ++#if HAVE_WINT_T ++ wint_t a_wide_char; + #endif +- int a_char; +-#ifdef HAVE_WINT_T +- wint_t a_wide_char; ++ const char* a_string; ++#if HAVE_WCHAR_T ++ const wchar_t* a_wide_string; + #endif +- const char* a_string; +-#ifdef HAVE_WCHAR_T +- const wchar_t* a_wide_string; ++ void* a_pointer; ++ signed char * a_count_schar_pointer; ++ short * a_count_short_pointer; ++ int * a_count_int_pointer; ++ long int * a_count_longint_pointer; ++#if HAVE_LONG_LONG_INT ++ long long int * a_count_longlongint_pointer; + #endif +- void* a_pointer; +- signed char * a_count_schar_pointer; +- short * a_count_short_pointer; +- int * a_count_int_pointer; +- long int * a_count_longint_pointer; +-#ifdef HAVE_LONG_LONG +- long long int * a_count_longlongint_pointer; ++#if ENABLE_UNISTDIO ++ /* The unistdio extensions. */ ++ const uint8_t * a_u8_string; ++ const uint16_t * a_u16_string; ++ const uint32_t * a_u32_string; + #endif + } + a; + } + argument; + ++/* Number of directly allocated arguments (no malloc() needed). */ ++#define N_DIRECT_ALLOC_ARGUMENTS 7 ++ + typedef struct + { + size_t count; + argument *arg; ++ argument direct_alloc_arg[N_DIRECT_ALLOC_ARGUMENTS]; + } + arguments; + +@@ -131,6 +154,6 @@ + #else + extern + #endif +-int printf_fetchargs (va_list args, arguments *a); ++int PRINTF_FETCHARGS (va_list args, arguments *a); + + #endif /* _PRINTF_ARGS_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/printf-parse.c b/xbmc/screensavers/rsxs-0.9/lib/printf-parse.c +index 3d2fb17..ff24ba4 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/printf-parse.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/printf-parse.c +@@ -1,9 +1,9 @@ + /* Formatted output to strings. +- Copyright (C) 1999-2000, 2002-2003 Free Software Foundation, Inc. ++ Copyright (C) 1999-2000, 2002-2003, 2006-2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -15,44 +15,66 @@ + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +-#ifdef HAVE_CONFIG_H ++/* This file can be parametrized with the following macros: ++ CHAR_T The element type of the format string. ++ CHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters ++ in the format string are ASCII. ++ DIRECTIVE Structure denoting a format directive. ++ Depends on CHAR_T. ++ DIRECTIVES Structure denoting the set of format directives of a ++ format string. Depends on CHAR_T. ++ PRINTF_PARSE Function that parses a format string. ++ Depends on CHAR_T. ++ STATIC Set to 'static' to declare the function static. ++ ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. */ ++ ++#ifndef PRINTF_PARSE + # include + #endif + + /* Specification. */ +-#if WIDE_CHAR_VERSION +-# include "wprintf-parse.h" +-#else ++#ifndef PRINTF_PARSE + # include "printf-parse.h" + #endif + ++/* Default parameters. */ ++#ifndef PRINTF_PARSE ++# define PRINTF_PARSE printf_parse ++# define CHAR_T char ++# define DIRECTIVE char_directive ++# define DIRECTIVES char_directives ++#endif ++ + /* Get size_t, NULL. */ + #include + + /* Get intmax_t. */ +-#if HAVE_STDINT_H_WITH_UINTMAX ++#if defined IN_LIBINTL || defined IN_LIBASPRINTF ++# if HAVE_STDINT_H_WITH_UINTMAX ++# include ++# endif ++# if HAVE_INTTYPES_H_WITH_UINTMAX ++# include ++# endif ++#else + # include + #endif +-#if HAVE_INTTYPES_H_WITH_UINTMAX +-# include +-#endif + + /* malloc(), realloc(), free(). */ + #include + ++/* memcpy(). */ ++#include ++ ++/* errno. */ ++#include ++ + /* Checked size_t computations. */ + #include "xsize.h" + +-#if WIDE_CHAR_VERSION +-# define PRINTF_PARSE wprintf_parse +-# define CHAR_T wchar_t +-# define DIRECTIVE wchar_t_directive +-# define DIRECTIVES wchar_t_directives +-#else +-# define PRINTF_PARSE printf_parse +-# define CHAR_T char +-# define DIRECTIVE char_directive +-# define DIRECTIVES char_directives ++#if CHAR_T_ONLY_ASCII ++/* c_isascii(). */ ++# include "c-ctype.h" + #endif + + #ifdef STATIC +@@ -61,460 +83,531 @@ + int + PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) + { +- const CHAR_T *cp = format; /* pointer into format */ +- size_t arg_posn = 0; /* number of regular arguments consumed */ +- size_t d_allocated; /* allocated elements of d->dir */ +- size_t a_allocated; /* allocated elements of a->arg */ ++ const CHAR_T *cp = format; /* pointer into format */ ++ size_t arg_posn = 0; /* number of regular arguments consumed */ ++ size_t d_allocated; /* allocated elements of d->dir */ ++ size_t a_allocated; /* allocated elements of a->arg */ + size_t max_width_length = 0; + size_t max_precision_length = 0; + + d->count = 0; +- d_allocated = 1; +- d->dir = malloc (d_allocated * sizeof (DIRECTIVE)); +- if (d->dir == NULL) +- /* Out of memory. */ +- return -1; ++ d_allocated = N_DIRECT_ALLOC_DIRECTIVES; ++ d->dir = d->direct_alloc_dir; + + a->count = 0; +- a_allocated = 0; +- a->arg = NULL; ++ a_allocated = N_DIRECT_ALLOC_ARGUMENTS; ++ a->arg = a->direct_alloc_arg; + + #define REGISTER_ARG(_index_,_type_) \ +- { \ +- size_t n = (_index_); \ +- if (n >= a_allocated) \ +- { \ +- size_t memory_size; \ +- argument *memory; \ +- \ +- a_allocated = xtimes (a_allocated, 2); \ +- if (a_allocated <= n) \ +- a_allocated = xsum (n, 1); \ +- memory_size = xtimes (a_allocated, sizeof (argument)); \ +- if (size_overflow_p (memory_size)) \ +- /* Overflow, would lead to out of memory. */ \ +- goto error; \ +- memory = (a->arg \ +- ? realloc (a->arg, memory_size) \ +- : malloc (memory_size)); \ +- if (memory == NULL) \ +- /* Out of memory. */ \ +- goto error; \ +- a->arg = memory; \ +- } \ +- while (a->count <= n) \ +- a->arg[a->count++].type = TYPE_NONE; \ +- if (a->arg[n].type == TYPE_NONE) \ +- a->arg[n].type = (_type_); \ +- else if (a->arg[n].type != (_type_)) \ +- /* Ambiguous type for positional argument. */ \ +- goto error; \ ++ { \ ++ size_t n = (_index_); \ ++ if (n >= a_allocated) \ ++ { \ ++ size_t memory_size; \ ++ argument *memory; \ ++ \ ++ a_allocated = xtimes (a_allocated, 2); \ ++ if (a_allocated <= n) \ ++ a_allocated = xsum (n, 1); \ ++ memory_size = xtimes (a_allocated, sizeof (argument)); \ ++ if (size_overflow_p (memory_size)) \ ++ /* Overflow, would lead to out of memory. */ \ ++ goto out_of_memory; \ ++ memory = (argument *) (a->arg != a->direct_alloc_arg \ ++ ? realloc (a->arg, memory_size) \ ++ : malloc (memory_size)); \ ++ if (memory == NULL) \ ++ /* Out of memory. */ \ ++ goto out_of_memory; \ ++ if (a->arg == a->direct_alloc_arg) \ ++ memcpy (memory, a->arg, a->count * sizeof (argument)); \ ++ a->arg = memory; \ ++ } \ ++ while (a->count <= n) \ ++ a->arg[a->count++].type = TYPE_NONE; \ ++ if (a->arg[n].type == TYPE_NONE) \ ++ a->arg[n].type = (_type_); \ ++ else if (a->arg[n].type != (_type_)) \ ++ /* Ambiguous type for positional argument. */ \ ++ goto error; \ + } + + while (*cp != '\0') + { + CHAR_T c = *cp++; + if (c == '%') +- { +- size_t arg_index = ARG_NONE; +- DIRECTIVE *dp = &d->dir[d->count];/* pointer to next directive */ +- +- /* Initialize the next directive. */ +- dp->dir_start = cp - 1; +- dp->flags = 0; +- dp->width_start = NULL; +- dp->width_end = NULL; +- dp->width_arg_index = ARG_NONE; +- dp->precision_start = NULL; +- dp->precision_end = NULL; +- dp->precision_arg_index = ARG_NONE; +- dp->arg_index = ARG_NONE; +- +- /* Test for positional argument. */ +- if (*cp >= '0' && *cp <= '9') +- { +- const CHAR_T *np; +- +- for (np = cp; *np >= '0' && *np <= '9'; np++) +- ; +- if (*np == '$') +- { +- size_t n = 0; +- +- for (np = cp; *np >= '0' && *np <= '9'; np++) +- n = xsum (xtimes (n, 10), *np - '0'); +- if (n == 0) +- /* Positional argument 0. */ +- goto error; +- if (size_overflow_p (n)) +- /* n too large, would lead to out of memory later. */ +- goto error; +- arg_index = n - 1; +- cp = np + 1; +- } +- } +- +- /* Read the flags. */ +- for (;;) +- { +- if (*cp == '\'') +- { +- dp->flags |= FLAG_GROUP; +- cp++; +- } +- else if (*cp == '-') +- { +- dp->flags |= FLAG_LEFT; +- cp++; +- } +- else if (*cp == '+') +- { +- dp->flags |= FLAG_SHOWSIGN; +- cp++; +- } +- else if (*cp == ' ') +- { +- dp->flags |= FLAG_SPACE; +- cp++; +- } +- else if (*cp == '#') +- { +- dp->flags |= FLAG_ALT; +- cp++; +- } +- else if (*cp == '0') +- { +- dp->flags |= FLAG_ZERO; +- cp++; +- } +- else +- break; +- } +- +- /* Parse the field width. */ +- if (*cp == '*') +- { +- dp->width_start = cp; +- cp++; +- dp->width_end = cp; +- if (max_width_length < 1) +- max_width_length = 1; +- +- /* Test for positional argument. */ +- if (*cp >= '0' && *cp <= '9') +- { +- const CHAR_T *np; +- +- for (np = cp; *np >= '0' && *np <= '9'; np++) +- ; +- if (*np == '$') +- { +- size_t n = 0; +- +- for (np = cp; *np >= '0' && *np <= '9'; np++) +- n = xsum (xtimes (n, 10), *np - '0'); +- if (n == 0) +- /* Positional argument 0. */ +- goto error; +- if (size_overflow_p (n)) +- /* n too large, would lead to out of memory later. */ +- goto error; +- dp->width_arg_index = n - 1; +- cp = np + 1; +- } +- } +- if (dp->width_arg_index == ARG_NONE) +- { +- dp->width_arg_index = arg_posn++; +- if (dp->width_arg_index == ARG_NONE) +- /* arg_posn wrapped around. */ +- goto error; +- } +- REGISTER_ARG (dp->width_arg_index, TYPE_INT); +- } +- else if (*cp >= '0' && *cp <= '9') +- { +- size_t width_length; +- +- dp->width_start = cp; +- for (; *cp >= '0' && *cp <= '9'; cp++) +- ; +- dp->width_end = cp; +- width_length = dp->width_end - dp->width_start; +- if (max_width_length < width_length) +- max_width_length = width_length; +- } +- +- /* Parse the precision. */ +- if (*cp == '.') +- { +- cp++; +- if (*cp == '*') +- { +- dp->precision_start = cp - 1; +- cp++; +- dp->precision_end = cp; +- if (max_precision_length < 2) +- max_precision_length = 2; +- +- /* Test for positional argument. */ +- if (*cp >= '0' && *cp <= '9') +- { +- const CHAR_T *np; +- +- for (np = cp; *np >= '0' && *np <= '9'; np++) +- ; +- if (*np == '$') +- { +- size_t n = 0; +- +- for (np = cp; *np >= '0' && *np <= '9'; np++) +- n = xsum (xtimes (n, 10), *np - '0'); +- if (n == 0) +- /* Positional argument 0. */ +- goto error; +- if (size_overflow_p (n)) +- /* n too large, would lead to out of memory +- later. */ +- goto error; +- dp->precision_arg_index = n - 1; +- cp = np + 1; +- } +- } +- if (dp->precision_arg_index == ARG_NONE) +- { +- dp->precision_arg_index = arg_posn++; +- if (dp->precision_arg_index == ARG_NONE) +- /* arg_posn wrapped around. */ +- goto error; +- } +- REGISTER_ARG (dp->precision_arg_index, TYPE_INT); +- } +- else +- { +- size_t precision_length; +- +- dp->precision_start = cp - 1; +- for (; *cp >= '0' && *cp <= '9'; cp++) +- ; +- dp->precision_end = cp; +- precision_length = dp->precision_end - dp->precision_start; +- if (max_precision_length < precision_length) +- max_precision_length = precision_length; +- } +- } +- +- { +- arg_type type; +- +- /* Parse argument type/size specifiers. */ +- { +- int flags = 0; +- +- for (;;) +- { +- if (*cp == 'h') +- { +- flags |= (1 << (flags & 1)); +- cp++; +- } +- else if (*cp == 'L') +- { +- flags |= 4; +- cp++; +- } +- else if (*cp == 'l') +- { +- flags += 8; +- cp++; +- } +-#ifdef HAVE_INTMAX_T +- else if (*cp == 'j') +- { +- if (sizeof (intmax_t) > sizeof (long)) +- { +- /* intmax_t = long long */ +- flags += 16; +- } +- else if (sizeof (intmax_t) > sizeof (int)) +- { +- /* intmax_t = long */ +- flags += 8; +- } +- cp++; +- } ++ { ++ size_t arg_index = ARG_NONE; ++ DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */ ++ ++ /* Initialize the next directive. */ ++ dp->dir_start = cp - 1; ++ dp->flags = 0; ++ dp->width_start = NULL; ++ dp->width_end = NULL; ++ dp->width_arg_index = ARG_NONE; ++ dp->precision_start = NULL; ++ dp->precision_end = NULL; ++ dp->precision_arg_index = ARG_NONE; ++ dp->arg_index = ARG_NONE; ++ ++ /* Test for positional argument. */ ++ if (*cp >= '0' && *cp <= '9') ++ { ++ const CHAR_T *np; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ ; ++ if (*np == '$') ++ { ++ size_t n = 0; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ n = xsum (xtimes (n, 10), *np - '0'); ++ if (n == 0) ++ /* Positional argument 0. */ ++ goto error; ++ if (size_overflow_p (n)) ++ /* n too large, would lead to out of memory later. */ ++ goto error; ++ arg_index = n - 1; ++ cp = np + 1; ++ } ++ } ++ ++ /* Read the flags. */ ++ for (;;) ++ { ++ if (*cp == '\'') ++ { ++ dp->flags |= FLAG_GROUP; ++ cp++; ++ } ++ else if (*cp == '-') ++ { ++ dp->flags |= FLAG_LEFT; ++ cp++; ++ } ++ else if (*cp == '+') ++ { ++ dp->flags |= FLAG_SHOWSIGN; ++ cp++; ++ } ++ else if (*cp == ' ') ++ { ++ dp->flags |= FLAG_SPACE; ++ cp++; ++ } ++ else if (*cp == '#') ++ { ++ dp->flags |= FLAG_ALT; ++ cp++; ++ } ++ else if (*cp == '0') ++ { ++ dp->flags |= FLAG_ZERO; ++ cp++; ++ } ++#if __GLIBC__ >= 2 && !defined __UCLIBC__ ++ else if (*cp == 'I') ++ { ++ dp->flags |= FLAG_LOCALIZED; ++ cp++; ++ } + #endif +- else if (*cp == 'z' || *cp == 'Z') +- { +- /* 'z' is standardized in ISO C 99, but glibc uses 'Z' +- because the warning facility in gcc-2.95.2 understands +- only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ +- if (sizeof (size_t) > sizeof (long)) +- { +- /* size_t = long long */ +- flags += 16; +- } +- else if (sizeof (size_t) > sizeof (int)) +- { +- /* size_t = long */ +- flags += 8; +- } +- cp++; +- } +- else if (*cp == 't') +- { +- if (sizeof (ptrdiff_t) > sizeof (long)) +- { +- /* ptrdiff_t = long long */ +- flags += 16; +- } +- else if (sizeof (ptrdiff_t) > sizeof (int)) +- { +- /* ptrdiff_t = long */ +- flags += 8; +- } +- cp++; +- } +- else +- break; +- } +- +- /* Read the conversion character. */ +- c = *cp++; +- switch (c) +- { +- case 'd': case 'i': +-#ifdef HAVE_LONG_LONG +- if (flags >= 16 || (flags & 4)) +- type = TYPE_LONGLONGINT; +- else ++ else ++ break; ++ } ++ ++ /* Parse the field width. */ ++ if (*cp == '*') ++ { ++ dp->width_start = cp; ++ cp++; ++ dp->width_end = cp; ++ if (max_width_length < 1) ++ max_width_length = 1; ++ ++ /* Test for positional argument. */ ++ if (*cp >= '0' && *cp <= '9') ++ { ++ const CHAR_T *np; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ ; ++ if (*np == '$') ++ { ++ size_t n = 0; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ n = xsum (xtimes (n, 10), *np - '0'); ++ if (n == 0) ++ /* Positional argument 0. */ ++ goto error; ++ if (size_overflow_p (n)) ++ /* n too large, would lead to out of memory later. */ ++ goto error; ++ dp->width_arg_index = n - 1; ++ cp = np + 1; ++ } ++ } ++ if (dp->width_arg_index == ARG_NONE) ++ { ++ dp->width_arg_index = arg_posn++; ++ if (dp->width_arg_index == ARG_NONE) ++ /* arg_posn wrapped around. */ ++ goto error; ++ } ++ REGISTER_ARG (dp->width_arg_index, TYPE_INT); ++ } ++ else if (*cp >= '0' && *cp <= '9') ++ { ++ size_t width_length; ++ ++ dp->width_start = cp; ++ for (; *cp >= '0' && *cp <= '9'; cp++) ++ ; ++ dp->width_end = cp; ++ width_length = dp->width_end - dp->width_start; ++ if (max_width_length < width_length) ++ max_width_length = width_length; ++ } ++ ++ /* Parse the precision. */ ++ if (*cp == '.') ++ { ++ cp++; ++ if (*cp == '*') ++ { ++ dp->precision_start = cp - 1; ++ cp++; ++ dp->precision_end = cp; ++ if (max_precision_length < 2) ++ max_precision_length = 2; ++ ++ /* Test for positional argument. */ ++ if (*cp >= '0' && *cp <= '9') ++ { ++ const CHAR_T *np; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ ; ++ if (*np == '$') ++ { ++ size_t n = 0; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ n = xsum (xtimes (n, 10), *np - '0'); ++ if (n == 0) ++ /* Positional argument 0. */ ++ goto error; ++ if (size_overflow_p (n)) ++ /* n too large, would lead to out of memory ++ later. */ ++ goto error; ++ dp->precision_arg_index = n - 1; ++ cp = np + 1; ++ } ++ } ++ if (dp->precision_arg_index == ARG_NONE) ++ { ++ dp->precision_arg_index = arg_posn++; ++ if (dp->precision_arg_index == ARG_NONE) ++ /* arg_posn wrapped around. */ ++ goto error; ++ } ++ REGISTER_ARG (dp->precision_arg_index, TYPE_INT); ++ } ++ else ++ { ++ size_t precision_length; ++ ++ dp->precision_start = cp - 1; ++ for (; *cp >= '0' && *cp <= '9'; cp++) ++ ; ++ dp->precision_end = cp; ++ precision_length = dp->precision_end - dp->precision_start; ++ if (max_precision_length < precision_length) ++ max_precision_length = precision_length; ++ } ++ } ++ ++ { ++ arg_type type; ++ ++ /* Parse argument type/size specifiers. */ ++ { ++ int flags = 0; ++ ++ for (;;) ++ { ++ if (*cp == 'h') ++ { ++ flags |= (1 << (flags & 1)); ++ cp++; ++ } ++ else if (*cp == 'L') ++ { ++ flags |= 4; ++ cp++; ++ } ++ else if (*cp == 'l') ++ { ++ flags += 8; ++ cp++; ++ } ++ else if (*cp == 'j') ++ { ++ if (sizeof (intmax_t) > sizeof (long)) ++ { ++ /* intmax_t = long long */ ++ flags += 16; ++ } ++ else if (sizeof (intmax_t) > sizeof (int)) ++ { ++ /* intmax_t = long */ ++ flags += 8; ++ } ++ cp++; ++ } ++ else if (*cp == 'z' || *cp == 'Z') ++ { ++ /* 'z' is standardized in ISO C 99, but glibc uses 'Z' ++ because the warning facility in gcc-2.95.2 understands ++ only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ ++ if (sizeof (size_t) > sizeof (long)) ++ { ++ /* size_t = long long */ ++ flags += 16; ++ } ++ else if (sizeof (size_t) > sizeof (int)) ++ { ++ /* size_t = long */ ++ flags += 8; ++ } ++ cp++; ++ } ++ else if (*cp == 't') ++ { ++ if (sizeof (ptrdiff_t) > sizeof (long)) ++ { ++ /* ptrdiff_t = long long */ ++ flags += 16; ++ } ++ else if (sizeof (ptrdiff_t) > sizeof (int)) ++ { ++ /* ptrdiff_t = long */ ++ flags += 8; ++ } ++ cp++; ++ } ++#if defined __APPLE__ && defined __MACH__ ++ /* On MacOS X 10.3, PRIdMAX is defined as "qd". ++ We cannot change it to "lld" because PRIdMAX must also ++ be understood by the system's printf routines. */ ++ else if (*cp == 'q') ++ { ++ if (64 / 8 > sizeof (long)) ++ { ++ /* int64_t = long long */ ++ flags += 16; ++ } ++ else ++ { ++ /* int64_t = long */ ++ flags += 8; ++ } ++ cp++; ++ } + #endif +- if (flags >= 8) +- type = TYPE_LONGINT; +- else if (flags & 2) +- type = TYPE_SCHAR; +- else if (flags & 1) +- type = TYPE_SHORT; +- else +- type = TYPE_INT; +- break; +- case 'o': case 'u': case 'x': case 'X': +-#ifdef HAVE_LONG_LONG +- if (flags >= 16 || (flags & 4)) +- type = TYPE_ULONGLONGINT; +- else ++#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ /* On native Win32, PRIdMAX is defined as "I64d". ++ We cannot change it to "lld" because PRIdMAX must also ++ be understood by the system's printf routines. */ ++ else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4') ++ { ++ if (64 / 8 > sizeof (long)) ++ { ++ /* __int64 = long long */ ++ flags += 16; ++ } ++ else ++ { ++ /* __int64 = long */ ++ flags += 8; ++ } ++ cp += 3; ++ } + #endif +- if (flags >= 8) +- type = TYPE_ULONGINT; +- else if (flags & 2) +- type = TYPE_UCHAR; +- else if (flags & 1) +- type = TYPE_USHORT; +- else +- type = TYPE_UINT; +- break; +- case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': +- case 'a': case 'A': +-#ifdef HAVE_LONG_DOUBLE +- if (flags >= 16 || (flags & 4)) +- type = TYPE_LONGDOUBLE; +- else ++ else ++ break; ++ } ++ ++ /* Read the conversion character. */ ++ c = *cp++; ++ switch (c) ++ { ++ case 'd': case 'i': ++#if HAVE_LONG_LONG_INT ++ /* If 'long long' exists and is larger than 'long': */ ++ if (flags >= 16 || (flags & 4)) ++ type = TYPE_LONGLONGINT; ++ else + #endif +- type = TYPE_DOUBLE; +- break; +- case 'c': +- if (flags >= 8) +-#ifdef HAVE_WINT_T +- type = TYPE_WIDE_CHAR; ++ /* If 'long long' exists and is the same as 'long', we parse ++ "lld" into TYPE_LONGINT. */ ++ if (flags >= 8) ++ type = TYPE_LONGINT; ++ else if (flags & 2) ++ type = TYPE_SCHAR; ++ else if (flags & 1) ++ type = TYPE_SHORT; ++ else ++ type = TYPE_INT; ++ break; ++ case 'o': case 'u': case 'x': case 'X': ++#if HAVE_LONG_LONG_INT ++ /* If 'long long' exists and is larger than 'long': */ ++ if (flags >= 16 || (flags & 4)) ++ type = TYPE_ULONGLONGINT; ++ else ++#endif ++ /* If 'unsigned long long' exists and is the same as ++ 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ ++ if (flags >= 8) ++ type = TYPE_ULONGINT; ++ else if (flags & 2) ++ type = TYPE_UCHAR; ++ else if (flags & 1) ++ type = TYPE_USHORT; ++ else ++ type = TYPE_UINT; ++ break; ++ case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': ++ case 'a': case 'A': ++ if (flags >= 16 || (flags & 4)) ++ type = TYPE_LONGDOUBLE; ++ else ++ type = TYPE_DOUBLE; ++ break; ++ case 'c': ++ if (flags >= 8) ++#if HAVE_WINT_T ++ type = TYPE_WIDE_CHAR; + #else +- goto error; ++ goto error; + #endif +- else +- type = TYPE_CHAR; +- break; +-#ifdef HAVE_WINT_T +- case 'C': +- type = TYPE_WIDE_CHAR; +- c = 'c'; +- break; ++ else ++ type = TYPE_CHAR; ++ break; ++#if HAVE_WINT_T ++ case 'C': ++ type = TYPE_WIDE_CHAR; ++ c = 'c'; ++ break; + #endif +- case 's': +- if (flags >= 8) +-#ifdef HAVE_WCHAR_T +- type = TYPE_WIDE_STRING; ++ case 's': ++ if (flags >= 8) ++#if HAVE_WCHAR_T ++ type = TYPE_WIDE_STRING; + #else +- goto error; ++ goto error; ++#endif ++ else ++ type = TYPE_STRING; ++ break; ++#if HAVE_WCHAR_T ++ case 'S': ++ type = TYPE_WIDE_STRING; ++ c = 's'; ++ break; ++#endif ++ case 'p': ++ type = TYPE_POINTER; ++ break; ++ case 'n': ++#if HAVE_LONG_LONG_INT ++ /* If 'long long' exists and is larger than 'long': */ ++ if (flags >= 16 || (flags & 4)) ++ type = TYPE_COUNT_LONGLONGINT_POINTER; ++ else + #endif +- else +- type = TYPE_STRING; +- break; +-#ifdef HAVE_WCHAR_T +- case 'S': +- type = TYPE_WIDE_STRING; +- c = 's'; +- break; ++ /* If 'long long' exists and is the same as 'long', we parse ++ "lln" into TYPE_COUNT_LONGINT_POINTER. */ ++ if (flags >= 8) ++ type = TYPE_COUNT_LONGINT_POINTER; ++ else if (flags & 2) ++ type = TYPE_COUNT_SCHAR_POINTER; ++ else if (flags & 1) ++ type = TYPE_COUNT_SHORT_POINTER; ++ else ++ type = TYPE_COUNT_INT_POINTER; ++ break; ++#if ENABLE_UNISTDIO ++ /* The unistdio extensions. */ ++ case 'U': ++ if (flags >= 16) ++ type = TYPE_U32_STRING; ++ else if (flags >= 8) ++ type = TYPE_U16_STRING; ++ else ++ type = TYPE_U8_STRING; ++ break; + #endif +- case 'p': +- type = TYPE_POINTER; +- break; +- case 'n': +-#ifdef HAVE_LONG_LONG +- if (flags >= 16 || (flags & 4)) +- type = TYPE_COUNT_LONGLONGINT_POINTER; +- else ++ case '%': ++ type = TYPE_NONE; ++ break; ++ default: ++ /* Unknown conversion character. */ ++ goto error; ++ } ++ } ++ ++ if (type != TYPE_NONE) ++ { ++ dp->arg_index = arg_index; ++ if (dp->arg_index == ARG_NONE) ++ { ++ dp->arg_index = arg_posn++; ++ if (dp->arg_index == ARG_NONE) ++ /* arg_posn wrapped around. */ ++ goto error; ++ } ++ REGISTER_ARG (dp->arg_index, type); ++ } ++ dp->conversion = c; ++ dp->dir_end = cp; ++ } ++ ++ d->count++; ++ if (d->count >= d_allocated) ++ { ++ size_t memory_size; ++ DIRECTIVE *memory; ++ ++ d_allocated = xtimes (d_allocated, 2); ++ memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); ++ if (size_overflow_p (memory_size)) ++ /* Overflow, would lead to out of memory. */ ++ goto out_of_memory; ++ memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir ++ ? realloc (d->dir, memory_size) ++ : malloc (memory_size)); ++ if (memory == NULL) ++ /* Out of memory. */ ++ goto out_of_memory; ++ if (d->dir == d->direct_alloc_dir) ++ memcpy (memory, d->dir, d->count * sizeof (DIRECTIVE)); ++ d->dir = memory; ++ } ++ } ++#if CHAR_T_ONLY_ASCII ++ else if (!c_isascii (c)) ++ { ++ /* Non-ASCII character. Not supported. */ ++ goto error; ++ } + #endif +- if (flags >= 8) +- type = TYPE_COUNT_LONGINT_POINTER; +- else if (flags & 2) +- type = TYPE_COUNT_SCHAR_POINTER; +- else if (flags & 1) +- type = TYPE_COUNT_SHORT_POINTER; +- else +- type = TYPE_COUNT_INT_POINTER; +- break; +- case '%': +- type = TYPE_NONE; +- break; +- default: +- /* Unknown conversion character. */ +- goto error; +- } +- } +- +- if (type != TYPE_NONE) +- { +- dp->arg_index = arg_index; +- if (dp->arg_index == ARG_NONE) +- { +- dp->arg_index = arg_posn++; +- if (dp->arg_index == ARG_NONE) +- /* arg_posn wrapped around. */ +- goto error; +- } +- REGISTER_ARG (dp->arg_index, type); +- } +- dp->conversion = c; +- dp->dir_end = cp; +- } +- +- d->count++; +- if (d->count >= d_allocated) +- { +- size_t memory_size; +- DIRECTIVE *memory; +- +- d_allocated = xtimes (d_allocated, 2); +- memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); +- if (size_overflow_p (memory_size)) +- /* Overflow, would lead to out of memory. */ +- goto error; +- memory = realloc (d->dir, memory_size); +- if (memory == NULL) +- /* Out of memory. */ +- goto error; +- d->dir = memory; +- } +- } + } + d->dir[d->count].dir_start = cp; + +@@ -523,14 +616,24 @@ + return 0; + + error: +- if (a->arg) ++ if (a->arg != a->direct_alloc_arg) + free (a->arg); +- if (d->dir) ++ if (d->dir != d->direct_alloc_dir) + free (d->dir); ++ errno = EINVAL; ++ return -1; ++ ++out_of_memory: ++ if (a->arg != a->direct_alloc_arg) ++ free (a->arg); ++ if (d->dir != d->direct_alloc_dir) ++ free (d->dir); ++ errno = ENOMEM; + return -1; + } + ++#undef PRINTF_PARSE + #undef DIRECTIVES + #undef DIRECTIVE ++#undef CHAR_T_ONLY_ASCII + #undef CHAR_T +-#undef PRINTF_PARSE +diff --git a/xbmc/screensavers/rsxs-0.9/lib/printf-parse.h b/xbmc/screensavers/rsxs-0.9/lib/printf-parse.h +index 82a0d37..76e5ba3 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/printf-parse.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/printf-parse.h +@@ -1,9 +1,10 @@ + /* Parse printf format string. +- Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. ++ Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2011 Free Software ++ Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -18,19 +19,36 @@ + #ifndef _PRINTF_PARSE_H + #define _PRINTF_PARSE_H + ++/* This file can be parametrized with the following macros: ++ ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. ++ STATIC Set to 'static' to declare the function static. */ ++ ++#if HAVE_FEATURES_H ++# include /* for __GLIBC__, __UCLIBC__ */ ++#endif ++ + #include "printf-args.h" + + + /* Flags */ +-#define FLAG_GROUP 1 /* ' flag */ +-#define FLAG_LEFT 2 /* - flag */ +-#define FLAG_SHOWSIGN 4 /* + flag */ +-#define FLAG_SPACE 8 /* space flag */ +-#define FLAG_ALT 16 /* # flag */ +-#define FLAG_ZERO 32 ++#define FLAG_GROUP 1 /* ' flag */ ++#define FLAG_LEFT 2 /* - flag */ ++#define FLAG_SHOWSIGN 4 /* + flag */ ++#define FLAG_SPACE 8 /* space flag */ ++#define FLAG_ALT 16 /* # flag */ ++#define FLAG_ZERO 32 ++#if __GLIBC__ >= 2 && !defined __UCLIBC__ ++# define FLAG_LOCALIZED 64 /* I flag, uses localized digits */ ++#endif + + /* arg_index value indicating that no argument is consumed. */ +-#define ARG_NONE (~(size_t)0) ++#define ARG_NONE (~(size_t)0) ++ ++/* xxx_directive: A parsed directive. ++ xxx_directives: A parsed format string. */ ++ ++/* Number of directly allocated directives (no malloc() needed). */ ++#define N_DIRECT_ALLOC_DIRECTIVES 7 + + /* A parsed directive. */ + typedef struct +@@ -44,7 +62,7 @@ + const char* precision_start; + const char* precision_end; + size_t precision_arg_index; +- char conversion; /* d i o u x X f e E g G c s p n U % but not C S */ ++ 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 */ + size_t arg_index; + } + char_directive; +@@ -56,19 +74,121 @@ + char_directive *dir; + size_t max_width_length; + size_t max_precision_length; ++ char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; + } + char_directives; + ++#if ENABLE_UNISTDIO ++ ++/* A parsed directive. */ ++typedef struct ++{ ++ const uint8_t* dir_start; ++ const uint8_t* dir_end; ++ int flags; ++ const uint8_t* width_start; ++ const uint8_t* width_end; ++ size_t width_arg_index; ++ const uint8_t* precision_start; ++ const uint8_t* precision_end; ++ size_t precision_arg_index; ++ 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 */ ++ size_t arg_index; ++} ++u8_directive; ++ ++/* A parsed format string. */ ++typedef struct ++{ ++ size_t count; ++ u8_directive *dir; ++ size_t max_width_length; ++ size_t max_precision_length; ++ u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; ++} ++u8_directives; ++ ++/* A parsed directive. */ ++typedef struct ++{ ++ const uint16_t* dir_start; ++ const uint16_t* dir_end; ++ int flags; ++ const uint16_t* width_start; ++ const uint16_t* width_end; ++ size_t width_arg_index; ++ const uint16_t* precision_start; ++ const uint16_t* precision_end; ++ size_t precision_arg_index; ++ 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 */ ++ size_t arg_index; ++} ++u16_directive; ++ ++/* A parsed format string. */ ++typedef struct ++{ ++ size_t count; ++ u16_directive *dir; ++ size_t max_width_length; ++ size_t max_precision_length; ++ u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; ++} ++u16_directives; ++ ++/* A parsed directive. */ ++typedef struct ++{ ++ const uint32_t* dir_start; ++ const uint32_t* dir_end; ++ int flags; ++ const uint32_t* width_start; ++ const uint32_t* width_end; ++ size_t width_arg_index; ++ const uint32_t* precision_start; ++ const uint32_t* precision_end; ++ size_t precision_arg_index; ++ 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 */ ++ size_t arg_index; ++} ++u32_directive; ++ ++/* A parsed format string. */ ++typedef struct ++{ ++ size_t count; ++ u32_directive *dir; ++ size_t max_width_length; ++ size_t max_precision_length; ++ u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; ++} ++u32_directives; ++ ++#endif ++ + + /* Parses the format string. Fills in the number N of directives, and fills + in directives[0], ..., directives[N-1], and sets directives[N].dir_start + to the end of the format string. Also fills in the arg_type fields of the + arguments and the needed count of arguments. */ +-#ifdef STATIC +-STATIC ++#if ENABLE_UNISTDIO ++extern int ++ ulc_printf_parse (const char *format, char_directives *d, arguments *a); ++extern int ++ u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a); ++extern int ++ u16_printf_parse (const uint16_t *format, u16_directives *d, ++ arguments *a); ++extern int ++ u32_printf_parse (const uint32_t *format, u32_directives *d, ++ arguments *a); + #else ++# ifdef STATIC ++STATIC ++# else + extern +-#endif ++# endif + int printf_parse (const char *format, char_directives *d, arguments *a); ++#endif + + #endif /* _PRINTF_PARSE_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/rawmemchr.c b/xbmc/screensavers/rsxs-0.9/lib/rawmemchr.c +new file mode 100644 +index 0000000..095a50a +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/rawmemchr.c +@@ -0,0 +1,136 @@ ++/* Searching in a string. ++ Copyright (C) 2008-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++/* Specification. */ ++#include ++ ++/* Find the first occurrence of C in S. */ ++void * ++rawmemchr (const void *s, int c_in) ++{ ++ /* On 32-bit hardware, choosing longword to be a 32-bit unsigned ++ long instead of a 64-bit uintmax_t tends to give better ++ performance. On 64-bit hardware, unsigned long is generally 64 ++ bits already. Change this typedef to experiment with ++ performance. */ ++ typedef unsigned long int longword; ++ ++ const unsigned char *char_ptr; ++ const longword *longword_ptr; ++ longword repeated_one; ++ longword repeated_c; ++ unsigned char c; ++ ++ c = (unsigned char) c_in; ++ ++ /* Handle the first few bytes by reading one byte at a time. ++ Do this until CHAR_PTR is aligned on a longword boundary. */ ++ for (char_ptr = (const unsigned char *) s; ++ (size_t) char_ptr % sizeof (longword) != 0; ++ ++char_ptr) ++ if (*char_ptr == c) ++ return (void *) char_ptr; ++ ++ longword_ptr = (const longword *) char_ptr; ++ ++ /* All these elucidatory comments refer to 4-byte longwords, ++ but the theory applies equally well to any size longwords. */ ++ ++ /* Compute auxiliary longword values: ++ repeated_one is a value which has a 1 in every byte. ++ repeated_c has c in every byte. */ ++ repeated_one = 0x01010101; ++ repeated_c = c | (c << 8); ++ repeated_c |= repeated_c << 16; ++ if (0xffffffffU < (longword) -1) ++ { ++ repeated_one |= repeated_one << 31 << 1; ++ repeated_c |= repeated_c << 31 << 1; ++ if (8 < sizeof (longword)) ++ { ++ size_t i; ++ ++ for (i = 64; i < sizeof (longword) * 8; i *= 2) ++ { ++ repeated_one |= repeated_one << i; ++ repeated_c |= repeated_c << i; ++ } ++ } ++ } ++ ++ /* Instead of the traditional loop which tests each byte, we will ++ test a longword at a time. The tricky part is testing if *any of ++ the four* bytes in the longword in question are equal to NUL or ++ c. We first use an xor with repeated_c. This reduces the task ++ to testing whether *any of the four* bytes in longword1 is zero. ++ ++ We compute tmp = ++ ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). ++ That is, we perform the following operations: ++ 1. Subtract repeated_one. ++ 2. & ~longword1. ++ 3. & a mask consisting of 0x80 in every byte. ++ Consider what happens in each byte: ++ - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, ++ and step 3 transforms it into 0x80. A carry can also be propagated ++ to more significant bytes. ++ - If a byte of longword1 is nonzero, let its lowest 1 bit be at ++ position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, ++ the byte ends in a single bit of value 0 and k bits of value 1. ++ After step 2, the result is just k bits of value 1: 2^k - 1. After ++ step 3, the result is 0. And no carry is produced. ++ So, if longword1 has only non-zero bytes, tmp is zero. ++ Whereas if longword1 has a zero byte, call j the position of the least ++ significant zero byte. Then the result has a zero at positions 0, ..., ++ j-1 and a 0x80 at position j. We cannot predict the result at the more ++ significant bytes (positions j+1..3), but it does not matter since we ++ already have a non-zero bit at position 8*j+7. ++ ++ The test whether any byte in longword1 is zero is equivalent ++ to testing whether tmp is nonzero. ++ ++ This test can read beyond the end of a string, depending on where ++ C_IN is encountered. However, this is considered safe since the ++ initialization phase ensured that the read will be aligned, ++ therefore, the read will not cross page boundaries and will not ++ cause a fault. */ ++ ++ while (1) ++ { ++ longword longword1 = *longword_ptr ^ repeated_c; ++ ++ if ((((longword1 - repeated_one) & ~longword1) ++ & (repeated_one << 7)) != 0) ++ break; ++ longword_ptr++; ++ } ++ ++ char_ptr = (const unsigned char *) longword_ptr; ++ ++ /* At this point, we know that one of the sizeof (longword) bytes ++ starting at char_ptr is == c. On little-endian machines, we ++ could determine the first such byte without any further memory ++ accesses, just by looking at the tmp result from the last loop ++ iteration. But this does not work on big-endian machines. ++ Choose code that works in both cases. */ ++ ++ char_ptr = (unsigned char *) longword_ptr; ++ while (*char_ptr != c) ++ char_ptr++; ++ return (void *) char_ptr; ++} +diff --git a/xbmc/screensavers/rsxs-0.9/lib/rawmemchr.valgrind b/xbmc/screensavers/rsxs-0.9/lib/rawmemchr.valgrind +new file mode 100644 +index 0000000..6363923 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/rawmemchr.valgrind +@@ -0,0 +1,12 @@ ++# Suppress a valgrind message about use of uninitialized memory in rawmemchr(). ++# This use is OK because it provides only a speedup. ++{ ++ rawmemchr-value4 ++ Memcheck:Value4 ++ fun:rawmemchr ++} ++{ ++ rawmemchr-value8 ++ Memcheck:Value8 ++ fun:rawmemchr ++} +diff --git a/xbmc/screensavers/rsxs-0.9/lib/size_max.h b/xbmc/screensavers/rsxs-0.9/lib/size_max.h +index ed0bc13..d5f3152 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/size_max.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/size_max.h +@@ -1,10 +1,10 @@ + /* size_max.h -- declare SIZE_MAX through system headers +- Copyright (C) 2005-2006 Free Software Foundation, Inc. ++ Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc. + Written by Simon Josefsson. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +diff --git a/xbmc/screensavers/rsxs-0.9/lib/sleep.c b/xbmc/screensavers/rsxs-0.9/lib/sleep.c +new file mode 100644 +index 0000000..45b9d80 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/sleep.c +@@ -0,0 +1,76 @@ ++/* Pausing execution of the current thread. ++ Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2007. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++/* Specification. */ ++#include ++ ++#include ++ ++#include "verify.h" ++ ++#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ ++# define WIN32_LEAN_AND_MEAN /* avoid including junk */ ++# include ++ ++unsigned int ++sleep (unsigned int seconds) ++{ ++ unsigned int remaining; ++ ++ /* Sleep for 1 second many times, because ++ 1. Sleep is not interruptiple by Ctrl-C, ++ 2. we want to avoid arithmetic overflow while multiplying with 1000. */ ++ for (remaining = seconds; remaining > 0; remaining--) ++ Sleep (1000); ++ ++ return remaining; ++} ++ ++#elif HAVE_SLEEP ++ ++# undef sleep ++ ++/* Guarantee unlimited sleep and a reasonable return value. Cygwin ++ 1.5.x rejects attempts to sleep more than 49.7 days (2**32 ++ milliseconds), but uses uninitialized memory which results in a ++ garbage answer. Similarly, Linux 2.6.9 with glibc 2.3.4 has a too ++ small return value when asked to sleep more than 24.85 days. */ ++unsigned int ++rpl_sleep (unsigned int seconds) ++{ ++ /* This requires int larger than 16 bits. */ ++ verify (UINT_MAX / 24 / 24 / 60 / 60); ++ const unsigned int limit = 24 * 24 * 60 * 60; ++ while (limit < seconds) ++ { ++ unsigned int result; ++ seconds -= limit; ++ result = sleep (limit); ++ if (result) ++ return seconds + result; ++ } ++ return sleep (seconds); ++} ++ ++#else /* !HAVE_SLEEP */ ++ ++ #error "Please port gnulib sleep.c to your platform, possibly using usleep() or select(), then report this to bug-gnulib." ++ ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stdalign.h b/xbmc/screensavers/rsxs-0.9/lib/stdalign.h +new file mode 100644 +index 0000000..5d342d2 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/stdalign.h +@@ -0,0 +1,90 @@ ++/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ ++/* A substitute for ISO C 1x . ++ ++ Copyright 2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* Written by Paul Eggert and Bruno Haible. */ ++ ++#ifndef _GL_STDALIGN_H ++#define _GL_STDALIGN_H ++ ++/* ISO C1X for platforms that lack it. ++ ++ References: ++ ISO C1X ++ sections 6.5.3.4, 6.7.5, 7.15. ++ C++0X ++ section 18.10. */ ++ ++/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment ++ requirement of a structure member (i.e., slot or field) that is of ++ type TYPE, as an integer constant expression. ++ ++ This differs from GCC's __alignof__ operator, which can yield a ++ better-performing alignment for an object of that type. For ++ example, on x86 with GCC, __alignof__ (double) and __alignof__ ++ (long long) are 8, whereas alignof (double) and alignof (long long) ++ are 4 unless the option '-malign-double' is used. ++ ++ The result cannot be used as a value for an 'enum' constant, if you ++ want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ ++#include ++#if defined __cplusplus ++ template struct __alignof_helper { char __a; __t __b; }; ++# define _Alignof(type) offsetof (__alignof_helper, __b) ++#else ++# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) ++#endif ++#define alignof _Alignof ++#define __alignof_is_defined 1 ++ ++/* alignas (A), also known as _Alignas (A), aligns a variable or type ++ to the alignment A, where A is an integer constant expression. For ++ example: ++ ++ int alignas (8) foo; ++ struct s { int a; int alignas (8) bar; }; ++ ++ aligns the address of FOO and the offset of BAR to be multiples of 8. ++ ++ A should be a power of two that is at least the type's alignment ++ and at most the implementation's alignment limit. This limit is ++ 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable ++ to MSVC through at least version 10.0, A should be an integer ++ constant, as MSVC does not support expressions such as 1 << 3. ++ To be portable to Sun C 5.11, do not align auto variables to ++ anything stricter than their default alignment. ++ ++ The following draft C1X requirements are not supported here: ++ ++ - If A is zero, alignas has no effect. ++ - alignas can be used multiple times; the strictest one wins. ++ - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). ++ ++ */ ++ ++#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C ++# define _Alignas(a) __attribute__ ((__aligned__ (a))) ++#elif 1300 <= _MSC_VER ++# define _Alignas(a) __declspec (align (a)) ++#endif ++#ifdef _Alignas ++# define alignas _Alignas ++# define __alignas_is_defined 1 ++#endif ++ ++#endif /* _GL_STDALIGN_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stdalign.in.h b/xbmc/screensavers/rsxs-0.9/lib/stdalign.in.h +new file mode 100644 +index 0000000..79e5691 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/stdalign.in.h +@@ -0,0 +1,89 @@ ++/* A substitute for ISO C 1x . ++ ++ Copyright 2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* Written by Paul Eggert and Bruno Haible. */ ++ ++#ifndef _GL_STDALIGN_H ++#define _GL_STDALIGN_H ++ ++/* ISO C1X for platforms that lack it. ++ ++ References: ++ ISO C1X ++ sections 6.5.3.4, 6.7.5, 7.15. ++ C++0X ++ section 18.10. */ ++ ++/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment ++ requirement of a structure member (i.e., slot or field) that is of ++ type TYPE, as an integer constant expression. ++ ++ This differs from GCC's __alignof__ operator, which can yield a ++ better-performing alignment for an object of that type. For ++ example, on x86 with GCC, __alignof__ (double) and __alignof__ ++ (long long) are 8, whereas alignof (double) and alignof (long long) ++ are 4 unless the option '-malign-double' is used. ++ ++ The result cannot be used as a value for an 'enum' constant, if you ++ want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ ++#include ++#if defined __cplusplus ++ template struct __alignof_helper { char __a; __t __b; }; ++# define _Alignof(type) offsetof (__alignof_helper, __b) ++#else ++# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) ++#endif ++#define alignof _Alignof ++#define __alignof_is_defined 1 ++ ++/* alignas (A), also known as _Alignas (A), aligns a variable or type ++ to the alignment A, where A is an integer constant expression. For ++ example: ++ ++ int alignas (8) foo; ++ struct s { int a; int alignas (8) bar; }; ++ ++ aligns the address of FOO and the offset of BAR to be multiples of 8. ++ ++ A should be a power of two that is at least the type's alignment ++ and at most the implementation's alignment limit. This limit is ++ 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable ++ to MSVC through at least version 10.0, A should be an integer ++ constant, as MSVC does not support expressions such as 1 << 3. ++ To be portable to Sun C 5.11, do not align auto variables to ++ anything stricter than their default alignment. ++ ++ The following draft C1X requirements are not supported here: ++ ++ - If A is zero, alignas has no effect. ++ - alignas can be used multiple times; the strictest one wins. ++ - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). ++ ++ */ ++ ++#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C ++# define _Alignas(a) __attribute__ ((__aligned__ (a))) ++#elif 1300 <= _MSC_VER ++# define _Alignas(a) __declspec (align (a)) ++#endif ++#ifdef _Alignas ++# define alignas _Alignas ++# define __alignas_is_defined 1 ++#endif ++ ++#endif /* _GL_STDALIGN_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stdbool.in.h b/xbmc/screensavers/rsxs-0.9/lib/stdbool.in.h +new file mode 100644 +index 0000000..b64dc75b2 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/stdbool.in.h +@@ -0,0 +1,122 @@ ++/* Copyright (C) 2001-2003, 2006-2011 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2001. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _GL_STDBOOL_H ++#define _GL_STDBOOL_H ++ ++/* ISO C 99 for platforms that lack it. */ ++ ++/* Usage suggestions: ++ ++ Programs that use should be aware of some limitations ++ and standards compliance issues. ++ ++ Standards compliance: ++ ++ - must be #included before 'bool', 'false', 'true' ++ can be used. ++ ++ - You cannot assume that sizeof (bool) == 1. ++ ++ - Programs should not undefine the macros bool, true, and false, ++ as C99 lists that as an "obsolescent feature". ++ ++ Limitations of this substitute, when used in a C89 environment: ++ ++ - must be #included before the '_Bool' type can be used. ++ ++ - You cannot assume that _Bool is a typedef; it might be a macro. ++ ++ - Bit-fields of type 'bool' are not supported. Portable code ++ should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. ++ ++ - In C99, casts and automatic conversions to '_Bool' or 'bool' are ++ performed in such a way that every nonzero value gets converted ++ to 'true', and zero gets converted to 'false'. This doesn't work ++ with this substitute. With this substitute, only the values 0 and 1 ++ give the expected result when converted to _Bool' or 'bool'. ++ ++ - C99 allows the use of (_Bool)0.0 in constant expressions, but ++ this substitute cannot always provide this property. ++ ++ Also, it is suggested that programs use 'bool' rather than '_Bool'; ++ this isn't required, but 'bool' is more common. */ ++ ++ ++/* 7.16. Boolean type and values */ ++ ++/* BeOS already #defines false 0, true 1. We use the same ++ definitions below, but temporarily we have to #undef them. */ ++#if defined __BEOS__ && !defined __HAIKU__ ++# include /* defines bool but not _Bool */ ++# undef false ++# undef true ++#endif ++ ++/* For the sake of symbolic names in gdb, we define true and false as ++ enum constants, not only as macros. ++ It is tempting to write ++ typedef enum { false = 0, true = 1 } _Bool; ++ so that gdb prints values of type 'bool' symbolically. But if we do ++ this, values of type '_Bool' may promote to 'int' or 'unsigned int' ++ (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' ++ (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the ++ enum; this ensures that '_Bool' promotes to 'int'. */ ++#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__) ++ /* A compiler known to have 'bool'. */ ++ /* If the compiler already has both 'bool' and '_Bool', we can assume they ++ are the same types. */ ++# if !@HAVE__BOOL@ ++typedef bool _Bool; ++# endif ++#else ++# if !defined __GNUC__ ++ /* If @HAVE__BOOL@: ++ Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when ++ the built-in _Bool type is used. See ++ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html ++ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html ++ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html ++ Similar bugs are likely with other compilers as well; this file ++ wouldn't be used if was working. ++ So we override the _Bool type. ++ If !@HAVE__BOOL@: ++ Need to define _Bool ourselves. As 'signed char' or as an enum type? ++ Use of a typedef, with SunPRO C, leads to a stupid ++ "warning: _Bool is a keyword in ISO C99". ++ Use of an enum type, with IRIX cc, leads to a stupid ++ "warning(1185): enumerated type mixed with another type". ++ Even the existence of an enum type, without a typedef, ++ "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. ++ The only benefit of the enum, debuggability, is not important ++ with these compilers. So use 'signed char' and no enum. */ ++# define _Bool signed char ++# else ++ /* With this compiler, trust the _Bool type if the compiler has it. */ ++# if !@HAVE__BOOL@ ++typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; ++# endif ++# endif ++#endif ++#define bool _Bool ++ ++/* The other macros must be usable in preprocessor directives. */ ++#define false 0 ++#define true 1 ++#define __bool_true_false_are_defined 1 ++ ++#endif /* _GL_STDBOOL_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stddef.in.h b/xbmc/screensavers/rsxs-0.9/lib/stddef.in.h +new file mode 100644 +index 0000000..c7b98e7 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/stddef.in.h +@@ -0,0 +1,87 @@ ++/* A substitute for POSIX 2008 , for platforms that have issues. ++ ++ Copyright (C) 2009-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* Written by Eric Blake. */ ++ ++/* ++ * POSIX 2008 for platforms that have issues. ++ * ++ */ ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++#if defined __need_wchar_t || defined __need_size_t \ ++ || defined __need_ptrdiff_t || defined __need_NULL \ ++ || defined __need_wint_t ++/* Special invocation convention inside gcc header files. In ++ particular, gcc provides a version of that blindly ++ redefines NULL even when __need_wint_t was defined, even though ++ wint_t is not normally provided by . Hence, we must ++ remember if special invocation has ever been used to obtain wint_t, ++ in which case we need to clean up NULL yet again. */ ++ ++# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) ++# ifdef __need_wint_t ++# undef _@GUARD_PREFIX@_STDDEF_H ++# define _GL_STDDEF_WINT_T ++# endif ++# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ ++# endif ++ ++#else ++/* Normal invocation convention. */ ++ ++# ifndef _@GUARD_PREFIX@_STDDEF_H ++ ++/* The include_next requires a split double-inclusion guard. */ ++ ++# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ ++ ++# ifndef _@GUARD_PREFIX@_STDDEF_H ++# define _@GUARD_PREFIX@_STDDEF_H ++ ++/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ ++#if @REPLACE_NULL@ ++# undef NULL ++# ifdef __cplusplus ++ /* ISO C++ says that the macro NULL must expand to an integer constant ++ expression, hence '((void *) 0)' is not allowed in C++. */ ++# if __GNUG__ >= 3 ++ /* GNU C++ has a __null macro that behaves like an integer ('int' or ++ 'long') but has the same size as a pointer. Use that, to avoid ++ warnings. */ ++# define NULL __null ++# else ++# define NULL 0L ++# endif ++# else ++# define NULL ((void *) 0) ++# endif ++#endif ++ ++/* Some platforms lack wchar_t. */ ++#if !@HAVE_WCHAR_T@ ++# define wchar_t int ++#endif ++ ++# endif /* _@GUARD_PREFIX@_STDDEF_H */ ++# endif /* _@GUARD_PREFIX@_STDDEF_H */ ++#endif /* __need_XXX */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stdint.in.h b/xbmc/screensavers/rsxs-0.9/lib/stdint.in.h +new file mode 100644 +index 0000000..b6d08c7 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/stdint.in.h +@@ -0,0 +1,606 @@ ++/* Copyright (C) 2001-2002, 2004-2011 Free Software Foundation, Inc. ++ Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. ++ This file is part of gnulib. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* ++ * ISO C 99 for platforms that lack it. ++ * ++ */ ++ ++#ifndef _@GUARD_PREFIX@_STDINT_H ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++/* When including a system file that in turn includes , ++ use the system , not our substitute. This avoids ++ problems with (for example) VMS, whose includes ++ . */ ++#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H ++ ++/* Get those types that are already defined in other system include ++ files, so that we can "#define int8_t signed char" below without ++ worrying about a later system include file containing a "typedef ++ signed char int8_t;" that will get messed up by our macro. Our ++ macros should all be consistent with the system versions, except ++ for the "fast" types and macros, which we recommend against using ++ in public interfaces due to compiler differences. */ ++ ++#if @HAVE_STDINT_H@ ++# if defined __sgi && ! defined __c99 ++ /* Bypass IRIX's if in C89 mode, since it merely annoys users ++ with "This header file is to be used only for c99 mode compilations" ++ diagnostics. */ ++# define __STDINT_H__ ++# endif ++ /* Other systems may have an incomplete or buggy . ++ Include it before , since any "#include " ++ in would reinclude us, skipping our contents because ++ _@GUARD_PREFIX@_STDINT_H is defined. ++ The include_next requires a split double-inclusion guard. */ ++# @INCLUDE_NEXT@ @NEXT_STDINT_H@ ++#endif ++ ++#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H ++#define _@GUARD_PREFIX@_STDINT_H ++ ++/* defines some of the stdint.h types as well, on glibc, ++ IRIX 6.5, and OpenBSD 3.8 (via ). ++ AIX 5.2 isn't needed and causes troubles. ++ MacOS X 10.4.6 includes (which is us), but ++ relies on the system definitions, so include ++ after @NEXT_STDINT_H@. */ ++#if @HAVE_SYS_TYPES_H@ && ! defined _AIX ++# include ++#endif ++ ++/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ ++#include ++ ++#if @HAVE_INTTYPES_H@ ++ /* In OpenBSD 3.8, includes , which defines ++ int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. ++ also defines intptr_t and uintptr_t. */ ++# include ++#elif @HAVE_SYS_INTTYPES_H@ ++ /* Solaris 7 has the types except the *_fast*_t types, and ++ the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ ++# include ++#endif ++ ++#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ ++ /* Linux libc4 >= 4.6.7 and libc5 have a that defines ++ int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is ++ included by . */ ++# include ++#endif ++ ++#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H ++ ++/* Minimum and maximum values for an integer type under the usual assumption. ++ Return an unspecified value if BITS == 0, adding a check to pacify ++ picky compilers. */ ++ ++#define _STDINT_MIN(signed, bits, zero) \ ++ ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) ++ ++#define _STDINT_MAX(signed, bits, zero) \ ++ ((signed) \ ++ ? ~ _STDINT_MIN (signed, bits, zero) \ ++ : /* The expression for the unsigned case. The subtraction of (signed) \ ++ is a nop in the unsigned case and avoids "signed integer overflow" \ ++ warnings in the signed case. */ \ ++ ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) ++ ++#if !GNULIB_defined_stdint_types ++ ++/* 7.18.1.1. Exact-width integer types */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. */ ++ ++#undef int8_t ++#undef uint8_t ++typedef signed char gl_int8_t; ++typedef unsigned char gl_uint8_t; ++#define int8_t gl_int8_t ++#define uint8_t gl_uint8_t ++ ++#undef int16_t ++#undef uint16_t ++typedef short int gl_int16_t; ++typedef unsigned short int gl_uint16_t; ++#define int16_t gl_int16_t ++#define uint16_t gl_uint16_t ++ ++#undef int32_t ++#undef uint32_t ++typedef int gl_int32_t; ++typedef unsigned int gl_uint32_t; ++#define int32_t gl_int32_t ++#define uint32_t gl_uint32_t ++ ++/* If the system defines INT64_MAX, assume int64_t works. That way, ++ if the underlying platform defines int64_t to be a 64-bit long long ++ int, the code below won't mistakenly define it to be a 64-bit long ++ int, which would mess up C++ name mangling. We must use #ifdef ++ rather than #if, to avoid an error with HP-UX 10.20 cc. */ ++ ++#ifdef INT64_MAX ++# define GL_INT64_T ++#else ++/* Do not undefine int64_t if gnulib is not being used with 64-bit ++ types, since otherwise it breaks platforms like Tandem/NSK. */ ++# if LONG_MAX >> 31 >> 31 == 1 ++# undef int64_t ++typedef long int gl_int64_t; ++# define int64_t gl_int64_t ++# define GL_INT64_T ++# elif defined _MSC_VER ++# undef int64_t ++typedef __int64 gl_int64_t; ++# define int64_t gl_int64_t ++# define GL_INT64_T ++# elif @HAVE_LONG_LONG_INT@ ++# undef int64_t ++typedef long long int gl_int64_t; ++# define int64_t gl_int64_t ++# define GL_INT64_T ++# endif ++#endif ++ ++#ifdef UINT64_MAX ++# define GL_UINT64_T ++#else ++# if ULONG_MAX >> 31 >> 31 >> 1 == 1 ++# undef uint64_t ++typedef unsigned long int gl_uint64_t; ++# define uint64_t gl_uint64_t ++# define GL_UINT64_T ++# elif defined _MSC_VER ++# undef uint64_t ++typedef unsigned __int64 gl_uint64_t; ++# define uint64_t gl_uint64_t ++# define GL_UINT64_T ++# elif @HAVE_UNSIGNED_LONG_LONG_INT@ ++# undef uint64_t ++typedef unsigned long long int gl_uint64_t; ++# define uint64_t gl_uint64_t ++# define GL_UINT64_T ++# endif ++#endif ++ ++/* Avoid collision with Solaris 2.5.1 etc. */ ++#define _UINT8_T ++#define _UINT32_T ++#define _UINT64_T ++ ++ ++/* 7.18.1.2. Minimum-width integer types */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types ++ are the same as the corresponding N_t types. */ ++ ++#undef int_least8_t ++#undef uint_least8_t ++#undef int_least16_t ++#undef uint_least16_t ++#undef int_least32_t ++#undef uint_least32_t ++#undef int_least64_t ++#undef uint_least64_t ++#define int_least8_t int8_t ++#define uint_least8_t uint8_t ++#define int_least16_t int16_t ++#define uint_least16_t uint16_t ++#define int_least32_t int32_t ++#define uint_least32_t uint32_t ++#ifdef GL_INT64_T ++# define int_least64_t int64_t ++#endif ++#ifdef GL_UINT64_T ++# define uint_least64_t uint64_t ++#endif ++ ++/* 7.18.1.3. Fastest minimum-width integer types */ ++ ++/* Note: Other substitutes may define these types differently. ++ It is not recommended to use these types in public header files. */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types ++ are taken from the same list of types. Assume that 'long int' ++ is fast enough for all narrower integers. */ ++ ++#undef int_fast8_t ++#undef uint_fast8_t ++#undef int_fast16_t ++#undef uint_fast16_t ++#undef int_fast32_t ++#undef uint_fast32_t ++#undef int_fast64_t ++#undef uint_fast64_t ++typedef long int gl_int_fast8_t; ++typedef unsigned long int gl_uint_fast8_t; ++typedef long int gl_int_fast16_t; ++typedef unsigned long int gl_uint_fast16_t; ++typedef long int gl_int_fast32_t; ++typedef unsigned long int gl_uint_fast32_t; ++#define int_fast8_t gl_int_fast8_t ++#define uint_fast8_t gl_uint_fast8_t ++#define int_fast16_t gl_int_fast16_t ++#define uint_fast16_t gl_uint_fast16_t ++#define int_fast32_t gl_int_fast32_t ++#define uint_fast32_t gl_uint_fast32_t ++#ifdef GL_INT64_T ++# define int_fast64_t int64_t ++#endif ++#ifdef GL_UINT64_T ++# define uint_fast64_t uint64_t ++#endif ++ ++/* 7.18.1.4. Integer types capable of holding object pointers */ ++ ++#undef intptr_t ++#undef uintptr_t ++typedef long int gl_intptr_t; ++typedef unsigned long int gl_uintptr_t; ++#define intptr_t gl_intptr_t ++#define uintptr_t gl_uintptr_t ++ ++/* 7.18.1.5. Greatest-width integer types */ ++ ++/* Note: These types are compiler dependent. It may be unwise to use them in ++ public header files. */ ++ ++/* If the system defines INTMAX_MAX, assume that intmax_t works, and ++ similarly for UINTMAX_MAX and uintmax_t. This avoids problems with ++ assuming one type where another is used by the system. */ ++ ++#ifndef INTMAX_MAX ++# undef INTMAX_C ++# undef intmax_t ++# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 ++typedef long long int gl_intmax_t; ++# define intmax_t gl_intmax_t ++# elif defined GL_INT64_T ++# define intmax_t int64_t ++# else ++typedef long int gl_intmax_t; ++# define intmax_t gl_intmax_t ++# endif ++#endif ++ ++#ifndef UINTMAX_MAX ++# undef UINTMAX_C ++# undef uintmax_t ++# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 ++typedef unsigned long long int gl_uintmax_t; ++# define uintmax_t gl_uintmax_t ++# elif defined GL_UINT64_T ++# define uintmax_t uint64_t ++# else ++typedef unsigned long int gl_uintmax_t; ++# define uintmax_t gl_uintmax_t ++# endif ++#endif ++ ++/* Verify that intmax_t and uintmax_t have the same size. Too much code ++ breaks if this is not the case. If this check fails, the reason is likely ++ to be found in the autoconf macros. */ ++typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) ++ ? 1 : -1]; ++ ++#define GNULIB_defined_stdint_types 1 ++#endif /* !GNULIB_defined_stdint_types */ ++ ++/* 7.18.2. Limits of specified-width integer types */ ++ ++#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS ++ ++/* 7.18.2.1. Limits of exact-width integer types */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. */ ++ ++#undef INT8_MIN ++#undef INT8_MAX ++#undef UINT8_MAX ++#define INT8_MIN (~ INT8_MAX) ++#define INT8_MAX 127 ++#define UINT8_MAX 255 ++ ++#undef INT16_MIN ++#undef INT16_MAX ++#undef UINT16_MAX ++#define INT16_MIN (~ INT16_MAX) ++#define INT16_MAX 32767 ++#define UINT16_MAX 65535 ++ ++#undef INT32_MIN ++#undef INT32_MAX ++#undef UINT32_MAX ++#define INT32_MIN (~ INT32_MAX) ++#define INT32_MAX 2147483647 ++#define UINT32_MAX 4294967295U ++ ++#if defined GL_INT64_T && ! defined INT64_MAX ++/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 ++ evaluates the latter incorrectly in preprocessor expressions. */ ++# define INT64_MIN (- INTMAX_C (1) << 63) ++# define INT64_MAX INTMAX_C (9223372036854775807) ++#endif ++ ++#if defined GL_UINT64_T && ! defined UINT64_MAX ++# define UINT64_MAX UINTMAX_C (18446744073709551615) ++#endif ++ ++/* 7.18.2.2. Limits of minimum-width integer types */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types ++ are the same as the corresponding N_t types. */ ++ ++#undef INT_LEAST8_MIN ++#undef INT_LEAST8_MAX ++#undef UINT_LEAST8_MAX ++#define INT_LEAST8_MIN INT8_MIN ++#define INT_LEAST8_MAX INT8_MAX ++#define UINT_LEAST8_MAX UINT8_MAX ++ ++#undef INT_LEAST16_MIN ++#undef INT_LEAST16_MAX ++#undef UINT_LEAST16_MAX ++#define INT_LEAST16_MIN INT16_MIN ++#define INT_LEAST16_MAX INT16_MAX ++#define UINT_LEAST16_MAX UINT16_MAX ++ ++#undef INT_LEAST32_MIN ++#undef INT_LEAST32_MAX ++#undef UINT_LEAST32_MAX ++#define INT_LEAST32_MIN INT32_MIN ++#define INT_LEAST32_MAX INT32_MAX ++#define UINT_LEAST32_MAX UINT32_MAX ++ ++#undef INT_LEAST64_MIN ++#undef INT_LEAST64_MAX ++#ifdef GL_INT64_T ++# define INT_LEAST64_MIN INT64_MIN ++# define INT_LEAST64_MAX INT64_MAX ++#endif ++ ++#undef UINT_LEAST64_MAX ++#ifdef GL_UINT64_T ++# define UINT_LEAST64_MAX UINT64_MAX ++#endif ++ ++/* 7.18.2.3. Limits of fastest minimum-width integer types */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types ++ are taken from the same list of types. */ ++ ++#undef INT_FAST8_MIN ++#undef INT_FAST8_MAX ++#undef UINT_FAST8_MAX ++#define INT_FAST8_MIN LONG_MIN ++#define INT_FAST8_MAX LONG_MAX ++#define UINT_FAST8_MAX ULONG_MAX ++ ++#undef INT_FAST16_MIN ++#undef INT_FAST16_MAX ++#undef UINT_FAST16_MAX ++#define INT_FAST16_MIN LONG_MIN ++#define INT_FAST16_MAX LONG_MAX ++#define UINT_FAST16_MAX ULONG_MAX ++ ++#undef INT_FAST32_MIN ++#undef INT_FAST32_MAX ++#undef UINT_FAST32_MAX ++#define INT_FAST32_MIN LONG_MIN ++#define INT_FAST32_MAX LONG_MAX ++#define UINT_FAST32_MAX ULONG_MAX ++ ++#undef INT_FAST64_MIN ++#undef INT_FAST64_MAX ++#ifdef GL_INT64_T ++# define INT_FAST64_MIN INT64_MIN ++# define INT_FAST64_MAX INT64_MAX ++#endif ++ ++#undef UINT_FAST64_MAX ++#ifdef GL_UINT64_T ++# define UINT_FAST64_MAX UINT64_MAX ++#endif ++ ++/* 7.18.2.4. Limits of integer types capable of holding object pointers */ ++ ++#undef INTPTR_MIN ++#undef INTPTR_MAX ++#undef UINTPTR_MAX ++#define INTPTR_MIN LONG_MIN ++#define INTPTR_MAX LONG_MAX ++#define UINTPTR_MAX ULONG_MAX ++ ++/* 7.18.2.5. Limits of greatest-width integer types */ ++ ++#ifndef INTMAX_MAX ++# undef INTMAX_MIN ++# ifdef INT64_MAX ++# define INTMAX_MIN INT64_MIN ++# define INTMAX_MAX INT64_MAX ++# else ++# define INTMAX_MIN INT32_MIN ++# define INTMAX_MAX INT32_MAX ++# endif ++#endif ++ ++#ifndef UINTMAX_MAX ++# ifdef UINT64_MAX ++# define UINTMAX_MAX UINT64_MAX ++# else ++# define UINTMAX_MAX UINT32_MAX ++# endif ++#endif ++ ++/* 7.18.3. Limits of other integer types */ ++ ++/* ptrdiff_t limits */ ++#undef PTRDIFF_MIN ++#undef PTRDIFF_MAX ++#if @APPLE_UNIVERSAL_BUILD@ ++# ifdef _LP64 ++# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) ++# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) ++# else ++# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) ++# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) ++# endif ++#else ++# define PTRDIFF_MIN \ ++ _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) ++# define PTRDIFF_MAX \ ++ _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) ++#endif ++ ++/* sig_atomic_t limits */ ++#undef SIG_ATOMIC_MIN ++#undef SIG_ATOMIC_MAX ++#define SIG_ATOMIC_MIN \ ++ _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ ++ 0@SIG_ATOMIC_T_SUFFIX@) ++#define SIG_ATOMIC_MAX \ ++ _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ ++ 0@SIG_ATOMIC_T_SUFFIX@) ++ ++ ++/* size_t limit */ ++#undef SIZE_MAX ++#if @APPLE_UNIVERSAL_BUILD@ ++# ifdef _LP64 ++# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) ++# else ++# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) ++# endif ++#else ++# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) ++#endif ++ ++/* wchar_t limits */ ++/* Get WCHAR_MIN, WCHAR_MAX. ++ This include is not on the top, above, because on OSF/1 4.0 we have a ++ sequence of nested includes ++ -> -> -> , and the latter includes ++ and assumes its types are already defined. */ ++#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) ++ /* BSD/OS 4.0.1 has a bug: , and must be ++ included before . */ ++# include ++# include ++# include ++# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H ++# include ++# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H ++#endif ++#undef WCHAR_MIN ++#undef WCHAR_MAX ++#define WCHAR_MIN \ ++ _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) ++#define WCHAR_MAX \ ++ _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) ++ ++/* wint_t limits */ ++#undef WINT_MIN ++#undef WINT_MAX ++#define WINT_MIN \ ++ _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) ++#define WINT_MAX \ ++ _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) ++ ++#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ ++ ++/* 7.18.4. Macros for integer constants */ ++ ++#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS ++ ++/* 7.18.4.1. Macros for minimum-width integer constants */ ++/* According to ISO C 99 Technical Corrigendum 1 */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ ++ ++#undef INT8_C ++#undef UINT8_C ++#define INT8_C(x) x ++#define UINT8_C(x) x ++ ++#undef INT16_C ++#undef UINT16_C ++#define INT16_C(x) x ++#define UINT16_C(x) x ++ ++#undef INT32_C ++#undef UINT32_C ++#define INT32_C(x) x ++#define UINT32_C(x) x ## U ++ ++#undef INT64_C ++#undef UINT64_C ++#if LONG_MAX >> 31 >> 31 == 1 ++# define INT64_C(x) x##L ++#elif defined _MSC_VER ++# define INT64_C(x) x##i64 ++#elif @HAVE_LONG_LONG_INT@ ++# define INT64_C(x) x##LL ++#endif ++#if ULONG_MAX >> 31 >> 31 >> 1 == 1 ++# define UINT64_C(x) x##UL ++#elif defined _MSC_VER ++# define UINT64_C(x) x##ui64 ++#elif @HAVE_UNSIGNED_LONG_LONG_INT@ ++# define UINT64_C(x) x##ULL ++#endif ++ ++/* 7.18.4.2. Macros for greatest-width integer constants */ ++ ++#ifndef INTMAX_C ++# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 ++# define INTMAX_C(x) x##LL ++# elif defined GL_INT64_T ++# define INTMAX_C(x) INT64_C(x) ++# else ++# define INTMAX_C(x) x##L ++# endif ++#endif ++ ++#ifndef UINTMAX_C ++# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 ++# define UINTMAX_C(x) x##ULL ++# elif defined GL_UINT64_T ++# define UINTMAX_C(x) UINT64_C(x) ++# else ++# define UINTMAX_C(x) x##UL ++# endif ++#endif ++ ++#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ ++ ++#endif /* _@GUARD_PREFIX@_STDINT_H */ ++#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stdio.h b/xbmc/screensavers/rsxs-0.9/lib/stdio.h +new file mode 100644 +index 0000000..a467c16 +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stdio.in.h b/xbmc/screensavers/rsxs-0.9/lib/stdio.in.h +new file mode 100644 +index 0000000..ce00af5 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/stdio.in.h +@@ -0,0 +1,1350 @@ ++/* A GNU-like . ++ ++ Copyright (C) 2004, 2007-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H ++/* Special invocation convention: ++ - Inside glibc header files. ++ - On OSF/1 5.1 we have a sequence of nested includes ++ -> -> -> -> ++ -> -> -> . ++ In this situation, the functions are not yet declared, therefore we cannot ++ provide the C++ aliases. */ ++ ++#@INCLUDE_NEXT@ @NEXT_STDIO_H@ ++ ++#else ++/* Normal invocation convention. */ ++ ++#ifndef _@GUARD_PREFIX@_STDIO_H ++ ++#define _GL_ALREADY_INCLUDING_STDIO_H ++ ++/* The include_next requires a split double-inclusion guard. */ ++#@INCLUDE_NEXT@ @NEXT_STDIO_H@ ++ ++#undef _GL_ALREADY_INCLUDING_STDIO_H ++ ++#ifndef _@GUARD_PREFIX@_STDIO_H ++#define _@GUARD_PREFIX@_STDIO_H ++ ++/* Get va_list. Needed on many systems, including glibc 2.8. */ ++#include ++ ++#include ++ ++/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 ++ and eglibc 2.11.2. */ ++#include ++ ++/* The __attribute__ feature is available in gcc versions 2.5 and later. ++ The __-protected variants of the attributes 'format' and 'printf' are ++ accepted by gcc versions 2.6.4 (effectively 2.7) and later. ++ We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because ++ gnulib and libintl do '#define printf __printf__' when they override ++ the 'printf' function. */ ++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) ++# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) ++#else ++# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ ++#endif ++ ++/* _GL_ATTRIBUTE_FORMAT_PRINTF ++ indicates to GCC that the function takes a format string and arguments, ++ where the format string directives are the ones standardized by ISO C99 ++ and POSIX. */ ++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) ++# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ ++ _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument)) ++#else ++# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ ++ _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) ++#endif ++ ++/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF, ++ except that it indicates to GCC that the supported format string directives ++ are the ones of the system printf(), rather than the ones standardized by ++ ISO C99 and POSIX. */ ++#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ ++ _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) ++ ++/* _GL_ATTRIBUTE_FORMAT_SCANF ++ indicates to GCC that the function takes a format string and arguments, ++ where the format string directives are the ones standardized by ISO C99 ++ and POSIX. */ ++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) ++# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ ++ _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument)) ++#else ++# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ ++ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) ++#endif ++ ++/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF, ++ except that it indicates to GCC that the supported format string directives ++ are the ones of the system scanf(), rather than the ones standardized by ++ ISO C99 and POSIX. */ ++#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ ++ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) ++ ++/* Solaris 10 declares renameat in , not in . */ ++/* But in any case avoid namespace pollution on glibc systems. */ ++#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ ++ && ! defined __GLIBC__ ++# include ++#endif ++ ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++ ++/* Macros for stringification. */ ++#define _GL_STDIO_STRINGIZE(token) #token ++#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) ++ ++ ++#if @GNULIB_DPRINTF@ ++# if @REPLACE_DPRINTF@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define dprintf rpl_dprintf ++# endif ++_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); ++# else ++# if !@HAVE_DPRINTF@ ++_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); ++# endif ++_GL_CXXALIASWARN (dprintf); ++#elif defined GNULIB_POSIXCHECK ++# undef dprintf ++# if HAVE_RAW_DECL_DPRINTF ++_GL_WARN_ON_USE (dprintf, "dprintf is unportable - " ++ "use gnulib module dprintf for portability"); ++# endif ++#endif ++ ++#if @GNULIB_FCLOSE@ ++/* Close STREAM and its underlying file descriptor. */ ++# if @REPLACE_FCLOSE@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define fclose rpl_fclose ++# endif ++_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); ++# else ++_GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); ++# endif ++_GL_CXXALIASWARN (fclose); ++#elif defined GNULIB_POSIXCHECK ++# undef fclose ++/* Assume fclose is always declared. */ ++_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " ++ "use gnulib module fclose for portable POSIX compliance"); ++#endif ++ ++#if @GNULIB_FDOPEN@ ++# if @REPLACE_FDOPEN@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fdopen ++# define fdopen rpl_fdopen ++# endif ++_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); ++# else ++_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); ++# endif ++_GL_CXXALIASWARN (fdopen); ++#elif defined GNULIB_POSIXCHECK ++# undef fdopen ++/* Assume fdopen is always declared. */ ++_GL_WARN_ON_USE (fdopen, "fdopen on Win32 platforms is not POSIX compatible - " ++ "use gnulib module fdopen for portability"); ++#endif ++ ++#if @GNULIB_FFLUSH@ ++/* Flush all pending data on STREAM according to POSIX rules. Both ++ output and seekable input streams are supported. ++ Note! LOSS OF DATA can occur if fflush is applied on an input stream ++ that is _not_seekable_ or on an update stream that is _not_seekable_ ++ and in which the most recent operation was input. Seekability can ++ be tested with lseek(fileno(fp),0,SEEK_CUR). */ ++# if @REPLACE_FFLUSH@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define fflush rpl_fflush ++# endif ++_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); ++_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); ++# else ++_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); ++# endif ++_GL_CXXALIASWARN (fflush); ++#elif defined GNULIB_POSIXCHECK ++# undef fflush ++/* Assume fflush is always declared. */ ++_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " ++ "use gnulib module fflush for portable POSIX compliance"); ++#endif ++ ++#if @GNULIB_FGETC@ ++# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fgetc ++# define fgetc rpl_fgetc ++# endif ++_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); ++# else ++_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); ++# endif ++_GL_CXXALIASWARN (fgetc); ++#endif ++ ++#if @GNULIB_FGETS@ ++# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fgets ++# define fgets rpl_fgets ++# endif ++_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream) ++ _GL_ARG_NONNULL ((1, 3))); ++_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream)); ++# else ++_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream)); ++# endif ++_GL_CXXALIASWARN (fgets); ++#endif ++ ++#if @GNULIB_FOPEN@ ++# if @REPLACE_FOPEN@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fopen ++# define fopen rpl_fopen ++# endif ++_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode)); ++# else ++_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); ++# endif ++_GL_CXXALIASWARN (fopen); ++#elif defined GNULIB_POSIXCHECK ++# undef fopen ++/* Assume fopen is always declared. */ ++_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - " ++ "use gnulib module fopen for portability"); ++#endif ++ ++#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ ++# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ ++ || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define fprintf rpl_fprintf ++# endif ++# define GNULIB_overrides_fprintf 1 ++# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ ++_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) ++ _GL_ARG_NONNULL ((1, 2))); ++# else ++_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); ++# else ++_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); ++# endif ++_GL_CXXALIASWARN (fprintf); ++#endif ++#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK ++# if !GNULIB_overrides_fprintf ++# undef fprintf ++# endif ++/* Assume fprintf is always declared. */ ++_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " ++ "use gnulib module fprintf-posix for portable " ++ "POSIX compliance"); ++#endif ++ ++#if @GNULIB_FPURGE@ ++/* Discard all pending buffered I/O data on STREAM. ++ STREAM must not be wide-character oriented. ++ When discarding pending output, the file position is set back to where it ++ was before the write calls. When discarding pending input, the file ++ position is advanced to match the end of the previously read input. ++ Return 0 if successful. Upon error, return -1 and set errno. */ ++# if @REPLACE_FPURGE@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define fpurge rpl_fpurge ++# endif ++_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); ++# else ++# if !@HAVE_DECL_FPURGE@ ++_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); ++# endif ++_GL_CXXALIASWARN (fpurge); ++#elif defined GNULIB_POSIXCHECK ++# undef fpurge ++# if HAVE_RAW_DECL_FPURGE ++_GL_WARN_ON_USE (fpurge, "fpurge is not always present - " ++ "use gnulib module fpurge for portability"); ++# endif ++#endif ++ ++#if @GNULIB_FPUTC@ ++# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fputc ++# define fputc rpl_fputc ++# endif ++_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); ++# else ++_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); ++# endif ++_GL_CXXALIASWARN (fputc); ++#endif ++ ++#if @GNULIB_FPUTS@ ++# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fputs ++# define fputs rpl_fputs ++# endif ++_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream)); ++# else ++_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); ++# endif ++_GL_CXXALIASWARN (fputs); ++#endif ++ ++#if @GNULIB_FREAD@ ++# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fread ++# define fread rpl_fread ++# endif ++_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream) ++ _GL_ARG_NONNULL ((4))); ++_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); ++# else ++_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); ++# endif ++_GL_CXXALIASWARN (fread); ++#endif ++ ++#if @GNULIB_FREOPEN@ ++# if @REPLACE_FREOPEN@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef freopen ++# define freopen rpl_freopen ++# endif ++_GL_FUNCDECL_RPL (freopen, FILE *, ++ (const char *filename, const char *mode, FILE *stream) ++ _GL_ARG_NONNULL ((2, 3))); ++_GL_CXXALIAS_RPL (freopen, FILE *, ++ (const char *filename, const char *mode, FILE *stream)); ++# else ++_GL_CXXALIAS_SYS (freopen, FILE *, ++ (const char *filename, const char *mode, FILE *stream)); ++# endif ++_GL_CXXALIASWARN (freopen); ++#elif defined GNULIB_POSIXCHECK ++# undef freopen ++/* Assume freopen is always declared. */ ++_GL_WARN_ON_USE (freopen, ++ "freopen on Win32 platforms is not POSIX compatible - " ++ "use gnulib module freopen for portability"); ++#endif ++ ++#if @GNULIB_FSCANF@ ++# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fscanf ++# define fscanf rpl_fscanf ++# endif ++_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...)); ++# else ++_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...)); ++# endif ++_GL_CXXALIASWARN (fscanf); ++#endif ++ ++ ++/* Set up the following warnings, based on which modules are in use. ++ GNU Coding Standards discourage the use of fseek, since it imposes ++ an arbitrary limitation on some 32-bit hosts. Remember that the ++ fseek module depends on the fseeko module, so we only have three ++ cases to consider: ++ ++ 1. The developer is not using either module. Issue a warning under ++ GNULIB_POSIXCHECK for both functions, to remind them that both ++ functions have bugs on some systems. _GL_NO_LARGE_FILES has no ++ impact on this warning. ++ ++ 2. The developer is using both modules. They may be unaware of the ++ arbitrary limitations of fseek, so issue a warning under ++ GNULIB_POSIXCHECK. On the other hand, they may be using both ++ modules intentionally, so the developer can define ++ _GL_NO_LARGE_FILES in the compilation units where the use of fseek ++ is safe, to silence the warning. ++ ++ 3. The developer is using the fseeko module, but not fseek. Gnulib ++ guarantees that fseek will still work around platform bugs in that ++ case, but we presume that the developer is aware of the pitfalls of ++ fseek and was trying to avoid it, so issue a warning even when ++ GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be ++ defined to silence the warning in particular compilation units. ++ In C++ compilations with GNULIB_NAMESPACE, in order to avoid that ++ fseek gets defined as a macro, it is recommended that the developer ++ uses the fseek module, even if he is not calling the fseek function. ++ ++ Most gnulib clients that perform stream operations should fall into ++ category 3. */ ++ ++#if @GNULIB_FSEEK@ ++# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES ++# define _GL_FSEEK_WARN /* Category 2, above. */ ++# undef fseek ++# endif ++# if @REPLACE_FSEEK@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fseek ++# define fseek rpl_fseek ++# endif ++_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); ++# else ++_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); ++# endif ++_GL_CXXALIASWARN (fseek); ++#endif ++ ++#if @GNULIB_FSEEKO@ ++# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES ++# define _GL_FSEEK_WARN /* Category 3, above. */ ++# undef fseek ++# endif ++# if @REPLACE_FSEEKO@ ++/* Provide an fseeko function that is aware of a preceding fflush(), and which ++ detects pipes. */ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fseeko ++# define fseeko rpl_fseeko ++# endif ++_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); ++# else ++# if ! @HAVE_DECL_FSEEKO@ ++_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); ++# endif ++_GL_CXXALIASWARN (fseeko); ++#elif defined GNULIB_POSIXCHECK ++# define _GL_FSEEK_WARN /* Category 1, above. */ ++# undef fseek ++# undef fseeko ++# if HAVE_RAW_DECL_FSEEKO ++_GL_WARN_ON_USE (fseeko, "fseeko is unportable - " ++ "use gnulib module fseeko for portability"); ++# endif ++#endif ++ ++#ifdef _GL_FSEEK_WARN ++# undef _GL_FSEEK_WARN ++/* Here, either fseek is undefined (but C89 guarantees that it is ++ declared), or it is defined as rpl_fseek (declared above). */ ++_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB " ++ "on 32-bit platforms - " ++ "use fseeko function for handling of large files"); ++#endif ++ ++ ++/* ftell, ftello. See the comments on fseek/fseeko. */ ++ ++#if @GNULIB_FTELL@ ++# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES ++# define _GL_FTELL_WARN /* Category 2, above. */ ++# undef ftell ++# endif ++# if @REPLACE_FTELL@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef ftell ++# define ftell rpl_ftell ++# endif ++_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); ++# else ++_GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); ++# endif ++_GL_CXXALIASWARN (ftell); ++#endif ++ ++#if @GNULIB_FTELLO@ ++# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES ++# define _GL_FTELL_WARN /* Category 3, above. */ ++# undef ftell ++# endif ++# if @REPLACE_FTELLO@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef ftello ++# define ftello rpl_ftello ++# endif ++_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); ++# else ++# if ! @HAVE_DECL_FTELLO@ ++_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); ++# endif ++_GL_CXXALIASWARN (ftello); ++#elif defined GNULIB_POSIXCHECK ++# define _GL_FTELL_WARN /* Category 1, above. */ ++# undef ftell ++# undef ftello ++# if HAVE_RAW_DECL_FTELLO ++_GL_WARN_ON_USE (ftello, "ftello is unportable - " ++ "use gnulib module ftello for portability"); ++# endif ++#endif ++ ++#ifdef _GL_FTELL_WARN ++# undef _GL_FTELL_WARN ++/* Here, either ftell is undefined (but C89 guarantees that it is ++ declared), or it is defined as rpl_ftell (declared above). */ ++_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " ++ "on 32-bit platforms - " ++ "use ftello function for handling of large files"); ++#endif ++ ++ ++#if @GNULIB_FWRITE@ ++# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fwrite ++# define fwrite rpl_fwrite ++# endif ++_GL_FUNCDECL_RPL (fwrite, size_t, ++ (const void *ptr, size_t s, size_t n, FILE *stream) ++ _GL_ARG_NONNULL ((1, 4))); ++_GL_CXXALIAS_RPL (fwrite, size_t, ++ (const void *ptr, size_t s, size_t n, FILE *stream)); ++# else ++_GL_CXXALIAS_SYS (fwrite, size_t, ++ (const void *ptr, size_t s, size_t n, FILE *stream)); ++ ++/* Work around glibc bug 11959 ++ , ++ which sometimes causes an unwanted diagnostic for fwrite calls. ++ This affects only function declaration attributes, so it's not ++ needed for C++. */ ++# if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL ++static inline size_t _GL_ARG_NONNULL ((1, 4)) ++rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream) ++{ ++ size_t r = fwrite (ptr, s, n, stream); ++ (void) r; ++ return r; ++} ++# undef fwrite ++# define fwrite rpl_fwrite ++# endif ++# endif ++_GL_CXXALIASWARN (fwrite); ++#endif ++ ++#if @GNULIB_GETC@ ++# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef getc ++# define getc rpl_fgetc ++# endif ++_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); ++# else ++_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); ++# endif ++_GL_CXXALIASWARN (getc); ++#endif ++ ++#if @GNULIB_GETCHAR@ ++# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef getchar ++# define getchar rpl_getchar ++# endif ++_GL_FUNCDECL_RPL (getchar, int, (void)); ++_GL_CXXALIAS_RPL (getchar, int, (void)); ++# else ++_GL_CXXALIAS_SYS (getchar, int, (void)); ++# endif ++_GL_CXXALIASWARN (getchar); ++#endif ++ ++#if @GNULIB_GETDELIM@ ++/* Read input, up to (and including) the next occurrence of DELIMITER, from ++ STREAM, store it in *LINEPTR (and NUL-terminate it). ++ *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE ++ bytes of space. It is realloc'd as necessary. ++ Return the number of bytes read and stored at *LINEPTR (not including the ++ NUL terminator), or -1 on error or EOF. */ ++# if @REPLACE_GETDELIM@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef getdelim ++# define getdelim rpl_getdelim ++# endif ++_GL_FUNCDECL_RPL (getdelim, ssize_t, ++ (char **lineptr, size_t *linesize, int delimiter, ++ FILE *stream) ++ _GL_ARG_NONNULL ((1, 2, 4))); ++_GL_CXXALIAS_RPL (getdelim, ssize_t, ++ (char **lineptr, size_t *linesize, int delimiter, ++ FILE *stream)); ++# else ++# if !@HAVE_DECL_GETDELIM@ ++_GL_FUNCDECL_SYS (getdelim, ssize_t, ++ (char **lineptr, size_t *linesize, int delimiter, ++ FILE *stream) ++ _GL_ARG_NONNULL ((1, 2, 4))); ++# endif ++_GL_CXXALIAS_SYS (getdelim, ssize_t, ++ (char **lineptr, size_t *linesize, int delimiter, ++ FILE *stream)); ++# endif ++_GL_CXXALIASWARN (getdelim); ++#elif defined GNULIB_POSIXCHECK ++# undef getdelim ++# if HAVE_RAW_DECL_GETDELIM ++_GL_WARN_ON_USE (getdelim, "getdelim is unportable - " ++ "use gnulib module getdelim for portability"); ++# endif ++#endif ++ ++#if @GNULIB_GETLINE@ ++/* Read a line, up to (and including) the next newline, from STREAM, store it ++ in *LINEPTR (and NUL-terminate it). ++ *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE ++ bytes of space. It is realloc'd as necessary. ++ Return the number of bytes read and stored at *LINEPTR (not including the ++ NUL terminator), or -1 on error or EOF. */ ++# if @REPLACE_GETLINE@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef getline ++# define getline rpl_getline ++# endif ++_GL_FUNCDECL_RPL (getline, ssize_t, ++ (char **lineptr, size_t *linesize, FILE *stream) ++ _GL_ARG_NONNULL ((1, 2, 3))); ++_GL_CXXALIAS_RPL (getline, ssize_t, ++ (char **lineptr, size_t *linesize, FILE *stream)); ++# else ++# if !@HAVE_DECL_GETLINE@ ++_GL_FUNCDECL_SYS (getline, ssize_t, ++ (char **lineptr, size_t *linesize, FILE *stream) ++ _GL_ARG_NONNULL ((1, 2, 3))); ++# endif ++_GL_CXXALIAS_SYS (getline, ssize_t, ++ (char **lineptr, size_t *linesize, FILE *stream)); ++# endif ++# if @HAVE_DECL_GETLINE@ ++_GL_CXXALIASWARN (getline); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef getline ++# if HAVE_RAW_DECL_GETLINE ++_GL_WARN_ON_USE (getline, "getline is unportable - " ++ "use gnulib module getline for portability"); ++# endif ++#endif ++ ++#if @GNULIB_GETS@ ++# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef gets ++# define gets rpl_gets ++# endif ++_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (gets, char *, (char *s)); ++# else ++_GL_CXXALIAS_SYS (gets, char *, (char *s)); ++# undef gets ++# endif ++_GL_CXXALIASWARN (gets); ++/* It is very rare that the developer ever has full control of stdin, ++ so any use of gets warrants an unconditional warning. Assume it is ++ always declared, since it is required by C89. */ ++_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); ++#endif ++ ++ ++#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ ++struct obstack; ++/* Grow an obstack with formatted output. Return the number of ++ bytes added to OBS. No trailing nul byte is added, and the ++ object should be closed with obstack_finish before use. Upon ++ memory allocation error, call obstack_alloc_failed_handler. Upon ++ other error, return -1. */ ++# if @REPLACE_OBSTACK_PRINTF@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define obstack_printf rpl_obstack_printf ++# endif ++_GL_FUNCDECL_RPL (obstack_printf, int, ++ (struct obstack *obs, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (obstack_printf, int, ++ (struct obstack *obs, const char *format, ...)); ++# else ++# if !@HAVE_DECL_OBSTACK_PRINTF@ ++_GL_FUNCDECL_SYS (obstack_printf, int, ++ (struct obstack *obs, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (obstack_printf, int, ++ (struct obstack *obs, const char *format, ...)); ++# endif ++_GL_CXXALIASWARN (obstack_printf); ++# if @REPLACE_OBSTACK_PRINTF@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define obstack_vprintf rpl_obstack_vprintf ++# endif ++_GL_FUNCDECL_RPL (obstack_vprintf, int, ++ (struct obstack *obs, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (obstack_vprintf, int, ++ (struct obstack *obs, const char *format, va_list args)); ++# else ++# if !@HAVE_DECL_OBSTACK_PRINTF@ ++_GL_FUNCDECL_SYS (obstack_vprintf, int, ++ (struct obstack *obs, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (obstack_vprintf, int, ++ (struct obstack *obs, const char *format, va_list args)); ++# endif ++_GL_CXXALIASWARN (obstack_vprintf); ++#endif ++ ++#if @GNULIB_PCLOSE@ ++# if !@HAVE_PCLOSE@ ++_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); ++_GL_CXXALIASWARN (pclose); ++#elif defined GNULIB_POSIXCHECK ++# undef pclose ++# if HAVE_RAW_DECL_PCLOSE ++_GL_WARN_ON_USE (pclose, "popen is unportable - " ++ "use gnulib module pclose for more portability"); ++# endif ++#endif ++ ++#if @GNULIB_PERROR@ ++/* Print a message to standard error, describing the value of ERRNO, ++ (if STRING is not NULL and not empty) prefixed with STRING and ": ", ++ and terminated with a newline. */ ++# if @REPLACE_PERROR@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define perror rpl_perror ++# endif ++_GL_FUNCDECL_RPL (perror, void, (const char *string)); ++_GL_CXXALIAS_RPL (perror, void, (const char *string)); ++# else ++_GL_CXXALIAS_SYS (perror, void, (const char *string)); ++# endif ++_GL_CXXALIASWARN (perror); ++#elif defined GNULIB_POSIXCHECK ++# undef perror ++/* Assume perror is always declared. */ ++_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " ++ "use gnulib module perror for portability"); ++#endif ++ ++#if @GNULIB_POPEN@ ++# if @REPLACE_POPEN@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef popen ++# define popen rpl_popen ++# endif ++_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); ++# else ++# if !@HAVE_POPEN@ ++_GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); ++# endif ++_GL_CXXALIASWARN (popen); ++#elif defined GNULIB_POSIXCHECK ++# undef popen ++# if HAVE_RAW_DECL_POPEN ++_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " ++ "use gnulib module popen or pipe for more portability"); ++# endif ++#endif ++ ++#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ ++# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ ++ || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) ++# if defined __GNUC__ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++/* Don't break __attribute__((format(printf,M,N))). */ ++# define printf __printf__ ++# endif ++# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ ++_GL_FUNCDECL_RPL_1 (__printf__, int, ++ (const char *format, ...) ++ __asm__ (@ASM_SYMBOL_PREFIX@ ++ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) ++ _GL_ARG_NONNULL ((1))); ++# else ++_GL_FUNCDECL_RPL_1 (__printf__, int, ++ (const char *format, ...) ++ __asm__ (@ASM_SYMBOL_PREFIX@ ++ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) ++ _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); ++# else ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define printf rpl_printf ++# endif ++_GL_FUNCDECL_RPL (printf, int, ++ (const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); ++# endif ++# define GNULIB_overrides_printf 1 ++# else ++_GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); ++# endif ++_GL_CXXALIASWARN (printf); ++#endif ++#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK ++# if !GNULIB_overrides_printf ++# undef printf ++# endif ++/* Assume printf is always declared. */ ++_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " ++ "use gnulib module printf-posix for portable " ++ "POSIX compliance"); ++#endif ++ ++#if @GNULIB_PUTC@ ++# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef putc ++# define putc rpl_fputc ++# endif ++_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); ++# else ++_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); ++# endif ++_GL_CXXALIASWARN (putc); ++#endif ++ ++#if @GNULIB_PUTCHAR@ ++# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef putchar ++# define putchar rpl_putchar ++# endif ++_GL_FUNCDECL_RPL (putchar, int, (int c)); ++_GL_CXXALIAS_RPL (putchar, int, (int c)); ++# else ++_GL_CXXALIAS_SYS (putchar, int, (int c)); ++# endif ++_GL_CXXALIASWARN (putchar); ++#endif ++ ++#if @GNULIB_PUTS@ ++# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef puts ++# define puts rpl_puts ++# endif ++_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (puts, int, (const char *string)); ++# else ++_GL_CXXALIAS_SYS (puts, int, (const char *string)); ++# endif ++_GL_CXXALIASWARN (puts); ++#endif ++ ++#if @GNULIB_REMOVE@ ++# if @REPLACE_REMOVE@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef remove ++# define remove rpl_remove ++# endif ++_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (remove, int, (const char *name)); ++# else ++_GL_CXXALIAS_SYS (remove, int, (const char *name)); ++# endif ++_GL_CXXALIASWARN (remove); ++#elif defined GNULIB_POSIXCHECK ++# undef remove ++/* Assume remove is always declared. */ ++_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " ++ "use gnulib module remove for more portability"); ++#endif ++ ++#if @GNULIB_RENAME@ ++# if @REPLACE_RENAME@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef rename ++# define rename rpl_rename ++# endif ++_GL_FUNCDECL_RPL (rename, int, ++ (const char *old_filename, const char *new_filename) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (rename, int, ++ (const char *old_filename, const char *new_filename)); ++# else ++_GL_CXXALIAS_SYS (rename, int, ++ (const char *old_filename, const char *new_filename)); ++# endif ++_GL_CXXALIASWARN (rename); ++#elif defined GNULIB_POSIXCHECK ++# undef rename ++/* Assume rename is always declared. */ ++_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " ++ "use gnulib module rename for more portability"); ++#endif ++ ++#if @GNULIB_RENAMEAT@ ++# if @REPLACE_RENAMEAT@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef renameat ++# define renameat rpl_renameat ++# endif ++_GL_FUNCDECL_RPL (renameat, int, ++ (int fd1, char const *file1, int fd2, char const *file2) ++ _GL_ARG_NONNULL ((2, 4))); ++_GL_CXXALIAS_RPL (renameat, int, ++ (int fd1, char const *file1, int fd2, char const *file2)); ++# else ++# if !@HAVE_RENAMEAT@ ++_GL_FUNCDECL_SYS (renameat, int, ++ (int fd1, char const *file1, int fd2, char const *file2) ++ _GL_ARG_NONNULL ((2, 4))); ++# endif ++_GL_CXXALIAS_SYS (renameat, int, ++ (int fd1, char const *file1, int fd2, char const *file2)); ++# endif ++_GL_CXXALIASWARN (renameat); ++#elif defined GNULIB_POSIXCHECK ++# undef renameat ++# if HAVE_RAW_DECL_RENAMEAT ++_GL_WARN_ON_USE (renameat, "renameat is not portable - " ++ "use gnulib module renameat for portability"); ++# endif ++#endif ++ ++#if @GNULIB_SCANF@ ++# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ ++# if defined __GNUC__ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef scanf ++/* Don't break __attribute__((format(scanf,M,N))). */ ++# define scanf __scanf__ ++# endif ++_GL_FUNCDECL_RPL_1 (__scanf__, int, ++ (const char *format, ...) ++ __asm__ (@ASM_SYMBOL_PREFIX@ ++ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) ++ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...)); ++# else ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef scanf ++# define scanf rpl_scanf ++# endif ++_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...)); ++# endif ++# else ++_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...)); ++# endif ++_GL_CXXALIASWARN (scanf); ++#endif ++ ++#if @GNULIB_SNPRINTF@ ++# if @REPLACE_SNPRINTF@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define snprintf rpl_snprintf ++# endif ++_GL_FUNCDECL_RPL (snprintf, int, ++ (char *str, size_t size, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) ++ _GL_ARG_NONNULL ((3))); ++_GL_CXXALIAS_RPL (snprintf, int, ++ (char *str, size_t size, const char *format, ...)); ++# else ++# if !@HAVE_DECL_SNPRINTF@ ++_GL_FUNCDECL_SYS (snprintf, int, ++ (char *str, size_t size, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) ++ _GL_ARG_NONNULL ((3))); ++# endif ++_GL_CXXALIAS_SYS (snprintf, int, ++ (char *str, size_t size, const char *format, ...)); ++# endif ++_GL_CXXALIASWARN (snprintf); ++#elif defined GNULIB_POSIXCHECK ++# undef snprintf ++# if HAVE_RAW_DECL_SNPRINTF ++_GL_WARN_ON_USE (snprintf, "snprintf is unportable - " ++ "use gnulib module snprintf for portability"); ++# endif ++#endif ++ ++/* Some people would argue that sprintf should be handled like gets ++ (for example, OpenBSD issues a link warning for both functions), ++ since both can cause security holes due to buffer overruns. ++ However, we believe that sprintf can be used safely, and is more ++ efficient than snprintf in those safe cases; and as proof of our ++ belief, we use sprintf in several gnulib modules. So this header ++ intentionally avoids adding a warning to sprintf except when ++ GNULIB_POSIXCHECK is defined. */ ++ ++#if @GNULIB_SPRINTF_POSIX@ ++# if @REPLACE_SPRINTF@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define sprintf rpl_sprintf ++# endif ++_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); ++# else ++_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); ++# endif ++_GL_CXXALIASWARN (sprintf); ++#elif defined GNULIB_POSIXCHECK ++# undef sprintf ++/* Assume sprintf is always declared. */ ++_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " ++ "use gnulib module sprintf-posix for portable " ++ "POSIX compliance"); ++#endif ++ ++#if @GNULIB_TMPFILE@ ++# if @REPLACE_TMPFILE@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define tmpfile rpl_tmpfile ++# endif ++_GL_FUNCDECL_RPL (tmpfile, FILE *, (void)); ++_GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); ++# else ++_GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); ++# endif ++_GL_CXXALIASWARN (tmpfile); ++#elif defined GNULIB_POSIXCHECK ++# undef tmpfile ++# if HAVE_RAW_DECL_TMPFILE ++_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " ++ "use gnulib module tmpfile for portability"); ++# endif ++#endif ++ ++#if @GNULIB_VASPRINTF@ ++/* Write formatted output to a string dynamically allocated with malloc(). ++ If the memory allocation succeeds, store the address of the string in ++ *RESULT and return the number of resulting bytes, excluding the trailing ++ NUL. Upon memory allocation error, or some other error, return -1. */ ++# if @REPLACE_VASPRINTF@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define asprintf rpl_asprintf ++# endif ++_GL_FUNCDECL_RPL (asprintf, int, ++ (char **result, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (asprintf, int, ++ (char **result, const char *format, ...)); ++# else ++# if !@HAVE_VASPRINTF@ ++_GL_FUNCDECL_SYS (asprintf, int, ++ (char **result, const char *format, ...) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (asprintf, int, ++ (char **result, const char *format, ...)); ++# endif ++_GL_CXXALIASWARN (asprintf); ++# if @REPLACE_VASPRINTF@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define vasprintf rpl_vasprintf ++# endif ++_GL_FUNCDECL_RPL (vasprintf, int, ++ (char **result, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (vasprintf, int, ++ (char **result, const char *format, va_list args)); ++# else ++# if !@HAVE_VASPRINTF@ ++_GL_FUNCDECL_SYS (vasprintf, int, ++ (char **result, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (vasprintf, int, ++ (char **result, const char *format, va_list args)); ++# endif ++_GL_CXXALIASWARN (vasprintf); ++#endif ++ ++#if @GNULIB_VDPRINTF@ ++# if @REPLACE_VDPRINTF@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define vdprintf rpl_vdprintf ++# endif ++_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); ++# else ++# if !@HAVE_VDPRINTF@ ++_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) ++ _GL_ARG_NONNULL ((2))); ++# endif ++/* Need to cast, because on Solaris, the third parameter will likely be ++ __va_list args. */ ++_GL_CXXALIAS_SYS_CAST (vdprintf, int, ++ (int fd, const char *format, va_list args)); ++# endif ++_GL_CXXALIASWARN (vdprintf); ++#elif defined GNULIB_POSIXCHECK ++# undef vdprintf ++# if HAVE_RAW_DECL_VDPRINTF ++_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " ++ "use gnulib module vdprintf for portability"); ++# endif ++#endif ++ ++#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ ++# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ ++ || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define vfprintf rpl_vfprintf ++# endif ++# define GNULIB_overrides_vfprintf 1 ++# if @GNULIB_VFPRINTF_POSIX@ ++_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) ++ _GL_ARG_NONNULL ((1, 2))); ++# else ++_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); ++# else ++/* Need to cast, because on Solaris, the third parameter is ++ __va_list args ++ and GCC's fixincludes did not change this to __gnuc_va_list. */ ++_GL_CXXALIAS_SYS_CAST (vfprintf, int, ++ (FILE *fp, const char *format, va_list args)); ++# endif ++_GL_CXXALIASWARN (vfprintf); ++#endif ++#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK ++# if !GNULIB_overrides_vfprintf ++# undef vfprintf ++# endif ++/* Assume vfprintf is always declared. */ ++_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " ++ "use gnulib module vfprintf-posix for portable " ++ "POSIX compliance"); ++#endif ++ ++#if @GNULIB_VFSCANF@ ++# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef vfscanf ++# define vfscanf rpl_vfscanf ++# endif ++_GL_FUNCDECL_RPL (vfscanf, int, ++ (FILE *stream, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (vfscanf, int, ++ (FILE *stream, const char *format, va_list args)); ++# else ++_GL_CXXALIAS_SYS (vfscanf, int, ++ (FILE *stream, const char *format, va_list args)); ++# endif ++_GL_CXXALIASWARN (vfscanf); ++#endif ++ ++#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ ++# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ ++ || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define vprintf rpl_vprintf ++# endif ++# define GNULIB_overrides_vprintf 1 ++# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ ++_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0) ++ _GL_ARG_NONNULL ((1))); ++# else ++_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); ++# else ++/* Need to cast, because on Solaris, the second parameter is ++ __va_list args ++ and GCC's fixincludes did not change this to __gnuc_va_list. */ ++_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args)); ++# endif ++_GL_CXXALIASWARN (vprintf); ++#endif ++#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK ++# if !GNULIB_overrides_vprintf ++# undef vprintf ++# endif ++/* Assume vprintf is always declared. */ ++_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " ++ "use gnulib module vprintf-posix for portable " ++ "POSIX compliance"); ++#endif ++ ++#if @GNULIB_VSCANF@ ++# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef vscanf ++# define vscanf rpl_vscanf ++# endif ++_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args)); ++# else ++_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args)); ++# endif ++_GL_CXXALIASWARN (vscanf); ++#endif ++ ++#if @GNULIB_VSNPRINTF@ ++# if @REPLACE_VSNPRINTF@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define vsnprintf rpl_vsnprintf ++# endif ++_GL_FUNCDECL_RPL (vsnprintf, int, ++ (char *str, size_t size, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) ++ _GL_ARG_NONNULL ((3))); ++_GL_CXXALIAS_RPL (vsnprintf, int, ++ (char *str, size_t size, const char *format, va_list args)); ++# else ++# if !@HAVE_DECL_VSNPRINTF@ ++_GL_FUNCDECL_SYS (vsnprintf, int, ++ (char *str, size_t size, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) ++ _GL_ARG_NONNULL ((3))); ++# endif ++_GL_CXXALIAS_SYS (vsnprintf, int, ++ (char *str, size_t size, const char *format, va_list args)); ++# endif ++_GL_CXXALIASWARN (vsnprintf); ++#elif defined GNULIB_POSIXCHECK ++# undef vsnprintf ++# if HAVE_RAW_DECL_VSNPRINTF ++_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " ++ "use gnulib module vsnprintf for portability"); ++# endif ++#endif ++ ++#if @GNULIB_VSPRINTF_POSIX@ ++# if @REPLACE_VSPRINTF@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define vsprintf rpl_vsprintf ++# endif ++_GL_FUNCDECL_RPL (vsprintf, int, ++ (char *str, const char *format, va_list args) ++ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (vsprintf, int, ++ (char *str, const char *format, va_list args)); ++# else ++/* Need to cast, because on Solaris, the third parameter is ++ __va_list args ++ and GCC's fixincludes did not change this to __gnuc_va_list. */ ++_GL_CXXALIAS_SYS_CAST (vsprintf, int, ++ (char *str, const char *format, va_list args)); ++# endif ++_GL_CXXALIASWARN (vsprintf); ++#elif defined GNULIB_POSIXCHECK ++# undef vsprintf ++/* Assume vsprintf is always declared. */ ++_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " ++ "use gnulib module vsprintf-posix for portable " ++ "POSIX compliance"); ++#endif ++ ++ ++#endif /* _@GUARD_PREFIX@_STDIO_H */ ++#endif /* _@GUARD_PREFIX@_STDIO_H */ ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stdlib.h b/xbmc/screensavers/rsxs-0.9/lib/stdlib.h +new file mode 100644 +index 0000000..4f847a3 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/stdlib.h +@@ -0,0 +1,1126 @@ ++/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ ++/* A GNU-like . ++ ++ Copyright (C) 1995, 2001-2004, 2006-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#if __GNUC__ >= 3 ++#pragma GCC system_header ++#endif ++ ++ ++#if defined __need_malloc_and_calloc ++/* Special invocation convention inside glibc header files. */ ++ ++#include_next ++ ++#else ++/* Normal invocation convention. */ ++ ++#ifndef _GL_STDLIB_H ++ ++/* The include_next requires a split double-inclusion guard. */ ++#include_next ++ ++#ifndef _GL_STDLIB_H ++#define _GL_STDLIB_H ++ ++/* NetBSD 5.0 mis-defines NULL. */ ++#include ++ ++/* MirBSD 10 defines WEXITSTATUS in , not in . */ ++#if 0 && !defined WEXITSTATUS ++# include ++#endif ++ ++/* Solaris declares getloadavg() in . */ ++#if (0 || defined GNULIB_POSIXCHECK) && 0 ++# include ++#endif ++ ++#if 0 ++ ++/* OSF/1 5.1 declares 'struct random_data' in , which is included ++ from if _REENTRANT is defined. Include it whenever we need ++ 'struct random_data'. */ ++# if 1 ++# include ++# endif ++ ++# if !1 || !1 ++# include ++# endif ++ ++# if !1 ++/* Define 'struct random_data'. ++ But allow multiple gnulib generated replacements to coexist. */ ++# if !GNULIB_defined_struct_random_data ++struct random_data ++{ ++ int32_t *fptr; /* Front pointer. */ ++ int32_t *rptr; /* Rear pointer. */ ++ int32_t *state; /* Array of state values. */ ++ int rand_type; /* Type of random number generator. */ ++ int rand_deg; /* Degree of random number generator. */ ++ int rand_sep; /* Distance between front and rear. */ ++ int32_t *end_ptr; /* Pointer behind state table. */ ++}; ++# define GNULIB_defined_struct_random_data 1 ++# endif ++# endif ++#endif ++ ++#if (0 || 0 || 0 || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) ++/* On MacOS X 10.3, only declares mkstemp. */ ++/* On MacOS X 10.5, only declares mkstemps. */ ++/* On Cygwin 1.7.1, only declares getsubopt. */ ++/* But avoid namespace pollution on glibc systems and native Windows. */ ++# include ++#endif ++ ++/* The definition of _Noreturn is copied here. */ ++#ifndef _Noreturn ++# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ ++ || 0x5110 <= __SUNPRO_C) ++# define _Noreturn __attribute__ ((__noreturn__)) ++# elif 1200 <= _MSC_VER ++# define _Noreturn __declspec (noreturn) ++# else ++# define _Noreturn ++# endif ++#endif ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++#ifndef _GL_CXXDEFS_H ++#define _GL_CXXDEFS_H ++ ++/* The three most frequent use cases of these macros are: ++ ++ * For providing a substitute for a function that is missing on some ++ platforms, but is declared and works fine on the platforms on which ++ it exists: ++ ++ #if @GNULIB_FOO@ ++ # if !@HAVE_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on all platforms, ++ but is broken/insufficient and needs to be replaced on some platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on some platforms ++ but is broken/insufficient and needs to be replaced on some of them and ++ is additionally either missing or undeclared on some other platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++*/ ++ ++/* _GL_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#if defined __cplusplus ++# define _GL_EXTERN_C extern "C" ++#else ++# define _GL_EXTERN_C extern ++#endif ++ ++/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); ++ declares a replacement function, named rpl_func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ ++ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) ++#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype rpl_func parameters_and_attributes ++ ++/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); ++ declares the system function, named func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype func parameters_and_attributes ++ ++/* _GL_CXXALIAS_RPL (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. ++ Example: ++ _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); ++ */ ++#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ ++ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = ::rpl_func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); ++ is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); ++ except that the C function rpl_func may have a slightly different ++ declaration. A cast is used to silence the "invalid conversion" error ++ that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = \ ++ reinterpret_cast(::rpl_func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to the system provided function func, if GNULIB_NAMESPACE ++ is defined. ++ Example: ++ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); ++ */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* If we were to write ++ rettype (*const func) parameters = ::func; ++ like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls ++ better (remove an indirection through a 'static' pointer variable), ++ but then the _GL_CXXALIASWARN macro below would cause a warning not only ++ for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = ::func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function func may have a slightly different declaration. ++ A cast is used to silence the "invalid conversion" error that would ++ otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast(::func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function is picked among a set of overloaded functions, ++ namely the one with rettype2 and parameters2. Two consecutive casts ++ are used to silence the "cannot find a match" and "invalid conversion" ++ errors that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* The outer cast must be a reinterpret_cast. ++ The inner cast: When the function is defined as a set of overloaded ++ functions, it works as a static_cast<>, choosing the designated variant. ++ When the function is defined as a single variant, it works as a ++ reinterpret_cast<>. The parenthesized cast syntax works both ways. */ ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast( \ ++ (rettype2(*)parameters2)(::func)); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN (func); ++ causes a warning to be emitted when ::func is used but not when ++ GNULIB_NAMESPACE::func is used. func must be defined without overloaded ++ variants. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN(func) \ ++ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN_1(func,namespace) \ ++ _GL_CXXALIASWARN_2 (func, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_WARN_ON_USE (func, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN(func) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); ++ causes a warning to be emitted when the given overloaded variant of ::func ++ is used but not when GNULIB_NAMESPACE::func is used. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ ++ GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++#endif /* _GL_CXXDEFS_H */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools ++ that the values passed as arguments n, ..., m must be non-NULL pointers. ++ n = 1 stands for the first argument, n = 2 for the second argument etc. */ ++#ifndef _GL_ARG_NONNULL ++# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 ++# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) ++# else ++# define _GL_ARG_NONNULL(params) ++# endif ++#endif ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++#ifndef _GL_WARN_ON_USE ++ ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++/* A compiler attribute is available in gcc versions 4.3.0 and later. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function __attribute__ ((__warning__ (message))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE(function, message) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") ++ is like _GL_WARN_ON_USE (function, "string"), except that the function is ++ declared with the given prototype, consisting of return type, parameters, ++ and attributes. ++ This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does ++ not work in this case. */ ++#ifndef _GL_WARN_ON_USE_CXX ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes \ ++ __attribute__ ((__warning__ (msg))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#ifndef _GL_WARN_EXTERN_C ++# if defined __cplusplus ++# define _GL_WARN_EXTERN_C extern "C" ++# else ++# define _GL_WARN_EXTERN_C extern ++# endif ++#endif ++ ++ ++/* Some systems do not define EXIT_*, despite otherwise supporting C89. */ ++#ifndef EXIT_SUCCESS ++# define EXIT_SUCCESS 0 ++#endif ++/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere ++ with proper operation of xargs. */ ++#ifndef EXIT_FAILURE ++# define EXIT_FAILURE 1 ++#elif EXIT_FAILURE != 1 ++# undef EXIT_FAILURE ++# define EXIT_FAILURE 1 ++#endif ++ ++ ++#if 0 ++/* Terminate the current process with the given return code, without running ++ the 'atexit' handlers. */ ++# if !1 ++_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); ++# endif ++_GL_CXXALIAS_SYS (_Exit, void, (int status)); ++_GL_CXXALIASWARN (_Exit); ++#elif defined GNULIB_POSIXCHECK ++# undef _Exit ++# if HAVE_RAW_DECL__EXIT ++_GL_WARN_ON_USE (_Exit, "_Exit is unportable - " ++ "use gnulib module _Exit for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Parse a signed decimal integer. ++ Returns the value of the integer. Errors are not detected. */ ++# if !1 ++_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); ++_GL_CXXALIASWARN (atoll); ++#elif defined GNULIB_POSIXCHECK ++# undef atoll ++# if HAVE_RAW_DECL_ATOLL ++_GL_WARN_ON_USE (atoll, "atoll is unportable - " ++ "use gnulib module atoll for portability"); ++# endif ++#endif ++ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef calloc ++# define calloc rpl_calloc ++# endif ++_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); ++_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); ++# else ++_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); ++# endif ++_GL_CXXALIASWARN (calloc); ++#elif defined GNULIB_POSIXCHECK ++# undef calloc ++/* Assume calloc is always declared. */ ++_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " ++ "use gnulib module calloc-posix for portability"); ++#endif ++ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define canonicalize_file_name rpl_canonicalize_file_name ++# endif ++_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); ++# endif ++_GL_CXXALIASWARN (canonicalize_file_name); ++#elif defined GNULIB_POSIXCHECK ++# undef canonicalize_file_name ++# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME ++_GL_WARN_ON_USE (canonicalize_file_name, ++ "canonicalize_file_name is unportable - " ++ "use gnulib module canonicalize-lgpl for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Store max(NELEM,3) load average numbers in LOADAVG[]. ++ The three numbers are the load average of the last 1 minute, the last 5 ++ minutes, and the last 15 minutes, respectively. ++ LOADAVG is an array of NELEM numbers. */ ++# if !1 ++_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); ++_GL_CXXALIASWARN (getloadavg); ++#elif defined GNULIB_POSIXCHECK ++# undef getloadavg ++# if HAVE_RAW_DECL_GETLOADAVG ++_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " ++ "use gnulib module getloadavg for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Assuming *OPTIONP is a comma separated list of elements of the form ++ "token" or "token=value", getsubopt parses the first of these elements. ++ If the first element refers to a "token" that is member of the given ++ NULL-terminated array of tokens: ++ - It replaces the comma with a NUL byte, updates *OPTIONP to point past ++ the first option and the comma, sets *VALUEP to the value of the ++ element (or NULL if it doesn't contain an "=" sign), ++ - It returns the index of the "token" in the given array of tokens. ++ Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. ++ For more details see the POSIX:2001 specification. ++ http://www.opengroup.org/susv3xsh/getsubopt.html */ ++# if !1 ++_GL_FUNCDECL_SYS (getsubopt, int, ++ (char **optionp, char *const *tokens, char **valuep) ++ _GL_ARG_NONNULL ((1, 2, 3))); ++# endif ++_GL_CXXALIAS_SYS (getsubopt, int, ++ (char **optionp, char *const *tokens, char **valuep)); ++_GL_CXXALIASWARN (getsubopt); ++#elif defined GNULIB_POSIXCHECK ++# undef getsubopt ++# if HAVE_RAW_DECL_GETSUBOPT ++_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " ++ "use gnulib module getsubopt for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Change the ownership and access permission of the slave side of the ++ pseudo-terminal whose master side is specified by FD. */ ++# if !1 ++_GL_FUNCDECL_SYS (grantpt, int, (int fd)); ++# endif ++_GL_CXXALIAS_SYS (grantpt, int, (int fd)); ++_GL_CXXALIASWARN (grantpt); ++#elif defined GNULIB_POSIXCHECK ++# undef grantpt ++# if HAVE_RAW_DECL_GRANTPT ++_GL_WARN_ON_USE (grantpt, "grantpt is not portable - " ++ "use gnulib module grantpt for portability"); ++# endif ++#endif ++ ++/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not ++ rely on GNU or POSIX semantics for malloc and realloc (for example, ++ by never specifying a zero size), so it does not need malloc or ++ realloc to be redefined. */ ++#if 1 ++# if 0 ++# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ ++ || _GL_USE_STDLIB_ALLOC) ++# undef malloc ++# define malloc rpl_malloc ++# endif ++_GL_FUNCDECL_RPL (malloc, void *, (size_t size)); ++_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); ++# else ++_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); ++# endif ++_GL_CXXALIASWARN (malloc); ++#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC ++# undef malloc ++/* Assume malloc is always declared. */ ++_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " ++ "use gnulib module malloc-posix for portability"); ++#endif ++ ++/* Convert a multibyte character to a wide character. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbtowc ++# define mbtowc rpl_mbtowc ++# endif ++_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); ++_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); ++# else ++_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); ++# endif ++_GL_CXXALIASWARN (mbtowc); ++#endif ++ ++#if 0 ++/* Create a unique temporary directory from TEMPLATE. ++ The last six characters of TEMPLATE must be "XXXXXX"; ++ they are replaced with a string that makes the directory name unique. ++ Returns TEMPLATE, or a null pointer if it cannot get a unique name. ++ The directory is created mode 700. */ ++# if !1 ++_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); ++_GL_CXXALIASWARN (mkdtemp); ++#elif defined GNULIB_POSIXCHECK ++# undef mkdtemp ++# if HAVE_RAW_DECL_MKDTEMP ++_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " ++ "use gnulib module mkdtemp for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Create a unique temporary file from TEMPLATE. ++ The last six characters of TEMPLATE must be "XXXXXX"; ++ they are replaced with a string that makes the file name unique. ++ The flags are a bitmask, possibly including O_CLOEXEC (defined in ) ++ and O_TEXT, O_BINARY (defined in "binary-io.h"). ++ The file is then created, with the specified flags, ensuring it didn't exist ++ before. ++ The file is created read-write (mask at least 0600 & ~umask), but it may be ++ world-readable and world-writable (mask 0666 & ~umask), depending on the ++ implementation. ++ Returns the open file descriptor if successful, otherwise -1 and errno ++ set. */ ++# if !1 ++_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); ++_GL_CXXALIASWARN (mkostemp); ++#elif defined GNULIB_POSIXCHECK ++# undef mkostemp ++# if HAVE_RAW_DECL_MKOSTEMP ++_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " ++ "use gnulib module mkostemp for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Create a unique temporary file from TEMPLATE. ++ The last six characters of TEMPLATE before a suffix of length ++ SUFFIXLEN must be "XXXXXX"; ++ they are replaced with a string that makes the file name unique. ++ The flags are a bitmask, possibly including O_CLOEXEC (defined in ) ++ and O_TEXT, O_BINARY (defined in "binary-io.h"). ++ The file is then created, with the specified flags, ensuring it didn't exist ++ before. ++ The file is created read-write (mask at least 0600 & ~umask), but it may be ++ world-readable and world-writable (mask 0666 & ~umask), depending on the ++ implementation. ++ Returns the open file descriptor if successful, otherwise -1 and errno ++ set. */ ++# if !1 ++_GL_FUNCDECL_SYS (mkostemps, int, ++ (char * /*template*/, int /*suffixlen*/, int /*flags*/) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (mkostemps, int, ++ (char * /*template*/, int /*suffixlen*/, int /*flags*/)); ++_GL_CXXALIASWARN (mkostemps); ++#elif defined GNULIB_POSIXCHECK ++# undef mkostemps ++# if HAVE_RAW_DECL_MKOSTEMPS ++_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " ++ "use gnulib module mkostemps for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Create a unique temporary file from TEMPLATE. ++ The last six characters of TEMPLATE must be "XXXXXX"; ++ they are replaced with a string that makes the file name unique. ++ The file is then created, ensuring it didn't exist before. ++ The file is created read-write (mask at least 0600 & ~umask), but it may be ++ world-readable and world-writable (mask 0666 & ~umask), depending on the ++ implementation. ++ Returns the open file descriptor if successful, otherwise -1 and errno ++ set. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define mkstemp rpl_mkstemp ++# endif ++_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); ++# else ++# if ! 1 ++_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); ++# endif ++_GL_CXXALIASWARN (mkstemp); ++#elif defined GNULIB_POSIXCHECK ++# undef mkstemp ++# if HAVE_RAW_DECL_MKSTEMP ++_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " ++ "use gnulib module mkstemp for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Create a unique temporary file from TEMPLATE. ++ The last six characters of TEMPLATE prior to a suffix of length ++ SUFFIXLEN must be "XXXXXX"; ++ they are replaced with a string that makes the file name unique. ++ The file is then created, ensuring it didn't exist before. ++ The file is created read-write (mask at least 0600 & ~umask), but it may be ++ world-readable and world-writable (mask 0666 & ~umask), depending on the ++ implementation. ++ Returns the open file descriptor if successful, otherwise -1 and errno ++ set. */ ++# if !1 ++_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); ++_GL_CXXALIASWARN (mkstemps); ++#elif defined GNULIB_POSIXCHECK ++# undef mkstemps ++# if HAVE_RAW_DECL_MKSTEMPS ++_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " ++ "use gnulib module mkstemps for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Return an FD open to the master side of a pseudo-terminal. Flags should ++ include O_RDWR, and may also include O_NOCTTY. */ ++# if !1 ++_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); ++# endif ++_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); ++_GL_CXXALIASWARN (posix_openpt); ++#elif defined GNULIB_POSIXCHECK ++# undef posix_openpt ++# if HAVE_RAW_DECL_POSIX_OPENPT ++_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " ++ "use gnulib module posix_openpt for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Return the pathname of the pseudo-terminal slave associated with ++ the master FD is open on, or NULL on errors. */ ++# if !1 ++_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); ++# endif ++_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); ++_GL_CXXALIASWARN (ptsname); ++#elif defined GNULIB_POSIXCHECK ++# undef ptsname ++# if HAVE_RAW_DECL_PTSNAME ++_GL_WARN_ON_USE (ptsname, "ptsname is not portable - " ++ "use gnulib module ptsname for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Set the pathname of the pseudo-terminal slave associated with ++ the master FD is open on and return 0, or set errno and return ++ non-zero on errors. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef ptsname_r ++# define ptsname_r rpl_ptsname_r ++# endif ++_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); ++_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); ++# endif ++_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); ++# endif ++_GL_CXXALIASWARN (ptsname_r); ++#elif defined GNULIB_POSIXCHECK ++# undef ptsname_r ++# if HAVE_RAW_DECL_PTSNAME_R ++_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " ++ "use gnulib module ptsname_r for portability"); ++# endif ++#endif ++ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef putenv ++# define putenv rpl_putenv ++# endif ++_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (putenv, int, (char *string)); ++# else ++_GL_CXXALIAS_SYS (putenv, int, (char *string)); ++# endif ++_GL_CXXALIASWARN (putenv); ++#endif ++ ++ ++#if 0 ++# if !1 ++# ifndef RAND_MAX ++# define RAND_MAX 2147483647 ++# endif ++# endif ++#endif ++ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); ++_GL_CXXALIASWARN (random_r); ++#elif defined GNULIB_POSIXCHECK ++# undef random_r ++# if HAVE_RAW_DECL_RANDOM_R ++_GL_WARN_ON_USE (random_r, "random_r is unportable - " ++ "use gnulib module random_r for portability"); ++# endif ++#endif ++ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (srandom_r, int, ++ (unsigned int seed, struct random_data *rand_state) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (srandom_r, int, ++ (unsigned int seed, struct random_data *rand_state)); ++_GL_CXXALIASWARN (srandom_r); ++#elif defined GNULIB_POSIXCHECK ++# undef srandom_r ++# if HAVE_RAW_DECL_SRANDOM_R ++_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " ++ "use gnulib module random_r for portability"); ++# endif ++#endif ++ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (initstate_r, int, ++ (unsigned int seed, char *buf, size_t buf_size, ++ struct random_data *rand_state) ++ _GL_ARG_NONNULL ((2, 4))); ++# endif ++_GL_CXXALIAS_SYS (initstate_r, int, ++ (unsigned int seed, char *buf, size_t buf_size, ++ struct random_data *rand_state)); ++_GL_CXXALIASWARN (initstate_r); ++#elif defined GNULIB_POSIXCHECK ++# undef initstate_r ++# if HAVE_RAW_DECL_INITSTATE_R ++_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " ++ "use gnulib module random_r for portability"); ++# endif ++#endif ++ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (setstate_r, int, ++ (char *arg_state, struct random_data *rand_state) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (setstate_r, int, ++ (char *arg_state, struct random_data *rand_state)); ++_GL_CXXALIASWARN (setstate_r); ++#elif defined GNULIB_POSIXCHECK ++# undef setstate_r ++# if HAVE_RAW_DECL_SETSTATE_R ++_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " ++ "use gnulib module random_r for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++# if 0 ++# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ ++ || _GL_USE_STDLIB_ALLOC) ++# undef realloc ++# define realloc rpl_realloc ++# endif ++_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); ++_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); ++# else ++_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); ++# endif ++_GL_CXXALIASWARN (realloc); ++#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC ++# undef realloc ++/* Assume realloc is always declared. */ ++_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " ++ "use gnulib module realloc-posix for portability"); ++#endif ++ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define realpath rpl_realpath ++# endif ++_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); ++# endif ++_GL_CXXALIASWARN (realpath); ++#elif defined GNULIB_POSIXCHECK ++# undef realpath ++# if HAVE_RAW_DECL_REALPATH ++_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " ++ "canonicalize or canonicalize-lgpl for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Test a user response to a question. ++ Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ ++# if !1 ++_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); ++_GL_CXXALIASWARN (rpmatch); ++#elif defined GNULIB_POSIXCHECK ++# undef rpmatch ++# if HAVE_RAW_DECL_RPMATCH ++_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " ++ "use gnulib module rpmatch for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Set NAME to VALUE in the environment. ++ If REPLACE is nonzero, overwrite an existing value. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef setenv ++# define setenv rpl_setenv ++# endif ++_GL_FUNCDECL_RPL (setenv, int, ++ (const char *name, const char *value, int replace) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (setenv, int, ++ (const char *name, const char *value, int replace)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (setenv, int, ++ (const char *name, const char *value, int replace) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (setenv, int, ++ (const char *name, const char *value, int replace)); ++# endif ++# if !(0 && !1) ++_GL_CXXALIASWARN (setenv); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef setenv ++# if HAVE_RAW_DECL_SETENV ++_GL_WARN_ON_USE (setenv, "setenv is unportable - " ++ "use gnulib module setenv for portability"); ++# endif ++#endif ++ ++#if 0 ++ /* Parse a double from STRING, updating ENDP if appropriate. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define strtod rpl_strtod ++# endif ++_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); ++# endif ++_GL_CXXALIASWARN (strtod); ++#elif defined GNULIB_POSIXCHECK ++# undef strtod ++# if HAVE_RAW_DECL_STRTOD ++_GL_WARN_ON_USE (strtod, "strtod is unportable - " ++ "use gnulib module strtod for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Parse a signed integer whose textual representation starts at STRING. ++ The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, ++ it may be decimal or octal (with prefix "0") or hexadecimal (with prefix ++ "0x"). ++ If ENDPTR is not NULL, the address of the first byte after the integer is ++ stored in *ENDPTR. ++ Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set ++ to ERANGE. */ ++# if !1 ++_GL_FUNCDECL_SYS (strtoll, long long, ++ (const char *string, char **endptr, int base) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strtoll, long long, ++ (const char *string, char **endptr, int base)); ++_GL_CXXALIASWARN (strtoll); ++#elif defined GNULIB_POSIXCHECK ++# undef strtoll ++# if HAVE_RAW_DECL_STRTOLL ++_GL_WARN_ON_USE (strtoll, "strtoll is unportable - " ++ "use gnulib module strtoll for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Parse an unsigned integer whose textual representation starts at STRING. ++ The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, ++ it may be decimal or octal (with prefix "0") or hexadecimal (with prefix ++ "0x"). ++ If ENDPTR is not NULL, the address of the first byte after the integer is ++ stored in *ENDPTR. ++ Upon overflow, the return value is ULLONG_MAX, and errno is set to ++ ERANGE. */ ++# if !1 ++_GL_FUNCDECL_SYS (strtoull, unsigned long long, ++ (const char *string, char **endptr, int base) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strtoull, unsigned long long, ++ (const char *string, char **endptr, int base)); ++_GL_CXXALIASWARN (strtoull); ++#elif defined GNULIB_POSIXCHECK ++# undef strtoull ++# if HAVE_RAW_DECL_STRTOULL ++_GL_WARN_ON_USE (strtoull, "strtoull is unportable - " ++ "use gnulib module strtoull for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Unlock the slave side of the pseudo-terminal whose master side is specified ++ by FD, so that it can be opened. */ ++# if !1 ++_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); ++# endif ++_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); ++_GL_CXXALIASWARN (unlockpt); ++#elif defined GNULIB_POSIXCHECK ++# undef unlockpt ++# if HAVE_RAW_DECL_UNLOCKPT ++_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " ++ "use gnulib module unlockpt for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Remove the variable NAME from the environment. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef unsetenv ++# define unsetenv rpl_unsetenv ++# endif ++_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); ++# endif ++# if !(0 && !1) ++_GL_CXXALIASWARN (unsetenv); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef unsetenv ++# if HAVE_RAW_DECL_UNSETENV ++_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " ++ "use gnulib module unsetenv for portability"); ++# endif ++#endif ++ ++/* Convert a wide character to a multibyte character. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wctomb ++# define wctomb rpl_wctomb ++# endif ++_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); ++_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); ++# else ++_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); ++# endif ++_GL_CXXALIASWARN (wctomb); ++#endif ++ ++ ++#endif /* _GL_STDLIB_H */ ++#endif /* _GL_STDLIB_H */ ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stdlib.in.h b/xbmc/screensavers/rsxs-0.9/lib/stdlib.in.h +new file mode 100644 +index 0000000..a59cb08 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/stdlib.in.h +@@ -0,0 +1,804 @@ ++/* A GNU-like . ++ ++ Copyright (C) 1995, 2001-2004, 2006-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++#if defined __need_malloc_and_calloc ++/* Special invocation convention inside glibc header files. */ ++ ++#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ ++ ++#else ++/* Normal invocation convention. */ ++ ++#ifndef _@GUARD_PREFIX@_STDLIB_H ++ ++/* The include_next requires a split double-inclusion guard. */ ++#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ ++ ++#ifndef _@GUARD_PREFIX@_STDLIB_H ++#define _@GUARD_PREFIX@_STDLIB_H ++ ++/* NetBSD 5.0 mis-defines NULL. */ ++#include ++ ++/* MirBSD 10 defines WEXITSTATUS in , not in . */ ++#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS ++# include ++#endif ++ ++/* Solaris declares getloadavg() in . */ ++#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ ++# include ++#endif ++ ++#if @GNULIB_RANDOM_R@ ++ ++/* OSF/1 5.1 declares 'struct random_data' in , which is included ++ from if _REENTRANT is defined. Include it whenever we need ++ 'struct random_data'. */ ++# if @HAVE_RANDOM_H@ ++# include ++# endif ++ ++# if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@ ++# include ++# endif ++ ++# if !@HAVE_STRUCT_RANDOM_DATA@ ++/* Define 'struct random_data'. ++ But allow multiple gnulib generated replacements to coexist. */ ++# if !GNULIB_defined_struct_random_data ++struct random_data ++{ ++ int32_t *fptr; /* Front pointer. */ ++ int32_t *rptr; /* Rear pointer. */ ++ int32_t *state; /* Array of state values. */ ++ int rand_type; /* Type of random number generator. */ ++ int rand_deg; /* Degree of random number generator. */ ++ int rand_sep; /* Distance between front and rear. */ ++ int32_t *end_ptr; /* Pointer behind state table. */ ++}; ++# define GNULIB_defined_struct_random_data 1 ++# endif ++# endif ++#endif ++ ++#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) ++/* On MacOS X 10.3, only declares mkstemp. */ ++/* On MacOS X 10.5, only declares mkstemps. */ ++/* On Cygwin 1.7.1, only declares getsubopt. */ ++/* But avoid namespace pollution on glibc systems and native Windows. */ ++# include ++#endif ++ ++/* The definition of _Noreturn is copied here. */ ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++ ++ ++/* Some systems do not define EXIT_*, despite otherwise supporting C89. */ ++#ifndef EXIT_SUCCESS ++# define EXIT_SUCCESS 0 ++#endif ++/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere ++ with proper operation of xargs. */ ++#ifndef EXIT_FAILURE ++# define EXIT_FAILURE 1 ++#elif EXIT_FAILURE != 1 ++# undef EXIT_FAILURE ++# define EXIT_FAILURE 1 ++#endif ++ ++ ++#if @GNULIB__EXIT@ ++/* Terminate the current process with the given return code, without running ++ the 'atexit' handlers. */ ++# if !@HAVE__EXIT@ ++_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); ++# endif ++_GL_CXXALIAS_SYS (_Exit, void, (int status)); ++_GL_CXXALIASWARN (_Exit); ++#elif defined GNULIB_POSIXCHECK ++# undef _Exit ++# if HAVE_RAW_DECL__EXIT ++_GL_WARN_ON_USE (_Exit, "_Exit is unportable - " ++ "use gnulib module _Exit for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_ATOLL@ ++/* Parse a signed decimal integer. ++ Returns the value of the integer. Errors are not detected. */ ++# if !@HAVE_ATOLL@ ++_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); ++_GL_CXXALIASWARN (atoll); ++#elif defined GNULIB_POSIXCHECK ++# undef atoll ++# if HAVE_RAW_DECL_ATOLL ++_GL_WARN_ON_USE (atoll, "atoll is unportable - " ++ "use gnulib module atoll for portability"); ++# endif ++#endif ++ ++#if @GNULIB_CALLOC_POSIX@ ++# if @REPLACE_CALLOC@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef calloc ++# define calloc rpl_calloc ++# endif ++_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); ++_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); ++# else ++_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); ++# endif ++_GL_CXXALIASWARN (calloc); ++#elif defined GNULIB_POSIXCHECK ++# undef calloc ++/* Assume calloc is always declared. */ ++_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " ++ "use gnulib module calloc-posix for portability"); ++#endif ++ ++#if @GNULIB_CANONICALIZE_FILE_NAME@ ++# if @REPLACE_CANONICALIZE_FILE_NAME@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define canonicalize_file_name rpl_canonicalize_file_name ++# endif ++_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); ++# else ++# if !@HAVE_CANONICALIZE_FILE_NAME@ ++_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); ++# endif ++_GL_CXXALIASWARN (canonicalize_file_name); ++#elif defined GNULIB_POSIXCHECK ++# undef canonicalize_file_name ++# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME ++_GL_WARN_ON_USE (canonicalize_file_name, ++ "canonicalize_file_name is unportable - " ++ "use gnulib module canonicalize-lgpl for portability"); ++# endif ++#endif ++ ++#if @GNULIB_GETLOADAVG@ ++/* Store max(NELEM,3) load average numbers in LOADAVG[]. ++ The three numbers are the load average of the last 1 minute, the last 5 ++ minutes, and the last 15 minutes, respectively. ++ LOADAVG is an array of NELEM numbers. */ ++# if !@HAVE_DECL_GETLOADAVG@ ++_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); ++_GL_CXXALIASWARN (getloadavg); ++#elif defined GNULIB_POSIXCHECK ++# undef getloadavg ++# if HAVE_RAW_DECL_GETLOADAVG ++_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " ++ "use gnulib module getloadavg for portability"); ++# endif ++#endif ++ ++#if @GNULIB_GETSUBOPT@ ++/* Assuming *OPTIONP is a comma separated list of elements of the form ++ "token" or "token=value", getsubopt parses the first of these elements. ++ If the first element refers to a "token" that is member of the given ++ NULL-terminated array of tokens: ++ - It replaces the comma with a NUL byte, updates *OPTIONP to point past ++ the first option and the comma, sets *VALUEP to the value of the ++ element (or NULL if it doesn't contain an "=" sign), ++ - It returns the index of the "token" in the given array of tokens. ++ Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. ++ For more details see the POSIX:2001 specification. ++ http://www.opengroup.org/susv3xsh/getsubopt.html */ ++# if !@HAVE_GETSUBOPT@ ++_GL_FUNCDECL_SYS (getsubopt, int, ++ (char **optionp, char *const *tokens, char **valuep) ++ _GL_ARG_NONNULL ((1, 2, 3))); ++# endif ++_GL_CXXALIAS_SYS (getsubopt, int, ++ (char **optionp, char *const *tokens, char **valuep)); ++_GL_CXXALIASWARN (getsubopt); ++#elif defined GNULIB_POSIXCHECK ++# undef getsubopt ++# if HAVE_RAW_DECL_GETSUBOPT ++_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " ++ "use gnulib module getsubopt for portability"); ++# endif ++#endif ++ ++#if @GNULIB_GRANTPT@ ++/* Change the ownership and access permission of the slave side of the ++ pseudo-terminal whose master side is specified by FD. */ ++# if !@HAVE_GRANTPT@ ++_GL_FUNCDECL_SYS (grantpt, int, (int fd)); ++# endif ++_GL_CXXALIAS_SYS (grantpt, int, (int fd)); ++_GL_CXXALIASWARN (grantpt); ++#elif defined GNULIB_POSIXCHECK ++# undef grantpt ++# if HAVE_RAW_DECL_GRANTPT ++_GL_WARN_ON_USE (grantpt, "grantpt is not portable - " ++ "use gnulib module grantpt for portability"); ++# endif ++#endif ++ ++/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not ++ rely on GNU or POSIX semantics for malloc and realloc (for example, ++ by never specifying a zero size), so it does not need malloc or ++ realloc to be redefined. */ ++#if @GNULIB_MALLOC_POSIX@ ++# if @REPLACE_MALLOC@ ++# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ ++ || _GL_USE_STDLIB_ALLOC) ++# undef malloc ++# define malloc rpl_malloc ++# endif ++_GL_FUNCDECL_RPL (malloc, void *, (size_t size)); ++_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); ++# else ++_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); ++# endif ++_GL_CXXALIASWARN (malloc); ++#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC ++# undef malloc ++/* Assume malloc is always declared. */ ++_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " ++ "use gnulib module malloc-posix for portability"); ++#endif ++ ++/* Convert a multibyte character to a wide character. */ ++#if @GNULIB_MBTOWC@ ++# if @REPLACE_MBTOWC@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbtowc ++# define mbtowc rpl_mbtowc ++# endif ++_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); ++_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); ++# else ++_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); ++# endif ++_GL_CXXALIASWARN (mbtowc); ++#endif ++ ++#if @GNULIB_MKDTEMP@ ++/* Create a unique temporary directory from TEMPLATE. ++ The last six characters of TEMPLATE must be "XXXXXX"; ++ they are replaced with a string that makes the directory name unique. ++ Returns TEMPLATE, or a null pointer if it cannot get a unique name. ++ The directory is created mode 700. */ ++# if !@HAVE_MKDTEMP@ ++_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); ++_GL_CXXALIASWARN (mkdtemp); ++#elif defined GNULIB_POSIXCHECK ++# undef mkdtemp ++# if HAVE_RAW_DECL_MKDTEMP ++_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " ++ "use gnulib module mkdtemp for portability"); ++# endif ++#endif ++ ++#if @GNULIB_MKOSTEMP@ ++/* Create a unique temporary file from TEMPLATE. ++ The last six characters of TEMPLATE must be "XXXXXX"; ++ they are replaced with a string that makes the file name unique. ++ The flags are a bitmask, possibly including O_CLOEXEC (defined in ) ++ and O_TEXT, O_BINARY (defined in "binary-io.h"). ++ The file is then created, with the specified flags, ensuring it didn't exist ++ before. ++ The file is created read-write (mask at least 0600 & ~umask), but it may be ++ world-readable and world-writable (mask 0666 & ~umask), depending on the ++ implementation. ++ Returns the open file descriptor if successful, otherwise -1 and errno ++ set. */ ++# if !@HAVE_MKOSTEMP@ ++_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); ++_GL_CXXALIASWARN (mkostemp); ++#elif defined GNULIB_POSIXCHECK ++# undef mkostemp ++# if HAVE_RAW_DECL_MKOSTEMP ++_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " ++ "use gnulib module mkostemp for portability"); ++# endif ++#endif ++ ++#if @GNULIB_MKOSTEMPS@ ++/* Create a unique temporary file from TEMPLATE. ++ The last six characters of TEMPLATE before a suffix of length ++ SUFFIXLEN must be "XXXXXX"; ++ they are replaced with a string that makes the file name unique. ++ The flags are a bitmask, possibly including O_CLOEXEC (defined in ) ++ and O_TEXT, O_BINARY (defined in "binary-io.h"). ++ The file is then created, with the specified flags, ensuring it didn't exist ++ before. ++ The file is created read-write (mask at least 0600 & ~umask), but it may be ++ world-readable and world-writable (mask 0666 & ~umask), depending on the ++ implementation. ++ Returns the open file descriptor if successful, otherwise -1 and errno ++ set. */ ++# if !@HAVE_MKOSTEMPS@ ++_GL_FUNCDECL_SYS (mkostemps, int, ++ (char * /*template*/, int /*suffixlen*/, int /*flags*/) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (mkostemps, int, ++ (char * /*template*/, int /*suffixlen*/, int /*flags*/)); ++_GL_CXXALIASWARN (mkostemps); ++#elif defined GNULIB_POSIXCHECK ++# undef mkostemps ++# if HAVE_RAW_DECL_MKOSTEMPS ++_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " ++ "use gnulib module mkostemps for portability"); ++# endif ++#endif ++ ++#if @GNULIB_MKSTEMP@ ++/* Create a unique temporary file from TEMPLATE. ++ The last six characters of TEMPLATE must be "XXXXXX"; ++ they are replaced with a string that makes the file name unique. ++ The file is then created, ensuring it didn't exist before. ++ The file is created read-write (mask at least 0600 & ~umask), but it may be ++ world-readable and world-writable (mask 0666 & ~umask), depending on the ++ implementation. ++ Returns the open file descriptor if successful, otherwise -1 and errno ++ set. */ ++# if @REPLACE_MKSTEMP@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define mkstemp rpl_mkstemp ++# endif ++_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); ++# else ++# if ! @HAVE_MKSTEMP@ ++_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); ++# endif ++_GL_CXXALIASWARN (mkstemp); ++#elif defined GNULIB_POSIXCHECK ++# undef mkstemp ++# if HAVE_RAW_DECL_MKSTEMP ++_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " ++ "use gnulib module mkstemp for portability"); ++# endif ++#endif ++ ++#if @GNULIB_MKSTEMPS@ ++/* Create a unique temporary file from TEMPLATE. ++ The last six characters of TEMPLATE prior to a suffix of length ++ SUFFIXLEN must be "XXXXXX"; ++ they are replaced with a string that makes the file name unique. ++ The file is then created, ensuring it didn't exist before. ++ The file is created read-write (mask at least 0600 & ~umask), but it may be ++ world-readable and world-writable (mask 0666 & ~umask), depending on the ++ implementation. ++ Returns the open file descriptor if successful, otherwise -1 and errno ++ set. */ ++# if !@HAVE_MKSTEMPS@ ++_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); ++_GL_CXXALIASWARN (mkstemps); ++#elif defined GNULIB_POSIXCHECK ++# undef mkstemps ++# if HAVE_RAW_DECL_MKSTEMPS ++_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " ++ "use gnulib module mkstemps for portability"); ++# endif ++#endif ++ ++#if @GNULIB_POSIX_OPENPT@ ++/* Return an FD open to the master side of a pseudo-terminal. Flags should ++ include O_RDWR, and may also include O_NOCTTY. */ ++# if !@HAVE_POSIX_OPENPT@ ++_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); ++# endif ++_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); ++_GL_CXXALIASWARN (posix_openpt); ++#elif defined GNULIB_POSIXCHECK ++# undef posix_openpt ++# if HAVE_RAW_DECL_POSIX_OPENPT ++_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " ++ "use gnulib module posix_openpt for portability"); ++# endif ++#endif ++ ++#if @GNULIB_PTSNAME@ ++/* Return the pathname of the pseudo-terminal slave associated with ++ the master FD is open on, or NULL on errors. */ ++# if !@HAVE_PTSNAME@ ++_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); ++# endif ++_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); ++_GL_CXXALIASWARN (ptsname); ++#elif defined GNULIB_POSIXCHECK ++# undef ptsname ++# if HAVE_RAW_DECL_PTSNAME ++_GL_WARN_ON_USE (ptsname, "ptsname is not portable - " ++ "use gnulib module ptsname for portability"); ++# endif ++#endif ++ ++#if @GNULIB_PTSNAME_R@ ++/* Set the pathname of the pseudo-terminal slave associated with ++ the master FD is open on and return 0, or set errno and return ++ non-zero on errors. */ ++# if @REPLACE_PTSNAME_R@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef ptsname_r ++# define ptsname_r rpl_ptsname_r ++# endif ++_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); ++_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); ++# else ++# if !@HAVE_PTSNAME_R@ ++_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); ++# endif ++_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); ++# endif ++_GL_CXXALIASWARN (ptsname_r); ++#elif defined GNULIB_POSIXCHECK ++# undef ptsname_r ++# if HAVE_RAW_DECL_PTSNAME_R ++_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " ++ "use gnulib module ptsname_r for portability"); ++# endif ++#endif ++ ++#if @GNULIB_PUTENV@ ++# if @REPLACE_PUTENV@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef putenv ++# define putenv rpl_putenv ++# endif ++_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (putenv, int, (char *string)); ++# else ++_GL_CXXALIAS_SYS (putenv, int, (char *string)); ++# endif ++_GL_CXXALIASWARN (putenv); ++#endif ++ ++ ++#if @GNULIB_RANDOM_R@ ++# if !@HAVE_RANDOM_R@ ++# ifndef RAND_MAX ++# define RAND_MAX 2147483647 ++# endif ++# endif ++#endif ++ ++#if @GNULIB_RANDOM_R@ ++# if !@HAVE_RANDOM_R@ ++_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); ++_GL_CXXALIASWARN (random_r); ++#elif defined GNULIB_POSIXCHECK ++# undef random_r ++# if HAVE_RAW_DECL_RANDOM_R ++_GL_WARN_ON_USE (random_r, "random_r is unportable - " ++ "use gnulib module random_r for portability"); ++# endif ++#endif ++ ++#if @GNULIB_RANDOM_R@ ++# if !@HAVE_RANDOM_R@ ++_GL_FUNCDECL_SYS (srandom_r, int, ++ (unsigned int seed, struct random_data *rand_state) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (srandom_r, int, ++ (unsigned int seed, struct random_data *rand_state)); ++_GL_CXXALIASWARN (srandom_r); ++#elif defined GNULIB_POSIXCHECK ++# undef srandom_r ++# if HAVE_RAW_DECL_SRANDOM_R ++_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " ++ "use gnulib module random_r for portability"); ++# endif ++#endif ++ ++#if @GNULIB_RANDOM_R@ ++# if !@HAVE_RANDOM_R@ ++_GL_FUNCDECL_SYS (initstate_r, int, ++ (unsigned int seed, char *buf, size_t buf_size, ++ struct random_data *rand_state) ++ _GL_ARG_NONNULL ((2, 4))); ++# endif ++_GL_CXXALIAS_SYS (initstate_r, int, ++ (unsigned int seed, char *buf, size_t buf_size, ++ struct random_data *rand_state)); ++_GL_CXXALIASWARN (initstate_r); ++#elif defined GNULIB_POSIXCHECK ++# undef initstate_r ++# if HAVE_RAW_DECL_INITSTATE_R ++_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " ++ "use gnulib module random_r for portability"); ++# endif ++#endif ++ ++#if @GNULIB_RANDOM_R@ ++# if !@HAVE_RANDOM_R@ ++_GL_FUNCDECL_SYS (setstate_r, int, ++ (char *arg_state, struct random_data *rand_state) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (setstate_r, int, ++ (char *arg_state, struct random_data *rand_state)); ++_GL_CXXALIASWARN (setstate_r); ++#elif defined GNULIB_POSIXCHECK ++# undef setstate_r ++# if HAVE_RAW_DECL_SETSTATE_R ++_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " ++ "use gnulib module random_r for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_REALLOC_POSIX@ ++# if @REPLACE_REALLOC@ ++# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ ++ || _GL_USE_STDLIB_ALLOC) ++# undef realloc ++# define realloc rpl_realloc ++# endif ++_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); ++_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); ++# else ++_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); ++# endif ++_GL_CXXALIASWARN (realloc); ++#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC ++# undef realloc ++/* Assume realloc is always declared. */ ++_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " ++ "use gnulib module realloc-posix for portability"); ++#endif ++ ++#if @GNULIB_REALPATH@ ++# if @REPLACE_REALPATH@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define realpath rpl_realpath ++# endif ++_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); ++# else ++# if !@HAVE_REALPATH@ ++_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); ++# endif ++_GL_CXXALIASWARN (realpath); ++#elif defined GNULIB_POSIXCHECK ++# undef realpath ++# if HAVE_RAW_DECL_REALPATH ++_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " ++ "canonicalize or canonicalize-lgpl for portability"); ++# endif ++#endif ++ ++#if @GNULIB_RPMATCH@ ++/* Test a user response to a question. ++ Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ ++# if !@HAVE_RPMATCH@ ++_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); ++_GL_CXXALIASWARN (rpmatch); ++#elif defined GNULIB_POSIXCHECK ++# undef rpmatch ++# if HAVE_RAW_DECL_RPMATCH ++_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " ++ "use gnulib module rpmatch for portability"); ++# endif ++#endif ++ ++#if @GNULIB_SETENV@ ++/* Set NAME to VALUE in the environment. ++ If REPLACE is nonzero, overwrite an existing value. */ ++# if @REPLACE_SETENV@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef setenv ++# define setenv rpl_setenv ++# endif ++_GL_FUNCDECL_RPL (setenv, int, ++ (const char *name, const char *value, int replace) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (setenv, int, ++ (const char *name, const char *value, int replace)); ++# else ++# if !@HAVE_DECL_SETENV@ ++_GL_FUNCDECL_SYS (setenv, int, ++ (const char *name, const char *value, int replace) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (setenv, int, ++ (const char *name, const char *value, int replace)); ++# endif ++# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@) ++_GL_CXXALIASWARN (setenv); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef setenv ++# if HAVE_RAW_DECL_SETENV ++_GL_WARN_ON_USE (setenv, "setenv is unportable - " ++ "use gnulib module setenv for portability"); ++# endif ++#endif ++ ++#if @GNULIB_STRTOD@ ++ /* Parse a double from STRING, updating ENDP if appropriate. */ ++# if @REPLACE_STRTOD@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define strtod rpl_strtod ++# endif ++_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); ++# else ++# if !@HAVE_STRTOD@ ++_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); ++# endif ++_GL_CXXALIASWARN (strtod); ++#elif defined GNULIB_POSIXCHECK ++# undef strtod ++# if HAVE_RAW_DECL_STRTOD ++_GL_WARN_ON_USE (strtod, "strtod is unportable - " ++ "use gnulib module strtod for portability"); ++# endif ++#endif ++ ++#if @GNULIB_STRTOLL@ ++/* Parse a signed integer whose textual representation starts at STRING. ++ The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, ++ it may be decimal or octal (with prefix "0") or hexadecimal (with prefix ++ "0x"). ++ If ENDPTR is not NULL, the address of the first byte after the integer is ++ stored in *ENDPTR. ++ Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set ++ to ERANGE. */ ++# if !@HAVE_STRTOLL@ ++_GL_FUNCDECL_SYS (strtoll, long long, ++ (const char *string, char **endptr, int base) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strtoll, long long, ++ (const char *string, char **endptr, int base)); ++_GL_CXXALIASWARN (strtoll); ++#elif defined GNULIB_POSIXCHECK ++# undef strtoll ++# if HAVE_RAW_DECL_STRTOLL ++_GL_WARN_ON_USE (strtoll, "strtoll is unportable - " ++ "use gnulib module strtoll for portability"); ++# endif ++#endif ++ ++#if @GNULIB_STRTOULL@ ++/* Parse an unsigned integer whose textual representation starts at STRING. ++ The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, ++ it may be decimal or octal (with prefix "0") or hexadecimal (with prefix ++ "0x"). ++ If ENDPTR is not NULL, the address of the first byte after the integer is ++ stored in *ENDPTR. ++ Upon overflow, the return value is ULLONG_MAX, and errno is set to ++ ERANGE. */ ++# if !@HAVE_STRTOULL@ ++_GL_FUNCDECL_SYS (strtoull, unsigned long long, ++ (const char *string, char **endptr, int base) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strtoull, unsigned long long, ++ (const char *string, char **endptr, int base)); ++_GL_CXXALIASWARN (strtoull); ++#elif defined GNULIB_POSIXCHECK ++# undef strtoull ++# if HAVE_RAW_DECL_STRTOULL ++_GL_WARN_ON_USE (strtoull, "strtoull is unportable - " ++ "use gnulib module strtoull for portability"); ++# endif ++#endif ++ ++#if @GNULIB_UNLOCKPT@ ++/* Unlock the slave side of the pseudo-terminal whose master side is specified ++ by FD, so that it can be opened. */ ++# if !@HAVE_UNLOCKPT@ ++_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); ++# endif ++_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); ++_GL_CXXALIASWARN (unlockpt); ++#elif defined GNULIB_POSIXCHECK ++# undef unlockpt ++# if HAVE_RAW_DECL_UNLOCKPT ++_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " ++ "use gnulib module unlockpt for portability"); ++# endif ++#endif ++ ++#if @GNULIB_UNSETENV@ ++/* Remove the variable NAME from the environment. */ ++# if @REPLACE_UNSETENV@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef unsetenv ++# define unsetenv rpl_unsetenv ++# endif ++_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); ++# else ++# if !@HAVE_DECL_UNSETENV@ ++_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); ++# endif ++# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@) ++_GL_CXXALIASWARN (unsetenv); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef unsetenv ++# if HAVE_RAW_DECL_UNSETENV ++_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " ++ "use gnulib module unsetenv for portability"); ++# endif ++#endif ++ ++/* Convert a wide character to a multibyte character. */ ++#if @GNULIB_WCTOMB@ ++# if @REPLACE_WCTOMB@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wctomb ++# define wctomb rpl_wctomb ++# endif ++_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); ++_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); ++# else ++_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); ++# endif ++_GL_CXXALIASWARN (wctomb); ++#endif ++ ++ ++#endif /* _@GUARD_PREFIX@_STDLIB_H */ ++#endif /* _@GUARD_PREFIX@_STDLIB_H */ ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stpcpy.c b/xbmc/screensavers/rsxs-0.9/lib/stpcpy.c +new file mode 100644 +index 0000000..fa42af4 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/stpcpy.c +@@ -0,0 +1,49 @@ ++/* stpcpy.c -- copy a string and return pointer to end of new string ++ Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2011 Free Software ++ Foundation, Inc. ++ ++ NOTE: The canonical source of this file is maintained with the GNU C Library. ++ Bugs can be reported to bug-glibc@prep.ai.mit.edu. ++ ++ This program is free software: you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published by the ++ Free Software Foundation; either version 3 of the License, or any ++ later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++#include ++ ++#undef __stpcpy ++#ifdef _LIBC ++# undef stpcpy ++#endif ++ ++#ifndef weak_alias ++# define __stpcpy stpcpy ++#endif ++ ++/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */ ++char * ++__stpcpy (char *dest, const char *src) ++{ ++ register char *d = dest; ++ register const char *s = src; ++ ++ do ++ *d++ = *s; ++ while (*s++ != '\0'); ++ ++ return d - 1; ++} ++#ifdef weak_alias ++weak_alias (__stpcpy, stpcpy) ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/str-two-way.h b/xbmc/screensavers/rsxs-0.9/lib/str-two-way.h +new file mode 100644 +index 0000000..08a6cd3 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/str-two-way.h +@@ -0,0 +1,453 @@ ++/* Byte-wise substring search, using the Two-Way algorithm. ++ Copyright (C) 2008-2011 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ Written by Eric Blake , 2008. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* Before including this file, you need to include and ++ , and define: ++ RESULT_TYPE A macro that expands to the return type. ++ AVAILABLE(h, h_l, j, n_l) ++ A macro that returns nonzero if there are ++ at least N_L bytes left starting at H[J]. ++ H is 'unsigned char *', H_L, J, and N_L ++ are 'size_t'; H_L is an lvalue. For ++ NUL-terminated searches, H_L can be ++ modified each iteration to avoid having ++ to compute the end of H up front. ++ ++ For case-insensitivity, you may optionally define: ++ CMP_FUNC(p1, p2, l) A macro that returns 0 iff the first L ++ characters of P1 and P2 are equal. ++ CANON_ELEMENT(c) A macro that canonicalizes an element right after ++ it has been fetched from one of the two strings. ++ The argument is an 'unsigned char'; the result ++ must be an 'unsigned char' as well. ++ ++ This file undefines the macros documented above, and defines ++ LONG_NEEDLE_THRESHOLD. ++*/ ++ ++#include ++#include ++ ++/* We use the Two-Way string matching algorithm (also known as ++ Chrochemore-Perrin), which guarantees linear complexity with ++ constant space. Additionally, for long needles, we also use a bad ++ character shift table similar to the Boyer-Moore algorithm to ++ achieve improved (potentially sub-linear) performance. ++ ++ See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260, ++ http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm, ++ http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf ++*/ ++ ++/* Point at which computing a bad-byte shift table is likely to be ++ worthwhile. Small needles should not compute a table, since it ++ adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a ++ speedup no greater than a factor of NEEDLE_LEN. The larger the ++ needle, the better the potential performance gain. On the other ++ hand, on non-POSIX systems with CHAR_BIT larger than eight, the ++ memory required for the table is prohibitive. */ ++#if CHAR_BIT < 10 ++# define LONG_NEEDLE_THRESHOLD 32U ++#else ++# define LONG_NEEDLE_THRESHOLD SIZE_MAX ++#endif ++ ++#ifndef MAX ++# define MAX(a, b) ((a < b) ? (b) : (a)) ++#endif ++ ++#ifndef CANON_ELEMENT ++# define CANON_ELEMENT(c) c ++#endif ++#ifndef CMP_FUNC ++# define CMP_FUNC memcmp ++#endif ++ ++/* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN. ++ Return the index of the first byte in the right half, and set ++ *PERIOD to the global period of the right half. ++ ++ The global period of a string is the smallest index (possibly its ++ length) at which all remaining bytes in the string are repetitions ++ of the prefix (the last repetition may be a subset of the prefix). ++ ++ When NEEDLE is factored into two halves, a local period is the ++ length of the smallest word that shares a suffix with the left half ++ and shares a prefix with the right half. All factorizations of a ++ non-empty NEEDLE have a local period of at least 1 and no greater ++ than NEEDLE_LEN. ++ ++ A critical factorization has the property that the local period ++ equals the global period. All strings have at least one critical ++ factorization with the left half smaller than the global period. ++ And while some strings have more than one critical factorization, ++ it is provable that with an ordered alphabet, at least one of the ++ critical factorizations corresponds to a maximal suffix. ++ ++ Given an ordered alphabet, a critical factorization can be computed ++ in linear time, with 2 * NEEDLE_LEN comparisons, by computing the ++ shorter of two ordered maximal suffixes. The ordered maximal ++ suffixes are determined by lexicographic comparison while tracking ++ periodicity. */ ++static size_t ++critical_factorization (const unsigned char *needle, size_t needle_len, ++ size_t *period) ++{ ++ /* Index of last byte of left half, or SIZE_MAX. */ ++ size_t max_suffix, max_suffix_rev; ++ size_t j; /* Index into NEEDLE for current candidate suffix. */ ++ size_t k; /* Offset into current period. */ ++ size_t p; /* Intermediate period. */ ++ unsigned char a, b; /* Current comparison bytes. */ ++ ++ /* Special case NEEDLE_LEN of 1 or 2 (all callers already filtered ++ out 0-length needles. */ ++ if (needle_len < 3) ++ { ++ *period = 1; ++ return needle_len - 1; ++ } ++ ++ /* Invariants: ++ 0 <= j < NEEDLE_LEN - 1 ++ -1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed) ++ min(max_suffix, max_suffix_rev) < global period of NEEDLE ++ 1 <= p <= global period of NEEDLE ++ p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j] ++ 1 <= k <= p ++ */ ++ ++ /* Perform lexicographic search. */ ++ max_suffix = SIZE_MAX; ++ j = 0; ++ k = p = 1; ++ while (j + k < needle_len) ++ { ++ a = CANON_ELEMENT (needle[j + k]); ++ b = CANON_ELEMENT (needle[max_suffix + k]); ++ if (a < b) ++ { ++ /* Suffix is smaller, period is entire prefix so far. */ ++ j += k; ++ k = 1; ++ p = j - max_suffix; ++ } ++ else if (a == b) ++ { ++ /* Advance through repetition of the current period. */ ++ if (k != p) ++ ++k; ++ else ++ { ++ j += p; ++ k = 1; ++ } ++ } ++ else /* b < a */ ++ { ++ /* Suffix is larger, start over from current location. */ ++ max_suffix = j++; ++ k = p = 1; ++ } ++ } ++ *period = p; ++ ++ /* Perform reverse lexicographic search. */ ++ max_suffix_rev = SIZE_MAX; ++ j = 0; ++ k = p = 1; ++ while (j + k < needle_len) ++ { ++ a = CANON_ELEMENT (needle[j + k]); ++ b = CANON_ELEMENT (needle[max_suffix_rev + k]); ++ if (b < a) ++ { ++ /* Suffix is smaller, period is entire prefix so far. */ ++ j += k; ++ k = 1; ++ p = j - max_suffix_rev; ++ } ++ else if (a == b) ++ { ++ /* Advance through repetition of the current period. */ ++ if (k != p) ++ ++k; ++ else ++ { ++ j += p; ++ k = 1; ++ } ++ } ++ else /* a < b */ ++ { ++ /* Suffix is larger, start over from current location. */ ++ max_suffix_rev = j++; ++ k = p = 1; ++ } ++ } ++ ++ /* Choose the shorter suffix. Return the index of the first byte of ++ the right half, rather than the last byte of the left half. ++ ++ For some examples, 'banana' has two critical factorizations, both ++ exposed by the two lexicographic extreme suffixes of 'anana' and ++ 'nana', where both suffixes have a period of 2. On the other ++ hand, with 'aab' and 'bba', both strings have a single critical ++ factorization of the last byte, with the suffix having a period ++ of 1. While the maximal lexicographic suffix of 'aab' is 'b', ++ the maximal lexicographic suffix of 'bba' is 'ba', which is not a ++ critical factorization. Conversely, the maximal reverse ++ lexicographic suffix of 'a' works for 'bba', but not 'ab' for ++ 'aab'. The shorter suffix of the two will always be a critical ++ factorization. */ ++ if (max_suffix_rev + 1 < max_suffix + 1) ++ return max_suffix + 1; ++ *period = p; ++ return max_suffix_rev + 1; ++} ++ ++/* Return the first location of non-empty NEEDLE within HAYSTACK, or ++ NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This ++ method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD. ++ Performance is guaranteed to be linear, with an initialization cost ++ of 2 * NEEDLE_LEN comparisons. ++ ++ If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at ++ most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. ++ If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 * ++ HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. */ ++static RETURN_TYPE ++two_way_short_needle (const unsigned char *haystack, size_t haystack_len, ++ const unsigned char *needle, size_t needle_len) ++{ ++ size_t i; /* Index into current byte of NEEDLE. */ ++ size_t j; /* Index into current window of HAYSTACK. */ ++ size_t period; /* The period of the right half of needle. */ ++ size_t suffix; /* The index of the right half of needle. */ ++ ++ /* Factor the needle into two halves, such that the left half is ++ smaller than the global period, and the right half is ++ periodic (with a period as large as NEEDLE_LEN - suffix). */ ++ suffix = critical_factorization (needle, needle_len, &period); ++ ++ /* Perform the search. Each iteration compares the right half ++ first. */ ++ if (CMP_FUNC (needle, needle + period, suffix) == 0) ++ { ++ /* Entire needle is periodic; a mismatch in the left half can ++ only advance by the period, so use memory to avoid rescanning ++ known occurrences of the period in the right half. */ ++ size_t memory = 0; ++ j = 0; ++ while (AVAILABLE (haystack, haystack_len, j, needle_len)) ++ { ++ /* Scan for matches in right half. */ ++ i = MAX (suffix, memory); ++ while (i < needle_len && (CANON_ELEMENT (needle[i]) ++ == CANON_ELEMENT (haystack[i + j]))) ++ ++i; ++ if (needle_len <= i) ++ { ++ /* Scan for matches in left half. */ ++ i = suffix - 1; ++ while (memory < i + 1 && (CANON_ELEMENT (needle[i]) ++ == CANON_ELEMENT (haystack[i + j]))) ++ --i; ++ if (i + 1 < memory + 1) ++ return (RETURN_TYPE) (haystack + j); ++ /* No match, so remember how many repetitions of period ++ on the right half were scanned. */ ++ j += period; ++ memory = needle_len - period; ++ } ++ else ++ { ++ j += i - suffix + 1; ++ memory = 0; ++ } ++ } ++ } ++ else ++ { ++ /* The two halves of needle are distinct; no extra memory is ++ required, and any mismatch results in a maximal shift. */ ++ period = MAX (suffix, needle_len - suffix) + 1; ++ j = 0; ++ while (AVAILABLE (haystack, haystack_len, j, needle_len)) ++ { ++ /* Scan for matches in right half. */ ++ i = suffix; ++ while (i < needle_len && (CANON_ELEMENT (needle[i]) ++ == CANON_ELEMENT (haystack[i + j]))) ++ ++i; ++ if (needle_len <= i) ++ { ++ /* Scan for matches in left half. */ ++ i = suffix - 1; ++ while (i != SIZE_MAX && (CANON_ELEMENT (needle[i]) ++ == CANON_ELEMENT (haystack[i + j]))) ++ --i; ++ if (i == SIZE_MAX) ++ return (RETURN_TYPE) (haystack + j); ++ j += period; ++ } ++ else ++ j += i - suffix + 1; ++ } ++ } ++ return NULL; ++} ++ ++/* Return the first location of non-empty NEEDLE within HAYSTACK, or ++ NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This ++ method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN. ++ Performance is guaranteed to be linear, with an initialization cost ++ of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations. ++ ++ If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at ++ most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, ++ and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible. ++ If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 * ++ HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and ++ sublinear performance is not possible. */ ++static RETURN_TYPE ++two_way_long_needle (const unsigned char *haystack, size_t haystack_len, ++ const unsigned char *needle, size_t needle_len) ++{ ++ size_t i; /* Index into current byte of NEEDLE. */ ++ size_t j; /* Index into current window of HAYSTACK. */ ++ size_t period; /* The period of the right half of needle. */ ++ size_t suffix; /* The index of the right half of needle. */ ++ size_t shift_table[1U << CHAR_BIT]; /* See below. */ ++ ++ /* Factor the needle into two halves, such that the left half is ++ smaller than the global period, and the right half is ++ periodic (with a period as large as NEEDLE_LEN - suffix). */ ++ suffix = critical_factorization (needle, needle_len, &period); ++ ++ /* Populate shift_table. For each possible byte value c, ++ shift_table[c] is the distance from the last occurrence of c to ++ the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE. ++ shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */ ++ for (i = 0; i < 1U << CHAR_BIT; i++) ++ shift_table[i] = needle_len; ++ for (i = 0; i < needle_len; i++) ++ shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1; ++ ++ /* Perform the search. Each iteration compares the right half ++ first. */ ++ if (CMP_FUNC (needle, needle + period, suffix) == 0) ++ { ++ /* Entire needle is periodic; a mismatch in the left half can ++ only advance by the period, so use memory to avoid rescanning ++ known occurrences of the period in the right half. */ ++ size_t memory = 0; ++ size_t shift; ++ j = 0; ++ while (AVAILABLE (haystack, haystack_len, j, needle_len)) ++ { ++ /* Check the last byte first; if it does not match, then ++ shift to the next possible match location. */ ++ shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])]; ++ if (0 < shift) ++ { ++ if (memory && shift < period) ++ { ++ /* Since needle is periodic, but the last period has ++ a byte out of place, there can be no match until ++ after the mismatch. */ ++ shift = needle_len - period; ++ } ++ memory = 0; ++ j += shift; ++ continue; ++ } ++ /* Scan for matches in right half. The last byte has ++ already been matched, by virtue of the shift table. */ ++ i = MAX (suffix, memory); ++ while (i < needle_len - 1 && (CANON_ELEMENT (needle[i]) ++ == CANON_ELEMENT (haystack[i + j]))) ++ ++i; ++ if (needle_len - 1 <= i) ++ { ++ /* Scan for matches in left half. */ ++ i = suffix - 1; ++ while (memory < i + 1 && (CANON_ELEMENT (needle[i]) ++ == CANON_ELEMENT (haystack[i + j]))) ++ --i; ++ if (i + 1 < memory + 1) ++ return (RETURN_TYPE) (haystack + j); ++ /* No match, so remember how many repetitions of period ++ on the right half were scanned. */ ++ j += period; ++ memory = needle_len - period; ++ } ++ else ++ { ++ j += i - suffix + 1; ++ memory = 0; ++ } ++ } ++ } ++ else ++ { ++ /* The two halves of needle are distinct; no extra memory is ++ required, and any mismatch results in a maximal shift. */ ++ size_t shift; ++ period = MAX (suffix, needle_len - suffix) + 1; ++ j = 0; ++ while (AVAILABLE (haystack, haystack_len, j, needle_len)) ++ { ++ /* Check the last byte first; if it does not match, then ++ shift to the next possible match location. */ ++ shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])]; ++ if (0 < shift) ++ { ++ j += shift; ++ continue; ++ } ++ /* Scan for matches in right half. The last byte has ++ already been matched, by virtue of the shift table. */ ++ i = suffix; ++ while (i < needle_len - 1 && (CANON_ELEMENT (needle[i]) ++ == CANON_ELEMENT (haystack[i + j]))) ++ ++i; ++ if (needle_len - 1 <= i) ++ { ++ /* Scan for matches in left half. */ ++ i = suffix - 1; ++ while (i != SIZE_MAX && (CANON_ELEMENT (needle[i]) ++ == CANON_ELEMENT (haystack[i + j]))) ++ --i; ++ if (i == SIZE_MAX) ++ return (RETURN_TYPE) (haystack + j); ++ j += period; ++ } ++ else ++ j += i - suffix + 1; ++ } ++ } ++ return NULL; ++} ++ ++#undef AVAILABLE ++#undef CANON_ELEMENT ++#undef CMP_FUNC ++#undef MAX ++#undef RETURN_TYPE +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strcasecmp.c b/xbmc/screensavers/rsxs-0.9/lib/strcasecmp.c +index c1bac0a..9a77bb5 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/strcasecmp.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/strcasecmp.c +@@ -1,11 +1,9 @@ + /* Case-insensitive string comparison function. +- Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc. +- Written by Bruno Haible , 2005, +- based on earlier glibc code. ++ Copyright (C) 1998-1999, 2005-2007, 2009-2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -17,89 +15,49 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif ++#include + + /* Specification. */ +-#include "strcase.h" ++#include + + #include + #include + +-#if HAVE_MBRTOWC +-# include "mbuiter.h" +-#endif +- + #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) + + /* Compare strings S1 and S2, ignoring case, returning less than, equal to or + greater than zero if S1 is lexicographically less than, equal to or greater + than S2. +- Note: This function may, in multibyte locales, return 0 for strings of +- different lengths! */ ++ Note: This function does not work with multibyte strings! */ ++ + int + strcasecmp (const char *s1, const char *s2) + { +- if (s1 == s2) ++ const unsigned char *p1 = (const unsigned char *) s1; ++ const unsigned char *p2 = (const unsigned char *) s2; ++ unsigned char c1, c2; ++ ++ if (p1 == p2) + return 0; + +- /* Be careful not to look at the entire extent of s1 or s2 until needed. +- This is useful because when two strings differ, the difference is +- most often already in the very few first characters. */ +-#if HAVE_MBRTOWC +- if (MB_CUR_MAX > 1) ++ do + { +- mbui_iterator_t iter1; +- mbui_iterator_t iter2; ++ c1 = TOLOWER (*p1); ++ c2 = TOLOWER (*p2); + +- mbui_init (iter1, s1); +- mbui_init (iter2, s2); ++ if (c1 == '\0') ++ break; + +- while (mbui_avail (iter1) && mbui_avail (iter2)) +- { +- int cmp = mb_casecmp (mbui_cur (iter1), mbui_cur (iter2)); +- +- if (cmp != 0) +- return cmp; +- +- mbui_advance (iter1); +- mbui_advance (iter2); +- } +- if (mbui_avail (iter1)) +- /* s2 terminated before s1. */ +- return 1; +- if (mbui_avail (iter2)) +- /* s1 terminated before s2. */ +- return -1; +- return 0; ++ ++p1; ++ ++p2; + } +- else +-#endif +- { +- const unsigned char *p1 = (const unsigned char *) s1; +- const unsigned char *p2 = (const unsigned char *) s2; +- unsigned char c1, c2; +- +- do +- { +- c1 = TOLOWER (*p1); +- c2 = TOLOWER (*p2); +- +- if (c1 == '\0') +- break; ++ while (c1 == c2); + +- ++p1; +- ++p2; +- } +- while (c1 == c2); +- +- if (UCHAR_MAX <= INT_MAX) +- return c1 - c2; +- else +- /* On machines where 'char' and 'int' are types of the same size, the +- difference of two 'unsigned char' values - including the sign bit - +- doesn't fit in an 'int'. */ +- return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); +- } ++ if (UCHAR_MAX <= INT_MAX) ++ return c1 - c2; ++ else ++ /* On machines where 'char' and 'int' are types of the same size, the ++ difference of two 'unsigned char' values - including the sign bit - ++ doesn't fit in an 'int'. */ ++ return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); + } +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strchrnul.c b/xbmc/screensavers/rsxs-0.9/lib/strchrnul.c +index 8d17f15..61db4e8 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/strchrnul.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/strchrnul.c +@@ -1,10 +1,10 @@ + /* Searching in a string. +- Copyright (C) 2003 Free Software Foundation, Inc. ++ Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc. + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +@@ -12,19 +12,131 @@ + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License +- along with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ along with this program. If not, see . */ ++ ++#include + + /* Specification. */ +-#include "strchrnul.h" ++#include + + /* Find the first occurrence of C in S or the final NUL byte. */ + char * + strchrnul (const char *s, int c_in) + { +- char c = c_in; +- while (*s && (*s != c)) +- s++; ++ /* On 32-bit hardware, choosing longword to be a 32-bit unsigned ++ long instead of a 64-bit uintmax_t tends to give better ++ performance. On 64-bit hardware, unsigned long is generally 64 ++ bits already. Change this typedef to experiment with ++ performance. */ ++ typedef unsigned long int longword; ++ ++ const unsigned char *char_ptr; ++ const longword *longword_ptr; ++ longword repeated_one; ++ longword repeated_c; ++ unsigned char c; ++ ++ c = (unsigned char) c_in; ++ if (!c) ++ return rawmemchr (s, 0); ++ ++ /* Handle the first few bytes by reading one byte at a time. ++ Do this until CHAR_PTR is aligned on a longword boundary. */ ++ for (char_ptr = (const unsigned char *) s; ++ (size_t) char_ptr % sizeof (longword) != 0; ++ ++char_ptr) ++ if (!*char_ptr || *char_ptr == c) ++ return (char *) char_ptr; ++ ++ longword_ptr = (const longword *) char_ptr; ++ ++ /* All these elucidatory comments refer to 4-byte longwords, ++ but the theory applies equally well to any size longwords. */ ++ ++ /* Compute auxiliary longword values: ++ repeated_one is a value which has a 1 in every byte. ++ repeated_c has c in every byte. */ ++ repeated_one = 0x01010101; ++ repeated_c = c | (c << 8); ++ repeated_c |= repeated_c << 16; ++ if (0xffffffffU < (longword) -1) ++ { ++ repeated_one |= repeated_one << 31 << 1; ++ repeated_c |= repeated_c << 31 << 1; ++ if (8 < sizeof (longword)) ++ { ++ size_t i; ++ ++ for (i = 64; i < sizeof (longword) * 8; i *= 2) ++ { ++ repeated_one |= repeated_one << i; ++ repeated_c |= repeated_c << i; ++ } ++ } ++ } ++ ++ /* Instead of the traditional loop which tests each byte, we will ++ test a longword at a time. The tricky part is testing if *any of ++ the four* bytes in the longword in question are equal to NUL or ++ c. We first use an xor with repeated_c. This reduces the task ++ to testing whether *any of the four* bytes in longword1 or ++ longword2 is zero. ++ ++ Let's consider longword1. We compute tmp = ++ ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). ++ That is, we perform the following operations: ++ 1. Subtract repeated_one. ++ 2. & ~longword1. ++ 3. & a mask consisting of 0x80 in every byte. ++ Consider what happens in each byte: ++ - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, ++ and step 3 transforms it into 0x80. A carry can also be propagated ++ to more significant bytes. ++ - If a byte of longword1 is nonzero, let its lowest 1 bit be at ++ position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, ++ the byte ends in a single bit of value 0 and k bits of value 1. ++ After step 2, the result is just k bits of value 1: 2^k - 1. After ++ step 3, the result is 0. And no carry is produced. ++ So, if longword1 has only non-zero bytes, tmp is zero. ++ Whereas if longword1 has a zero byte, call j the position of the least ++ significant zero byte. Then the result has a zero at positions 0, ..., ++ j-1 and a 0x80 at position j. We cannot predict the result at the more ++ significant bytes (positions j+1..3), but it does not matter since we ++ already have a non-zero bit at position 8*j+7. ++ ++ The test whether any byte in longword1 or longword2 is zero is equivalent ++ to testing whether tmp1 is nonzero or tmp2 is nonzero. We can combine ++ this into a single test, whether (tmp1 | tmp2) is nonzero. ++ ++ This test can read more than one byte beyond the end of a string, ++ depending on where the terminating NUL is encountered. However, ++ this is considered safe since the initialization phase ensured ++ that the read will be aligned, therefore, the read will not cross ++ page boundaries and will not cause a fault. */ ++ ++ while (1) ++ { ++ longword longword1 = *longword_ptr ^ repeated_c; ++ longword longword2 = *longword_ptr; ++ ++ if (((((longword1 - repeated_one) & ~longword1) ++ | ((longword2 - repeated_one) & ~longword2)) ++ & (repeated_one << 7)) != 0) ++ break; ++ longword_ptr++; ++ } ++ ++ char_ptr = (const unsigned char *) longword_ptr; ++ ++ /* At this point, we know that one of the sizeof (longword) bytes ++ starting at char_ptr is == 0 or == c. On little-endian machines, ++ we could determine the first such byte without any further memory ++ accesses, just by looking at the tmp result from the last loop ++ iteration. But this does not work on big-endian machines. ++ Choose code that works in both cases. */ + +- return (char *) s; ++ char_ptr = (unsigned char *) longword_ptr; ++ while (*char_ptr && (*char_ptr != c)) ++ char_ptr++; ++ return (char *) char_ptr; + } +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strchrnul.valgrind b/xbmc/screensavers/rsxs-0.9/lib/strchrnul.valgrind +new file mode 100644 +index 0000000..b14fa13 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/strchrnul.valgrind +@@ -0,0 +1,12 @@ ++# Suppress a valgrind message about use of uninitialized memory in strchrnul(). ++# This use is OK because it provides only a speedup. ++{ ++ strchrnul-value4 ++ Memcheck:Value4 ++ fun:strchrnul ++} ++{ ++ strchrnul-value8 ++ Memcheck:Value8 ++ fun:strchrnul ++} +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strerror-override.c b/xbmc/screensavers/rsxs-0.9/lib/strerror-override.c +new file mode 100644 +index 0000000..4e2c32b +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/strerror-override.c +@@ -0,0 +1,289 @@ ++/* strerror-override.c --- POSIX compatible system error routine ++ ++ Copyright (C) 2010-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2010. */ ++ ++#include ++ ++#include "strerror-override.h" ++ ++#include ++ ++#if GNULIB_defined_EWINSOCK /* native Windows platforms */ ++# if HAVE_WINSOCK2_H ++# include ++# endif ++#endif ++ ++/* If ERRNUM maps to an errno value defined by gnulib, return a string ++ describing the error. Otherwise return NULL. */ ++const char * ++strerror_override (int errnum) ++{ ++ /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ ++ switch (errnum) ++ { ++#if REPLACE_STRERROR_0 ++ case 0: ++ return "Success"; ++#endif ++ ++#if GNULIB_defined_ESOCK /* native Windows platforms with older */ ++ case EINPROGRESS: ++ return "Operation now in progress"; ++ case EALREADY: ++ return "Operation already in progress"; ++ case ENOTSOCK: ++ return "Socket operation on non-socket"; ++ case EDESTADDRREQ: ++ return "Destination address required"; ++ case EMSGSIZE: ++ return "Message too long"; ++ case EPROTOTYPE: ++ return "Protocol wrong type for socket"; ++ case ENOPROTOOPT: ++ return "Protocol not available"; ++ case EPROTONOSUPPORT: ++ return "Protocol not supported"; ++ case EOPNOTSUPP: ++ return "Operation not supported"; ++ case EAFNOSUPPORT: ++ return "Address family not supported by protocol"; ++ case EADDRINUSE: ++ return "Address already in use"; ++ case EADDRNOTAVAIL: ++ return "Cannot assign requested address"; ++ case ENETDOWN: ++ return "Network is down"; ++ case ENETUNREACH: ++ return "Network is unreachable"; ++ case ECONNRESET: ++ return "Connection reset by peer"; ++ case ENOBUFS: ++ return "No buffer space available"; ++ case EISCONN: ++ return "Transport endpoint is already connected"; ++ case ENOTCONN: ++ return "Transport endpoint is not connected"; ++ case ETIMEDOUT: ++ return "Connection timed out"; ++ case ECONNREFUSED: ++ return "Connection refused"; ++ case ELOOP: ++ return "Too many levels of symbolic links"; ++ case EHOSTUNREACH: ++ return "No route to host"; ++ case EWOULDBLOCK: ++ return "Operation would block"; ++ case ETXTBSY: ++ return "Text file busy"; ++ case ENODATA: ++ return "No data available"; ++ case ENOSR: ++ return "Out of streams resources"; ++ case ENOSTR: ++ return "Device not a stream"; ++ case ENOTRECOVERABLE: ++ return "State not recoverable"; ++ case EOWNERDEAD: ++ return "Owner died"; ++ case ETIME: ++ return "Timer expired"; ++ case EOTHER: ++ return "Other error"; ++#endif ++#if GNULIB_defined_EWINSOCK /* native Windows platforms */ ++ case ESOCKTNOSUPPORT: ++ return "Socket type not supported"; ++ case EPFNOSUPPORT: ++ return "Protocol family not supported"; ++ case ESHUTDOWN: ++ return "Cannot send after transport endpoint shutdown"; ++ case ETOOMANYREFS: ++ return "Too many references: cannot splice"; ++ case EHOSTDOWN: ++ return "Host is down"; ++ case EPROCLIM: ++ return "Too many processes"; ++ case EUSERS: ++ return "Too many users"; ++ case EDQUOT: ++ return "Disk quota exceeded"; ++ case ESTALE: ++ return "Stale NFS file handle"; ++ case EREMOTE: ++ return "Object is remote"; ++# if HAVE_WINSOCK2_H ++ /* WSA_INVALID_HANDLE maps to EBADF */ ++ /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ ++ /* WSA_INVALID_PARAMETER maps to EINVAL */ ++ case WSA_OPERATION_ABORTED: ++ return "Overlapped operation aborted"; ++ case WSA_IO_INCOMPLETE: ++ return "Overlapped I/O event object not in signaled state"; ++ case WSA_IO_PENDING: ++ return "Overlapped operations will complete later"; ++ /* WSAEINTR maps to EINTR */ ++ /* WSAEBADF maps to EBADF */ ++ /* WSAEACCES maps to EACCES */ ++ /* WSAEFAULT maps to EFAULT */ ++ /* WSAEINVAL maps to EINVAL */ ++ /* WSAEMFILE maps to EMFILE */ ++ /* WSAEWOULDBLOCK maps to EWOULDBLOCK */ ++ /* WSAEINPROGRESS maps to EINPROGRESS */ ++ /* WSAEALREADY maps to EALREADY */ ++ /* WSAENOTSOCK maps to ENOTSOCK */ ++ /* WSAEDESTADDRREQ maps to EDESTADDRREQ */ ++ /* WSAEMSGSIZE maps to EMSGSIZE */ ++ /* WSAEPROTOTYPE maps to EPROTOTYPE */ ++ /* WSAENOPROTOOPT maps to ENOPROTOOPT */ ++ /* WSAEPROTONOSUPPORT maps to EPROTONOSUPPORT */ ++ /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */ ++ /* WSAEOPNOTSUPP maps to EOPNOTSUPP */ ++ /* WSAEPFNOSUPPORT is EPFNOSUPPORT */ ++ /* WSAEAFNOSUPPORT maps to EAFNOSUPPORT */ ++ /* WSAEADDRINUSE maps to EADDRINUSE */ ++ /* WSAEADDRNOTAVAIL maps to EADDRNOTAVAIL */ ++ /* WSAENETDOWN maps to ENETDOWN */ ++ /* WSAENETUNREACH maps to ENETUNREACH */ ++ /* WSAENETRESET maps to ENETRESET */ ++ /* WSAECONNABORTED maps to ECONNABORTED */ ++ /* WSAECONNRESET maps to ECONNRESET */ ++ /* WSAENOBUFS maps to ENOBUFS */ ++ /* WSAEISCONN maps to EISCONN */ ++ /* WSAENOTCONN maps to ENOTCONN */ ++ /* WSAESHUTDOWN is ESHUTDOWN */ ++ /* WSAETOOMANYREFS is ETOOMANYREFS */ ++ /* WSAETIMEDOUT maps to ETIMEDOUT */ ++ /* WSAECONNREFUSED maps to ECONNREFUSED */ ++ /* WSAELOOP maps to ELOOP */ ++ /* WSAENAMETOOLONG maps to ENAMETOOLONG */ ++ /* WSAEHOSTDOWN is EHOSTDOWN */ ++ /* WSAEHOSTUNREACH maps to EHOSTUNREACH */ ++ /* WSAENOTEMPTY maps to ENOTEMPTY */ ++ /* WSAEPROCLIM is EPROCLIM */ ++ /* WSAEUSERS is EUSERS */ ++ /* WSAEDQUOT is EDQUOT */ ++ /* WSAESTALE is ESTALE */ ++ /* WSAEREMOTE is EREMOTE */ ++ case WSASYSNOTREADY: ++ return "Network subsystem is unavailable"; ++ case WSAVERNOTSUPPORTED: ++ return "Winsock.dll version out of range"; ++ case WSANOTINITIALISED: ++ return "Successful WSAStartup not yet performed"; ++ case WSAEDISCON: ++ return "Graceful shutdown in progress"; ++ case WSAENOMORE: case WSA_E_NO_MORE: ++ return "No more results"; ++ case WSAECANCELLED: case WSA_E_CANCELLED: ++ return "Call was canceled"; ++ case WSAEINVALIDPROCTABLE: ++ return "Procedure call table is invalid"; ++ case WSAEINVALIDPROVIDER: ++ return "Service provider is invalid"; ++ case WSAEPROVIDERFAILEDINIT: ++ return "Service provider failed to initialize"; ++ case WSASYSCALLFAILURE: ++ return "System call failure"; ++ case WSASERVICE_NOT_FOUND: ++ return "Service not found"; ++ case WSATYPE_NOT_FOUND: ++ return "Class type not found"; ++ case WSAEREFUSED: ++ return "Database query was refused"; ++ case WSAHOST_NOT_FOUND: ++ return "Host not found"; ++ case WSATRY_AGAIN: ++ return "Nonauthoritative host not found"; ++ case WSANO_RECOVERY: ++ return "Nonrecoverable error"; ++ case WSANO_DATA: ++ return "Valid name, no data record of requested type"; ++ /* WSA_QOS_* omitted */ ++# endif ++#endif ++ ++#if GNULIB_defined_ENOMSG ++ case ENOMSG: ++ return "No message of desired type"; ++#endif ++ ++#if GNULIB_defined_EIDRM ++ case EIDRM: ++ return "Identifier removed"; ++#endif ++ ++#if GNULIB_defined_ENOLINK ++ case ENOLINK: ++ return "Link has been severed"; ++#endif ++ ++#if GNULIB_defined_EPROTO ++ case EPROTO: ++ return "Protocol error"; ++#endif ++ ++#if GNULIB_defined_EMULTIHOP ++ case EMULTIHOP: ++ return "Multihop attempted"; ++#endif ++ ++#if GNULIB_defined_EBADMSG ++ case EBADMSG: ++ return "Bad message"; ++#endif ++ ++#if GNULIB_defined_EOVERFLOW ++ case EOVERFLOW: ++ return "Value too large for defined data type"; ++#endif ++ ++#if GNULIB_defined_ENOTSUP ++ case ENOTSUP: ++ return "Not supported"; ++#endif ++ ++#if GNULIB_defined_ENETRESET ++ case ENETRESET: ++ return "Network dropped connection on reset"; ++#endif ++ ++#if GNULIB_defined_ECONNABORTED ++ case ECONNABORTED: ++ return "Software caused connection abort"; ++#endif ++ ++#if GNULIB_defined_ESTALE ++ case ESTALE: ++ return "Stale NFS file handle"; ++#endif ++ ++#if GNULIB_defined_EDQUOT ++ case EDQUOT: ++ return "Disk quota exceeded"; ++#endif ++ ++#if GNULIB_defined_ECANCELED ++ case ECANCELED: ++ return "Operation canceled"; ++#endif ++ ++ default: ++ return NULL; ++ } ++} +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strerror-override.h b/xbmc/screensavers/rsxs-0.9/lib/strerror-override.h +new file mode 100644 +index 0000000..09540b9 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/strerror-override.h +@@ -0,0 +1,52 @@ ++/* strerror-override.h --- POSIX compatible system error routine ++ ++ Copyright (C) 2010-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#ifndef _GL_STRERROR_OVERRIDE_H ++# define _GL_STRERROR_OVERRIDE_H ++ ++# include ++# include ++ ++/* Reasonable buffer size that should never trigger ERANGE; if this ++ proves too small, we intentionally abort(), to remind us to fix ++ this value. */ ++# define STACKBUF_LEN 256 ++ ++/* If ERRNUM maps to an errno value defined by gnulib, return a string ++ describing the error. Otherwise return NULL. */ ++# if REPLACE_STRERROR_0 \ ++ || GNULIB_defined_ESOCK \ ++ || GNULIB_defined_EWINSOCK \ ++ || GNULIB_defined_ENOMSG \ ++ || GNULIB_defined_EIDRM \ ++ || GNULIB_defined_ENOLINK \ ++ || GNULIB_defined_EPROTO \ ++ || GNULIB_defined_EMULTIHOP \ ++ || GNULIB_defined_EBADMSG \ ++ || GNULIB_defined_EOVERFLOW \ ++ || GNULIB_defined_ENOTSUP \ ++ || GNULIB_defined_ENETRESET \ ++ || GNULIB_defined_ECONNABORTED \ ++ || GNULIB_defined_ESTALE \ ++ || GNULIB_defined_EDQUOT \ ++ || GNULIB_defined_ECANCELED ++extern const char *strerror_override (int errnum); ++# else ++# define strerror_override(ignored) NULL ++# endif ++ ++#endif /* _GL_STRERROR_OVERRIDE_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strerror.c b/xbmc/screensavers/rsxs-0.9/lib/strerror.c +new file mode 100644 +index 0000000..63899ca +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/strerror.c +@@ -0,0 +1,70 @@ ++/* strerror.c --- POSIX compatible system error routine ++ ++ Copyright (C) 2007-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++/* Specification. */ ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include "intprops.h" ++#include "strerror-override.h" ++#include "verify.h" ++ ++/* Use the system functions, not the gnulib overrides in this file. */ ++#undef sprintf ++ ++char * ++strerror (int n) ++#undef strerror ++{ ++ static char buf[STACKBUF_LEN]; ++ size_t len; ++ ++ /* Cast away const, due to the historical signature of strerror; ++ callers should not be modifying the string. */ ++ const char *msg = strerror_override (n); ++ if (msg) ++ return (char *) msg; ++ ++ msg = strerror (n); ++ ++ /* Our strerror_r implementation might use the system's strerror ++ buffer, so all other clients of strerror have to see the error ++ copied into a buffer that we manage. This is not thread-safe, ++ even if the system strerror is, but portable programs shouldn't ++ be using strerror if they care about thread-safety. */ ++ if (!msg || !*msg) ++ { ++ static char const fmt[] = "Unknown error %d"; ++ verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n)); ++ sprintf (buf, fmt, n); ++ errno = EINVAL; ++ return buf; ++ } ++ ++ /* Fix STACKBUF_LEN if this ever aborts. */ ++ len = strlen (msg); ++ if (sizeof buf <= len) ++ abort (); ++ ++ return memcpy (buf, msg, len + 1); ++} +diff --git a/xbmc/screensavers/rsxs-0.9/lib/string.h b/xbmc/screensavers/rsxs-0.9/lib/string.h +new file mode 100644 +index 0000000..930f796 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/string.h +@@ -0,0 +1,1323 @@ ++/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ ++/* A GNU-like . ++ ++ Copyright (C) 1995-1996, 2001-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _GL_STRING_H ++ ++#if __GNUC__ >= 3 ++#pragma GCC system_header ++#endif ++ ++ ++/* The include_next requires a split double-inclusion guard. */ ++#include_next ++ ++#ifndef _GL_STRING_H ++#define _GL_STRING_H ++ ++/* NetBSD 5.0 mis-defines NULL. */ ++#include ++ ++/* MirBSD defines mbslen as a macro. */ ++#if 0 && defined __MirBSD__ ++# include ++#endif ++ ++/* The __attribute__ feature is available in gcc versions 2.5 and later. ++ The attribute __pure__ was added in gcc 2.96. */ ++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) ++# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) ++#else ++# define _GL_ATTRIBUTE_PURE /* empty */ ++#endif ++ ++/* NetBSD 5.0 declares strsignal in , not in . */ ++/* But in any case avoid namespace pollution on glibc systems. */ ++#if (0 || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ ++ && ! defined __GLIBC__ ++# include ++#endif ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++#ifndef _GL_CXXDEFS_H ++#define _GL_CXXDEFS_H ++ ++/* The three most frequent use cases of these macros are: ++ ++ * For providing a substitute for a function that is missing on some ++ platforms, but is declared and works fine on the platforms on which ++ it exists: ++ ++ #if @GNULIB_FOO@ ++ # if !@HAVE_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on all platforms, ++ but is broken/insufficient and needs to be replaced on some platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on some platforms ++ but is broken/insufficient and needs to be replaced on some of them and ++ is additionally either missing or undeclared on some other platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++*/ ++ ++/* _GL_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#if defined __cplusplus ++# define _GL_EXTERN_C extern "C" ++#else ++# define _GL_EXTERN_C extern ++#endif ++ ++/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); ++ declares a replacement function, named rpl_func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ ++ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) ++#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype rpl_func parameters_and_attributes ++ ++/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); ++ declares the system function, named func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype func parameters_and_attributes ++ ++/* _GL_CXXALIAS_RPL (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. ++ Example: ++ _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); ++ */ ++#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ ++ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = ::rpl_func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); ++ is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); ++ except that the C function rpl_func may have a slightly different ++ declaration. A cast is used to silence the "invalid conversion" error ++ that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = \ ++ reinterpret_cast(::rpl_func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to the system provided function func, if GNULIB_NAMESPACE ++ is defined. ++ Example: ++ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); ++ */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* If we were to write ++ rettype (*const func) parameters = ::func; ++ like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls ++ better (remove an indirection through a 'static' pointer variable), ++ but then the _GL_CXXALIASWARN macro below would cause a warning not only ++ for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = ::func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function func may have a slightly different declaration. ++ A cast is used to silence the "invalid conversion" error that would ++ otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast(::func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function is picked among a set of overloaded functions, ++ namely the one with rettype2 and parameters2. Two consecutive casts ++ are used to silence the "cannot find a match" and "invalid conversion" ++ errors that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* The outer cast must be a reinterpret_cast. ++ The inner cast: When the function is defined as a set of overloaded ++ functions, it works as a static_cast<>, choosing the designated variant. ++ When the function is defined as a single variant, it works as a ++ reinterpret_cast<>. The parenthesized cast syntax works both ways. */ ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast( \ ++ (rettype2(*)parameters2)(::func)); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN (func); ++ causes a warning to be emitted when ::func is used but not when ++ GNULIB_NAMESPACE::func is used. func must be defined without overloaded ++ variants. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN(func) \ ++ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN_1(func,namespace) \ ++ _GL_CXXALIASWARN_2 (func, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_WARN_ON_USE (func, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN(func) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); ++ causes a warning to be emitted when the given overloaded variant of ::func ++ is used but not when GNULIB_NAMESPACE::func is used. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ ++ GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++#endif /* _GL_CXXDEFS_H */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools ++ that the values passed as arguments n, ..., m must be non-NULL pointers. ++ n = 1 stands for the first argument, n = 2 for the second argument etc. */ ++#ifndef _GL_ARG_NONNULL ++# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 ++# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) ++# else ++# define _GL_ARG_NONNULL(params) ++# endif ++#endif ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++#ifndef _GL_WARN_ON_USE ++ ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++/* A compiler attribute is available in gcc versions 4.3.0 and later. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function __attribute__ ((__warning__ (message))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE(function, message) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") ++ is like _GL_WARN_ON_USE (function, "string"), except that the function is ++ declared with the given prototype, consisting of return type, parameters, ++ and attributes. ++ This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does ++ not work in this case. */ ++#ifndef _GL_WARN_ON_USE_CXX ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes \ ++ __attribute__ ((__warning__ (msg))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#ifndef _GL_WARN_EXTERN_C ++# if defined __cplusplus ++# define _GL_WARN_EXTERN_C extern "C" ++# else ++# define _GL_WARN_EXTERN_C extern ++# endif ++#endif ++ ++ ++/* Find the index of the least-significant set bit. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (ffsl, int, (long int i)); ++# endif ++_GL_CXXALIAS_SYS (ffsl, int, (long int i)); ++_GL_CXXALIASWARN (ffsl); ++#elif defined GNULIB_POSIXCHECK ++# undef ffsl ++# if HAVE_RAW_DECL_FFSL ++_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); ++# endif ++#endif ++ ++ ++/* Find the index of the least-significant set bit. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (ffsll, int, (long long int i)); ++# endif ++_GL_CXXALIAS_SYS (ffsll, int, (long long int i)); ++_GL_CXXALIASWARN (ffsll); ++#elif defined GNULIB_POSIXCHECK ++# undef ffsll ++# if HAVE_RAW_DECL_FFSLL ++_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); ++# endif ++#endif ++ ++ ++/* Return the first instance of C within N bytes of S, or NULL. */ ++#if 1 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define memchr rpl_memchr ++# endif ++_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); ++# else ++# if ! 1 ++_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C" { const void * std::memchr (const void *, int, size_t); } ++ extern "C++" { void * std::memchr (void *, int, size_t); } */ ++_GL_CXXALIAS_SYS_CAST2 (memchr, ++ void *, (void const *__s, int __c, size_t __n), ++ void const *, (void const *__s, int __c, size_t __n)); ++# endif ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); ++_GL_CXXALIASWARN1 (memchr, void const *, ++ (void const *__s, int __c, size_t __n)); ++# else ++_GL_CXXALIASWARN (memchr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef memchr ++/* Assume memchr is always declared. */ ++_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " ++ "use gnulib module memchr for portability" ); ++#endif ++ ++/* Return the first occurrence of NEEDLE in HAYSTACK. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define memmem rpl_memmem ++# endif ++_GL_FUNCDECL_RPL (memmem, void *, ++ (void const *__haystack, size_t __haystack_len, ++ void const *__needle, size_t __needle_len) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 3))); ++_GL_CXXALIAS_RPL (memmem, void *, ++ (void const *__haystack, size_t __haystack_len, ++ void const *__needle, size_t __needle_len)); ++# else ++# if ! 1 ++_GL_FUNCDECL_SYS (memmem, void *, ++ (void const *__haystack, size_t __haystack_len, ++ void const *__needle, size_t __needle_len) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 3))); ++# endif ++_GL_CXXALIAS_SYS (memmem, void *, ++ (void const *__haystack, size_t __haystack_len, ++ void const *__needle, size_t __needle_len)); ++# endif ++_GL_CXXALIASWARN (memmem); ++#elif defined GNULIB_POSIXCHECK ++# undef memmem ++# if HAVE_RAW_DECL_MEMMEM ++_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " ++ "use gnulib module memmem-simple for portability, " ++ "and module memmem for speed" ); ++# endif ++#endif ++ ++/* Copy N bytes of SRC to DEST, return pointer to bytes after the ++ last written byte. */ ++#if 1 ++# if ! 1 ++_GL_FUNCDECL_SYS (mempcpy, void *, ++ (void *restrict __dest, void const *restrict __src, ++ size_t __n) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (mempcpy, void *, ++ (void *restrict __dest, void const *restrict __src, ++ size_t __n)); ++_GL_CXXALIASWARN (mempcpy); ++#elif defined GNULIB_POSIXCHECK ++# undef mempcpy ++# if HAVE_RAW_DECL_MEMPCPY ++_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " ++ "use gnulib module mempcpy for portability"); ++# endif ++#endif ++ ++/* Search backwards through a block for a byte (specified as an int). */ ++#if 0 ++# if ! 1 ++_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { const void * std::memrchr (const void *, int, size_t); } ++ extern "C++" { void * std::memrchr (void *, int, size_t); } */ ++_GL_CXXALIAS_SYS_CAST2 (memrchr, ++ void *, (void const *, int, size_t), ++ void const *, (void const *, int, size_t)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); ++_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); ++# else ++_GL_CXXALIASWARN (memrchr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef memrchr ++# if HAVE_RAW_DECL_MEMRCHR ++_GL_WARN_ON_USE (memrchr, "memrchr is unportable - " ++ "use gnulib module memrchr for portability"); ++# endif ++#endif ++ ++/* Find the first occurrence of C in S. More efficient than ++ memchr(S,C,N), at the expense of undefined behavior if C does not ++ occur within N bytes. */ ++#if 1 ++# if ! 1 ++_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { const void * std::rawmemchr (const void *, int); } ++ extern "C++" { void * std::rawmemchr (void *, int); } */ ++_GL_CXXALIAS_SYS_CAST2 (rawmemchr, ++ void *, (void const *__s, int __c_in), ++ void const *, (void const *__s, int __c_in)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); ++_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); ++# else ++_GL_CXXALIASWARN (rawmemchr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef rawmemchr ++# if HAVE_RAW_DECL_RAWMEMCHR ++_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " ++ "use gnulib module rawmemchr for portability"); ++# endif ++#endif ++ ++/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ ++#if 1 ++# if ! 1 ++_GL_FUNCDECL_SYS (stpcpy, char *, ++ (char *restrict __dst, char const *restrict __src) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (stpcpy, char *, ++ (char *restrict __dst, char const *restrict __src)); ++_GL_CXXALIASWARN (stpcpy); ++#elif defined GNULIB_POSIXCHECK ++# undef stpcpy ++# if HAVE_RAW_DECL_STPCPY ++_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " ++ "use gnulib module stpcpy for portability"); ++# endif ++#endif ++ ++/* Copy no more than N bytes of SRC to DST, returning a pointer past the ++ last non-NUL byte written into DST. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef stpncpy ++# define stpncpy rpl_stpncpy ++# endif ++_GL_FUNCDECL_RPL (stpncpy, char *, ++ (char *restrict __dst, char const *restrict __src, ++ size_t __n) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (stpncpy, char *, ++ (char *restrict __dst, char const *restrict __src, ++ size_t __n)); ++# else ++# if ! 1 ++_GL_FUNCDECL_SYS (stpncpy, char *, ++ (char *restrict __dst, char const *restrict __src, ++ size_t __n) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (stpncpy, char *, ++ (char *restrict __dst, char const *restrict __src, ++ size_t __n)); ++# endif ++_GL_CXXALIASWARN (stpncpy); ++#elif defined GNULIB_POSIXCHECK ++# undef stpncpy ++# if HAVE_RAW_DECL_STPNCPY ++_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " ++ "use gnulib module stpncpy for portability"); ++# endif ++#endif ++ ++#if defined GNULIB_POSIXCHECK ++/* strchr() does not work with multibyte strings if the locale encoding is ++ GB18030 and the character to be searched is a digit. */ ++# undef strchr ++/* Assume strchr is always declared. */ ++_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings " ++ "in some multibyte locales - " ++ "use mbschr if you care about internationalization"); ++#endif ++ ++/* Find the first occurrence of C in S or the final NUL byte. */ ++#if 1 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define strchrnul rpl_strchrnul ++# endif ++_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (strchrnul, char *, ++ (const char *str, int ch)); ++# else ++# if ! 1 ++_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { const char * std::strchrnul (const char *, int); } ++ extern "C++" { char * std::strchrnul (char *, int); } */ ++_GL_CXXALIAS_SYS_CAST2 (strchrnul, ++ char *, (char const *__s, int __c_in), ++ char const *, (char const *__s, int __c_in)); ++# endif ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); ++_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); ++# else ++_GL_CXXALIASWARN (strchrnul); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef strchrnul ++# if HAVE_RAW_DECL_STRCHRNUL ++_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " ++ "use gnulib module strchrnul for portability"); ++# endif ++#endif ++ ++/* Duplicate S, returning an identical malloc'd string. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strdup ++# define strdup rpl_strdup ++# endif ++_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); ++# else ++# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup ++ /* strdup exists as a function and as a macro. Get rid of the macro. */ ++# undef strdup ++# endif ++# if !(1 || defined strdup) ++_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); ++# endif ++_GL_CXXALIASWARN (strdup); ++#elif defined GNULIB_POSIXCHECK ++# undef strdup ++# if HAVE_RAW_DECL_STRDUP ++_GL_WARN_ON_USE (strdup, "strdup is unportable - " ++ "use gnulib module strdup for portability"); ++# endif ++#endif ++ ++/* Append no more than N characters from SRC onto DEST. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strncat ++# define strncat rpl_strncat ++# endif ++_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n)); ++# else ++_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n)); ++# endif ++_GL_CXXALIASWARN (strncat); ++#elif defined GNULIB_POSIXCHECK ++# undef strncat ++# if HAVE_RAW_DECL_STRNCAT ++_GL_WARN_ON_USE (strncat, "strncat is unportable - " ++ "use gnulib module strncat for portability"); ++# endif ++#endif ++ ++/* Return a newly allocated copy of at most N bytes of STRING. */ ++#if 1 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strndup ++# define strndup rpl_strndup ++# endif ++_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n)); ++# else ++# if ! 1 ++_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n)); ++# endif ++_GL_CXXALIASWARN (strndup); ++#elif defined GNULIB_POSIXCHECK ++# undef strndup ++# if HAVE_RAW_DECL_STRNDUP ++_GL_WARN_ON_USE (strndup, "strndup is unportable - " ++ "use gnulib module strndup for portability"); ++# endif ++#endif ++ ++/* Find the length (number of bytes) of STRING, but scan at most ++ MAXLEN bytes. If no '\0' terminator is found in that many bytes, ++ return MAXLEN. */ ++#if 1 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strnlen ++# define strnlen rpl_strnlen ++# endif ++_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)); ++# else ++# if ! 1 ++_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)); ++# endif ++_GL_CXXALIASWARN (strnlen); ++#elif defined GNULIB_POSIXCHECK ++# undef strnlen ++# if HAVE_RAW_DECL_STRNLEN ++_GL_WARN_ON_USE (strnlen, "strnlen is unportable - " ++ "use gnulib module strnlen for portability"); ++# endif ++#endif ++ ++#if defined GNULIB_POSIXCHECK ++/* strcspn() assumes the second argument is a list of single-byte characters. ++ Even in this simple case, it does not work with multibyte strings if the ++ locale encoding is GB18030 and one of the characters to be searched is a ++ digit. */ ++# undef strcspn ++/* Assume strcspn is always declared. */ ++_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " ++ "in multibyte locales - " ++ "use mbscspn if you care about internationalization"); ++#endif ++ ++/* Find the first occurrence in S of any character in ACCEPT. */ ++#if 0 ++# if ! 1 ++_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C" { const char * strpbrk (const char *, const char *); } ++ extern "C++" { char * strpbrk (char *, const char *); } */ ++_GL_CXXALIAS_SYS_CAST2 (strpbrk, ++ char *, (char const *__s, char const *__accept), ++ const char *, (char const *__s, char const *__accept)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); ++_GL_CXXALIASWARN1 (strpbrk, char const *, ++ (char const *__s, char const *__accept)); ++# else ++_GL_CXXALIASWARN (strpbrk); ++# endif ++# if defined GNULIB_POSIXCHECK ++/* strpbrk() assumes the second argument is a list of single-byte characters. ++ Even in this simple case, it does not work with multibyte strings if the ++ locale encoding is GB18030 and one of the characters to be searched is a ++ digit. */ ++# undef strpbrk ++_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings " ++ "in multibyte locales - " ++ "use mbspbrk if you care about internationalization"); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef strpbrk ++# if HAVE_RAW_DECL_STRPBRK ++_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - " ++ "use gnulib module strpbrk for portability"); ++# endif ++#endif ++ ++#if defined GNULIB_POSIXCHECK ++/* strspn() assumes the second argument is a list of single-byte characters. ++ Even in this simple case, it cannot work with multibyte strings. */ ++# undef strspn ++/* Assume strspn is always declared. */ ++_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " ++ "in multibyte locales - " ++ "use mbsspn if you care about internationalization"); ++#endif ++ ++#if defined GNULIB_POSIXCHECK ++/* strrchr() does not work with multibyte strings if the locale encoding is ++ GB18030 and the character to be searched is a digit. */ ++# undef strrchr ++/* Assume strrchr is always declared. */ ++_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings " ++ "in some multibyte locales - " ++ "use mbsrchr if you care about internationalization"); ++#endif ++ ++/* Search the next delimiter (char listed in DELIM) starting at *STRINGP. ++ If one is found, overwrite it with a NUL, and advance *STRINGP ++ to point to the next char after it. Otherwise, set *STRINGP to NULL. ++ If *STRINGP was already NULL, nothing happens. ++ Return the old value of *STRINGP. ++ ++ This is a variant of strtok() that is multithread-safe and supports ++ empty fields. ++ ++ Caveat: It modifies the original string. ++ Caveat: These functions cannot be used on constant strings. ++ Caveat: The identity of the delimiting character is lost. ++ Caveat: It doesn't work with multibyte strings unless all of the delimiter ++ characters are ASCII characters < 0x30. ++ ++ See also strtok_r(). */ ++#if 0 ++# if ! 1 ++_GL_FUNCDECL_SYS (strsep, char *, ++ (char **restrict __stringp, char const *restrict __delim) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (strsep, char *, ++ (char **restrict __stringp, char const *restrict __delim)); ++_GL_CXXALIASWARN (strsep); ++# if defined GNULIB_POSIXCHECK ++# undef strsep ++_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " ++ "in multibyte locales - " ++ "use mbssep if you care about internationalization"); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef strsep ++# if HAVE_RAW_DECL_STRSEP ++_GL_WARN_ON_USE (strsep, "strsep is unportable - " ++ "use gnulib module strsep for portability"); ++# endif ++#endif ++ ++#if 1 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define strstr rpl_strstr ++# endif ++_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); ++# else ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { const char * strstr (const char *, const char *); } ++ extern "C++" { char * strstr (char *, const char *); } */ ++_GL_CXXALIAS_SYS_CAST2 (strstr, ++ char *, (const char *haystack, const char *needle), ++ const char *, (const char *haystack, const char *needle)); ++# endif ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); ++_GL_CXXALIASWARN1 (strstr, const char *, ++ (const char *haystack, const char *needle)); ++# else ++_GL_CXXALIASWARN (strstr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++/* strstr() does not work with multibyte strings if the locale encoding is ++ different from UTF-8: ++ POSIX says that it operates on "strings", and "string" in POSIX is defined ++ as a sequence of bytes, not of characters. */ ++# undef strstr ++/* Assume strstr is always declared. */ ++_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " ++ "work correctly on character strings in most " ++ "multibyte locales - " ++ "use mbsstr if you care about internationalization, " ++ "or use strstr if you care about speed"); ++#endif ++ ++/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive ++ comparison. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define strcasestr rpl_strcasestr ++# endif ++_GL_FUNCDECL_RPL (strcasestr, char *, ++ (const char *haystack, const char *needle) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (strcasestr, char *, ++ (const char *haystack, const char *needle)); ++# else ++# if ! 1 ++_GL_FUNCDECL_SYS (strcasestr, char *, ++ (const char *haystack, const char *needle) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { const char * strcasestr (const char *, const char *); } ++ extern "C++" { char * strcasestr (char *, const char *); } */ ++_GL_CXXALIAS_SYS_CAST2 (strcasestr, ++ char *, (const char *haystack, const char *needle), ++ const char *, (const char *haystack, const char *needle)); ++# endif ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); ++_GL_CXXALIASWARN1 (strcasestr, const char *, ++ (const char *haystack, const char *needle)); ++# else ++_GL_CXXALIASWARN (strcasestr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++/* strcasestr() does not work with multibyte strings: ++ It is a glibc extension, and glibc implements it only for unibyte ++ locales. */ ++# undef strcasestr ++# if HAVE_RAW_DECL_STRCASESTR ++_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " ++ "strings in multibyte locales - " ++ "use mbscasestr if you care about " ++ "internationalization, or use c-strcasestr if you want " ++ "a locale independent function"); ++# endif ++#endif ++ ++/* Parse S into tokens separated by characters in DELIM. ++ If S is NULL, the saved pointer in SAVE_PTR is used as ++ the next starting point. For example: ++ char s[] = "-abc-=-def"; ++ char *sp; ++ x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" ++ x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL ++ x = strtok_r(NULL, "=", &sp); // x = NULL ++ // s = "abc\0-def\0" ++ ++ This is a variant of strtok() that is multithread-safe. ++ ++ For the POSIX documentation for this function, see: ++ http://www.opengroup.org/susv3xsh/strtok.html ++ ++ Caveat: It modifies the original string. ++ Caveat: These functions cannot be used on constant strings. ++ Caveat: The identity of the delimiting character is lost. ++ Caveat: It doesn't work with multibyte strings unless all of the delimiter ++ characters are ASCII characters < 0x30. ++ ++ See also strsep(). */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strtok_r ++# define strtok_r rpl_strtok_r ++# endif ++_GL_FUNCDECL_RPL (strtok_r, char *, ++ (char *restrict s, char const *restrict delim, ++ char **restrict save_ptr) ++ _GL_ARG_NONNULL ((2, 3))); ++_GL_CXXALIAS_RPL (strtok_r, char *, ++ (char *restrict s, char const *restrict delim, ++ char **restrict save_ptr)); ++# else ++# if 0 || defined GNULIB_POSIXCHECK ++# undef strtok_r ++# endif ++# if ! 1 ++_GL_FUNCDECL_SYS (strtok_r, char *, ++ (char *restrict s, char const *restrict delim, ++ char **restrict save_ptr) ++ _GL_ARG_NONNULL ((2, 3))); ++# endif ++_GL_CXXALIAS_SYS (strtok_r, char *, ++ (char *restrict s, char const *restrict delim, ++ char **restrict save_ptr)); ++# endif ++_GL_CXXALIASWARN (strtok_r); ++# if defined GNULIB_POSIXCHECK ++_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " ++ "strings in multibyte locales - " ++ "use mbstok_r if you care about internationalization"); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef strtok_r ++# if HAVE_RAW_DECL_STRTOK_R ++_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " ++ "use gnulib module strtok_r for portability"); ++# endif ++#endif ++ ++ ++/* The following functions are not specified by POSIX. They are gnulib ++ extensions. */ ++ ++#if 0 ++/* Return the number of multibyte characters in the character string STRING. ++ This considers multibyte characters, unlike strlen, which counts bytes. */ ++# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ ++# undef mbslen ++# endif ++# if 0 /* AIX, OSF/1, MirBSD define mbslen already in libc. */ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define mbslen rpl_mbslen ++# endif ++_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); ++# else ++_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); ++# endif ++_GL_CXXALIASWARN (mbslen); ++#endif ++ ++#if 0 ++/* Return the number of multibyte characters in the character string starting ++ at STRING and ending at STRING + LEN. */ ++_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) ++ _GL_ARG_NONNULL ((1)); ++#endif ++ ++#if 0 ++/* Locate the first single-byte character C in the character string STRING, ++ and return a pointer to it. Return NULL if C is not found in STRING. ++ Unlike strchr(), this function works correctly in multibyte locales with ++ encodings such as GB18030. */ ++# if defined __hpux ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ ++# endif ++_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); ++# else ++_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); ++# endif ++_GL_CXXALIASWARN (mbschr); ++#endif ++ ++#if 0 ++/* Locate the last single-byte character C in the character string STRING, ++ and return a pointer to it. Return NULL if C is not found in STRING. ++ Unlike strrchr(), this function works correctly in multibyte locales with ++ encodings such as GB18030. */ ++# if defined __hpux || defined __INTERIX ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ ++# endif ++_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); ++# else ++_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); ++# endif ++_GL_CXXALIASWARN (mbsrchr); ++#endif ++ ++#if 0 ++/* Find the first occurrence of the character string NEEDLE in the character ++ string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. ++ Unlike strstr(), this function works correctly in multibyte locales with ++ encodings different from UTF-8. */ ++_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if 0 ++/* Compare the character strings S1 and S2, ignoring case, returning less than, ++ equal to or greater than zero if S1 is lexicographically less than, equal to ++ or greater than S2. ++ Note: This function may, in multibyte locales, return 0 for strings of ++ different lengths! ++ Unlike strcasecmp(), this function works correctly in multibyte locales. */ ++_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if 0 ++/* Compare the initial segment of the character string S1 consisting of at most ++ N characters with the initial segment of the character string S2 consisting ++ of at most N characters, ignoring case, returning less than, equal to or ++ greater than zero if the initial segment of S1 is lexicographically less ++ than, equal to or greater than the initial segment of S2. ++ Note: This function may, in multibyte locales, return 0 for initial segments ++ of different lengths! ++ Unlike strncasecmp(), this function works correctly in multibyte locales. ++ But beware that N is not a byte count but a character count! */ ++_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if 0 ++/* Compare the initial segment of the character string STRING consisting of ++ at most mbslen (PREFIX) characters with the character string PREFIX, ++ ignoring case. If the two match, return a pointer to the first byte ++ after this prefix in STRING. Otherwise, return NULL. ++ Note: This function may, in multibyte locales, return non-NULL if STRING ++ is of smaller length than PREFIX! ++ Unlike strncasecmp(), this function works correctly in multibyte ++ locales. */ ++_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if 0 ++/* Find the first occurrence of the character string NEEDLE in the character ++ string HAYSTACK, using case-insensitive comparison. ++ Note: This function may, in multibyte locales, return success even if ++ strlen (haystack) < strlen (needle) ! ++ Unlike strcasestr(), this function works correctly in multibyte locales. */ ++_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if 0 ++/* Find the first occurrence in the character string STRING of any character ++ in the character string ACCEPT. Return the number of bytes from the ++ beginning of the string to this occurrence, or to the end of the string ++ if none exists. ++ Unlike strcspn(), this function works correctly in multibyte locales. */ ++_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if 0 ++/* Find the first occurrence in the character string STRING of any character ++ in the character string ACCEPT. Return the pointer to it, or NULL if none ++ exists. ++ Unlike strpbrk(), this function works correctly in multibyte locales. */ ++# if defined __hpux ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ ++# endif ++_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); ++# else ++_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); ++# endif ++_GL_CXXALIASWARN (mbspbrk); ++#endif ++ ++#if 0 ++/* Find the first occurrence in the character string STRING of any character ++ not in the character string REJECT. Return the number of bytes from the ++ beginning of the string to this occurrence, or to the end of the string ++ if none exists. ++ Unlike strspn(), this function works correctly in multibyte locales. */ ++_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if 0 ++/* Search the next delimiter (multibyte character listed in the character ++ string DELIM) starting at the character string *STRINGP. ++ If one is found, overwrite it with a NUL, and advance *STRINGP to point ++ to the next multibyte character after it. Otherwise, set *STRINGP to NULL. ++ If *STRINGP was already NULL, nothing happens. ++ Return the old value of *STRINGP. ++ ++ This is a variant of mbstok_r() that supports empty fields. ++ ++ Caveat: It modifies the original string. ++ Caveat: These functions cannot be used on constant strings. ++ Caveat: The identity of the delimiting character is lost. ++ ++ See also mbstok_r(). */ ++_GL_EXTERN_C char * mbssep (char **stringp, const char *delim) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if 0 ++/* Parse the character string STRING into tokens separated by characters in ++ the character string DELIM. ++ If STRING is NULL, the saved pointer in SAVE_PTR is used as ++ the next starting point. For example: ++ char s[] = "-abc-=-def"; ++ char *sp; ++ x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" ++ x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL ++ x = mbstok_r(NULL, "=", &sp); // x = NULL ++ // s = "abc\0-def\0" ++ ++ Caveat: It modifies the original string. ++ Caveat: These functions cannot be used on constant strings. ++ Caveat: The identity of the delimiting character is lost. ++ ++ See also mbssep(). */ ++_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr) ++ _GL_ARG_NONNULL ((2, 3)); ++#endif ++ ++/* Map any int, typically from errno, into an error message. */ ++#if 1 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strerror ++# define strerror rpl_strerror ++# endif ++_GL_FUNCDECL_RPL (strerror, char *, (int)); ++_GL_CXXALIAS_RPL (strerror, char *, (int)); ++# else ++_GL_CXXALIAS_SYS (strerror, char *, (int)); ++# endif ++_GL_CXXALIASWARN (strerror); ++#elif defined GNULIB_POSIXCHECK ++# undef strerror ++/* Assume strerror is always declared. */ ++_GL_WARN_ON_USE (strerror, "strerror is unportable - " ++ "use gnulib module strerror to guarantee non-NULL result"); ++#endif ++ ++/* Map any int, typically from errno, into an error message. Multithread-safe. ++ Uses the POSIX declaration, not the glibc declaration. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strerror_r ++# define strerror_r rpl_strerror_r ++# endif ++_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); ++# endif ++# if 1 ++_GL_CXXALIASWARN (strerror_r); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef strerror_r ++# if HAVE_RAW_DECL_STRERROR_R ++_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " ++ "use gnulib module strerror_r-posix for portability"); ++# endif ++#endif ++ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define strsignal rpl_strsignal ++# endif ++_GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); ++_GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); ++# else ++# if ! 1 ++_GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); ++# endif ++/* Need to cast, because on Cygwin 1.5.x systems, the return type is ++ 'const char *'. */ ++_GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); ++# endif ++_GL_CXXALIASWARN (strsignal); ++#elif defined GNULIB_POSIXCHECK ++# undef strsignal ++# if HAVE_RAW_DECL_STRSIGNAL ++_GL_WARN_ON_USE (strsignal, "strsignal is unportable - " ++ "use gnulib module strsignal for portability"); ++# endif ++#endif ++ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); ++_GL_CXXALIASWARN (strverscmp); ++#elif defined GNULIB_POSIXCHECK ++# undef strverscmp ++# if HAVE_RAW_DECL_STRVERSCMP ++_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " ++ "use gnulib module strverscmp for portability"); ++# endif ++#endif ++ ++ ++#endif /* _GL_STRING_H */ ++#endif /* _GL_STRING_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/string.in.h b/xbmc/screensavers/rsxs-0.9/lib/string.in.h +new file mode 100644 +index 0000000..62d7994 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/string.in.h +@@ -0,0 +1,1011 @@ ++/* A GNU-like . ++ ++ Copyright (C) 1995-1996, 2001-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _@GUARD_PREFIX@_STRING_H ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++/* The include_next requires a split double-inclusion guard. */ ++#@INCLUDE_NEXT@ @NEXT_STRING_H@ ++ ++#ifndef _@GUARD_PREFIX@_STRING_H ++#define _@GUARD_PREFIX@_STRING_H ++ ++/* NetBSD 5.0 mis-defines NULL. */ ++#include ++ ++/* MirBSD defines mbslen as a macro. */ ++#if @GNULIB_MBSLEN@ && defined __MirBSD__ ++# include ++#endif ++ ++/* The __attribute__ feature is available in gcc versions 2.5 and later. ++ The attribute __pure__ was added in gcc 2.96. */ ++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) ++# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) ++#else ++# define _GL_ATTRIBUTE_PURE /* empty */ ++#endif ++ ++/* NetBSD 5.0 declares strsignal in , not in . */ ++/* But in any case avoid namespace pollution on glibc systems. */ ++#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ ++ && ! defined __GLIBC__ ++# include ++#endif ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++ ++ ++/* Find the index of the least-significant set bit. */ ++#if @GNULIB_FFSL@ ++# if !@HAVE_FFSL@ ++_GL_FUNCDECL_SYS (ffsl, int, (long int i)); ++# endif ++_GL_CXXALIAS_SYS (ffsl, int, (long int i)); ++_GL_CXXALIASWARN (ffsl); ++#elif defined GNULIB_POSIXCHECK ++# undef ffsl ++# if HAVE_RAW_DECL_FFSL ++_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); ++# endif ++#endif ++ ++ ++/* Find the index of the least-significant set bit. */ ++#if @GNULIB_FFSLL@ ++# if !@HAVE_FFSLL@ ++_GL_FUNCDECL_SYS (ffsll, int, (long long int i)); ++# endif ++_GL_CXXALIAS_SYS (ffsll, int, (long long int i)); ++_GL_CXXALIASWARN (ffsll); ++#elif defined GNULIB_POSIXCHECK ++# undef ffsll ++# if HAVE_RAW_DECL_FFSLL ++_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); ++# endif ++#endif ++ ++ ++/* Return the first instance of C within N bytes of S, or NULL. */ ++#if @GNULIB_MEMCHR@ ++# if @REPLACE_MEMCHR@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define memchr rpl_memchr ++# endif ++_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); ++# else ++# if ! @HAVE_MEMCHR@ ++_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C" { const void * std::memchr (const void *, int, size_t); } ++ extern "C++" { void * std::memchr (void *, int, size_t); } */ ++_GL_CXXALIAS_SYS_CAST2 (memchr, ++ void *, (void const *__s, int __c, size_t __n), ++ void const *, (void const *__s, int __c, size_t __n)); ++# endif ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); ++_GL_CXXALIASWARN1 (memchr, void const *, ++ (void const *__s, int __c, size_t __n)); ++# else ++_GL_CXXALIASWARN (memchr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef memchr ++/* Assume memchr is always declared. */ ++_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " ++ "use gnulib module memchr for portability" ); ++#endif ++ ++/* Return the first occurrence of NEEDLE in HAYSTACK. */ ++#if @GNULIB_MEMMEM@ ++# if @REPLACE_MEMMEM@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define memmem rpl_memmem ++# endif ++_GL_FUNCDECL_RPL (memmem, void *, ++ (void const *__haystack, size_t __haystack_len, ++ void const *__needle, size_t __needle_len) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 3))); ++_GL_CXXALIAS_RPL (memmem, void *, ++ (void const *__haystack, size_t __haystack_len, ++ void const *__needle, size_t __needle_len)); ++# else ++# if ! @HAVE_DECL_MEMMEM@ ++_GL_FUNCDECL_SYS (memmem, void *, ++ (void const *__haystack, size_t __haystack_len, ++ void const *__needle, size_t __needle_len) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 3))); ++# endif ++_GL_CXXALIAS_SYS (memmem, void *, ++ (void const *__haystack, size_t __haystack_len, ++ void const *__needle, size_t __needle_len)); ++# endif ++_GL_CXXALIASWARN (memmem); ++#elif defined GNULIB_POSIXCHECK ++# undef memmem ++# if HAVE_RAW_DECL_MEMMEM ++_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " ++ "use gnulib module memmem-simple for portability, " ++ "and module memmem for speed" ); ++# endif ++#endif ++ ++/* Copy N bytes of SRC to DEST, return pointer to bytes after the ++ last written byte. */ ++#if @GNULIB_MEMPCPY@ ++# if ! @HAVE_MEMPCPY@ ++_GL_FUNCDECL_SYS (mempcpy, void *, ++ (void *restrict __dest, void const *restrict __src, ++ size_t __n) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (mempcpy, void *, ++ (void *restrict __dest, void const *restrict __src, ++ size_t __n)); ++_GL_CXXALIASWARN (mempcpy); ++#elif defined GNULIB_POSIXCHECK ++# undef mempcpy ++# if HAVE_RAW_DECL_MEMPCPY ++_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " ++ "use gnulib module mempcpy for portability"); ++# endif ++#endif ++ ++/* Search backwards through a block for a byte (specified as an int). */ ++#if @GNULIB_MEMRCHR@ ++# if ! @HAVE_DECL_MEMRCHR@ ++_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { const void * std::memrchr (const void *, int, size_t); } ++ extern "C++" { void * std::memrchr (void *, int, size_t); } */ ++_GL_CXXALIAS_SYS_CAST2 (memrchr, ++ void *, (void const *, int, size_t), ++ void const *, (void const *, int, size_t)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); ++_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); ++# else ++_GL_CXXALIASWARN (memrchr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef memrchr ++# if HAVE_RAW_DECL_MEMRCHR ++_GL_WARN_ON_USE (memrchr, "memrchr is unportable - " ++ "use gnulib module memrchr for portability"); ++# endif ++#endif ++ ++/* Find the first occurrence of C in S. More efficient than ++ memchr(S,C,N), at the expense of undefined behavior if C does not ++ occur within N bytes. */ ++#if @GNULIB_RAWMEMCHR@ ++# if ! @HAVE_RAWMEMCHR@ ++_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { const void * std::rawmemchr (const void *, int); } ++ extern "C++" { void * std::rawmemchr (void *, int); } */ ++_GL_CXXALIAS_SYS_CAST2 (rawmemchr, ++ void *, (void const *__s, int __c_in), ++ void const *, (void const *__s, int __c_in)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); ++_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); ++# else ++_GL_CXXALIASWARN (rawmemchr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef rawmemchr ++# if HAVE_RAW_DECL_RAWMEMCHR ++_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " ++ "use gnulib module rawmemchr for portability"); ++# endif ++#endif ++ ++/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ ++#if @GNULIB_STPCPY@ ++# if ! @HAVE_STPCPY@ ++_GL_FUNCDECL_SYS (stpcpy, char *, ++ (char *restrict __dst, char const *restrict __src) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (stpcpy, char *, ++ (char *restrict __dst, char const *restrict __src)); ++_GL_CXXALIASWARN (stpcpy); ++#elif defined GNULIB_POSIXCHECK ++# undef stpcpy ++# if HAVE_RAW_DECL_STPCPY ++_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " ++ "use gnulib module stpcpy for portability"); ++# endif ++#endif ++ ++/* Copy no more than N bytes of SRC to DST, returning a pointer past the ++ last non-NUL byte written into DST. */ ++#if @GNULIB_STPNCPY@ ++# if @REPLACE_STPNCPY@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef stpncpy ++# define stpncpy rpl_stpncpy ++# endif ++_GL_FUNCDECL_RPL (stpncpy, char *, ++ (char *restrict __dst, char const *restrict __src, ++ size_t __n) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (stpncpy, char *, ++ (char *restrict __dst, char const *restrict __src, ++ size_t __n)); ++# else ++# if ! @HAVE_STPNCPY@ ++_GL_FUNCDECL_SYS (stpncpy, char *, ++ (char *restrict __dst, char const *restrict __src, ++ size_t __n) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (stpncpy, char *, ++ (char *restrict __dst, char const *restrict __src, ++ size_t __n)); ++# endif ++_GL_CXXALIASWARN (stpncpy); ++#elif defined GNULIB_POSIXCHECK ++# undef stpncpy ++# if HAVE_RAW_DECL_STPNCPY ++_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " ++ "use gnulib module stpncpy for portability"); ++# endif ++#endif ++ ++#if defined GNULIB_POSIXCHECK ++/* strchr() does not work with multibyte strings if the locale encoding is ++ GB18030 and the character to be searched is a digit. */ ++# undef strchr ++/* Assume strchr is always declared. */ ++_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings " ++ "in some multibyte locales - " ++ "use mbschr if you care about internationalization"); ++#endif ++ ++/* Find the first occurrence of C in S or the final NUL byte. */ ++#if @GNULIB_STRCHRNUL@ ++# if @REPLACE_STRCHRNUL@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define strchrnul rpl_strchrnul ++# endif ++_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (strchrnul, char *, ++ (const char *str, int ch)); ++# else ++# if ! @HAVE_STRCHRNUL@ ++_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { const char * std::strchrnul (const char *, int); } ++ extern "C++" { char * std::strchrnul (char *, int); } */ ++_GL_CXXALIAS_SYS_CAST2 (strchrnul, ++ char *, (char const *__s, int __c_in), ++ char const *, (char const *__s, int __c_in)); ++# endif ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); ++_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); ++# else ++_GL_CXXALIASWARN (strchrnul); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef strchrnul ++# if HAVE_RAW_DECL_STRCHRNUL ++_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " ++ "use gnulib module strchrnul for portability"); ++# endif ++#endif ++ ++/* Duplicate S, returning an identical malloc'd string. */ ++#if @GNULIB_STRDUP@ ++# if @REPLACE_STRDUP@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strdup ++# define strdup rpl_strdup ++# endif ++_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); ++# else ++# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup ++ /* strdup exists as a function and as a macro. Get rid of the macro. */ ++# undef strdup ++# endif ++# if !(@HAVE_DECL_STRDUP@ || defined strdup) ++_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); ++# endif ++_GL_CXXALIASWARN (strdup); ++#elif defined GNULIB_POSIXCHECK ++# undef strdup ++# if HAVE_RAW_DECL_STRDUP ++_GL_WARN_ON_USE (strdup, "strdup is unportable - " ++ "use gnulib module strdup for portability"); ++# endif ++#endif ++ ++/* Append no more than N characters from SRC onto DEST. */ ++#if @GNULIB_STRNCAT@ ++# if @REPLACE_STRNCAT@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strncat ++# define strncat rpl_strncat ++# endif ++_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n)); ++# else ++_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n)); ++# endif ++_GL_CXXALIASWARN (strncat); ++#elif defined GNULIB_POSIXCHECK ++# undef strncat ++# if HAVE_RAW_DECL_STRNCAT ++_GL_WARN_ON_USE (strncat, "strncat is unportable - " ++ "use gnulib module strncat for portability"); ++# endif ++#endif ++ ++/* Return a newly allocated copy of at most N bytes of STRING. */ ++#if @GNULIB_STRNDUP@ ++# if @REPLACE_STRNDUP@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strndup ++# define strndup rpl_strndup ++# endif ++_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n)); ++# else ++# if ! @HAVE_DECL_STRNDUP@ ++_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n)); ++# endif ++_GL_CXXALIASWARN (strndup); ++#elif defined GNULIB_POSIXCHECK ++# undef strndup ++# if HAVE_RAW_DECL_STRNDUP ++_GL_WARN_ON_USE (strndup, "strndup is unportable - " ++ "use gnulib module strndup for portability"); ++# endif ++#endif ++ ++/* Find the length (number of bytes) of STRING, but scan at most ++ MAXLEN bytes. If no '\0' terminator is found in that many bytes, ++ return MAXLEN. */ ++#if @GNULIB_STRNLEN@ ++# if @REPLACE_STRNLEN@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strnlen ++# define strnlen rpl_strnlen ++# endif ++_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)); ++# else ++# if ! @HAVE_DECL_STRNLEN@ ++_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)); ++# endif ++_GL_CXXALIASWARN (strnlen); ++#elif defined GNULIB_POSIXCHECK ++# undef strnlen ++# if HAVE_RAW_DECL_STRNLEN ++_GL_WARN_ON_USE (strnlen, "strnlen is unportable - " ++ "use gnulib module strnlen for portability"); ++# endif ++#endif ++ ++#if defined GNULIB_POSIXCHECK ++/* strcspn() assumes the second argument is a list of single-byte characters. ++ Even in this simple case, it does not work with multibyte strings if the ++ locale encoding is GB18030 and one of the characters to be searched is a ++ digit. */ ++# undef strcspn ++/* Assume strcspn is always declared. */ ++_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " ++ "in multibyte locales - " ++ "use mbscspn if you care about internationalization"); ++#endif ++ ++/* Find the first occurrence in S of any character in ACCEPT. */ ++#if @GNULIB_STRPBRK@ ++# if ! @HAVE_STRPBRK@ ++_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C" { const char * strpbrk (const char *, const char *); } ++ extern "C++" { char * strpbrk (char *, const char *); } */ ++_GL_CXXALIAS_SYS_CAST2 (strpbrk, ++ char *, (char const *__s, char const *__accept), ++ const char *, (char const *__s, char const *__accept)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); ++_GL_CXXALIASWARN1 (strpbrk, char const *, ++ (char const *__s, char const *__accept)); ++# else ++_GL_CXXALIASWARN (strpbrk); ++# endif ++# if defined GNULIB_POSIXCHECK ++/* strpbrk() assumes the second argument is a list of single-byte characters. ++ Even in this simple case, it does not work with multibyte strings if the ++ locale encoding is GB18030 and one of the characters to be searched is a ++ digit. */ ++# undef strpbrk ++_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings " ++ "in multibyte locales - " ++ "use mbspbrk if you care about internationalization"); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef strpbrk ++# if HAVE_RAW_DECL_STRPBRK ++_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - " ++ "use gnulib module strpbrk for portability"); ++# endif ++#endif ++ ++#if defined GNULIB_POSIXCHECK ++/* strspn() assumes the second argument is a list of single-byte characters. ++ Even in this simple case, it cannot work with multibyte strings. */ ++# undef strspn ++/* Assume strspn is always declared. */ ++_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " ++ "in multibyte locales - " ++ "use mbsspn if you care about internationalization"); ++#endif ++ ++#if defined GNULIB_POSIXCHECK ++/* strrchr() does not work with multibyte strings if the locale encoding is ++ GB18030 and the character to be searched is a digit. */ ++# undef strrchr ++/* Assume strrchr is always declared. */ ++_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings " ++ "in some multibyte locales - " ++ "use mbsrchr if you care about internationalization"); ++#endif ++ ++/* Search the next delimiter (char listed in DELIM) starting at *STRINGP. ++ If one is found, overwrite it with a NUL, and advance *STRINGP ++ to point to the next char after it. Otherwise, set *STRINGP to NULL. ++ If *STRINGP was already NULL, nothing happens. ++ Return the old value of *STRINGP. ++ ++ This is a variant of strtok() that is multithread-safe and supports ++ empty fields. ++ ++ Caveat: It modifies the original string. ++ Caveat: These functions cannot be used on constant strings. ++ Caveat: The identity of the delimiting character is lost. ++ Caveat: It doesn't work with multibyte strings unless all of the delimiter ++ characters are ASCII characters < 0x30. ++ ++ See also strtok_r(). */ ++#if @GNULIB_STRSEP@ ++# if ! @HAVE_STRSEP@ ++_GL_FUNCDECL_SYS (strsep, char *, ++ (char **restrict __stringp, char const *restrict __delim) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (strsep, char *, ++ (char **restrict __stringp, char const *restrict __delim)); ++_GL_CXXALIASWARN (strsep); ++# if defined GNULIB_POSIXCHECK ++# undef strsep ++_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " ++ "in multibyte locales - " ++ "use mbssep if you care about internationalization"); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef strsep ++# if HAVE_RAW_DECL_STRSEP ++_GL_WARN_ON_USE (strsep, "strsep is unportable - " ++ "use gnulib module strsep for portability"); ++# endif ++#endif ++ ++#if @GNULIB_STRSTR@ ++# if @REPLACE_STRSTR@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define strstr rpl_strstr ++# endif ++_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); ++# else ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { const char * strstr (const char *, const char *); } ++ extern "C++" { char * strstr (char *, const char *); } */ ++_GL_CXXALIAS_SYS_CAST2 (strstr, ++ char *, (const char *haystack, const char *needle), ++ const char *, (const char *haystack, const char *needle)); ++# endif ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); ++_GL_CXXALIASWARN1 (strstr, const char *, ++ (const char *haystack, const char *needle)); ++# else ++_GL_CXXALIASWARN (strstr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++/* strstr() does not work with multibyte strings if the locale encoding is ++ different from UTF-8: ++ POSIX says that it operates on "strings", and "string" in POSIX is defined ++ as a sequence of bytes, not of characters. */ ++# undef strstr ++/* Assume strstr is always declared. */ ++_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " ++ "work correctly on character strings in most " ++ "multibyte locales - " ++ "use mbsstr if you care about internationalization, " ++ "or use strstr if you care about speed"); ++#endif ++ ++/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive ++ comparison. */ ++#if @GNULIB_STRCASESTR@ ++# if @REPLACE_STRCASESTR@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define strcasestr rpl_strcasestr ++# endif ++_GL_FUNCDECL_RPL (strcasestr, char *, ++ (const char *haystack, const char *needle) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (strcasestr, char *, ++ (const char *haystack, const char *needle)); ++# else ++# if ! @HAVE_STRCASESTR@ ++_GL_FUNCDECL_SYS (strcasestr, char *, ++ (const char *haystack, const char *needle) ++ _GL_ATTRIBUTE_PURE ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { const char * strcasestr (const char *, const char *); } ++ extern "C++" { char * strcasestr (char *, const char *); } */ ++_GL_CXXALIAS_SYS_CAST2 (strcasestr, ++ char *, (const char *haystack, const char *needle), ++ const char *, (const char *haystack, const char *needle)); ++# endif ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); ++_GL_CXXALIASWARN1 (strcasestr, const char *, ++ (const char *haystack, const char *needle)); ++# else ++_GL_CXXALIASWARN (strcasestr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++/* strcasestr() does not work with multibyte strings: ++ It is a glibc extension, and glibc implements it only for unibyte ++ locales. */ ++# undef strcasestr ++# if HAVE_RAW_DECL_STRCASESTR ++_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " ++ "strings in multibyte locales - " ++ "use mbscasestr if you care about " ++ "internationalization, or use c-strcasestr if you want " ++ "a locale independent function"); ++# endif ++#endif ++ ++/* Parse S into tokens separated by characters in DELIM. ++ If S is NULL, the saved pointer in SAVE_PTR is used as ++ the next starting point. For example: ++ char s[] = "-abc-=-def"; ++ char *sp; ++ x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" ++ x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL ++ x = strtok_r(NULL, "=", &sp); // x = NULL ++ // s = "abc\0-def\0" ++ ++ This is a variant of strtok() that is multithread-safe. ++ ++ For the POSIX documentation for this function, see: ++ http://www.opengroup.org/susv3xsh/strtok.html ++ ++ Caveat: It modifies the original string. ++ Caveat: These functions cannot be used on constant strings. ++ Caveat: The identity of the delimiting character is lost. ++ Caveat: It doesn't work with multibyte strings unless all of the delimiter ++ characters are ASCII characters < 0x30. ++ ++ See also strsep(). */ ++#if @GNULIB_STRTOK_R@ ++# if @REPLACE_STRTOK_R@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strtok_r ++# define strtok_r rpl_strtok_r ++# endif ++_GL_FUNCDECL_RPL (strtok_r, char *, ++ (char *restrict s, char const *restrict delim, ++ char **restrict save_ptr) ++ _GL_ARG_NONNULL ((2, 3))); ++_GL_CXXALIAS_RPL (strtok_r, char *, ++ (char *restrict s, char const *restrict delim, ++ char **restrict save_ptr)); ++# else ++# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK ++# undef strtok_r ++# endif ++# if ! @HAVE_DECL_STRTOK_R@ ++_GL_FUNCDECL_SYS (strtok_r, char *, ++ (char *restrict s, char const *restrict delim, ++ char **restrict save_ptr) ++ _GL_ARG_NONNULL ((2, 3))); ++# endif ++_GL_CXXALIAS_SYS (strtok_r, char *, ++ (char *restrict s, char const *restrict delim, ++ char **restrict save_ptr)); ++# endif ++_GL_CXXALIASWARN (strtok_r); ++# if defined GNULIB_POSIXCHECK ++_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " ++ "strings in multibyte locales - " ++ "use mbstok_r if you care about internationalization"); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef strtok_r ++# if HAVE_RAW_DECL_STRTOK_R ++_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " ++ "use gnulib module strtok_r for portability"); ++# endif ++#endif ++ ++ ++/* The following functions are not specified by POSIX. They are gnulib ++ extensions. */ ++ ++#if @GNULIB_MBSLEN@ ++/* Return the number of multibyte characters in the character string STRING. ++ This considers multibyte characters, unlike strlen, which counts bytes. */ ++# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ ++# undef mbslen ++# endif ++# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define mbslen rpl_mbslen ++# endif ++_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); ++# else ++_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); ++# endif ++_GL_CXXALIASWARN (mbslen); ++#endif ++ ++#if @GNULIB_MBSNLEN@ ++/* Return the number of multibyte characters in the character string starting ++ at STRING and ending at STRING + LEN. */ ++_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) ++ _GL_ARG_NONNULL ((1)); ++#endif ++ ++#if @GNULIB_MBSCHR@ ++/* Locate the first single-byte character C in the character string STRING, ++ and return a pointer to it. Return NULL if C is not found in STRING. ++ Unlike strchr(), this function works correctly in multibyte locales with ++ encodings such as GB18030. */ ++# if defined __hpux ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ ++# endif ++_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); ++# else ++_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); ++# endif ++_GL_CXXALIASWARN (mbschr); ++#endif ++ ++#if @GNULIB_MBSRCHR@ ++/* Locate the last single-byte character C in the character string STRING, ++ and return a pointer to it. Return NULL if C is not found in STRING. ++ Unlike strrchr(), this function works correctly in multibyte locales with ++ encodings such as GB18030. */ ++# if defined __hpux || defined __INTERIX ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ ++# endif ++_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); ++# else ++_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); ++# endif ++_GL_CXXALIASWARN (mbsrchr); ++#endif ++ ++#if @GNULIB_MBSSTR@ ++/* Find the first occurrence of the character string NEEDLE in the character ++ string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. ++ Unlike strstr(), this function works correctly in multibyte locales with ++ encodings different from UTF-8. */ ++_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if @GNULIB_MBSCASECMP@ ++/* Compare the character strings S1 and S2, ignoring case, returning less than, ++ equal to or greater than zero if S1 is lexicographically less than, equal to ++ or greater than S2. ++ Note: This function may, in multibyte locales, return 0 for strings of ++ different lengths! ++ Unlike strcasecmp(), this function works correctly in multibyte locales. */ ++_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if @GNULIB_MBSNCASECMP@ ++/* Compare the initial segment of the character string S1 consisting of at most ++ N characters with the initial segment of the character string S2 consisting ++ of at most N characters, ignoring case, returning less than, equal to or ++ greater than zero if the initial segment of S1 is lexicographically less ++ than, equal to or greater than the initial segment of S2. ++ Note: This function may, in multibyte locales, return 0 for initial segments ++ of different lengths! ++ Unlike strncasecmp(), this function works correctly in multibyte locales. ++ But beware that N is not a byte count but a character count! */ ++_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if @GNULIB_MBSPCASECMP@ ++/* Compare the initial segment of the character string STRING consisting of ++ at most mbslen (PREFIX) characters with the character string PREFIX, ++ ignoring case. If the two match, return a pointer to the first byte ++ after this prefix in STRING. Otherwise, return NULL. ++ Note: This function may, in multibyte locales, return non-NULL if STRING ++ is of smaller length than PREFIX! ++ Unlike strncasecmp(), this function works correctly in multibyte ++ locales. */ ++_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if @GNULIB_MBSCASESTR@ ++/* Find the first occurrence of the character string NEEDLE in the character ++ string HAYSTACK, using case-insensitive comparison. ++ Note: This function may, in multibyte locales, return success even if ++ strlen (haystack) < strlen (needle) ! ++ Unlike strcasestr(), this function works correctly in multibyte locales. */ ++_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if @GNULIB_MBSCSPN@ ++/* Find the first occurrence in the character string STRING of any character ++ in the character string ACCEPT. Return the number of bytes from the ++ beginning of the string to this occurrence, or to the end of the string ++ if none exists. ++ Unlike strcspn(), this function works correctly in multibyte locales. */ ++_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if @GNULIB_MBSPBRK@ ++/* Find the first occurrence in the character string STRING of any character ++ in the character string ACCEPT. Return the pointer to it, or NULL if none ++ exists. ++ Unlike strpbrk(), this function works correctly in multibyte locales. */ ++# if defined __hpux ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ ++# endif ++_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); ++# else ++_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); ++# endif ++_GL_CXXALIASWARN (mbspbrk); ++#endif ++ ++#if @GNULIB_MBSSPN@ ++/* Find the first occurrence in the character string STRING of any character ++ not in the character string REJECT. Return the number of bytes from the ++ beginning of the string to this occurrence, or to the end of the string ++ if none exists. ++ Unlike strspn(), this function works correctly in multibyte locales. */ ++_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if @GNULIB_MBSSEP@ ++/* Search the next delimiter (multibyte character listed in the character ++ string DELIM) starting at the character string *STRINGP. ++ If one is found, overwrite it with a NUL, and advance *STRINGP to point ++ to the next multibyte character after it. Otherwise, set *STRINGP to NULL. ++ If *STRINGP was already NULL, nothing happens. ++ Return the old value of *STRINGP. ++ ++ This is a variant of mbstok_r() that supports empty fields. ++ ++ Caveat: It modifies the original string. ++ Caveat: These functions cannot be used on constant strings. ++ Caveat: The identity of the delimiting character is lost. ++ ++ See also mbstok_r(). */ ++_GL_EXTERN_C char * mbssep (char **stringp, const char *delim) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++ ++#if @GNULIB_MBSTOK_R@ ++/* Parse the character string STRING into tokens separated by characters in ++ the character string DELIM. ++ If STRING is NULL, the saved pointer in SAVE_PTR is used as ++ the next starting point. For example: ++ char s[] = "-abc-=-def"; ++ char *sp; ++ x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" ++ x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL ++ x = mbstok_r(NULL, "=", &sp); // x = NULL ++ // s = "abc\0-def\0" ++ ++ Caveat: It modifies the original string. ++ Caveat: These functions cannot be used on constant strings. ++ Caveat: The identity of the delimiting character is lost. ++ ++ See also mbssep(). */ ++_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr) ++ _GL_ARG_NONNULL ((2, 3)); ++#endif ++ ++/* Map any int, typically from errno, into an error message. */ ++#if @GNULIB_STRERROR@ ++# if @REPLACE_STRERROR@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strerror ++# define strerror rpl_strerror ++# endif ++_GL_FUNCDECL_RPL (strerror, char *, (int)); ++_GL_CXXALIAS_RPL (strerror, char *, (int)); ++# else ++_GL_CXXALIAS_SYS (strerror, char *, (int)); ++# endif ++_GL_CXXALIASWARN (strerror); ++#elif defined GNULIB_POSIXCHECK ++# undef strerror ++/* Assume strerror is always declared. */ ++_GL_WARN_ON_USE (strerror, "strerror is unportable - " ++ "use gnulib module strerror to guarantee non-NULL result"); ++#endif ++ ++/* Map any int, typically from errno, into an error message. Multithread-safe. ++ Uses the POSIX declaration, not the glibc declaration. */ ++#if @GNULIB_STRERROR_R@ ++# if @REPLACE_STRERROR_R@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef strerror_r ++# define strerror_r rpl_strerror_r ++# endif ++_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); ++# else ++# if !@HAVE_DECL_STRERROR_R@ ++_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); ++# endif ++# if @HAVE_DECL_STRERROR_R@ ++_GL_CXXALIASWARN (strerror_r); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef strerror_r ++# if HAVE_RAW_DECL_STRERROR_R ++_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " ++ "use gnulib module strerror_r-posix for portability"); ++# endif ++#endif ++ ++#if @GNULIB_STRSIGNAL@ ++# if @REPLACE_STRSIGNAL@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define strsignal rpl_strsignal ++# endif ++_GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); ++_GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); ++# else ++# if ! @HAVE_DECL_STRSIGNAL@ ++_GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); ++# endif ++/* Need to cast, because on Cygwin 1.5.x systems, the return type is ++ 'const char *'. */ ++_GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); ++# endif ++_GL_CXXALIASWARN (strsignal); ++#elif defined GNULIB_POSIXCHECK ++# undef strsignal ++# if HAVE_RAW_DECL_STRSIGNAL ++_GL_WARN_ON_USE (strsignal, "strsignal is unportable - " ++ "use gnulib module strsignal for portability"); ++# endif ++#endif ++ ++#if @GNULIB_STRVERSCMP@ ++# if !@HAVE_STRVERSCMP@ ++_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); ++_GL_CXXALIASWARN (strverscmp); ++#elif defined GNULIB_POSIXCHECK ++# undef strverscmp ++# if HAVE_RAW_DECL_STRVERSCMP ++_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " ++ "use gnulib module strverscmp for portability"); ++# endif ++#endif ++ ++ ++#endif /* _@GUARD_PREFIX@_STRING_H */ ++#endif /* _@GUARD_PREFIX@_STRING_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strings.h b/xbmc/screensavers/rsxs-0.9/lib/strings.h +new file mode 100644 +index 0000000..2d63b01 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/strings.h +@@ -0,0 +1,435 @@ ++/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ ++/* A substitute . ++ ++ Copyright (C) 2007-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _GL_STRINGS_H ++ ++#if __GNUC__ >= 3 ++#pragma GCC system_header ++#endif ++ ++ ++/* Minix 3.1.8 has a bug: must be included before . ++ But avoid namespace pollution on glibc systems. */ ++#if defined __minix && !defined __GLIBC__ ++# include ++#endif ++ ++/* The include_next requires a split double-inclusion guard. */ ++#if 1 ++# include_next ++#endif ++ ++#ifndef _GL_STRINGS_H ++#define _GL_STRINGS_H ++ ++#if ! 1 ++/* Get size_t. */ ++# include ++#endif ++ ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++#ifndef _GL_CXXDEFS_H ++#define _GL_CXXDEFS_H ++ ++/* The three most frequent use cases of these macros are: ++ ++ * For providing a substitute for a function that is missing on some ++ platforms, but is declared and works fine on the platforms on which ++ it exists: ++ ++ #if @GNULIB_FOO@ ++ # if !@HAVE_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on all platforms, ++ but is broken/insufficient and needs to be replaced on some platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on some platforms ++ but is broken/insufficient and needs to be replaced on some of them and ++ is additionally either missing or undeclared on some other platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++*/ ++ ++/* _GL_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#if defined __cplusplus ++# define _GL_EXTERN_C extern "C" ++#else ++# define _GL_EXTERN_C extern ++#endif ++ ++/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); ++ declares a replacement function, named rpl_func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ ++ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) ++#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype rpl_func parameters_and_attributes ++ ++/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); ++ declares the system function, named func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype func parameters_and_attributes ++ ++/* _GL_CXXALIAS_RPL (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. ++ Example: ++ _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); ++ */ ++#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ ++ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = ::rpl_func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); ++ is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); ++ except that the C function rpl_func may have a slightly different ++ declaration. A cast is used to silence the "invalid conversion" error ++ that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = \ ++ reinterpret_cast(::rpl_func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to the system provided function func, if GNULIB_NAMESPACE ++ is defined. ++ Example: ++ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); ++ */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* If we were to write ++ rettype (*const func) parameters = ::func; ++ like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls ++ better (remove an indirection through a 'static' pointer variable), ++ but then the _GL_CXXALIASWARN macro below would cause a warning not only ++ for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = ::func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function func may have a slightly different declaration. ++ A cast is used to silence the "invalid conversion" error that would ++ otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast(::func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function is picked among a set of overloaded functions, ++ namely the one with rettype2 and parameters2. Two consecutive casts ++ are used to silence the "cannot find a match" and "invalid conversion" ++ errors that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* The outer cast must be a reinterpret_cast. ++ The inner cast: When the function is defined as a set of overloaded ++ functions, it works as a static_cast<>, choosing the designated variant. ++ When the function is defined as a single variant, it works as a ++ reinterpret_cast<>. The parenthesized cast syntax works both ways. */ ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast( \ ++ (rettype2(*)parameters2)(::func)); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN (func); ++ causes a warning to be emitted when ::func is used but not when ++ GNULIB_NAMESPACE::func is used. func must be defined without overloaded ++ variants. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN(func) \ ++ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN_1(func,namespace) \ ++ _GL_CXXALIASWARN_2 (func, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_WARN_ON_USE (func, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN(func) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); ++ causes a warning to be emitted when the given overloaded variant of ::func ++ is used but not when GNULIB_NAMESPACE::func is used. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ ++ GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++#endif /* _GL_CXXDEFS_H */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools ++ that the values passed as arguments n, ..., m must be non-NULL pointers. ++ n = 1 stands for the first argument, n = 2 for the second argument etc. */ ++#ifndef _GL_ARG_NONNULL ++# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 ++# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) ++# else ++# define _GL_ARG_NONNULL(params) ++# endif ++#endif ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++#ifndef _GL_WARN_ON_USE ++ ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++/* A compiler attribute is available in gcc versions 4.3.0 and later. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function __attribute__ ((__warning__ (message))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE(function, message) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") ++ is like _GL_WARN_ON_USE (function, "string"), except that the function is ++ declared with the given prototype, consisting of return type, parameters, ++ and attributes. ++ This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does ++ not work in this case. */ ++#ifndef _GL_WARN_ON_USE_CXX ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes \ ++ __attribute__ ((__warning__ (msg))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#ifndef _GL_WARN_EXTERN_C ++# if defined __cplusplus ++# define _GL_WARN_EXTERN_C extern "C" ++# else ++# define _GL_WARN_EXTERN_C extern ++# endif ++#endif ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* Find the index of the least-significant set bit. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (ffs, int, (int i)); ++# endif ++_GL_CXXALIAS_SYS (ffs, int, (int i)); ++_GL_CXXALIASWARN (ffs); ++#elif defined GNULIB_POSIXCHECK ++# undef ffs ++# if HAVE_RAW_DECL_FFS ++_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module"); ++# endif ++#endif ++ ++/* Compare strings S1 and S2, ignoring case, returning less than, equal to or ++ greater than zero if S1 is lexicographically less than, equal to or greater ++ than S2. ++ Note: This function does not work in multibyte locales. */ ++#if ! 1 ++extern int strcasecmp (char const *s1, char const *s2) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++#if defined GNULIB_POSIXCHECK ++/* strcasecmp() does not work with multibyte strings: ++ POSIX says that it operates on "strings", and "string" in POSIX is defined ++ as a sequence of bytes, not of characters. */ ++# undef strcasecmp ++# if HAVE_RAW_DECL_STRCASECMP ++_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character " ++ "strings in multibyte locales - " ++ "use mbscasecmp if you care about " ++ "internationalization, or use c_strcasecmp , " ++ "gnulib module c-strcase) if you want a locale " ++ "independent function"); ++# endif ++#endif ++ ++/* Compare no more than N bytes of strings S1 and S2, ignoring case, ++ returning less than, equal to or greater than zero if S1 is ++ lexicographically less than, equal to or greater than S2. ++ Note: This function cannot work correctly in multibyte locales. */ ++#if ! 1 ++extern int strncasecmp (char const *s1, char const *s2, size_t n) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++#if defined GNULIB_POSIXCHECK ++/* strncasecmp() does not work with multibyte strings: ++ POSIX says that it operates on "strings", and "string" in POSIX is defined ++ as a sequence of bytes, not of characters. */ ++# undef strncasecmp ++# if HAVE_RAW_DECL_STRNCASECMP ++_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character " ++ "strings in multibyte locales - " ++ "use mbsncasecmp or mbspcasecmp if you care about " ++ "internationalization, or use c_strncasecmp , " ++ "gnulib module c-strcase) if you want a locale " ++ "independent function"); ++# endif ++#endif ++ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _GL_STRING_H */ ++#endif /* _GL_STRING_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strings.in.h b/xbmc/screensavers/rsxs-0.9/lib/strings.in.h +new file mode 100644 +index 0000000..8bb455e +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/strings.in.h +@@ -0,0 +1,123 @@ ++/* A substitute . ++ ++ Copyright (C) 2007-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _@GUARD_PREFIX@_STRINGS_H ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++/* Minix 3.1.8 has a bug: must be included before . ++ But avoid namespace pollution on glibc systems. */ ++#if defined __minix && !defined __GLIBC__ ++# include ++#endif ++ ++/* The include_next requires a split double-inclusion guard. */ ++#if @HAVE_STRINGS_H@ ++# @INCLUDE_NEXT@ @NEXT_STRINGS_H@ ++#endif ++ ++#ifndef _@GUARD_PREFIX@_STRINGS_H ++#define _@GUARD_PREFIX@_STRINGS_H ++ ++#if ! @HAVE_DECL_STRNCASECMP@ ++/* Get size_t. */ ++# include ++#endif ++ ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* Find the index of the least-significant set bit. */ ++#if @GNULIB_FFS@ ++# if !@HAVE_FFS@ ++_GL_FUNCDECL_SYS (ffs, int, (int i)); ++# endif ++_GL_CXXALIAS_SYS (ffs, int, (int i)); ++_GL_CXXALIASWARN (ffs); ++#elif defined GNULIB_POSIXCHECK ++# undef ffs ++# if HAVE_RAW_DECL_FFS ++_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module"); ++# endif ++#endif ++ ++/* Compare strings S1 and S2, ignoring case, returning less than, equal to or ++ greater than zero if S1 is lexicographically less than, equal to or greater ++ than S2. ++ Note: This function does not work in multibyte locales. */ ++#if ! @HAVE_STRCASECMP@ ++extern int strcasecmp (char const *s1, char const *s2) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++#if defined GNULIB_POSIXCHECK ++/* strcasecmp() does not work with multibyte strings: ++ POSIX says that it operates on "strings", and "string" in POSIX is defined ++ as a sequence of bytes, not of characters. */ ++# undef strcasecmp ++# if HAVE_RAW_DECL_STRCASECMP ++_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character " ++ "strings in multibyte locales - " ++ "use mbscasecmp if you care about " ++ "internationalization, or use c_strcasecmp , " ++ "gnulib module c-strcase) if you want a locale " ++ "independent function"); ++# endif ++#endif ++ ++/* Compare no more than N bytes of strings S1 and S2, ignoring case, ++ returning less than, equal to or greater than zero if S1 is ++ lexicographically less than, equal to or greater than S2. ++ Note: This function cannot work correctly in multibyte locales. */ ++#if ! @HAVE_DECL_STRNCASECMP@ ++extern int strncasecmp (char const *s1, char const *s2, size_t n) ++ _GL_ARG_NONNULL ((1, 2)); ++#endif ++#if defined GNULIB_POSIXCHECK ++/* strncasecmp() does not work with multibyte strings: ++ POSIX says that it operates on "strings", and "string" in POSIX is defined ++ as a sequence of bytes, not of characters. */ ++# undef strncasecmp ++# if HAVE_RAW_DECL_STRNCASECMP ++_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character " ++ "strings in multibyte locales - " ++ "use mbsncasecmp or mbspcasecmp if you care about " ++ "internationalization, or use c_strncasecmp , " ++ "gnulib module c-strcase) if you want a locale " ++ "independent function"); ++# endif ++#endif ++ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _@GUARD_PREFIX@_STRING_H */ ++#endif /* _@GUARD_PREFIX@_STRING_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/stripslash.c b/xbmc/screensavers/rsxs-0.9/lib/stripslash.c +index 4ba5dad..1212440 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/stripslash.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/stripslash.c +@@ -1,11 +1,12 @@ + /* stripslash.c -- remove redundant trailing slashes from a file name + +- Copyright (C) 1990, 2001, 2003-2006 Free Software Foundation, Inc. ++ Copyright (C) 1990, 2001, 2003-2006, 2009-2011 Free Software Foundation, ++ Inc. + +- This program is free software; you can redistribute it and/or modify ++ This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +@@ -13,12 +14,9 @@ + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License +- along with this program; if not, write to the Free Software Foundation, +- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ along with this program. If not, see . */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif ++#include + + #include "dirname.h" + +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strncasecmp.c b/xbmc/screensavers/rsxs-0.9/lib/strncasecmp.c +index 0209c39..1e0d75f 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/strncasecmp.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/strncasecmp.c +@@ -1,9 +1,9 @@ + /* strncasecmp.c -- case insensitive string comparator +- Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc. ++ Copyright (C) 1998-1999, 2005-2007, 2009-2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -15,22 +15,20 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif ++#include + + /* Specification. */ +-#include "strcase.h" ++#include + + #include + #include + + #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) + +-/* Compare no more than N bytes of strings S1 and S2, +- ignoring case, returning less than, equal to or +- greater than zero if S1 is lexicographically less +- than, equal to or greater than S2. */ ++/* Compare no more than N bytes of strings S1 and S2, ignoring case, ++ returning less than, equal to or greater than zero if S1 is ++ lexicographically less than, equal to or greater than S2. ++ Note: This function cannot work correctly in multibyte locales. */ + + int + strncasecmp (const char *s1, const char *s2, size_t n) +@@ -48,7 +46,7 @@ + c2 = TOLOWER (*p2); + + if (--n == 0 || c1 == '\0') +- break; ++ break; + + ++p1; + ++p2; +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strndup.c b/xbmc/screensavers/rsxs-0.9/lib/strndup.c +index 2626373..4a3bece 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/strndup.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/strndup.c +@@ -1,12 +1,11 @@ +-/* Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006 Free +- Software Foundation, Inc. ++/* A replacement function, for systems that lack strndup. + +- NOTE: The canonical source of this file is maintained with the GNU C Library. +- Bugs can be reported to bug-glibc@prep.ai.mit.edu. ++ Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2011 Free Software ++ Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the +- Free Software Foundation; either version 2, or (at your option) any ++ Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, +@@ -18,38 +17,16 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif +-#if !_LIBC +-# include "strndup.h" +-#endif ++#include + +-#include + #include + +-#if !_LIBC +-# include "strnlen.h" +-# ifndef __strnlen +-# define __strnlen strnlen +-# endif +-#endif +- +-#undef __strndup +-#if _LIBC +-# undef strndup +-#endif +- +-#ifndef weak_alias +-# define __strndup strndup +-#endif ++#include + + char * +-__strndup (s, n) +- const char *s; +- size_t n; ++strndup (char const *s, size_t n) + { +- size_t len = __strnlen (s, n); ++ size_t len = strnlen (s, n); + char *new = malloc (len + 1); + + if (new == NULL) +@@ -58,9 +35,3 @@ + new[len] = '\0'; + return memcpy (new, s, len); + } +-#ifdef libc_hidden_def +-libc_hidden_def (__strndup) +-#endif +-#ifdef weak_alias +-weak_alias (__strndup, strndup) +-#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strnlen.c b/xbmc/screensavers/rsxs-0.9/lib/strnlen.c +index 09ba788..3cefa97 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/strnlen.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/strnlen.c +@@ -1,10 +1,10 @@ + /* Find the length of STRING, but scan at most MAXLEN characters. +- Copyright (C) 2005, 2006 Free Software Foundation, Inc. ++ Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc. + Written by Simon Josefsson. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -16,11 +16,9 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif ++#include + +-#include "strnlen.h" ++#include + + /* Find the length of STRING, but scan at most MAXLEN characters. + If no '\0' terminator is found in that many characters, return MAXLEN. */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/strstr.c b/xbmc/screensavers/rsxs-0.9/lib/strstr.c +new file mode 100644 +index 0000000..433cad6 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/strstr.c +@@ -0,0 +1,83 @@ ++/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2011 Free Software ++ Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* This particular implementation was written by Eric Blake, 2008. */ ++ ++#ifndef _LIBC ++# include ++#endif ++ ++/* Specification of strstr. */ ++#include ++ ++#include ++ ++#ifndef _LIBC ++# define __builtin_expect(expr, val) (expr) ++#endif ++ ++#define RETURN_TYPE char * ++#define AVAILABLE(h, h_l, j, n_l) \ ++ (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ ++ && ((h_l) = (j) + (n_l))) ++#include "str-two-way.h" ++ ++/* Return the first occurrence of NEEDLE in HAYSTACK. Return HAYSTACK ++ if NEEDLE is empty, otherwise NULL if NEEDLE is not found in ++ HAYSTACK. */ ++char * ++strstr (const char *haystack_start, const char *needle_start) ++{ ++ const char *haystack = haystack_start; ++ const char *needle = needle_start; ++ size_t needle_len; /* Length of NEEDLE. */ ++ size_t haystack_len; /* Known minimum length of HAYSTACK. */ ++ bool ok = true; /* True if NEEDLE is prefix of HAYSTACK. */ ++ ++ /* Determine length of NEEDLE, and in the process, make sure ++ HAYSTACK is at least as long (no point processing all of a long ++ NEEDLE if HAYSTACK is too short). */ ++ while (*haystack && *needle) ++ ok &= *haystack++ == *needle++; ++ if (*needle) ++ return NULL; ++ if (ok) ++ return (char *) haystack_start; ++ ++ /* Reduce the size of haystack using strchr, since it has a smaller ++ linear coefficient than the Two-Way algorithm. */ ++ needle_len = needle - needle_start; ++ haystack = strchr (haystack_start + 1, *needle_start); ++ if (!haystack || __builtin_expect (needle_len == 1, 0)) ++ return (char *) haystack; ++ needle -= needle_len; ++ haystack_len = (haystack > haystack_start + needle_len ? 1 ++ : needle_len + haystack_start - haystack); ++ ++ /* Perform the search. Abstract memory is considered to be an array ++ of 'unsigned char' values, not an array of 'char' values. See ++ ISO C 99 section 6.2.6.1. */ ++ if (needle_len < LONG_NEEDLE_THRESHOLD) ++ return two_way_short_needle ((const unsigned char *) haystack, ++ haystack_len, ++ (const unsigned char *) needle, needle_len); ++ return two_way_long_needle ((const unsigned char *) haystack, haystack_len, ++ (const unsigned char *) needle, needle_len); ++} ++ ++#undef LONG_NEEDLE_THRESHOLD +diff --git a/xbmc/screensavers/rsxs-0.9/lib/sys/time.h b/xbmc/screensavers/rsxs-0.9/lib/sys/time.h +new file mode 100644 +index 0000000..f5723c9 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/sys/time.h +@@ -0,0 +1,512 @@ ++/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ ++/* Provide a more complete sys/time.h. ++ ++ Copyright (C) 2007-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* Written by Paul Eggert. */ ++ ++#if __GNUC__ >= 3 ++#pragma GCC system_header ++#endif ++ ++ ++#if defined _GL_SYS_TIME_H ++ ++/* Simply delegate to the system's header, without adding anything. */ ++# if 1 ++# include_next ++# endif ++ ++#else ++ ++# define _GL_SYS_TIME_H ++ ++# if 1 ++# include_next ++# else ++# include ++# endif ++ ++/* On native Windows with MSVC: ++ Get the 'struct timeval' type. */ ++# if defined _MSC_VER && 0 && !defined _GL_INCLUDING_WINSOCK2_H ++# define _GL_INCLUDING_WINSOCK2_H ++# include ++# undef _GL_INCLUDING_WINSOCK2_H ++# endif ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++#ifndef _GL_CXXDEFS_H ++#define _GL_CXXDEFS_H ++ ++/* The three most frequent use cases of these macros are: ++ ++ * For providing a substitute for a function that is missing on some ++ platforms, but is declared and works fine on the platforms on which ++ it exists: ++ ++ #if @GNULIB_FOO@ ++ # if !@HAVE_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on all platforms, ++ but is broken/insufficient and needs to be replaced on some platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on some platforms ++ but is broken/insufficient and needs to be replaced on some of them and ++ is additionally either missing or undeclared on some other platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++*/ ++ ++/* _GL_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#if defined __cplusplus ++# define _GL_EXTERN_C extern "C" ++#else ++# define _GL_EXTERN_C extern ++#endif ++ ++/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); ++ declares a replacement function, named rpl_func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ ++ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) ++#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype rpl_func parameters_and_attributes ++ ++/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); ++ declares the system function, named func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype func parameters_and_attributes ++ ++/* _GL_CXXALIAS_RPL (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. ++ Example: ++ _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); ++ */ ++#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ ++ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = ::rpl_func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); ++ is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); ++ except that the C function rpl_func may have a slightly different ++ declaration. A cast is used to silence the "invalid conversion" error ++ that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = \ ++ reinterpret_cast(::rpl_func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to the system provided function func, if GNULIB_NAMESPACE ++ is defined. ++ Example: ++ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); ++ */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* If we were to write ++ rettype (*const func) parameters = ::func; ++ like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls ++ better (remove an indirection through a 'static' pointer variable), ++ but then the _GL_CXXALIASWARN macro below would cause a warning not only ++ for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = ::func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function func may have a slightly different declaration. ++ A cast is used to silence the "invalid conversion" error that would ++ otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast(::func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function is picked among a set of overloaded functions, ++ namely the one with rettype2 and parameters2. Two consecutive casts ++ are used to silence the "cannot find a match" and "invalid conversion" ++ errors that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* The outer cast must be a reinterpret_cast. ++ The inner cast: When the function is defined as a set of overloaded ++ functions, it works as a static_cast<>, choosing the designated variant. ++ When the function is defined as a single variant, it works as a ++ reinterpret_cast<>. The parenthesized cast syntax works both ways. */ ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast( \ ++ (rettype2(*)parameters2)(::func)); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN (func); ++ causes a warning to be emitted when ::func is used but not when ++ GNULIB_NAMESPACE::func is used. func must be defined without overloaded ++ variants. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN(func) \ ++ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN_1(func,namespace) \ ++ _GL_CXXALIASWARN_2 (func, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_WARN_ON_USE (func, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN(func) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); ++ causes a warning to be emitted when the given overloaded variant of ::func ++ is used but not when GNULIB_NAMESPACE::func is used. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ ++ GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++#endif /* _GL_CXXDEFS_H */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools ++ that the values passed as arguments n, ..., m must be non-NULL pointers. ++ n = 1 stands for the first argument, n = 2 for the second argument etc. */ ++#ifndef _GL_ARG_NONNULL ++# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 ++# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) ++# else ++# define _GL_ARG_NONNULL(params) ++# endif ++#endif ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++#ifndef _GL_WARN_ON_USE ++ ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++/* A compiler attribute is available in gcc versions 4.3.0 and later. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function __attribute__ ((__warning__ (message))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE(function, message) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") ++ is like _GL_WARN_ON_USE (function, "string"), except that the function is ++ declared with the given prototype, consisting of return type, parameters, ++ and attributes. ++ This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does ++ not work in this case. */ ++#ifndef _GL_WARN_ON_USE_CXX ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes \ ++ __attribute__ ((__warning__ (msg))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#ifndef _GL_WARN_EXTERN_C ++# if defined __cplusplus ++# define _GL_WARN_EXTERN_C extern "C" ++# else ++# define _GL_WARN_EXTERN_C extern ++# endif ++#endif ++ ++# ifdef __cplusplus ++extern "C" { ++# endif ++ ++# if ! 1 ++ ++# if !GNULIB_defined_struct_timeval ++struct timeval ++{ ++ time_t tv_sec; ++ long int tv_usec; ++}; ++# define GNULIB_defined_struct_timeval 1 ++# endif ++ ++# endif ++ ++# ifdef __cplusplus ++} ++# endif ++ ++# if 1 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef gettimeofday ++# define gettimeofday rpl_gettimeofday ++# endif ++_GL_FUNCDECL_RPL (gettimeofday, int, ++ (struct timeval *restrict, void *restrict) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (gettimeofday, int, ++ (struct timeval *restrict, void *restrict)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (gettimeofday, int, ++ (struct timeval *restrict, void *restrict) ++ _GL_ARG_NONNULL ((1))); ++# endif ++/* Need to cast, because on glibc systems, by default, the second argument is ++ struct timezone *. */ ++_GL_CXXALIAS_SYS_CAST (gettimeofday, int, ++ (struct timeval *restrict, void *restrict)); ++# endif ++_GL_CXXALIASWARN (gettimeofday); ++# elif defined GNULIB_POSIXCHECK ++# undef gettimeofday ++# if HAVE_RAW_DECL_GETTIMEOFDAY ++_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " ++ "use gnulib module gettimeofday for portability"); ++# endif ++# endif ++ ++/* Hide some function declarations from . */ ++ ++# if defined _MSC_VER && 0 ++# if !defined _GL_UNISTD_H ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef close ++# define close close_used_without_including_unistd_h ++# else ++ _GL_WARN_ON_USE (close, ++ "close() used without including "); ++# endif ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef gethostname ++# define gethostname gethostname_used_without_including_unistd_h ++# else ++ _GL_WARN_ON_USE (gethostname, ++ "gethostname() used without including "); ++# endif ++# endif ++# if !defined _GL_SYS_SOCKET_H ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef socket ++# define socket socket_used_without_including_sys_socket_h ++# undef connect ++# define connect connect_used_without_including_sys_socket_h ++# undef accept ++# define accept accept_used_without_including_sys_socket_h ++# undef bind ++# define bind bind_used_without_including_sys_socket_h ++# undef getpeername ++# define getpeername getpeername_used_without_including_sys_socket_h ++# undef getsockname ++# define getsockname getsockname_used_without_including_sys_socket_h ++# undef getsockopt ++# define getsockopt getsockopt_used_without_including_sys_socket_h ++# undef listen ++# define listen listen_used_without_including_sys_socket_h ++# undef recv ++# define recv recv_used_without_including_sys_socket_h ++# undef send ++# define send send_used_without_including_sys_socket_h ++# undef recvfrom ++# define recvfrom recvfrom_used_without_including_sys_socket_h ++# undef sendto ++# define sendto sendto_used_without_including_sys_socket_h ++# undef setsockopt ++# define setsockopt setsockopt_used_without_including_sys_socket_h ++# undef shutdown ++# define shutdown shutdown_used_without_including_sys_socket_h ++# else ++ _GL_WARN_ON_USE (socket, ++ "socket() used without including "); ++ _GL_WARN_ON_USE (connect, ++ "connect() used without including "); ++ _GL_WARN_ON_USE (accept, ++ "accept() used without including "); ++ _GL_WARN_ON_USE (bind, ++ "bind() used without including "); ++ _GL_WARN_ON_USE (getpeername, ++ "getpeername() used without including "); ++ _GL_WARN_ON_USE (getsockname, ++ "getsockname() used without including "); ++ _GL_WARN_ON_USE (getsockopt, ++ "getsockopt() used without including "); ++ _GL_WARN_ON_USE (listen, ++ "listen() used without including "); ++ _GL_WARN_ON_USE (recv, ++ "recv() used without including "); ++ _GL_WARN_ON_USE (send, ++ "send() used without including "); ++ _GL_WARN_ON_USE (recvfrom, ++ "recvfrom() used without including "); ++ _GL_WARN_ON_USE (sendto, ++ "sendto() used without including "); ++ _GL_WARN_ON_USE (setsockopt, ++ "setsockopt() used without including "); ++ _GL_WARN_ON_USE (shutdown, ++ "shutdown() used without including "); ++# endif ++# endif ++# if !defined _GL_SYS_SELECT_H ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef select ++# define select select_used_without_including_sys_select_h ++# else ++ _GL_WARN_ON_USE (select, ++ "select() used without including "); ++# endif ++# endif ++# endif ++ ++#endif /* _GL_SYS_TIME_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/sys/types.h b/xbmc/screensavers/rsxs-0.9/lib/sys/types.h +new file mode 100644 +index 0000000..066d464 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/sys/types.h +@@ -0,0 +1,41 @@ ++/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ ++/* Provide a more complete sys/types.h. ++ ++ Copyright (C) 2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#if __GNUC__ >= 3 ++#pragma GCC system_header ++#endif ++ ++ ++#ifndef _GL_SYS_TYPES_H ++ ++/* The include_next requires a split double-inclusion guard. */ ++#include_next ++ ++#ifndef _GL_SYS_TYPES_H ++#define _GL_SYS_TYPES_H ++ ++/* MSVC 9 defines size_t in , not in . */ ++/* But avoid namespace pollution on glibc systems. */ ++#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ ++ && ! defined __GLIBC__ ++# include ++#endif ++ ++#endif /* _GL_SYS_TYPES_H */ ++#endif /* _GL_SYS_TYPES_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/sys_time.in.h b/xbmc/screensavers/rsxs-0.9/lib/sys_time.in.h +new file mode 100644 +index 0000000..db4eeae +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/sys_time.in.h +@@ -0,0 +1,200 @@ ++/* Provide a more complete sys/time.h. ++ ++ Copyright (C) 2007-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* Written by Paul Eggert. */ ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++#if defined _@GUARD_PREFIX@_SYS_TIME_H ++ ++/* Simply delegate to the system's header, without adding anything. */ ++# if @HAVE_SYS_TIME_H@ ++# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ ++# endif ++ ++#else ++ ++# define _@GUARD_PREFIX@_SYS_TIME_H ++ ++# if @HAVE_SYS_TIME_H@ ++# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ ++# else ++# include ++# endif ++ ++/* On native Windows with MSVC: ++ Get the 'struct timeval' type. */ ++# if defined _MSC_VER && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H ++# define _GL_INCLUDING_WINSOCK2_H ++# include ++# undef _GL_INCLUDING_WINSOCK2_H ++# endif ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++ ++# ifdef __cplusplus ++extern "C" { ++# endif ++ ++# if ! @HAVE_STRUCT_TIMEVAL@ ++ ++# if !GNULIB_defined_struct_timeval ++struct timeval ++{ ++ time_t tv_sec; ++ long int tv_usec; ++}; ++# define GNULIB_defined_struct_timeval 1 ++# endif ++ ++# endif ++ ++# ifdef __cplusplus ++} ++# endif ++ ++# if @GNULIB_GETTIMEOFDAY@ ++# if @REPLACE_GETTIMEOFDAY@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef gettimeofday ++# define gettimeofday rpl_gettimeofday ++# endif ++_GL_FUNCDECL_RPL (gettimeofday, int, ++ (struct timeval *restrict, void *restrict) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (gettimeofday, int, ++ (struct timeval *restrict, void *restrict)); ++# else ++# if !@HAVE_GETTIMEOFDAY@ ++_GL_FUNCDECL_SYS (gettimeofday, int, ++ (struct timeval *restrict, void *restrict) ++ _GL_ARG_NONNULL ((1))); ++# endif ++/* Need to cast, because on glibc systems, by default, the second argument is ++ struct timezone *. */ ++_GL_CXXALIAS_SYS_CAST (gettimeofday, int, ++ (struct timeval *restrict, void *restrict)); ++# endif ++_GL_CXXALIASWARN (gettimeofday); ++# elif defined GNULIB_POSIXCHECK ++# undef gettimeofday ++# if HAVE_RAW_DECL_GETTIMEOFDAY ++_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " ++ "use gnulib module gettimeofday for portability"); ++# endif ++# endif ++ ++/* Hide some function declarations from . */ ++ ++# if defined _MSC_VER && @HAVE_WINSOCK2_H@ ++# if !defined _@GUARD_PREFIX@_UNISTD_H ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef close ++# define close close_used_without_including_unistd_h ++# else ++ _GL_WARN_ON_USE (close, ++ "close() used without including "); ++# endif ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef gethostname ++# define gethostname gethostname_used_without_including_unistd_h ++# else ++ _GL_WARN_ON_USE (gethostname, ++ "gethostname() used without including "); ++# endif ++# endif ++# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef socket ++# define socket socket_used_without_including_sys_socket_h ++# undef connect ++# define connect connect_used_without_including_sys_socket_h ++# undef accept ++# define accept accept_used_without_including_sys_socket_h ++# undef bind ++# define bind bind_used_without_including_sys_socket_h ++# undef getpeername ++# define getpeername getpeername_used_without_including_sys_socket_h ++# undef getsockname ++# define getsockname getsockname_used_without_including_sys_socket_h ++# undef getsockopt ++# define getsockopt getsockopt_used_without_including_sys_socket_h ++# undef listen ++# define listen listen_used_without_including_sys_socket_h ++# undef recv ++# define recv recv_used_without_including_sys_socket_h ++# undef send ++# define send send_used_without_including_sys_socket_h ++# undef recvfrom ++# define recvfrom recvfrom_used_without_including_sys_socket_h ++# undef sendto ++# define sendto sendto_used_without_including_sys_socket_h ++# undef setsockopt ++# define setsockopt setsockopt_used_without_including_sys_socket_h ++# undef shutdown ++# define shutdown shutdown_used_without_including_sys_socket_h ++# else ++ _GL_WARN_ON_USE (socket, ++ "socket() used without including "); ++ _GL_WARN_ON_USE (connect, ++ "connect() used without including "); ++ _GL_WARN_ON_USE (accept, ++ "accept() used without including "); ++ _GL_WARN_ON_USE (bind, ++ "bind() used without including "); ++ _GL_WARN_ON_USE (getpeername, ++ "getpeername() used without including "); ++ _GL_WARN_ON_USE (getsockname, ++ "getsockname() used without including "); ++ _GL_WARN_ON_USE (getsockopt, ++ "getsockopt() used without including "); ++ _GL_WARN_ON_USE (listen, ++ "listen() used without including "); ++ _GL_WARN_ON_USE (recv, ++ "recv() used without including "); ++ _GL_WARN_ON_USE (send, ++ "send() used without including "); ++ _GL_WARN_ON_USE (recvfrom, ++ "recvfrom() used without including "); ++ _GL_WARN_ON_USE (sendto, ++ "sendto() used without including "); ++ _GL_WARN_ON_USE (setsockopt, ++ "setsockopt() used without including "); ++ _GL_WARN_ON_USE (shutdown, ++ "shutdown() used without including "); ++# endif ++# endif ++# if !defined _@GUARD_PREFIX@_SYS_SELECT_H ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef select ++# define select select_used_without_including_sys_select_h ++# else ++ _GL_WARN_ON_USE (select, ++ "select() used without including "); ++# endif ++# endif ++# endif ++ ++#endif /* _@GUARD_PREFIX@_SYS_TIME_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/sys_types.in.h b/xbmc/screensavers/rsxs-0.9/lib/sys_types.in.h +new file mode 100644 +index 0000000..63389de +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/sys_types.in.h +@@ -0,0 +1,40 @@ ++/* Provide a more complete sys/types.h. ++ ++ Copyright (C) 2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++#ifndef _@GUARD_PREFIX@_SYS_TYPES_H ++ ++/* The include_next requires a split double-inclusion guard. */ ++#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ ++ ++#ifndef _@GUARD_PREFIX@_SYS_TYPES_H ++#define _@GUARD_PREFIX@_SYS_TYPES_H ++ ++/* MSVC 9 defines size_t in , not in . */ ++/* But avoid namespace pollution on glibc systems. */ ++#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ ++ && ! defined __GLIBC__ ++# include ++#endif ++ ++#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ ++#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/sysexits.in.h b/xbmc/screensavers/rsxs-0.9/lib/sysexits.in.h +new file mode 100644 +index 0000000..f925b69 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/sysexits.in.h +@@ -0,0 +1,72 @@ ++/* exit() exit codes for some BSD system programs. ++ Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Simon Josefsson based on sysexits(3) man page */ ++ ++#ifndef _@GUARD_PREFIX@_SYSEXITS_H ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++#if @HAVE_SYSEXITS_H@ ++ ++/* IRIX 6.5 has an that defines a macro EX_OK with a nonzero ++ value. Override it. See ++ */ ++# ifdef __sgi ++# include ++# undef EX_OK ++# endif ++ ++/* The include_next requires a split double-inclusion guard. */ ++# @INCLUDE_NEXT@ @NEXT_SYSEXITS_H@ ++ ++/* HP-UX 11 ends at EX_NOPERM. */ ++# ifndef EX_CONFIG ++# define EX_CONFIG 78 ++# endif ++ ++#endif ++ ++#ifndef _@GUARD_PREFIX@_SYSEXITS_H ++#define _@GUARD_PREFIX@_SYSEXITS_H ++ ++#if !@HAVE_SYSEXITS_H@ ++ ++# define EX_OK 0 /* same value as EXIT_SUCCESS */ ++ ++# define EX_USAGE 64 ++# define EX_DATAERR 65 ++# define EX_NOINPUT 66 ++# define EX_NOUSER 67 ++# define EX_NOHOST 68 ++# define EX_UNAVAILABLE 69 ++# define EX_SOFTWARE 70 ++# define EX_OSERR 71 ++# define EX_OSFILE 72 ++# define EX_CANTCREAT 73 ++# define EX_IOERR 74 ++# define EX_TEMPFAIL 75 ++# define EX_PROTOCOL 76 ++# define EX_NOPERM 77 ++# define EX_CONFIG 78 ++ ++#endif ++ ++#endif /* _@GUARD_PREFIX@_SYSEXITS_H */ ++#endif /* _@GUARD_PREFIX@_SYSEXITS_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/unistd.h b/xbmc/screensavers/rsxs-0.9/lib/unistd.h +new file mode 100644 +index 0000000..a739710 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/unistd.h +@@ -0,0 +1,1783 @@ ++/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ ++/* Substitute for and wrapper around . ++ Copyright (C) 2003-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#if __GNUC__ >= 3 ++#pragma GCC system_header ++#endif ++ ++ ++/* Special invocation convention: ++ - On mingw, several headers, including , include , ++ but we need to ensure that both the system and ++ are completely included before we replace gethostname. */ ++#if 0 && 0 \ ++ && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H ++/* is being indirectly included for the first time from ++ ; avoid declaring any overrides. */ ++# if 1 ++# include_next ++# else ++# error unexpected; report this to bug-gnulib@gnu.org ++# endif ++# define _GL_WINSOCK2_H_WITNESS ++ ++/* Normal invocation. */ ++#elif !defined _GL_UNISTD_H ++ ++/* The include_next requires a split double-inclusion guard. */ ++#if 1 ++# include_next ++#endif ++ ++/* Get all possible declarations of gethostname(). */ ++#if 0 && 0 \ ++ && !defined _GL_INCLUDING_WINSOCK2_H ++# define _GL_INCLUDING_WINSOCK2_H ++# include ++# undef _GL_INCLUDING_WINSOCK2_H ++#endif ++ ++#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H ++#define _GL_UNISTD_H ++ ++/* NetBSD 5.0 mis-defines NULL. Also get size_t. */ ++#include ++ ++/* mingw doesn't define the SEEK_* or *_FILENO macros in . */ ++/* Cygwin 1.7.1 declares symlinkat in , not in . */ ++/* But avoid namespace pollution on glibc systems. */ ++#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ ++ || ((0 || defined GNULIB_POSIXCHECK) \ ++ && defined __CYGWIN__)) \ ++ && ! defined __GLIBC__ ++# include ++#endif ++ ++/* Cygwin 1.7.1 declares unlinkat in , not in . */ ++/* But avoid namespace pollution on glibc systems. */ ++#if (0 || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \ ++ && ! defined __GLIBC__ ++# include ++#endif ++ ++/* mingw fails to declare _exit in . */ ++/* mingw, MSVC, BeOS, Haiku declare environ in , not in ++ . */ ++/* Solaris declares getcwd not only in but also in . */ ++/* But avoid namespace pollution on glibc systems. */ ++#ifndef __GLIBC__ ++# include ++#endif ++ ++/* Native Windows platforms declare chdir, getcwd, rmdir in ++ and/or , not in . */ ++#if ((0 || 0 || 0 \ ++ || defined GNULIB_POSIXCHECK) \ ++ && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) ++# include /* mingw32, mingw64 */ ++# include /* mingw64, MSVC 9 */ ++#endif ++ ++/* AIX and OSF/1 5.1 declare getdomainname in , not in . ++ NonStop Kernel declares gethostname in , not in . */ ++/* But avoid namespace pollution on glibc systems. */ ++#if ((0 && (defined _AIX || defined __osf__)) \ ++ || (0 && defined __TANDEM)) \ ++ && !defined __GLIBC__ ++# include ++#endif ++ ++/* MSVC defines off_t in . */ ++#if !1 ++/* Get off_t. */ ++# include ++#endif ++ ++#if (0 || 0 \ ++ || 0 || 0 \ ++ || 0 || 0 || defined GNULIB_POSIXCHECK) ++/* Get ssize_t. */ ++# include ++#endif ++ ++/* Get getopt(), optarg, optind, opterr, optopt. ++ But avoid namespace pollution on glibc systems. */ ++#if 01 && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT ++# include ++#endif ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++#ifndef _GL_CXXDEFS_H ++#define _GL_CXXDEFS_H ++ ++/* The three most frequent use cases of these macros are: ++ ++ * For providing a substitute for a function that is missing on some ++ platforms, but is declared and works fine on the platforms on which ++ it exists: ++ ++ #if @GNULIB_FOO@ ++ # if !@HAVE_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on all platforms, ++ but is broken/insufficient and needs to be replaced on some platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on some platforms ++ but is broken/insufficient and needs to be replaced on some of them and ++ is additionally either missing or undeclared on some other platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++*/ ++ ++/* _GL_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#if defined __cplusplus ++# define _GL_EXTERN_C extern "C" ++#else ++# define _GL_EXTERN_C extern ++#endif ++ ++/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); ++ declares a replacement function, named rpl_func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ ++ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) ++#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype rpl_func parameters_and_attributes ++ ++/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); ++ declares the system function, named func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype func parameters_and_attributes ++ ++/* _GL_CXXALIAS_RPL (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. ++ Example: ++ _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); ++ */ ++#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ ++ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = ::rpl_func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); ++ is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); ++ except that the C function rpl_func may have a slightly different ++ declaration. A cast is used to silence the "invalid conversion" error ++ that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = \ ++ reinterpret_cast(::rpl_func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to the system provided function func, if GNULIB_NAMESPACE ++ is defined. ++ Example: ++ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); ++ */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* If we were to write ++ rettype (*const func) parameters = ::func; ++ like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls ++ better (remove an indirection through a 'static' pointer variable), ++ but then the _GL_CXXALIASWARN macro below would cause a warning not only ++ for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = ::func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function func may have a slightly different declaration. ++ A cast is used to silence the "invalid conversion" error that would ++ otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast(::func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function is picked among a set of overloaded functions, ++ namely the one with rettype2 and parameters2. Two consecutive casts ++ are used to silence the "cannot find a match" and "invalid conversion" ++ errors that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* The outer cast must be a reinterpret_cast. ++ The inner cast: When the function is defined as a set of overloaded ++ functions, it works as a static_cast<>, choosing the designated variant. ++ When the function is defined as a single variant, it works as a ++ reinterpret_cast<>. The parenthesized cast syntax works both ways. */ ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast( \ ++ (rettype2(*)parameters2)(::func)); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN (func); ++ causes a warning to be emitted when ::func is used but not when ++ GNULIB_NAMESPACE::func is used. func must be defined without overloaded ++ variants. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN(func) \ ++ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN_1(func,namespace) \ ++ _GL_CXXALIASWARN_2 (func, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_WARN_ON_USE (func, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN(func) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); ++ causes a warning to be emitted when the given overloaded variant of ::func ++ is used but not when GNULIB_NAMESPACE::func is used. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ ++ GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++#endif /* _GL_CXXDEFS_H */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools ++ that the values passed as arguments n, ..., m must be non-NULL pointers. ++ n = 1 stands for the first argument, n = 2 for the second argument etc. */ ++#ifndef _GL_ARG_NONNULL ++# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 ++# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) ++# else ++# define _GL_ARG_NONNULL(params) ++# endif ++#endif ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++#ifndef _GL_WARN_ON_USE ++ ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++/* A compiler attribute is available in gcc versions 4.3.0 and later. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function __attribute__ ((__warning__ (message))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE(function, message) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") ++ is like _GL_WARN_ON_USE (function, "string"), except that the function is ++ declared with the given prototype, consisting of return type, parameters, ++ and attributes. ++ This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does ++ not work in this case. */ ++#ifndef _GL_WARN_ON_USE_CXX ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes \ ++ __attribute__ ((__warning__ (msg))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#ifndef _GL_WARN_EXTERN_C ++# if defined __cplusplus ++# define _GL_WARN_EXTERN_C extern "C" ++# else ++# define _GL_WARN_EXTERN_C extern ++# endif ++#endif ++ ++ ++/* Hide some function declarations from . */ ++ ++#if 0 && 0 ++# if !defined _GL_SYS_SOCKET_H ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef socket ++# define socket socket_used_without_including_sys_socket_h ++# undef connect ++# define connect connect_used_without_including_sys_socket_h ++# undef accept ++# define accept accept_used_without_including_sys_socket_h ++# undef bind ++# define bind bind_used_without_including_sys_socket_h ++# undef getpeername ++# define getpeername getpeername_used_without_including_sys_socket_h ++# undef getsockname ++# define getsockname getsockname_used_without_including_sys_socket_h ++# undef getsockopt ++# define getsockopt getsockopt_used_without_including_sys_socket_h ++# undef listen ++# define listen listen_used_without_including_sys_socket_h ++# undef recv ++# define recv recv_used_without_including_sys_socket_h ++# undef send ++# define send send_used_without_including_sys_socket_h ++# undef recvfrom ++# define recvfrom recvfrom_used_without_including_sys_socket_h ++# undef sendto ++# define sendto sendto_used_without_including_sys_socket_h ++# undef setsockopt ++# define setsockopt setsockopt_used_without_including_sys_socket_h ++# undef shutdown ++# define shutdown shutdown_used_without_including_sys_socket_h ++# else ++ _GL_WARN_ON_USE (socket, ++ "socket() used without including "); ++ _GL_WARN_ON_USE (connect, ++ "connect() used without including "); ++ _GL_WARN_ON_USE (accept, ++ "accept() used without including "); ++ _GL_WARN_ON_USE (bind, ++ "bind() used without including "); ++ _GL_WARN_ON_USE (getpeername, ++ "getpeername() used without including "); ++ _GL_WARN_ON_USE (getsockname, ++ "getsockname() used without including "); ++ _GL_WARN_ON_USE (getsockopt, ++ "getsockopt() used without including "); ++ _GL_WARN_ON_USE (listen, ++ "listen() used without including "); ++ _GL_WARN_ON_USE (recv, ++ "recv() used without including "); ++ _GL_WARN_ON_USE (send, ++ "send() used without including "); ++ _GL_WARN_ON_USE (recvfrom, ++ "recvfrom() used without including "); ++ _GL_WARN_ON_USE (sendto, ++ "sendto() used without including "); ++ _GL_WARN_ON_USE (setsockopt, ++ "setsockopt() used without including "); ++ _GL_WARN_ON_USE (shutdown, ++ "shutdown() used without including "); ++# endif ++# endif ++# if !defined _GL_SYS_SELECT_H ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef select ++# define select select_used_without_including_sys_select_h ++# else ++ _GL_WARN_ON_USE (select, ++ "select() used without including "); ++# endif ++# endif ++#endif ++ ++ ++/* OS/2 EMX lacks these macros. */ ++#ifndef STDIN_FILENO ++# define STDIN_FILENO 0 ++#endif ++#ifndef STDOUT_FILENO ++# define STDOUT_FILENO 1 ++#endif ++#ifndef STDERR_FILENO ++# define STDERR_FILENO 2 ++#endif ++ ++/* Ensure *_OK macros exist. */ ++#ifndef F_OK ++# define F_OK 0 ++# define X_OK 1 ++# define W_OK 2 ++# define R_OK 4 ++#endif ++ ++ ++/* Declare overridden functions. */ ++ ++ ++#if defined GNULIB_POSIXCHECK ++/* The access() function is a security risk. */ ++_GL_WARN_ON_USE (access, "the access function is a security risk - " ++ "use the gnulib module faccessat instead"); ++#endif ++ ++ ++#if 0 ++_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIASWARN (chdir); ++#elif defined GNULIB_POSIXCHECK ++# undef chdir ++# if HAVE_RAW_DECL_CHDIR ++_GL_WARN_ON_USE (chown, "chdir is not always in - " ++ "use gnulib module chdir for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE ++ to GID (if GID is not -1). Follow symbolic links. ++ Return 0 if successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define dup2 rpl_dup2 ++# endif ++_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); ++_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd)); ++# endif ++_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); ++# endif ++_GL_CXXALIASWARN (dup2); ++#elif defined GNULIB_POSIXCHECK ++# undef dup2 ++# if HAVE_RAW_DECL_DUP2 ++_GL_WARN_ON_USE (dup2, "dup2 is unportable - " ++ "use gnulib module dup2 for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the ++ specified flags. ++ The flags are a bitmask, possibly including O_CLOEXEC (defined in ) ++ and O_TEXT, O_BINARY (defined in "binary-io.h"). ++ Close NEWFD first if it is open. ++ Return newfd if successful, otherwise -1 and errno set. ++ See the Linux man page at ++ . */ ++# if 1 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define dup3 rpl_dup3 ++# endif ++_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); ++_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); ++# else ++_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); ++_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); ++# endif ++_GL_CXXALIASWARN (dup3); ++#elif defined GNULIB_POSIXCHECK ++# undef dup3 ++# if HAVE_RAW_DECL_DUP3 ++_GL_WARN_ON_USE (dup3, "dup3 is unportable - " ++ "use gnulib module dup3 for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++# if !1 ++/* Set of environment variables and values. An array of strings of the form ++ "VARIABLE=VALUE", terminated with a NULL. */ ++# if defined __APPLE__ && defined __MACH__ ++# include ++# define environ (*_NSGetEnviron ()) ++# else ++# ifdef __cplusplus ++extern "C" { ++# endif ++extern char **environ; ++# ifdef __cplusplus ++} ++# endif ++# endif ++# endif ++#elif defined GNULIB_POSIXCHECK ++# if HAVE_RAW_DECL_ENVIRON ++static inline char *** ++rpl_environ (void) ++{ ++ return &environ; ++} ++_GL_WARN_ON_USE (rpl_environ, "environ is unportable - " ++ "use gnulib module environ for portability"); ++# undef environ ++# define environ (*rpl_environ ()) ++# endif ++#endif ++ ++ ++#if 0 ++/* Like access(), except that it uses the effective user id and group id of ++ the current process. */ ++# if !1 ++_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); ++_GL_CXXALIASWARN (euidaccess); ++# if defined GNULIB_POSIXCHECK ++/* Like access(), this function is a security risk. */ ++_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " ++ "use the gnulib module faccessat instead"); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef euidaccess ++# if HAVE_RAW_DECL_EUIDACCESS ++_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " ++ "use gnulib module euidaccess for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (faccessat, int, ++ (int fd, char const *file, int mode, int flag) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (faccessat, int, ++ (int fd, char const *file, int mode, int flag)); ++_GL_CXXALIASWARN (faccessat); ++#elif defined GNULIB_POSIXCHECK ++# undef faccessat ++# if HAVE_RAW_DECL_FACCESSAT ++_GL_WARN_ON_USE (faccessat, "faccessat is not portable - " ++ "use gnulib module faccessat for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Change the process' current working directory to the directory on which ++ the given file descriptor is open. ++ Return 0 if successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if ! 1 ++_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); ++ ++/* Gnulib internal hooks needed to maintain the fchdir metadata. */ ++_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) ++ _GL_ARG_NONNULL ((2)); ++_GL_EXTERN_C void _gl_unregister_fd (int fd); ++_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); ++_GL_EXTERN_C const char *_gl_directory_name (int fd); ++ ++# else ++# if !1 ++_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); ++# endif ++# endif ++_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); ++_GL_CXXALIASWARN (fchdir); ++#elif defined GNULIB_POSIXCHECK ++# undef fchdir ++# if HAVE_RAW_DECL_FCHDIR ++_GL_WARN_ON_USE (fchdir, "fchdir is unportable - " ++ "use gnulib module fchdir for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fchownat ++# define fchownat rpl_fchownat ++# endif ++_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, ++ uid_t owner, gid_t group, int flag) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, ++ uid_t owner, gid_t group, int flag)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, ++ uid_t owner, gid_t group, int flag) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, ++ uid_t owner, gid_t group, int flag)); ++# endif ++_GL_CXXALIASWARN (fchownat); ++#elif defined GNULIB_POSIXCHECK ++# undef fchownat ++# if HAVE_RAW_DECL_FCHOWNAT ++_GL_WARN_ON_USE (fchownat, "fchownat is not portable - " ++ "use gnulib module openat for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Synchronize changes to a file. ++ Return 0 if successful, otherwise -1 and errno set. ++ See POSIX:2008 specification ++ . */ ++# if !1 || !1 ++_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); ++# endif ++_GL_CXXALIAS_SYS (fdatasync, int, (int fd)); ++_GL_CXXALIASWARN (fdatasync); ++#elif defined GNULIB_POSIXCHECK ++# undef fdatasync ++# if HAVE_RAW_DECL_FDATASYNC ++_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " ++ "use gnulib module fdatasync for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Synchronize changes, including metadata, to a file. ++ Return 0 if successful, otherwise -1 and errno set. ++ See POSIX:2008 specification ++ . */ ++# if !1 ++_GL_FUNCDECL_SYS (fsync, int, (int fd)); ++# endif ++_GL_CXXALIAS_SYS (fsync, int, (int fd)); ++_GL_CXXALIASWARN (fsync); ++#elif defined GNULIB_POSIXCHECK ++# undef fsync ++# if HAVE_RAW_DECL_FSYNC ++_GL_WARN_ON_USE (fsync, "fsync is unportable - " ++ "use gnulib module fsync for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Change the size of the file to which FD is opened to become equal to LENGTH. ++ Return 0 if successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if !1 ++_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); ++# endif ++_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); ++_GL_CXXALIASWARN (ftruncate); ++#elif defined GNULIB_POSIXCHECK ++# undef ftruncate ++# if HAVE_RAW_DECL_FTRUNCATE ++_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " ++ "use gnulib module ftruncate for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Get the name of the current working directory, and put it in SIZE bytes ++ of BUF. ++ Return BUF if successful, or NULL if the directory couldn't be determined ++ or SIZE was too small. ++ See the POSIX:2008 specification ++ . ++ Additionally, the gnulib module 'getcwd' guarantees the following GNU ++ extension: If BUF is NULL, an array is allocated with 'malloc'; the array ++ is SIZE bytes long, unless SIZE == 0, in which case it is as big as ++ necessary. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define getcwd rpl_getcwd ++# endif ++_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); ++_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); ++# else ++/* Need to cast, because on mingw, the second parameter is ++ int size. */ ++_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); ++# endif ++_GL_CXXALIASWARN (getcwd); ++#elif defined GNULIB_POSIXCHECK ++# undef getcwd ++# if HAVE_RAW_DECL_GETCWD ++_GL_WARN_ON_USE (getcwd, "getcwd is unportable - " ++ "use gnulib module getcwd for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Return the NIS domain name of the machine. ++ WARNING! The NIS domain name is unrelated to the fully qualified host name ++ of the machine. It is also unrelated to email addresses. ++ WARNING! The NIS domain name is usually the empty string or "(none)" when ++ not using NIS. ++ ++ Put up to LEN bytes of the NIS domain name into NAME. ++ Null terminate it if the name is shorter than LEN. ++ If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. ++ Return 0 if successful, otherwise set errno and return -1. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef getdomainname ++# define getdomainname rpl_getdomainname ++# endif ++_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); ++# endif ++_GL_CXXALIASWARN (getdomainname); ++#elif defined GNULIB_POSIXCHECK ++# undef getdomainname ++# if HAVE_RAW_DECL_GETDOMAINNAME ++_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " ++ "use gnulib module getdomainname for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Return the maximum number of file descriptors in the current process. ++ In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ ++# if !1 ++_GL_FUNCDECL_SYS (getdtablesize, int, (void)); ++# endif ++_GL_CXXALIAS_SYS (getdtablesize, int, (void)); ++_GL_CXXALIASWARN (getdtablesize); ++#elif defined GNULIB_POSIXCHECK ++# undef getdtablesize ++# if HAVE_RAW_DECL_GETDTABLESIZE ++_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " ++ "use gnulib module getdtablesize for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Return the supplemental groups that the current process belongs to. ++ It is unspecified whether the effective group id is in the list. ++ If N is 0, return the group count; otherwise, N describes how many ++ entries are available in GROUPS. Return -1 and set errno if N is ++ not 0 and not large enough. Fails with ENOSYS on some systems. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef getgroups ++# define getgroups rpl_getgroups ++# endif ++_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); ++_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); ++# endif ++_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); ++# endif ++_GL_CXXALIASWARN (getgroups); ++#elif defined GNULIB_POSIXCHECK ++# undef getgroups ++# if HAVE_RAW_DECL_GETGROUPS ++_GL_WARN_ON_USE (getgroups, "getgroups is unportable - " ++ "use gnulib module getgroups for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Return the standard host name of the machine. ++ WARNING! The host name may or may not be fully qualified. ++ ++ Put up to LEN bytes of the host name into NAME. ++ Null terminate it if the name is shorter than LEN. ++ If the host name is longer than LEN, set errno = EINVAL and return -1. ++ Return 0 if successful, otherwise set errno and return -1. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef gethostname ++# define gethostname rpl_gethostname ++# endif ++_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) ++ _GL_ARG_NONNULL ((1))); ++# endif ++/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second ++ parameter is ++ int len. */ ++_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); ++# endif ++_GL_CXXALIASWARN (gethostname); ++#elif 0 ++# undef gethostname ++# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname ++#elif defined GNULIB_POSIXCHECK ++# undef gethostname ++# if HAVE_RAW_DECL_GETHOSTNAME ++_GL_WARN_ON_USE (gethostname, "gethostname is unportable - " ++ "use gnulib module gethostname for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Returns the user's login name, or NULL if it cannot be found. Upon error, ++ returns NULL with errno set. ++ ++ See . ++ ++ Most programs don't need to use this function, because the information is ++ available through environment variables: ++ ${LOGNAME-$USER} on Unix platforms, ++ $USERNAME on native Windows platforms. ++ */ ++# if !1 ++_GL_FUNCDECL_SYS (getlogin, char *, (void)); ++# endif ++_GL_CXXALIAS_SYS (getlogin, char *, (void)); ++_GL_CXXALIASWARN (getlogin); ++#elif defined GNULIB_POSIXCHECK ++# undef getlogin ++# if HAVE_RAW_DECL_GETLOGIN ++_GL_WARN_ON_USE (getlogin, "getlogin is unportable - " ++ "use gnulib module getlogin for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Copies the user's login name to NAME. ++ The array pointed to by NAME has room for SIZE bytes. ++ ++ Returns 0 if successful. Upon error, an error number is returned, or -1 in ++ the case that the login name cannot be found but no specific error is ++ provided (this case is hopefully rare but is left open by the POSIX spec). ++ ++ See . ++ ++ Most programs don't need to use this function, because the information is ++ available through environment variables: ++ ${LOGNAME-$USER} on Unix platforms, ++ $USERNAME on native Windows platforms. ++ */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define getlogin_r rpl_getlogin_r ++# endif ++_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) ++ _GL_ARG_NONNULL ((1))); ++# endif ++/* Need to cast, because on Solaris 10 systems, the second argument is ++ int size. */ ++_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); ++# endif ++_GL_CXXALIASWARN (getlogin_r); ++#elif defined GNULIB_POSIXCHECK ++# undef getlogin_r ++# if HAVE_RAW_DECL_GETLOGIN_R ++_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " ++ "use gnulib module getlogin_r for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define getpagesize rpl_getpagesize ++# endif ++_GL_FUNCDECL_RPL (getpagesize, int, (void)); ++_GL_CXXALIAS_RPL (getpagesize, int, (void)); ++# else ++# if !1 ++# if !defined getpagesize ++/* This is for POSIX systems. */ ++# if !defined _gl_getpagesize && defined _SC_PAGESIZE ++# if ! (defined __VMS && __VMS_VER < 70000000) ++# define _gl_getpagesize() sysconf (_SC_PAGESIZE) ++# endif ++# endif ++/* This is for older VMS. */ ++# if !defined _gl_getpagesize && defined __VMS ++# ifdef __ALPHA ++# define _gl_getpagesize() 8192 ++# else ++# define _gl_getpagesize() 512 ++# endif ++# endif ++/* This is for BeOS. */ ++# if !defined _gl_getpagesize && 0 ++# include ++# if defined B_PAGE_SIZE ++# define _gl_getpagesize() B_PAGE_SIZE ++# endif ++# endif ++/* This is for AmigaOS4.0. */ ++# if !defined _gl_getpagesize && defined __amigaos4__ ++# define _gl_getpagesize() 2048 ++# endif ++/* This is for older Unix systems. */ ++# if !defined _gl_getpagesize && 0 ++# include ++# ifdef EXEC_PAGESIZE ++# define _gl_getpagesize() EXEC_PAGESIZE ++# else ++# ifdef NBPG ++# ifndef CLSIZE ++# define CLSIZE 1 ++# endif ++# define _gl_getpagesize() (NBPG * CLSIZE) ++# else ++# ifdef NBPC ++# define _gl_getpagesize() NBPC ++# endif ++# endif ++# endif ++# endif ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define getpagesize() _gl_getpagesize () ++# else ++# if !GNULIB_defined_getpagesize_function ++static inline int ++getpagesize () ++{ ++ return _gl_getpagesize (); ++} ++# define GNULIB_defined_getpagesize_function 1 ++# endif ++# endif ++# endif ++# endif ++/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ ++_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); ++# endif ++# if 1 ++_GL_CXXALIASWARN (getpagesize); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef getpagesize ++# if HAVE_RAW_DECL_GETPAGESIZE ++_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " ++ "use gnulib module getpagesize for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Return the next valid login shell on the system, or NULL when the end of ++ the list has been reached. */ ++# if !1 ++_GL_FUNCDECL_SYS (getusershell, char *, (void)); ++# endif ++_GL_CXXALIAS_SYS (getusershell, char *, (void)); ++_GL_CXXALIASWARN (getusershell); ++#elif defined GNULIB_POSIXCHECK ++# undef getusershell ++# if HAVE_RAW_DECL_GETUSERSHELL ++_GL_WARN_ON_USE (getusershell, "getusershell is unportable - " ++ "use gnulib module getusershell for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Rewind to pointer that is advanced at each getusershell() call. */ ++# if !1 ++_GL_FUNCDECL_SYS (setusershell, void, (void)); ++# endif ++_GL_CXXALIAS_SYS (setusershell, void, (void)); ++_GL_CXXALIASWARN (setusershell); ++#elif defined GNULIB_POSIXCHECK ++# undef setusershell ++# if HAVE_RAW_DECL_SETUSERSHELL ++_GL_WARN_ON_USE (setusershell, "setusershell is unportable - " ++ "use gnulib module getusershell for portability"); ++# endif ++#endif ++ ++#if 0 ++/* Free the pointer that is advanced at each getusershell() call and ++ associated resources. */ ++# if !1 ++_GL_FUNCDECL_SYS (endusershell, void, (void)); ++# endif ++_GL_CXXALIAS_SYS (endusershell, void, (void)); ++_GL_CXXALIASWARN (endusershell); ++#elif defined GNULIB_POSIXCHECK ++# undef endusershell ++# if HAVE_RAW_DECL_ENDUSERSHELL ++_GL_WARN_ON_USE (endusershell, "endusershell is unportable - " ++ "use gnulib module getusershell for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Determine whether group id is in calling user's group list. */ ++# if !1 ++_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); ++# endif ++_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); ++_GL_CXXALIASWARN (group_member); ++#elif defined GNULIB_POSIXCHECK ++# undef group_member ++# if HAVE_RAW_DECL_GROUP_MEMBER ++_GL_WARN_ON_USE (group_member, "group_member is unportable - " ++ "use gnulib module group-member for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE ++ to GID (if GID is not -1). Do not follow symbolic links. ++ Return 0 if successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef lchown ++# define lchown rpl_lchown ++# endif ++_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); ++# endif ++_GL_CXXALIASWARN (lchown); ++#elif defined GNULIB_POSIXCHECK ++# undef lchown ++# if HAVE_RAW_DECL_LCHOWN ++_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " ++ "use gnulib module lchown for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Create a new hard link for an existing file. ++ Return 0 if successful, otherwise -1 and errno set. ++ See POSIX:2008 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define link rpl_link ++# endif ++_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); ++# endif ++_GL_CXXALIASWARN (link); ++#elif defined GNULIB_POSIXCHECK ++# undef link ++# if HAVE_RAW_DECL_LINK ++_GL_WARN_ON_USE (link, "link is unportable - " ++ "use gnulib module link for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Create a new hard link for an existing file, relative to two ++ directories. FLAG controls whether symlinks are followed. ++ Return 0 if successful, otherwise -1 and errno set. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef linkat ++# define linkat rpl_linkat ++# endif ++_GL_FUNCDECL_RPL (linkat, int, ++ (int fd1, const char *path1, int fd2, const char *path2, ++ int flag) ++ _GL_ARG_NONNULL ((2, 4))); ++_GL_CXXALIAS_RPL (linkat, int, ++ (int fd1, const char *path1, int fd2, const char *path2, ++ int flag)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (linkat, int, ++ (int fd1, const char *path1, int fd2, const char *path2, ++ int flag) ++ _GL_ARG_NONNULL ((2, 4))); ++# endif ++_GL_CXXALIAS_SYS (linkat, int, ++ (int fd1, const char *path1, int fd2, const char *path2, ++ int flag)); ++# endif ++_GL_CXXALIASWARN (linkat); ++#elif defined GNULIB_POSIXCHECK ++# undef linkat ++# if HAVE_RAW_DECL_LINKAT ++_GL_WARN_ON_USE (linkat, "linkat is unportable - " ++ "use gnulib module linkat for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. ++ Return the new offset if successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define lseek rpl_lseek ++# endif ++_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); ++_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); ++# else ++_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); ++# endif ++_GL_CXXALIASWARN (lseek); ++#elif defined GNULIB_POSIXCHECK ++# undef lseek ++# if HAVE_RAW_DECL_LSEEK ++_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " ++ "systems - use gnulib module lseek for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Create a pipe, defaulting to O_BINARY mode. ++ Store the read-end as fd[0] and the write-end as fd[1]. ++ Return 0 upon success, or -1 with errno set upon failure. */ ++# if !1 ++_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); ++_GL_CXXALIASWARN (pipe); ++#elif defined GNULIB_POSIXCHECK ++# undef pipe ++# if HAVE_RAW_DECL_PIPE ++_GL_WARN_ON_USE (pipe, "pipe is unportable - " ++ "use gnulib module pipe-posix for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Create a pipe, applying the given flags when opening the read-end of the ++ pipe and the write-end of the pipe. ++ The flags are a bitmask, possibly including O_CLOEXEC (defined in ) ++ and O_TEXT, O_BINARY (defined in "binary-io.h"). ++ Store the read-end as fd[0] and the write-end as fd[1]. ++ Return 0 upon success, or -1 with errno set upon failure. ++ See also the Linux man page at ++ . */ ++# if 1 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define pipe2 rpl_pipe2 ++# endif ++_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); ++# else ++_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); ++# endif ++_GL_CXXALIASWARN (pipe2); ++#elif defined GNULIB_POSIXCHECK ++# undef pipe2 ++# if HAVE_RAW_DECL_PIPE2 ++_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " ++ "use gnulib module pipe2 for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. ++ Return the number of bytes placed into BUF if successful, otherwise ++ set errno and return -1. 0 indicates EOF. ++ See the POSIX:2008 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef pread ++# define pread rpl_pread ++# endif ++_GL_FUNCDECL_RPL (pread, ssize_t, ++ (int fd, void *buf, size_t bufsize, off_t offset) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (pread, ssize_t, ++ (int fd, void *buf, size_t bufsize, off_t offset)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (pread, ssize_t, ++ (int fd, void *buf, size_t bufsize, off_t offset) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (pread, ssize_t, ++ (int fd, void *buf, size_t bufsize, off_t offset)); ++# endif ++_GL_CXXALIASWARN (pread); ++#elif defined GNULIB_POSIXCHECK ++# undef pread ++# if HAVE_RAW_DECL_PREAD ++_GL_WARN_ON_USE (pread, "pread is unportable - " ++ "use gnulib module pread for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. ++ Return the number of bytes written if successful, otherwise ++ set errno and return -1. 0 indicates nothing written. See the ++ POSIX:2008 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef pwrite ++# define pwrite rpl_pwrite ++# endif ++_GL_FUNCDECL_RPL (pwrite, ssize_t, ++ (int fd, const void *buf, size_t bufsize, off_t offset) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (pwrite, ssize_t, ++ (int fd, const void *buf, size_t bufsize, off_t offset)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (pwrite, ssize_t, ++ (int fd, const void *buf, size_t bufsize, off_t offset) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (pwrite, ssize_t, ++ (int fd, const void *buf, size_t bufsize, off_t offset)); ++# endif ++_GL_CXXALIASWARN (pwrite); ++#elif defined GNULIB_POSIXCHECK ++# undef pwrite ++# if HAVE_RAW_DECL_PWRITE ++_GL_WARN_ON_USE (pwrite, "pwrite is unportable - " ++ "use gnulib module pwrite for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Read up to COUNT bytes from file descriptor FD into the buffer starting ++ at BUF. See the POSIX:2008 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef read ++# define read rpl_read ++# endif ++_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); ++# else ++/* Need to cast, because on mingw, the third parameter is ++ unsigned int count ++ and the return type is 'int'. */ ++_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count)); ++# endif ++_GL_CXXALIASWARN (read); ++#endif ++ ++ ++#if 0 ++/* Read the contents of the symbolic link FILE and place the first BUFSIZE ++ bytes of it into BUF. Return the number of bytes placed into BUF if ++ successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define readlink rpl_readlink ++# endif ++_GL_FUNCDECL_RPL (readlink, ssize_t, ++ (const char *file, char *buf, size_t bufsize) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (readlink, ssize_t, ++ (const char *file, char *buf, size_t bufsize)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (readlink, ssize_t, ++ (const char *file, char *buf, size_t bufsize) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (readlink, ssize_t, ++ (const char *file, char *buf, size_t bufsize)); ++# endif ++_GL_CXXALIASWARN (readlink); ++#elif defined GNULIB_POSIXCHECK ++# undef readlink ++# if HAVE_RAW_DECL_READLINK ++_GL_WARN_ON_USE (readlink, "readlink is unportable - " ++ "use gnulib module readlink for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (readlinkat, ssize_t, ++ (int fd, char const *file, char *buf, size_t len) ++ _GL_ARG_NONNULL ((2, 3))); ++# endif ++_GL_CXXALIAS_SYS (readlinkat, ssize_t, ++ (int fd, char const *file, char *buf, size_t len)); ++_GL_CXXALIASWARN (readlinkat); ++#elif defined GNULIB_POSIXCHECK ++# undef readlinkat ++# if HAVE_RAW_DECL_READLINKAT ++_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " ++ "use gnulib module readlinkat for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Remove the directory DIR. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define rmdir rpl_rmdir ++# endif ++_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); ++# else ++_GL_CXXALIAS_SYS (rmdir, int, (char const *name)); ++# endif ++_GL_CXXALIASWARN (rmdir); ++#elif defined GNULIB_POSIXCHECK ++# undef rmdir ++# if HAVE_RAW_DECL_RMDIR ++_GL_WARN_ON_USE (rmdir, "rmdir is unportable - " ++ "use gnulib module rmdir for portability"); ++# endif ++#endif ++ ++ ++#if 1 ++/* Pause the execution of the current thread for N seconds. ++ Returns the number of seconds left to sleep. ++ See the POSIX:2008 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef sleep ++# define sleep rpl_sleep ++# endif ++_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); ++_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); ++# endif ++_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); ++# endif ++_GL_CXXALIASWARN (sleep); ++#elif defined GNULIB_POSIXCHECK ++# undef sleep ++# if HAVE_RAW_DECL_SLEEP ++_GL_WARN_ON_USE (sleep, "sleep is unportable - " ++ "use gnulib module sleep for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef symlink ++# define symlink rpl_symlink ++# endif ++_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); ++# endif ++_GL_CXXALIASWARN (symlink); ++#elif defined GNULIB_POSIXCHECK ++# undef symlink ++# if HAVE_RAW_DECL_SYMLINK ++_GL_WARN_ON_USE (symlink, "symlink is not portable - " ++ "use gnulib module symlink for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (symlinkat, int, ++ (char const *contents, int fd, char const *file) ++ _GL_ARG_NONNULL ((1, 3))); ++# endif ++_GL_CXXALIAS_SYS (symlinkat, int, ++ (char const *contents, int fd, char const *file)); ++_GL_CXXALIASWARN (symlinkat); ++#elif defined GNULIB_POSIXCHECK ++# undef symlinkat ++# if HAVE_RAW_DECL_SYMLINKAT ++_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " ++ "use gnulib module symlinkat for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Store at most BUFLEN characters of the pathname of the terminal FD is ++ open on in BUF. Return 0 on success, otherwise an error number. */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef ttyname_r ++# define ttyname_r rpl_ttyname_r ++# endif ++_GL_FUNCDECL_RPL (ttyname_r, int, ++ (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (ttyname_r, int, ++ (int fd, char *buf, size_t buflen)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (ttyname_r, int, ++ (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (ttyname_r, int, ++ (int fd, char *buf, size_t buflen)); ++# endif ++_GL_CXXALIASWARN (ttyname_r); ++#elif defined GNULIB_POSIXCHECK ++# undef ttyname_r ++# if HAVE_RAW_DECL_TTYNAME_R ++_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " ++ "use gnulib module ttyname_r for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef unlink ++# define unlink rpl_unlink ++# endif ++_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (unlink, int, (char const *file)); ++# else ++_GL_CXXALIAS_SYS (unlink, int, (char const *file)); ++# endif ++_GL_CXXALIASWARN (unlink); ++#elif defined GNULIB_POSIXCHECK ++# undef unlink ++# if HAVE_RAW_DECL_UNLINK ++_GL_WARN_ON_USE (unlink, "unlink is not portable - " ++ "use gnulib module unlink for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef unlinkat ++# define unlinkat rpl_unlinkat ++# endif ++_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); ++# endif ++_GL_CXXALIASWARN (unlinkat); ++#elif defined GNULIB_POSIXCHECK ++# undef unlinkat ++# if HAVE_RAW_DECL_UNLINKAT ++_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " ++ "use gnulib module openat for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Pause the execution of the current thread for N microseconds. ++ Returns 0 on completion, or -1 on range error. ++ See the POSIX:2001 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef usleep ++# define usleep rpl_usleep ++# endif ++_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); ++_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); ++# endif ++_GL_CXXALIAS_SYS (usleep, int, (useconds_t n)); ++# endif ++_GL_CXXALIASWARN (usleep); ++#elif defined GNULIB_POSIXCHECK ++# undef usleep ++# if HAVE_RAW_DECL_USLEEP ++_GL_WARN_ON_USE (usleep, "usleep is unportable - " ++ "use gnulib module usleep for portability"); ++# endif ++#endif ++ ++ ++#if 0 ++/* Write up to COUNT bytes starting at BUF to file descriptor FD. ++ See the POSIX:2008 specification ++ . */ ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef write ++# define write rpl_write ++# endif ++_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); ++# else ++/* Need to cast, because on mingw, the third parameter is ++ unsigned int count ++ and the return type is 'int'. */ ++_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); ++# endif ++_GL_CXXALIASWARN (write); ++#endif ++ ++ ++#endif /* _GL_UNISTD_H */ ++#endif /* _GL_UNISTD_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/unistd.in.h b/xbmc/screensavers/rsxs-0.9/lib/unistd.in.h +new file mode 100644 +index 0000000..77e5675 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/unistd.in.h +@@ -0,0 +1,1471 @@ ++/* Substitute for and wrapper around . ++ Copyright (C) 2003-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++/* Special invocation convention: ++ - On mingw, several headers, including , include , ++ but we need to ensure that both the system and ++ are completely included before we replace gethostname. */ ++#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ ++ && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H ++/* is being indirectly included for the first time from ++ ; avoid declaring any overrides. */ ++# if @HAVE_UNISTD_H@ ++# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ ++# else ++# error unexpected; report this to bug-gnulib@gnu.org ++# endif ++# define _GL_WINSOCK2_H_WITNESS ++ ++/* Normal invocation. */ ++#elif !defined _@GUARD_PREFIX@_UNISTD_H ++ ++/* The include_next requires a split double-inclusion guard. */ ++#if @HAVE_UNISTD_H@ ++# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ ++#endif ++ ++/* Get all possible declarations of gethostname(). */ ++#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ ++ && !defined _GL_INCLUDING_WINSOCK2_H ++# define _GL_INCLUDING_WINSOCK2_H ++# include ++# undef _GL_INCLUDING_WINSOCK2_H ++#endif ++ ++#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H ++#define _@GUARD_PREFIX@_UNISTD_H ++ ++/* NetBSD 5.0 mis-defines NULL. Also get size_t. */ ++#include ++ ++/* mingw doesn't define the SEEK_* or *_FILENO macros in . */ ++/* Cygwin 1.7.1 declares symlinkat in , not in . */ ++/* But avoid namespace pollution on glibc systems. */ ++#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ ++ || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ ++ && defined __CYGWIN__)) \ ++ && ! defined __GLIBC__ ++# include ++#endif ++ ++/* Cygwin 1.7.1 declares unlinkat in , not in . */ ++/* But avoid namespace pollution on glibc systems. */ ++#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \ ++ && ! defined __GLIBC__ ++# include ++#endif ++ ++/* mingw fails to declare _exit in . */ ++/* mingw, MSVC, BeOS, Haiku declare environ in , not in ++ . */ ++/* Solaris declares getcwd not only in but also in . */ ++/* But avoid namespace pollution on glibc systems. */ ++#ifndef __GLIBC__ ++# include ++#endif ++ ++/* Native Windows platforms declare chdir, getcwd, rmdir in ++ and/or , not in . */ ++#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \ ++ || defined GNULIB_POSIXCHECK) \ ++ && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) ++# include /* mingw32, mingw64 */ ++# include /* mingw64, MSVC 9 */ ++#endif ++ ++/* AIX and OSF/1 5.1 declare getdomainname in , not in . ++ NonStop Kernel declares gethostname in , not in . */ ++/* But avoid namespace pollution on glibc systems. */ ++#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \ ++ || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \ ++ && !defined __GLIBC__ ++# include ++#endif ++ ++/* MSVC defines off_t in . */ ++#if !@HAVE_UNISTD_H@ ++/* Get off_t. */ ++# include ++#endif ++ ++#if (@GNULIB_READ@ || @GNULIB_WRITE@ \ ++ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ ++ || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) ++/* Get ssize_t. */ ++# include ++#endif ++ ++/* Get getopt(), optarg, optind, opterr, optopt. ++ But avoid namespace pollution on glibc systems. */ ++#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT ++# include ++#endif ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++ ++ ++/* Hide some function declarations from . */ ++ ++#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ ++# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef socket ++# define socket socket_used_without_including_sys_socket_h ++# undef connect ++# define connect connect_used_without_including_sys_socket_h ++# undef accept ++# define accept accept_used_without_including_sys_socket_h ++# undef bind ++# define bind bind_used_without_including_sys_socket_h ++# undef getpeername ++# define getpeername getpeername_used_without_including_sys_socket_h ++# undef getsockname ++# define getsockname getsockname_used_without_including_sys_socket_h ++# undef getsockopt ++# define getsockopt getsockopt_used_without_including_sys_socket_h ++# undef listen ++# define listen listen_used_without_including_sys_socket_h ++# undef recv ++# define recv recv_used_without_including_sys_socket_h ++# undef send ++# define send send_used_without_including_sys_socket_h ++# undef recvfrom ++# define recvfrom recvfrom_used_without_including_sys_socket_h ++# undef sendto ++# define sendto sendto_used_without_including_sys_socket_h ++# undef setsockopt ++# define setsockopt setsockopt_used_without_including_sys_socket_h ++# undef shutdown ++# define shutdown shutdown_used_without_including_sys_socket_h ++# else ++ _GL_WARN_ON_USE (socket, ++ "socket() used without including "); ++ _GL_WARN_ON_USE (connect, ++ "connect() used without including "); ++ _GL_WARN_ON_USE (accept, ++ "accept() used without including "); ++ _GL_WARN_ON_USE (bind, ++ "bind() used without including "); ++ _GL_WARN_ON_USE (getpeername, ++ "getpeername() used without including "); ++ _GL_WARN_ON_USE (getsockname, ++ "getsockname() used without including "); ++ _GL_WARN_ON_USE (getsockopt, ++ "getsockopt() used without including "); ++ _GL_WARN_ON_USE (listen, ++ "listen() used without including "); ++ _GL_WARN_ON_USE (recv, ++ "recv() used without including "); ++ _GL_WARN_ON_USE (send, ++ "send() used without including "); ++ _GL_WARN_ON_USE (recvfrom, ++ "recvfrom() used without including "); ++ _GL_WARN_ON_USE (sendto, ++ "sendto() used without including "); ++ _GL_WARN_ON_USE (setsockopt, ++ "setsockopt() used without including "); ++ _GL_WARN_ON_USE (shutdown, ++ "shutdown() used without including "); ++# endif ++# endif ++# if !defined _@GUARD_PREFIX@_SYS_SELECT_H ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef select ++# define select select_used_without_including_sys_select_h ++# else ++ _GL_WARN_ON_USE (select, ++ "select() used without including "); ++# endif ++# endif ++#endif ++ ++ ++/* OS/2 EMX lacks these macros. */ ++#ifndef STDIN_FILENO ++# define STDIN_FILENO 0 ++#endif ++#ifndef STDOUT_FILENO ++# define STDOUT_FILENO 1 ++#endif ++#ifndef STDERR_FILENO ++# define STDERR_FILENO 2 ++#endif ++ ++/* Ensure *_OK macros exist. */ ++#ifndef F_OK ++# define F_OK 0 ++# define X_OK 1 ++# define W_OK 2 ++# define R_OK 4 ++#endif ++ ++ ++/* Declare overridden functions. */ ++ ++ ++#if defined GNULIB_POSIXCHECK ++/* The access() function is a security risk. */ ++_GL_WARN_ON_USE (access, "the access function is a security risk - " ++ "use the gnulib module faccessat instead"); ++#endif ++ ++ ++#if @GNULIB_CHDIR@ ++_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIASWARN (chdir); ++#elif defined GNULIB_POSIXCHECK ++# undef chdir ++# if HAVE_RAW_DECL_CHDIR ++_GL_WARN_ON_USE (chown, "chdir is not always in - " ++ "use gnulib module chdir for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_CHOWN@ ++/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE ++ to GID (if GID is not -1). Follow symbolic links. ++ Return 0 if successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if @REPLACE_DUP2@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define dup2 rpl_dup2 ++# endif ++_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); ++_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); ++# else ++# if !@HAVE_DUP2@ ++_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd)); ++# endif ++_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); ++# endif ++_GL_CXXALIASWARN (dup2); ++#elif defined GNULIB_POSIXCHECK ++# undef dup2 ++# if HAVE_RAW_DECL_DUP2 ++_GL_WARN_ON_USE (dup2, "dup2 is unportable - " ++ "use gnulib module dup2 for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_DUP3@ ++/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the ++ specified flags. ++ The flags are a bitmask, possibly including O_CLOEXEC (defined in ) ++ and O_TEXT, O_BINARY (defined in "binary-io.h"). ++ Close NEWFD first if it is open. ++ Return newfd if successful, otherwise -1 and errno set. ++ See the Linux man page at ++ . */ ++# if @HAVE_DUP3@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define dup3 rpl_dup3 ++# endif ++_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); ++_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); ++# else ++_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); ++_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); ++# endif ++_GL_CXXALIASWARN (dup3); ++#elif defined GNULIB_POSIXCHECK ++# undef dup3 ++# if HAVE_RAW_DECL_DUP3 ++_GL_WARN_ON_USE (dup3, "dup3 is unportable - " ++ "use gnulib module dup3 for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_ENVIRON@ ++# if !@HAVE_DECL_ENVIRON@ ++/* Set of environment variables and values. An array of strings of the form ++ "VARIABLE=VALUE", terminated with a NULL. */ ++# if defined __APPLE__ && defined __MACH__ ++# include ++# define environ (*_NSGetEnviron ()) ++# else ++# ifdef __cplusplus ++extern "C" { ++# endif ++extern char **environ; ++# ifdef __cplusplus ++} ++# endif ++# endif ++# endif ++#elif defined GNULIB_POSIXCHECK ++# if HAVE_RAW_DECL_ENVIRON ++static inline char *** ++rpl_environ (void) ++{ ++ return &environ; ++} ++_GL_WARN_ON_USE (rpl_environ, "environ is unportable - " ++ "use gnulib module environ for portability"); ++# undef environ ++# define environ (*rpl_environ ()) ++# endif ++#endif ++ ++ ++#if @GNULIB_EUIDACCESS@ ++/* Like access(), except that it uses the effective user id and group id of ++ the current process. */ ++# if !@HAVE_EUIDACCESS@ ++_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); ++_GL_CXXALIASWARN (euidaccess); ++# if defined GNULIB_POSIXCHECK ++/* Like access(), this function is a security risk. */ ++_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " ++ "use the gnulib module faccessat instead"); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef euidaccess ++# if HAVE_RAW_DECL_EUIDACCESS ++_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " ++ "use gnulib module euidaccess for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_FACCESSAT@ ++# if !@HAVE_FACCESSAT@ ++_GL_FUNCDECL_SYS (faccessat, int, ++ (int fd, char const *file, int mode, int flag) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (faccessat, int, ++ (int fd, char const *file, int mode, int flag)); ++_GL_CXXALIASWARN (faccessat); ++#elif defined GNULIB_POSIXCHECK ++# undef faccessat ++# if HAVE_RAW_DECL_FACCESSAT ++_GL_WARN_ON_USE (faccessat, "faccessat is not portable - " ++ "use gnulib module faccessat for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_FCHDIR@ ++/* Change the process' current working directory to the directory on which ++ the given file descriptor is open. ++ Return 0 if successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if ! @HAVE_FCHDIR@ ++_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); ++ ++/* Gnulib internal hooks needed to maintain the fchdir metadata. */ ++_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) ++ _GL_ARG_NONNULL ((2)); ++_GL_EXTERN_C void _gl_unregister_fd (int fd); ++_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); ++_GL_EXTERN_C const char *_gl_directory_name (int fd); ++ ++# else ++# if !@HAVE_DECL_FCHDIR@ ++_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); ++# endif ++# endif ++_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); ++_GL_CXXALIASWARN (fchdir); ++#elif defined GNULIB_POSIXCHECK ++# undef fchdir ++# if HAVE_RAW_DECL_FCHDIR ++_GL_WARN_ON_USE (fchdir, "fchdir is unportable - " ++ "use gnulib module fchdir for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_FCHOWNAT@ ++# if @REPLACE_FCHOWNAT@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef fchownat ++# define fchownat rpl_fchownat ++# endif ++_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, ++ uid_t owner, gid_t group, int flag) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, ++ uid_t owner, gid_t group, int flag)); ++# else ++# if !@HAVE_FCHOWNAT@ ++_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, ++ uid_t owner, gid_t group, int flag) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, ++ uid_t owner, gid_t group, int flag)); ++# endif ++_GL_CXXALIASWARN (fchownat); ++#elif defined GNULIB_POSIXCHECK ++# undef fchownat ++# if HAVE_RAW_DECL_FCHOWNAT ++_GL_WARN_ON_USE (fchownat, "fchownat is not portable - " ++ "use gnulib module openat for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_FDATASYNC@ ++/* Synchronize changes to a file. ++ Return 0 if successful, otherwise -1 and errno set. ++ See POSIX:2008 specification ++ . */ ++# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ ++_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); ++# endif ++_GL_CXXALIAS_SYS (fdatasync, int, (int fd)); ++_GL_CXXALIASWARN (fdatasync); ++#elif defined GNULIB_POSIXCHECK ++# undef fdatasync ++# if HAVE_RAW_DECL_FDATASYNC ++_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " ++ "use gnulib module fdatasync for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_FSYNC@ ++/* Synchronize changes, including metadata, to a file. ++ Return 0 if successful, otherwise -1 and errno set. ++ See POSIX:2008 specification ++ . */ ++# if !@HAVE_FSYNC@ ++_GL_FUNCDECL_SYS (fsync, int, (int fd)); ++# endif ++_GL_CXXALIAS_SYS (fsync, int, (int fd)); ++_GL_CXXALIASWARN (fsync); ++#elif defined GNULIB_POSIXCHECK ++# undef fsync ++# if HAVE_RAW_DECL_FSYNC ++_GL_WARN_ON_USE (fsync, "fsync is unportable - " ++ "use gnulib module fsync for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_FTRUNCATE@ ++/* Change the size of the file to which FD is opened to become equal to LENGTH. ++ Return 0 if successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if !@HAVE_FTRUNCATE@ ++_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); ++# endif ++_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); ++_GL_CXXALIASWARN (ftruncate); ++#elif defined GNULIB_POSIXCHECK ++# undef ftruncate ++# if HAVE_RAW_DECL_FTRUNCATE ++_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " ++ "use gnulib module ftruncate for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_GETCWD@ ++/* Get the name of the current working directory, and put it in SIZE bytes ++ of BUF. ++ Return BUF if successful, or NULL if the directory couldn't be determined ++ or SIZE was too small. ++ See the POSIX:2008 specification ++ . ++ Additionally, the gnulib module 'getcwd' guarantees the following GNU ++ extension: If BUF is NULL, an array is allocated with 'malloc'; the array ++ is SIZE bytes long, unless SIZE == 0, in which case it is as big as ++ necessary. */ ++# if @REPLACE_GETCWD@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define getcwd rpl_getcwd ++# endif ++_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); ++_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); ++# else ++/* Need to cast, because on mingw, the second parameter is ++ int size. */ ++_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); ++# endif ++_GL_CXXALIASWARN (getcwd); ++#elif defined GNULIB_POSIXCHECK ++# undef getcwd ++# if HAVE_RAW_DECL_GETCWD ++_GL_WARN_ON_USE (getcwd, "getcwd is unportable - " ++ "use gnulib module getcwd for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_GETDOMAINNAME@ ++/* Return the NIS domain name of the machine. ++ WARNING! The NIS domain name is unrelated to the fully qualified host name ++ of the machine. It is also unrelated to email addresses. ++ WARNING! The NIS domain name is usually the empty string or "(none)" when ++ not using NIS. ++ ++ Put up to LEN bytes of the NIS domain name into NAME. ++ Null terminate it if the name is shorter than LEN. ++ If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. ++ Return 0 if successful, otherwise set errno and return -1. */ ++# if @REPLACE_GETDOMAINNAME@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef getdomainname ++# define getdomainname rpl_getdomainname ++# endif ++_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); ++# else ++# if !@HAVE_DECL_GETDOMAINNAME@ ++_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); ++# endif ++_GL_CXXALIASWARN (getdomainname); ++#elif defined GNULIB_POSIXCHECK ++# undef getdomainname ++# if HAVE_RAW_DECL_GETDOMAINNAME ++_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " ++ "use gnulib module getdomainname for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_GETDTABLESIZE@ ++/* Return the maximum number of file descriptors in the current process. ++ In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ ++# if !@HAVE_GETDTABLESIZE@ ++_GL_FUNCDECL_SYS (getdtablesize, int, (void)); ++# endif ++_GL_CXXALIAS_SYS (getdtablesize, int, (void)); ++_GL_CXXALIASWARN (getdtablesize); ++#elif defined GNULIB_POSIXCHECK ++# undef getdtablesize ++# if HAVE_RAW_DECL_GETDTABLESIZE ++_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " ++ "use gnulib module getdtablesize for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_GETGROUPS@ ++/* Return the supplemental groups that the current process belongs to. ++ It is unspecified whether the effective group id is in the list. ++ If N is 0, return the group count; otherwise, N describes how many ++ entries are available in GROUPS. Return -1 and set errno if N is ++ not 0 and not large enough. Fails with ENOSYS on some systems. */ ++# if @REPLACE_GETGROUPS@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef getgroups ++# define getgroups rpl_getgroups ++# endif ++_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); ++_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); ++# else ++# if !@HAVE_GETGROUPS@ ++_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); ++# endif ++_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); ++# endif ++_GL_CXXALIASWARN (getgroups); ++#elif defined GNULIB_POSIXCHECK ++# undef getgroups ++# if HAVE_RAW_DECL_GETGROUPS ++_GL_WARN_ON_USE (getgroups, "getgroups is unportable - " ++ "use gnulib module getgroups for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_GETHOSTNAME@ ++/* Return the standard host name of the machine. ++ WARNING! The host name may or may not be fully qualified. ++ ++ Put up to LEN bytes of the host name into NAME. ++ Null terminate it if the name is shorter than LEN. ++ If the host name is longer than LEN, set errno = EINVAL and return -1. ++ Return 0 if successful, otherwise set errno and return -1. */ ++# if @UNISTD_H_HAVE_WINSOCK2_H@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef gethostname ++# define gethostname rpl_gethostname ++# endif ++_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); ++# else ++# if !@HAVE_GETHOSTNAME@ ++_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) ++ _GL_ARG_NONNULL ((1))); ++# endif ++/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second ++ parameter is ++ int len. */ ++_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); ++# endif ++_GL_CXXALIASWARN (gethostname); ++#elif @UNISTD_H_HAVE_WINSOCK2_H@ ++# undef gethostname ++# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname ++#elif defined GNULIB_POSIXCHECK ++# undef gethostname ++# if HAVE_RAW_DECL_GETHOSTNAME ++_GL_WARN_ON_USE (gethostname, "gethostname is unportable - " ++ "use gnulib module gethostname for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_GETLOGIN@ ++/* Returns the user's login name, or NULL if it cannot be found. Upon error, ++ returns NULL with errno set. ++ ++ See . ++ ++ Most programs don't need to use this function, because the information is ++ available through environment variables: ++ ${LOGNAME-$USER} on Unix platforms, ++ $USERNAME on native Windows platforms. ++ */ ++# if !@HAVE_GETLOGIN@ ++_GL_FUNCDECL_SYS (getlogin, char *, (void)); ++# endif ++_GL_CXXALIAS_SYS (getlogin, char *, (void)); ++_GL_CXXALIASWARN (getlogin); ++#elif defined GNULIB_POSIXCHECK ++# undef getlogin ++# if HAVE_RAW_DECL_GETLOGIN ++_GL_WARN_ON_USE (getlogin, "getlogin is unportable - " ++ "use gnulib module getlogin for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_GETLOGIN_R@ ++/* Copies the user's login name to NAME. ++ The array pointed to by NAME has room for SIZE bytes. ++ ++ Returns 0 if successful. Upon error, an error number is returned, or -1 in ++ the case that the login name cannot be found but no specific error is ++ provided (this case is hopefully rare but is left open by the POSIX spec). ++ ++ See . ++ ++ Most programs don't need to use this function, because the information is ++ available through environment variables: ++ ${LOGNAME-$USER} on Unix platforms, ++ $USERNAME on native Windows platforms. ++ */ ++# if @REPLACE_GETLOGIN_R@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define getlogin_r rpl_getlogin_r ++# endif ++_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); ++# else ++# if !@HAVE_DECL_GETLOGIN_R@ ++_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) ++ _GL_ARG_NONNULL ((1))); ++# endif ++/* Need to cast, because on Solaris 10 systems, the second argument is ++ int size. */ ++_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); ++# endif ++_GL_CXXALIASWARN (getlogin_r); ++#elif defined GNULIB_POSIXCHECK ++# undef getlogin_r ++# if HAVE_RAW_DECL_GETLOGIN_R ++_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " ++ "use gnulib module getlogin_r for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_GETPAGESIZE@ ++# if @REPLACE_GETPAGESIZE@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define getpagesize rpl_getpagesize ++# endif ++_GL_FUNCDECL_RPL (getpagesize, int, (void)); ++_GL_CXXALIAS_RPL (getpagesize, int, (void)); ++# else ++# if !@HAVE_GETPAGESIZE@ ++# if !defined getpagesize ++/* This is for POSIX systems. */ ++# if !defined _gl_getpagesize && defined _SC_PAGESIZE ++# if ! (defined __VMS && __VMS_VER < 70000000) ++# define _gl_getpagesize() sysconf (_SC_PAGESIZE) ++# endif ++# endif ++/* This is for older VMS. */ ++# if !defined _gl_getpagesize && defined __VMS ++# ifdef __ALPHA ++# define _gl_getpagesize() 8192 ++# else ++# define _gl_getpagesize() 512 ++# endif ++# endif ++/* This is for BeOS. */ ++# if !defined _gl_getpagesize && @HAVE_OS_H@ ++# include ++# if defined B_PAGE_SIZE ++# define _gl_getpagesize() B_PAGE_SIZE ++# endif ++# endif ++/* This is for AmigaOS4.0. */ ++# if !defined _gl_getpagesize && defined __amigaos4__ ++# define _gl_getpagesize() 2048 ++# endif ++/* This is for older Unix systems. */ ++# if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@ ++# include ++# ifdef EXEC_PAGESIZE ++# define _gl_getpagesize() EXEC_PAGESIZE ++# else ++# ifdef NBPG ++# ifndef CLSIZE ++# define CLSIZE 1 ++# endif ++# define _gl_getpagesize() (NBPG * CLSIZE) ++# else ++# ifdef NBPC ++# define _gl_getpagesize() NBPC ++# endif ++# endif ++# endif ++# endif ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define getpagesize() _gl_getpagesize () ++# else ++# if !GNULIB_defined_getpagesize_function ++static inline int ++getpagesize () ++{ ++ return _gl_getpagesize (); ++} ++# define GNULIB_defined_getpagesize_function 1 ++# endif ++# endif ++# endif ++# endif ++/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ ++_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); ++# endif ++# if @HAVE_DECL_GETPAGESIZE@ ++_GL_CXXALIASWARN (getpagesize); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef getpagesize ++# if HAVE_RAW_DECL_GETPAGESIZE ++_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " ++ "use gnulib module getpagesize for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_GETUSERSHELL@ ++/* Return the next valid login shell on the system, or NULL when the end of ++ the list has been reached. */ ++# if !@HAVE_DECL_GETUSERSHELL@ ++_GL_FUNCDECL_SYS (getusershell, char *, (void)); ++# endif ++_GL_CXXALIAS_SYS (getusershell, char *, (void)); ++_GL_CXXALIASWARN (getusershell); ++#elif defined GNULIB_POSIXCHECK ++# undef getusershell ++# if HAVE_RAW_DECL_GETUSERSHELL ++_GL_WARN_ON_USE (getusershell, "getusershell is unportable - " ++ "use gnulib module getusershell for portability"); ++# endif ++#endif ++ ++#if @GNULIB_GETUSERSHELL@ ++/* Rewind to pointer that is advanced at each getusershell() call. */ ++# if !@HAVE_DECL_GETUSERSHELL@ ++_GL_FUNCDECL_SYS (setusershell, void, (void)); ++# endif ++_GL_CXXALIAS_SYS (setusershell, void, (void)); ++_GL_CXXALIASWARN (setusershell); ++#elif defined GNULIB_POSIXCHECK ++# undef setusershell ++# if HAVE_RAW_DECL_SETUSERSHELL ++_GL_WARN_ON_USE (setusershell, "setusershell is unportable - " ++ "use gnulib module getusershell for portability"); ++# endif ++#endif ++ ++#if @GNULIB_GETUSERSHELL@ ++/* Free the pointer that is advanced at each getusershell() call and ++ associated resources. */ ++# if !@HAVE_DECL_GETUSERSHELL@ ++_GL_FUNCDECL_SYS (endusershell, void, (void)); ++# endif ++_GL_CXXALIAS_SYS (endusershell, void, (void)); ++_GL_CXXALIASWARN (endusershell); ++#elif defined GNULIB_POSIXCHECK ++# undef endusershell ++# if HAVE_RAW_DECL_ENDUSERSHELL ++_GL_WARN_ON_USE (endusershell, "endusershell is unportable - " ++ "use gnulib module getusershell for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_GROUP_MEMBER@ ++/* Determine whether group id is in calling user's group list. */ ++# if !@HAVE_GROUP_MEMBER@ ++_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); ++# endif ++_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); ++_GL_CXXALIASWARN (group_member); ++#elif defined GNULIB_POSIXCHECK ++# undef group_member ++# if HAVE_RAW_DECL_GROUP_MEMBER ++_GL_WARN_ON_USE (group_member, "group_member is unportable - " ++ "use gnulib module group-member for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_LCHOWN@ ++/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE ++ to GID (if GID is not -1). Do not follow symbolic links. ++ Return 0 if successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if @REPLACE_LCHOWN@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef lchown ++# define lchown rpl_lchown ++# endif ++_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) ++ _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); ++# else ++# if !@HAVE_LCHOWN@ ++_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) ++ _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); ++# endif ++_GL_CXXALIASWARN (lchown); ++#elif defined GNULIB_POSIXCHECK ++# undef lchown ++# if HAVE_RAW_DECL_LCHOWN ++_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " ++ "use gnulib module lchown for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_LINK@ ++/* Create a new hard link for an existing file. ++ Return 0 if successful, otherwise -1 and errno set. ++ See POSIX:2008 specification ++ . */ ++# if @REPLACE_LINK@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define link rpl_link ++# endif ++_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); ++# else ++# if !@HAVE_LINK@ ++_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); ++# endif ++_GL_CXXALIASWARN (link); ++#elif defined GNULIB_POSIXCHECK ++# undef link ++# if HAVE_RAW_DECL_LINK ++_GL_WARN_ON_USE (link, "link is unportable - " ++ "use gnulib module link for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_LINKAT@ ++/* Create a new hard link for an existing file, relative to two ++ directories. FLAG controls whether symlinks are followed. ++ Return 0 if successful, otherwise -1 and errno set. */ ++# if @REPLACE_LINKAT@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef linkat ++# define linkat rpl_linkat ++# endif ++_GL_FUNCDECL_RPL (linkat, int, ++ (int fd1, const char *path1, int fd2, const char *path2, ++ int flag) ++ _GL_ARG_NONNULL ((2, 4))); ++_GL_CXXALIAS_RPL (linkat, int, ++ (int fd1, const char *path1, int fd2, const char *path2, ++ int flag)); ++# else ++# if !@HAVE_LINKAT@ ++_GL_FUNCDECL_SYS (linkat, int, ++ (int fd1, const char *path1, int fd2, const char *path2, ++ int flag) ++ _GL_ARG_NONNULL ((2, 4))); ++# endif ++_GL_CXXALIAS_SYS (linkat, int, ++ (int fd1, const char *path1, int fd2, const char *path2, ++ int flag)); ++# endif ++_GL_CXXALIASWARN (linkat); ++#elif defined GNULIB_POSIXCHECK ++# undef linkat ++# if HAVE_RAW_DECL_LINKAT ++_GL_WARN_ON_USE (linkat, "linkat is unportable - " ++ "use gnulib module linkat for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_LSEEK@ ++/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. ++ Return the new offset if successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if @REPLACE_LSEEK@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define lseek rpl_lseek ++# endif ++_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); ++_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); ++# else ++_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); ++# endif ++_GL_CXXALIASWARN (lseek); ++#elif defined GNULIB_POSIXCHECK ++# undef lseek ++# if HAVE_RAW_DECL_LSEEK ++_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " ++ "systems - use gnulib module lseek for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_PIPE@ ++/* Create a pipe, defaulting to O_BINARY mode. ++ Store the read-end as fd[0] and the write-end as fd[1]. ++ Return 0 upon success, or -1 with errno set upon failure. */ ++# if !@HAVE_PIPE@ ++_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); ++# endif ++_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); ++_GL_CXXALIASWARN (pipe); ++#elif defined GNULIB_POSIXCHECK ++# undef pipe ++# if HAVE_RAW_DECL_PIPE ++_GL_WARN_ON_USE (pipe, "pipe is unportable - " ++ "use gnulib module pipe-posix for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_PIPE2@ ++/* Create a pipe, applying the given flags when opening the read-end of the ++ pipe and the write-end of the pipe. ++ The flags are a bitmask, possibly including O_CLOEXEC (defined in ) ++ and O_TEXT, O_BINARY (defined in "binary-io.h"). ++ Store the read-end as fd[0] and the write-end as fd[1]. ++ Return 0 upon success, or -1 with errno set upon failure. ++ See also the Linux man page at ++ . */ ++# if @HAVE_PIPE2@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define pipe2 rpl_pipe2 ++# endif ++_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); ++# else ++_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); ++# endif ++_GL_CXXALIASWARN (pipe2); ++#elif defined GNULIB_POSIXCHECK ++# undef pipe2 ++# if HAVE_RAW_DECL_PIPE2 ++_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " ++ "use gnulib module pipe2 for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_PREAD@ ++/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. ++ Return the number of bytes placed into BUF if successful, otherwise ++ set errno and return -1. 0 indicates EOF. ++ See the POSIX:2008 specification ++ . */ ++# if @REPLACE_PREAD@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef pread ++# define pread rpl_pread ++# endif ++_GL_FUNCDECL_RPL (pread, ssize_t, ++ (int fd, void *buf, size_t bufsize, off_t offset) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (pread, ssize_t, ++ (int fd, void *buf, size_t bufsize, off_t offset)); ++# else ++# if !@HAVE_PREAD@ ++_GL_FUNCDECL_SYS (pread, ssize_t, ++ (int fd, void *buf, size_t bufsize, off_t offset) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (pread, ssize_t, ++ (int fd, void *buf, size_t bufsize, off_t offset)); ++# endif ++_GL_CXXALIASWARN (pread); ++#elif defined GNULIB_POSIXCHECK ++# undef pread ++# if HAVE_RAW_DECL_PREAD ++_GL_WARN_ON_USE (pread, "pread is unportable - " ++ "use gnulib module pread for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_PWRITE@ ++/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. ++ Return the number of bytes written if successful, otherwise ++ set errno and return -1. 0 indicates nothing written. See the ++ POSIX:2008 specification ++ . */ ++# if @REPLACE_PWRITE@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef pwrite ++# define pwrite rpl_pwrite ++# endif ++_GL_FUNCDECL_RPL (pwrite, ssize_t, ++ (int fd, const void *buf, size_t bufsize, off_t offset) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (pwrite, ssize_t, ++ (int fd, const void *buf, size_t bufsize, off_t offset)); ++# else ++# if !@HAVE_PWRITE@ ++_GL_FUNCDECL_SYS (pwrite, ssize_t, ++ (int fd, const void *buf, size_t bufsize, off_t offset) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (pwrite, ssize_t, ++ (int fd, const void *buf, size_t bufsize, off_t offset)); ++# endif ++_GL_CXXALIASWARN (pwrite); ++#elif defined GNULIB_POSIXCHECK ++# undef pwrite ++# if HAVE_RAW_DECL_PWRITE ++_GL_WARN_ON_USE (pwrite, "pwrite is unportable - " ++ "use gnulib module pwrite for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_READ@ ++/* Read up to COUNT bytes from file descriptor FD into the buffer starting ++ at BUF. See the POSIX:2008 specification ++ . */ ++# if @REPLACE_READ@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef read ++# define read rpl_read ++# endif ++_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); ++# else ++/* Need to cast, because on mingw, the third parameter is ++ unsigned int count ++ and the return type is 'int'. */ ++_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count)); ++# endif ++_GL_CXXALIASWARN (read); ++#endif ++ ++ ++#if @GNULIB_READLINK@ ++/* Read the contents of the symbolic link FILE and place the first BUFSIZE ++ bytes of it into BUF. Return the number of bytes placed into BUF if ++ successful, otherwise -1 and errno set. ++ See the POSIX:2008 specification ++ . */ ++# if @REPLACE_READLINK@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define readlink rpl_readlink ++# endif ++_GL_FUNCDECL_RPL (readlink, ssize_t, ++ (const char *file, char *buf, size_t bufsize) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (readlink, ssize_t, ++ (const char *file, char *buf, size_t bufsize)); ++# else ++# if !@HAVE_READLINK@ ++_GL_FUNCDECL_SYS (readlink, ssize_t, ++ (const char *file, char *buf, size_t bufsize) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (readlink, ssize_t, ++ (const char *file, char *buf, size_t bufsize)); ++# endif ++_GL_CXXALIASWARN (readlink); ++#elif defined GNULIB_POSIXCHECK ++# undef readlink ++# if HAVE_RAW_DECL_READLINK ++_GL_WARN_ON_USE (readlink, "readlink is unportable - " ++ "use gnulib module readlink for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_READLINKAT@ ++# if !@HAVE_READLINKAT@ ++_GL_FUNCDECL_SYS (readlinkat, ssize_t, ++ (int fd, char const *file, char *buf, size_t len) ++ _GL_ARG_NONNULL ((2, 3))); ++# endif ++_GL_CXXALIAS_SYS (readlinkat, ssize_t, ++ (int fd, char const *file, char *buf, size_t len)); ++_GL_CXXALIASWARN (readlinkat); ++#elif defined GNULIB_POSIXCHECK ++# undef readlinkat ++# if HAVE_RAW_DECL_READLINKAT ++_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " ++ "use gnulib module readlinkat for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_RMDIR@ ++/* Remove the directory DIR. */ ++# if @REPLACE_RMDIR@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define rmdir rpl_rmdir ++# endif ++_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); ++# else ++_GL_CXXALIAS_SYS (rmdir, int, (char const *name)); ++# endif ++_GL_CXXALIASWARN (rmdir); ++#elif defined GNULIB_POSIXCHECK ++# undef rmdir ++# if HAVE_RAW_DECL_RMDIR ++_GL_WARN_ON_USE (rmdir, "rmdir is unportable - " ++ "use gnulib module rmdir for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_SLEEP@ ++/* Pause the execution of the current thread for N seconds. ++ Returns the number of seconds left to sleep. ++ See the POSIX:2008 specification ++ . */ ++# if @REPLACE_SLEEP@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef sleep ++# define sleep rpl_sleep ++# endif ++_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); ++_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); ++# else ++# if !@HAVE_SLEEP@ ++_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); ++# endif ++_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); ++# endif ++_GL_CXXALIASWARN (sleep); ++#elif defined GNULIB_POSIXCHECK ++# undef sleep ++# if HAVE_RAW_DECL_SLEEP ++_GL_WARN_ON_USE (sleep, "sleep is unportable - " ++ "use gnulib module sleep for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_SYMLINK@ ++# if @REPLACE_SYMLINK@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef symlink ++# define symlink rpl_symlink ++# endif ++_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) ++ _GL_ARG_NONNULL ((1, 2))); ++_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); ++# else ++# if !@HAVE_SYMLINK@ ++_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) ++ _GL_ARG_NONNULL ((1, 2))); ++# endif ++_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); ++# endif ++_GL_CXXALIASWARN (symlink); ++#elif defined GNULIB_POSIXCHECK ++# undef symlink ++# if HAVE_RAW_DECL_SYMLINK ++_GL_WARN_ON_USE (symlink, "symlink is not portable - " ++ "use gnulib module symlink for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_SYMLINKAT@ ++# if !@HAVE_SYMLINKAT@ ++_GL_FUNCDECL_SYS (symlinkat, int, ++ (char const *contents, int fd, char const *file) ++ _GL_ARG_NONNULL ((1, 3))); ++# endif ++_GL_CXXALIAS_SYS (symlinkat, int, ++ (char const *contents, int fd, char const *file)); ++_GL_CXXALIASWARN (symlinkat); ++#elif defined GNULIB_POSIXCHECK ++# undef symlinkat ++# if HAVE_RAW_DECL_SYMLINKAT ++_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " ++ "use gnulib module symlinkat for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_TTYNAME_R@ ++/* Store at most BUFLEN characters of the pathname of the terminal FD is ++ open on in BUF. Return 0 on success, otherwise an error number. */ ++# if @REPLACE_TTYNAME_R@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef ttyname_r ++# define ttyname_r rpl_ttyname_r ++# endif ++_GL_FUNCDECL_RPL (ttyname_r, int, ++ (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (ttyname_r, int, ++ (int fd, char *buf, size_t buflen)); ++# else ++# if !@HAVE_DECL_TTYNAME_R@ ++_GL_FUNCDECL_SYS (ttyname_r, int, ++ (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (ttyname_r, int, ++ (int fd, char *buf, size_t buflen)); ++# endif ++_GL_CXXALIASWARN (ttyname_r); ++#elif defined GNULIB_POSIXCHECK ++# undef ttyname_r ++# if HAVE_RAW_DECL_TTYNAME_R ++_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " ++ "use gnulib module ttyname_r for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_UNLINK@ ++# if @REPLACE_UNLINK@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef unlink ++# define unlink rpl_unlink ++# endif ++_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); ++_GL_CXXALIAS_RPL (unlink, int, (char const *file)); ++# else ++_GL_CXXALIAS_SYS (unlink, int, (char const *file)); ++# endif ++_GL_CXXALIASWARN (unlink); ++#elif defined GNULIB_POSIXCHECK ++# undef unlink ++# if HAVE_RAW_DECL_UNLINK ++_GL_WARN_ON_USE (unlink, "unlink is not portable - " ++ "use gnulib module unlink for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_UNLINKAT@ ++# if @REPLACE_UNLINKAT@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef unlinkat ++# define unlinkat rpl_unlinkat ++# endif ++_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); ++# else ++# if !@HAVE_UNLINKAT@ ++_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); ++# endif ++_GL_CXXALIASWARN (unlinkat); ++#elif defined GNULIB_POSIXCHECK ++# undef unlinkat ++# if HAVE_RAW_DECL_UNLINKAT ++_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " ++ "use gnulib module openat for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_USLEEP@ ++/* Pause the execution of the current thread for N microseconds. ++ Returns 0 on completion, or -1 on range error. ++ See the POSIX:2001 specification ++ . */ ++# if @REPLACE_USLEEP@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef usleep ++# define usleep rpl_usleep ++# endif ++_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); ++_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); ++# else ++# if !@HAVE_USLEEP@ ++_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); ++# endif ++_GL_CXXALIAS_SYS (usleep, int, (useconds_t n)); ++# endif ++_GL_CXXALIASWARN (usleep); ++#elif defined GNULIB_POSIXCHECK ++# undef usleep ++# if HAVE_RAW_DECL_USLEEP ++_GL_WARN_ON_USE (usleep, "usleep is unportable - " ++ "use gnulib module usleep for portability"); ++# endif ++#endif ++ ++ ++#if @GNULIB_WRITE@ ++/* Write up to COUNT bytes starting at BUF to file descriptor FD. ++ See the POSIX:2008 specification ++ . */ ++# if @REPLACE_WRITE@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef write ++# define write rpl_write ++# endif ++_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); ++# else ++/* Need to cast, because on mingw, the third parameter is ++ unsigned int count ++ and the return type is 'int'. */ ++_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); ++# endif ++_GL_CXXALIASWARN (write); ++#endif ++ ++ ++#endif /* _@GUARD_PREFIX@_UNISTD_H */ ++#endif /* _@GUARD_PREFIX@_UNISTD_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/lib/vasnprintf.c b/xbmc/screensavers/rsxs-0.9/lib/vasnprintf.c +index 3b496d2..71f8d80 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/vasnprintf.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/vasnprintf.c +@@ -1,9 +1,9 @@ + /* vsprintf with automatic memory allocation. +- Copyright (C) 1999, 2002-2006 Free Software Foundation, Inc. ++ Copyright (C) 1999, 2002-2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -15,6 +15,35 @@ + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + ++/* This file can be parametrized with the following macros: ++ VASNPRINTF The name of the function being defined. ++ FCHAR_T The element type of the format string. ++ DCHAR_T The element type of the destination (result) string. ++ FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters ++ in the format string are ASCII. MUST be set if ++ FCHAR_T and DCHAR_T are not the same type. ++ DIRECTIVE Structure denoting a format directive. ++ Depends on FCHAR_T. ++ DIRECTIVES Structure denoting the set of format directives of a ++ format string. Depends on FCHAR_T. ++ PRINTF_PARSE Function that parses a format string. ++ Depends on FCHAR_T. ++ DCHAR_CPY memcpy like function for DCHAR_T[] arrays. ++ DCHAR_SET memset like function for DCHAR_T[] arrays. ++ DCHAR_MBSNLEN mbsnlen like function for DCHAR_T[] arrays. ++ SNPRINTF The system's snprintf (or similar) function. ++ This may be either snprintf or swprintf. ++ TCHAR_T The element type of the argument and result string ++ of the said SNPRINTF function. This may be either ++ char or wchar_t. The code exploits that ++ sizeof (TCHAR_T) | sizeof (DCHAR_T) and ++ alignof (TCHAR_T) <= alignof (DCHAR_T). ++ DCHAR_IS_TCHAR Set to 1 if DCHAR_T and TCHAR_T are the same type. ++ DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[]. ++ DCHAR_IS_UINT8_T Set to 1 if DCHAR_T is uint8_t. ++ DCHAR_IS_UINT16_T Set to 1 if DCHAR_T is uint16_t. ++ DCHAR_IS_UINT32_T Set to 1 if DCHAR_T is uint32_t. */ ++ + /* Tell glibc's to provide a prototype for snprintf(). + This must come before because may include + , and once has been included, it's too late. */ +@@ -22,7 +51,7 @@ + # define _GNU_SOURCE 1 + #endif + +-#ifdef HAVE_CONFIG_H ++#ifndef VASNPRINTF + # include + #endif + #ifndef IN_LIBINTL +@@ -30,34 +59,174 @@ + #endif + + /* Specification. */ ++#ifndef VASNPRINTF ++# if WIDE_CHAR_VERSION ++# include "vasnwprintf.h" ++# else ++# include "vasnprintf.h" ++# endif ++#endif ++ ++#include /* localeconv() */ ++#include /* snprintf(), sprintf() */ ++#include /* abort(), malloc(), realloc(), free() */ ++#include /* memcpy(), strlen() */ ++#include /* errno */ ++#include /* CHAR_BIT */ ++#include /* DBL_MAX_EXP, LDBL_MAX_EXP */ ++#if HAVE_NL_LANGINFO ++# include ++#endif ++#ifndef VASNPRINTF ++# if WIDE_CHAR_VERSION ++# include "wprintf-parse.h" ++# else ++# include "printf-parse.h" ++# endif ++#endif ++ ++/* Checked size_t computations. */ ++#include "xsize.h" ++ ++#include "verify.h" ++ ++#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL ++# include ++# include "float+.h" ++#endif ++ ++#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL ++# include ++# include "isnand-nolibm.h" ++#endif ++ ++#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL ++# include ++# include "isnanl-nolibm.h" ++# include "fpucw.h" ++#endif ++ ++#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL ++# include ++# include "isnand-nolibm.h" ++# include "printf-frexp.h" ++#endif ++ ++#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL ++# include ++# include "isnanl-nolibm.h" ++# include "printf-frexpl.h" ++# include "fpucw.h" ++#endif ++ ++/* Default parameters. */ ++#ifndef VASNPRINTF ++# if WIDE_CHAR_VERSION ++# define VASNPRINTF vasnwprintf ++# define FCHAR_T wchar_t ++# define DCHAR_T wchar_t ++# define TCHAR_T wchar_t ++# define DCHAR_IS_TCHAR 1 ++# define DIRECTIVE wchar_t_directive ++# define DIRECTIVES wchar_t_directives ++# define PRINTF_PARSE wprintf_parse ++# define DCHAR_CPY wmemcpy ++# define DCHAR_SET wmemset ++# else ++# define VASNPRINTF vasnprintf ++# define FCHAR_T char ++# define DCHAR_T char ++# define TCHAR_T char ++# define DCHAR_IS_TCHAR 1 ++# define DIRECTIVE char_directive ++# define DIRECTIVES char_directives ++# define PRINTF_PARSE printf_parse ++# define DCHAR_CPY memcpy ++# define DCHAR_SET memset ++# endif ++#endif + #if WIDE_CHAR_VERSION +-# include "vasnwprintf.h" ++ /* TCHAR_T is wchar_t. */ ++# define USE_SNPRINTF 1 ++# if HAVE_DECL__SNWPRINTF ++ /* On Windows, the function swprintf() has a different signature than ++ on Unix; we use the function _snwprintf() or - on mingw - snwprintf() ++ instead. The mingw function snwprintf() has fewer bugs than the ++ MSVCRT function _snwprintf(), so prefer that. */ ++# if defined __MINGW32__ ++# define SNPRINTF snwprintf ++# else ++# define SNPRINTF _snwprintf ++# endif ++# else ++ /* Unix. */ ++# define SNPRINTF swprintf ++# endif + #else +-# include "vasnprintf.h" ++ /* TCHAR_T is char. */ ++ /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'. ++ But don't use it on BeOS, since BeOS snprintf produces no output if the ++ size argument is >= 0x3000000. ++ Also don't use it on Linux libc5, since there snprintf with size = 1 ++ writes any output without bounds, like sprintf. */ ++# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ && !(__GNU_LIBRARY__ == 1) ++# define USE_SNPRINTF 1 ++# else ++# define USE_SNPRINTF 0 ++# endif ++# if HAVE_DECL__SNPRINTF ++ /* Windows. The mingw function snprintf() has fewer bugs than the MSVCRT ++ function _snprintf(), so prefer that. */ ++# if defined __MINGW32__ ++# define SNPRINTF snprintf ++ /* Here we need to call the native snprintf, not rpl_snprintf. */ ++# undef snprintf ++# else ++# define SNPRINTF _snprintf ++# endif ++# else ++ /* Unix. */ ++# define SNPRINTF snprintf ++ /* Here we need to call the native snprintf, not rpl_snprintf. */ ++# undef snprintf ++# endif + #endif ++/* Here we need to call the native sprintf, not rpl_sprintf. */ ++#undef sprintf + +-#include /* snprintf(), sprintf() */ +-#include /* abort(), malloc(), realloc(), free() */ +-#include /* memcpy(), strlen() */ +-#include /* errno */ +-#include /* CHAR_BIT, INT_MAX */ +-#include /* DBL_MAX_EXP, LDBL_MAX_EXP */ +-#if WIDE_CHAR_VERSION +-# include "wprintf-parse.h" ++/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized" ++ warnings in this file. Use -Dlint to suppress them. */ ++#ifdef lint ++# define IF_LINT(Code) Code + #else +-# include "printf-parse.h" ++# define IF_LINT(Code) /* empty */ + #endif + +-/* Checked size_t computations. */ +-#include "xsize.h" ++/* Avoid some warnings from "gcc -Wshadow". ++ This file doesn't use the exp() and remainder() functions. */ ++#undef exp ++#define exp expo ++#undef remainder ++#define remainder rem + +-/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ +-#ifndef EOVERFLOW +-# define EOVERFLOW E2BIG ++#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && !WIDE_CHAR_VERSION ++# if (HAVE_STRNLEN && !defined _AIX) ++# define local_strnlen strnlen ++# else ++# ifndef local_strnlen_defined ++# define local_strnlen_defined 1 ++static size_t ++local_strnlen (const char *string, size_t maxlen) ++{ ++ const char *end = memchr (string, '\0', maxlen); ++ return end ? (size_t) (end - string) : maxlen; ++} ++# endif ++# endif + #endif + +-#ifdef HAVE_WCHAR_T +-# ifdef HAVE_WCSLEN ++#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T ++# if HAVE_WCSLEN + # define local_wcslen wcslen + # else + /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid +@@ -79,808 +248,5336 @@ + # endif + #endif + +-#if WIDE_CHAR_VERSION +-# define VASNPRINTF vasnwprintf +-# define CHAR_T wchar_t +-# define DIRECTIVE wchar_t_directive +-# define DIRECTIVES wchar_t_directives +-# define PRINTF_PARSE wprintf_parse +-# define USE_SNPRINTF 1 +-# if HAVE_DECL__SNWPRINTF +- /* On Windows, the function swprintf() has a different signature than +- on Unix; we use the _snwprintf() function instead. */ +-# define SNPRINTF _snwprintf ++#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && HAVE_WCHAR_T && WIDE_CHAR_VERSION ++# if HAVE_WCSNLEN ++# define local_wcsnlen wcsnlen + # else +- /* Unix. */ +-# define SNPRINTF swprintf ++# ifndef local_wcsnlen_defined ++# define local_wcsnlen_defined 1 ++static size_t ++local_wcsnlen (const wchar_t *s, size_t maxlen) ++{ ++ const wchar_t *ptr; ++ ++ for (ptr = s; maxlen > 0 && *ptr != (wchar_t) 0; ptr++, maxlen--) ++ ; ++ return ptr - s; ++} ++# endif + # endif +-#else +-# define VASNPRINTF vasnprintf +-# define CHAR_T char +-# define DIRECTIVE char_directive +-# define DIRECTIVES char_directives +-# define PRINTF_PARSE printf_parse +-# define USE_SNPRINTF (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) +-# if HAVE_DECL__SNPRINTF +- /* Windows. */ +-# define SNPRINTF _snprintf +-# else +- /* Unix. */ +-# define SNPRINTF snprintf ++#endif ++ ++#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL ++/* Determine the decimal-point character according to the current locale. */ ++# ifndef decimal_point_char_defined ++# define decimal_point_char_defined 1 ++static char ++decimal_point_char (void) ++{ ++ const char *point; ++ /* Determine it in a multithread-safe way. We know nl_langinfo is ++ multithread-safe on glibc systems and MacOS X systems, but is not required ++ to be multithread-safe by POSIX. sprintf(), however, is multithread-safe. ++ localeconv() is rarely multithread-safe. */ ++# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__)) ++ point = nl_langinfo (RADIXCHAR); ++# elif 1 ++ char pointbuf[5]; ++ sprintf (pointbuf, "%#.0f", 1.0); ++ point = &pointbuf[1]; ++# else ++ point = localeconv () -> decimal_point; ++# endif ++ /* The decimal point is always a single byte: either '.' or ','. */ ++ return (point[0] != '\0' ? point[0] : '.'); ++} + # endif + #endif + +-CHAR_T * +-VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list args) ++#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL ++ ++/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ ++static int ++is_infinite_or_zero (double x) + { +- DIRECTIVES d; +- arguments a; ++ return isnand (x) || x + x == x; ++} + +- if (PRINTF_PARSE (format, &d, &a) < 0) ++#endif ++ ++#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL ++ ++/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ ++static int ++is_infinite_or_zerol (long double x) ++{ ++ return isnanl (x) || x + x == x; ++} ++ ++#endif ++ ++#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL ++ ++/* Converting 'long double' to decimal without rare rounding bugs requires ++ real bignums. We use the naming conventions of GNU gmp, but vastly simpler ++ (and slower) algorithms. */ ++ ++typedef unsigned int mp_limb_t; ++# define GMP_LIMB_BITS 32 ++verify (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS); ++ ++typedef unsigned long long mp_twolimb_t; ++# define GMP_TWOLIMB_BITS 64 ++verify (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS); ++ ++/* Representation of a bignum >= 0. */ ++typedef struct ++{ ++ size_t nlimbs; ++ mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc(). */ ++} mpn_t; ++ ++/* Compute the product of two bignums >= 0. ++ Return the allocated memory in case of success, NULL in case of memory ++ allocation failure. */ ++static void * ++multiply (mpn_t src1, mpn_t src2, mpn_t *dest) ++{ ++ const mp_limb_t *p1; ++ const mp_limb_t *p2; ++ size_t len1; ++ size_t len2; ++ ++ if (src1.nlimbs <= src2.nlimbs) + { +- errno = EINVAL; +- return NULL; ++ len1 = src1.nlimbs; ++ p1 = src1.limbs; ++ len2 = src2.nlimbs; ++ p2 = src2.limbs; ++ } ++ else ++ { ++ len1 = src2.nlimbs; ++ p1 = src2.limbs; ++ len2 = src1.nlimbs; ++ p2 = src1.limbs; ++ } ++ /* Now 0 <= len1 <= len2. */ ++ if (len1 == 0) ++ { ++ /* src1 or src2 is zero. */ ++ dest->nlimbs = 0; ++ dest->limbs = (mp_limb_t *) malloc (1); ++ } ++ else ++ { ++ /* Here 1 <= len1 <= len2. */ ++ size_t dlen; ++ mp_limb_t *dp; ++ size_t k, i, j; ++ ++ dlen = len1 + len2; ++ dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t)); ++ if (dp == NULL) ++ return NULL; ++ for (k = len2; k > 0; ) ++ dp[--k] = 0; ++ for (i = 0; i < len1; i++) ++ { ++ mp_limb_t digit1 = p1[i]; ++ mp_twolimb_t carry = 0; ++ for (j = 0; j < len2; j++) ++ { ++ mp_limb_t digit2 = p2[j]; ++ carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; ++ carry += dp[i + j]; ++ dp[i + j] = (mp_limb_t) carry; ++ carry = carry >> GMP_LIMB_BITS; ++ } ++ dp[i + len2] = (mp_limb_t) carry; ++ } ++ /* Normalise. */ ++ while (dlen > 0 && dp[dlen - 1] == 0) ++ dlen--; ++ dest->nlimbs = dlen; ++ dest->limbs = dp; + } ++ return dest->limbs; ++} + +-#define CLEANUP() \ +- free (d.dir); \ +- if (a.arg) \ +- free (a.arg); ++/* Compute the quotient of a bignum a >= 0 and a bignum b > 0. ++ a is written as a = q * b + r with 0 <= r < b. q is the quotient, r ++ the remainder. ++ Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd, ++ q is incremented. ++ Return the allocated memory in case of success, NULL in case of memory ++ allocation failure. */ ++static void * ++divide (mpn_t a, mpn_t b, mpn_t *q) ++{ ++ /* Algorithm: ++ First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]] ++ with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS). ++ If m=n=1, perform a single-precision division: ++ r:=0, j:=m, ++ while j>0 do ++ {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j = ++ = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r=n>1, perform a multiple-precision division: ++ We have a/b < beta^(m-n+1). ++ s:=intDsize-1-(highest bit in b[n-1]), 0<=s=beta/2. ++ For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).} ++ Compute q* : ++ q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]). ++ In case of overflow (q* >= beta) set q* := beta-1. ++ Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2] ++ and c3 := b[n-2] * q*. ++ {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow ++ occurred. Furthermore 0 <= c3 < beta^2. ++ If there was overflow and ++ r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2, ++ the next test can be skipped.} ++ While c3 > c2, {Here 0 <= c2 < c3 < beta^2} ++ Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2]. ++ If q* > 0: ++ Put r := r - b * q* * beta^j. In detail: ++ [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]]. ++ hence: u:=0, for i:=0 to n-1 do ++ u := u + q* * b[i], ++ r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry), ++ u:=u div beta (+ 1, if carry in subtraction) ++ r[n+j]:=r[n+j]-u. ++ {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1 ++ < q* + 1 <= beta, ++ the carry u does not overflow.} ++ If a negative carry occurs, put q* := q* - 1 ++ and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]]. ++ Set q[j] := q*. ++ Normalise [q[m-n],..,q[0]]; this yields the quotient q. ++ Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the ++ rest r. ++ The room for q[j] can be allocated at the memory location of r[n+j]. ++ Finally, round-to-even: ++ Shift r left by 1 bit. ++ If r > b or if r = b and q[0] is odd, q := q+1. ++ */ ++ const mp_limb_t *a_ptr = a.limbs; ++ size_t a_len = a.nlimbs; ++ const mp_limb_t *b_ptr = b.limbs; ++ size_t b_len = b.nlimbs; ++ mp_limb_t *roomptr; ++ mp_limb_t *tmp_roomptr = NULL; ++ mp_limb_t *q_ptr; ++ size_t q_len; ++ mp_limb_t *r_ptr; ++ size_t r_len; ++ ++ /* Allocate room for a_len+2 digits. ++ (Need a_len+1 digits for the real division and 1 more digit for the ++ final rounding of q.) */ ++ roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t)); ++ if (roomptr == NULL) ++ return NULL; + +- if (printf_fetchargs (args, &a) < 0) ++ /* Normalise a. */ ++ while (a_len > 0 && a_ptr[a_len - 1] == 0) ++ a_len--; ++ ++ /* Normalise b. */ ++ for (;;) + { +- CLEANUP (); +- errno = EINVAL; +- return NULL; ++ if (b_len == 0) ++ /* Division by zero. */ ++ abort (); ++ if (b_ptr[b_len - 1] == 0) ++ b_len--; ++ else ++ break; + } + +- { +- size_t buf_neededlength; +- CHAR_T *buf; +- CHAR_T *buf_malloced; +- const CHAR_T *cp; +- size_t i; +- DIRECTIVE *dp; +- /* Output string accumulator. */ +- CHAR_T *result; +- size_t allocated; +- size_t length; ++ /* Here m = a_len >= 0 and n = b_len > 0. */ + +- /* Allocate a small buffer that will hold a directive passed to +- sprintf or snprintf. */ +- buf_neededlength = +- xsum4 (7, d.max_width_length, d.max_precision_length, 6); +-#if HAVE_ALLOCA +- if (buf_neededlength < 4000 / sizeof (CHAR_T)) ++ if (a_len < b_len) ++ { ++ /* m beta^(m-2) <= a/b < beta^m */ ++ r_ptr = roomptr; ++ q_ptr = roomptr + 1; + { +- buf = (CHAR_T *) alloca (buf_neededlength * sizeof (CHAR_T)); +- buf_malloced = NULL; ++ mp_limb_t den = b_ptr[0]; ++ mp_limb_t remainder = 0; ++ const mp_limb_t *sourceptr = a_ptr + a_len; ++ mp_limb_t *destptr = q_ptr + a_len; ++ size_t count; ++ for (count = a_len; count > 0; count--) ++ { ++ mp_twolimb_t num = ++ ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr; ++ *--destptr = num / den; ++ remainder = num % den; ++ } ++ /* Normalise and store r. */ ++ if (remainder > 0) ++ { ++ r_ptr[0] = remainder; ++ r_len = 1; ++ } ++ else ++ r_len = 0; ++ /* Normalise q. */ ++ q_len = a_len; ++ if (q_ptr[q_len - 1] == 0) ++ q_len--; + } +- else +-#endif ++ } ++ else ++ { ++ /* n>1: multiple precision division. ++ beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n ==> ++ beta^(m-n-1) <= a/b < beta^(m-n+1). */ ++ /* Determine s. */ ++ size_t s; + { +- size_t buf_memsize = xtimes (buf_neededlength, sizeof (CHAR_T)); +- if (size_overflow_p (buf_memsize)) +- goto out_of_memory_1; +- buf = (CHAR_T *) malloc (buf_memsize); +- if (buf == NULL) +- goto out_of_memory_1; +- buf_malloced = buf; +- } ++ mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */ ++ /* Determine s = GMP_LIMB_BITS - integer_length (msd). ++ Code copied from gnulib's integer_length.c. */ ++# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) ++ s = __builtin_clz (msd); ++# else ++# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT ++ if (GMP_LIMB_BITS <= DBL_MANT_BIT) ++ { ++ /* Use 'double' operations. ++ Assumes an IEEE 754 'double' implementation. */ ++# define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7) ++# define DBL_EXP_BIAS (DBL_EXP_MASK / 2 - 1) ++# define NWORDS \ ++ ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) ++ union { double value; unsigned int word[NWORDS]; } m; + +- if (resultbuf != NULL) ++ /* Use a single integer to floating-point conversion. */ ++ m.value = msd; ++ ++ s = GMP_LIMB_BITS ++ - (((m.word[DBL_EXPBIT0_WORD] >> DBL_EXPBIT0_BIT) & DBL_EXP_MASK) ++ - DBL_EXP_BIAS); ++ } ++ else ++# undef NWORDS ++# endif ++ { ++ s = 31; ++ if (msd >= 0x10000) ++ { ++ msd = msd >> 16; ++ s -= 16; ++ } ++ if (msd >= 0x100) ++ { ++ msd = msd >> 8; ++ s -= 8; ++ } ++ if (msd >= 0x10) ++ { ++ msd = msd >> 4; ++ s -= 4; ++ } ++ if (msd >= 0x4) ++ { ++ msd = msd >> 2; ++ s -= 2; ++ } ++ if (msd >= 0x2) ++ { ++ msd = msd >> 1; ++ s -= 1; ++ } ++ } ++# endif ++ } ++ /* 0 <= s < GMP_LIMB_BITS. ++ Copy b, shifting it left by s bits. */ ++ if (s > 0) ++ { ++ tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t)); ++ if (tmp_roomptr == NULL) ++ { ++ free (roomptr); ++ return NULL; ++ } ++ { ++ const mp_limb_t *sourceptr = b_ptr; ++ mp_limb_t *destptr = tmp_roomptr; ++ mp_twolimb_t accu = 0; ++ size_t count; ++ for (count = b_len; count > 0; count--) ++ { ++ accu += (mp_twolimb_t) *sourceptr++ << s; ++ *destptr++ = (mp_limb_t) accu; ++ accu = accu >> GMP_LIMB_BITS; ++ } ++ /* accu must be zero, since that was how s was determined. */ ++ if (accu != 0) ++ abort (); ++ } ++ b_ptr = tmp_roomptr; ++ } ++ /* Copy a, shifting it left by s bits, yields r. ++ Memory layout: ++ At the beginning: r = roomptr[0..a_len], ++ at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len] */ ++ r_ptr = roomptr; ++ if (s == 0) ++ { ++ memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t)); ++ r_ptr[a_len] = 0; ++ } ++ else ++ { ++ const mp_limb_t *sourceptr = a_ptr; ++ mp_limb_t *destptr = r_ptr; ++ mp_twolimb_t accu = 0; ++ size_t count; ++ for (count = a_len; count > 0; count--) ++ { ++ accu += (mp_twolimb_t) *sourceptr++ << s; ++ *destptr++ = (mp_limb_t) accu; ++ accu = accu >> GMP_LIMB_BITS; ++ } ++ *destptr++ = (mp_limb_t) accu; ++ } ++ q_ptr = roomptr + b_len; ++ q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */ + { +- result = resultbuf; +- allocated = *lengthp; ++ size_t j = a_len - b_len; /* m-n */ ++ mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */ ++ mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */ ++ mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */ ++ ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd; ++ /* Division loop, traversed m-n+1 times. ++ j counts down, b is unchanged, beta/2 <= b[n-1] < beta. */ ++ for (;;) ++ { ++ mp_limb_t q_star; ++ mp_limb_t c1; ++ if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */ ++ { ++ /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow. */ ++ mp_twolimb_t num = ++ ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS) ++ | r_ptr[j + b_len - 1]; ++ q_star = num / b_msd; ++ c1 = num % b_msd; ++ } ++ else ++ { ++ /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1]. */ ++ q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */ ++ /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta ++ <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta ++ <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) ++ {<= beta !}. ++ If yes, jump directly to the subtraction loop. ++ (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta ++ <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */ ++ if (r_ptr[j + b_len] > b_msd ++ || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd) ++ /* r[j+n] >= b[n-1]+1 or ++ r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a ++ carry. */ ++ goto subtract; ++ } ++ /* q_star = q*, ++ c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, 0, decrease it by ++ b[n-1]*beta+b[n-2]. Because of b[n-1]*beta+b[n-2] >= beta^2/2 ++ this can happen only twice. */ ++ if (c3 > c2) ++ { ++ q_star = q_star - 1; /* q* := q* - 1 */ ++ if (c3 - c2 > b_msdd) ++ q_star = q_star - 1; /* q* := q* - 1 */ ++ } ++ } ++ if (q_star > 0) ++ subtract: ++ { ++ /* Subtract r := r - b * q* * beta^j. */ ++ mp_limb_t cr; ++ { ++ const mp_limb_t *sourceptr = b_ptr; ++ mp_limb_t *destptr = r_ptr + j; ++ mp_twolimb_t carry = 0; ++ size_t count; ++ for (count = b_len; count > 0; count--) ++ { ++ /* Here 0 <= carry <= q*. */ ++ carry = ++ carry ++ + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++ ++ + (mp_limb_t) ~(*destptr); ++ /* Here 0 <= carry <= beta*q* + beta-1. */ ++ *destptr++ = ~(mp_limb_t) carry; ++ carry = carry >> GMP_LIMB_BITS; /* <= q* */ ++ } ++ cr = (mp_limb_t) carry; ++ } ++ /* Subtract cr from r_ptr[j + b_len], then forget about ++ r_ptr[j + b_len]. */ ++ if (cr > r_ptr[j + b_len]) ++ { ++ /* Subtraction gave a carry. */ ++ q_star = q_star - 1; /* q* := q* - 1 */ ++ /* Add b back. */ ++ { ++ const mp_limb_t *sourceptr = b_ptr; ++ mp_limb_t *destptr = r_ptr + j; ++ mp_limb_t carry = 0; ++ size_t count; ++ for (count = b_len; count > 0; count--) ++ { ++ mp_limb_t source1 = *sourceptr++; ++ mp_limb_t source2 = *destptr; ++ *destptr++ = source1 + source2 + carry; ++ carry = ++ (carry ++ ? source1 >= (mp_limb_t) ~source2 ++ : source1 > (mp_limb_t) ~source2); ++ } ++ } ++ /* Forget about the carry and about r[j+n]. */ ++ } ++ } ++ /* q* is determined. Store it as q[j]. */ ++ q_ptr[j] = q_star; ++ if (j == 0) ++ break; ++ j--; ++ } + } +- else ++ r_len = b_len; ++ /* Normalise q. */ ++ if (q_ptr[q_len - 1] == 0) ++ q_len--; ++# if 0 /* Not needed here, since we need r only to compare it with b/2, and ++ b is shifted left by s bits. */ ++ /* Shift r right by s bits. */ ++ if (s > 0) ++ { ++ mp_limb_t ptr = r_ptr + r_len; ++ mp_twolimb_t accu = 0; ++ size_t count; ++ for (count = r_len; count > 0; count--) ++ { ++ accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS; ++ accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s); ++ *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS); ++ } ++ } ++# endif ++ /* Normalise r. */ ++ while (r_len > 0 && r_ptr[r_len - 1] == 0) ++ r_len--; ++ } ++ /* Compare r << 1 with b. */ ++ if (r_len > b_len) ++ goto increment_q; ++ { ++ size_t i; ++ for (i = b_len;;) + { +- result = NULL; +- allocated = 0; ++ mp_limb_t r_i = ++ (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0) ++ | (i < r_len ? r_ptr[i] << 1 : 0); ++ mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0); ++ if (r_i > b_i) ++ goto increment_q; ++ if (r_i < b_i) ++ goto keep_q; ++ if (i == 0) ++ break; ++ i--; + } +- length = 0; +- /* Invariants: +- result is either == resultbuf or == NULL or malloc-allocated. +- If length > 0, then result != NULL. */ ++ } ++ if (q_len > 0 && ((q_ptr[0] & 1) != 0)) ++ /* q is odd. */ ++ increment_q: ++ { ++ size_t i; ++ for (i = 0; i < q_len; i++) ++ if (++(q_ptr[i]) != 0) ++ goto keep_q; ++ q_ptr[q_len++] = 1; ++ } ++ keep_q: ++ if (tmp_roomptr != NULL) ++ free (tmp_roomptr); ++ q->limbs = q_ptr; ++ q->nlimbs = q_len; ++ return roomptr; ++} + +- /* Ensures that allocated >= needed. Aborts through a jump to +- out_of_memory if needed is SIZE_MAX or otherwise too big. */ +-#define ENSURE_ALLOCATION(needed) \ +- if ((needed) > allocated) \ +- { \ +- size_t memory_size; \ +- CHAR_T *memory; \ +- \ +- allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ +- if ((needed) > allocated) \ +- allocated = (needed); \ +- memory_size = xtimes (allocated, sizeof (CHAR_T)); \ +- if (size_overflow_p (memory_size)) \ +- goto out_of_memory; \ +- if (result == resultbuf || result == NULL) \ +- memory = (CHAR_T *) malloc (memory_size); \ +- else \ +- memory = (CHAR_T *) realloc (result, memory_size); \ +- if (memory == NULL) \ +- goto out_of_memory; \ +- if (result == resultbuf && length > 0) \ +- memcpy (memory, result, length * sizeof (CHAR_T)); \ +- result = memory; \ +- } ++/* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal ++ representation. ++ Destroys the contents of a. ++ Return the allocated memory - containing the decimal digits in low-to-high ++ order, terminated with a NUL character - in case of success, NULL in case ++ of memory allocation failure. */ ++static char * ++convert_to_decimal (mpn_t a, size_t extra_zeroes) ++{ ++ mp_limb_t *a_ptr = a.limbs; ++ size_t a_len = a.nlimbs; ++ /* 0.03345 is slightly larger than log(2)/(9*log(10)). */ ++ size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1); ++ char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes)); ++ if (c_ptr != NULL) ++ { ++ char *d_ptr = c_ptr; ++ for (; extra_zeroes > 0; extra_zeroes--) ++ *d_ptr++ = '0'; ++ while (a_len > 0) ++ { ++ /* Divide a by 10^9, in-place. */ ++ mp_limb_t remainder = 0; ++ mp_limb_t *ptr = a_ptr + a_len; ++ size_t count; ++ for (count = a_len; count > 0; count--) ++ { ++ mp_twolimb_t num = ++ ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr; ++ *ptr = num / 1000000000; ++ remainder = num % 1000000000; ++ } ++ /* Store the remainder as 9 decimal digits. */ ++ for (count = 9; count > 0; count--) ++ { ++ *d_ptr++ = '0' + (remainder % 10); ++ remainder = remainder / 10; ++ } ++ /* Normalize a. */ ++ if (a_ptr[a_len - 1] == 0) ++ a_len--; ++ } ++ /* Remove leading zeroes. */ ++ while (d_ptr > c_ptr && d_ptr[-1] == '0') ++ d_ptr--; ++ /* But keep at least one zero. */ ++ if (d_ptr == c_ptr) ++ *d_ptr++ = '0'; ++ /* Terminate the string. */ ++ *d_ptr = '\0'; ++ } ++ return c_ptr; ++} + +- for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) +- { +- if (cp != dp->dir_start) +- { +- size_t n = dp->dir_start - cp; +- size_t augmented_length = xsum (length, n); +- +- ENSURE_ALLOCATION (augmented_length); +- memcpy (result + length, cp, n * sizeof (CHAR_T)); +- length = augmented_length; +- } +- if (i == d.count) +- break; +- +- /* Execute a single directive. */ +- if (dp->conversion == '%') +- { +- size_t augmented_length; +- +- if (!(dp->arg_index == ARG_NONE)) +- abort (); +- augmented_length = xsum (length, 1); +- ENSURE_ALLOCATION (augmented_length); +- result[length] = '%'; +- length = augmented_length; +- } +- else +- { +- if (!(dp->arg_index != ARG_NONE)) +- abort (); +- +- if (dp->conversion == 'n') +- { +- switch (a.arg[dp->arg_index].type) +- { +- case TYPE_COUNT_SCHAR_POINTER: +- *a.arg[dp->arg_index].a.a_count_schar_pointer = length; +- break; +- case TYPE_COUNT_SHORT_POINTER: +- *a.arg[dp->arg_index].a.a_count_short_pointer = length; +- break; +- case TYPE_COUNT_INT_POINTER: +- *a.arg[dp->arg_index].a.a_count_int_pointer = length; +- break; +- case TYPE_COUNT_LONGINT_POINTER: +- *a.arg[dp->arg_index].a.a_count_longint_pointer = length; +- break; +-#ifdef HAVE_LONG_LONG +- case TYPE_COUNT_LONGLONGINT_POINTER: +- *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; +- break; +-#endif +- default: +- abort (); +- } +- } +- else +- { +- arg_type type = a.arg[dp->arg_index].type; +- CHAR_T *p; +- unsigned int prefix_count; +- int prefixes[2]; +-#if !USE_SNPRINTF +- size_t tmp_length; +- CHAR_T tmpbuf[700]; +- CHAR_T *tmp; +- +- /* Allocate a temporary buffer of sufficient size for calling +- sprintf. */ +- { +- size_t width; +- size_t precision; +- +- width = 0; +- if (dp->width_start != dp->width_end) +- { +- if (dp->width_arg_index != ARG_NONE) +- { +- int arg; +- +- if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) +- abort (); +- arg = a.arg[dp->width_arg_index].a.a_int; +- width = (arg < 0 ? (unsigned int) (-arg) : arg); +- } +- else +- { +- const CHAR_T *digitp = dp->width_start; +- +- do +- width = xsum (xtimes (width, 10), *digitp++ - '0'); +- while (digitp != dp->width_end); +- } +- } +- +- precision = 6; +- if (dp->precision_start != dp->precision_end) +- { +- if (dp->precision_arg_index != ARG_NONE) +- { +- int arg; +- +- if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) +- abort (); +- arg = a.arg[dp->precision_arg_index].a.a_int; +- precision = (arg < 0 ? 0 : arg); +- } +- else +- { +- const CHAR_T *digitp = dp->precision_start + 1; +- +- precision = 0; +- while (digitp != dp->precision_end) +- precision = xsum (xtimes (precision, 10), *digitp++ - '0'); +- } +- } +- +- switch (dp->conversion) +- { +- +- case 'd': case 'i': case 'u': +-# ifdef HAVE_LONG_LONG +- if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) +- tmp_length = +- (unsigned int) (sizeof (unsigned long long) * CHAR_BIT +- * 0.30103 /* binary -> decimal */ +- ) +- + 1; /* turn floor into ceil */ +- else +-# endif +- if (type == TYPE_LONGINT || type == TYPE_ULONGINT) +- tmp_length = +- (unsigned int) (sizeof (unsigned long) * CHAR_BIT +- * 0.30103 /* binary -> decimal */ +- ) +- + 1; /* turn floor into ceil */ +- else +- tmp_length = +- (unsigned int) (sizeof (unsigned int) * CHAR_BIT +- * 0.30103 /* binary -> decimal */ +- ) +- + 1; /* turn floor into ceil */ +- if (tmp_length < precision) +- tmp_length = precision; +- /* Multiply by 2, as an estimate for FLAG_GROUP. */ +- tmp_length = xsum (tmp_length, tmp_length); +- /* Add 1, to account for a leading sign. */ +- tmp_length = xsum (tmp_length, 1); +- break; +- +- case 'o': +-# ifdef HAVE_LONG_LONG +- if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) +- tmp_length = +- (unsigned int) (sizeof (unsigned long long) * CHAR_BIT +- * 0.333334 /* binary -> octal */ +- ) +- + 1; /* turn floor into ceil */ +- else +-# endif +- if (type == TYPE_LONGINT || type == TYPE_ULONGINT) +- tmp_length = +- (unsigned int) (sizeof (unsigned long) * CHAR_BIT +- * 0.333334 /* binary -> octal */ +- ) +- + 1; /* turn floor into ceil */ +- else +- tmp_length = +- (unsigned int) (sizeof (unsigned int) * CHAR_BIT +- * 0.333334 /* binary -> octal */ +- ) +- + 1; /* turn floor into ceil */ +- if (tmp_length < precision) +- tmp_length = precision; +- /* Add 1, to account for a leading sign. */ +- tmp_length = xsum (tmp_length, 1); +- break; +- +- case 'x': case 'X': +-# ifdef HAVE_LONG_LONG +- if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) +- tmp_length = +- (unsigned int) (sizeof (unsigned long long) * CHAR_BIT +- * 0.25 /* binary -> hexadecimal */ +- ) +- + 1; /* turn floor into ceil */ +- else +-# endif +- if (type == TYPE_LONGINT || type == TYPE_ULONGINT) +- tmp_length = +- (unsigned int) (sizeof (unsigned long) * CHAR_BIT +- * 0.25 /* binary -> hexadecimal */ +- ) +- + 1; /* turn floor into ceil */ +- else +- tmp_length = +- (unsigned int) (sizeof (unsigned int) * CHAR_BIT +- * 0.25 /* binary -> hexadecimal */ +- ) +- + 1; /* turn floor into ceil */ +- if (tmp_length < precision) +- tmp_length = precision; +- /* Add 2, to account for a leading sign or alternate form. */ +- tmp_length = xsum (tmp_length, 2); +- break; +- +- case 'f': case 'F': +-# ifdef HAVE_LONG_DOUBLE +- if (type == TYPE_LONGDOUBLE) +- tmp_length = +- (unsigned int) (LDBL_MAX_EXP +- * 0.30103 /* binary -> decimal */ +- * 2 /* estimate for FLAG_GROUP */ +- ) +- + 1 /* turn floor into ceil */ +- + 10; /* sign, decimal point etc. */ +- else +-# endif +- tmp_length = +- (unsigned int) (DBL_MAX_EXP +- * 0.30103 /* binary -> decimal */ +- * 2 /* estimate for FLAG_GROUP */ +- ) +- + 1 /* turn floor into ceil */ +- + 10; /* sign, decimal point etc. */ +- tmp_length = xsum (tmp_length, precision); +- break; +- +- case 'e': case 'E': case 'g': case 'G': +- case 'a': case 'A': +- tmp_length = +- 12; /* sign, decimal point, exponent etc. */ +- tmp_length = xsum (tmp_length, precision); +- break; +- +- case 'c': +-# if defined HAVE_WINT_T && !WIDE_CHAR_VERSION +- if (type == TYPE_WIDE_CHAR) +- tmp_length = MB_CUR_MAX; +- else +-# endif +- tmp_length = 1; +- break; +- +- case 's': +-# ifdef HAVE_WCHAR_T +- if (type == TYPE_WIDE_STRING) +- { +- tmp_length = +- local_wcslen (a.arg[dp->arg_index].a.a_wide_string); +- +-# if !WIDE_CHAR_VERSION +- tmp_length = xtimes (tmp_length, MB_CUR_MAX); +-# endif +- } +- else +-# endif +- tmp_length = strlen (a.arg[dp->arg_index].a.a_string); +- break; +- +- case 'p': +- tmp_length = +- (unsigned int) (sizeof (void *) * CHAR_BIT +- * 0.25 /* binary -> hexadecimal */ +- ) +- + 1 /* turn floor into ceil */ +- + 2; /* account for leading 0x */ +- break; +- +- default: +- abort (); +- } +- +- if (tmp_length < width) +- tmp_length = width; +- +- tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ +- } +- +- if (tmp_length <= sizeof (tmpbuf) / sizeof (CHAR_T)) +- tmp = tmpbuf; +- else +- { +- size_t tmp_memsize = xtimes (tmp_length, sizeof (CHAR_T)); +- +- if (size_overflow_p (tmp_memsize)) +- /* Overflow, would lead to out of memory. */ +- goto out_of_memory; +- tmp = (CHAR_T *) malloc (tmp_memsize); +- if (tmp == NULL) +- /* Out of memory. */ +- goto out_of_memory; +- } +-#endif +- +- /* Construct the format string for calling snprintf or +- sprintf. */ +- p = buf; +- *p++ = '%'; +- if (dp->flags & FLAG_GROUP) +- *p++ = '\''; +- if (dp->flags & FLAG_LEFT) +- *p++ = '-'; +- if (dp->flags & FLAG_SHOWSIGN) +- *p++ = '+'; +- if (dp->flags & FLAG_SPACE) +- *p++ = ' '; +- if (dp->flags & FLAG_ALT) +- *p++ = '#'; +- if (dp->flags & FLAG_ZERO) +- *p++ = '0'; +- if (dp->width_start != dp->width_end) +- { +- size_t n = dp->width_end - dp->width_start; +- memcpy (p, dp->width_start, n * sizeof (CHAR_T)); +- p += n; +- } +- if (dp->precision_start != dp->precision_end) +- { +- size_t n = dp->precision_end - dp->precision_start; +- memcpy (p, dp->precision_start, n * sizeof (CHAR_T)); +- p += n; +- } +- +- switch (type) +- { +-#ifdef HAVE_LONG_LONG +- case TYPE_LONGLONGINT: +- case TYPE_ULONGLONGINT: +- *p++ = 'l'; +- /*FALLTHROUGH*/ +-#endif +- case TYPE_LONGINT: +- case TYPE_ULONGINT: +-#ifdef HAVE_WINT_T +- case TYPE_WIDE_CHAR: +-#endif +-#ifdef HAVE_WCHAR_T +- case TYPE_WIDE_STRING: +-#endif +- *p++ = 'l'; +- break; +-#ifdef HAVE_LONG_DOUBLE +- case TYPE_LONGDOUBLE: +- *p++ = 'L'; +- break; +-#endif +- default: +- break; +- } +- *p = dp->conversion; +-#if USE_SNPRINTF +- p[1] = '%'; +- p[2] = 'n'; +- p[3] = '\0'; +-#else +- p[1] = '\0'; +-#endif +- +- /* Construct the arguments for calling snprintf or sprintf. */ +- prefix_count = 0; +- if (dp->width_arg_index != ARG_NONE) +- { +- if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) +- abort (); +- prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int; +- } +- if (dp->precision_arg_index != ARG_NONE) +- { +- if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) +- abort (); +- prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int; +- } ++# if NEED_PRINTF_LONG_DOUBLE + +-#if USE_SNPRINTF +- /* Prepare checking whether snprintf returns the count +- via %n. */ +- ENSURE_ALLOCATION (xsum (length, 1)); +- result[length] = '\0'; +-#endif ++/* Assuming x is finite and >= 0: ++ write x as x = 2^e * m, where m is a bignum. ++ Return the allocated memory in case of success, NULL in case of memory ++ allocation failure. */ ++static void * ++decode_long_double (long double x, int *ep, mpn_t *mp) ++{ ++ mpn_t m; ++ int exp; ++ long double y; ++ size_t i; + +- for (;;) +- { +- size_t maxlen; +- int count; +- int retcount; ++ /* Allocate memory for result. */ ++ m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; ++ m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); ++ if (m.limbs == NULL) ++ return NULL; ++ /* Split into exponential part and mantissa. */ ++ y = frexpl (x, &exp); ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the ++ latter is an integer. */ ++ /* Convert the mantissa (y * 2^LDBL_MANT_BIT) to a sequence of limbs. ++ I'm not sure whether it's safe to cast a 'long double' value between ++ 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only ++ 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int', ++ doesn't matter). */ ++# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0 ++# if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 ++ { ++ mp_limb_t hi, lo; ++ y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2)); ++ hi = (int) y; ++ y -= hi; ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ lo = (int) y; ++ y -= lo; ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; ++ } ++# else ++ { ++ mp_limb_t d; ++ y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS); ++ d = (int) y; ++ y -= d; ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d; ++ } ++# endif ++# endif ++ for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) ++ { ++ mp_limb_t hi, lo; ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ hi = (int) y; ++ y -= hi; ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ lo = (int) y; ++ y -= lo; ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; ++ } ++# if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess ++ precision. */ ++ if (!(y == 0.0L)) ++ abort (); ++# endif ++ /* Normalise. */ ++ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) ++ m.nlimbs--; ++ *mp = m; ++ *ep = exp - LDBL_MANT_BIT; ++ return m.limbs; ++} + +- maxlen = allocated - length; +- count = -1; +- retcount = 0; ++# endif + +-#if USE_SNPRINTF +-# define SNPRINTF_BUF(arg) \ +- switch (prefix_count) \ +- { \ +- case 0: \ +- retcount = SNPRINTF (result + length, maxlen, buf, \ +- arg, &count); \ +- break; \ +- case 1: \ +- retcount = SNPRINTF (result + length, maxlen, buf, \ +- prefixes[0], arg, &count); \ +- break; \ +- case 2: \ +- retcount = SNPRINTF (result + length, maxlen, buf, \ +- prefixes[0], prefixes[1], arg, \ +- &count); \ +- break; \ +- default: \ +- abort (); \ +- } +-#else +-# define SNPRINTF_BUF(arg) \ +- switch (prefix_count) \ +- { \ +- case 0: \ +- count = sprintf (tmp, buf, arg); \ +- break; \ +- case 1: \ +- count = sprintf (tmp, buf, prefixes[0], arg); \ +- break; \ +- case 2: \ +- count = sprintf (tmp, buf, prefixes[0], prefixes[1],\ +- arg); \ +- break; \ +- default: \ +- abort (); \ +- } +-#endif +- +- switch (type) +- { +- case TYPE_SCHAR: +- { +- int arg = a.arg[dp->arg_index].a.a_schar; +- SNPRINTF_BUF (arg); +- } +- break; +- case TYPE_UCHAR: +- { +- unsigned int arg = a.arg[dp->arg_index].a.a_uchar; +- SNPRINTF_BUF (arg); +- } +- break; +- case TYPE_SHORT: +- { +- int arg = a.arg[dp->arg_index].a.a_short; +- SNPRINTF_BUF (arg); +- } +- break; +- case TYPE_USHORT: +- { +- unsigned int arg = a.arg[dp->arg_index].a.a_ushort; +- SNPRINTF_BUF (arg); +- } +- break; +- case TYPE_INT: +- { +- int arg = a.arg[dp->arg_index].a.a_int; +- SNPRINTF_BUF (arg); +- } +- break; +- case TYPE_UINT: +- { +- unsigned int arg = a.arg[dp->arg_index].a.a_uint; +- SNPRINTF_BUF (arg); +- } +- break; +- case TYPE_LONGINT: +- { +- long int arg = a.arg[dp->arg_index].a.a_longint; +- SNPRINTF_BUF (arg); +- } +- break; +- case TYPE_ULONGINT: +- { +- unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint; +- SNPRINTF_BUF (arg); +- } +- break; +-#ifdef HAVE_LONG_LONG +- case TYPE_LONGLONGINT: +- { +- long long int arg = a.arg[dp->arg_index].a.a_longlongint; +- SNPRINTF_BUF (arg); +- } +- break; +- case TYPE_ULONGLONGINT: +- { +- unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint; +- SNPRINTF_BUF (arg); +- } +- break; +-#endif +- case TYPE_DOUBLE: +- { +- double arg = a.arg[dp->arg_index].a.a_double; +- SNPRINTF_BUF (arg); +- } +- break; +-#ifdef HAVE_LONG_DOUBLE +- case TYPE_LONGDOUBLE: +- { +- long double arg = a.arg[dp->arg_index].a.a_longdouble; +- SNPRINTF_BUF (arg); +- } +- break; +-#endif +- case TYPE_CHAR: +- { +- int arg = a.arg[dp->arg_index].a.a_char; +- SNPRINTF_BUF (arg); +- } +- break; +-#ifdef HAVE_WINT_T +- case TYPE_WIDE_CHAR: +- { +- wint_t arg = a.arg[dp->arg_index].a.a_wide_char; +- SNPRINTF_BUF (arg); +- } +- break; +-#endif +- case TYPE_STRING: +- { +- const char *arg = a.arg[dp->arg_index].a.a_string; +- SNPRINTF_BUF (arg); +- } +- break; +-#ifdef HAVE_WCHAR_T +- case TYPE_WIDE_STRING: +- { +- const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; +- SNPRINTF_BUF (arg); +- } +- break; +-#endif +- case TYPE_POINTER: +- { +- void *arg = a.arg[dp->arg_index].a.a_pointer; +- SNPRINTF_BUF (arg); +- } +- break; +- default: +- abort (); +- } ++# if NEED_PRINTF_DOUBLE + +-#if USE_SNPRINTF +- /* Portability: Not all implementations of snprintf() +- are ISO C 99 compliant. Determine the number of +- bytes that snprintf() has produced or would have +- produced. */ +- if (count >= 0) +- { +- /* Verify that snprintf() has NUL-terminated its +- result. */ +- if (count < maxlen && result[length + count] != '\0') +- abort (); +- /* Portability hack. */ +- if (retcount > count) +- count = retcount; +- } +- else +- { +- /* snprintf() doesn't understand the '%n' +- directive. */ +- if (p[1] != '\0') +- { +- /* Don't use the '%n' directive; instead, look +- at the snprintf() return value. */ +- p[1] = '\0'; +- continue; +- } +- else +- { +- /* Look at the snprintf() return value. */ +- if (retcount < 0) +- { +- /* HP-UX 10.20 snprintf() is doubly deficient: +- It doesn't understand the '%n' directive, +- *and* it returns -1 (rather than the length +- that would have been required) when the +- buffer is too small. */ +- size_t bigger_need = +- xsum (xtimes (allocated, 2), 12); +- ENSURE_ALLOCATION (bigger_need); +- continue; +- } +- else +- count = retcount; +- } +- } +-#endif +- +- /* Attempt to handle failure. */ +- if (count < 0) +- { +- if (!(result == resultbuf || result == NULL)) +- free (result); +- if (buf_malloced != NULL) +- free (buf_malloced); +- CLEANUP (); +- errno = EINVAL; +- return NULL; +- } ++/* Assuming x is finite and >= 0: ++ write x as x = 2^e * m, where m is a bignum. ++ Return the allocated memory in case of success, NULL in case of memory ++ allocation failure. */ ++static void * ++decode_double (double x, int *ep, mpn_t *mp) ++{ ++ mpn_t m; ++ int exp; ++ double y; ++ size_t i; + +-#if !USE_SNPRINTF +- if (count >= tmp_length) +- /* tmp_length was incorrectly calculated - fix the +- code above! */ +- abort (); +-#endif +- +- /* Make room for the result. */ +- if (count >= maxlen) +- { +- /* Need at least count bytes. But allocate +- proportionally, to avoid looping eternally if +- snprintf() reports a too small count. */ +- size_t n = +- xmax (xsum (length, count), xtimes (allocated, 2)); +- +- ENSURE_ALLOCATION (n); +-#if USE_SNPRINTF +- continue; +-#endif +- } ++ /* Allocate memory for result. */ ++ m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; ++ m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); ++ if (m.limbs == NULL) ++ return NULL; ++ /* Split into exponential part and mantissa. */ ++ y = frexp (x, &exp); ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * 2^DBL_MANT_BIT), and the ++ latter is an integer. */ ++ /* Convert the mantissa (y * 2^DBL_MANT_BIT) to a sequence of limbs. ++ I'm not sure whether it's safe to cast a 'double' value between ++ 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only ++ 'double' values between 0 and 2^16 (to 'unsigned int' or 'int', ++ doesn't matter). */ ++# if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0 ++# if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 ++ { ++ mp_limb_t hi, lo; ++ y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2)); ++ hi = (int) y; ++ y -= hi; ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ lo = (int) y; ++ y -= lo; ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; ++ } ++# else ++ { ++ mp_limb_t d; ++ y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS); ++ d = (int) y; ++ y -= d; ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d; ++ } ++# endif ++# endif ++ for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) ++ { ++ mp_limb_t hi, lo; ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ hi = (int) y; ++ y -= hi; ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ lo = (int) y; ++ y -= lo; ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; ++ } ++ if (!(y == 0.0)) ++ abort (); ++ /* Normalise. */ ++ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) ++ m.nlimbs--; ++ *mp = m; ++ *ep = exp - DBL_MANT_BIT; ++ return m.limbs; ++} + +-#if USE_SNPRINTF +- /* The snprintf() result did fit. */ +-#else +- /* Append the sprintf() result. */ +- memcpy (result + length, tmp, count * sizeof (CHAR_T)); +- if (tmp != tmpbuf) +- free (tmp); +-#endif ++# endif + +- length += count; +- break; +- } +- } +- } +- } ++/* Assuming x = 2^e * m is finite and >= 0, and n is an integer: ++ Returns the decimal representation of round (x * 10^n). ++ Return the allocated memory - containing the decimal digits in low-to-high ++ order, terminated with a NUL character - in case of success, NULL in case ++ of memory allocation failure. */ ++static char * ++scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) ++{ ++ int s; ++ size_t extra_zeroes; ++ unsigned int abs_n; ++ unsigned int abs_s; ++ mp_limb_t *pow5_ptr; ++ size_t pow5_len; ++ unsigned int s_limbs; ++ unsigned int s_bits; ++ mpn_t pow5; ++ mpn_t z; ++ void *z_memory; ++ char *digits; + +- /* Add the final NUL. */ +- ENSURE_ALLOCATION (xsum (length, 1)); +- result[length] = '\0'; ++ if (memory == NULL) ++ return NULL; ++ /* x = 2^e * m, hence ++ y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m) ++ = round (2^s * 5^n * m). */ ++ s = e + n; ++ extra_zeroes = 0; ++ /* Factor out a common power of 10 if possible. */ ++ if (s > 0 && n > 0) ++ { ++ extra_zeroes = (s < n ? s : n); ++ s -= extra_zeroes; ++ n -= extra_zeroes; ++ } ++ /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes. ++ Before converting to decimal, we need to compute ++ z = round (2^s * 5^n * m). */ ++ /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same ++ sign. 2.322 is slightly larger than log(5)/log(2). */ ++ abs_n = (n >= 0 ? n : -n); ++ abs_s = (s >= 0 ? s : -s); ++ pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1 ++ + abs_s / GMP_LIMB_BITS + 1) ++ * sizeof (mp_limb_t)); ++ if (pow5_ptr == NULL) ++ { ++ free (memory); ++ return NULL; ++ } ++ /* Initialize with 1. */ ++ pow5_ptr[0] = 1; ++ pow5_len = 1; ++ /* Multiply with 5^|n|. */ ++ if (abs_n > 0) ++ { ++ static mp_limb_t const small_pow5[13 + 1] = ++ { ++ 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, ++ 48828125, 244140625, 1220703125 ++ }; ++ unsigned int n13; ++ for (n13 = 0; n13 <= abs_n; n13 += 13) ++ { ++ mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13]; ++ size_t j; ++ mp_twolimb_t carry = 0; ++ for (j = 0; j < pow5_len; j++) ++ { ++ mp_limb_t digit2 = pow5_ptr[j]; ++ carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; ++ pow5_ptr[j] = (mp_limb_t) carry; ++ carry = carry >> GMP_LIMB_BITS; ++ } ++ if (carry > 0) ++ pow5_ptr[pow5_len++] = (mp_limb_t) carry; ++ } ++ } ++ s_limbs = abs_s / GMP_LIMB_BITS; ++ s_bits = abs_s % GMP_LIMB_BITS; ++ if (n >= 0 ? s >= 0 : s <= 0) ++ { ++ /* Multiply with 2^|s|. */ ++ if (s_bits > 0) ++ { ++ mp_limb_t *ptr = pow5_ptr; ++ mp_twolimb_t accu = 0; ++ size_t count; ++ for (count = pow5_len; count > 0; count--) ++ { ++ accu += (mp_twolimb_t) *ptr << s_bits; ++ *ptr++ = (mp_limb_t) accu; ++ accu = accu >> GMP_LIMB_BITS; ++ } ++ if (accu > 0) ++ { ++ *ptr = (mp_limb_t) accu; ++ pow5_len++; ++ } ++ } ++ if (s_limbs > 0) ++ { ++ size_t count; ++ for (count = pow5_len; count > 0;) ++ { ++ count--; ++ pow5_ptr[s_limbs + count] = pow5_ptr[count]; ++ } ++ for (count = s_limbs; count > 0;) ++ { ++ count--; ++ pow5_ptr[count] = 0; ++ } ++ pow5_len += s_limbs; ++ } ++ pow5.limbs = pow5_ptr; ++ pow5.nlimbs = pow5_len; ++ if (n >= 0) ++ { ++ /* Multiply m with pow5. No division needed. */ ++ z_memory = multiply (m, pow5, &z); ++ } ++ else ++ { ++ /* Divide m by pow5 and round. */ ++ z_memory = divide (m, pow5, &z); ++ } ++ } ++ else ++ { ++ pow5.limbs = pow5_ptr; ++ pow5.nlimbs = pow5_len; ++ if (n >= 0) ++ { ++ /* n >= 0, s < 0. ++ Multiply m with pow5, then divide by 2^|s|. */ ++ mpn_t numerator; ++ mpn_t denominator; ++ void *tmp_memory; ++ tmp_memory = multiply (m, pow5, &numerator); ++ if (tmp_memory == NULL) ++ { ++ free (pow5_ptr); ++ free (memory); ++ return NULL; ++ } ++ /* Construct 2^|s|. */ ++ { ++ mp_limb_t *ptr = pow5_ptr + pow5_len; ++ size_t i; ++ for (i = 0; i < s_limbs; i++) ++ ptr[i] = 0; ++ ptr[s_limbs] = (mp_limb_t) 1 << s_bits; ++ denominator.limbs = ptr; ++ denominator.nlimbs = s_limbs + 1; ++ } ++ z_memory = divide (numerator, denominator, &z); ++ free (tmp_memory); ++ } ++ else ++ { ++ /* n < 0, s > 0. ++ Multiply m with 2^s, then divide by pow5. */ ++ mpn_t numerator; ++ mp_limb_t *num_ptr; ++ num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1) ++ * sizeof (mp_limb_t)); ++ if (num_ptr == NULL) ++ { ++ free (pow5_ptr); ++ free (memory); ++ return NULL; ++ } ++ { ++ mp_limb_t *destptr = num_ptr; ++ { ++ size_t i; ++ for (i = 0; i < s_limbs; i++) ++ *destptr++ = 0; ++ } ++ if (s_bits > 0) ++ { ++ const mp_limb_t *sourceptr = m.limbs; ++ mp_twolimb_t accu = 0; ++ size_t count; ++ for (count = m.nlimbs; count > 0; count--) ++ { ++ accu += (mp_twolimb_t) *sourceptr++ << s_bits; ++ *destptr++ = (mp_limb_t) accu; ++ accu = accu >> GMP_LIMB_BITS; ++ } ++ if (accu > 0) ++ *destptr++ = (mp_limb_t) accu; ++ } ++ else ++ { ++ const mp_limb_t *sourceptr = m.limbs; ++ size_t count; ++ for (count = m.nlimbs; count > 0; count--) ++ *destptr++ = *sourceptr++; ++ } ++ numerator.limbs = num_ptr; ++ numerator.nlimbs = destptr - num_ptr; ++ } ++ z_memory = divide (numerator, pow5, &z); ++ free (num_ptr); ++ } ++ } ++ free (pow5_ptr); ++ free (memory); + +- if (result != resultbuf && length + 1 < allocated) +- { +- /* Shrink the allocated memory if possible. */ +- CHAR_T *memory; ++ /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */ + +- memory = (CHAR_T *) realloc (result, (length + 1) * sizeof (CHAR_T)); +- if (memory != NULL) +- result = memory; +- } ++ if (z_memory == NULL) ++ return NULL; ++ digits = convert_to_decimal (z, extra_zeroes); ++ free (z_memory); ++ return digits; ++} + +- if (buf_malloced != NULL) +- free (buf_malloced); +- CLEANUP (); +- *lengthp = length; +- if (length > INT_MAX) +- goto length_overflow; +- return result; ++# if NEED_PRINTF_LONG_DOUBLE + +- length_overflow: +- /* We could produce such a big string, but its length doesn't fit into +- an 'int'. POSIX says that snprintf() fails with errno = EOVERFLOW in +- this case. */ +- if (result != resultbuf) +- free (result); +- errno = EOVERFLOW; +- return NULL; ++/* Assuming x is finite and >= 0, and n is an integer: ++ Returns the decimal representation of round (x * 10^n). ++ Return the allocated memory - containing the decimal digits in low-to-high ++ order, terminated with a NUL character - in case of success, NULL in case ++ of memory allocation failure. */ ++static char * ++scale10_round_decimal_long_double (long double x, int n) ++{ ++ int e IF_LINT(= 0); ++ mpn_t m; ++ void *memory = decode_long_double (x, &e, &m); ++ return scale10_round_decimal_decoded (e, m, memory, n); ++} ++ ++# endif ++ ++# if NEED_PRINTF_DOUBLE ++ ++/* Assuming x is finite and >= 0, and n is an integer: ++ Returns the decimal representation of round (x * 10^n). ++ Return the allocated memory - containing the decimal digits in low-to-high ++ order, terminated with a NUL character - in case of success, NULL in case ++ of memory allocation failure. */ ++static char * ++scale10_round_decimal_double (double x, int n) ++{ ++ int e IF_LINT(= 0); ++ mpn_t m; ++ void *memory = decode_double (x, &e, &m); ++ return scale10_round_decimal_decoded (e, m, memory, n); ++} ++ ++# endif ++ ++# if NEED_PRINTF_LONG_DOUBLE ++ ++/* Assuming x is finite and > 0: ++ Return an approximation for n with 10^n <= x < 10^(n+1). ++ The approximation is usually the right n, but may be off by 1 sometimes. */ ++static int ++floorlog10l (long double x) ++{ ++ int exp; ++ long double y; ++ double z; ++ double l; ++ ++ /* Split into exponential part and mantissa. */ ++ y = frexpl (x, &exp); ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ if (y == 0.0L) ++ return INT_MIN; ++ if (y < 0.5L) ++ { ++ while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) ++ { ++ y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); ++ exp -= GMP_LIMB_BITS; ++ } ++ if (y < (1.0L / (1 << 16))) ++ { ++ y *= 1.0L * (1 << 16); ++ exp -= 16; ++ } ++ if (y < (1.0L / (1 << 8))) ++ { ++ y *= 1.0L * (1 << 8); ++ exp -= 8; ++ } ++ if (y < (1.0L / (1 << 4))) ++ { ++ y *= 1.0L * (1 << 4); ++ exp -= 4; ++ } ++ if (y < (1.0L / (1 << 2))) ++ { ++ y *= 1.0L * (1 << 2); ++ exp -= 2; ++ } ++ if (y < (1.0L / (1 << 1))) ++ { ++ y *= 1.0L * (1 << 1); ++ exp -= 1; ++ } ++ } ++ if (!(y >= 0.5L && y < 1.0L)) ++ abort (); ++ /* Compute an approximation for l = log2(x) = exp + log2(y). */ ++ l = exp; ++ z = y; ++ if (z < 0.70710678118654752444) ++ { ++ z *= 1.4142135623730950488; ++ l -= 0.5; ++ } ++ if (z < 0.8408964152537145431) ++ { ++ z *= 1.1892071150027210667; ++ l -= 0.25; ++ } ++ if (z < 0.91700404320467123175) ++ { ++ z *= 1.0905077326652576592; ++ l -= 0.125; ++ } ++ if (z < 0.9576032806985736469) ++ { ++ z *= 1.0442737824274138403; ++ l -= 0.0625; ++ } ++ /* Now 0.95 <= z <= 1.01. */ ++ z = 1 - z; ++ /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...) ++ Four terms are enough to get an approximation with error < 10^-7. */ ++ l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); ++ /* Finally multiply with log(2)/log(10), yields an approximation for ++ log10(x). */ ++ l *= 0.30102999566398119523; ++ /* Round down to the next integer. */ ++ return (int) l + (l < 0 ? -1 : 0); ++} ++ ++# endif ++ ++# if NEED_PRINTF_DOUBLE ++ ++/* Assuming x is finite and > 0: ++ Return an approximation for n with 10^n <= x < 10^(n+1). ++ The approximation is usually the right n, but may be off by 1 sometimes. */ ++static int ++floorlog10 (double x) ++{ ++ int exp; ++ double y; ++ double z; ++ double l; ++ ++ /* Split into exponential part and mantissa. */ ++ y = frexp (x, &exp); ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ if (y == 0.0) ++ return INT_MIN; ++ if (y < 0.5) ++ { ++ while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) ++ { ++ y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); ++ exp -= GMP_LIMB_BITS; ++ } ++ if (y < (1.0 / (1 << 16))) ++ { ++ y *= 1.0 * (1 << 16); ++ exp -= 16; ++ } ++ if (y < (1.0 / (1 << 8))) ++ { ++ y *= 1.0 * (1 << 8); ++ exp -= 8; ++ } ++ if (y < (1.0 / (1 << 4))) ++ { ++ y *= 1.0 * (1 << 4); ++ exp -= 4; ++ } ++ if (y < (1.0 / (1 << 2))) ++ { ++ y *= 1.0 * (1 << 2); ++ exp -= 2; ++ } ++ if (y < (1.0 / (1 << 1))) ++ { ++ y *= 1.0 * (1 << 1); ++ exp -= 1; ++ } ++ } ++ if (!(y >= 0.5 && y < 1.0)) ++ abort (); ++ /* Compute an approximation for l = log2(x) = exp + log2(y). */ ++ l = exp; ++ z = y; ++ if (z < 0.70710678118654752444) ++ { ++ z *= 1.4142135623730950488; ++ l -= 0.5; ++ } ++ if (z < 0.8408964152537145431) ++ { ++ z *= 1.1892071150027210667; ++ l -= 0.25; ++ } ++ if (z < 0.91700404320467123175) ++ { ++ z *= 1.0905077326652576592; ++ l -= 0.125; ++ } ++ if (z < 0.9576032806985736469) ++ { ++ z *= 1.0442737824274138403; ++ l -= 0.0625; ++ } ++ /* Now 0.95 <= z <= 1.01. */ ++ z = 1 - z; ++ /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...) ++ Four terms are enough to get an approximation with error < 10^-7. */ ++ l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); ++ /* Finally multiply with log(2)/log(10), yields an approximation for ++ log10(x). */ ++ l *= 0.30102999566398119523; ++ /* Round down to the next integer. */ ++ return (int) l + (l < 0 ? -1 : 0); ++} ++ ++# endif ++ ++/* Tests whether a string of digits consists of exactly PRECISION zeroes and ++ a single '1' digit. */ ++static int ++is_borderline (const char *digits, size_t precision) ++{ ++ for (; precision > 0; precision--, digits++) ++ if (*digits != '0') ++ return 0; ++ if (*digits != '1') ++ return 0; ++ digits++; ++ return *digits == '\0'; ++} ++ ++#endif ++ ++#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 ++ ++/* Use a different function name, to make it possible that the 'wchar_t' ++ parametrization and the 'char' parametrization get compiled in the same ++ translation unit. */ ++# if WIDE_CHAR_VERSION ++# define MAX_ROOM_NEEDED wmax_room_needed ++# else ++# define MAX_ROOM_NEEDED max_room_needed ++# endif ++ ++/* Returns the number of TCHAR_T units needed as temporary space for the result ++ of sprintf or SNPRINTF of a single conversion directive. */ ++static inline size_t ++MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, ++ arg_type type, int flags, size_t width, int has_precision, ++ size_t precision, int pad_ourselves) ++{ ++ size_t tmp_length; ++ ++ switch (conversion) ++ { ++ case 'd': case 'i': case 'u': ++# if HAVE_LONG_LONG_INT ++ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT ++ * 0.30103 /* binary -> decimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++# endif ++ if (type == TYPE_LONGINT || type == TYPE_ULONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long) * CHAR_BIT ++ * 0.30103 /* binary -> decimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++ tmp_length = ++ (unsigned int) (sizeof (unsigned int) * CHAR_BIT ++ * 0.30103 /* binary -> decimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ if (tmp_length < precision) ++ tmp_length = precision; ++ /* Multiply by 2, as an estimate for FLAG_GROUP. */ ++ tmp_length = xsum (tmp_length, tmp_length); ++ /* Add 1, to account for a leading sign. */ ++ tmp_length = xsum (tmp_length, 1); ++ break; ++ ++ case 'o': ++# if HAVE_LONG_LONG_INT ++ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT ++ * 0.333334 /* binary -> octal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++# endif ++ if (type == TYPE_LONGINT || type == TYPE_ULONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long) * CHAR_BIT ++ * 0.333334 /* binary -> octal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++ tmp_length = ++ (unsigned int) (sizeof (unsigned int) * CHAR_BIT ++ * 0.333334 /* binary -> octal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ if (tmp_length < precision) ++ tmp_length = precision; ++ /* Add 1, to account for a leading sign. */ ++ tmp_length = xsum (tmp_length, 1); ++ break; ++ ++ case 'x': case 'X': ++# if HAVE_LONG_LONG_INT ++ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT ++ * 0.25 /* binary -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++# endif ++ if (type == TYPE_LONGINT || type == TYPE_ULONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long) * CHAR_BIT ++ * 0.25 /* binary -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++ tmp_length = ++ (unsigned int) (sizeof (unsigned int) * CHAR_BIT ++ * 0.25 /* binary -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ if (tmp_length < precision) ++ tmp_length = precision; ++ /* Add 2, to account for a leading sign or alternate form. */ ++ tmp_length = xsum (tmp_length, 2); ++ break; ++ ++ case 'f': case 'F': ++ if (type == TYPE_LONGDOUBLE) ++ tmp_length = ++ (unsigned int) (LDBL_MAX_EXP ++ * 0.30103 /* binary -> decimal */ ++ * 2 /* estimate for FLAG_GROUP */ ++ ) ++ + 1 /* turn floor into ceil */ ++ + 10; /* sign, decimal point etc. */ ++ else ++ tmp_length = ++ (unsigned int) (DBL_MAX_EXP ++ * 0.30103 /* binary -> decimal */ ++ * 2 /* estimate for FLAG_GROUP */ ++ ) ++ + 1 /* turn floor into ceil */ ++ + 10; /* sign, decimal point etc. */ ++ tmp_length = xsum (tmp_length, precision); ++ break; ++ ++ case 'e': case 'E': case 'g': case 'G': ++ tmp_length = ++ 12; /* sign, decimal point, exponent etc. */ ++ tmp_length = xsum (tmp_length, precision); ++ break; ++ ++ case 'a': case 'A': ++ if (type == TYPE_LONGDOUBLE) ++ tmp_length = ++ (unsigned int) (LDBL_DIG ++ * 0.831 /* decimal -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++ tmp_length = ++ (unsigned int) (DBL_DIG ++ * 0.831 /* decimal -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ if (tmp_length < precision) ++ tmp_length = precision; ++ /* Account for sign, decimal point etc. */ ++ tmp_length = xsum (tmp_length, 12); ++ break; ++ ++ case 'c': ++# if HAVE_WINT_T && !WIDE_CHAR_VERSION ++ if (type == TYPE_WIDE_CHAR) ++ tmp_length = MB_CUR_MAX; ++ else ++# endif ++ tmp_length = 1; ++ break; ++ ++ case 's': ++# if HAVE_WCHAR_T ++ if (type == TYPE_WIDE_STRING) ++ { ++# if WIDE_CHAR_VERSION ++ /* ISO C says about %ls in fwprintf: ++ "If the precision is not specified or is greater than the size ++ of the array, the array shall contain a null wide character." ++ So if there is a precision, we must not use wcslen. */ ++ const wchar_t *arg = ap->arg[arg_index].a.a_wide_string; ++ ++ if (has_precision) ++ tmp_length = local_wcsnlen (arg, precision); ++ else ++ tmp_length = local_wcslen (arg); ++# else ++ /* ISO C says about %ls in fprintf: ++ "If a precision is specified, no more than that many bytes are ++ written (including shift sequences, if any), and the array ++ shall contain a null wide character if, to equal the multibyte ++ character sequence length given by the precision, the function ++ would need to access a wide character one past the end of the ++ array." ++ So if there is a precision, we must not use wcslen. */ ++ /* This case has already been handled separately in VASNPRINTF. */ ++ abort (); ++# endif ++ } ++ else ++# endif ++ { ++# if WIDE_CHAR_VERSION ++ /* ISO C says about %s in fwprintf: ++ "If the precision is not specified or is greater than the size ++ of the converted array, the converted array shall contain a ++ null wide character." ++ So if there is a precision, we must not use strlen. */ ++ /* This case has already been handled separately in VASNPRINTF. */ ++ abort (); ++# else ++ /* ISO C says about %s in fprintf: ++ "If the precision is not specified or greater than the size of ++ the array, the array shall contain a null character." ++ So if there is a precision, we must not use strlen. */ ++ const char *arg = ap->arg[arg_index].a.a_string; ++ ++ if (has_precision) ++ tmp_length = local_strnlen (arg, precision); ++ else ++ tmp_length = strlen (arg); ++# endif ++ } ++ break; ++ ++ case 'p': ++ tmp_length = ++ (unsigned int) (sizeof (void *) * CHAR_BIT ++ * 0.25 /* binary -> hexadecimal */ ++ ) ++ + 1 /* turn floor into ceil */ ++ + 2; /* account for leading 0x */ ++ break; ++ ++ default: ++ abort (); ++ } ++ ++ if (!pad_ourselves) ++ { ++# if ENABLE_UNISTDIO ++ /* Padding considers the number of characters, therefore the number of ++ elements after padding may be ++ > max (tmp_length, width) ++ but is certainly ++ <= tmp_length + width. */ ++ tmp_length = xsum (tmp_length, width); ++# else ++ /* Padding considers the number of elements, says POSIX. */ ++ if (tmp_length < width) ++ tmp_length = width; ++# endif ++ } ++ ++ tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ ++ ++ return tmp_length; ++} ++ ++#endif ++ ++DCHAR_T * ++VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, ++ const FCHAR_T *format, va_list args) ++{ ++ DIRECTIVES d; ++ arguments a; ++ ++ if (PRINTF_PARSE (format, &d, &a) < 0) ++ /* errno is already set. */ ++ return NULL; ++ ++#define CLEANUP() \ ++ if (d.dir != d.direct_alloc_dir) \ ++ free (d.dir); \ ++ if (a.arg != a.direct_alloc_arg) \ ++ free (a.arg); ++ ++ if (PRINTF_FETCHARGS (args, &a) < 0) ++ { ++ CLEANUP (); ++ errno = EINVAL; ++ return NULL; ++ } ++ ++ { ++ size_t buf_neededlength; ++ TCHAR_T *buf; ++ TCHAR_T *buf_malloced; ++ const FCHAR_T *cp; ++ size_t i; ++ DIRECTIVE *dp; ++ /* Output string accumulator. */ ++ DCHAR_T *result; ++ size_t allocated; ++ size_t length; ++ ++ /* Allocate a small buffer that will hold a directive passed to ++ sprintf or snprintf. */ ++ buf_neededlength = ++ xsum4 (7, d.max_width_length, d.max_precision_length, 6); ++#if HAVE_ALLOCA ++ if (buf_neededlength < 4000 / sizeof (TCHAR_T)) ++ { ++ buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T)); ++ buf_malloced = NULL; ++ } ++ else ++#endif ++ { ++ size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T)); ++ if (size_overflow_p (buf_memsize)) ++ goto out_of_memory_1; ++ buf = (TCHAR_T *) malloc (buf_memsize); ++ if (buf == NULL) ++ goto out_of_memory_1; ++ buf_malloced = buf; ++ } ++ ++ if (resultbuf != NULL) ++ { ++ result = resultbuf; ++ allocated = *lengthp; ++ } ++ else ++ { ++ result = NULL; ++ allocated = 0; ++ } ++ length = 0; ++ /* Invariants: ++ result is either == resultbuf or == NULL or malloc-allocated. ++ If length > 0, then result != NULL. */ ++ ++ /* Ensures that allocated >= needed. Aborts through a jump to ++ out_of_memory if needed is SIZE_MAX or otherwise too big. */ ++#define ENSURE_ALLOCATION(needed) \ ++ if ((needed) > allocated) \ ++ { \ ++ size_t memory_size; \ ++ DCHAR_T *memory; \ ++ \ ++ allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ ++ if ((needed) > allocated) \ ++ allocated = (needed); \ ++ memory_size = xtimes (allocated, sizeof (DCHAR_T)); \ ++ if (size_overflow_p (memory_size)) \ ++ goto out_of_memory; \ ++ if (result == resultbuf || result == NULL) \ ++ memory = (DCHAR_T *) malloc (memory_size); \ ++ else \ ++ memory = (DCHAR_T *) realloc (result, memory_size); \ ++ if (memory == NULL) \ ++ goto out_of_memory; \ ++ if (result == resultbuf && length > 0) \ ++ DCHAR_CPY (memory, result, length); \ ++ result = memory; \ ++ } ++ ++ for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) ++ { ++ if (cp != dp->dir_start) ++ { ++ size_t n = dp->dir_start - cp; ++ size_t augmented_length = xsum (length, n); ++ ++ ENSURE_ALLOCATION (augmented_length); ++ /* This copies a piece of FCHAR_T[] into a DCHAR_T[]. Here we ++ need that the format string contains only ASCII characters ++ if FCHAR_T and DCHAR_T are not the same type. */ ++ if (sizeof (FCHAR_T) == sizeof (DCHAR_T)) ++ { ++ DCHAR_CPY (result + length, (const DCHAR_T *) cp, n); ++ length = augmented_length; ++ } ++ else ++ { ++ do ++ result[length++] = (unsigned char) *cp++; ++ while (--n > 0); ++ } ++ } ++ if (i == d.count) ++ break; ++ ++ /* Execute a single directive. */ ++ if (dp->conversion == '%') ++ { ++ size_t augmented_length; ++ ++ if (!(dp->arg_index == ARG_NONE)) ++ abort (); ++ augmented_length = xsum (length, 1); ++ ENSURE_ALLOCATION (augmented_length); ++ result[length] = '%'; ++ length = augmented_length; ++ } ++ else ++ { ++ if (!(dp->arg_index != ARG_NONE)) ++ abort (); ++ ++ if (dp->conversion == 'n') ++ { ++ switch (a.arg[dp->arg_index].type) ++ { ++ case TYPE_COUNT_SCHAR_POINTER: ++ *a.arg[dp->arg_index].a.a_count_schar_pointer = length; ++ break; ++ case TYPE_COUNT_SHORT_POINTER: ++ *a.arg[dp->arg_index].a.a_count_short_pointer = length; ++ break; ++ case TYPE_COUNT_INT_POINTER: ++ *a.arg[dp->arg_index].a.a_count_int_pointer = length; ++ break; ++ case TYPE_COUNT_LONGINT_POINTER: ++ *a.arg[dp->arg_index].a.a_count_longint_pointer = length; ++ break; ++#if HAVE_LONG_LONG_INT ++ case TYPE_COUNT_LONGLONGINT_POINTER: ++ *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; ++ break; ++#endif ++ default: ++ abort (); ++ } ++ } ++#if ENABLE_UNISTDIO ++ /* The unistdio extensions. */ ++ else if (dp->conversion == 'U') ++ { ++ arg_type type = a.arg[dp->arg_index].type; ++ int flags = dp->flags; ++ int has_width; ++ size_t width; ++ int has_precision; ++ size_t precision; ++ ++ has_width = 0; ++ width = 0; ++ if (dp->width_start != dp->width_end) ++ { ++ if (dp->width_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->width_arg_index].a.a_int; ++ if (arg < 0) ++ { ++ /* "A negative field width is taken as a '-' flag ++ followed by a positive field width." */ ++ flags |= FLAG_LEFT; ++ width = (unsigned int) (-arg); ++ } ++ else ++ width = arg; ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->width_start; ++ ++ do ++ width = xsum (xtimes (width, 10), *digitp++ - '0'); ++ while (digitp != dp->width_end); ++ } ++ has_width = 1; ++ } ++ ++ has_precision = 0; ++ precision = 0; ++ if (dp->precision_start != dp->precision_end) ++ { ++ if (dp->precision_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->precision_arg_index].a.a_int; ++ /* "A negative precision is taken as if the precision ++ were omitted." */ ++ if (arg >= 0) ++ { ++ precision = arg; ++ has_precision = 1; ++ } ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->precision_start + 1; ++ ++ precision = 0; ++ while (digitp != dp->precision_end) ++ precision = xsum (xtimes (precision, 10), *digitp++ - '0'); ++ has_precision = 1; ++ } ++ } ++ ++ switch (type) ++ { ++ case TYPE_U8_STRING: ++ { ++ const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string; ++ const uint8_t *arg_end; ++ size_t characters; ++ ++ if (has_precision) ++ { ++ /* Use only PRECISION characters, from the left. */ ++ arg_end = arg; ++ characters = 0; ++ for (; precision > 0; precision--) ++ { ++ int count = u8_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else if (has_width) ++ { ++ /* Use the entire string, and count the number of ++ characters. */ ++ arg_end = arg; ++ characters = 0; ++ for (;;) ++ { ++ int count = u8_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else ++ { ++ /* Use the entire string. */ ++ arg_end = arg + u8_strlen (arg); ++ /* The number of characters doesn't matter. */ ++ characters = 0; ++ } ++ ++ if (has_width && width > characters ++ && !(dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ ++# if DCHAR_IS_UINT8_T ++ { ++ size_t n = arg_end - arg; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_CPY (result + length, arg, n); ++ length += n; ++ } ++# else ++ { /* Convert. */ ++ DCHAR_T *converted = result + length; ++ size_t converted_len = allocated - length; ++# if DCHAR_IS_TCHAR ++ /* Convert from UTF-8 to locale encoding. */ ++ converted = ++ u8_conv_to_encoding (locale_charset (), ++ iconveh_question_mark, ++ arg, arg_end - arg, NULL, ++ converted, &converted_len); ++# else ++ /* Convert from UTF-8 to UTF-16/UTF-32. */ ++ converted = ++ U8_TO_DCHAR (arg, arg_end - arg, ++ converted, &converted_len); ++# endif ++ if (converted == NULL) ++ { ++ int saved_errno = errno; ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = saved_errno; ++ return NULL; ++ } ++ if (converted != result + length) ++ { ++ ENSURE_ALLOCATION (xsum (length, converted_len)); ++ DCHAR_CPY (result + length, converted, converted_len); ++ free (converted); ++ } ++ length += converted_len; ++ } ++# endif ++ ++ if (has_width && width > characters ++ && (dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ } ++ break; ++ ++ case TYPE_U16_STRING: ++ { ++ const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string; ++ const uint16_t *arg_end; ++ size_t characters; ++ ++ if (has_precision) ++ { ++ /* Use only PRECISION characters, from the left. */ ++ arg_end = arg; ++ characters = 0; ++ for (; precision > 0; precision--) ++ { ++ int count = u16_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else if (has_width) ++ { ++ /* Use the entire string, and count the number of ++ characters. */ ++ arg_end = arg; ++ characters = 0; ++ for (;;) ++ { ++ int count = u16_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else ++ { ++ /* Use the entire string. */ ++ arg_end = arg + u16_strlen (arg); ++ /* The number of characters doesn't matter. */ ++ characters = 0; ++ } ++ ++ if (has_width && width > characters ++ && !(dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ ++# if DCHAR_IS_UINT16_T ++ { ++ size_t n = arg_end - arg; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_CPY (result + length, arg, n); ++ length += n; ++ } ++# else ++ { /* Convert. */ ++ DCHAR_T *converted = result + length; ++ size_t converted_len = allocated - length; ++# if DCHAR_IS_TCHAR ++ /* Convert from UTF-16 to locale encoding. */ ++ converted = ++ u16_conv_to_encoding (locale_charset (), ++ iconveh_question_mark, ++ arg, arg_end - arg, NULL, ++ converted, &converted_len); ++# else ++ /* Convert from UTF-16 to UTF-8/UTF-32. */ ++ converted = ++ U16_TO_DCHAR (arg, arg_end - arg, ++ converted, &converted_len); ++# endif ++ if (converted == NULL) ++ { ++ int saved_errno = errno; ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = saved_errno; ++ return NULL; ++ } ++ if (converted != result + length) ++ { ++ ENSURE_ALLOCATION (xsum (length, converted_len)); ++ DCHAR_CPY (result + length, converted, converted_len); ++ free (converted); ++ } ++ length += converted_len; ++ } ++# endif ++ ++ if (has_width && width > characters ++ && (dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ } ++ break; ++ ++ case TYPE_U32_STRING: ++ { ++ const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string; ++ const uint32_t *arg_end; ++ size_t characters; ++ ++ if (has_precision) ++ { ++ /* Use only PRECISION characters, from the left. */ ++ arg_end = arg; ++ characters = 0; ++ for (; precision > 0; precision--) ++ { ++ int count = u32_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else if (has_width) ++ { ++ /* Use the entire string, and count the number of ++ characters. */ ++ arg_end = arg; ++ characters = 0; ++ for (;;) ++ { ++ int count = u32_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else ++ { ++ /* Use the entire string. */ ++ arg_end = arg + u32_strlen (arg); ++ /* The number of characters doesn't matter. */ ++ characters = 0; ++ } ++ ++ if (has_width && width > characters ++ && !(dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ ++# if DCHAR_IS_UINT32_T ++ { ++ size_t n = arg_end - arg; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_CPY (result + length, arg, n); ++ length += n; ++ } ++# else ++ { /* Convert. */ ++ DCHAR_T *converted = result + length; ++ size_t converted_len = allocated - length; ++# if DCHAR_IS_TCHAR ++ /* Convert from UTF-32 to locale encoding. */ ++ converted = ++ u32_conv_to_encoding (locale_charset (), ++ iconveh_question_mark, ++ arg, arg_end - arg, NULL, ++ converted, &converted_len); ++# else ++ /* Convert from UTF-32 to UTF-8/UTF-16. */ ++ converted = ++ U32_TO_DCHAR (arg, arg_end - arg, ++ converted, &converted_len); ++# endif ++ if (converted == NULL) ++ { ++ int saved_errno = errno; ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = saved_errno; ++ return NULL; ++ } ++ if (converted != result + length) ++ { ++ ENSURE_ALLOCATION (xsum (length, converted_len)); ++ DCHAR_CPY (result + length, converted, converted_len); ++ free (converted); ++ } ++ length += converted_len; ++ } ++# endif ++ ++ if (has_width && width > characters ++ && (dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ } ++ break; ++ ++ default: ++ abort (); ++ } ++ } ++#endif ++#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T ++ else if (dp->conversion == 's' ++# if WIDE_CHAR_VERSION ++ && a.arg[dp->arg_index].type != TYPE_WIDE_STRING ++# else ++ && a.arg[dp->arg_index].type == TYPE_WIDE_STRING ++# endif ++ ) ++ { ++ /* The normal handling of the 's' directive below requires ++ allocating a temporary buffer. The determination of its ++ length (tmp_length), in the case when a precision is ++ specified, below requires a conversion between a char[] ++ string and a wchar_t[] wide string. It could be done, but ++ we have no guarantee that the implementation of sprintf will ++ use the exactly same algorithm. Without this guarantee, it ++ is possible to have buffer overrun bugs. In order to avoid ++ such bugs, we implement the entire processing of the 's' ++ directive ourselves. */ ++ int flags = dp->flags; ++ int has_width; ++ size_t width; ++ int has_precision; ++ size_t precision; ++ ++ has_width = 0; ++ width = 0; ++ if (dp->width_start != dp->width_end) ++ { ++ if (dp->width_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->width_arg_index].a.a_int; ++ if (arg < 0) ++ { ++ /* "A negative field width is taken as a '-' flag ++ followed by a positive field width." */ ++ flags |= FLAG_LEFT; ++ width = (unsigned int) (-arg); ++ } ++ else ++ width = arg; ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->width_start; ++ ++ do ++ width = xsum (xtimes (width, 10), *digitp++ - '0'); ++ while (digitp != dp->width_end); ++ } ++ has_width = 1; ++ } ++ ++ has_precision = 0; ++ precision = 6; ++ if (dp->precision_start != dp->precision_end) ++ { ++ if (dp->precision_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->precision_arg_index].a.a_int; ++ /* "A negative precision is taken as if the precision ++ were omitted." */ ++ if (arg >= 0) ++ { ++ precision = arg; ++ has_precision = 1; ++ } ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->precision_start + 1; ++ ++ precision = 0; ++ while (digitp != dp->precision_end) ++ precision = xsum (xtimes (precision, 10), *digitp++ - '0'); ++ has_precision = 1; ++ } ++ } ++ ++# if WIDE_CHAR_VERSION ++ /* %s in vasnwprintf. See the specification of fwprintf. */ ++ { ++ const char *arg = a.arg[dp->arg_index].a.a_string; ++ const char *arg_end; ++ size_t characters; ++ ++ if (has_precision) ++ { ++ /* Use only as many bytes as needed to produce PRECISION ++ wide characters, from the left. */ ++# if HAVE_MBRTOWC ++ mbstate_t state; ++ memset (&state, '\0', sizeof (mbstate_t)); ++# endif ++ arg_end = arg; ++ characters = 0; ++ for (; precision > 0; precision--) ++ { ++ int count; ++# if HAVE_MBRTOWC ++ count = mbrlen (arg_end, MB_CUR_MAX, &state); ++# else ++ count = mblen (arg_end, MB_CUR_MAX); ++# endif ++ if (count == 0) ++ /* Found the terminating NUL. */ ++ break; ++ if (count < 0) ++ { ++ /* Invalid or incomplete multibyte character. */ ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else if (has_width) ++ { ++ /* Use the entire string, and count the number of wide ++ characters. */ ++# if HAVE_MBRTOWC ++ mbstate_t state; ++ memset (&state, '\0', sizeof (mbstate_t)); ++# endif ++ arg_end = arg; ++ characters = 0; ++ for (;;) ++ { ++ int count; ++# if HAVE_MBRTOWC ++ count = mbrlen (arg_end, MB_CUR_MAX, &state); ++# else ++ count = mblen (arg_end, MB_CUR_MAX); ++# endif ++ if (count == 0) ++ /* Found the terminating NUL. */ ++ break; ++ if (count < 0) ++ { ++ /* Invalid or incomplete multibyte character. */ ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else ++ { ++ /* Use the entire string. */ ++ arg_end = arg + strlen (arg); ++ /* The number of characters doesn't matter. */ ++ characters = 0; ++ } ++ ++ if (has_width && width > characters ++ && !(dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ ++ if (has_precision || has_width) ++ { ++ /* We know the number of wide characters in advance. */ ++ size_t remaining; ++# if HAVE_MBRTOWC ++ mbstate_t state; ++ memset (&state, '\0', sizeof (mbstate_t)); ++# endif ++ ENSURE_ALLOCATION (xsum (length, characters)); ++ for (remaining = characters; remaining > 0; remaining--) ++ { ++ wchar_t wc; ++ int count; ++# if HAVE_MBRTOWC ++ count = mbrtowc (&wc, arg, arg_end - arg, &state); ++# else ++ count = mbtowc (&wc, arg, arg_end - arg); ++# endif ++ if (count <= 0) ++ /* mbrtowc not consistent with mbrlen, or mbtowc ++ not consistent with mblen. */ ++ abort (); ++ result[length++] = wc; ++ arg += count; ++ } ++ if (!(arg == arg_end)) ++ abort (); ++ } ++ else ++ { ++# if HAVE_MBRTOWC ++ mbstate_t state; ++ memset (&state, '\0', sizeof (mbstate_t)); ++# endif ++ while (arg < arg_end) ++ { ++ wchar_t wc; ++ int count; ++# if HAVE_MBRTOWC ++ count = mbrtowc (&wc, arg, arg_end - arg, &state); ++# else ++ count = mbtowc (&wc, arg, arg_end - arg); ++# endif ++ if (count <= 0) ++ /* mbrtowc not consistent with mbrlen, or mbtowc ++ not consistent with mblen. */ ++ abort (); ++ ENSURE_ALLOCATION (xsum (length, 1)); ++ result[length++] = wc; ++ arg += count; ++ } ++ } ++ ++ if (has_width && width > characters ++ && (dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ } ++# else ++ /* %ls in vasnprintf. See the specification of fprintf. */ ++ { ++ const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; ++ const wchar_t *arg_end; ++ size_t characters; ++# if !DCHAR_IS_TCHAR ++ /* This code assumes that TCHAR_T is 'char'. */ ++ verify (sizeof (TCHAR_T) == 1); ++ TCHAR_T *tmpsrc; ++ DCHAR_T *tmpdst; ++ size_t tmpdst_len; ++# endif ++ size_t w; ++ ++ if (has_precision) ++ { ++ /* Use only as many wide characters as needed to produce ++ at most PRECISION bytes, from the left. */ ++# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t ++ mbstate_t state; ++ memset (&state, '\0', sizeof (mbstate_t)); ++# endif ++ arg_end = arg; ++ characters = 0; ++ while (precision > 0) ++ { ++ char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ ++ int count; ++ ++ if (*arg_end == 0) ++ /* Found the terminating null wide character. */ ++ break; ++# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t ++ count = wcrtomb (cbuf, *arg_end, &state); ++# else ++ count = wctomb (cbuf, *arg_end); ++# endif ++ if (count < 0) ++ { ++ /* Cannot convert. */ ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ if (precision < count) ++ break; ++ arg_end++; ++ characters += count; ++ precision -= count; ++ } ++ } ++# if DCHAR_IS_TCHAR ++ else if (has_width) ++# else ++ else ++# endif ++ { ++ /* Use the entire string, and count the number of ++ bytes. */ ++# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t ++ mbstate_t state; ++ memset (&state, '\0', sizeof (mbstate_t)); ++# endif ++ arg_end = arg; ++ characters = 0; ++ for (;;) ++ { ++ char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ ++ int count; ++ ++ if (*arg_end == 0) ++ /* Found the terminating null wide character. */ ++ break; ++# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t ++ count = wcrtomb (cbuf, *arg_end, &state); ++# else ++ count = wctomb (cbuf, *arg_end); ++# endif ++ if (count < 0) ++ { ++ /* Cannot convert. */ ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end++; ++ characters += count; ++ } ++ } ++# if DCHAR_IS_TCHAR ++ else ++ { ++ /* Use the entire string. */ ++ arg_end = arg + local_wcslen (arg); ++ /* The number of bytes doesn't matter. */ ++ characters = 0; ++ } ++# endif ++ ++# if !DCHAR_IS_TCHAR ++ /* Convert the string into a piece of temporary memory. */ ++ tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T)); ++ if (tmpsrc == NULL) ++ goto out_of_memory; ++ { ++ TCHAR_T *tmpptr = tmpsrc; ++ size_t remaining; ++# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t ++ mbstate_t state; ++ memset (&state, '\0', sizeof (mbstate_t)); ++# endif ++ for (remaining = characters; remaining > 0; ) ++ { ++ char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ ++ int count; ++ ++ if (*arg == 0) ++ abort (); ++# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t ++ count = wcrtomb (cbuf, *arg, &state); ++# else ++ count = wctomb (cbuf, *arg); ++# endif ++ if (count <= 0) ++ /* Inconsistency. */ ++ abort (); ++ memcpy (tmpptr, cbuf, count); ++ tmpptr += count; ++ arg++; ++ remaining -= count; ++ } ++ if (!(arg == arg_end)) ++ abort (); ++ } ++ ++ /* Convert from TCHAR_T[] to DCHAR_T[]. */ ++ tmpdst = ++ DCHAR_CONV_FROM_ENCODING (locale_charset (), ++ iconveh_question_mark, ++ tmpsrc, characters, ++ NULL, ++ NULL, &tmpdst_len); ++ if (tmpdst == NULL) ++ { ++ int saved_errno = errno; ++ free (tmpsrc); ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = saved_errno; ++ return NULL; ++ } ++ free (tmpsrc); ++# endif ++ ++ if (has_width) ++ { ++# if ENABLE_UNISTDIO ++ /* Outside POSIX, it's preferrable to compare the width ++ against the number of _characters_ of the converted ++ value. */ ++ w = DCHAR_MBSNLEN (result + length, characters); ++# else ++ /* The width is compared against the number of _bytes_ ++ of the converted value, says POSIX. */ ++ w = characters; ++# endif ++ } ++ else ++ /* w doesn't matter. */ ++ w = 0; ++ ++ if (has_width && width > w ++ && !(dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - w; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ ++# if DCHAR_IS_TCHAR ++ if (has_precision || has_width) ++ { ++ /* We know the number of bytes in advance. */ ++ size_t remaining; ++# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t ++ mbstate_t state; ++ memset (&state, '\0', sizeof (mbstate_t)); ++# endif ++ ENSURE_ALLOCATION (xsum (length, characters)); ++ for (remaining = characters; remaining > 0; ) ++ { ++ char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ ++ int count; ++ ++ if (*arg == 0) ++ abort (); ++# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t ++ count = wcrtomb (cbuf, *arg, &state); ++# else ++ count = wctomb (cbuf, *arg); ++# endif ++ if (count <= 0) ++ /* Inconsistency. */ ++ abort (); ++ memcpy (result + length, cbuf, count); ++ length += count; ++ arg++; ++ remaining -= count; ++ } ++ if (!(arg == arg_end)) ++ abort (); ++ } ++ else ++ { ++# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t ++ mbstate_t state; ++ memset (&state, '\0', sizeof (mbstate_t)); ++# endif ++ while (arg < arg_end) ++ { ++ char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ ++ int count; ++ ++ if (*arg == 0) ++ abort (); ++# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t ++ count = wcrtomb (cbuf, *arg, &state); ++# else ++ count = wctomb (cbuf, *arg); ++# endif ++ if (count <= 0) ++ { ++ /* Cannot convert. */ ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ ENSURE_ALLOCATION (xsum (length, count)); ++ memcpy (result + length, cbuf, count); ++ length += count; ++ arg++; ++ } ++ } ++# else ++ ENSURE_ALLOCATION (xsum (length, tmpdst_len)); ++ DCHAR_CPY (result + length, tmpdst, tmpdst_len); ++ free (tmpdst); ++ length += tmpdst_len; ++# endif ++ ++ if (has_width && width > w ++ && (dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - w; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ } ++# endif ++ } ++#endif ++#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL ++ else if ((dp->conversion == 'a' || dp->conversion == 'A') ++# if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) ++ && (0 ++# if NEED_PRINTF_DOUBLE ++ || a.arg[dp->arg_index].type == TYPE_DOUBLE ++# endif ++# if NEED_PRINTF_LONG_DOUBLE ++ || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE ++# endif ++ ) ++# endif ++ ) ++ { ++ arg_type type = a.arg[dp->arg_index].type; ++ int flags = dp->flags; ++ int has_width; ++ size_t width; ++ int has_precision; ++ size_t precision; ++ size_t tmp_length; ++ DCHAR_T tmpbuf[700]; ++ DCHAR_T *tmp; ++ DCHAR_T *pad_ptr; ++ DCHAR_T *p; ++ ++ has_width = 0; ++ width = 0; ++ if (dp->width_start != dp->width_end) ++ { ++ if (dp->width_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->width_arg_index].a.a_int; ++ if (arg < 0) ++ { ++ /* "A negative field width is taken as a '-' flag ++ followed by a positive field width." */ ++ flags |= FLAG_LEFT; ++ width = (unsigned int) (-arg); ++ } ++ else ++ width = arg; ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->width_start; ++ ++ do ++ width = xsum (xtimes (width, 10), *digitp++ - '0'); ++ while (digitp != dp->width_end); ++ } ++ has_width = 1; ++ } ++ ++ has_precision = 0; ++ precision = 0; ++ if (dp->precision_start != dp->precision_end) ++ { ++ if (dp->precision_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->precision_arg_index].a.a_int; ++ /* "A negative precision is taken as if the precision ++ were omitted." */ ++ if (arg >= 0) ++ { ++ precision = arg; ++ has_precision = 1; ++ } ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->precision_start + 1; ++ ++ precision = 0; ++ while (digitp != dp->precision_end) ++ precision = xsum (xtimes (precision, 10), *digitp++ - '0'); ++ has_precision = 1; ++ } ++ } ++ ++ /* Allocate a temporary buffer of sufficient size. */ ++ if (type == TYPE_LONGDOUBLE) ++ tmp_length = ++ (unsigned int) ((LDBL_DIG + 1) ++ * 0.831 /* decimal -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++ tmp_length = ++ (unsigned int) ((DBL_DIG + 1) ++ * 0.831 /* decimal -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ if (tmp_length < precision) ++ tmp_length = precision; ++ /* Account for sign, decimal point etc. */ ++ tmp_length = xsum (tmp_length, 12); ++ ++ if (tmp_length < width) ++ tmp_length = width; ++ ++ tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ ++ ++ if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) ++ tmp = tmpbuf; ++ else ++ { ++ size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); ++ ++ if (size_overflow_p (tmp_memsize)) ++ /* Overflow, would lead to out of memory. */ ++ goto out_of_memory; ++ tmp = (DCHAR_T *) malloc (tmp_memsize); ++ if (tmp == NULL) ++ /* Out of memory. */ ++ goto out_of_memory; ++ } ++ ++ pad_ptr = NULL; ++ p = tmp; ++ if (type == TYPE_LONGDOUBLE) ++ { ++# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE ++ long double arg = a.arg[dp->arg_index].a.a_longdouble; ++ ++ if (isnanl (arg)) ++ { ++ if (dp->conversion == 'A') ++ { ++ *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; ++ } ++ else ++ { ++ *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; ++ } ++ } ++ else ++ { ++ int sign = 0; ++ DECL_LONG_DOUBLE_ROUNDING ++ ++ BEGIN_LONG_DOUBLE_ROUNDING (); ++ ++ if (signbit (arg)) /* arg < 0.0L or negative zero */ ++ { ++ sign = -1; ++ arg = -arg; ++ } ++ ++ if (sign < 0) ++ *p++ = '-'; ++ else if (flags & FLAG_SHOWSIGN) ++ *p++ = '+'; ++ else if (flags & FLAG_SPACE) ++ *p++ = ' '; ++ ++ if (arg > 0.0L && arg + arg == arg) ++ { ++ if (dp->conversion == 'A') ++ { ++ *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; ++ } ++ else ++ { ++ *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; ++ } ++ } ++ else ++ { ++ int exponent; ++ long double mantissa; ++ ++ if (arg > 0.0L) ++ mantissa = printf_frexpl (arg, &exponent); ++ else ++ { ++ exponent = 0; ++ mantissa = 0.0L; ++ } ++ ++ if (has_precision ++ && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1) ++ { ++ /* Round the mantissa. */ ++ long double tail = mantissa; ++ size_t q; ++ ++ for (q = precision; ; q--) ++ { ++ int digit = (int) tail; ++ tail -= digit; ++ if (q == 0) ++ { ++ if (digit & 1 ? tail >= 0.5L : tail > 0.5L) ++ tail = 1 - tail; ++ else ++ tail = - tail; ++ break; ++ } ++ tail *= 16.0L; ++ } ++ if (tail != 0.0L) ++ for (q = precision; q > 0; q--) ++ tail *= 0.0625L; ++ mantissa += tail; ++ } ++ ++ *p++ = '0'; ++ *p++ = dp->conversion - 'A' + 'X'; ++ pad_ptr = p; ++ { ++ int digit; ++ ++ digit = (int) mantissa; ++ mantissa -= digit; ++ *p++ = '0' + digit; ++ if ((flags & FLAG_ALT) ++ || mantissa > 0.0L || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ /* This loop terminates because we assume ++ that FLT_RADIX is a power of 2. */ ++ while (mantissa > 0.0L) ++ { ++ mantissa *= 16.0L; ++ digit = (int) mantissa; ++ mantissa -= digit; ++ *p++ = digit ++ + (digit < 10 ++ ? '0' ++ : dp->conversion - 10); ++ if (precision > 0) ++ precision--; ++ } ++ while (precision > 0) ++ { ++ *p++ = '0'; ++ precision--; ++ } ++ } ++ } ++ *p++ = dp->conversion - 'A' + 'P'; ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ { '%', '+', 'd', '\0' }; ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, "%+d", exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, "%+d", exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++# endif ++ } ++ ++ END_LONG_DOUBLE_ROUNDING (); ++ } ++# else ++ abort (); ++# endif ++ } ++ else ++ { ++# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE ++ double arg = a.arg[dp->arg_index].a.a_double; ++ ++ if (isnand (arg)) ++ { ++ if (dp->conversion == 'A') ++ { ++ *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; ++ } ++ else ++ { ++ *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; ++ } ++ } ++ else ++ { ++ int sign = 0; ++ ++ if (signbit (arg)) /* arg < 0.0 or negative zero */ ++ { ++ sign = -1; ++ arg = -arg; ++ } ++ ++ if (sign < 0) ++ *p++ = '-'; ++ else if (flags & FLAG_SHOWSIGN) ++ *p++ = '+'; ++ else if (flags & FLAG_SPACE) ++ *p++ = ' '; ++ ++ if (arg > 0.0 && arg + arg == arg) ++ { ++ if (dp->conversion == 'A') ++ { ++ *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; ++ } ++ else ++ { ++ *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; ++ } ++ } ++ else ++ { ++ int exponent; ++ double mantissa; ++ ++ if (arg > 0.0) ++ mantissa = printf_frexp (arg, &exponent); ++ else ++ { ++ exponent = 0; ++ mantissa = 0.0; ++ } ++ ++ if (has_precision ++ && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1) ++ { ++ /* Round the mantissa. */ ++ double tail = mantissa; ++ size_t q; ++ ++ for (q = precision; ; q--) ++ { ++ int digit = (int) tail; ++ tail -= digit; ++ if (q == 0) ++ { ++ if (digit & 1 ? tail >= 0.5 : tail > 0.5) ++ tail = 1 - tail; ++ else ++ tail = - tail; ++ break; ++ } ++ tail *= 16.0; ++ } ++ if (tail != 0.0) ++ for (q = precision; q > 0; q--) ++ tail *= 0.0625; ++ mantissa += tail; ++ } ++ ++ *p++ = '0'; ++ *p++ = dp->conversion - 'A' + 'X'; ++ pad_ptr = p; ++ { ++ int digit; ++ ++ digit = (int) mantissa; ++ mantissa -= digit; ++ *p++ = '0' + digit; ++ if ((flags & FLAG_ALT) ++ || mantissa > 0.0 || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ /* This loop terminates because we assume ++ that FLT_RADIX is a power of 2. */ ++ while (mantissa > 0.0) ++ { ++ mantissa *= 16.0; ++ digit = (int) mantissa; ++ mantissa -= digit; ++ *p++ = digit ++ + (digit < 10 ++ ? '0' ++ : dp->conversion - 10); ++ if (precision > 0) ++ precision--; ++ } ++ while (precision > 0) ++ { ++ *p++ = '0'; ++ precision--; ++ } ++ } ++ } ++ *p++ = dp->conversion - 'A' + 'P'; ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ { '%', '+', 'd', '\0' }; ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, "%+d", exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, "%+d", exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++# endif ++ } ++ } ++# else ++ abort (); ++# endif ++ } ++ /* The generated string now extends from tmp to p, with the ++ zero padding insertion point being at pad_ptr. */ ++ if (has_width && p - tmp < width) ++ { ++ size_t pad = width - (p - tmp); ++ DCHAR_T *end = p + pad; ++ ++ if (flags & FLAG_LEFT) ++ { ++ /* Pad with spaces on the right. */ ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ else if ((flags & FLAG_ZERO) && pad_ptr != NULL) ++ { ++ /* Pad with zeroes. */ ++ DCHAR_T *q = end; ++ ++ while (p > pad_ptr) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = '0'; ++ } ++ else ++ { ++ /* Pad with spaces on the left. */ ++ DCHAR_T *q = end; ++ ++ while (p > tmp) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ ++ p = end; ++ } ++ ++ { ++ size_t count = p - tmp; ++ ++ if (count >= tmp_length) ++ /* tmp_length was incorrectly calculated - fix the ++ code above! */ ++ abort (); ++ ++ /* Make room for the result. */ ++ if (count >= allocated - length) ++ { ++ size_t n = xsum (length, count); ++ ++ ENSURE_ALLOCATION (n); ++ } ++ ++ /* Append the result. */ ++ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); ++ if (tmp != tmpbuf) ++ free (tmp); ++ length += count; ++ } ++ } ++#endif ++#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL ++ else if ((dp->conversion == 'f' || dp->conversion == 'F' ++ || dp->conversion == 'e' || dp->conversion == 'E' ++ || dp->conversion == 'g' || dp->conversion == 'G' ++ || dp->conversion == 'a' || dp->conversion == 'A') ++ && (0 ++# if NEED_PRINTF_DOUBLE ++ || a.arg[dp->arg_index].type == TYPE_DOUBLE ++# elif NEED_PRINTF_INFINITE_DOUBLE ++ || (a.arg[dp->arg_index].type == TYPE_DOUBLE ++ /* The systems (mingw) which produce wrong output ++ for Inf, -Inf, and NaN also do so for -0.0. ++ Therefore we treat this case here as well. */ ++ && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double)) ++# endif ++# if NEED_PRINTF_LONG_DOUBLE ++ || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE ++# elif NEED_PRINTF_INFINITE_LONG_DOUBLE ++ || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE ++ /* Some systems produce wrong output for Inf, ++ -Inf, and NaN. Some systems in this category ++ (IRIX 5.3) also do so for -0.0. Therefore we ++ treat this case here as well. */ ++ && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble)) ++# endif ++ )) ++ { ++# if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) ++ arg_type type = a.arg[dp->arg_index].type; ++# endif ++ int flags = dp->flags; ++ int has_width; ++ size_t width; ++ int has_precision; ++ size_t precision; ++ size_t tmp_length; ++ DCHAR_T tmpbuf[700]; ++ DCHAR_T *tmp; ++ DCHAR_T *pad_ptr; ++ DCHAR_T *p; ++ ++ has_width = 0; ++ width = 0; ++ if (dp->width_start != dp->width_end) ++ { ++ if (dp->width_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->width_arg_index].a.a_int; ++ if (arg < 0) ++ { ++ /* "A negative field width is taken as a '-' flag ++ followed by a positive field width." */ ++ flags |= FLAG_LEFT; ++ width = (unsigned int) (-arg); ++ } ++ else ++ width = arg; ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->width_start; ++ ++ do ++ width = xsum (xtimes (width, 10), *digitp++ - '0'); ++ while (digitp != dp->width_end); ++ } ++ has_width = 1; ++ } ++ ++ has_precision = 0; ++ precision = 0; ++ if (dp->precision_start != dp->precision_end) ++ { ++ if (dp->precision_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->precision_arg_index].a.a_int; ++ /* "A negative precision is taken as if the precision ++ were omitted." */ ++ if (arg >= 0) ++ { ++ precision = arg; ++ has_precision = 1; ++ } ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->precision_start + 1; ++ ++ precision = 0; ++ while (digitp != dp->precision_end) ++ precision = xsum (xtimes (precision, 10), *digitp++ - '0'); ++ has_precision = 1; ++ } ++ } ++ ++ /* POSIX specifies the default precision to be 6 for %f, %F, ++ %e, %E, but not for %g, %G. Implementations appear to use ++ the same default precision also for %g, %G. But for %a, %A, ++ the default precision is 0. */ ++ if (!has_precision) ++ if (!(dp->conversion == 'a' || dp->conversion == 'A')) ++ precision = 6; ++ ++ /* Allocate a temporary buffer of sufficient size. */ ++# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE ++ tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1); ++# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE ++ tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0); ++# elif NEED_PRINTF_LONG_DOUBLE ++ tmp_length = LDBL_DIG + 1; ++# elif NEED_PRINTF_DOUBLE ++ tmp_length = DBL_DIG + 1; ++# else ++ tmp_length = 0; ++# endif ++ if (tmp_length < precision) ++ tmp_length = precision; ++# if NEED_PRINTF_LONG_DOUBLE ++# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE ++ if (type == TYPE_LONGDOUBLE) ++# endif ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ long double arg = a.arg[dp->arg_index].a.a_longdouble; ++ if (!(isnanl (arg) || arg + arg == arg)) ++ { ++ /* arg is finite and nonzero. */ ++ int exponent = floorlog10l (arg < 0 ? -arg : arg); ++ if (exponent >= 0 && tmp_length < exponent + precision) ++ tmp_length = exponent + precision; ++ } ++ } ++# endif ++# if NEED_PRINTF_DOUBLE ++# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE ++ if (type == TYPE_DOUBLE) ++# endif ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ double arg = a.arg[dp->arg_index].a.a_double; ++ if (!(isnand (arg) || arg + arg == arg)) ++ { ++ /* arg is finite and nonzero. */ ++ int exponent = floorlog10 (arg < 0 ? -arg : arg); ++ if (exponent >= 0 && tmp_length < exponent + precision) ++ tmp_length = exponent + precision; ++ } ++ } ++# endif ++ /* Account for sign, decimal point etc. */ ++ tmp_length = xsum (tmp_length, 12); ++ ++ if (tmp_length < width) ++ tmp_length = width; ++ ++ tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ ++ ++ if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) ++ tmp = tmpbuf; ++ else ++ { ++ size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); ++ ++ if (size_overflow_p (tmp_memsize)) ++ /* Overflow, would lead to out of memory. */ ++ goto out_of_memory; ++ tmp = (DCHAR_T *) malloc (tmp_memsize); ++ if (tmp == NULL) ++ /* Out of memory. */ ++ goto out_of_memory; ++ } ++ ++ pad_ptr = NULL; ++ p = tmp; ++ ++# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE ++# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE ++ if (type == TYPE_LONGDOUBLE) ++# endif ++ { ++ long double arg = a.arg[dp->arg_index].a.a_longdouble; ++ ++ if (isnanl (arg)) ++ { ++ if (dp->conversion >= 'A' && dp->conversion <= 'Z') ++ { ++ *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; ++ } ++ else ++ { ++ *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; ++ } ++ } ++ else ++ { ++ int sign = 0; ++ DECL_LONG_DOUBLE_ROUNDING ++ ++ BEGIN_LONG_DOUBLE_ROUNDING (); ++ ++ if (signbit (arg)) /* arg < 0.0L or negative zero */ ++ { ++ sign = -1; ++ arg = -arg; ++ } ++ ++ if (sign < 0) ++ *p++ = '-'; ++ else if (flags & FLAG_SHOWSIGN) ++ *p++ = '+'; ++ else if (flags & FLAG_SPACE) ++ *p++ = ' '; ++ ++ if (arg > 0.0L && arg + arg == arg) ++ { ++ if (dp->conversion >= 'A' && dp->conversion <= 'Z') ++ { ++ *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; ++ } ++ else ++ { ++ *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; ++ } ++ } ++ else ++ { ++# if NEED_PRINTF_LONG_DOUBLE ++ pad_ptr = p; ++ ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ char *digits; ++ size_t ndigits; ++ ++ digits = ++ scale10_round_decimal_long_double (arg, precision); ++ if (digits == NULL) ++ { ++ END_LONG_DOUBLE_ROUNDING (); ++ goto out_of_memory; ++ } ++ ndigits = strlen (digits); ++ ++ if (ndigits > precision) ++ do ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ while (ndigits > precision); ++ else ++ *p++ = '0'; ++ /* Here ndigits <= precision. */ ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > ndigits; precision--) ++ *p++ = '0'; ++ while (ndigits > 0) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ ++ free (digits); ++ } ++ else if (dp->conversion == 'e' || dp->conversion == 'E') ++ { ++ int exponent; ++ ++ if (arg == 0.0L) ++ { ++ exponent = 0; ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ } ++ else ++ { ++ /* arg > 0.0L. */ ++ int adjusted; ++ char *digits; ++ size_t ndigits; ++ ++ exponent = floorlog10l (arg); ++ adjusted = 0; ++ for (;;) ++ { ++ digits = ++ scale10_round_decimal_long_double (arg, ++ (int)precision - exponent); ++ if (digits == NULL) ++ { ++ END_LONG_DOUBLE_ROUNDING (); ++ goto out_of_memory; ++ } ++ ndigits = strlen (digits); ++ ++ if (ndigits == precision + 1) ++ break; ++ if (ndigits < precision ++ || ndigits > precision + 2) ++ /* The exponent was not guessed ++ precisely enough. */ ++ abort (); ++ if (adjusted) ++ /* None of two values of exponent is ++ the right one. Prevent an endless ++ loop. */ ++ abort (); ++ free (digits); ++ if (ndigits == precision) ++ exponent -= 1; ++ else ++ exponent += 1; ++ adjusted = 1; ++ } ++ /* Here ndigits = precision+1. */ ++ if (is_borderline (digits, precision)) ++ { ++ /* Maybe the exponent guess was too high ++ and a smaller exponent can be reached ++ by turning a 10...0 into 9...9x. */ ++ char *digits2 = ++ scale10_round_decimal_long_double (arg, ++ (int)precision - exponent + 1); ++ if (digits2 == NULL) ++ { ++ free (digits); ++ END_LONG_DOUBLE_ROUNDING (); ++ goto out_of_memory; ++ } ++ if (strlen (digits2) == precision + 1) ++ { ++ free (digits); ++ digits = digits2; ++ exponent -= 1; ++ } ++ else ++ free (digits2); ++ } ++ /* Here ndigits = precision+1. */ ++ ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > 0) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ ++ free (digits); ++ } ++ ++ *p++ = dp->conversion; /* 'e' or 'E' */ ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ { '%', '+', '.', '2', 'd', '\0' }; ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, "%+.2d", exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, "%+.2d", exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++# endif ++ } ++ else if (dp->conversion == 'g' || dp->conversion == 'G') ++ { ++ if (precision == 0) ++ precision = 1; ++ /* precision >= 1. */ ++ ++ if (arg == 0.0L) ++ /* The exponent is 0, >= -4, < precision. ++ Use fixed-point notation. */ ++ { ++ size_t ndigits = precision; ++ /* Number of trailing zeroes that have to be ++ dropped. */ ++ size_t nzeroes = ++ (flags & FLAG_ALT ? 0 : precision - 1); ++ ++ --ndigits; ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = '0'; ++ } ++ } ++ } ++ else ++ { ++ /* arg > 0.0L. */ ++ int exponent; ++ int adjusted; ++ char *digits; ++ size_t ndigits; ++ size_t nzeroes; ++ ++ exponent = floorlog10l (arg); ++ adjusted = 0; ++ for (;;) ++ { ++ digits = ++ scale10_round_decimal_long_double (arg, ++ (int)(precision - 1) - exponent); ++ if (digits == NULL) ++ { ++ END_LONG_DOUBLE_ROUNDING (); ++ goto out_of_memory; ++ } ++ ndigits = strlen (digits); ++ ++ if (ndigits == precision) ++ break; ++ if (ndigits < precision - 1 ++ || ndigits > precision + 1) ++ /* The exponent was not guessed ++ precisely enough. */ ++ abort (); ++ if (adjusted) ++ /* None of two values of exponent is ++ the right one. Prevent an endless ++ loop. */ ++ abort (); ++ free (digits); ++ if (ndigits < precision) ++ exponent -= 1; ++ else ++ exponent += 1; ++ adjusted = 1; ++ } ++ /* Here ndigits = precision. */ ++ if (is_borderline (digits, precision - 1)) ++ { ++ /* Maybe the exponent guess was too high ++ and a smaller exponent can be reached ++ by turning a 10...0 into 9...9x. */ ++ char *digits2 = ++ scale10_round_decimal_long_double (arg, ++ (int)(precision - 1) - exponent + 1); ++ if (digits2 == NULL) ++ { ++ free (digits); ++ END_LONG_DOUBLE_ROUNDING (); ++ goto out_of_memory; ++ } ++ if (strlen (digits2) == precision) ++ { ++ free (digits); ++ digits = digits2; ++ exponent -= 1; ++ } ++ else ++ free (digits2); ++ } ++ /* Here ndigits = precision. */ ++ ++ /* Determine the number of trailing zeroes ++ that have to be dropped. */ ++ nzeroes = 0; ++ if ((flags & FLAG_ALT) == 0) ++ while (nzeroes < ndigits ++ && digits[nzeroes] == '0') ++ nzeroes++; ++ ++ /* The exponent is now determined. */ ++ if (exponent >= -4 ++ && exponent < (long)precision) ++ { ++ /* Fixed-point notation: ++ max(exponent,0)+1 digits, then the ++ decimal point, then the remaining ++ digits without trailing zeroes. */ ++ if (exponent >= 0) ++ { ++ size_t count = exponent + 1; ++ /* Note: count <= precision = ndigits. */ ++ for (; count > 0; count--) ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ } ++ else ++ { ++ size_t count = -exponent - 1; ++ *p++ = '0'; ++ *p++ = decimal_point_char (); ++ for (; count > 0; count--) ++ *p++ = '0'; ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ } ++ else ++ { ++ /* Exponential notation. */ ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ { '%', '+', '.', '2', 'd', '\0' }; ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, "%+.2d", exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, "%+.2d", exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++# endif ++ } ++ ++ free (digits); ++ } ++ } ++ else ++ abort (); ++# else ++ /* arg is finite. */ ++ if (!(arg == 0.0L)) ++ abort (); ++ ++ pad_ptr = p; ++ ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ } ++ else if (dp->conversion == 'e' || dp->conversion == 'E') ++ { ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ *p++ = dp->conversion; /* 'e' or 'E' */ ++ *p++ = '+'; ++ *p++ = '0'; ++ *p++ = '0'; ++ } ++ else if (dp->conversion == 'g' || dp->conversion == 'G') ++ { ++ *p++ = '0'; ++ if (flags & FLAG_ALT) ++ { ++ size_t ndigits = ++ (precision > 0 ? precision - 1 : 0); ++ *p++ = decimal_point_char (); ++ for (; ndigits > 0; --ndigits) ++ *p++ = '0'; ++ } ++ } ++ else if (dp->conversion == 'a' || dp->conversion == 'A') ++ { ++ *p++ = '0'; ++ *p++ = dp->conversion - 'A' + 'X'; ++ pad_ptr = p; ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ *p++ = dp->conversion - 'A' + 'P'; ++ *p++ = '+'; ++ *p++ = '0'; ++ } ++ else ++ abort (); ++# endif ++ } ++ ++ END_LONG_DOUBLE_ROUNDING (); ++ } ++ } ++# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE ++ else ++# endif ++# endif ++# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE ++ { ++ double arg = a.arg[dp->arg_index].a.a_double; ++ ++ if (isnand (arg)) ++ { ++ if (dp->conversion >= 'A' && dp->conversion <= 'Z') ++ { ++ *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; ++ } ++ else ++ { ++ *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; ++ } ++ } ++ else ++ { ++ int sign = 0; ++ ++ if (signbit (arg)) /* arg < 0.0 or negative zero */ ++ { ++ sign = -1; ++ arg = -arg; ++ } ++ ++ if (sign < 0) ++ *p++ = '-'; ++ else if (flags & FLAG_SHOWSIGN) ++ *p++ = '+'; ++ else if (flags & FLAG_SPACE) ++ *p++ = ' '; ++ ++ if (arg > 0.0 && arg + arg == arg) ++ { ++ if (dp->conversion >= 'A' && dp->conversion <= 'Z') ++ { ++ *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; ++ } ++ else ++ { ++ *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; ++ } ++ } ++ else ++ { ++# if NEED_PRINTF_DOUBLE ++ pad_ptr = p; ++ ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ char *digits; ++ size_t ndigits; ++ ++ digits = ++ scale10_round_decimal_double (arg, precision); ++ if (digits == NULL) ++ goto out_of_memory; ++ ndigits = strlen (digits); ++ ++ if (ndigits > precision) ++ do ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ while (ndigits > precision); ++ else ++ *p++ = '0'; ++ /* Here ndigits <= precision. */ ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > ndigits; precision--) ++ *p++ = '0'; ++ while (ndigits > 0) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ ++ free (digits); ++ } ++ else if (dp->conversion == 'e' || dp->conversion == 'E') ++ { ++ int exponent; ++ ++ if (arg == 0.0) ++ { ++ exponent = 0; ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ } ++ else ++ { ++ /* arg > 0.0. */ ++ int adjusted; ++ char *digits; ++ size_t ndigits; ++ ++ exponent = floorlog10 (arg); ++ adjusted = 0; ++ for (;;) ++ { ++ digits = ++ scale10_round_decimal_double (arg, ++ (int)precision - exponent); ++ if (digits == NULL) ++ goto out_of_memory; ++ ndigits = strlen (digits); ++ ++ if (ndigits == precision + 1) ++ break; ++ if (ndigits < precision ++ || ndigits > precision + 2) ++ /* The exponent was not guessed ++ precisely enough. */ ++ abort (); ++ if (adjusted) ++ /* None of two values of exponent is ++ the right one. Prevent an endless ++ loop. */ ++ abort (); ++ free (digits); ++ if (ndigits == precision) ++ exponent -= 1; ++ else ++ exponent += 1; ++ adjusted = 1; ++ } ++ /* Here ndigits = precision+1. */ ++ if (is_borderline (digits, precision)) ++ { ++ /* Maybe the exponent guess was too high ++ and a smaller exponent can be reached ++ by turning a 10...0 into 9...9x. */ ++ char *digits2 = ++ scale10_round_decimal_double (arg, ++ (int)precision - exponent + 1); ++ if (digits2 == NULL) ++ { ++ free (digits); ++ goto out_of_memory; ++ } ++ if (strlen (digits2) == precision + 1) ++ { ++ free (digits); ++ digits = digits2; ++ exponent -= 1; ++ } ++ else ++ free (digits2); ++ } ++ /* Here ndigits = precision+1. */ ++ ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > 0) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ ++ free (digits); ++ } ++ ++ *p++ = dp->conversion; /* 'e' or 'E' */ ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ /* Produce the same number of exponent digits ++ as the native printf implementation. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ { '%', '+', '.', '3', 'd', '\0' }; ++# else ++ { '%', '+', '.', '2', 'd', '\0' }; ++# endif ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ { ++ static const char decimal_format[] = ++ /* Produce the same number of exponent digits ++ as the native printf implementation. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ "%+.3d"; ++# else ++ "%+.2d"; ++# endif ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, decimal_format, exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, decimal_format, exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++ } ++# endif ++ } ++ else if (dp->conversion == 'g' || dp->conversion == 'G') ++ { ++ if (precision == 0) ++ precision = 1; ++ /* precision >= 1. */ ++ ++ if (arg == 0.0) ++ /* The exponent is 0, >= -4, < precision. ++ Use fixed-point notation. */ ++ { ++ size_t ndigits = precision; ++ /* Number of trailing zeroes that have to be ++ dropped. */ ++ size_t nzeroes = ++ (flags & FLAG_ALT ? 0 : precision - 1); ++ ++ --ndigits; ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = '0'; ++ } ++ } ++ } ++ else ++ { ++ /* arg > 0.0. */ ++ int exponent; ++ int adjusted; ++ char *digits; ++ size_t ndigits; ++ size_t nzeroes; ++ ++ exponent = floorlog10 (arg); ++ adjusted = 0; ++ for (;;) ++ { ++ digits = ++ scale10_round_decimal_double (arg, ++ (int)(precision - 1) - exponent); ++ if (digits == NULL) ++ goto out_of_memory; ++ ndigits = strlen (digits); ++ ++ if (ndigits == precision) ++ break; ++ if (ndigits < precision - 1 ++ || ndigits > precision + 1) ++ /* The exponent was not guessed ++ precisely enough. */ ++ abort (); ++ if (adjusted) ++ /* None of two values of exponent is ++ the right one. Prevent an endless ++ loop. */ ++ abort (); ++ free (digits); ++ if (ndigits < precision) ++ exponent -= 1; ++ else ++ exponent += 1; ++ adjusted = 1; ++ } ++ /* Here ndigits = precision. */ ++ if (is_borderline (digits, precision - 1)) ++ { ++ /* Maybe the exponent guess was too high ++ and a smaller exponent can be reached ++ by turning a 10...0 into 9...9x. */ ++ char *digits2 = ++ scale10_round_decimal_double (arg, ++ (int)(precision - 1) - exponent + 1); ++ if (digits2 == NULL) ++ { ++ free (digits); ++ goto out_of_memory; ++ } ++ if (strlen (digits2) == precision) ++ { ++ free (digits); ++ digits = digits2; ++ exponent -= 1; ++ } ++ else ++ free (digits2); ++ } ++ /* Here ndigits = precision. */ ++ ++ /* Determine the number of trailing zeroes ++ that have to be dropped. */ ++ nzeroes = 0; ++ if ((flags & FLAG_ALT) == 0) ++ while (nzeroes < ndigits ++ && digits[nzeroes] == '0') ++ nzeroes++; ++ ++ /* The exponent is now determined. */ ++ if (exponent >= -4 ++ && exponent < (long)precision) ++ { ++ /* Fixed-point notation: ++ max(exponent,0)+1 digits, then the ++ decimal point, then the remaining ++ digits without trailing zeroes. */ ++ if (exponent >= 0) ++ { ++ size_t count = exponent + 1; ++ /* Note: count <= precision = ndigits. */ ++ for (; count > 0; count--) ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ } ++ else ++ { ++ size_t count = -exponent - 1; ++ *p++ = '0'; ++ *p++ = decimal_point_char (); ++ for (; count > 0; count--) ++ *p++ = '0'; ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ } ++ else ++ { ++ /* Exponential notation. */ ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ /* Produce the same number of exponent digits ++ as the native printf implementation. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ { '%', '+', '.', '3', 'd', '\0' }; ++# else ++ { '%', '+', '.', '2', 'd', '\0' }; ++# endif ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ { ++ static const char decimal_format[] = ++ /* Produce the same number of exponent digits ++ as the native printf implementation. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ "%+.3d"; ++# else ++ "%+.2d"; ++# endif ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, decimal_format, exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, decimal_format, exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++ } ++# endif ++ } ++ ++ free (digits); ++ } ++ } ++ else ++ abort (); ++# else ++ /* arg is finite. */ ++ if (!(arg == 0.0)) ++ abort (); ++ ++ pad_ptr = p; ++ ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ } ++ else if (dp->conversion == 'e' || dp->conversion == 'E') ++ { ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ *p++ = dp->conversion; /* 'e' or 'E' */ ++ *p++ = '+'; ++ /* Produce the same number of exponent digits as ++ the native printf implementation. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ *p++ = '0'; ++# endif ++ *p++ = '0'; ++ *p++ = '0'; ++ } ++ else if (dp->conversion == 'g' || dp->conversion == 'G') ++ { ++ *p++ = '0'; ++ if (flags & FLAG_ALT) ++ { ++ size_t ndigits = ++ (precision > 0 ? precision - 1 : 0); ++ *p++ = decimal_point_char (); ++ for (; ndigits > 0; --ndigits) ++ *p++ = '0'; ++ } ++ } ++ else ++ abort (); ++# endif ++ } ++ } ++ } ++# endif ++ ++ /* The generated string now extends from tmp to p, with the ++ zero padding insertion point being at pad_ptr. */ ++ if (has_width && p - tmp < width) ++ { ++ size_t pad = width - (p - tmp); ++ DCHAR_T *end = p + pad; ++ ++ if (flags & FLAG_LEFT) ++ { ++ /* Pad with spaces on the right. */ ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ else if ((flags & FLAG_ZERO) && pad_ptr != NULL) ++ { ++ /* Pad with zeroes. */ ++ DCHAR_T *q = end; ++ ++ while (p > pad_ptr) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = '0'; ++ } ++ else ++ { ++ /* Pad with spaces on the left. */ ++ DCHAR_T *q = end; ++ ++ while (p > tmp) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ ++ p = end; ++ } ++ ++ { ++ size_t count = p - tmp; ++ ++ if (count >= tmp_length) ++ /* tmp_length was incorrectly calculated - fix the ++ code above! */ ++ abort (); ++ ++ /* Make room for the result. */ ++ if (count >= allocated - length) ++ { ++ size_t n = xsum (length, count); ++ ++ ENSURE_ALLOCATION (n); ++ } ++ ++ /* Append the result. */ ++ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); ++ if (tmp != tmpbuf) ++ free (tmp); ++ length += count; ++ } ++ } ++#endif ++ else ++ { ++ arg_type type = a.arg[dp->arg_index].type; ++ int flags = dp->flags; ++#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION ++ int has_width; ++ size_t width; ++#endif ++#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION ++ int has_precision; ++ size_t precision; ++#endif ++#if NEED_PRINTF_UNBOUNDED_PRECISION ++ int prec_ourselves; ++#else ++# define prec_ourselves 0 ++#endif ++#if NEED_PRINTF_FLAG_LEFTADJUST ++# define pad_ourselves 1 ++#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION ++ int pad_ourselves; ++#else ++# define pad_ourselves 0 ++#endif ++ TCHAR_T *fbp; ++ unsigned int prefix_count; ++ int prefixes[2] IF_LINT (= { 0 }); ++ int orig_errno; ++#if !USE_SNPRINTF ++ size_t tmp_length; ++ TCHAR_T tmpbuf[700]; ++ TCHAR_T *tmp; ++#endif ++ ++#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION ++ has_width = 0; ++ width = 0; ++ if (dp->width_start != dp->width_end) ++ { ++ if (dp->width_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->width_arg_index].a.a_int; ++ if (arg < 0) ++ { ++ /* "A negative field width is taken as a '-' flag ++ followed by a positive field width." */ ++ flags |= FLAG_LEFT; ++ width = (unsigned int) (-arg); ++ } ++ else ++ width = arg; ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->width_start; ++ ++ do ++ width = xsum (xtimes (width, 10), *digitp++ - '0'); ++ while (digitp != dp->width_end); ++ } ++ has_width = 1; ++ } ++#endif ++ ++#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION ++ has_precision = 0; ++ precision = 6; ++ if (dp->precision_start != dp->precision_end) ++ { ++ if (dp->precision_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->precision_arg_index].a.a_int; ++ /* "A negative precision is taken as if the precision ++ were omitted." */ ++ if (arg >= 0) ++ { ++ precision = arg; ++ has_precision = 1; ++ } ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->precision_start + 1; ++ ++ precision = 0; ++ while (digitp != dp->precision_end) ++ precision = xsum (xtimes (precision, 10), *digitp++ - '0'); ++ has_precision = 1; ++ } ++ } ++#endif ++ ++ /* Decide whether to handle the precision ourselves. */ ++#if NEED_PRINTF_UNBOUNDED_PRECISION ++ switch (dp->conversion) ++ { ++ case 'd': case 'i': case 'u': ++ case 'o': ++ case 'x': case 'X': case 'p': ++ prec_ourselves = has_precision && (precision > 0); ++ break; ++ default: ++ prec_ourselves = 0; ++ break; ++ } ++#endif ++ ++ /* Decide whether to perform the padding ourselves. */ ++#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION) ++ switch (dp->conversion) ++ { ++# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO ++ /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need ++ to perform the padding after this conversion. Functions ++ with unistdio extensions perform the padding based on ++ character count rather than element count. */ ++ case 'c': case 's': ++# endif ++# if NEED_PRINTF_FLAG_ZERO ++ case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': ++ case 'a': case 'A': ++# endif ++ pad_ourselves = 1; ++ break; ++ default: ++ pad_ourselves = prec_ourselves; ++ break; ++ } ++#endif ++ ++#if !USE_SNPRINTF ++ /* Allocate a temporary buffer of sufficient size for calling ++ sprintf. */ ++ tmp_length = ++ MAX_ROOM_NEEDED (&a, dp->arg_index, dp->conversion, type, ++ flags, width, has_precision, precision, ++ pad_ourselves); ++ ++ if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T)) ++ tmp = tmpbuf; ++ else ++ { ++ size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T)); ++ ++ if (size_overflow_p (tmp_memsize)) ++ /* Overflow, would lead to out of memory. */ ++ goto out_of_memory; ++ tmp = (TCHAR_T *) malloc (tmp_memsize); ++ if (tmp == NULL) ++ /* Out of memory. */ ++ goto out_of_memory; ++ } ++#endif ++ ++ /* Construct the format string for calling snprintf or ++ sprintf. */ ++ fbp = buf; ++ *fbp++ = '%'; ++#if NEED_PRINTF_FLAG_GROUPING ++ /* The underlying implementation doesn't support the ' flag. ++ Produce no grouping characters in this case; this is ++ acceptable because the grouping is locale dependent. */ ++#else ++ if (flags & FLAG_GROUP) ++ *fbp++ = '\''; ++#endif ++ if (flags & FLAG_LEFT) ++ *fbp++ = '-'; ++ if (flags & FLAG_SHOWSIGN) ++ *fbp++ = '+'; ++ if (flags & FLAG_SPACE) ++ *fbp++ = ' '; ++ if (flags & FLAG_ALT) ++ *fbp++ = '#'; ++#if __GLIBC__ >= 2 && !defined __UCLIBC__ ++ if (flags & FLAG_LOCALIZED) ++ *fbp++ = 'I'; ++#endif ++ if (!pad_ourselves) ++ { ++ if (flags & FLAG_ZERO) ++ *fbp++ = '0'; ++ if (dp->width_start != dp->width_end) ++ { ++ size_t n = dp->width_end - dp->width_start; ++ /* The width specification is known to consist only ++ of standard ASCII characters. */ ++ if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) ++ { ++ memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T)); ++ fbp += n; ++ } ++ else ++ { ++ const FCHAR_T *mp = dp->width_start; ++ do ++ *fbp++ = (unsigned char) *mp++; ++ while (--n > 0); ++ } ++ } ++ } ++ if (!prec_ourselves) ++ { ++ if (dp->precision_start != dp->precision_end) ++ { ++ size_t n = dp->precision_end - dp->precision_start; ++ /* The precision specification is known to consist only ++ of standard ASCII characters. */ ++ if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) ++ { ++ memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T)); ++ fbp += n; ++ } ++ else ++ { ++ const FCHAR_T *mp = dp->precision_start; ++ do ++ *fbp++ = (unsigned char) *mp++; ++ while (--n > 0); ++ } ++ } ++ } ++ ++ switch (type) ++ { ++#if HAVE_LONG_LONG_INT ++ case TYPE_LONGLONGINT: ++ case TYPE_ULONGLONGINT: ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ *fbp++ = 'I'; ++ *fbp++ = '6'; ++ *fbp++ = '4'; ++ break; ++# else ++ *fbp++ = 'l'; ++ /*FALLTHROUGH*/ ++# endif ++#endif ++ case TYPE_LONGINT: ++ case TYPE_ULONGINT: ++#if HAVE_WINT_T ++ case TYPE_WIDE_CHAR: ++#endif ++#if HAVE_WCHAR_T ++ case TYPE_WIDE_STRING: ++#endif ++ *fbp++ = 'l'; ++ break; ++ case TYPE_LONGDOUBLE: ++ *fbp++ = 'L'; ++ break; ++ default: ++ break; ++ } ++#if NEED_PRINTF_DIRECTIVE_F ++ if (dp->conversion == 'F') ++ *fbp = 'f'; ++ else ++#endif ++ *fbp = dp->conversion; ++#if USE_SNPRINTF ++# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) ++ fbp[1] = '%'; ++ fbp[2] = 'n'; ++ fbp[3] = '\0'; ++# else ++ /* On glibc2 systems from glibc >= 2.3 - probably also older ++ ones - we know that snprintf's return value conforms to ++ ISO C 99: the tests gl_SNPRINTF_RETVAL_C99 and ++ gl_SNPRINTF_TRUNCATION_C99 pass. ++ Therefore we can avoid using %n in this situation. ++ On glibc2 systems from 2004-10-18 or newer, the use of %n ++ in format strings in writable memory may crash the program ++ (if compiled with _FORTIFY_SOURCE=2), so we should avoid it ++ in this situation. */ ++ /* On native Win32 systems (such as mingw), we can avoid using ++ %n because: ++ - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, ++ snprintf does not write more than the specified number ++ of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes ++ '4', '5', '6' into buf, not '4', '5', '\0'.) ++ - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf ++ allows us to recognize the case of an insufficient ++ buffer size: it returns -1 in this case. ++ On native Win32 systems (such as mingw) where the OS is ++ Windows Vista, the use of %n in format strings by default ++ crashes the program. See ++ and ++ ++ So we should avoid %n in this situation. */ ++ fbp[1] = '\0'; ++# endif ++#else ++ fbp[1] = '\0'; ++#endif ++ ++ /* Construct the arguments for calling snprintf or sprintf. */ ++ prefix_count = 0; ++ if (!pad_ourselves && dp->width_arg_index != ARG_NONE) ++ { ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int; ++ } ++ if (!prec_ourselves && dp->precision_arg_index != ARG_NONE) ++ { ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int; ++ } ++ ++#if USE_SNPRINTF ++ /* The SNPRINTF result is appended after result[0..length]. ++ The latter is an array of DCHAR_T; SNPRINTF appends an ++ array of TCHAR_T to it. This is possible because ++ sizeof (TCHAR_T) divides sizeof (DCHAR_T) and ++ alignof (TCHAR_T) <= alignof (DCHAR_T). */ ++# define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T)) ++ /* Ensure that maxlen below will be >= 2. Needed on BeOS, ++ where an snprintf() with maxlen==1 acts like sprintf(). */ ++ ENSURE_ALLOCATION (xsum (length, ++ (2 + TCHARS_PER_DCHAR - 1) ++ / TCHARS_PER_DCHAR)); ++ /* Prepare checking whether snprintf returns the count ++ via %n. */ ++ *(TCHAR_T *) (result + length) = '\0'; ++#endif ++ ++ orig_errno = errno; ++ ++ for (;;) ++ { ++ int count = -1; ++ ++#if USE_SNPRINTF ++ int retcount = 0; ++ size_t maxlen = allocated - length; ++ /* SNPRINTF can fail if its second argument is ++ > INT_MAX. */ ++ if (maxlen > INT_MAX / TCHARS_PER_DCHAR) ++ maxlen = INT_MAX / TCHARS_PER_DCHAR; ++ maxlen = maxlen * TCHARS_PER_DCHAR; ++# define SNPRINTF_BUF(arg) \ ++ switch (prefix_count) \ ++ { \ ++ case 0: \ ++ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ ++ maxlen, buf, \ ++ arg, &count); \ ++ break; \ ++ case 1: \ ++ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ ++ maxlen, buf, \ ++ prefixes[0], arg, &count); \ ++ break; \ ++ case 2: \ ++ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ ++ maxlen, buf, \ ++ prefixes[0], prefixes[1], arg, \ ++ &count); \ ++ break; \ ++ default: \ ++ abort (); \ ++ } ++#else ++# define SNPRINTF_BUF(arg) \ ++ switch (prefix_count) \ ++ { \ ++ case 0: \ ++ count = sprintf (tmp, buf, arg); \ ++ break; \ ++ case 1: \ ++ count = sprintf (tmp, buf, prefixes[0], arg); \ ++ break; \ ++ case 2: \ ++ count = sprintf (tmp, buf, prefixes[0], prefixes[1],\ ++ arg); \ ++ break; \ ++ default: \ ++ abort (); \ ++ } ++#endif ++ ++ errno = 0; ++ switch (type) ++ { ++ case TYPE_SCHAR: ++ { ++ int arg = a.arg[dp->arg_index].a.a_schar; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_UCHAR: ++ { ++ unsigned int arg = a.arg[dp->arg_index].a.a_uchar; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_SHORT: ++ { ++ int arg = a.arg[dp->arg_index].a.a_short; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_USHORT: ++ { ++ unsigned int arg = a.arg[dp->arg_index].a.a_ushort; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_INT: ++ { ++ int arg = a.arg[dp->arg_index].a.a_int; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_UINT: ++ { ++ unsigned int arg = a.arg[dp->arg_index].a.a_uint; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_LONGINT: ++ { ++ long int arg = a.arg[dp->arg_index].a.a_longint; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_ULONGINT: ++ { ++ unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#if HAVE_LONG_LONG_INT ++ case TYPE_LONGLONGINT: ++ { ++ long long int arg = a.arg[dp->arg_index].a.a_longlongint; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_ULONGLONGINT: ++ { ++ unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#endif ++ case TYPE_DOUBLE: ++ { ++ double arg = a.arg[dp->arg_index].a.a_double; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_LONGDOUBLE: ++ { ++ long double arg = a.arg[dp->arg_index].a.a_longdouble; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_CHAR: ++ { ++ int arg = a.arg[dp->arg_index].a.a_char; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#if HAVE_WINT_T ++ case TYPE_WIDE_CHAR: ++ { ++ wint_t arg = a.arg[dp->arg_index].a.a_wide_char; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#endif ++ case TYPE_STRING: ++ { ++ const char *arg = a.arg[dp->arg_index].a.a_string; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#if HAVE_WCHAR_T ++ case TYPE_WIDE_STRING: ++ { ++ const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#endif ++ case TYPE_POINTER: ++ { ++ void *arg = a.arg[dp->arg_index].a.a_pointer; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ default: ++ abort (); ++ } ++ ++#if USE_SNPRINTF ++ /* Portability: Not all implementations of snprintf() ++ are ISO C 99 compliant. Determine the number of ++ bytes that snprintf() has produced or would have ++ produced. */ ++ if (count >= 0) ++ { ++ /* Verify that snprintf() has NUL-terminated its ++ result. */ ++ if (count < maxlen ++ && ((TCHAR_T *) (result + length)) [count] != '\0') ++ abort (); ++ /* Portability hack. */ ++ if (retcount > count) ++ count = retcount; ++ } ++ else ++ { ++ /* snprintf() doesn't understand the '%n' ++ directive. */ ++ if (fbp[1] != '\0') ++ { ++ /* Don't use the '%n' directive; instead, look ++ at the snprintf() return value. */ ++ fbp[1] = '\0'; ++ continue; ++ } ++ else ++ { ++ /* Look at the snprintf() return value. */ ++ if (retcount < 0) ++ { ++# if !HAVE_SNPRINTF_RETVAL_C99 ++ /* HP-UX 10.20 snprintf() is doubly deficient: ++ It doesn't understand the '%n' directive, ++ *and* it returns -1 (rather than the length ++ that would have been required) when the ++ buffer is too small. ++ But a failure at this point can also come ++ from other reasons than a too small buffer, ++ such as an invalid wide string argument to ++ the %ls directive, or possibly an invalid ++ floating-point argument. */ ++ size_t tmp_length = ++ MAX_ROOM_NEEDED (&a, dp->arg_index, ++ dp->conversion, type, flags, ++ width, has_precision, ++ precision, pad_ourselves); ++ ++ if (maxlen < tmp_length) ++ { ++ /* Make more room. But try to do through ++ this reallocation only once. */ ++ size_t bigger_need = ++ xsum (length, ++ xsum (tmp_length, ++ TCHARS_PER_DCHAR - 1) ++ / TCHARS_PER_DCHAR); ++ /* And always grow proportionally. ++ (There may be several arguments, each ++ needing a little more room than the ++ previous one.) */ ++ size_t bigger_need2 = ++ xsum (xtimes (allocated, 2), 12); ++ if (bigger_need < bigger_need2) ++ bigger_need = bigger_need2; ++ ENSURE_ALLOCATION (bigger_need); ++ continue; ++ } ++# endif ++ } ++ else ++ count = retcount; ++ } ++ } ++#endif ++ ++ /* Attempt to handle failure. */ ++ if (count < 0) ++ { ++ /* SNPRINTF or sprintf failed. Save and use the errno ++ that it has set, if any. */ ++ int saved_errno = errno; ++ ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = ++ (saved_errno != 0 ++ ? saved_errno ++ : (dp->conversion == 'c' || dp->conversion == 's' ++ ? EILSEQ ++ : EINVAL)); ++ return NULL; ++ } ++ ++#if USE_SNPRINTF ++ /* Handle overflow of the allocated buffer. ++ If such an overflow occurs, a C99 compliant snprintf() ++ returns a count >= maxlen. However, a non-compliant ++ snprintf() function returns only count = maxlen - 1. To ++ cover both cases, test whether count >= maxlen - 1. */ ++ if ((unsigned int) count + 1 >= maxlen) ++ { ++ /* If maxlen already has attained its allowed maximum, ++ allocating more memory will not increase maxlen. ++ Instead of looping, bail out. */ ++ if (maxlen == INT_MAX / TCHARS_PER_DCHAR) ++ goto overflow; ++ else ++ { ++ /* Need at least (count + 1) * sizeof (TCHAR_T) ++ bytes. (The +1 is for the trailing NUL.) ++ But ask for (count + 2) * sizeof (TCHAR_T) ++ bytes, so that in the next round, we likely get ++ maxlen > (unsigned int) count + 1 ++ and so we don't get here again. ++ And allocate proportionally, to avoid looping ++ eternally if snprintf() reports a too small ++ count. */ ++ size_t n = ++ xmax (xsum (length, ++ ((unsigned int) count + 2 ++ + TCHARS_PER_DCHAR - 1) ++ / TCHARS_PER_DCHAR), ++ xtimes (allocated, 2)); ++ ++ ENSURE_ALLOCATION (n); ++ continue; ++ } ++ } ++#endif ++ ++#if NEED_PRINTF_UNBOUNDED_PRECISION ++ if (prec_ourselves) ++ { ++ /* Handle the precision. */ ++ TCHAR_T *prec_ptr = ++# if USE_SNPRINTF ++ (TCHAR_T *) (result + length); ++# else ++ tmp; ++# endif ++ size_t prefix_count; ++ size_t move; ++ ++ prefix_count = 0; ++ /* Put the additional zeroes after the sign. */ ++ if (count >= 1 ++ && (*prec_ptr == '-' || *prec_ptr == '+' ++ || *prec_ptr == ' ')) ++ prefix_count = 1; ++ /* Put the additional zeroes after the 0x prefix if ++ (flags & FLAG_ALT) || (dp->conversion == 'p'). */ ++ else if (count >= 2 ++ && prec_ptr[0] == '0' ++ && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) ++ prefix_count = 2; ++ ++ move = count - prefix_count; ++ if (precision > move) ++ { ++ /* Insert zeroes. */ ++ size_t insert = precision - move; ++ TCHAR_T *prec_end; ++ ++# if USE_SNPRINTF ++ size_t n = ++ xsum (length, ++ (count + insert + TCHARS_PER_DCHAR - 1) ++ / TCHARS_PER_DCHAR); ++ length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; ++ ENSURE_ALLOCATION (n); ++ length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; ++ prec_ptr = (TCHAR_T *) (result + length); ++# endif ++ ++ prec_end = prec_ptr + count; ++ prec_ptr += prefix_count; ++ ++ while (prec_end > prec_ptr) ++ { ++ prec_end--; ++ prec_end[insert] = prec_end[0]; ++ } ++ ++ prec_end += insert; ++ do ++ *--prec_end = '0'; ++ while (prec_end > prec_ptr); ++ ++ count += insert; ++ } ++ } ++#endif ++ ++#if !USE_SNPRINTF ++ if (count >= tmp_length) ++ /* tmp_length was incorrectly calculated - fix the ++ code above! */ ++ abort (); ++#endif ++ ++#if !DCHAR_IS_TCHAR ++ /* Convert from TCHAR_T[] to DCHAR_T[]. */ ++ if (dp->conversion == 'c' || dp->conversion == 's') ++ { ++ /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING ++ TYPE_WIDE_STRING. ++ The result string is not certainly ASCII. */ ++ const TCHAR_T *tmpsrc; ++ DCHAR_T *tmpdst; ++ size_t tmpdst_len; ++ /* This code assumes that TCHAR_T is 'char'. */ ++ verify (sizeof (TCHAR_T) == 1); ++# if USE_SNPRINTF ++ tmpsrc = (TCHAR_T *) (result + length); ++# else ++ tmpsrc = tmp; ++# endif ++ tmpdst = ++ DCHAR_CONV_FROM_ENCODING (locale_charset (), ++ iconveh_question_mark, ++ tmpsrc, count, ++ NULL, ++ NULL, &tmpdst_len); ++ if (tmpdst == NULL) ++ { ++ int saved_errno = errno; ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = saved_errno; ++ return NULL; ++ } ++ ENSURE_ALLOCATION (xsum (length, tmpdst_len)); ++ DCHAR_CPY (result + length, tmpdst, tmpdst_len); ++ free (tmpdst); ++ count = tmpdst_len; ++ } ++ else ++ { ++ /* The result string is ASCII. ++ Simple 1:1 conversion. */ ++# if USE_SNPRINTF ++ /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a ++ no-op conversion, in-place on the array starting ++ at (result + length). */ ++ if (sizeof (DCHAR_T) != sizeof (TCHAR_T)) ++# endif ++ { ++ const TCHAR_T *tmpsrc; ++ DCHAR_T *tmpdst; ++ size_t n; ++ ++# if USE_SNPRINTF ++ if (result == resultbuf) ++ { ++ tmpsrc = (TCHAR_T *) (result + length); ++ /* ENSURE_ALLOCATION will not move tmpsrc ++ (because it's part of resultbuf). */ ++ ENSURE_ALLOCATION (xsum (length, count)); ++ } ++ else ++ { ++ /* ENSURE_ALLOCATION will move the array ++ (because it uses realloc(). */ ++ ENSURE_ALLOCATION (xsum (length, count)); ++ tmpsrc = (TCHAR_T *) (result + length); ++ } ++# else ++ tmpsrc = tmp; ++ ENSURE_ALLOCATION (xsum (length, count)); ++# endif ++ tmpdst = result + length; ++ /* Copy backwards, because of overlapping. */ ++ tmpsrc += count; ++ tmpdst += count; ++ for (n = count; n > 0; n--) ++ *--tmpdst = (unsigned char) *--tmpsrc; ++ } ++ } ++#endif ++ ++#if DCHAR_IS_TCHAR && !USE_SNPRINTF ++ /* Make room for the result. */ ++ if (count > allocated - length) ++ { ++ /* Need at least count elements. But allocate ++ proportionally. */ ++ size_t n = ++ xmax (xsum (length, count), xtimes (allocated, 2)); ++ ++ ENSURE_ALLOCATION (n); ++ } ++#endif ++ ++ /* Here count <= allocated - length. */ ++ ++ /* Perform padding. */ ++#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION ++ if (pad_ourselves && has_width) ++ { ++ size_t w; ++# if ENABLE_UNISTDIO ++ /* Outside POSIX, it's preferrable to compare the width ++ against the number of _characters_ of the converted ++ value. */ ++ w = DCHAR_MBSNLEN (result + length, count); ++# else ++ /* The width is compared against the number of _bytes_ ++ of the converted value, says POSIX. */ ++ w = count; ++# endif ++ if (w < width) ++ { ++ size_t pad = width - w; ++ ++ /* Make room for the result. */ ++ if (xsum (count, pad) > allocated - length) ++ { ++ /* Need at least count + pad elements. But ++ allocate proportionally. */ ++ size_t n = ++ xmax (xsum3 (length, count, pad), ++ xtimes (allocated, 2)); ++ ++# if USE_SNPRINTF ++ length += count; ++ ENSURE_ALLOCATION (n); ++ length -= count; ++# else ++ ENSURE_ALLOCATION (n); ++# endif ++ } ++ /* Here count + pad <= allocated - length. */ ++ ++ { ++# if !DCHAR_IS_TCHAR || USE_SNPRINTF ++ DCHAR_T * const rp = result + length; ++# else ++ DCHAR_T * const rp = tmp; ++# endif ++ DCHAR_T *p = rp + count; ++ DCHAR_T *end = p + pad; ++ DCHAR_T *pad_ptr; ++# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO ++ if (dp->conversion == 'c' ++ || dp->conversion == 's') ++ /* No zero-padding for string directives. */ ++ pad_ptr = NULL; ++ else ++# endif ++ { ++ pad_ptr = (*rp == '-' ? rp + 1 : rp); ++ /* No zero-padding of "inf" and "nan". */ ++ if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z') ++ || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) ++ pad_ptr = NULL; ++ } ++ /* The generated string now extends from rp to p, ++ with the zero padding insertion point being at ++ pad_ptr. */ ++ ++ count = count + pad; /* = end - rp */ ++ ++ if (flags & FLAG_LEFT) ++ { ++ /* Pad with spaces on the right. */ ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ else if ((flags & FLAG_ZERO) && pad_ptr != NULL) ++ { ++ /* Pad with zeroes. */ ++ DCHAR_T *q = end; ++ ++ while (p > pad_ptr) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = '0'; ++ } ++ else ++ { ++ /* Pad with spaces on the left. */ ++ DCHAR_T *q = end; ++ ++ while (p > rp) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ } ++ } ++ } ++#endif ++ ++ /* Here still count <= allocated - length. */ ++ ++#if !DCHAR_IS_TCHAR || USE_SNPRINTF ++ /* The snprintf() result did fit. */ ++#else ++ /* Append the sprintf() result. */ ++ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); ++#endif ++#if !USE_SNPRINTF ++ if (tmp != tmpbuf) ++ free (tmp); ++#endif ++ ++#if NEED_PRINTF_DIRECTIVE_F ++ if (dp->conversion == 'F') ++ { ++ /* Convert the %f result to upper case for %F. */ ++ DCHAR_T *rp = result + length; ++ size_t rc; ++ for (rc = count; rc > 0; rc--, rp++) ++ if (*rp >= 'a' && *rp <= 'z') ++ *rp = *rp - 'a' + 'A'; ++ } ++#endif ++ ++ length += count; ++ break; ++ } ++ errno = orig_errno; ++#undef pad_ourselves ++#undef prec_ourselves ++ } ++ } ++ } ++ ++ /* Add the final NUL. */ ++ ENSURE_ALLOCATION (xsum (length, 1)); ++ result[length] = '\0'; ++ ++ if (result != resultbuf && length + 1 < allocated) ++ { ++ /* Shrink the allocated memory if possible. */ ++ DCHAR_T *memory; ++ ++ memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T)); ++ if (memory != NULL) ++ result = memory; ++ } ++ ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ *lengthp = length; ++ /* Note that we can produce a big string of a length > INT_MAX. POSIX ++ says that snprintf() fails with errno = EOVERFLOW in this case, but ++ that's only because snprintf() returns an 'int'. This function does ++ not have this limitation. */ ++ return result; ++ ++#if USE_SNPRINTF ++ overflow: ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EOVERFLOW; ++ return NULL; ++#endif + + out_of_memory: + if (!(result == resultbuf || result == NULL)) +@@ -894,10 +5591,17 @@ + } + } + ++#undef MAX_ROOM_NEEDED ++#undef TCHARS_PER_DCHAR + #undef SNPRINTF + #undef USE_SNPRINTF ++#undef DCHAR_SET ++#undef DCHAR_CPY + #undef PRINTF_PARSE + #undef DIRECTIVES + #undef DIRECTIVE +-#undef CHAR_T ++#undef DCHAR_IS_TCHAR ++#undef TCHAR_T ++#undef DCHAR_T ++#undef FCHAR_T + #undef VASNPRINTF +diff --git a/xbmc/screensavers/rsxs-0.9/lib/vasnprintf.h b/xbmc/screensavers/rsxs-0.9/lib/vasnprintf.h +index 894008c..c9f4c21 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/vasnprintf.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/vasnprintf.h +@@ -1,9 +1,9 @@ + /* vsprintf with automatic memory allocation. +- Copyright (C) 2002-2004 Free Software Foundation, Inc. ++ Copyright (C) 2002-2004, 2007-2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -24,20 +24,19 @@ + /* Get size_t. */ + #include + +-#ifndef __attribute__ +-/* This feature is available in gcc versions 2.5 and later. */ +-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +-# define __attribute__(Spec) /* empty */ +-# endif +-/* The __-protected variants of `format' and `printf' attributes +- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +-# define __format__ format +-# define __printf__ printf +-# endif ++/* The __attribute__ feature is available in gcc versions 2.5 and later. ++ The __-protected variants of the attributes 'format' and 'printf' are ++ accepted by gcc versions 2.6.4 (effectively 2.7) and later. ++ We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because ++ gnulib and libintl do '#define printf __printf__' when they override ++ the 'printf' function. */ ++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) ++# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) ++#else ++# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ + #endif + +-#ifdef __cplusplus ++#ifdef __cplusplus + extern "C" { + #endif + +@@ -65,12 +64,16 @@ + free (output); + } + */ ++#if REPLACE_VASNPRINTF ++# define asnprintf rpl_asnprintf ++# define vasnprintf rpl_vasnprintf ++#endif + extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) +- __attribute__ ((__format__ (__printf__, 3, 4))); ++ _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); + extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) +- __attribute__ ((__format__ (__printf__, 3, 0))); ++ _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0)); + +-#ifdef __cplusplus ++#ifdef __cplusplus + } + #endif + +diff --git a/xbmc/screensavers/rsxs-0.9/lib/verify.h b/xbmc/screensavers/rsxs-0.9/lib/verify.h +new file mode 100644 +index 0000000..9a8caad +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/verify.h +@@ -0,0 +1,243 @@ ++/* Compile-time assert-like macros. ++ ++ Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ ++ ++#ifndef _GL_VERIFY_H ++# define _GL_VERIFY_H ++ ++ ++/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the ++ C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and ++ later, in C mode, and its use here generates easier-to-read diagnostics ++ when verify (R) fails. ++ ++ Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per the ++ C++0X draft N3242 section 7.(4). ++ This will likely be supported by future GCC versions, in C++ mode. ++ ++ Use this only with GCC. If we were willing to slow 'configure' ++ down we could also use it with other compilers, but since this ++ affects only the quality of diagnostics, why bother? */ ++# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus ++# define _GL_HAVE__STATIC_ASSERT 1 ++# endif ++/* The condition (99 < __GNUC__) is temporary, until we know about the ++ first G++ release that supports static_assert. */ ++# if (99 < __GNUC__) && defined __cplusplus ++# define _GL_HAVE_STATIC_ASSERT 1 ++# endif ++ ++/* Each of these macros verifies that its argument R is nonzero. To ++ be portable, R should be an integer constant expression. Unlike ++ assert (R), there is no run-time overhead. ++ ++ If _Static_assert works, verify (R) uses it directly. Similarly, ++ _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct ++ that is an operand of sizeof. ++ ++ The code below uses several ideas for C++ compilers, and for C ++ compilers that do not support _Static_assert: ++ ++ * The first step is ((R) ? 1 : -1). Given an expression R, of ++ integral or boolean or floating-point type, this yields an ++ expression of integral type, whose value is later verified to be ++ constant and nonnegative. ++ ++ * Next this expression W is wrapped in a type ++ struct _gl_verify_type { ++ unsigned int _gl_verify_error_if_negative: W; ++ }. ++ If W is negative, this yields a compile-time error. No compiler can ++ deal with a bit-field of negative size. ++ ++ One might think that an array size check would have the same ++ effect, that is, that the type struct { unsigned int dummy[W]; } ++ would work as well. However, inside a function, some compilers ++ (such as C++ compilers and GNU C) allow local parameters and ++ variables inside array size expressions. With these compilers, ++ an array size check would not properly diagnose this misuse of ++ the verify macro: ++ ++ void function (int n) { verify (n < 0); } ++ ++ * For the verify macro, the struct _gl_verify_type will need to ++ somehow be embedded into a declaration. To be portable, this ++ declaration must declare an object, a constant, a function, or a ++ typedef name. If the declared entity uses the type directly, ++ such as in ++ ++ struct dummy {...}; ++ typedef struct {...} dummy; ++ extern struct {...} *dummy; ++ extern void dummy (struct {...} *); ++ extern struct {...} *dummy (void); ++ ++ two uses of the verify macro would yield colliding declarations ++ if the entity names are not disambiguated. A workaround is to ++ attach the current line number to the entity name: ++ ++ #define _GL_CONCAT0(x, y) x##y ++ #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) ++ extern struct {...} * _GL_CONCAT (dummy, __LINE__); ++ ++ But this has the problem that two invocations of verify from ++ within the same macro would collide, since the __LINE__ value ++ would be the same for both invocations. (The GCC __COUNTER__ ++ macro solves this problem, but is not portable.) ++ ++ A solution is to use the sizeof operator. It yields a number, ++ getting rid of the identity of the type. Declarations like ++ ++ extern int dummy [sizeof (struct {...})]; ++ extern void dummy (int [sizeof (struct {...})]); ++ extern int (*dummy (void)) [sizeof (struct {...})]; ++ ++ can be repeated. ++ ++ * Should the implementation use a named struct or an unnamed struct? ++ Which of the following alternatives can be used? ++ ++ extern int dummy [sizeof (struct {...})]; ++ extern int dummy [sizeof (struct _gl_verify_type {...})]; ++ extern void dummy (int [sizeof (struct {...})]); ++ extern void dummy (int [sizeof (struct _gl_verify_type {...})]); ++ extern int (*dummy (void)) [sizeof (struct {...})]; ++ extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})]; ++ ++ In the second and sixth case, the struct type is exported to the ++ outer scope; two such declarations therefore collide. GCC warns ++ about the first, third, and fourth cases. So the only remaining ++ possibility is the fifth case: ++ ++ extern int (*dummy (void)) [sizeof (struct {...})]; ++ ++ * GCC warns about duplicate declarations of the dummy function if ++ -Wredundant_decls is used. GCC 4.3 and later have a builtin ++ __COUNTER__ macro that can let us generate unique identifiers for ++ each dummy function, to suppress this warning. ++ ++ * This implementation exploits the fact that older versions of GCC, ++ which do not support _Static_assert, also do not warn about the ++ last declaration mentioned above. ++ ++ * In C++, any struct definition inside sizeof is invalid. ++ Use a template type to work around the problem. */ ++ ++/* Concatenate two preprocessor tokens. */ ++# define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) ++# define _GL_CONCAT0(x, y) x##y ++ ++/* _GL_COUNTER is an integer, preferably one that changes each time we ++ use it. Use __COUNTER__ if it works, falling back on __LINE__ ++ otherwise. __LINE__ isn't perfect, but it's better than a ++ constant. */ ++# if defined __COUNTER__ && __COUNTER__ != __COUNTER__ ++# define _GL_COUNTER __COUNTER__ ++# else ++# define _GL_COUNTER __LINE__ ++# endif ++ ++/* Generate a symbol with the given prefix, making it unique if ++ possible. */ ++# define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) ++ ++/* Verify requirement R at compile-time, as an integer constant expression ++ that returns 1. If R is false, fail at compile-time, preferably ++ with a diagnostic that includes the string-literal DIAGNOSTIC. */ ++ ++# define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ ++ (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC))) ++ ++# ifdef __cplusplus ++# if !GNULIB_defined_struct__gl_verify_type ++template ++ struct _gl_verify_type { ++ unsigned int _gl_verify_error_if_negative: w; ++ }; ++# define GNULIB_defined_struct__gl_verify_type 1 ++# endif ++# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ ++ _gl_verify_type<(R) ? 1 : -1> ++# elif defined _GL_HAVE__STATIC_ASSERT ++# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ ++ struct { \ ++ _Static_assert (R, DIAGNOSTIC); \ ++ int _gl_dummy; \ ++ } ++# else ++# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ ++ struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } ++# endif ++ ++/* Verify requirement R at compile-time, as a declaration without a ++ trailing ';'. If R is false, fail at compile-time, preferably ++ with a diagnostic that includes the string-literal DIAGNOSTIC. ++ ++ Unfortunately, unlike C1X, this implementation must appear as an ++ ordinary declaration, and cannot appear inside struct { ... }. */ ++ ++# ifdef _GL_HAVE__STATIC_ASSERT ++# define _GL_VERIFY _Static_assert ++# else ++# define _GL_VERIFY(R, DIAGNOSTIC) \ ++ extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ ++ [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] ++# endif ++ ++/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ ++# ifdef _GL_STATIC_ASSERT_H ++# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert ++# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC) ++# endif ++# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert ++# define static_assert _Static_assert /* Draft C1X requires this #define. */ ++# endif ++# endif ++ ++/* @assert.h omit start@ */ ++ ++/* Each of these macros verifies that its argument R is nonzero. To ++ be portable, R should be an integer constant expression. Unlike ++ assert (R), there is no run-time overhead. ++ ++ There are two macros, since no single macro can be used in all ++ contexts in C. verify_true (R) is for scalar contexts, including ++ integer constant expression contexts. verify (R) is for declaration ++ contexts, e.g., the top level. */ ++ ++/* Verify requirement R at compile-time, as an integer constant expression. ++ Return 1. This is equivalent to verify_expr (R, 1). ++ ++ verify_true is obsolescent; please use verify_expr instead. */ ++ ++# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")") ++ ++/* Verify requirement R at compile-time. Return the value of the ++ expression E. */ ++ ++# define verify_expr(R, E) \ ++ (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E)) ++ ++/* Verify requirement R at compile-time, as a declaration without a ++ trailing ';'. */ ++ ++# define verify(R) _GL_VERIFY (R, "verify (" #R ")") ++ ++/* @assert.h omit end@ */ ++ ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/vsnprintf.c b/xbmc/screensavers/rsxs-0.9/lib/vsnprintf.c +index 827397b..3f6f6a8 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/vsnprintf.c ++++ b/xbmc/screensavers/rsxs-0.9/lib/vsnprintf.c +@@ -1,10 +1,10 @@ + /* Formatted output to strings. +- Copyright (C) 2004 Free Software Foundation, Inc. ++ Copyright (C) 2004, 2006-2011 Free Software Foundation, Inc. + Written by Simon Josefsson and Yoann Vandoorselaere . + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -21,10 +21,11 @@ + #endif + + /* Specification. */ +-#include "vsnprintf.h" ++#include + ++#include ++#include + #include +-#include + #include + #include + +@@ -34,25 +35,37 @@ + additional length SIZE limit how much is written into STR. Returns + string length of formatted string (which may be larger than SIZE). + STR may be NULL, in which case nothing will be written. On error, +- return a negative value. */ ++ return a negative value. */ + int + vsnprintf (char *str, size_t size, const char *format, va_list args) + { + char *output; + size_t len; ++ size_t lenbuf = size; + +- len = size; +- output = vasnprintf (str, &len, format, args); ++ output = vasnprintf (str, &lenbuf, format, args); ++ len = lenbuf; + + if (!output) + return -1; + +- if (str != NULL) +- if (len > size - 1) /* equivalent to: (size > 0 && len >= size) */ +- str[size - 1] = '\0'; +- + if (output != str) +- free (output); ++ { ++ if (size) ++ { ++ size_t pruned_len = (len < size ? len : size - 1); ++ memcpy (str, output, pruned_len); ++ str[pruned_len] = '\0'; ++ } ++ ++ free (output); ++ } ++ ++ if (len > INT_MAX) ++ { ++ errno = EOVERFLOW; ++ return -1; ++ } + + return len; + } +diff --git a/xbmc/screensavers/rsxs-0.9/lib/warn-on-use.h b/xbmc/screensavers/rsxs-0.9/lib/warn-on-use.h +new file mode 100644 +index 0000000..9aebda4 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/warn-on-use.h +@@ -0,0 +1,46 @@ ++#ifndef _GL_WARN_ON_USE ++ ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++/* A compiler attribute is available in gcc versions 4.3.0 and later. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function __attribute__ ((__warning__ (message))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE(function, message) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") ++ is like _GL_WARN_ON_USE (function, "string"), except that the function is ++ declared with the given prototype, consisting of return type, parameters, ++ and attributes. ++ This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does ++ not work in this case. */ ++#ifndef _GL_WARN_ON_USE_CXX ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes \ ++ __attribute__ ((__warning__ (msg))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#ifndef _GL_WARN_EXTERN_C ++# if defined __cplusplus ++# define _GL_WARN_EXTERN_C extern "C" ++# else ++# define _GL_WARN_EXTERN_C extern ++# endif ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/wchar.h b/xbmc/screensavers/rsxs-0.9/lib/wchar.h +new file mode 100644 +index 0000000..37470ac +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/wchar.h +@@ -0,0 +1,1318 @@ ++/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ ++/* A substitute for ISO C99 , for platforms that have issues. ++ ++ Copyright (C) 2007-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* Written by Eric Blake. */ ++ ++/* ++ * ISO C 99 for platforms that have issues. ++ * ++ * ++ * For now, this just ensures proper prerequisite inclusion order and ++ * the declaration of wcwidth(). ++ */ ++ ++#if __GNUC__ >= 3 ++#pragma GCC system_header ++#endif ++ ++ ++#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H ++/* Special invocation convention: ++ - Inside glibc and uClibc header files. ++ - On HP-UX 11.00 we have a sequence of nested includes ++ -> -> , and the latter includes , ++ once indirectly -> -> -> ++ and once directly. In both situations 'wint_t' is not yet defined, ++ therefore we cannot provide the function overrides; instead include only ++ the system's . ++ - On IRIX 6.5, similarly, we have an include -> , and ++ the latter includes . But here, we have no way to detect whether ++ is completely included or is still being included. */ ++ ++#include_next ++ ++#else ++/* Normal invocation convention. */ ++ ++#ifndef _GL_WCHAR_H ++ ++#define _GL_ALREADY_INCLUDING_WCHAR_H ++ ++#if 1 ++# include /* for __GLIBC__ */ ++#endif ++ ++/* Tru64 with Desktop Toolkit C has a bug: must be included before ++ . ++ BSD/OS 4.0.1 has a bug: , and must be ++ included before . ++ In some builds of uClibc, is nonexistent and wchar_t is defined ++ by . ++ But avoid namespace pollution on glibc systems. */ ++#if !(defined __GLIBC__ && !defined __UCLIBC__) ++# include ++#endif ++#ifndef __GLIBC__ ++# include ++# include ++#endif ++ ++/* Include the original if it exists. ++ Some builds of uClibc lack it. */ ++/* The include_next requires a split double-inclusion guard. */ ++#if 1 ++# include_next ++#endif ++ ++#undef _GL_ALREADY_INCLUDING_WCHAR_H ++ ++#ifndef _GL_WCHAR_H ++#define _GL_WCHAR_H ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++#ifndef _GL_CXXDEFS_H ++#define _GL_CXXDEFS_H ++ ++/* The three most frequent use cases of these macros are: ++ ++ * For providing a substitute for a function that is missing on some ++ platforms, but is declared and works fine on the platforms on which ++ it exists: ++ ++ #if @GNULIB_FOO@ ++ # if !@HAVE_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on all platforms, ++ but is broken/insufficient and needs to be replaced on some platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on some platforms ++ but is broken/insufficient and needs to be replaced on some of them and ++ is additionally either missing or undeclared on some other platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++*/ ++ ++/* _GL_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#if defined __cplusplus ++# define _GL_EXTERN_C extern "C" ++#else ++# define _GL_EXTERN_C extern ++#endif ++ ++/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); ++ declares a replacement function, named rpl_func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ ++ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) ++#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype rpl_func parameters_and_attributes ++ ++/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); ++ declares the system function, named func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype func parameters_and_attributes ++ ++/* _GL_CXXALIAS_RPL (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. ++ Example: ++ _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); ++ */ ++#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ ++ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = ::rpl_func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); ++ is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); ++ except that the C function rpl_func may have a slightly different ++ declaration. A cast is used to silence the "invalid conversion" error ++ that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = \ ++ reinterpret_cast(::rpl_func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to the system provided function func, if GNULIB_NAMESPACE ++ is defined. ++ Example: ++ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); ++ */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* If we were to write ++ rettype (*const func) parameters = ::func; ++ like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls ++ better (remove an indirection through a 'static' pointer variable), ++ but then the _GL_CXXALIASWARN macro below would cause a warning not only ++ for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = ::func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function func may have a slightly different declaration. ++ A cast is used to silence the "invalid conversion" error that would ++ otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast(::func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function is picked among a set of overloaded functions, ++ namely the one with rettype2 and parameters2. Two consecutive casts ++ are used to silence the "cannot find a match" and "invalid conversion" ++ errors that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* The outer cast must be a reinterpret_cast. ++ The inner cast: When the function is defined as a set of overloaded ++ functions, it works as a static_cast<>, choosing the designated variant. ++ When the function is defined as a single variant, it works as a ++ reinterpret_cast<>. The parenthesized cast syntax works both ways. */ ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast( \ ++ (rettype2(*)parameters2)(::func)); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN (func); ++ causes a warning to be emitted when ::func is used but not when ++ GNULIB_NAMESPACE::func is used. func must be defined without overloaded ++ variants. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN(func) \ ++ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN_1(func,namespace) \ ++ _GL_CXXALIASWARN_2 (func, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_WARN_ON_USE (func, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN(func) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); ++ causes a warning to be emitted when the given overloaded variant of ::func ++ is used but not when GNULIB_NAMESPACE::func is used. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ ++ GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++#endif /* _GL_CXXDEFS_H */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools ++ that the values passed as arguments n, ..., m must be non-NULL pointers. ++ n = 1 stands for the first argument, n = 2 for the second argument etc. */ ++#ifndef _GL_ARG_NONNULL ++# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 ++# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) ++# else ++# define _GL_ARG_NONNULL(params) ++# endif ++#endif ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++#ifndef _GL_WARN_ON_USE ++ ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++/* A compiler attribute is available in gcc versions 4.3.0 and later. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function __attribute__ ((__warning__ (message))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE(function, message) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") ++ is like _GL_WARN_ON_USE (function, "string"), except that the function is ++ declared with the given prototype, consisting of return type, parameters, ++ and attributes. ++ This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does ++ not work in this case. */ ++#ifndef _GL_WARN_ON_USE_CXX ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes \ ++ __attribute__ ((__warning__ (msg))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#ifndef _GL_WARN_EXTERN_C ++# if defined __cplusplus ++# define _GL_WARN_EXTERN_C extern "C" ++# else ++# define _GL_WARN_EXTERN_C extern ++# endif ++#endif ++ ++ ++/* Define wint_t and WEOF. (Also done in wctype.in.h.) */ ++#if !1 && !defined wint_t ++# define wint_t int ++# ifndef WEOF ++# define WEOF -1 ++# endif ++#else ++/* MSVC defines wint_t as 'unsigned short' in . ++ This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be ++ "unchanged by default argument promotions". Override it. */ ++# if defined _MSC_VER ++# if !GNULIB_defined_wint_t ++# include ++typedef unsigned int rpl_wint_t; ++# undef wint_t ++# define wint_t rpl_wint_t ++# define GNULIB_defined_wint_t 1 ++# endif ++# endif ++# ifndef WEOF ++# define WEOF ((wint_t) -1) ++# endif ++#endif ++ ++ ++/* Override mbstate_t if it is too small. ++ On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for ++ implementing mbrtowc for encodings like UTF-8. */ ++#if !(1 && 1) || 0 ++# if !GNULIB_defined_mbstate_t ++typedef int rpl_mbstate_t; ++# undef mbstate_t ++# define mbstate_t rpl_mbstate_t ++# define GNULIB_defined_mbstate_t 1 ++# endif ++#endif ++ ++ ++/* Convert a single-byte character to a wide character. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef btowc ++# define btowc rpl_btowc ++# endif ++_GL_FUNCDECL_RPL (btowc, wint_t, (int c)); ++_GL_CXXALIAS_RPL (btowc, wint_t, (int c)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (btowc, wint_t, (int c)); ++# endif ++_GL_CXXALIAS_SYS (btowc, wint_t, (int c)); ++# endif ++_GL_CXXALIASWARN (btowc); ++#elif defined GNULIB_POSIXCHECK ++# undef btowc ++# if HAVE_RAW_DECL_BTOWC ++_GL_WARN_ON_USE (btowc, "btowc is unportable - " ++ "use gnulib module btowc for portability"); ++# endif ++#endif ++ ++ ++/* Convert a wide character to a single-byte character. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wctob ++# define wctob rpl_wctob ++# endif ++_GL_FUNCDECL_RPL (wctob, int, (wint_t wc)); ++_GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); ++# else ++# if !defined wctob && !1 ++/* wctob is provided by gnulib, or wctob exists but is not declared. */ ++_GL_FUNCDECL_SYS (wctob, int, (wint_t wc)); ++# endif ++_GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); ++# endif ++_GL_CXXALIASWARN (wctob); ++#elif defined GNULIB_POSIXCHECK ++# undef wctob ++# if HAVE_RAW_DECL_WCTOB ++_GL_WARN_ON_USE (wctob, "wctob is unportable - " ++ "use gnulib module wctob for portability"); ++# endif ++#endif ++ ++ ++/* Test whether *PS is in the initial state. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbsinit ++# define mbsinit rpl_mbsinit ++# endif ++_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); ++_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); ++# endif ++_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (mbsinit); ++#elif defined GNULIB_POSIXCHECK ++# undef mbsinit ++# if HAVE_RAW_DECL_MBSINIT ++_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " ++ "use gnulib module mbsinit for portability"); ++# endif ++#endif ++ ++ ++/* Convert a multibyte character to a wide character. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbrtowc ++# define mbrtowc rpl_mbrtowc ++# endif ++_GL_FUNCDECL_RPL (mbrtowc, size_t, ++ (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); ++_GL_CXXALIAS_RPL (mbrtowc, size_t, ++ (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (mbrtowc, size_t, ++ (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); ++# endif ++_GL_CXXALIAS_SYS (mbrtowc, size_t, ++ (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (mbrtowc); ++#elif defined GNULIB_POSIXCHECK ++# undef mbrtowc ++# if HAVE_RAW_DECL_MBRTOWC ++_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " ++ "use gnulib module mbrtowc for portability"); ++# endif ++#endif ++ ++ ++/* Recognize a multibyte character. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbrlen ++# define mbrlen rpl_mbrlen ++# endif ++_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); ++_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); ++# endif ++_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (mbrlen); ++#elif defined GNULIB_POSIXCHECK ++# undef mbrlen ++# if HAVE_RAW_DECL_MBRLEN ++_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " ++ "use gnulib module mbrlen for portability"); ++# endif ++#endif ++ ++ ++/* Convert a string to a wide string. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbsrtowcs ++# define mbsrtowcs rpl_mbsrtowcs ++# endif ++_GL_FUNCDECL_RPL (mbsrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (mbsrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t len, ++ mbstate_t *ps)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (mbsrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (mbsrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t len, ++ mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (mbsrtowcs); ++#elif defined GNULIB_POSIXCHECK ++# undef mbsrtowcs ++# if HAVE_RAW_DECL_MBSRTOWCS ++_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " ++ "use gnulib module mbsrtowcs for portability"); ++# endif ++#endif ++ ++ ++/* Convert a string to a wide string. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbsnrtowcs ++# define mbsnrtowcs rpl_mbsnrtowcs ++# endif ++_GL_FUNCDECL_RPL (mbsnrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t srclen, size_t len, ++ mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (mbsnrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t srclen, size_t len, ++ mbstate_t *ps)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (mbsnrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t srclen, size_t len, ++ mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (mbsnrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t srclen, size_t len, ++ mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (mbsnrtowcs); ++#elif defined GNULIB_POSIXCHECK ++# undef mbsnrtowcs ++# if HAVE_RAW_DECL_MBSNRTOWCS ++_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " ++ "use gnulib module mbsnrtowcs for portability"); ++# endif ++#endif ++ ++ ++/* Convert a wide character to a multibyte character. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wcrtomb ++# define wcrtomb rpl_wcrtomb ++# endif ++_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); ++_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); ++# endif ++_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (wcrtomb); ++#elif defined GNULIB_POSIXCHECK ++# undef wcrtomb ++# if HAVE_RAW_DECL_WCRTOMB ++_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " ++ "use gnulib module wcrtomb for portability"); ++# endif ++#endif ++ ++ ++/* Convert a wide string to a string. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wcsrtombs ++# define wcsrtombs rpl_wcsrtombs ++# endif ++_GL_FUNCDECL_RPL (wcsrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (wcsrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t len, ++ mbstate_t *ps)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (wcsrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (wcsrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t len, ++ mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (wcsrtombs); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsrtombs ++# if HAVE_RAW_DECL_WCSRTOMBS ++_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " ++ "use gnulib module wcsrtombs for portability"); ++# endif ++#endif ++ ++ ++/* Convert a wide string to a string. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wcsnrtombs ++# define wcsnrtombs rpl_wcsnrtombs ++# endif ++_GL_FUNCDECL_RPL (wcsnrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t srclen, size_t len, ++ mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (wcsnrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t srclen, size_t len, ++ mbstate_t *ps)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (wcsnrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t srclen, size_t len, ++ mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (wcsnrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t srclen, size_t len, ++ mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (wcsnrtombs); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsnrtombs ++# if HAVE_RAW_DECL_WCSNRTOMBS ++_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " ++ "use gnulib module wcsnrtombs for portability"); ++# endif ++#endif ++ ++ ++/* Return the number of screen columns needed for WC. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wcwidth ++# define wcwidth rpl_wcwidth ++# endif ++_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t)); ++_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); ++# else ++# if !1 ++/* wcwidth exists but is not declared. */ ++_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t)); ++# endif ++_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); ++# endif ++_GL_CXXALIASWARN (wcwidth); ++#elif defined GNULIB_POSIXCHECK ++# undef wcwidth ++# if HAVE_RAW_DECL_WCWIDTH ++_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " ++ "use gnulib module wcwidth for portability"); ++# endif ++#endif ++ ++ ++/* Search N wide characters of S for C. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { ++ const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t); ++ wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t); ++ } */ ++_GL_CXXALIAS_SYS_CAST2 (wmemchr, ++ wchar_t *, (const wchar_t *, wchar_t, size_t), ++ const wchar_t *, (const wchar_t *, wchar_t, size_t)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); ++_GL_CXXALIASWARN1 (wmemchr, const wchar_t *, ++ (const wchar_t *s, wchar_t c, size_t n)); ++# else ++_GL_CXXALIASWARN (wmemchr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wmemchr ++# if HAVE_RAW_DECL_WMEMCHR ++_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " ++ "use gnulib module wmemchr for portability"); ++# endif ++#endif ++ ++ ++/* Compare N wide characters of S1 and S2. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wmemcmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wmemcmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++_GL_CXXALIASWARN (wmemcmp); ++#elif defined GNULIB_POSIXCHECK ++# undef wmemcmp ++# if HAVE_RAW_DECL_WMEMCMP ++_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " ++ "use gnulib module wmemcmp for portability"); ++# endif ++#endif ++ ++ ++/* Copy N wide characters of SRC to DEST. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wmemcpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wmemcpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++_GL_CXXALIASWARN (wmemcpy); ++#elif defined GNULIB_POSIXCHECK ++# undef wmemcpy ++# if HAVE_RAW_DECL_WMEMCPY ++_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " ++ "use gnulib module wmemcpy for portability"); ++# endif ++#endif ++ ++ ++/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for ++ overlapping memory areas. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wmemmove, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wmemmove, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++_GL_CXXALIASWARN (wmemmove); ++#elif defined GNULIB_POSIXCHECK ++# undef wmemmove ++# if HAVE_RAW_DECL_WMEMMOVE ++_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " ++ "use gnulib module wmemmove for portability"); ++# endif ++#endif ++ ++ ++/* Set N wide characters of S to C. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); ++_GL_CXXALIASWARN (wmemset); ++#elif defined GNULIB_POSIXCHECK ++# undef wmemset ++# if HAVE_RAW_DECL_WMEMSET ++_GL_WARN_ON_USE (wmemset, "wmemset is unportable - " ++ "use gnulib module wmemset for portability"); ++# endif ++#endif ++ ++ ++/* Return the number of wide characters in S. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s)); ++# endif ++_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); ++_GL_CXXALIASWARN (wcslen); ++#elif defined GNULIB_POSIXCHECK ++# undef wcslen ++# if HAVE_RAW_DECL_WCSLEN ++_GL_WARN_ON_USE (wcslen, "wcslen is unportable - " ++ "use gnulib module wcslen for portability"); ++# endif ++#endif ++ ++ ++/* Return the number of wide characters in S, but at most MAXLEN. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); ++# endif ++_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); ++_GL_CXXALIASWARN (wcsnlen); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsnlen ++# if HAVE_RAW_DECL_WCSNLEN ++_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " ++ "use gnulib module wcsnlen for portability"); ++# endif ++#endif ++ ++ ++/* Copy SRC to DEST. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++# endif ++_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++_GL_CXXALIASWARN (wcscpy); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscpy ++# if HAVE_RAW_DECL_WCSCPY ++_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " ++ "use gnulib module wcscpy for portability"); ++# endif ++#endif ++ ++ ++/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++# endif ++_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++_GL_CXXALIASWARN (wcpcpy); ++#elif defined GNULIB_POSIXCHECK ++# undef wcpcpy ++# if HAVE_RAW_DECL_WCPCPY ++_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " ++ "use gnulib module wcpcpy for portability"); ++# endif ++#endif ++ ++ ++/* Copy no more than N wide characters of SRC to DEST. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcsncpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcsncpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++_GL_CXXALIASWARN (wcsncpy); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsncpy ++# if HAVE_RAW_DECL_WCSNCPY ++_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " ++ "use gnulib module wcsncpy for portability"); ++# endif ++#endif ++ ++ ++/* Copy no more than N characters of SRC to DEST, returning the address of ++ the last character written into DEST. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcpncpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcpncpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++_GL_CXXALIASWARN (wcpncpy); ++#elif defined GNULIB_POSIXCHECK ++# undef wcpncpy ++# if HAVE_RAW_DECL_WCPNCPY ++_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " ++ "use gnulib module wcpncpy for portability"); ++# endif ++#endif ++ ++ ++/* Append SRC onto DEST. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++# endif ++_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++_GL_CXXALIASWARN (wcscat); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscat ++# if HAVE_RAW_DECL_WCSCAT ++_GL_WARN_ON_USE (wcscat, "wcscat is unportable - " ++ "use gnulib module wcscat for portability"); ++# endif ++#endif ++ ++ ++/* Append no more than N wide characters of SRC onto DEST. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcsncat, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcsncat, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++_GL_CXXALIASWARN (wcsncat); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsncat ++# if HAVE_RAW_DECL_WCSNCAT ++_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " ++ "use gnulib module wcsncat for portability"); ++# endif ++#endif ++ ++ ++/* Compare S1 and S2. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); ++# endif ++_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); ++_GL_CXXALIASWARN (wcscmp); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscmp ++# if HAVE_RAW_DECL_WCSCMP ++_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " ++ "use gnulib module wcscmp for portability"); ++# endif ++#endif ++ ++ ++/* Compare no more than N wide characters of S1 and S2. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcsncmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcsncmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++_GL_CXXALIASWARN (wcsncmp); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsncmp ++# if HAVE_RAW_DECL_WCSNCMP ++_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " ++ "use gnulib module wcsncmp for portability"); ++# endif ++#endif ++ ++ ++/* Compare S1 and S2, ignoring case. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); ++# endif ++_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); ++_GL_CXXALIASWARN (wcscasecmp); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscasecmp ++# if HAVE_RAW_DECL_WCSCASECMP ++_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " ++ "use gnulib module wcscasecmp for portability"); ++# endif ++#endif ++ ++ ++/* Compare no more than N chars of S1 and S2, ignoring case. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcsncasecmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcsncasecmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++_GL_CXXALIASWARN (wcsncasecmp); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsncasecmp ++# if HAVE_RAW_DECL_WCSNCASECMP ++_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " ++ "use gnulib module wcsncasecmp for portability"); ++# endif ++#endif ++ ++ ++/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE ++ category of the current locale. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); ++# endif ++_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); ++_GL_CXXALIASWARN (wcscoll); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscoll ++# if HAVE_RAW_DECL_WCSCOLL ++_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " ++ "use gnulib module wcscoll for portability"); ++# endif ++#endif ++ ++ ++/* Transform S2 into array pointed to by S1 such that if wcscmp is applied ++ to two transformed strings the result is the as applying 'wcscoll' to the ++ original strings. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); ++_GL_CXXALIASWARN (wcsxfrm); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsxfrm ++# if HAVE_RAW_DECL_WCSXFRM ++_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " ++ "use gnulib module wcsxfrm for portability"); ++# endif ++#endif ++ ++ ++/* Duplicate S, returning an identical malloc'd string. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s)); ++# endif ++_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); ++_GL_CXXALIASWARN (wcsdup); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsdup ++# if HAVE_RAW_DECL_WCSDUP ++_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " ++ "use gnulib module wcsdup for portability"); ++# endif ++#endif ++ ++ ++/* Find the first occurrence of WC in WCS. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { ++ const wchar_t * std::wcschr (const wchar_t *, wchar_t); ++ wchar_t * std::wcschr (wchar_t *, wchar_t); ++ } */ ++_GL_CXXALIAS_SYS_CAST2 (wcschr, ++ wchar_t *, (const wchar_t *, wchar_t), ++ const wchar_t *, (const wchar_t *, wchar_t)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); ++_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); ++# else ++_GL_CXXALIASWARN (wcschr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wcschr ++# if HAVE_RAW_DECL_WCSCHR ++_GL_WARN_ON_USE (wcschr, "wcschr is unportable - " ++ "use gnulib module wcschr for portability"); ++# endif ++#endif ++ ++ ++/* Find the last occurrence of WC in WCS. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { ++ const wchar_t * std::wcsrchr (const wchar_t *, wchar_t); ++ wchar_t * std::wcsrchr (wchar_t *, wchar_t); ++ } */ ++_GL_CXXALIAS_SYS_CAST2 (wcsrchr, ++ wchar_t *, (const wchar_t *, wchar_t), ++ const wchar_t *, (const wchar_t *, wchar_t)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); ++_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); ++# else ++_GL_CXXALIASWARN (wcsrchr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wcsrchr ++# if HAVE_RAW_DECL_WCSRCHR ++_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " ++ "use gnulib module wcsrchr for portability"); ++# endif ++#endif ++ ++ ++/* Return the length of the initial segmet of WCS which consists entirely ++ of wide characters not in REJECT. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); ++# endif ++_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); ++_GL_CXXALIASWARN (wcscspn); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscspn ++# if HAVE_RAW_DECL_WCSCSPN ++_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " ++ "use gnulib module wcscspn for portability"); ++# endif ++#endif ++ ++ ++/* Return the length of the initial segmet of WCS which consists entirely ++ of wide characters in ACCEPT. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); ++# endif ++_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); ++_GL_CXXALIASWARN (wcsspn); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsspn ++# if HAVE_RAW_DECL_WCSSPN ++_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " ++ "use gnulib module wcsspn for portability"); ++# endif ++#endif ++ ++ ++/* Find the first occurrence in WCS of any character in ACCEPT. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcspbrk, wchar_t *, ++ (const wchar_t *wcs, const wchar_t *accept)); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { ++ const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *); ++ wchar_t * std::wcspbrk (wchar_t *, const wchar_t *); ++ } */ ++_GL_CXXALIAS_SYS_CAST2 (wcspbrk, ++ wchar_t *, (const wchar_t *, const wchar_t *), ++ const wchar_t *, (const wchar_t *, const wchar_t *)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (wcspbrk, wchar_t *, ++ (wchar_t *wcs, const wchar_t *accept)); ++_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, ++ (const wchar_t *wcs, const wchar_t *accept)); ++# else ++_GL_CXXALIASWARN (wcspbrk); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wcspbrk ++# if HAVE_RAW_DECL_WCSPBRK ++_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " ++ "use gnulib module wcspbrk for portability"); ++# endif ++#endif ++ ++ ++/* Find the first occurrence of NEEDLE in HAYSTACK. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcsstr, wchar_t *, ++ (const wchar_t *haystack, const wchar_t *needle)); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { ++ const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); ++ wchar_t * std::wcsstr (wchar_t *, const wchar_t *); ++ } */ ++_GL_CXXALIAS_SYS_CAST2 (wcsstr, ++ wchar_t *, (const wchar_t *, const wchar_t *), ++ const wchar_t *, (const wchar_t *, const wchar_t *)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (wcsstr, wchar_t *, ++ (wchar_t *haystack, const wchar_t *needle)); ++_GL_CXXALIASWARN1 (wcsstr, const wchar_t *, ++ (const wchar_t *haystack, const wchar_t *needle)); ++# else ++_GL_CXXALIASWARN (wcsstr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wcsstr ++# if HAVE_RAW_DECL_WCSSTR ++_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " ++ "use gnulib module wcsstr for portability"); ++# endif ++#endif ++ ++ ++/* Divide WCS into tokens separated by characters in DELIM. */ ++#if 0 ++# if !1 ++_GL_FUNCDECL_SYS (wcstok, wchar_t *, ++ (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); ++# endif ++_GL_CXXALIAS_SYS (wcstok, wchar_t *, ++ (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); ++_GL_CXXALIASWARN (wcstok); ++#elif defined GNULIB_POSIXCHECK ++# undef wcstok ++# if HAVE_RAW_DECL_WCSTOK ++_GL_WARN_ON_USE (wcstok, "wcstok is unportable - " ++ "use gnulib module wcstok for portability"); ++# endif ++#endif ++ ++ ++/* Determine number of column positions required for first N wide ++ characters (or fewer if S ends before this) in S. */ ++#if 0 ++# if 0 ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wcswidth ++# define wcswidth rpl_wcswidth ++# endif ++_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)); ++_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); ++# else ++# if !1 ++_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); ++# endif ++_GL_CXXALIASWARN (wcswidth); ++#elif defined GNULIB_POSIXCHECK ++# undef wcswidth ++# if HAVE_RAW_DECL_WCSWIDTH ++_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " ++ "use gnulib module wcswidth for portability"); ++# endif ++#endif ++ ++ ++#endif /* _GL_WCHAR_H */ ++#endif /* _GL_WCHAR_H */ ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/wchar.in.h b/xbmc/screensavers/rsxs-0.9/lib/wchar.in.h +new file mode 100644 +index 0000000..1ed4521 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/lib/wchar.in.h +@@ -0,0 +1,1006 @@ ++/* A substitute for ISO C99 , for platforms that have issues. ++ ++ Copyright (C) 2007-2011 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* Written by Eric Blake. */ ++ ++/* ++ * ISO C 99 for platforms that have issues. ++ * ++ * ++ * For now, this just ensures proper prerequisite inclusion order and ++ * the declaration of wcwidth(). ++ */ ++ ++#if __GNUC__ >= 3 ++@PRAGMA_SYSTEM_HEADER@ ++#endif ++@PRAGMA_COLUMNS@ ++ ++#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H ++/* Special invocation convention: ++ - Inside glibc and uClibc header files. ++ - On HP-UX 11.00 we have a sequence of nested includes ++ -> -> , and the latter includes , ++ once indirectly -> -> -> ++ and once directly. In both situations 'wint_t' is not yet defined, ++ therefore we cannot provide the function overrides; instead include only ++ the system's . ++ - On IRIX 6.5, similarly, we have an include -> , and ++ the latter includes . But here, we have no way to detect whether ++ is completely included or is still being included. */ ++ ++#@INCLUDE_NEXT@ @NEXT_WCHAR_H@ ++ ++#else ++/* Normal invocation convention. */ ++ ++#ifndef _@GUARD_PREFIX@_WCHAR_H ++ ++#define _GL_ALREADY_INCLUDING_WCHAR_H ++ ++#if @HAVE_FEATURES_H@ ++# include /* for __GLIBC__ */ ++#endif ++ ++/* Tru64 with Desktop Toolkit C has a bug: must be included before ++ . ++ BSD/OS 4.0.1 has a bug: , and must be ++ included before . ++ In some builds of uClibc, is nonexistent and wchar_t is defined ++ by . ++ But avoid namespace pollution on glibc systems. */ ++#if !(defined __GLIBC__ && !defined __UCLIBC__) ++# include ++#endif ++#ifndef __GLIBC__ ++# include ++# include ++#endif ++ ++/* Include the original if it exists. ++ Some builds of uClibc lack it. */ ++/* The include_next requires a split double-inclusion guard. */ ++#if @HAVE_WCHAR_H@ ++# @INCLUDE_NEXT@ @NEXT_WCHAR_H@ ++#endif ++ ++#undef _GL_ALREADY_INCLUDING_WCHAR_H ++ ++#ifndef _@GUARD_PREFIX@_WCHAR_H ++#define _@GUARD_PREFIX@_WCHAR_H ++ ++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ ++ ++/* The definition of _GL_ARG_NONNULL is copied here. */ ++ ++/* The definition of _GL_WARN_ON_USE is copied here. */ ++ ++ ++/* Define wint_t and WEOF. (Also done in wctype.in.h.) */ ++#if !@HAVE_WINT_T@ && !defined wint_t ++# define wint_t int ++# ifndef WEOF ++# define WEOF -1 ++# endif ++#else ++/* MSVC defines wint_t as 'unsigned short' in . ++ This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be ++ "unchanged by default argument promotions". Override it. */ ++# if defined _MSC_VER ++# if !GNULIB_defined_wint_t ++# include ++typedef unsigned int rpl_wint_t; ++# undef wint_t ++# define wint_t rpl_wint_t ++# define GNULIB_defined_wint_t 1 ++# endif ++# endif ++# ifndef WEOF ++# define WEOF ((wint_t) -1) ++# endif ++#endif ++ ++ ++/* Override mbstate_t if it is too small. ++ On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for ++ implementing mbrtowc for encodings like UTF-8. */ ++#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ ++# if !GNULIB_defined_mbstate_t ++typedef int rpl_mbstate_t; ++# undef mbstate_t ++# define mbstate_t rpl_mbstate_t ++# define GNULIB_defined_mbstate_t 1 ++# endif ++#endif ++ ++ ++/* Convert a single-byte character to a wide character. */ ++#if @GNULIB_BTOWC@ ++# if @REPLACE_BTOWC@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef btowc ++# define btowc rpl_btowc ++# endif ++_GL_FUNCDECL_RPL (btowc, wint_t, (int c)); ++_GL_CXXALIAS_RPL (btowc, wint_t, (int c)); ++# else ++# if !@HAVE_BTOWC@ ++_GL_FUNCDECL_SYS (btowc, wint_t, (int c)); ++# endif ++_GL_CXXALIAS_SYS (btowc, wint_t, (int c)); ++# endif ++_GL_CXXALIASWARN (btowc); ++#elif defined GNULIB_POSIXCHECK ++# undef btowc ++# if HAVE_RAW_DECL_BTOWC ++_GL_WARN_ON_USE (btowc, "btowc is unportable - " ++ "use gnulib module btowc for portability"); ++# endif ++#endif ++ ++ ++/* Convert a wide character to a single-byte character. */ ++#if @GNULIB_WCTOB@ ++# if @REPLACE_WCTOB@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wctob ++# define wctob rpl_wctob ++# endif ++_GL_FUNCDECL_RPL (wctob, int, (wint_t wc)); ++_GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); ++# else ++# if !defined wctob && !@HAVE_DECL_WCTOB@ ++/* wctob is provided by gnulib, or wctob exists but is not declared. */ ++_GL_FUNCDECL_SYS (wctob, int, (wint_t wc)); ++# endif ++_GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); ++# endif ++_GL_CXXALIASWARN (wctob); ++#elif defined GNULIB_POSIXCHECK ++# undef wctob ++# if HAVE_RAW_DECL_WCTOB ++_GL_WARN_ON_USE (wctob, "wctob is unportable - " ++ "use gnulib module wctob for portability"); ++# endif ++#endif ++ ++ ++/* Test whether *PS is in the initial state. */ ++#if @GNULIB_MBSINIT@ ++# if @REPLACE_MBSINIT@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbsinit ++# define mbsinit rpl_mbsinit ++# endif ++_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); ++_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); ++# else ++# if !@HAVE_MBSINIT@ ++_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); ++# endif ++_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (mbsinit); ++#elif defined GNULIB_POSIXCHECK ++# undef mbsinit ++# if HAVE_RAW_DECL_MBSINIT ++_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " ++ "use gnulib module mbsinit for portability"); ++# endif ++#endif ++ ++ ++/* Convert a multibyte character to a wide character. */ ++#if @GNULIB_MBRTOWC@ ++# if @REPLACE_MBRTOWC@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbrtowc ++# define mbrtowc rpl_mbrtowc ++# endif ++_GL_FUNCDECL_RPL (mbrtowc, size_t, ++ (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); ++_GL_CXXALIAS_RPL (mbrtowc, size_t, ++ (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); ++# else ++# if !@HAVE_MBRTOWC@ ++_GL_FUNCDECL_SYS (mbrtowc, size_t, ++ (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); ++# endif ++_GL_CXXALIAS_SYS (mbrtowc, size_t, ++ (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (mbrtowc); ++#elif defined GNULIB_POSIXCHECK ++# undef mbrtowc ++# if HAVE_RAW_DECL_MBRTOWC ++_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " ++ "use gnulib module mbrtowc for portability"); ++# endif ++#endif ++ ++ ++/* Recognize a multibyte character. */ ++#if @GNULIB_MBRLEN@ ++# if @REPLACE_MBRLEN@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbrlen ++# define mbrlen rpl_mbrlen ++# endif ++_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); ++_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); ++# else ++# if !@HAVE_MBRLEN@ ++_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); ++# endif ++_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (mbrlen); ++#elif defined GNULIB_POSIXCHECK ++# undef mbrlen ++# if HAVE_RAW_DECL_MBRLEN ++_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " ++ "use gnulib module mbrlen for portability"); ++# endif ++#endif ++ ++ ++/* Convert a string to a wide string. */ ++#if @GNULIB_MBSRTOWCS@ ++# if @REPLACE_MBSRTOWCS@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbsrtowcs ++# define mbsrtowcs rpl_mbsrtowcs ++# endif ++_GL_FUNCDECL_RPL (mbsrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (mbsrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t len, ++ mbstate_t *ps)); ++# else ++# if !@HAVE_MBSRTOWCS@ ++_GL_FUNCDECL_SYS (mbsrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (mbsrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t len, ++ mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (mbsrtowcs); ++#elif defined GNULIB_POSIXCHECK ++# undef mbsrtowcs ++# if HAVE_RAW_DECL_MBSRTOWCS ++_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " ++ "use gnulib module mbsrtowcs for portability"); ++# endif ++#endif ++ ++ ++/* Convert a string to a wide string. */ ++#if @GNULIB_MBSNRTOWCS@ ++# if @REPLACE_MBSNRTOWCS@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef mbsnrtowcs ++# define mbsnrtowcs rpl_mbsnrtowcs ++# endif ++_GL_FUNCDECL_RPL (mbsnrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t srclen, size_t len, ++ mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (mbsnrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t srclen, size_t len, ++ mbstate_t *ps)); ++# else ++# if !@HAVE_MBSNRTOWCS@ ++_GL_FUNCDECL_SYS (mbsnrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t srclen, size_t len, ++ mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (mbsnrtowcs, size_t, ++ (wchar_t *dest, const char **srcp, size_t srclen, size_t len, ++ mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (mbsnrtowcs); ++#elif defined GNULIB_POSIXCHECK ++# undef mbsnrtowcs ++# if HAVE_RAW_DECL_MBSNRTOWCS ++_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " ++ "use gnulib module mbsnrtowcs for portability"); ++# endif ++#endif ++ ++ ++/* Convert a wide character to a multibyte character. */ ++#if @GNULIB_WCRTOMB@ ++# if @REPLACE_WCRTOMB@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wcrtomb ++# define wcrtomb rpl_wcrtomb ++# endif ++_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); ++_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); ++# else ++# if !@HAVE_WCRTOMB@ ++_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); ++# endif ++_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (wcrtomb); ++#elif defined GNULIB_POSIXCHECK ++# undef wcrtomb ++# if HAVE_RAW_DECL_WCRTOMB ++_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " ++ "use gnulib module wcrtomb for portability"); ++# endif ++#endif ++ ++ ++/* Convert a wide string to a string. */ ++#if @GNULIB_WCSRTOMBS@ ++# if @REPLACE_WCSRTOMBS@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wcsrtombs ++# define wcsrtombs rpl_wcsrtombs ++# endif ++_GL_FUNCDECL_RPL (wcsrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (wcsrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t len, ++ mbstate_t *ps)); ++# else ++# if !@HAVE_WCSRTOMBS@ ++_GL_FUNCDECL_SYS (wcsrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (wcsrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t len, ++ mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (wcsrtombs); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsrtombs ++# if HAVE_RAW_DECL_WCSRTOMBS ++_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " ++ "use gnulib module wcsrtombs for portability"); ++# endif ++#endif ++ ++ ++/* Convert a wide string to a string. */ ++#if @GNULIB_WCSNRTOMBS@ ++# if @REPLACE_WCSNRTOMBS@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wcsnrtombs ++# define wcsnrtombs rpl_wcsnrtombs ++# endif ++_GL_FUNCDECL_RPL (wcsnrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t srclen, size_t len, ++ mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (wcsnrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t srclen, size_t len, ++ mbstate_t *ps)); ++# else ++# if !@HAVE_WCSNRTOMBS@ ++_GL_FUNCDECL_SYS (wcsnrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t srclen, size_t len, ++ mbstate_t *ps) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (wcsnrtombs, size_t, ++ (char *dest, const wchar_t **srcp, size_t srclen, size_t len, ++ mbstate_t *ps)); ++# endif ++_GL_CXXALIASWARN (wcsnrtombs); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsnrtombs ++# if HAVE_RAW_DECL_WCSNRTOMBS ++_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " ++ "use gnulib module wcsnrtombs for portability"); ++# endif ++#endif ++ ++ ++/* Return the number of screen columns needed for WC. */ ++#if @GNULIB_WCWIDTH@ ++# if @REPLACE_WCWIDTH@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wcwidth ++# define wcwidth rpl_wcwidth ++# endif ++_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t)); ++_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); ++# else ++# if !@HAVE_DECL_WCWIDTH@ ++/* wcwidth exists but is not declared. */ ++_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t)); ++# endif ++_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); ++# endif ++_GL_CXXALIASWARN (wcwidth); ++#elif defined GNULIB_POSIXCHECK ++# undef wcwidth ++# if HAVE_RAW_DECL_WCWIDTH ++_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " ++ "use gnulib module wcwidth for portability"); ++# endif ++#endif ++ ++ ++/* Search N wide characters of S for C. */ ++#if @GNULIB_WMEMCHR@ ++# if !@HAVE_WMEMCHR@ ++_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { ++ const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t); ++ wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t); ++ } */ ++_GL_CXXALIAS_SYS_CAST2 (wmemchr, ++ wchar_t *, (const wchar_t *, wchar_t, size_t), ++ const wchar_t *, (const wchar_t *, wchar_t, size_t)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); ++_GL_CXXALIASWARN1 (wmemchr, const wchar_t *, ++ (const wchar_t *s, wchar_t c, size_t n)); ++# else ++_GL_CXXALIASWARN (wmemchr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wmemchr ++# if HAVE_RAW_DECL_WMEMCHR ++_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " ++ "use gnulib module wmemchr for portability"); ++# endif ++#endif ++ ++ ++/* Compare N wide characters of S1 and S2. */ ++#if @GNULIB_WMEMCMP@ ++# if !@HAVE_WMEMCMP@ ++_GL_FUNCDECL_SYS (wmemcmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wmemcmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++_GL_CXXALIASWARN (wmemcmp); ++#elif defined GNULIB_POSIXCHECK ++# undef wmemcmp ++# if HAVE_RAW_DECL_WMEMCMP ++_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " ++ "use gnulib module wmemcmp for portability"); ++# endif ++#endif ++ ++ ++/* Copy N wide characters of SRC to DEST. */ ++#if @GNULIB_WMEMCPY@ ++# if !@HAVE_WMEMCPY@ ++_GL_FUNCDECL_SYS (wmemcpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wmemcpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++_GL_CXXALIASWARN (wmemcpy); ++#elif defined GNULIB_POSIXCHECK ++# undef wmemcpy ++# if HAVE_RAW_DECL_WMEMCPY ++_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " ++ "use gnulib module wmemcpy for portability"); ++# endif ++#endif ++ ++ ++/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for ++ overlapping memory areas. */ ++#if @GNULIB_WMEMMOVE@ ++# if !@HAVE_WMEMMOVE@ ++_GL_FUNCDECL_SYS (wmemmove, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wmemmove, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++_GL_CXXALIASWARN (wmemmove); ++#elif defined GNULIB_POSIXCHECK ++# undef wmemmove ++# if HAVE_RAW_DECL_WMEMMOVE ++_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " ++ "use gnulib module wmemmove for portability"); ++# endif ++#endif ++ ++ ++/* Set N wide characters of S to C. */ ++#if @GNULIB_WMEMSET@ ++# if !@HAVE_WMEMSET@ ++_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); ++_GL_CXXALIASWARN (wmemset); ++#elif defined GNULIB_POSIXCHECK ++# undef wmemset ++# if HAVE_RAW_DECL_WMEMSET ++_GL_WARN_ON_USE (wmemset, "wmemset is unportable - " ++ "use gnulib module wmemset for portability"); ++# endif ++#endif ++ ++ ++/* Return the number of wide characters in S. */ ++#if @GNULIB_WCSLEN@ ++# if !@HAVE_WCSLEN@ ++_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s)); ++# endif ++_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); ++_GL_CXXALIASWARN (wcslen); ++#elif defined GNULIB_POSIXCHECK ++# undef wcslen ++# if HAVE_RAW_DECL_WCSLEN ++_GL_WARN_ON_USE (wcslen, "wcslen is unportable - " ++ "use gnulib module wcslen for portability"); ++# endif ++#endif ++ ++ ++/* Return the number of wide characters in S, but at most MAXLEN. */ ++#if @GNULIB_WCSNLEN@ ++# if !@HAVE_WCSNLEN@ ++_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); ++# endif ++_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); ++_GL_CXXALIASWARN (wcsnlen); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsnlen ++# if HAVE_RAW_DECL_WCSNLEN ++_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " ++ "use gnulib module wcsnlen for portability"); ++# endif ++#endif ++ ++ ++/* Copy SRC to DEST. */ ++#if @GNULIB_WCSCPY@ ++# if !@HAVE_WCSCPY@ ++_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++# endif ++_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++_GL_CXXALIASWARN (wcscpy); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscpy ++# if HAVE_RAW_DECL_WCSCPY ++_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " ++ "use gnulib module wcscpy for portability"); ++# endif ++#endif ++ ++ ++/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ ++#if @GNULIB_WCPCPY@ ++# if !@HAVE_WCPCPY@ ++_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++# endif ++_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++_GL_CXXALIASWARN (wcpcpy); ++#elif defined GNULIB_POSIXCHECK ++# undef wcpcpy ++# if HAVE_RAW_DECL_WCPCPY ++_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " ++ "use gnulib module wcpcpy for portability"); ++# endif ++#endif ++ ++ ++/* Copy no more than N wide characters of SRC to DEST. */ ++#if @GNULIB_WCSNCPY@ ++# if !@HAVE_WCSNCPY@ ++_GL_FUNCDECL_SYS (wcsncpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcsncpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++_GL_CXXALIASWARN (wcsncpy); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsncpy ++# if HAVE_RAW_DECL_WCSNCPY ++_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " ++ "use gnulib module wcsncpy for portability"); ++# endif ++#endif ++ ++ ++/* Copy no more than N characters of SRC to DEST, returning the address of ++ the last character written into DEST. */ ++#if @GNULIB_WCPNCPY@ ++# if !@HAVE_WCPNCPY@ ++_GL_FUNCDECL_SYS (wcpncpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcpncpy, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++_GL_CXXALIASWARN (wcpncpy); ++#elif defined GNULIB_POSIXCHECK ++# undef wcpncpy ++# if HAVE_RAW_DECL_WCPNCPY ++_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " ++ "use gnulib module wcpncpy for portability"); ++# endif ++#endif ++ ++ ++/* Append SRC onto DEST. */ ++#if @GNULIB_WCSCAT@ ++# if !@HAVE_WCSCAT@ ++_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++# endif ++_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); ++_GL_CXXALIASWARN (wcscat); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscat ++# if HAVE_RAW_DECL_WCSCAT ++_GL_WARN_ON_USE (wcscat, "wcscat is unportable - " ++ "use gnulib module wcscat for portability"); ++# endif ++#endif ++ ++ ++/* Append no more than N wide characters of SRC onto DEST. */ ++#if @GNULIB_WCSNCAT@ ++# if !@HAVE_WCSNCAT@ ++_GL_FUNCDECL_SYS (wcsncat, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcsncat, wchar_t *, ++ (wchar_t *dest, const wchar_t *src, size_t n)); ++_GL_CXXALIASWARN (wcsncat); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsncat ++# if HAVE_RAW_DECL_WCSNCAT ++_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " ++ "use gnulib module wcsncat for portability"); ++# endif ++#endif ++ ++ ++/* Compare S1 and S2. */ ++#if @GNULIB_WCSCMP@ ++# if !@HAVE_WCSCMP@ ++_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); ++# endif ++_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); ++_GL_CXXALIASWARN (wcscmp); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscmp ++# if HAVE_RAW_DECL_WCSCMP ++_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " ++ "use gnulib module wcscmp for portability"); ++# endif ++#endif ++ ++ ++/* Compare no more than N wide characters of S1 and S2. */ ++#if @GNULIB_WCSNCMP@ ++# if !@HAVE_WCSNCMP@ ++_GL_FUNCDECL_SYS (wcsncmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcsncmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++_GL_CXXALIASWARN (wcsncmp); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsncmp ++# if HAVE_RAW_DECL_WCSNCMP ++_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " ++ "use gnulib module wcsncmp for portability"); ++# endif ++#endif ++ ++ ++/* Compare S1 and S2, ignoring case. */ ++#if @GNULIB_WCSCASECMP@ ++# if !@HAVE_WCSCASECMP@ ++_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); ++# endif ++_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); ++_GL_CXXALIASWARN (wcscasecmp); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscasecmp ++# if HAVE_RAW_DECL_WCSCASECMP ++_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " ++ "use gnulib module wcscasecmp for portability"); ++# endif ++#endif ++ ++ ++/* Compare no more than N chars of S1 and S2, ignoring case. */ ++#if @GNULIB_WCSNCASECMP@ ++# if !@HAVE_WCSNCASECMP@ ++_GL_FUNCDECL_SYS (wcsncasecmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcsncasecmp, int, ++ (const wchar_t *s1, const wchar_t *s2, size_t n)); ++_GL_CXXALIASWARN (wcsncasecmp); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsncasecmp ++# if HAVE_RAW_DECL_WCSNCASECMP ++_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " ++ "use gnulib module wcsncasecmp for portability"); ++# endif ++#endif ++ ++ ++/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE ++ category of the current locale. */ ++#if @GNULIB_WCSCOLL@ ++# if !@HAVE_WCSCOLL@ ++_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); ++# endif ++_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); ++_GL_CXXALIASWARN (wcscoll); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscoll ++# if HAVE_RAW_DECL_WCSCOLL ++_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " ++ "use gnulib module wcscoll for portability"); ++# endif ++#endif ++ ++ ++/* Transform S2 into array pointed to by S1 such that if wcscmp is applied ++ to two transformed strings the result is the as applying 'wcscoll' to the ++ original strings. */ ++#if @GNULIB_WCSXFRM@ ++# if !@HAVE_WCSXFRM@ ++_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); ++_GL_CXXALIASWARN (wcsxfrm); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsxfrm ++# if HAVE_RAW_DECL_WCSXFRM ++_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " ++ "use gnulib module wcsxfrm for portability"); ++# endif ++#endif ++ ++ ++/* Duplicate S, returning an identical malloc'd string. */ ++#if @GNULIB_WCSDUP@ ++# if !@HAVE_WCSDUP@ ++_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s)); ++# endif ++_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); ++_GL_CXXALIASWARN (wcsdup); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsdup ++# if HAVE_RAW_DECL_WCSDUP ++_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " ++ "use gnulib module wcsdup for portability"); ++# endif ++#endif ++ ++ ++/* Find the first occurrence of WC in WCS. */ ++#if @GNULIB_WCSCHR@ ++# if !@HAVE_WCSCHR@ ++_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { ++ const wchar_t * std::wcschr (const wchar_t *, wchar_t); ++ wchar_t * std::wcschr (wchar_t *, wchar_t); ++ } */ ++_GL_CXXALIAS_SYS_CAST2 (wcschr, ++ wchar_t *, (const wchar_t *, wchar_t), ++ const wchar_t *, (const wchar_t *, wchar_t)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); ++_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); ++# else ++_GL_CXXALIASWARN (wcschr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wcschr ++# if HAVE_RAW_DECL_WCSCHR ++_GL_WARN_ON_USE (wcschr, "wcschr is unportable - " ++ "use gnulib module wcschr for portability"); ++# endif ++#endif ++ ++ ++/* Find the last occurrence of WC in WCS. */ ++#if @GNULIB_WCSRCHR@ ++# if !@HAVE_WCSRCHR@ ++_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { ++ const wchar_t * std::wcsrchr (const wchar_t *, wchar_t); ++ wchar_t * std::wcsrchr (wchar_t *, wchar_t); ++ } */ ++_GL_CXXALIAS_SYS_CAST2 (wcsrchr, ++ wchar_t *, (const wchar_t *, wchar_t), ++ const wchar_t *, (const wchar_t *, wchar_t)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); ++_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); ++# else ++_GL_CXXALIASWARN (wcsrchr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wcsrchr ++# if HAVE_RAW_DECL_WCSRCHR ++_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " ++ "use gnulib module wcsrchr for portability"); ++# endif ++#endif ++ ++ ++/* Return the length of the initial segmet of WCS which consists entirely ++ of wide characters not in REJECT. */ ++#if @GNULIB_WCSCSPN@ ++# if !@HAVE_WCSCSPN@ ++_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); ++# endif ++_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); ++_GL_CXXALIASWARN (wcscspn); ++#elif defined GNULIB_POSIXCHECK ++# undef wcscspn ++# if HAVE_RAW_DECL_WCSCSPN ++_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " ++ "use gnulib module wcscspn for portability"); ++# endif ++#endif ++ ++ ++/* Return the length of the initial segmet of WCS which consists entirely ++ of wide characters in ACCEPT. */ ++#if @GNULIB_WCSSPN@ ++# if !@HAVE_WCSSPN@ ++_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); ++# endif ++_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); ++_GL_CXXALIASWARN (wcsspn); ++#elif defined GNULIB_POSIXCHECK ++# undef wcsspn ++# if HAVE_RAW_DECL_WCSSPN ++_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " ++ "use gnulib module wcsspn for portability"); ++# endif ++#endif ++ ++ ++/* Find the first occurrence in WCS of any character in ACCEPT. */ ++#if @GNULIB_WCSPBRK@ ++# if !@HAVE_WCSPBRK@ ++_GL_FUNCDECL_SYS (wcspbrk, wchar_t *, ++ (const wchar_t *wcs, const wchar_t *accept)); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { ++ const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *); ++ wchar_t * std::wcspbrk (wchar_t *, const wchar_t *); ++ } */ ++_GL_CXXALIAS_SYS_CAST2 (wcspbrk, ++ wchar_t *, (const wchar_t *, const wchar_t *), ++ const wchar_t *, (const wchar_t *, const wchar_t *)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (wcspbrk, wchar_t *, ++ (wchar_t *wcs, const wchar_t *accept)); ++_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, ++ (const wchar_t *wcs, const wchar_t *accept)); ++# else ++_GL_CXXALIASWARN (wcspbrk); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wcspbrk ++# if HAVE_RAW_DECL_WCSPBRK ++_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " ++ "use gnulib module wcspbrk for portability"); ++# endif ++#endif ++ ++ ++/* Find the first occurrence of NEEDLE in HAYSTACK. */ ++#if @GNULIB_WCSSTR@ ++# if !@HAVE_WCSSTR@ ++_GL_FUNCDECL_SYS (wcsstr, wchar_t *, ++ (const wchar_t *haystack, const wchar_t *needle)); ++# endif ++ /* On some systems, this function is defined as an overloaded function: ++ extern "C++" { ++ const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); ++ wchar_t * std::wcsstr (wchar_t *, const wchar_t *); ++ } */ ++_GL_CXXALIAS_SYS_CAST2 (wcsstr, ++ wchar_t *, (const wchar_t *, const wchar_t *), ++ const wchar_t *, (const wchar_t *, const wchar_t *)); ++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ ++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) ++_GL_CXXALIASWARN1 (wcsstr, wchar_t *, ++ (wchar_t *haystack, const wchar_t *needle)); ++_GL_CXXALIASWARN1 (wcsstr, const wchar_t *, ++ (const wchar_t *haystack, const wchar_t *needle)); ++# else ++_GL_CXXALIASWARN (wcsstr); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wcsstr ++# if HAVE_RAW_DECL_WCSSTR ++_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " ++ "use gnulib module wcsstr for portability"); ++# endif ++#endif ++ ++ ++/* Divide WCS into tokens separated by characters in DELIM. */ ++#if @GNULIB_WCSTOK@ ++# if !@HAVE_WCSTOK@ ++_GL_FUNCDECL_SYS (wcstok, wchar_t *, ++ (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); ++# endif ++_GL_CXXALIAS_SYS (wcstok, wchar_t *, ++ (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); ++_GL_CXXALIASWARN (wcstok); ++#elif defined GNULIB_POSIXCHECK ++# undef wcstok ++# if HAVE_RAW_DECL_WCSTOK ++_GL_WARN_ON_USE (wcstok, "wcstok is unportable - " ++ "use gnulib module wcstok for portability"); ++# endif ++#endif ++ ++ ++/* Determine number of column positions required for first N wide ++ characters (or fewer if S ends before this) in S. */ ++#if @GNULIB_WCSWIDTH@ ++# if @REPLACE_WCSWIDTH@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef wcswidth ++# define wcswidth rpl_wcswidth ++# endif ++_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)); ++_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); ++# else ++# if !@HAVE_WCSWIDTH@ ++_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)); ++# endif ++_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); ++# endif ++_GL_CXXALIASWARN (wcswidth); ++#elif defined GNULIB_POSIXCHECK ++# undef wcswidth ++# if HAVE_RAW_DECL_WCSWIDTH ++_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " ++ "use gnulib module wcswidth for portability"); ++# endif ++#endif ++ ++ ++#endif /* _@GUARD_PREFIX@_WCHAR_H */ ++#endif /* _@GUARD_PREFIX@_WCHAR_H */ ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/lib/xsize.h b/xbmc/screensavers/rsxs-0.9/lib/xsize.h +index 341fb16..6505c42 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/xsize.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/xsize.h +@@ -1,10 +1,10 @@ + /* xsize.h -- Checked size_t computations. + +- Copyright (C) 2003 Free Software Foundation, Inc. ++ Copyright (C) 2003, 2008-2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -94,7 +94,7 @@ + /* Multiplication of a count with an element size, with overflow check. + The count must be >= 0 and the element size must be > 0. + This is a macro, not an inline function, so that it works correctly even +- when N is of a wider tupe and N > SIZE_MAX. */ ++ when N is of a wider type and N > SIZE_MAX. */ + #define xtimes(N, ELSIZE) \ + ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) + +diff --git a/xbmc/screensavers/rsxs-0.9/m4/00gnulib.m4 b/xbmc/screensavers/rsxs-0.9/m4/00gnulib.m4 +new file mode 100644 +index 0000000..7feed46 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/00gnulib.m4 +@@ -0,0 +1,30 @@ ++# 00gnulib.m4 serial 2 ++dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl This file must be named something that sorts before all other ++dnl gnulib-provided .m4 files. It is needed until such time as we can ++dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics. ++ ++# AC_DEFUN_ONCE([NAME], VALUE) ++# ---------------------------- ++# Define NAME to expand to VALUE on the first use (whether by direct ++# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses. ++# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This ++# definition is slower than the version in Autoconf 2.64, because it ++# can only use interfaces that existed since 2.59; but it achieves the ++# same effect. Quoting is necessary to avoid confusing Automake. ++m4_version_prereq([2.63.263], [], ++[m4_define([AC][_DEFUN_ONCE], ++ [AC][_DEFUN([$1], ++ [AC_REQUIRE([_gl_DEFUN_ONCE([$1])], ++ [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl ++[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])]) ++ ++# gl_00GNULIB ++# ----------- ++# Witness macro that this file has been included. Needed to force ++# Automake to include this file prior to all other gnulib .m4 files. ++AC_DEFUN([gl_00GNULIB]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/alloca.m4 b/xbmc/screensavers/rsxs-0.9/m4/alloca.m4 +index a9e3f45..a8744a8 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/alloca.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/alloca.m4 +@@ -1,15 +1,12 @@ +-# alloca.m4 serial 5 +-dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. ++# alloca.m4 serial 13 ++dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation, ++dnl Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + + AC_DEFUN([gl_FUNC_ALLOCA], + [ +- dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. +- AC_REQUIRE([AC_PROG_CPP]) +- AC_REQUIRE([AC_PROG_EGREP]) +- + AC_REQUIRE([AC_FUNC_ALLOCA]) + if test $ac_cv_func_alloca_works = no; then + gl_PREREQ_ALLOCA +@@ -17,26 +14,108 @@ AC_DEFUN([gl_FUNC_ALLOCA], + + # Define an additional variable used in the Makefile substitution. + if test $ac_cv_working_alloca_h = yes; then +- AC_EGREP_CPP([Need own alloca], [ ++ AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [ ++ AC_EGREP_CPP([Need own alloca], [ + #if defined __GNUC__ || defined _AIX || defined _MSC_VER +- Need own alloca ++ Need own alloca + #endif +- ], +- [AC_DEFINE(HAVE_ALLOCA, 1, +- [Define to 1 if you have `alloca' after including , +- a header that may be supplied by this distribution.]) +- ALLOCA_H=alloca.h], +- [ALLOCA_H=]) ++ ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no]) ++ ]) ++ if test $gl_cv_rpl_alloca = yes; then ++ dnl OK, alloca can be implemented through a compiler built-in. ++ AC_DEFINE([HAVE_ALLOCA], [1], ++ [Define to 1 if you have 'alloca' after including , ++ a header that may be supplied by this distribution.]) ++ ALLOCA_H=alloca.h ++ else ++ dnl alloca exists as a library function, i.e. it is slow and probably ++ dnl a memory leak. Don't define HAVE_ALLOCA in this case. ++ ALLOCA_H= ++ fi + else + ALLOCA_H=alloca.h + fi + AC_SUBST([ALLOCA_H]) +- +- AC_DEFINE(HAVE_ALLOCA_H, 1, +- [Define HAVE_ALLOCA_H for backward compatibility with older code +- that includes only if HAVE_ALLOCA_H is defined.]) ++ AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"]) + ]) + + # Prerequisites of lib/alloca.c. + # STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. + AC_DEFUN([gl_PREREQ_ALLOCA], [:]) ++ ++# This works around a bug in autoconf <= 2.68. ++# See . ++ ++m4_version_prereq([2.69], [] ,[ ++ ++# This is taken from the following Autoconf patch: ++# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497 ++ ++# _AC_LIBOBJ_ALLOCA ++# ----------------- ++# Set up the LIBOBJ replacement of `alloca'. Well, not exactly ++# AC_LIBOBJ since we actually set the output variable `ALLOCA'. ++# Nevertheless, for Automake, AC_LIBSOURCES it. ++m4_define([_AC_LIBOBJ_ALLOCA], ++[# The SVR3 libPW and SVR4 libucb both contain incompatible functions ++# that cause trouble. Some versions do not even contain alloca or ++# contain a buggy version. If you still want to use their alloca, ++# use ar to extract alloca.o from them instead of compiling alloca.c. ++AC_LIBSOURCES(alloca.c) ++AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl ++AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using `alloca.c'.]) ++ ++AC_CACHE_CHECK(whether `alloca.c' needs Cray hooks, ac_cv_os_cray, ++[AC_EGREP_CPP(webecray, ++[#if defined CRAY && ! defined CRAY2 ++webecray ++#else ++wenotbecray ++#endif ++], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) ++if test $ac_cv_os_cray = yes; then ++ for ac_func in _getb67 GETB67 getb67; do ++ AC_CHECK_FUNC($ac_func, ++ [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func, ++ [Define to one of `_getb67', `GETB67', ++ `getb67' for Cray-2 and Cray-YMP ++ systems. This function is required for ++ `alloca.c' support on those systems.]) ++ break]) ++ done ++fi ++ ++AC_CACHE_CHECK([stack direction for C alloca], ++ [ac_cv_c_stack_direction], ++[AC_RUN_IFELSE([AC_LANG_SOURCE( ++[AC_INCLUDES_DEFAULT ++int ++find_stack_direction (int *addr, int depth) ++{ ++ int dir, dummy = 0; ++ if (! addr) ++ addr = &dummy; ++ *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; ++ dir = depth ? find_stack_direction (addr, depth - 1) : 0; ++ return dir + dummy; ++} ++ ++int ++main (int argc, char **argv) ++{ ++ return find_stack_direction (0, argc + !argv + 20) < 0; ++}])], ++ [ac_cv_c_stack_direction=1], ++ [ac_cv_c_stack_direction=-1], ++ [ac_cv_c_stack_direction=0])]) ++AH_VERBATIM([STACK_DIRECTION], ++[/* If using the C implementation of alloca, define if you know the ++ direction of stack growth for your system; otherwise it will be ++ automatically deduced at runtime. ++ STACK_DIRECTION > 0 => grows toward higher addresses ++ STACK_DIRECTION < 0 => grows toward lower addresses ++ STACK_DIRECTION = 0 => direction of growth unknown */ ++@%:@undef STACK_DIRECTION])dnl ++AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) ++])# _AC_LIBOBJ_ALLOCA ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/argp.m4 b/xbmc/screensavers/rsxs-0.9/m4/argp.m4 +index 7d761ae..a9963ee 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/argp.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/argp.m4 +@@ -1,5 +1,5 @@ +-# argp.m4 serial 6 +-dnl Copyright (C) 2003-2006 Free Software Foundation, Inc. ++# argp.m4 serial 13 ++dnl Copyright (C) 2003-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -7,41 +7,41 @@ dnl with or without modifications, as long as this notice is preserved. + AC_DEFUN([gl_ARGP], + [ + AC_REQUIRE([AC_C_INLINE]) ++ AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) +- AC_REQUIRE([gl_GETOPT_SUBSTITUTE]) + + AC_CHECK_DECL([program_invocation_name], +- [AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_NAME, 1, ++ [AC_DEFINE([HAVE_DECL_PROGRAM_INVOCATION_NAME], [1], + [Define if program_invocation_name is declared])], +- [AC_DEFINE(GNULIB_PROGRAM_INVOCATION_NAME, 1, +- [Define to 1 to add extern declaration of program_invocation_name to argp-namefrob.h])], +- [#include ]) ++ [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_NAME], [1], ++ [Define to 1 to add extern declaration of program_invocation_name to argp.h])], ++ [[#include ]]) + AC_CHECK_DECL([program_invocation_short_name], +- [AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME, 1, ++ [AC_DEFINE([HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME], [1], + [Define if program_invocation_short_name is declared])], +- [AC_DEFINE(GNULIB_PROGRAM_INVOCATION_SHORT_NAME, 1, +- [Define to 1 to add extern declaration of program_invocation_short_name to argp-namefrob.h])], +- [#include ]) ++ [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_SHORT_NAME], [1], ++ [Define to 1 to add extern declaration of program_invocation_short_name to argp.h])], ++ [[#include ]]) + + # Check if program_invocation_name and program_invocation_short_name + # are defined elsewhere. It is improbable that only one of them will + # be defined and other not, I prefer to stay on the safe side and to + # test each one separately. +- AC_MSG_CHECKING(whether program_invocation_name is defined) +- AC_TRY_COMPILE([#include ], +- [ program_invocation_name = "test"; ], +- [ AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME,1, +- [Define if program_invocation_name is defined]) +- AC_MSG_RESULT(yes)], +- [ AC_MSG_RESULT(no)] ) ++ AC_MSG_CHECKING([whether program_invocation_name is defined]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], ++ [[program_invocation_name = "test";]])], ++ [AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], [1], ++ [Define if program_invocation_name is defined]) ++ AC_MSG_RESULT([yes])], ++ [AC_MSG_RESULT([no])]) + +- AC_MSG_CHECKING(whether program_invocation_short_name is defined) +- AC_TRY_COMPILE([#include ], +- [ program_invocation_short_name = "test"; ], +- [ AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME,1, +- [Define if program_invocation_short_name is defined]) +- AC_MSG_RESULT(yes)], +- [ AC_MSG_RESULT(no)] ) ++ AC_MSG_CHECKING([whether program_invocation_short_name is defined]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], ++ [[program_invocation_short_name = "test";]])], ++ [AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1], ++ [Define if program_invocation_short_name is defined]) ++ AC_MSG_RESULT([yes])], ++ [AC_MSG_RESULT([no])]) + + AC_CHECK_DECLS_ONCE([clearerr_unlocked]) + AC_CHECK_DECLS_ONCE([feof_unlocked]) +@@ -59,3 +59,7 @@ AC_DEFUN([gl_ARGP], + AC_CHECK_FUNCS_ONCE([flockfile funlockfile]) + AC_CHECK_HEADERS_ONCE([features.h linewrap.h]) + ]) ++ ++dnl argp-parse.c depends on GNU getopt internals, therefore use GNU getopt ++dnl always. ++AC_DEFUN([gl_REPLACE_GETOPT_ALWAYS], []) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/argz.m4 b/xbmc/screensavers/rsxs-0.9/m4/argz.m4 +index 40e836b..503301e 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/argz.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/argz.m4 +@@ -1,17 +1,19 @@ + # Portability macros for glibc argz. -*- Autoconf -*- +-# Written by Gary V. Vaughan +- +-# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +- ++# ++# Copyright (C) 2004-2011 Free Software Foundation, Inc. ++# Written by Gary V. Vaughan ++# + # This file is free software; the Free Software Foundation gives + # unlimited permission to copy and/or distribute it, with or without + # modifications, as long as this notice is preserved. + +-# serial 4 argz.m4 ++# serial 10 argz.m4 + + AC_DEFUN([gl_FUNC_ARGZ], + [gl_PREREQ_ARGZ + ++AC_REQUIRE([AC_C_RESTRICT]) ++ + AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT]) + + AC_CHECK_TYPES([error_t], +@@ -25,9 +27,53 @@ AC_CHECK_TYPES([error_t], + #endif]) + + ARGZ_H= +-AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next \ +- argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])]) ++AC_CHECK_FUNC([argz_replace], [], [ARGZ_H=argz.h]) ++ ++dnl if have system argz functions, allow forced use of ++dnl libltdl-supplied implementation (and default to do so ++dnl on "known bad" systems). Could use a runtime check, but ++dnl (a) detecting malloc issues is notoriously unreliable ++dnl (b) only known system that declares argz functions, ++dnl provides them, yet they are broken, is cygwin ++dnl releases prior to 5-May-2007 (1.5.24 and earlier) ++dnl So, it's more straightforward simply to special case ++dnl this for known bad systems. ++AS_IF([test -z "$ARGZ_H"], ++ [AC_CACHE_CHECK( ++ [if argz actually works], ++ [lt_cv_sys_argz_works], ++ [[case $host_os in #( ++ *cygwin*) ++ lt_cv_sys_argz_works=no ++ if test "$cross_compiling" != no; then ++ lt_cv_sys_argz_works="guessing no" ++ else ++ lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/' ++ save_IFS=$IFS ++ IFS=-. ++ set x `uname -r | sed -e "$lt_sed_extract_leading_digits"` ++ IFS=$save_IFS ++ lt_os_major=${2-0} ++ lt_os_minor=${3-0} ++ lt_os_micro=${4-0} ++ if test "$lt_os_major" -gt 1 \ ++ || { test "$lt_os_major" -eq 1 \ ++ && { test "$lt_os_minor" -gt 5 \ ++ || { test "$lt_os_minor" -eq 5 \ ++ && test "$lt_os_micro" -gt 24; }; }; }; then ++ lt_cv_sys_argz_works=yes ++ fi ++ fi ++ ;; #( ++ *) lt_cv_sys_argz_works=yes ;; ++ esac]]) ++ AS_IF([test "$lt_cv_sys_argz_works" = yes], ++ [AC_DEFINE([HAVE_WORKING_ARGZ], [1], ++ [This value is set to 1 to indicate that the system argz facility works])], ++ [ARGZ_H=argz.h])]) ++ + AC_SUBST([ARGZ_H]) ++AM_CONDITIONAL([GL_GENERATE_ARGZ_H], [test -n "$ARGZ_H"]) + ]) + + # Prerequisites of lib/argz.c. +diff --git a/xbmc/screensavers/rsxs-0.9/m4/dirname.m4 b/xbmc/screensavers/rsxs-0.9/m4/dirname.m4 +index f3412ad..dcec7e4 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/dirname.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/dirname.m4 +@@ -1,17 +1,19 @@ +-#serial 6 -*- autoconf -*- +-dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. ++#serial 10 -*- autoconf -*- ++dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + + AC_DEFUN([gl_DIRNAME], + [ +- AC_LIBSOURCES([dirname.c, dirname.h]) +- AC_LIBOBJ([dirname]) ++ AC_REQUIRE([gl_DIRNAME_LGPL]) ++]) + ++AC_DEFUN([gl_DIRNAME_LGPL], ++[ + dnl Prerequisites of lib/dirname.h. +- AC_REQUIRE([gl_AC_DOS]) + AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) + +- dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c. ++ dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, ++ dnl lib/stripslash.c. + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/double-slash-root.m4 b/xbmc/screensavers/rsxs-0.9/m4/double-slash-root.m4 +index f8cbd54..16a4e3e 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/double-slash-root.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/double-slash-root.m4 +@@ -1,5 +1,5 @@ +-#serial 1 -*- autoconf -*- +-dnl Copyright (C) 2006 Free Software Foundation, Inc. ++# double-slash-root.m4 serial 4 -*- Autoconf -*- ++dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -7,37 +7,32 @@ dnl with or without modifications, as long as this notice is preserved. + AC_DEFUN([gl_DOUBLE_SLASH_ROOT], + [ + AC_REQUIRE([AC_CANONICAL_HOST]) +- AC_CACHE_CHECK([whether // is distinct from /], [ac_cv_double_slash_root], ++ AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root], + [ if test x"$cross_compiling" = xyes ; then +- # When cross-compiling, there is no way to tell whether // is special +- # short of a list of hosts. However, the only known hosts to date +- # that have a distinct // are Apollo DomainOS (too old to port to) +- # and Cygwin. If anyone knows of another system for which // has +- # special semantics and is distinct from /, please report it to +- # . +- case $host in +- *-cygwin) +- ac_cv_double_slash_root=yes ;; +- *) +- # Be optimistic and assume that / and // are the same when we +- # don't know. +- ac_cv_double_slash_root='unknown, assuming no' ;; +- esac ++ # When cross-compiling, there is no way to tell whether // is special ++ # short of a list of hosts. However, the only known hosts to date ++ # that have a distinct // are Apollo DomainOS (too old to port to), ++ # Cygwin, and z/OS. If anyone knows of another system for which // has ++ # special semantics and is distinct from /, please report it to ++ # . ++ case $host in ++ *-cygwin | i370-ibm-openedition) ++ gl_cv_double_slash_root=yes ;; ++ *) ++ # Be optimistic and assume that / and // are the same when we ++ # don't know. ++ gl_cv_double_slash_root='unknown, assuming no' ;; ++ esac + else +- set x `ls -di / //` +- if test $[2] = $[4]; then +- ac_cv_double_slash_root=no +- else +- ac_cv_double_slash_root=yes +- fi ++ set x `ls -di / // 2>/dev/null` ++ if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then ++ gl_cv_double_slash_root=no ++ else ++ gl_cv_double_slash_root=yes ++ fi + fi]) +- if test x"$ac_cv_double_slash_root" = xyes; then +- ac_double_slash_root=1 +- else +- ac_double_slash_root=0 ++ if test "$gl_cv_double_slash_root" = yes; then ++ AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1], ++ [Define to 1 if // is a file system root distinct from /.]) + fi +- +- AC_DEFINE_UNQUOTED([DOUBLE_SLASH_IS_DISTINCT_ROOT], +- $ac_double_slash_root, +- [Define to 1 if // is a file system root distinct from /.]) + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/errno_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/errno_h.m4 +new file mode 100644 +index 0000000..560adba +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/errno_h.m4 +@@ -0,0 +1,125 @@ ++# errno_h.m4 serial 10 ++dnl Copyright (C) 2004, 2006, 2008-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ ++ AC_EGREP_CPP([booboo],[ ++#include ++#if !defined ENOMSG ++booboo ++#endif ++#if !defined EIDRM ++booboo ++#endif ++#if !defined ENOLINK ++booboo ++#endif ++#if !defined EPROTO ++booboo ++#endif ++#if !defined EMULTIHOP ++booboo ++#endif ++#if !defined EBADMSG ++booboo ++#endif ++#if !defined EOVERFLOW ++booboo ++#endif ++#if !defined ENOTSUP ++booboo ++#endif ++#if !defined ENETRESET ++booboo ++#endif ++#if !defined ECONNABORTED ++booboo ++#endif ++#if !defined ESTALE ++booboo ++#endif ++#if !defined EDQUOT ++booboo ++#endif ++#if !defined ECANCELED ++booboo ++#endif ++ ], ++ [gl_cv_header_errno_h_complete=no], ++ [gl_cv_header_errno_h_complete=yes]) ++ ]) ++ if test $gl_cv_header_errno_h_complete = yes; then ++ ERRNO_H='' ++ else ++ gl_NEXT_HEADERS([errno.h]) ++ ERRNO_H='errno.h' ++ fi ++ AC_SUBST([ERRNO_H]) ++ AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"]) ++ gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) ++ gl_REPLACE_ERRNO_VALUE([ENOLINK]) ++ gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) ++]) ++ ++# Assuming $1 = EOVERFLOW. ++# The EOVERFLOW errno value ought to be defined in , according to ++# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and ++# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. ++# Check for the value of EOVERFLOW. ++# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. ++AC_DEFUN([gl_REPLACE_ERRNO_VALUE], ++[ ++ if test -n "$ERRNO_H"; then ++ AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ ++ AC_EGREP_CPP([yes],[ ++#include ++#ifdef ]$1[ ++yes ++#endif ++ ], ++ [gl_cv_header_errno_h_]$1[=yes], ++ [gl_cv_header_errno_h_]$1[=no]) ++ if test $gl_cv_header_errno_h_]$1[ = no; then ++ AC_EGREP_CPP([yes],[ ++#define _XOPEN_SOURCE_EXTENDED 1 ++#include ++#ifdef ]$1[ ++yes ++#endif ++ ], [gl_cv_header_errno_h_]$1[=hidden]) ++ if test $gl_cv_header_errno_h_]$1[ = hidden; then ++ dnl The macro exists but is hidden. ++ dnl Define it to the same value. ++ AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [ ++#define _XOPEN_SOURCE_EXTENDED 1 ++#include ++/* The following two lines are a workaround against an autoconf-2.52 bug. */ ++#include ++#include ++]) ++ fi ++ fi ++ ]) ++ case $gl_cv_header_errno_h_]$1[ in ++ yes | no) ++ ]$1[_HIDDEN=0; ]$1[_VALUE= ++ ;; ++ *) ++ ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1[" ++ ;; ++ esac ++ AC_SUBST($1[_HIDDEN]) ++ AC_SUBST($1[_VALUE]) ++ fi ++]) ++ ++dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. ++dnl Remove this when we can assume autoconf >= 2.61. ++m4_ifdef([AC_COMPUTE_INT], [], [ ++ AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/exponentd.m4 b/xbmc/screensavers/rsxs-0.9/m4/exponentd.m4 +new file mode 100644 +index 0000000..7e91924 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/exponentd.m4 +@@ -0,0 +1,115 @@ ++# exponentd.m4 serial 2 ++dnl Copyright (C) 2007-2008, 2010-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION], ++[ ++ AC_CACHE_CHECK([where to find the exponent in a 'double'], ++ [gl_cv_cc_double_expbit0], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++#include ++#include ++#define NWORDS \ ++ ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) ++typedef union { double value; unsigned int word[NWORDS]; } memory_double; ++static unsigned int ored_words[NWORDS]; ++static unsigned int anded_words[NWORDS]; ++static void add_to_ored_words (double x) ++{ ++ memory_double m; ++ size_t i; ++ /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ ++ memset (&m, 0, sizeof (memory_double)); ++ m.value = x; ++ for (i = 0; i < NWORDS; i++) ++ { ++ ored_words[i] |= m.word[i]; ++ anded_words[i] &= m.word[i]; ++ } ++} ++int main () ++{ ++ size_t j; ++ FILE *fp = fopen ("conftest.out", "w"); ++ if (fp == NULL) ++ return 1; ++ for (j = 0; j < NWORDS; j++) ++ anded_words[j] = ~ (unsigned int) 0; ++ add_to_ored_words (0.25); ++ add_to_ored_words (0.5); ++ add_to_ored_words (1.0); ++ add_to_ored_words (2.0); ++ add_to_ored_words (4.0); ++ /* Remove bits that are common (e.g. if representation of the first mantissa ++ bit is explicit). */ ++ for (j = 0; j < NWORDS; j++) ++ ored_words[j] &= ~anded_words[j]; ++ /* Now find the nonzero word. */ ++ for (j = 0; j < NWORDS; j++) ++ if (ored_words[j] != 0) ++ break; ++ if (j < NWORDS) ++ { ++ size_t i; ++ for (i = j + 1; i < NWORDS; i++) ++ if (ored_words[i] != 0) ++ { ++ fprintf (fp, "unknown"); ++ return (fclose (fp) != 0); ++ } ++ for (i = 0; ; i++) ++ if ((ored_words[j] >> i) & 1) ++ { ++ fprintf (fp, "word %d bit %d", (int) j, (int) i); ++ return (fclose (fp) != 0); ++ } ++ } ++ fprintf (fp, "unknown"); ++ return (fclose (fp) != 0); ++} ++ ]])], ++ [gl_cv_cc_double_expbit0=`cat conftest.out`], ++ [gl_cv_cc_double_expbit0="unknown"], ++ [ ++ dnl On ARM, there are two 'double' floating-point formats, used by ++ dnl different sets of instructions: The older FPA instructions assume ++ dnl that they are stored in big-endian word order, while the words ++ dnl (like integer types) are stored in little-endian byte order. ++ dnl The newer VFP instructions assume little-endian order consistenly. ++ AC_EGREP_CPP([mixed_endianness], [ ++#if defined arm || defined __arm || defined __arm__ ++ mixed_endianness ++#endif ++ ], ++ [gl_cv_cc_double_expbit0="unknown"], ++ [ ++ pushdef([AC_MSG_CHECKING],[:])dnl ++ pushdef([AC_MSG_RESULT],[:])dnl ++ pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl ++ AC_C_BIGENDIAN( ++ [gl_cv_cc_double_expbit0="word 0 bit 20"], ++ [gl_cv_cc_double_expbit0="word 1 bit 20"], ++ [gl_cv_cc_double_expbit0="unknown"]) ++ popdef([AC_MSG_RESULT_UNQUOTED])dnl ++ popdef([AC_MSG_RESULT])dnl ++ popdef([AC_MSG_CHECKING])dnl ++ ]) ++ ]) ++ rm -f conftest.out ++ ]) ++ case "$gl_cv_cc_double_expbit0" in ++ word*bit*) ++ word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` ++ bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` ++ AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word], ++ [Define as the word index where to find the exponent of 'double'.]) ++ AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit], ++ [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.]) ++ ;; ++ esac ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/extensions.m4 b/xbmc/screensavers/rsxs-0.9/m4/extensions.m4 +index 4976079..22156e0 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/extensions.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/extensions.m4 +@@ -1,42 +1,123 @@ ++# serial 10 -*- Autoconf -*- + # Enable extensions on systems that normally disable them. + +-# Copyright (C) 2003, 2006 Free Software Foundation, Inc. ++# Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc. + # This file is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. + +-# This file is only needed in autoconf <= 2.59. Newer versions of autoconf +-# have a macro AC_USE_SYSTEM_EXTENSIONS with identical semantics. ++# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS ++# Autoconf. Perhaps we can remove this once we can assume Autoconf ++# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly ++# enough in this area it's likely we'll need to redefine ++# AC_USE_SYSTEM_EXTENSIONS for quite some time. + +-# gl_USE_SYSTEM_EXTENSIONS ++# If autoconf reports a warning ++# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS ++# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS ++# the fix is ++# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked ++# but always AC_REQUIREd, ++# 2) to ensure that for each occurrence of ++# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ++# or ++# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) ++# the corresponding gnulib module description has 'extensions' among ++# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS ++# invocation occurs in gl_EARLY, not in gl_INIT. ++ ++# AC_USE_SYSTEM_EXTENSIONS + # ------------------------ + # Enable extensions on systems that normally disable them, + # typically due to standards-conformance issues. +-AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [ +- AC_BEFORE([$0], [AC_COMPILE_IFELSE]) +- AC_BEFORE([$0], [AC_RUN_IFELSE]) ++# Remember that #undef in AH_VERBATIM gets replaced with #define by ++# AC_DEFINE. The goal here is to define all known feature-enabling ++# macros, then, if reports of conflicts are made, disable macros that ++# cause problems on some platforms (such as __EXTENSIONS__). ++AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], ++[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl ++AC_BEFORE([$0], [AC_RUN_IFELSE])dnl + +- AC_REQUIRE([AC_GNU_SOURCE]) +- AC_REQUIRE([AC_AIX]) +- AC_REQUIRE([AC_MINIX]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) ++ ++ AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) ++ if test "$MINIX" = yes; then ++ AC_DEFINE([_POSIX_SOURCE], [1], ++ [Define to 1 if you need to in order for `stat' and other ++ things to work.]) ++ AC_DEFINE([_POSIX_1_SOURCE], [2], ++ [Define to 2 if the system does not provide POSIX.1 features ++ except with this defined.]) ++ AC_DEFINE([_MINIX], [1], ++ [Define to 1 if on MINIX.]) ++ fi ++ ++ dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, ++ dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already ++ dnl provided. ++ case "$host_os" in ++ hpux*) ++ AC_DEFINE([_XOPEN_SOURCE], [500], ++ [Define to 500 only on HP-UX.]) ++ ;; ++ esac + + AH_VERBATIM([__EXTENSIONS__], +-[/* Enable extensions on Solaris. */ +-#ifndef __EXTENSIONS__ +-# undef __EXTENSIONS__ ++[/* Enable extensions on AIX 3, Interix. */ ++#ifndef _ALL_SOURCE ++# undef _ALL_SOURCE ++#endif ++/* Enable general extensions on MacOS X. */ ++#ifndef _DARWIN_C_SOURCE ++# undef _DARWIN_C_SOURCE ++#endif ++/* Enable GNU extensions on systems that have them. */ ++#ifndef _GNU_SOURCE ++# undef _GNU_SOURCE + #endif ++/* Enable threading extensions on Solaris. */ + #ifndef _POSIX_PTHREAD_SEMANTICS + # undef _POSIX_PTHREAD_SEMANTICS +-#endif]) ++#endif ++/* Enable extensions on HP NonStop. */ ++#ifndef _TANDEM_SOURCE ++# undef _TANDEM_SOURCE ++#endif ++/* Enable general extensions on Solaris. */ ++#ifndef __EXTENSIONS__ ++# undef __EXTENSIONS__ ++#endif ++]) + AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], + [ac_cv_safe_to_define___extensions__], + [AC_COMPILE_IFELSE( +- [AC_LANG_PROGRAM([ +- #define __EXTENSIONS__ 1 +- AC_INCLUDES_DEFAULT])], ++ [AC_LANG_PROGRAM([[ ++# define __EXTENSIONS__ 1 ++ ]AC_INCLUDES_DEFAULT])], + [ac_cv_safe_to_define___extensions__=yes], + [ac_cv_safe_to_define___extensions__=no])]) + test $ac_cv_safe_to_define___extensions__ = yes && + AC_DEFINE([__EXTENSIONS__]) ++ AC_DEFINE([_ALL_SOURCE]) ++ AC_DEFINE([_DARWIN_C_SOURCE]) ++ AC_DEFINE([_GNU_SOURCE]) + AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) ++ AC_DEFINE([_TANDEM_SOURCE]) ++])# AC_USE_SYSTEM_EXTENSIONS ++ ++# gl_USE_SYSTEM_EXTENSIONS ++# ------------------------ ++# Enable extensions on systems that normally disable them, ++# typically due to standards-conformance issues. ++AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], ++[ ++ dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS. ++ dnl gnulib does not need it. But if it gets required by third-party macros ++ dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a ++ dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". ++ dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE, ++ dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck. ++ AC_REQUIRE([AC_GNU_SOURCE]) ++ ++ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/float_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/float_h.m4 +new file mode 100644 +index 0000000..0420e06 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/float_h.m4 +@@ -0,0 +1,98 @@ ++# float_h.m4 serial 9 ++dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_FLOAT_H], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) ++ FLOAT_H= ++ REPLACE_FLOAT_LDBL=0 ++ case "$host_os" in ++ aix* | beos* | openbsd* | mirbsd* | irix*) ++ FLOAT_H=float.h ++ ;; ++ freebsd*) ++ case "$host_cpu" in ++changequote(,)dnl ++ i[34567]86 ) ++changequote([,])dnl ++ FLOAT_H=float.h ++ ;; ++ x86_64 ) ++ # On x86_64 systems, the C compiler may still be generating ++ # 32-bit code. ++ AC_EGREP_CPP([yes], ++ [#if defined __LP64__ || defined __x86_64__ || defined __amd64__ ++ yes ++ #endif], ++ [], ++ [FLOAT_H=float.h]) ++ ;; ++ esac ++ ;; ++ linux*) ++ case "$host_cpu" in ++ powerpc*) ++ FLOAT_H=float.h ++ ;; ++ esac ++ ;; ++ esac ++ case "$host_os" in ++ aix* | freebsd* | linux*) ++ if test -n "$FLOAT_H"; then ++ REPLACE_FLOAT_LDBL=1 ++ fi ++ ;; ++ esac ++ ++ dnl Test against glibc-2.7 Linux/SPARC64 bug. ++ REPLACE_ITOLD=0 ++ AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], ++ [gl_cv_func_itold_works], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++int i = -1; ++volatile long double ld; ++int main () ++{ ++ ld += i * 1.0L; ++ if (ld > 0) ++ return 1; ++ return 0; ++}]])], ++ [gl_cv_func_itold_works=yes], ++ [gl_cv_func_itold_works=no], ++ [case "$host" in ++ sparc*-*-linux*) ++ AC_EGREP_CPP([yes], ++ [#if defined __LP64__ || defined __arch64__ ++ yes ++ #endif], ++ [gl_cv_func_itold_works="guessing no"], ++ [gl_cv_func_itold_works="guessing yes"]) ++ ;; ++ *) gl_cv_func_itold_works="guessing yes" ;; ++ esac ++ ]) ++ ]) ++ case "$gl_cv_func_itold_works" in ++ *no) ++ REPLACE_ITOLD=1 ++ dnl We add the workaround to but also to , ++ dnl to increase the chances that the fix function gets pulled in. ++ FLOAT_H=float.h ++ ;; ++ esac ++ ++ if test -n "$FLOAT_H"; then ++ gl_NEXT_HEADERS([float.h]) ++ fi ++ AC_SUBST([FLOAT_H]) ++ AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"]) ++ AC_SUBST([REPLACE_ITOLD]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/getopt.m4 b/xbmc/screensavers/rsxs-0.9/m4/getopt.m4 +index c0a73b2..8ec6e79 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/getopt.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/getopt.m4 +@@ -1,82 +1,340 @@ +-# getopt.m4 serial 13 +-dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. ++# getopt.m4 serial 39 ++dnl Copyright (C) 2002-2006, 2008-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + +-# The getopt module assume you want GNU getopt, with getopt_long etc, +-# rather than vanilla POSIX getopt. This means your code should +-# always include for the getopt prototypes. ++# Request a POSIX compliant getopt function. ++AC_DEFUN([gl_FUNC_GETOPT_POSIX], ++[ ++ m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX]) ++ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) ++ dnl Other modules can request the gnulib implementation of the getopt ++ dnl functions unconditionally, by defining gl_REPLACE_GETOPT_ALWAYS. ++ dnl argp.m4 does this. ++ m4_ifdef([gl_REPLACE_GETOPT_ALWAYS], [ ++ gl_GETOPT_IFELSE([], []) ++ REPLACE_GETOPT=1 ++ ], [ ++ REPLACE_GETOPT=0 ++ gl_GETOPT_IFELSE([ ++ REPLACE_GETOPT=1 ++ ], ++ []) ++ ]) ++ if test $REPLACE_GETOPT = 1; then ++ dnl Arrange for getopt.h to be created. ++ gl_GETOPT_SUBSTITUTE_HEADER ++ fi ++]) + +-AC_DEFUN([gl_GETOPT_SUBSTITUTE], ++# Request a POSIX compliant getopt function with GNU extensions (such as ++# options with optional arguments) and the functions getopt_long, ++# getopt_long_only. ++AC_DEFUN([gl_FUNC_GETOPT_GNU], + [ +- AC_LIBOBJ([getopt]) +- AC_LIBOBJ([getopt1]) +- gl_GETOPT_SUBSTITUTE_HEADER +- gl_PREREQ_GETOPT ++ m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU]) ++ ++ AC_REQUIRE([gl_FUNC_GETOPT_POSIX]) + ]) + +-AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], ++# emacs' configure.in uses this. ++AC_DEFUN([gl_GETOPT_IFELSE], + [ +- GETOPT_H=getopt.h +- AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], +- [Define to rpl_ if the getopt replacement functions and variables +- should be used.]) +- AC_SUBST([GETOPT_H]) ++ AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) ++ AS_IF([test -n "$gl_replace_getopt"], [$1], [$2]) + ]) + ++# Determine whether to replace the entire getopt facility. + AC_DEFUN([gl_GETOPT_CHECK_HEADERS], + [ +- if test -z "$GETOPT_H"; then +- AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_REQUIRE([AC_PROG_AWK]) dnl for awk that supports ENVIRON ++ ++ dnl Persuade Solaris to declare optarg, optind, opterr, optopt. ++ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ++ ++ gl_CHECK_NEXT_HEADERS([getopt.h]) ++ if test $ac_cv_header_getopt_h = yes; then ++ HAVE_GETOPT_H=1 ++ else ++ HAVE_GETOPT_H=0 + fi ++ AC_SUBST([HAVE_GETOPT_H]) + +- if test -z "$GETOPT_H"; then +- AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) ++ gl_replace_getopt= ++ ++ dnl Test whether is available. ++ if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then ++ AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes]) ++ fi ++ ++ dnl Test whether the function getopt_long is available. ++ if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then ++ AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes]) + fi + +- dnl BSD getopt_long uses an incompatible method to reset option processing, +- dnl and (as of 2004-10-15) mishandles optional option-arguments. +- if test -z "$GETOPT_H"; then +- AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include ]) ++ dnl mingw's getopt (in libmingwex.a) does weird things when the options ++ dnl strings starts with '+' and it's not the first call. Some internal state ++ dnl is left over from earlier calls, and neither setting optind = 0 nor ++ dnl setting optreset = 1 get rid of this internal state. ++ dnl POSIX is silent on optind vs. optreset, so we allow either behavior. ++ dnl POSIX 2008 does not specify leading '+' behavior, but see ++ dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on ++ dnl the next version of POSIX. For now, we only guarantee leading '+' ++ dnl behavior with getopt-gnu. ++ if test -z "$gl_replace_getopt"; then ++ AC_CACHE_CHECK([whether getopt is POSIX compatible], ++ [gl_cv_func_getopt_posix], ++ [ ++ dnl BSD getopt_long uses an incompatible method to reset option ++ dnl processing. Existence of the optreset variable, in and of ++ dnl itself, is not a reason to replace getopt, but knowledge ++ dnl of the variable is needed to determine how to reset and ++ dnl whether a reset reparses the environment. Solaris ++ dnl supports neither optreset nor optind=0, but keeps no state ++ dnl that needs a reset beyond setting optind=1; detect Solaris ++ dnl by getopt_clip. ++ AC_LINK_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ]], ++ [[int *p = &optreset; return optreset;]])], ++ [gl_optind_min=1], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ]], ++ [[return !getopt_clip;]])], ++ [gl_optind_min=1], ++ [gl_optind_min=0])]) ++ ++ dnl This test fails on mingw and succeeds on many other platforms. ++ gl_save_CPPFLAGS=$CPPFLAGS ++ CPPFLAGS="$CPPFLAGS -DOPTIND_MIN=$gl_optind_min" ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++#include ++#include ++#include ++ ++int ++main () ++{ ++ { ++ static char program[] = "program"; ++ static char a[] = "-a"; ++ static char foo[] = "foo"; ++ static char bar[] = "bar"; ++ char *argv[] = { program, a, foo, bar, NULL }; ++ int c; ++ ++ optind = OPTIND_MIN; ++ opterr = 0; ++ ++ c = getopt (4, argv, "ab"); ++ if (!(c == 'a')) ++ return 1; ++ c = getopt (4, argv, "ab"); ++ if (!(c == -1)) ++ return 2; ++ if (!(optind == 2)) ++ return 3; ++ } ++ /* Some internal state exists at this point. */ ++ { ++ static char program[] = "program"; ++ static char donald[] = "donald"; ++ static char p[] = "-p"; ++ static char billy[] = "billy"; ++ static char duck[] = "duck"; ++ static char a[] = "-a"; ++ static char bar[] = "bar"; ++ char *argv[] = { program, donald, p, billy, duck, a, bar, NULL }; ++ int c; ++ ++ optind = OPTIND_MIN; ++ opterr = 0; ++ ++ c = getopt (7, argv, "+abp:q:"); ++ if (!(c == -1)) ++ return 4; ++ if (!(strcmp (argv[0], "program") == 0)) ++ return 5; ++ if (!(strcmp (argv[1], "donald") == 0)) ++ return 6; ++ if (!(strcmp (argv[2], "-p") == 0)) ++ return 7; ++ if (!(strcmp (argv[3], "billy") == 0)) ++ return 8; ++ if (!(strcmp (argv[4], "duck") == 0)) ++ return 9; ++ if (!(strcmp (argv[5], "-a") == 0)) ++ return 10; ++ if (!(strcmp (argv[6], "bar") == 0)) ++ return 11; ++ if (!(optind == 1)) ++ return 12; ++ } ++ /* Detect MacOS 10.5, AIX 7.1 bug. */ ++ { ++ static char program[] = "program"; ++ static char ab[] = "-ab"; ++ char *argv[3] = { program, ab, NULL }; ++ optind = OPTIND_MIN; ++ opterr = 0; ++ if (getopt (2, argv, "ab:") != 'a') ++ return 13; ++ if (getopt (2, argv, "ab:") != '?') ++ return 14; ++ if (optopt != 'b') ++ return 15; ++ if (optind != 2) ++ return 16; ++ } ++ ++ return 0; ++} ++]])], ++ [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no], ++ [case "$host_os" in ++ mingw*) gl_cv_func_getopt_posix="guessing no";; ++ darwin* | aix*) gl_cv_func_getopt_posix="guessing no";; ++ *) gl_cv_func_getopt_posix="guessing yes";; ++ esac ++ ]) ++ CPPFLAGS=$gl_save_CPPFLAGS ++ ]) ++ case "$gl_cv_func_getopt_posix" in ++ *no) gl_replace_getopt=yes ;; ++ esac + fi + +- dnl Solaris 10 getopt doesn't handle `+' as a leading character in an +- dnl option string (as of 2005-05-05). +- if test -z "$GETOPT_H"; then +- AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt], +- [AC_RUN_IFELSE( +- [AC_LANG_PROGRAM([#include ], +- [[ +- char *myargv[3]; +- myargv[0] = "conftest"; +- myargv[1] = "-+"; +- myargv[2] = 0; +- return getopt (2, myargv, "+a") != '?'; +- ]])], +- [gl_cv_func_gnu_getopt=yes], +- [gl_cv_func_gnu_getopt=no], +- [dnl cross compiling - pessimistically guess based on decls +- dnl Solaris 10 getopt doesn't handle `+' as a leading character in an +- dnl option string (as of 2005-05-05). +- AC_CHECK_DECL([getopt_clip], +- [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes], +- [#include ])])]) +- if test "$gl_cv_func_gnu_getopt" = "no"; then +- GETOPT_H=getopt.h ++ if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then ++ AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_getopt_gnu], ++ [# Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the ++ # optstring is necessary for programs like m4 that have POSIX-mandated ++ # semantics for supporting options interspersed with files. ++ # Also, since getopt_long is a GNU extension, we require optind=0. ++ # Bash ties 'set -o posix' to a non-exported POSIXLY_CORRECT; ++ # so take care to revert to the correct (non-)export state. ++dnl GNU Coding Standards currently allow awk but not env; besides, env ++dnl is ambiguous with environment values that contain newlines. ++ gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }' ++ case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" ++ #include ++ #include ++ ]GL_NOCRASH[ ++ ]], [[ ++ int result = 0; ++ ++ nocrash_init(); ++ ++ /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, ++ and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, ++ OSF/1 5.1, Solaris 10. */ ++ { ++ static char conftest[] = "conftest"; ++ static char plus[] = "-+"; ++ char *argv[3] = { conftest, plus, NULL }; ++ opterr = 0; ++ if (getopt (2, argv, "+a") != '?') ++ result |= 1; ++ } ++ /* This code succeeds on glibc 2.8, mingw, ++ and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, ++ IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ ++ { ++ static char program[] = "program"; ++ static char p[] = "-p"; ++ static char foo[] = "foo"; ++ static char bar[] = "bar"; ++ char *argv[] = { program, p, foo, bar, NULL }; ++ ++ optind = 1; ++ if (getopt (4, argv, "p::") != 'p') ++ result |= 2; ++ else if (optarg != NULL) ++ result |= 4; ++ else if (getopt (4, argv, "p::") != -1) ++ result |= 6; ++ else if (optind != 2) ++ result |= 8; ++ } ++ /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ ++ { ++ static char program[] = "program"; ++ static char foo[] = "foo"; ++ static char p[] = "-p"; ++ char *argv[] = { program, foo, p, NULL }; ++ optind = 0; ++ if (getopt (3, argv, "-p") != 1) ++ result |= 16; ++ else if (getopt (3, argv, "-p") != 'p') ++ result |= 32; ++ } ++ /* This code fails on glibc 2.11. */ ++ { ++ static char program[] = "program"; ++ static char b[] = "-b"; ++ static char a[] = "-a"; ++ char *argv[] = { program, b, a, NULL }; ++ optind = opterr = 0; ++ if (getopt (3, argv, "+:a:b") != 'b') ++ result |= 64; ++ else if (getopt (3, argv, "+:a:b") != ':') ++ result |= 64; ++ } ++ /* This code dumps core on glibc 2.14. */ ++ { ++ static char program[] = "program"; ++ static char w[] = "-W"; ++ static char dummy[] = "dummy"; ++ char *argv[] = { program, w, dummy, NULL }; ++ optind = opterr = 1; ++ if (getopt (3, argv, "W;") != 'W') ++ result |= 128; ++ } ++ return result; ++ ]])], ++ [gl_cv_func_getopt_gnu=yes], ++ [gl_cv_func_getopt_gnu=no], ++ [dnl Cross compiling. Guess based on host and declarations. ++ case $host_os:$ac_cv_have_decl_optreset in ++ *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;; ++ *:yes) gl_cv_func_getopt_gnu=no;; ++ *) gl_cv_func_getopt_gnu=yes;; ++ esac ++ ]) ++ case $gl_had_POSIXLY_CORRECT in ++ exported) ;; ++ yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;; ++ *) AS_UNSET([POSIXLY_CORRECT]) ;; ++ esac ++ ]) ++ if test "$gl_cv_func_getopt_gnu" = "no"; then ++ gl_replace_getopt=yes + fi + fi + ]) + +-AC_DEFUN([gl_GETOPT_IFELSE], ++# emacs' configure.in uses this. ++AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], + [ +- AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) +- AS_IF([test -n "$GETOPT_H"], [$1], [$2]) ++ GETOPT_H=getopt.h ++ AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], ++ [Define to rpl_ if the getopt replacement functions and variables ++ should be used.]) ++ AC_SUBST([GETOPT_H]) + ]) + +-AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])]) +- + # Prerequisites of lib/getopt*. ++# emacs' configure.in uses this. + AC_DEFUN([gl_PREREQ_GETOPT], + [ + AC_CHECK_DECLS_ONCE([getenv]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/gettimeofday.m4 b/xbmc/screensavers/rsxs-0.9/m4/gettimeofday.m4 +index 2fdc531..47c1e1d 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/gettimeofday.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/gettimeofday.m4 +@@ -1,12 +1,73 @@ +-#serial 7 ++# serial 17 + +-# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. ++# Copyright (C) 2001-2003, 2005, 2007, 2009-2011 Free Software Foundation, Inc. + # This file is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. + + dnl From Jim Meyering. +-dnl ++ ++AC_DEFUN([gl_FUNC_GETTIMEOFDAY], ++[ ++ AC_REQUIRE([AC_C_RESTRICT]) ++ AC_REQUIRE([gl_HEADER_SYS_TIME_H]) ++ AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) ++ AC_CHECK_FUNCS_ONCE([gettimeofday]) ++ ++ gl_gettimeofday_timezone=void ++ if test $ac_cv_func_gettimeofday != yes; then ++ HAVE_GETTIMEOFDAY=0 ++ else ++ gl_FUNC_GETTIMEOFDAY_CLOBBER ++ AC_CACHE_CHECK([for gettimeofday with POSIX signature], ++ [gl_cv_func_gettimeofday_posix_signature], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ++ struct timeval c; ++ int gettimeofday (struct timeval *restrict, void *restrict); ++ ]], ++ [[/* glibc uses struct timezone * rather than the POSIX void * ++ if _GNU_SOURCE is defined. However, since the only portable ++ use of gettimeofday uses NULL as the second parameter, and ++ since the glibc definition is actually more typesafe, it is ++ not worth wrapping this to get a compliant signature. */ ++ int (*f) (struct timeval *restrict, void *restrict) ++ = gettimeofday; ++ int x = f (&c, 0); ++ return !(x | c.tv_sec | c.tv_usec); ++ ]])], ++ [gl_cv_func_gettimeofday_posix_signature=yes], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ++int gettimeofday (struct timeval *restrict, struct timezone *restrict); ++ ]])], ++ [gl_cv_func_gettimeofday_posix_signature=almost], ++ [gl_cv_func_gettimeofday_posix_signature=no])])]) ++ if test $gl_cv_func_gettimeofday_posix_signature = almost; then ++ gl_gettimeofday_timezone='struct timezone' ++ elif test $gl_cv_func_gettimeofday_posix_signature != yes; then ++ REPLACE_GETTIMEOFDAY=1 ++ fi ++ m4_ifdef([gl_FUNC_TZSET_CLOBBER], [ ++ gl_FUNC_TZSET_CLOBBER ++ if test $gl_cv_func_tzset_clobber = yes; then ++ REPLACE_GETTIMEOFDAY=1 ++ gl_GETTIMEOFDAY_REPLACE_LOCALTIME ++ AC_DEFINE([tzset], [rpl_tzset], ++ [Define to rpl_tzset if the wrapper function should be used.]) ++ AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1], ++ [Define if tzset clobbers localtime's static buffer.]) ++ fi ++ ]) ++ fi ++ AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone], ++ [Define this to 'void' or 'struct timezone' to match the system's ++ declaration of the second argument to gettimeofday.]) ++]) ++ ++ + dnl See if gettimeofday clobbers the static buffer that localtime uses + dnl for its return value. The gettimeofday function from Mac OS X 10.0.4 + dnl (i.e., Darwin 1.3.7) has this problem. +@@ -14,67 +75,51 @@ dnl + dnl If it does, then arrange to use gettimeofday and localtime only via + dnl the wrapper functions that work around the problem. + +-AC_DEFUN([AC_FUNC_GETTIMEOFDAY_CLOBBER], ++AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER], + [ +- AC_REQUIRE([AC_HEADER_TIME]) +- AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer], +- jm_cv_func_gettimeofday_clobber, +- [AC_TRY_RUN([ +-#include +-#include +- +-#if TIME_WITH_SYS_TIME +-# include +-# include +-#else +-# if HAVE_SYS_TIME_H +-# include +-# else +-# include +-# endif +-#endif +- +-#include ++ AC_REQUIRE([gl_HEADER_SYS_TIME_H]) + +-int +-main () +-{ +- time_t t = 0; +- struct tm *lt; +- struct tm saved_lt; +- struct timeval tv; +- lt = localtime (&t); +- saved_lt = *lt; +- gettimeofday (&tv, NULL); +- if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0) +- exit (1); +- +- exit (0); +-} +- ], +- jm_cv_func_gettimeofday_clobber=no, +- jm_cv_func_gettimeofday_clobber=yes, +- dnl When crosscompiling, assume it is broken. +- jm_cv_func_gettimeofday_clobber=yes) +- ]) +- if test $jm_cv_func_gettimeofday_clobber = yes; then +- gl_GETTIMEOFDAY_REPLACE_LOCALTIME ++ AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer], ++ [gl_cv_func_gettimeofday_clobber], ++ [AC_RUN_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ++ #include ++ #include ++ #include ++ ]], ++ [[ ++ time_t t = 0; ++ struct tm *lt; ++ struct tm saved_lt; ++ struct timeval tv; ++ lt = localtime (&t); ++ saved_lt = *lt; ++ gettimeofday (&tv, NULL); ++ return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0; ++ ]])], ++ [gl_cv_func_gettimeofday_clobber=no], ++ [gl_cv_func_gettimeofday_clobber=yes], ++ dnl When crosscompiling, assume it is broken. ++ [gl_cv_func_gettimeofday_clobber=yes])]) + +- AC_DEFINE(gettimeofday, rpl_gettimeofday, +- [Define to rpl_gettimeofday if the replacement function should be used.]) +- gl_PREREQ_GETTIMEOFDAY +- fi ++ if test $gl_cv_func_gettimeofday_clobber = yes; then ++ REPLACE_GETTIMEOFDAY=1 ++ gl_GETTIMEOFDAY_REPLACE_LOCALTIME ++ AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1], ++ [Define if gettimeofday clobbers the localtime buffer.]) ++ fi + ]) + + AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [ +- AC_LIBOBJ(gettimeofday) +- AC_DEFINE(gmtime, rpl_gmtime, ++ AC_DEFINE([gmtime], [rpl_gmtime], + [Define to rpl_gmtime if the replacement function should be used.]) +- AC_DEFINE(localtime, rpl_localtime, ++ AC_DEFINE([localtime], [rpl_localtime], + [Define to rpl_localtime if the replacement function should be used.]) + ]) + + # Prerequisites of lib/gettimeofday.c. + AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [ +- AC_REQUIRE([AC_HEADER_TIME]) ++ AC_CHECK_HEADERS([sys/timeb.h]) ++ AC_CHECK_FUNCS([_ftime]) + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/gnulib-cache.m4 b/xbmc/screensavers/rsxs-0.9/m4/gnulib-cache.m4 +new file mode 100644 +index 0000000..f483a38 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/gnulib-cache.m4 +@@ -0,0 +1,50 @@ ++# Copyright (C) 2002-2011 Free Software Foundation, Inc. ++# ++# This file is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This file is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this file. If not, see . ++# ++# As a special exception to the GNU General Public License, ++# this file may be distributed as part of a program that ++# contains a configuration script generated by Autoconf, under ++# the same distribution terms as the rest of that program. ++# ++# Generated by gnulib-tool. ++# ++# This file represents the specification of how gnulib-tool is used. ++# It acts as a cache: It is written and read by gnulib-tool. ++# In projects that use version control, this file is meant to be put under ++# version control, like the configure.ac and various Makefile.am files. ++ ++ ++# Specification in the form of a command-line invocation: ++# gnulib-tool --import --dir=. --lib=libmisc --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl argp argz gettimeofday unistd ++ ++# Specification in the form of a few gnulib-tool.m4 macro invocations: ++gl_LOCAL_DIR([]) ++gl_MODULES([ ++ argp ++ argz ++ gettimeofday ++ unistd ++]) ++gl_AVOID([]) ++gl_SOURCE_BASE([lib]) ++gl_M4_BASE([m4]) ++gl_PO_BASE([]) ++gl_DOC_BASE([doc]) ++gl_TESTS_BASE([tests]) ++gl_LIB([libmisc]) ++gl_MAKEFILE_NAME([]) ++gl_MACRO_PREFIX([gl]) ++gl_PO_DOMAIN([]) ++gl_WITNESS_C_DOMAIN([]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/gnulib-common.m4 b/xbmc/screensavers/rsxs-0.9/m4/gnulib-common.m4 +new file mode 100644 +index 0000000..8621dec +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/gnulib-common.m4 +@@ -0,0 +1,372 @@ ++# gnulib-common.m4 serial 31 ++dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++# gl_COMMON ++# is expanded unconditionally through gnulib-tool magic. ++AC_DEFUN([gl_COMMON], [ ++ dnl Use AC_REQUIRE here, so that the code is expanded once only. ++ AC_REQUIRE([gl_00GNULIB]) ++ AC_REQUIRE([gl_COMMON_BODY]) ++]) ++AC_DEFUN([gl_COMMON_BODY], [ ++ AH_VERBATIM([_Noreturn], ++[/* The _Noreturn keyword of draft C1X. */ ++#ifndef _Noreturn ++# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ ++ || 0x5110 <= __SUNPRO_C) ++# define _Noreturn __attribute__ ((__noreturn__)) ++# elif defined _MSC_VER && 1200 <= _MSC_VER ++# define _Noreturn __declspec (noreturn) ++# else ++# define _Noreturn ++# endif ++#endif ++]) ++ AH_VERBATIM([isoc99_inline], ++[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports ++ the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of ++ earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. ++ __APPLE__ && __MACH__ test for MacOS X. ++ __APPLE_CC__ tests for the Apple compiler and its version. ++ __STDC_VERSION__ tests for the C99 mode. */ ++#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ ++# define __GNUC_STDC_INLINE__ 1 ++#endif]) ++ AH_VERBATIM([unused_parameter], ++[/* Define as a marker that can be attached to declarations that might not ++ be used. This helps to reduce warnings, such as from ++ GCC -Wunused-parameter. */ ++#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) ++# define _GL_UNUSED __attribute__ ((__unused__)) ++#else ++# define _GL_UNUSED ++#endif ++/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name ++ is a misnomer outside of parameter lists. */ ++#define _UNUSED_PARAMETER_ _GL_UNUSED ++ ++/* The __pure__ attribute was added in gcc 2.96. */ ++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) ++# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) ++#else ++# define _GL_ATTRIBUTE_PURE /* empty */ ++#endif ++ ++/* The __const__ attribute was added in gcc 2.95. */ ++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) ++# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) ++#else ++# define _GL_ATTRIBUTE_CONST /* empty */ ++#endif ++]) ++ dnl Preparation for running test programs: ++ dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not ++ dnl to /dev/tty, so they can be redirected to log files. Such diagnostics ++ dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N. ++ LIBC_FATAL_STDERR_=1 ++ export LIBC_FATAL_STDERR_ ++]) ++ ++# gl_MODULE_INDICATOR_CONDITION ++# expands to a C preprocessor expression that evaluates to 1 or 0, depending ++# whether a gnulib module that has been requested shall be considered present ++# or not. ++m4_define([gl_MODULE_INDICATOR_CONDITION], [1]) ++ ++# gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) ++# sets the shell variable that indicates the presence of the given module to ++# a C preprocessor expression that will evaluate to 1. ++AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], ++[ ++ gl_MODULE_INDICATOR_SET_VARIABLE_AUX( ++ [GNULIB_[]m4_translit([[$1]], ++ [abcdefghijklmnopqrstuvwxyz./-], ++ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], ++ [gl_MODULE_INDICATOR_CONDITION]) ++]) ++ ++# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable]) ++# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION. ++# The shell variable's value is a C preprocessor expression that evaluates ++# to 0 or 1. ++AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX], ++[ ++ m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1], ++ [ ++ dnl Simplify the expression VALUE || 1 to 1. ++ $1=1 ++ ], ++ [gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1], ++ [gl_MODULE_INDICATOR_CONDITION])]) ++]) ++ ++# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition]) ++# modifies the shell variable to include the given condition. The shell ++# variable's value is a C preprocessor expression that evaluates to 0 or 1. ++AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR], ++[ ++ dnl Simplify the expression 1 || CONDITION to 1. ++ if test "$[]$1" != 1; then ++ dnl Simplify the expression 0 || CONDITION to CONDITION. ++ if test "$[]$1" = 0; then ++ $1=$2 ++ else ++ $1="($[]$1 || $2)" ++ fi ++ fi ++]) ++ ++# gl_MODULE_INDICATOR([modulename]) ++# defines a C macro indicating the presence of the given module ++# in a location where it can be used. ++# | Value | Value | ++# | in lib/ | in tests/ | ++# --------------------------------------------+---------+-----------+ ++# Module present among main modules: | 1 | 1 | ++# --------------------------------------------+---------+-----------+ ++# Module present among tests-related modules: | 0 | 1 | ++# --------------------------------------------+---------+-----------+ ++# Module not present at all: | 0 | 0 | ++# --------------------------------------------+---------+-----------+ ++AC_DEFUN([gl_MODULE_INDICATOR], ++[ ++ AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]], ++ [abcdefghijklmnopqrstuvwxyz./-], ++ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), ++ [gl_MODULE_INDICATOR_CONDITION], ++ [Define to a C preprocessor expression that evaluates to 1 or 0, ++ depending whether the gnulib module $1 shall be considered present.]) ++]) ++ ++# gl_MODULE_INDICATOR_FOR_TESTS([modulename]) ++# defines a C macro indicating the presence of the given module ++# in lib or tests. This is useful to determine whether the module ++# should be tested. ++# | Value | Value | ++# | in lib/ | in tests/ | ++# --------------------------------------------+---------+-----------+ ++# Module present among main modules: | 1 | 1 | ++# --------------------------------------------+---------+-----------+ ++# Module present among tests-related modules: | 1 | 1 | ++# --------------------------------------------+---------+-----------+ ++# Module not present at all: | 0 | 0 | ++# --------------------------------------------+---------+-----------+ ++AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], ++[ ++ AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]], ++ [abcdefghijklmnopqrstuvwxyz./-], ++ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], ++ [Define to 1 when the gnulib module $1 should be tested.]) ++]) ++ ++# gl_ASSERT_NO_GNULIB_POSIXCHECK ++# asserts that there will never be a need to #define GNULIB_POSIXCHECK. ++# and thereby enables an optimization of configure and config.h. ++# Used by Emacs. ++AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK], ++[ ++ dnl Override gl_WARN_ON_USE_PREPARE. ++ dnl But hide this definition from 'aclocal'. ++ AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], []) ++]) ++ ++# gl_ASSERT_NO_GNULIB_TESTS ++# asserts that there will be no gnulib tests in the scope of the configure.ac ++# and thereby enables an optimization of config.h. ++# Used by Emacs. ++AC_DEFUN([gl_ASSERT_NO_GNULIB_TESTS], ++[ ++ dnl Override gl_MODULE_INDICATOR_FOR_TESTS. ++ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], []) ++]) ++ ++# Test whether exists. ++# Set HAVE_FEATURES_H. ++AC_DEFUN([gl_FEATURES_H], ++[ ++ AC_CHECK_HEADERS_ONCE([features.h]) ++ if test $ac_cv_header_features_h = yes; then ++ HAVE_FEATURES_H=1 ++ else ++ HAVE_FEATURES_H=0 ++ fi ++ AC_SUBST([HAVE_FEATURES_H]) ++]) ++ ++# m4_foreach_w ++# is a backport of autoconf-2.59c's m4_foreach_w. ++# Remove this macro when we can assume autoconf >= 2.60. ++m4_ifndef([m4_foreach_w], ++ [m4_define([m4_foreach_w], ++ [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) ++ ++# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) ++# ---------------------------------------------------- ++# Backport of autoconf-2.63b's macro. ++# Remove this macro when we can assume autoconf >= 2.64. ++m4_ifndef([AS_VAR_IF], ++[m4_define([AS_VAR_IF], ++[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) ++ ++# gl_PROG_CC_C99 ++# Modifies the value of the shell variable CC in an attempt to make $CC ++# understand ISO C99 source code. ++# This is like AC_PROG_CC_C99, except that ++# - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60, ++# - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC ++# , ++# but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99 ++# . ++# Remaining problems: ++# - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options ++# to CC twice ++# . ++# - AC_PROG_CC_STDC is likely to change when C1X is an ISO standard. ++AC_DEFUN([gl_PROG_CC_C99], ++[ ++ dnl Change that version number to the minimum Autoconf version that supports ++ dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls. ++ m4_version_prereq([9.0], ++ [AC_REQUIRE([AC_PROG_CC_C99])], ++ [AC_REQUIRE([AC_PROG_CC_STDC])]) ++]) ++ ++# gl_PROG_AR_RANLIB ++# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler. ++# The user can set the variables AR, ARFLAGS, RANLIB if he wants to override ++# the values. ++AC_DEFUN([gl_PROG_AR_RANLIB], ++[ ++ dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler ++ dnl as "cc", and GCC as "gcc". They have different object file formats and ++ dnl library formats. In particular, the GNU binutils programs ar, ranlib ++ dnl produce libraries that work only with gcc, not with cc. ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler], ++ [ ++ AC_EGREP_CPP([Amsterdam], ++ [ ++#ifdef __ACK__ ++Amsterdam ++#endif ++ ], ++ [gl_cv_c_amsterdam_compiler=yes], ++ [gl_cv_c_amsterdam_compiler=no]) ++ ]) ++ if test -z "$AR"; then ++ if test $gl_cv_c_amsterdam_compiler = yes; then ++ AR='cc -c.a' ++ if test -z "$ARFLAGS"; then ++ ARFLAGS='-o' ++ fi ++ else ++ dnl Use the Automake-documented default values for AR and ARFLAGS, ++ dnl but prefer ${host}-ar over ar (useful for cross-compiling). ++ AC_CHECK_TOOL([AR], [ar], [ar]) ++ if test -z "$ARFLAGS"; then ++ ARFLAGS='cru' ++ fi ++ fi ++ else ++ if test -z "$ARFLAGS"; then ++ ARFLAGS='cru' ++ fi ++ fi ++ AC_SUBST([AR]) ++ AC_SUBST([ARFLAGS]) ++ if test -z "$RANLIB"; then ++ if test $gl_cv_c_amsterdam_compiler = yes; then ++ RANLIB=':' ++ else ++ dnl Use the ranlib program if it is available. ++ AC_PROG_RANLIB ++ fi ++ fi ++ AC_SUBST([RANLIB]) ++]) ++ ++# AC_PROG_MKDIR_P ++# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix ++# for interoperability with automake-1.9.6 from autoconf-2.62. ++# Remove this macro when we can assume autoconf >= 2.62 or ++# autoconf >= 2.60 && automake >= 1.10. ++m4_ifdef([AC_PROG_MKDIR_P], [ ++ dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. ++ m4_define([AC_PROG_MKDIR_P], ++ m4_defn([AC_PROG_MKDIR_P])[ ++ AC_SUBST([MKDIR_P])])], [ ++ dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P. ++ AC_DEFUN_ONCE([AC_PROG_MKDIR_P], ++ [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake ++ MKDIR_P='$(mkdir_p)' ++ AC_SUBST([MKDIR_P])])]) ++ ++# AC_C_RESTRICT ++# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, ++# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ ++# works. ++# This definition can be removed once autoconf >= 2.62 can be assumed. ++m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1],[ ++AC_DEFUN([AC_C_RESTRICT], ++[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], ++ [ac_cv_c_restrict=no ++ # The order here caters to the fact that C++ does not require restrict. ++ for ac_kw in __restrict __restrict__ _Restrict restrict; do ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( ++ [[typedef int * int_ptr; ++ int foo (int_ptr $ac_kw ip) { ++ return ip[0]; ++ }]], ++ [[int s[1]; ++ int * $ac_kw t = s; ++ t[0] = 0; ++ return foo(t)]])], ++ [ac_cv_c_restrict=$ac_kw]) ++ test "$ac_cv_c_restrict" != no && break ++ done ++ ]) ++ AH_VERBATIM([restrict], ++[/* Define to the equivalent of the C99 'restrict' keyword, or to ++ nothing if this is not supported. Do not define if restrict is ++ supported directly. */ ++#undef restrict ++/* Work around a bug in Sun C++: it does not support _Restrict, even ++ though the corresponding Sun C compiler does, which causes ++ "#define restrict _Restrict" in the previous line. Perhaps some future ++ version of Sun C++ will work with _Restrict; if so, it'll probably ++ define __RESTRICT, just as Sun C does. */ ++#if defined __SUNPRO_CC && !defined __RESTRICT ++# define _Restrict ++#endif]) ++ case $ac_cv_c_restrict in ++ restrict) ;; ++ no) AC_DEFINE([restrict], []) ;; ++ *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; ++ esac ++]) ++]) ++ ++# gl_BIGENDIAN ++# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. ++# Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some ++# macros invoke AC_C_BIGENDIAN with arguments. ++AC_DEFUN([gl_BIGENDIAN], ++[ ++ AC_C_BIGENDIAN ++]) ++ ++# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) ++# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not ++# output a spurious "(cached)" mark in the midst of other configure output. ++# This macro should be used instead of AC_CACHE_VAL when it is not surrounded ++# by an AC_MSG_CHECKING/AC_MSG_RESULT pair. ++AC_DEFUN([gl_CACHE_VAL_SILENT], ++[ ++ saved_as_echo_n="$as_echo_n" ++ as_echo_n=':' ++ AC_CACHE_VAL([$1], [$2]) ++ as_echo_n="$saved_as_echo_n" ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/gnulib-comp.m4 b/xbmc/screensavers/rsxs-0.9/m4/gnulib-comp.m4 +index 4cc853d..dda4c6e 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/gnulib-comp.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/gnulib-comp.m4 +@@ -1,9 +1,22 @@ +-# Copyright (C) 2004-2006 Free Software Foundation, Inc. ++# DO NOT EDIT! GENERATED AUTOMATICALLY! ++# Copyright (C) 2002-2011 Free Software Foundation, Inc. + # +-# This file is free software, distributed under the terms of the GNU +-# General Public License. As a special exception to the GNU General +-# Public License, this file may be distributed as part of a program +-# that contains a configuration script generated by Autoconf, under ++# This file is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This file is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this file. If not, see . ++# ++# As a special exception to the GNU General Public License, ++# this file may be distributed as part of a program that ++# contains a configuration script generated by Autoconf, under + # the same distribution terms as the rest of that program. + # + # Generated by gnulib-tool. +@@ -11,7 +24,8 @@ + # This file represents the compiled summary of the specification in + # gnulib-cache.m4. It lists the computed macro invocations that need + # to be invoked from configure.ac. +-# In projects using CVS, this file can be treated like other built files. ++# In projects that use version control, this file can be treated like ++# other built files. + + + # This macro should be invoked from ./configure.ac, in the section +@@ -19,9 +33,68 @@ + # any checks for libraries, header files, types and library functions. + AC_DEFUN([gl_EARLY], + [ +- AC_REQUIRE([AC_PROG_RANLIB]) +- AC_REQUIRE([AC_GNU_SOURCE]) ++ m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace ++ m4_pattern_allow([^gl_ES$])dnl a valid locale name ++ m4_pattern_allow([^gl_LIBOBJS$])dnl a variable ++ m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable ++ AC_REQUIRE([gl_PROG_AR_RANLIB]) ++ # Code from module alloca: ++ # Code from module alloca-opt: ++ # Code from module argp: ++ # Code from module argz: ++ # Code from module dirname-lgpl: ++ # Code from module dosname: ++ # Code from module double-slash-root: ++ # Code from module errno: ++ # Code from module extensions: + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) ++ # Code from module float: ++ # Code from module getopt-gnu: ++ # Code from module getopt-posix: ++ # Code from module gettext-h: ++ # Code from module gettimeofday: ++ # Code from module include_next: ++ # Code from module intprops: ++ # Code from module malloc-gnu: ++ # Code from module malloc-posix: ++ # Code from module memchr: ++ # Code from module mempcpy: ++ # Code from module multiarch: ++ # Code from module nocrash: ++ # Code from module rawmemchr: ++ # Code from module size_max: ++ # Code from module sleep: ++ # Code from module snippet/_Noreturn: ++ # Code from module snippet/arg-nonnull: ++ # Code from module snippet/c++defs: ++ # Code from module snippet/warn-on-use: ++ # Code from module ssize_t: ++ # Code from module stdalign: ++ # Code from module stdbool: ++ # Code from module stddef: ++ # Code from module stdint: ++ # Code from module stdio: ++ # Code from module stdlib: ++ # Code from module stpcpy: ++ # Code from module strcase: ++ # Code from module strchrnul: ++ # Code from module strerror: ++ # Code from module strerror-override: ++ # Code from module string: ++ # Code from module strings: ++ # Code from module strndup: ++ # Code from module strnlen: ++ # Code from module strstr: ++ # Code from module strstr-simple: ++ # Code from module sys_time: ++ # Code from module sys_types: ++ # Code from module sysexits: ++ # Code from module unistd: ++ # Code from module vasnprintf: ++ # Code from module verify: ++ # Code from module vsnprintf: ++ # Code from module wchar: ++ # Code from module xsize: + ]) + + # This macro should be invoked from ./configure.ac, in the section +@@ -29,42 +102,317 @@ AC_DEFUN([gl_EARLY], + AC_DEFUN([gl_INIT], + [ + AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) +- gl_FUNC_ALLOCA +- gl_ARGP +- gl_FUNC_ARGZ +- gl_DIRNAME +- gl_ERROR +- gl_EXITFAIL +- dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac. +- gl_GETOPT +- AC_FUNC_GETTIMEOFDAY_CLOBBER +- gl_MBCHAR +- gl_MBITER +- gl_FUNC_MEMCHR +- gl_FUNC_MEMPCPY +- gl_MINMAX +- gl_C_RESTRICT +- gl_SIZE_MAX +- AM_STDBOOL_H +- gl_STRCASE +- gl_FUNC_STRCHRNUL +- gl_FUNC_STRNDUP +- gl_FUNC_STRNLEN +- gl_SYSEXITS +- gl_HEADER_UNISTD +- gl_FUNC_VASNPRINTF +- gl_FUNC_VSNPRINTF +- gl_FUNC_WCWIDTH +- gl_XALLOC +- gl_XSIZE +- gl_XSTRNDUP ++ gl_cond_libtool=false ++ gl_libdeps= ++ gl_ltlibdeps= ++ gl_m4_base='m4' ++ m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) ++ m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) ++ m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) ++ m4_pushdef([gl_LIBSOURCES_LIST], []) ++ m4_pushdef([gl_LIBSOURCES_DIR], []) ++ gl_COMMON ++ gl_source_base='lib' ++gl_FUNC_ALLOCA ++gl_ARGP ++m4_ifdef([AM_XGETTEXT_OPTION], ++ [AM_][XGETTEXT_OPTION([--flag=argp_error:2:c-format]) ++ AM_][XGETTEXT_OPTION([--flag=argp_failure:4:c-format])]) ++gl_FUNC_ARGZ ++if test -n "$ARGZ_H"; then ++ AC_LIBOBJ([argz]) ++fi ++gl_DIRNAME_LGPL ++gl_DOUBLE_SLASH_ROOT ++gl_HEADER_ERRNO_H ++gl_FLOAT_H ++if test $REPLACE_FLOAT_LDBL = 1; then ++ AC_LIBOBJ([float]) ++fi ++if test $REPLACE_ITOLD = 1; then ++ AC_LIBOBJ([itold]) ++fi ++gl_FUNC_GETOPT_GNU ++if test $REPLACE_GETOPT = 1; then ++ AC_LIBOBJ([getopt]) ++ AC_LIBOBJ([getopt1]) ++ gl_PREREQ_GETOPT ++ dnl Arrange for unistd.h to include getopt.h. ++ GNULIB_GL_UNISTD_H_GETOPT=1 ++fi ++AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT]) ++gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu]) ++gl_FUNC_GETOPT_POSIX ++if test $REPLACE_GETOPT = 1; then ++ AC_LIBOBJ([getopt]) ++ AC_LIBOBJ([getopt1]) ++ gl_PREREQ_GETOPT ++ dnl Arrange for unistd.h to include getopt.h. ++ GNULIB_GL_UNISTD_H_GETOPT=1 ++fi ++AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT]) ++AC_SUBST([LIBINTL]) ++AC_SUBST([LTLIBINTL]) ++gl_FUNC_GETTIMEOFDAY ++if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then ++ AC_LIBOBJ([gettimeofday]) ++ gl_PREREQ_GETTIMEOFDAY ++fi ++gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) ++gl_FUNC_MALLOC_GNU ++if test $REPLACE_MALLOC = 1; then ++ AC_LIBOBJ([malloc]) ++fi ++gl_MODULE_INDICATOR([malloc-gnu]) ++gl_FUNC_MALLOC_POSIX ++if test $REPLACE_MALLOC = 1; then ++ AC_LIBOBJ([malloc]) ++fi ++gl_STDLIB_MODULE_INDICATOR([malloc-posix]) ++gl_FUNC_MEMCHR ++if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then ++ AC_LIBOBJ([memchr]) ++ gl_PREREQ_MEMCHR ++fi ++gl_STRING_MODULE_INDICATOR([memchr]) ++gl_FUNC_MEMPCPY ++if test $HAVE_MEMPCPY = 0; then ++ AC_LIBOBJ([mempcpy]) ++ gl_PREREQ_MEMPCPY ++fi ++gl_STRING_MODULE_INDICATOR([mempcpy]) ++gl_MULTIARCH ++gl_FUNC_RAWMEMCHR ++if test $HAVE_RAWMEMCHR = 0; then ++ AC_LIBOBJ([rawmemchr]) ++ gl_PREREQ_RAWMEMCHR ++fi ++gl_STRING_MODULE_INDICATOR([rawmemchr]) ++gl_SIZE_MAX ++gl_FUNC_SLEEP ++if test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1; then ++ AC_LIBOBJ([sleep]) ++fi ++gl_UNISTD_MODULE_INDICATOR([sleep]) ++gt_TYPE_SSIZE_T ++gl_STDALIGN_H ++AM_STDBOOL_H ++gl_STDDEF_H ++gl_STDINT_H ++gl_STDIO_H ++gl_STDLIB_H ++gl_FUNC_STPCPY ++if test $HAVE_STPCPY = 0; then ++ AC_LIBOBJ([stpcpy]) ++ gl_PREREQ_STPCPY ++fi ++gl_STRING_MODULE_INDICATOR([stpcpy]) ++gl_STRCASE ++if test $HAVE_STRCASECMP = 0; then ++ AC_LIBOBJ([strcasecmp]) ++ gl_PREREQ_STRCASECMP ++fi ++if test $HAVE_STRNCASECMP = 0; then ++ AC_LIBOBJ([strncasecmp]) ++ gl_PREREQ_STRNCASECMP ++fi ++gl_FUNC_STRCHRNUL ++if test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1; then ++ AC_LIBOBJ([strchrnul]) ++ gl_PREREQ_STRCHRNUL ++fi ++gl_STRING_MODULE_INDICATOR([strchrnul]) ++gl_FUNC_STRERROR ++if test $REPLACE_STRERROR = 1; then ++ AC_LIBOBJ([strerror]) ++fi ++gl_MODULE_INDICATOR([strerror]) ++gl_STRING_MODULE_INDICATOR([strerror]) ++AC_REQUIRE([gl_HEADER_ERRNO_H]) ++AC_REQUIRE([gl_FUNC_STRERROR_0]) ++if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then ++ AC_LIBOBJ([strerror-override]) ++ gl_PREREQ_SYS_H_WINSOCK2 ++fi ++gl_HEADER_STRING_H ++gl_HEADER_STRINGS_H ++gl_FUNC_STRNDUP ++if test $HAVE_STRNDUP = 0 || test $REPLACE_STRNDUP = 1; then ++ AC_LIBOBJ([strndup]) ++fi ++gl_STRING_MODULE_INDICATOR([strndup]) ++gl_FUNC_STRNLEN ++if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then ++ AC_LIBOBJ([strnlen]) ++ gl_PREREQ_STRNLEN ++fi ++gl_STRING_MODULE_INDICATOR([strnlen]) ++gl_FUNC_STRSTR ++if test $REPLACE_STRSTR = 1; then ++ AC_LIBOBJ([strstr]) ++fi ++gl_FUNC_STRSTR_SIMPLE ++if test $REPLACE_STRSTR = 1; then ++ AC_LIBOBJ([strstr]) ++fi ++gl_STRING_MODULE_INDICATOR([strstr]) ++gl_HEADER_SYS_TIME_H ++AC_PROG_MKDIR_P ++gl_SYS_TYPES_H ++AC_PROG_MKDIR_P ++gl_SYSEXITS ++gl_UNISTD_H ++gl_FUNC_VASNPRINTF ++gl_FUNC_VSNPRINTF ++gl_STDIO_MODULE_INDICATOR([vsnprintf]) ++gl_WCHAR_H ++gl_XSIZE ++ # End of code from modules ++ m4_ifval(gl_LIBSOURCES_LIST, [ ++ m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || ++ for gl_file in ]gl_LIBSOURCES_LIST[ ; do ++ if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then ++ echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2 ++ exit 1 ++ fi ++ done])dnl ++ m4_if(m4_sysval, [0], [], ++ [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ++ ]) ++ m4_popdef([gl_LIBSOURCES_DIR]) ++ m4_popdef([gl_LIBSOURCES_LIST]) ++ m4_popdef([AC_LIBSOURCES]) ++ m4_popdef([AC_REPLACE_FUNCS]) ++ m4_popdef([AC_LIBOBJ]) ++ AC_CONFIG_COMMANDS_PRE([ ++ gl_libobjs= ++ gl_ltlibobjs= ++ if test -n "$gl_LIBOBJS"; then ++ # Remove the extension. ++ sed_drop_objext='s/\.o$//;s/\.obj$//' ++ for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do ++ gl_libobjs="$gl_libobjs $i.$ac_objext" ++ gl_ltlibobjs="$gl_ltlibobjs $i.lo" ++ done ++ fi ++ AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) ++ AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) ++ ]) ++ gltests_libdeps= ++ gltests_ltlibdeps= ++ m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ])) ++ m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS])) ++ m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) ++ m4_pushdef([gltests_LIBSOURCES_LIST], []) ++ m4_pushdef([gltests_LIBSOURCES_DIR], []) ++ gl_COMMON ++ gl_source_base='tests' ++changequote(,)dnl ++ gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS ++changequote([, ])dnl ++ AC_SUBST([gltests_WITNESS]) ++ gl_module_indicator_condition=$gltests_WITNESS ++ m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) ++ m4_popdef([gl_MODULE_INDICATOR_CONDITION]) ++ m4_ifval(gltests_LIBSOURCES_LIST, [ ++ m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || ++ for gl_file in ]gltests_LIBSOURCES_LIST[ ; do ++ if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then ++ echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2 ++ exit 1 ++ fi ++ done])dnl ++ m4_if(m4_sysval, [0], [], ++ [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ++ ]) ++ m4_popdef([gltests_LIBSOURCES_DIR]) ++ m4_popdef([gltests_LIBSOURCES_LIST]) ++ m4_popdef([AC_LIBSOURCES]) ++ m4_popdef([AC_REPLACE_FUNCS]) ++ m4_popdef([AC_LIBOBJ]) ++ AC_CONFIG_COMMANDS_PRE([ ++ gltests_libobjs= ++ gltests_ltlibobjs= ++ if test -n "$gltests_LIBOBJS"; then ++ # Remove the extension. ++ sed_drop_objext='s/\.o$//;s/\.obj$//' ++ for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do ++ gltests_libobjs="$gltests_libobjs $i.$ac_objext" ++ gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" ++ done ++ fi ++ AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) ++ AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) ++ ]) ++ LIBMISC_LIBDEPS="$gl_libdeps" ++ AC_SUBST([LIBMISC_LIBDEPS]) ++ LIBMISC_LTLIBDEPS="$gl_ltlibdeps" ++ AC_SUBST([LIBMISC_LTLIBDEPS]) ++]) ++ ++# Like AC_LIBOBJ, except that the module name goes ++# into gl_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gl_LIBOBJ], [ ++ AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl ++ gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" ++]) ++ ++# Like AC_REPLACE_FUNCS, except that the module name goes ++# into gl_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gl_REPLACE_FUNCS], [ ++ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl ++ AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)]) ++]) ++ ++# Like AC_LIBSOURCES, except the directory where the source file is ++# expected is derived from the gnulib-tool parameterization, ++# and alloca is special cased (for the alloca-opt module). ++# We could also entirely rely on EXTRA_lib..._SOURCES. ++AC_DEFUN([gl_LIBSOURCES], [ ++ m4_foreach([_gl_NAME], [$1], [ ++ m4_if(_gl_NAME, [alloca.c], [], [ ++ m4_define([gl_LIBSOURCES_DIR], [lib]) ++ m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ]) ++ ]) ++ ]) ++]) ++ ++# Like AC_LIBOBJ, except that the module name goes ++# into gltests_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gltests_LIBOBJ], [ ++ AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl ++ gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext" ++]) ++ ++# Like AC_REPLACE_FUNCS, except that the module name goes ++# into gltests_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gltests_REPLACE_FUNCS], [ ++ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl ++ AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)]) ++]) ++ ++# Like AC_LIBSOURCES, except the directory where the source file is ++# expected is derived from the gnulib-tool parameterization, ++# and alloca is special cased (for the alloca-opt module). ++# We could also entirely rely on EXTRA_lib..._SOURCES. ++AC_DEFUN([gltests_LIBSOURCES], [ ++ m4_foreach([_gl_NAME], [$1], [ ++ m4_if(_gl_NAME, [alloca.c], [], [ ++ m4_define([gltests_LIBSOURCES_DIR], [tests]) ++ m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ]) ++ ]) ++ ]) + ]) + + # This macro records the list of files which have been installed by + # gnulib-tool and may be removed by future gnulib-tool invocations. + AC_DEFUN([gl_FILE_LIST], [ ++ build-aux/snippet/_Noreturn.h ++ build-aux/snippet/arg-nonnull.h ++ build-aux/snippet/c++defs.h ++ build-aux/snippet/warn-on-use.h + lib/alloca.c +- lib/alloca_.h ++ lib/alloca.in.h + lib/argp-ba.c + lib/argp-eexst.c + lib/argp-fmtstream.c +@@ -79,99 +427,123 @@ AC_DEFUN([gl_FILE_LIST], [ + lib/argp-xinl.c + lib/argp.h + lib/argz.c +- lib/argz_.h ++ lib/argz.in.h + lib/asnprintf.c +- lib/basename.c +- lib/dirname.c ++ lib/basename-lgpl.c ++ lib/dirname-lgpl.c + lib/dirname.h +- lib/error.c +- lib/error.h +- lib/exit.h +- lib/exitfail.c +- lib/exitfail.h ++ lib/dosname.h ++ lib/errno.in.h ++ lib/float+.h ++ lib/float.c ++ lib/float.in.h + lib/getopt.c ++ lib/getopt.in.h + lib/getopt1.c +- lib/getopt_.h + lib/getopt_int.h + lib/gettext.h + lib/gettimeofday.c +- lib/mbchar.c +- lib/mbchar.h +- lib/mbuiter.h ++ lib/intprops.h ++ lib/itold.c ++ lib/malloc.c + lib/memchr.c ++ lib/memchr.valgrind + lib/mempcpy.c +- lib/mempcpy.h +- lib/minmax.h + lib/printf-args.c + lib/printf-args.h + lib/printf-parse.c + lib/printf-parse.h ++ lib/rawmemchr.c ++ lib/rawmemchr.valgrind + lib/size_max.h +- lib/stdbool_.h +- lib/strcase.h ++ lib/sleep.c ++ lib/stdalign.in.h ++ lib/stdbool.in.h ++ lib/stddef.in.h ++ lib/stdint.in.h ++ lib/stdio.in.h ++ lib/stdlib.in.h ++ lib/stpcpy.c ++ lib/str-two-way.h + lib/strcasecmp.c + lib/strchrnul.c +- lib/strchrnul.h ++ lib/strchrnul.valgrind ++ lib/strerror-override.c ++ lib/strerror-override.h ++ lib/strerror.c ++ lib/string.in.h ++ lib/strings.in.h + lib/stripslash.c + lib/strncasecmp.c + lib/strndup.c +- lib/strndup.h + lib/strnlen.c +- lib/strnlen.h +- lib/strnlen1.c +- lib/strnlen1.h +- lib/sysexit_.h ++ lib/strstr.c ++ lib/sys_time.in.h ++ lib/sys_types.in.h ++ lib/sysexits.in.h ++ lib/unistd.in.h + lib/vasnprintf.c + lib/vasnprintf.h ++ lib/verify.h + lib/vsnprintf.c +- lib/vsnprintf.h +- lib/wcwidth.h +- lib/xalloc-die.c +- lib/xalloc.h +- lib/xmalloc.c ++ lib/wchar.in.h + lib/xsize.h +- lib/xstrndup.c +- lib/xstrndup.h ++ m4/00gnulib.m4 + m4/alloca.m4 + m4/argp.m4 + m4/argz.m4 + m4/dirname.m4 +- m4/dos.m4 + m4/double-slash-root.m4 +- m4/eoverflow.m4 +- m4/error.m4 +- m4/exitfail.m4 ++ m4/errno_h.m4 ++ m4/exponentd.m4 + m4/extensions.m4 ++ m4/float_h.m4 + m4/getopt.m4 + m4/gettimeofday.m4 ++ m4/gnulib-common.m4 ++ m4/include_next.m4 + m4/intmax_t.m4 + m4/inttypes_h.m4 +- m4/longdouble.m4 + m4/longlong.m4 +- m4/mbchar.m4 +- m4/mbiter.m4 +- m4/mbrtowc.m4 ++ m4/malloc.m4 ++ m4/math_h.m4 + m4/memchr.m4 + m4/mempcpy.m4 +- m4/minmax.m4 +- m4/restrict.m4 +- m4/signed.m4 ++ m4/mmap-anon.m4 ++ m4/multiarch.m4 ++ m4/nocrash.m4 ++ m4/onceonly.m4 ++ m4/printf.m4 ++ m4/rawmemchr.m4 + m4/size_max.m4 ++ m4/sleep.m4 ++ m4/ssize_t.m4 ++ m4/stdalign.m4 + m4/stdbool.m4 ++ m4/stddef_h.m4 ++ m4/stdint.m4 + m4/stdint_h.m4 ++ m4/stdio_h.m4 ++ m4/stdlib_h.m4 ++ m4/stpcpy.m4 + m4/strcase.m4 + m4/strchrnul.m4 +- m4/strerror_r.m4 ++ m4/strerror.m4 ++ m4/string_h.m4 ++ m4/strings_h.m4 + m4/strndup.m4 + m4/strnlen.m4 ++ m4/strstr.m4 ++ m4/sys_socket_h.m4 ++ m4/sys_time_h.m4 ++ m4/sys_types_h.m4 + m4/sysexits.m4 + m4/unistd_h.m4 + m4/vasnprintf.m4 + m4/vsnprintf.m4 ++ m4/warn-on-use.m4 ++ m4/wchar_h.m4 + m4/wchar_t.m4 +- m4/wcwidth.m4 + m4/wint_t.m4 +- m4/xalloc.m4 + m4/xsize.m4 +- m4/xstrndup.m4 + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/gnulib-tool.m4 b/xbmc/screensavers/rsxs-0.9/m4/gnulib-tool.m4 +new file mode 100644 +index 0000000..ed41e9d +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/gnulib-tool.m4 +@@ -0,0 +1,57 @@ ++# gnulib-tool.m4 serial 2 ++dnl Copyright (C) 2004-2005, 2009-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl The following macros need not be invoked explicitly. ++dnl Invoking them does nothing except to declare default arguments ++dnl for "gnulib-tool --import". ++ ++dnl Usage: gl_LOCAL_DIR([DIR]) ++AC_DEFUN([gl_LOCAL_DIR], []) ++ ++dnl Usage: gl_MODULES([module1 module2 ...]) ++AC_DEFUN([gl_MODULES], []) ++ ++dnl Usage: gl_AVOID([module1 module2 ...]) ++AC_DEFUN([gl_AVOID], []) ++ ++dnl Usage: gl_SOURCE_BASE([DIR]) ++AC_DEFUN([gl_SOURCE_BASE], []) ++ ++dnl Usage: gl_M4_BASE([DIR]) ++AC_DEFUN([gl_M4_BASE], []) ++ ++dnl Usage: gl_PO_BASE([DIR]) ++AC_DEFUN([gl_PO_BASE], []) ++ ++dnl Usage: gl_DOC_BASE([DIR]) ++AC_DEFUN([gl_DOC_BASE], []) ++ ++dnl Usage: gl_TESTS_BASE([DIR]) ++AC_DEFUN([gl_TESTS_BASE], []) ++ ++dnl Usage: gl_WITH_TESTS ++AC_DEFUN([gl_WITH_TESTS], []) ++ ++dnl Usage: gl_LIB([LIBNAME]) ++AC_DEFUN([gl_LIB], []) ++ ++dnl Usage: gl_LGPL or gl_LGPL([VERSION]) ++AC_DEFUN([gl_LGPL], []) ++ ++dnl Usage: gl_MAKEFILE_NAME([FILENAME]) ++AC_DEFUN([gl_MAKEFILE_NAME], []) ++ ++dnl Usage: gl_LIBTOOL ++AC_DEFUN([gl_LIBTOOL], []) ++ ++dnl Usage: gl_MACRO_PREFIX([PREFIX]) ++AC_DEFUN([gl_MACRO_PREFIX], []) ++ ++dnl Usage: gl_PO_DOMAIN([DOMAIN]) ++AC_DEFUN([gl_PO_DOMAIN], []) ++ ++dnl Usage: gl_VC_FILES([BOOLEAN]) ++AC_DEFUN([gl_VC_FILES], []) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/include_next.m4 b/xbmc/screensavers/rsxs-0.9/m4/include_next.m4 +new file mode 100644 +index 0000000..8a1fab6 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/include_next.m4 +@@ -0,0 +1,270 @@ ++# include_next.m4 serial 23 ++dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Paul Eggert and Derek Price. ++ ++dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER. ++dnl ++dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to ++dnl 'include' otherwise. ++dnl ++dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler ++dnl supports it in the special case that it is the first include directive in ++dnl the given file, or to 'include' otherwise. ++dnl ++dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next, ++dnl so as to avoid GCC warnings when the gcc option -pedantic is used. ++dnl '#pragma GCC system_header' has the same effect as if the file was found ++dnl through the include search path specified with '-isystem' options (as ++dnl opposed to the search path specified with '-I' options). Namely, gcc ++dnl does not warn about some things, and on some systems (Solaris and Interix) ++dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side ++dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead ++dnl of plain '__STDC__'. ++dnl ++dnl PRAGMA_COLUMNS can be used in files that override system header files, so ++dnl as to avoid compilation errors on HP NonStop systems when the gnulib file ++dnl is included by a system header file that does a "#pragma COLUMNS 80" (which ++dnl has the effect of truncating the lines of that file and all files that it ++dnl includes to 80 columns) and the gnulib file has lines longer than 80 ++dnl columns. ++ ++AC_DEFUN([gl_INCLUDE_NEXT], ++[ ++ AC_LANG_PREPROC_REQUIRE() ++ AC_CACHE_CHECK([whether the preprocessor supports include_next], ++ [gl_cv_have_include_next], ++ [rm -rf conftestd1a conftestd1b conftestd2 ++ mkdir conftestd1a conftestd1b conftestd2 ++ dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on ++ dnl AIX 6.1 support include_next when used as first preprocessor directive ++ dnl in a file, but not when preceded by another include directive. Check ++ dnl for this bug by including . ++ dnl Additionally, with this same compiler, include_next is a no-op when ++ dnl used in a header file that was included by specifying its absolute ++ dnl file name. Despite these two bugs, include_next is used in the ++ dnl compiler's . By virtue of the second bug, we need to use ++ dnl include_next as well in this case. ++ cat < conftestd1a/conftest.h ++#define DEFINED_IN_CONFTESTD1 ++#include_next ++#ifdef DEFINED_IN_CONFTESTD2 ++int foo; ++#else ++#error "include_next doesn't work" ++#endif ++EOF ++ cat < conftestd1b/conftest.h ++#define DEFINED_IN_CONFTESTD1 ++#include ++#include_next ++#ifdef DEFINED_IN_CONFTESTD2 ++int foo; ++#else ++#error "include_next doesn't work" ++#endif ++EOF ++ cat < conftestd2/conftest.h ++#ifndef DEFINED_IN_CONFTESTD1 ++#error "include_next test doesn't work" ++#endif ++#define DEFINED_IN_CONFTESTD2 ++EOF ++ gl_save_CPPFLAGS="$CPPFLAGS" ++ CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" ++dnl We intentionally avoid using AC_LANG_SOURCE here. ++ AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include ]], ++ [gl_cv_have_include_next=yes], ++ [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" ++ AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include ]], ++ [gl_cv_have_include_next=buggy], ++ [gl_cv_have_include_next=no]) ++ ]) ++ CPPFLAGS="$gl_save_CPPFLAGS" ++ rm -rf conftestd1a conftestd1b conftestd2 ++ ]) ++ PRAGMA_SYSTEM_HEADER= ++ if test $gl_cv_have_include_next = yes; then ++ INCLUDE_NEXT=include_next ++ INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next ++ if test -n "$GCC"; then ++ PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' ++ fi ++ else ++ if test $gl_cv_have_include_next = buggy; then ++ INCLUDE_NEXT=include ++ INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next ++ else ++ INCLUDE_NEXT=include ++ INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include ++ fi ++ fi ++ AC_SUBST([INCLUDE_NEXT]) ++ AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) ++ AC_SUBST([PRAGMA_SYSTEM_HEADER]) ++ AC_CACHE_CHECK([whether system header files limit the line length], ++ [gl_cv_pragma_columns], ++ [dnl HP NonStop systems, which define __TANDEM, have this misfeature. ++ AC_EGREP_CPP([choke me], ++ [ ++#ifdef __TANDEM ++choke me ++#endif ++ ], ++ [gl_cv_pragma_columns=yes], ++ [gl_cv_pragma_columns=no]) ++ ]) ++ if test $gl_cv_pragma_columns = yes; then ++ PRAGMA_COLUMNS="#pragma COLUMNS 10000" ++ else ++ PRAGMA_COLUMNS= ++ fi ++ AC_SUBST([PRAGMA_COLUMNS]) ++]) ++ ++# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) ++# ------------------------------------------ ++# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be ++# ''; otherwise define it to be ++# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. ++# Also, if #include_next works as first preprocessing directive in a file, ++# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be ''; otherwise define it to ++# be ++# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. ++# That way, a header file with the following line: ++# #@INCLUDE_NEXT@ @NEXT_FOO_H@ ++# or ++# #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@ ++# behaves (after sed substitution) as if it contained ++# #include_next ++# even if the compiler does not support include_next. ++# The three "///" are to pacify Sun C 5.8, which otherwise would say ++# "warning: #include of /usr/include/... may be non-portable". ++# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. ++# Note: This macro assumes that the header file is not empty after ++# preprocessing, i.e. it does not only define preprocessor macros but also ++# provides some type/enum definitions or function/variable declarations. ++# ++# This macro also checks whether each header exists, by invoking ++# AC_CHECK_HEADERS_ONCE or AC_CHECK_HEADERS on each argument. ++AC_DEFUN([gl_CHECK_NEXT_HEADERS], ++[ ++ gl_NEXT_HEADERS_INTERNAL([$1], [check]) ++]) ++ ++# gl_NEXT_HEADERS(HEADER1 HEADER2 ...) ++# ------------------------------------ ++# Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist. ++# This is suitable for headers like that are standardized by C89 ++# and therefore can be assumed to exist. ++AC_DEFUN([gl_NEXT_HEADERS], ++[ ++ gl_NEXT_HEADERS_INTERNAL([$1], [assume]) ++]) ++ ++# The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS. ++AC_DEFUN([gl_NEXT_HEADERS_INTERNAL], ++[ ++ AC_REQUIRE([gl_INCLUDE_NEXT]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) ++ ++ m4_if([$2], [check], ++ [AC_CHECK_HEADERS_ONCE([$1]) ++ ]) ++ ++dnl FIXME: gl_next_header and gl_header_exists must be used unquoted ++dnl until we can assume autoconf 2.64 or newer. ++ m4_foreach_w([gl_HEADER_NAME], [$1], ++ [AS_VAR_PUSHDEF([gl_next_header], ++ [gl_cv_next_]m4_defn([gl_HEADER_NAME])) ++ if test $gl_cv_have_include_next = yes; then ++ AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) ++ else ++ AC_CACHE_CHECK( ++ [absolute name of <]m4_defn([gl_HEADER_NAME])[>], ++ m4_defn([gl_next_header]), ++ [m4_if([$2], [check], ++ [AS_VAR_PUSHDEF([gl_header_exists], ++ [ac_cv_header_]m4_defn([gl_HEADER_NAME])) ++ if test AS_VAR_GET(gl_header_exists) = yes; then ++ AS_VAR_POPDEF([gl_header_exists]) ++ ]) ++ AC_LANG_CONFTEST( ++ [AC_LANG_SOURCE( ++ [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] ++ )]) ++ dnl AIX "xlc -E" and "cc -E" omit #line directives for header ++ dnl files that contain only a #include of other header files and ++ dnl no non-comment tokens of their own. This leads to a failure ++ dnl to detect the absolute name of , , ++ dnl and others. The workaround is to force preservation ++ dnl of comments through option -C. This ensures all necessary ++ dnl #line directives are present. GCC supports option -C as well. ++ case "$host_os" in ++ aix*) gl_absname_cpp="$ac_cpp -C" ;; ++ *) gl_absname_cpp="$ac_cpp" ;; ++ esac ++changequote(,) ++ case "$host_os" in ++ mingw*) ++ dnl For the sake of native Windows compilers (excluding gcc), ++ dnl treat backslash as a directory separator, like /. ++ dnl Actually, these compilers use a double-backslash as ++ dnl directory separator, inside the ++ dnl # line "filename" ++ dnl directives. ++ gl_dirsep_regex='[/\\]' ++ ;; ++ *) ++ gl_dirsep_regex='\/' ++ ;; ++ esac ++ dnl A sed expression that turns a string into a basic regular ++ dnl expression, for use within "/.../". ++ gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' ++changequote([,]) ++ gl_header_literal_regex=`echo ']m4_defn([gl_HEADER_NAME])[' \ ++ | sed -e "$gl_make_literal_regex_sed"` ++ gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ ++ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ ++changequote(,)dnl ++ s|^/[^/]|//&| ++changequote([,])dnl ++ p ++ q ++ }' ++ dnl eval is necessary to expand gl_absname_cpp. ++ dnl Ultrix and Pyramid sh refuse to redirect output of eval, ++ dnl so use subshell. ++ AS_VAR_SET(gl_next_header, ++ ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | ++ sed -n "$gl_absolute_header_sed"`'"']) ++ m4_if([$2], [check], ++ [else ++ AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) ++ fi ++ ]) ++ ]) ++ fi ++ AC_SUBST( ++ AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), ++ [AS_VAR_GET(gl_next_header)]) ++ if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then ++ # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' ++ gl_next_as_first_directive='<'gl_HEADER_NAME'>' ++ else ++ # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' ++ gl_next_as_first_directive=AS_VAR_GET(gl_next_header) ++ fi ++ AC_SUBST( ++ AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), ++ [$gl_next_as_first_directive]) ++ AS_VAR_POPDEF([gl_next_header])]) ++]) ++ ++# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE; ++# this fallback is safe for all earlier autoconf versions. ++m4_define_default([AC_LANG_DEFINES_PROVIDED]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/intmax_t.m4 b/xbmc/screensavers/rsxs-0.9/m4/intmax_t.m4 +index 44b1652..7341054 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/intmax_t.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/intmax_t.m4 +@@ -1,12 +1,13 @@ +-# intmax_t.m4 serial 4 +-dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. ++# intmax_t.m4 serial 8 ++dnl Copyright (C) 1997-2004, 2006-2007, 2009-2011 Free Software Foundation, ++dnl Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + + dnl From Paul Eggert. + +-AC_PREREQ(2.13) ++AC_PREREQ([2.53]) + + # Define intmax_t to 'long' or 'long long' + # if it is not already defined in or . +@@ -18,14 +19,14 @@ AC_DEFUN([gl_AC_TYPE_INTMAX_T], + AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([gl_AC_HEADER_STDINT_H]) + if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then +- AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) +- test $ac_cv_type_long_long = yes \ ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ++ test $ac_cv_type_long_long_int = yes \ + && ac_type='long long' \ + || ac_type='long' +- AC_DEFINE_UNQUOTED(intmax_t, $ac_type, ++ AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], + [Define to long or long long if and don't define.]) + else +- AC_DEFINE(HAVE_INTMAX_T, 1, ++ AC_DEFINE([HAVE_INTMAX_T], [1], + [Define if you have the 'intmax_t' type in or .]) + fi + ]) +@@ -36,8 +37,10 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T], + [ + AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([gl_AC_HEADER_STDINT_H]) +- AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, +- [AC_TRY_COMPILE([ ++ AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[ + #include + #include + #if HAVE_STDINT_H_WITH_UINTMAX +@@ -46,16 +49,19 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T], + #if HAVE_INTTYPES_H_WITH_UINTMAX + #include + #endif +-], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) ++ ]], ++ [[intmax_t x = -1; return !x;]])], ++ [gt_cv_c_intmax_t=yes], ++ [gt_cv_c_intmax_t=no])]) + if test $gt_cv_c_intmax_t = yes; then +- AC_DEFINE(HAVE_INTMAX_T, 1, ++ AC_DEFINE([HAVE_INTMAX_T], [1], + [Define if you have the 'intmax_t' type in or .]) + else +- AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) +- test $ac_cv_type_long_long = yes \ ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ++ test $ac_cv_type_long_long_int = yes \ + && ac_type='long long' \ + || ac_type='long' +- AC_DEFINE_UNQUOTED(intmax_t, $ac_type, ++ AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], + [Define to long or long long if and don't define.]) + fi + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/inttypes_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/inttypes_h.m4 +index a5d075d..f10fd54 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/inttypes_h.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/inttypes_h.m4 +@@ -1,5 +1,5 @@ +-# inttypes_h.m4 serial 6 +-dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. ++# inttypes_h.m4 serial 10 ++dnl Copyright (C) 1997-2004, 2006, 2008-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -11,15 +11,18 @@ dnl From Paul Eggert. + + AC_DEFUN([gl_AC_HEADER_INTTYPES_H], + [ +- AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, +- [AC_TRY_COMPILE( +- [#include +-#include ], +- [uintmax_t i = (uintmax_t) -1;], +- gl_cv_header_inttypes_h=yes, +- gl_cv_header_inttypes_h=no)]) ++ AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[ ++#include ++#include ++ ]], ++ [[uintmax_t i = (uintmax_t) -1; return !i;]])], ++ [gl_cv_header_inttypes_h=yes], ++ [gl_cv_header_inttypes_h=no])]) + if test $gl_cv_header_inttypes_h = yes; then +- AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, ++ AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1], + [Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +diff --git a/xbmc/screensavers/rsxs-0.9/m4/longlong.m4 b/xbmc/screensavers/rsxs-0.9/m4/longlong.m4 +index ea7c485..aed816c 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/longlong.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/longlong.m4 +@@ -1,5 +1,5 @@ +-# longlong.m4 serial 6 +-dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. ++# longlong.m4 serial 16 ++dnl Copyright (C) 1999-2007, 2009-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -7,38 +7,107 @@ dnl with or without modifications, as long as this notice is preserved. + dnl From Paul Eggert. + + # Define HAVE_LONG_LONG_INT if 'long long int' works. +-# This fixes a bug in Autoconf 2.60, but can be removed once we +-# assume 2.61 everywhere. ++# This fixes a bug in Autoconf 2.61, and can be faster ++# than what's in Autoconf 2.62 through 2.68. ++ ++# Note: If the type 'long long int' exists but is only 32 bits large ++# (as on some very old compilers), HAVE_LONG_LONG_INT will not be ++# defined. In this case you can treat 'long long int' like 'long int'. + + AC_DEFUN([AC_TYPE_LONG_LONG_INT], + [ ++ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) + AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], +- [AC_LINK_IFELSE( +- [AC_LANG_PROGRAM( +- [[long long int ll = 9223372036854775807ll; +- long long int nll = -9223372036854775807LL; +- typedef int a[((-9223372036854775807LL < 0 +- && 0 < 9223372036854775807ll) +- ? 1 : -1)]; +- int i = 63;]], +- [[long long int llmax = 9223372036854775807ll; +- return (ll << 63 | ll >> 63 | ll < i | ll > i +- | llmax / ll | llmax % ll);]])], +- [ac_cv_type_long_long_int=yes], +- [ac_cv_type_long_long_int=no])]) ++ [ac_cv_type_long_long_int=yes ++ if test "x${ac_cv_prog_cc_c99-no}" = xno; then ++ ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int ++ if test $ac_cv_type_long_long_int = yes; then ++ dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. ++ dnl If cross compiling, assume the bug is not important, since ++ dnl nobody cross compiles for this platform as far as we know. ++ AC_RUN_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[@%:@include ++ @%:@ifndef LLONG_MAX ++ @%:@ define HALF \ ++ (1LL << (sizeof (long long int) * CHAR_BIT - 2)) ++ @%:@ define LLONG_MAX (HALF - 1 + HALF) ++ @%:@endif]], ++ [[long long int n = 1; ++ int i; ++ for (i = 0; ; i++) ++ { ++ long long int m = n << i; ++ if (m >> i != n) ++ return 1; ++ if (LLONG_MAX / 2 < m) ++ break; ++ } ++ return 0;]])], ++ [], ++ [ac_cv_type_long_long_int=no], ++ [:]) ++ fi ++ fi]) + if test $ac_cv_type_long_long_int = yes; then +- AC_DEFINE([HAVE_LONG_LONG_INT], 1, ++ AC_DEFINE([HAVE_LONG_LONG_INT], [1], + [Define to 1 if the system has the type `long long int'.]) + fi + ]) + +-# This macro is obsolescent and should go away soon. +-AC_DEFUN([gl_AC_TYPE_LONG_LONG], ++# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. ++# This fixes a bug in Autoconf 2.61, and can be faster ++# than what's in Autoconf 2.62 through 2.68. ++ ++# Note: If the type 'unsigned long long int' exists but is only 32 bits ++# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT ++# will not be defined. In this case you can treat 'unsigned long long int' ++# like 'unsigned long int'. ++ ++AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], + [ +- AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) +- ac_cv_type_long_long=$ac_cv_type_long_long_int +- if test $ac_cv_type_long_long = yes; then +- AC_DEFINE(HAVE_LONG_LONG, 1, +- [Define if you have the 'long long' type.]) ++ AC_CACHE_CHECK([for unsigned long long int], ++ [ac_cv_type_unsigned_long_long_int], ++ [ac_cv_type_unsigned_long_long_int=yes ++ if test "x${ac_cv_prog_cc_c99-no}" = xno; then ++ AC_LINK_IFELSE( ++ [_AC_TYPE_LONG_LONG_SNIPPET], ++ [], ++ [ac_cv_type_unsigned_long_long_int=no]) ++ fi]) ++ if test $ac_cv_type_unsigned_long_long_int = yes; then ++ AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], ++ [Define to 1 if the system has the type `unsigned long long int'.]) + fi + ]) ++ ++# Expands to a C program that can be used to test for simultaneous support ++# of 'long long' and 'unsigned long long'. We don't want to say that ++# 'long long' is available if 'unsigned long long' is not, or vice versa, ++# because too many programs rely on the symmetry between signed and unsigned ++# integer types (excluding 'bool'). ++AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], ++[ ++ AC_LANG_PROGRAM( ++ [[/* For now, do not test the preprocessor; as of 2007 there are too many ++ implementations with broken preprocessors. Perhaps this can ++ be revisited in 2012. In the meantime, code should not expect ++ #if to work with literals wider than 32 bits. */ ++ /* Test literals. */ ++ long long int ll = 9223372036854775807ll; ++ long long int nll = -9223372036854775807LL; ++ unsigned long long int ull = 18446744073709551615ULL; ++ /* Test constant expressions. */ ++ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) ++ ? 1 : -1)]; ++ typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 ++ ? 1 : -1)]; ++ int i = 63;]], ++ [[/* Test availability of runtime routines for shift and division. */ ++ long long int llmax = 9223372036854775807ll; ++ unsigned long long int ullmax = 18446744073709551615ull; ++ return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) ++ | (llmax / ll) | (llmax % ll) ++ | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) ++ | (ullmax / ull) | (ullmax % ull));]]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/malloc.m4 b/xbmc/screensavers/rsxs-0.9/m4/malloc.m4 +new file mode 100644 +index 0000000..87018ec +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/malloc.m4 +@@ -0,0 +1,60 @@ ++# malloc.m4 serial 13 ++dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++# gl_FUNC_MALLOC_GNU ++# ------------------ ++# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if ++# it is not. ++AC_DEFUN([gl_FUNC_MALLOC_GNU], ++[ ++ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) ++ dnl _AC_FUNC_MALLOC_IF is defined in Autoconf. ++ _AC_FUNC_MALLOC_IF( ++ [AC_DEFINE([HAVE_MALLOC_GNU], [1], ++ [Define to 1 if your system has a GNU libc compatible 'malloc' ++ function, and to 0 otherwise.])], ++ [AC_DEFINE([HAVE_MALLOC_GNU], [0]) ++ REPLACE_MALLOC=1 ++ ]) ++]) ++ ++# gl_FUNC_MALLOC_POSIX ++# -------------------- ++# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it ++# fails), and replace malloc if it is not. ++AC_DEFUN([gl_FUNC_MALLOC_POSIX], ++[ ++ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) ++ AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) ++ if test $gl_cv_func_malloc_posix = yes; then ++ AC_DEFINE([HAVE_MALLOC_POSIX], [1], ++ [Define if the 'malloc' function is POSIX compliant.]) ++ else ++ REPLACE_MALLOC=1 ++ fi ++]) ++ ++# Test whether malloc, realloc, calloc are POSIX compliant, ++# Set gl_cv_func_malloc_posix to yes or no accordingly. ++AC_DEFUN([gl_CHECK_MALLOC_POSIX], ++[ ++ AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant], ++ [gl_cv_func_malloc_posix], ++ [ ++ dnl It is too dangerous to try to allocate a large amount of memory: ++ dnl some systems go to their knees when you do that. So assume that ++ dnl all Unix implementations of the function are POSIX compliant. ++ AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[]], ++ [[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ choke me ++ #endif ++ ]])], ++ [gl_cv_func_malloc_posix=yes], ++ [gl_cv_func_malloc_posix=no]) ++ ]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/math_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/math_h.m4 +new file mode 100644 +index 0000000..e58a9e9 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/math_h.m4 +@@ -0,0 +1,243 @@ ++# math_h.m4 serial 56 ++dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_MATH_H], ++[ ++ AC_REQUIRE([gl_MATH_H_DEFAULTS]) ++ gl_CHECK_NEXT_HEADERS([math.h]) ++ AC_REQUIRE([AC_C_INLINE]) ++ ++ AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], ++ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], ++ [[/* Solaris 10 has a broken definition of NAN. Other platforms ++ fail to provide NAN, or provide it only in C99 mode; this ++ test only needs to fail when NAN is provided but wrong. */ ++ float f = 1.0f; ++#ifdef NAN ++ f = NAN; ++#endif ++ return f == 0;]])], ++ [gl_cv_header_math_nan_works=yes], ++ [gl_cv_header_math_nan_works=no])]) ++ if test $gl_cv_header_math_nan_works = no; then ++ REPLACE_NAN=1 ++ fi ++ AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works], ++ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], ++ [[/* Solaris 10 has a broken definition of HUGE_VAL. */ ++ double d = HUGE_VAL; ++ return d == 0;]])], ++ [gl_cv_header_math_huge_val_works=yes], ++ [gl_cv_header_math_huge_val_works=no])]) ++ if test $gl_cv_header_math_huge_val_works = no; then ++ REPLACE_HUGE_VAL=1 ++ fi ++ ++ dnl Check for declarations of anything we want to poison if the ++ dnl corresponding gnulib module is not in use. ++ gl_WARN_ON_USE_PREPARE([[#include ]], ++ [acosf acosl asinf asinl atanf atanl ++ ceilf ceill copysign copysignf copysignl cosf cosl coshf ++ expf expl fabsf floorf floorl fma fmaf fmal fmodf frexpf frexpl ++ ldexpf ldexpl logb logf logl log10f modff powf ++ rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl ++ tanf tanl tanhf trunc truncf truncl]) ++]) ++ ++AC_DEFUN([gl_MATH_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_MATH_H_DEFAULTS]) ++ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ++ dnl Define it also as a C macro, for the benefit of the unit tests. ++ gl_MODULE_INDICATOR_FOR_TESTS([$1]) ++]) ++ ++AC_DEFUN([gl_MATH_H_DEFAULTS], ++[ ++ GNULIB_ACOSF=0; AC_SUBST([GNULIB_ACOSF]) ++ GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL]) ++ GNULIB_ASINF=0; AC_SUBST([GNULIB_ASINF]) ++ GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL]) ++ GNULIB_ATANF=0; AC_SUBST([GNULIB_ATANF]) ++ GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL]) ++ GNULIB_ATAN2F=0; AC_SUBST([GNULIB_ATAN2F]) ++ GNULIB_CEIL=0; AC_SUBST([GNULIB_CEIL]) ++ GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF]) ++ GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL]) ++ GNULIB_COPYSIGN=0; AC_SUBST([GNULIB_COPYSIGN]) ++ GNULIB_COPYSIGNF=0; AC_SUBST([GNULIB_COPYSIGNF]) ++ GNULIB_COPYSIGNL=0; AC_SUBST([GNULIB_COPYSIGNL]) ++ GNULIB_COSF=0; AC_SUBST([GNULIB_COSF]) ++ GNULIB_COSL=0; AC_SUBST([GNULIB_COSL]) ++ GNULIB_COSHF=0; AC_SUBST([GNULIB_COSHF]) ++ GNULIB_EXPF=0; AC_SUBST([GNULIB_EXPF]) ++ GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL]) ++ GNULIB_FABSF=0; AC_SUBST([GNULIB_FABSF]) ++ GNULIB_FLOOR=0; AC_SUBST([GNULIB_FLOOR]) ++ GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF]) ++ GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL]) ++ GNULIB_FMA=0; AC_SUBST([GNULIB_FMA]) ++ GNULIB_FMAF=0; AC_SUBST([GNULIB_FMAF]) ++ GNULIB_FMAL=0; AC_SUBST([GNULIB_FMAL]) ++ GNULIB_FMODF=0; AC_SUBST([GNULIB_FMODF]) ++ GNULIB_FREXPF=0; AC_SUBST([GNULIB_FREXPF]) ++ GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) ++ GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL]) ++ GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE]) ++ GNULIB_ISINF=0; AC_SUBST([GNULIB_ISINF]) ++ GNULIB_ISNAN=0; AC_SUBST([GNULIB_ISNAN]) ++ GNULIB_ISNANF=0; AC_SUBST([GNULIB_ISNANF]) ++ GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND]) ++ GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL]) ++ GNULIB_LDEXPF=0; AC_SUBST([GNULIB_LDEXPF]) ++ GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) ++ GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB]) ++ GNULIB_LOGF=0; AC_SUBST([GNULIB_LOGF]) ++ GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL]) ++ GNULIB_LOG10F=0; AC_SUBST([GNULIB_LOG10F]) ++ GNULIB_MODFF=0; AC_SUBST([GNULIB_MODFF]) ++ GNULIB_POWF=0; AC_SUBST([GNULIB_POWF]) ++ GNULIB_RINT=0; AC_SUBST([GNULIB_RINT]) ++ GNULIB_RINTF=0; AC_SUBST([GNULIB_RINTF]) ++ GNULIB_RINTL=0; AC_SUBST([GNULIB_RINTL]) ++ GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND]) ++ GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF]) ++ GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL]) ++ GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) ++ GNULIB_SINF=0; AC_SUBST([GNULIB_SINF]) ++ GNULIB_SINL=0; AC_SUBST([GNULIB_SINL]) ++ GNULIB_SINHF=0; AC_SUBST([GNULIB_SINHF]) ++ GNULIB_SQRTF=0; AC_SUBST([GNULIB_SQRTF]) ++ GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL]) ++ GNULIB_TANF=0; AC_SUBST([GNULIB_TANF]) ++ GNULIB_TANL=0; AC_SUBST([GNULIB_TANL]) ++ GNULIB_TANHF=0; AC_SUBST([GNULIB_TANHF]) ++ GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC]) ++ GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) ++ GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF]) ++ HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) ++ HAVE_ASINF=1; AC_SUBST([HAVE_ASINF]) ++ HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) ++ HAVE_ATANF=1; AC_SUBST([HAVE_ATANF]) ++ HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) ++ HAVE_ATAN2F=1; AC_SUBST([HAVE_ATAN2F]) ++ HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN]) ++ HAVE_COPYSIGNF=1; AC_SUBST([HAVE_COPYSIGNF]) ++ HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL]) ++ HAVE_COSF=1; AC_SUBST([HAVE_COSF]) ++ HAVE_COSL=1; AC_SUBST([HAVE_COSL]) ++ HAVE_COSHF=1; AC_SUBST([HAVE_COSHF]) ++ HAVE_EXPF=1; AC_SUBST([HAVE_EXPF]) ++ HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) ++ HAVE_FABSF=1; AC_SUBST([HAVE_FABSF]) ++ HAVE_FMA=1; AC_SUBST([HAVE_FMA]) ++ HAVE_FMAF=1; AC_SUBST([HAVE_FMAF]) ++ HAVE_FMAL=1; AC_SUBST([HAVE_FMAL]) ++ HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) ++ HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) ++ HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) ++ HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) ++ HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) ++ HAVE_LDEXPF=1; AC_SUBST([HAVE_LDEXPF]) ++ HAVE_LOGF=1; AC_SUBST([HAVE_LOGF]) ++ HAVE_LOGL=1; AC_SUBST([HAVE_LOGL]) ++ HAVE_LOG10F=1; AC_SUBST([HAVE_LOG10F]) ++ HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) ++ HAVE_POWF=1; AC_SUBST([HAVE_POWF]) ++ HAVE_RINT=1; AC_SUBST([HAVE_RINT]) ++ HAVE_RINTF=1; AC_SUBST([HAVE_RINTF]) ++ HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) ++ HAVE_SINF=1; AC_SUBST([HAVE_SINF]) ++ HAVE_SINL=1; AC_SUBST([HAVE_SINL]) ++ HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) ++ HAVE_SQRTF=1; AC_SUBST([HAVE_SQRTF]) ++ HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL]) ++ HAVE_TANF=1; AC_SUBST([HAVE_TANF]) ++ HAVE_TANL=1; AC_SUBST([HAVE_TANL]) ++ HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) ++ HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) ++ HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) ++ HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) ++ HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) ++ HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) ++ HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) ++ HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) ++ HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) ++ HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) ++ HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) ++ HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) ++ HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) ++ HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) ++ HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) ++ HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) ++ HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) ++ HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) ++ HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) ++ HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) ++ HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) ++ HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) ++ HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) ++ REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL]) ++ REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) ++ REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) ++ REPLACE_FLOOR=0; AC_SUBST([REPLACE_FLOOR]) ++ REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) ++ REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL]) ++ REPLACE_FMA=0; AC_SUBST([REPLACE_FMA]) ++ REPLACE_FMAF=0; AC_SUBST([REPLACE_FMAF]) ++ REPLACE_FMAL=0; AC_SUBST([REPLACE_FMAL]) ++ REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) ++ REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) ++ REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) ++ REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) ++ REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) ++ REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) ++ REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) ++ REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) ++ REPLACE_NAN=0; AC_SUBST([REPLACE_NAN]) ++ REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND]) ++ REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF]) ++ REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) ++ REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) ++ REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC]) ++ REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) ++ REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) ++ REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) ++]) ++ ++# gl_LONG_DOUBLE_VS_DOUBLE ++# determines whether 'long double' and 'double' have the same representation. ++# Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines ++# HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly. ++# The currently known platforms where this is the case are: ++# Linux/HPPA, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9. ++AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE], ++[ ++ AC_CACHE_CHECK([whether long double and double are the same], ++ [gl_cv_long_double_equals_double], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM([[#include ]], ++ [[typedef int check[sizeof (long double) == sizeof (double) ++ && LDBL_MANT_DIG == DBL_MANT_DIG ++ && LDBL_MAX_EXP == DBL_MAX_EXP ++ && LDBL_MIN_EXP == DBL_MIN_EXP ++ ? 1 : -1]; ++ ]])], ++ [gl_cv_long_double_equals_double=yes], ++ [gl_cv_long_double_equals_double=no]) ++ ]) ++ if test $gl_cv_long_double_equals_double = yes; then ++ AC_DEFINE([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE], [1], ++ [Define to 1 if 'long double' and 'double' have the same representation.]) ++ HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=1 ++ else ++ HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=0 ++ fi ++ AC_SUBST([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/memchr.m4 b/xbmc/screensavers/rsxs-0.9/m4/memchr.m4 +index 91b8636..f6dc3e7 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/memchr.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/memchr.m4 +@@ -1,18 +1,88 @@ +-# memchr.m4 serial 4 +-dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. ++# memchr.m4 serial 12 ++dnl Copyright (C) 2002-2004, 2009-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + +-AC_DEFUN([gl_FUNC_MEMCHR], ++AC_DEFUN_ONCE([gl_FUNC_MEMCHR], + [ +- AC_REPLACE_FUNCS(memchr) +- if test $ac_cv_func_memchr = no; then +- gl_PREREQ_MEMCHR ++ dnl Check for prerequisites for memory fence checks. ++ gl_FUNC_MMAP_ANON ++ AC_CHECK_HEADERS_ONCE([sys/mman.h]) ++ AC_CHECK_FUNCS_ONCE([mprotect]) ++ ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) ++ m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [ ++ dnl These days, we assume memchr is present. But if support for old ++ dnl platforms is desired: ++ AC_CHECK_FUNCS_ONCE([memchr]) ++ if test $ac_cv_func_memchr = no; then ++ HAVE_MEMCHR=0 ++ fi ++ ]) ++ if test $HAVE_MEMCHR = 1; then ++ # Detect platform-specific bugs in some versions of glibc: ++ # memchr should not dereference anything with length 0 ++ # http://bugzilla.redhat.com/499689 ++ # memchr should not dereference overestimated length after a match ++ # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 ++ # http://sourceware.org/bugzilla/show_bug.cgi?id=10162 ++ # Assume that memchr works on platforms that lack mprotect. ++ AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], ++ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ++#include ++#if HAVE_SYS_MMAN_H ++# include ++# include ++# include ++# include ++# ifndef MAP_FILE ++# define MAP_FILE 0 ++# endif ++#endif ++]], [[ ++ int result = 0; ++ char *fence = NULL; ++#if HAVE_SYS_MMAN_H && HAVE_MPROTECT ++# if HAVE_MAP_ANONYMOUS ++ const int flags = MAP_ANONYMOUS | MAP_PRIVATE; ++ const int fd = -1; ++# else /* !HAVE_MAP_ANONYMOUS */ ++ const int flags = MAP_FILE | MAP_PRIVATE; ++ int fd = open ("/dev/zero", O_RDONLY, 0666); ++ if (fd >= 0) ++# endif ++ { ++ int pagesize = getpagesize (); ++ char *two_pages = ++ (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, ++ flags, fd, 0); ++ if (two_pages != (char *)(-1) ++ && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) ++ fence = two_pages + pagesize; ++ } ++#endif ++ if (fence) ++ { ++ if (memchr (fence, 0, 0)) ++ result |= 1; ++ strcpy (fence - 9, "12345678"); ++ if (memchr (fence - 9, 0, 79) != fence - 1) ++ result |= 2; ++ if (memchr (fence - 1, 0, 3) != fence - 1) ++ result |= 4; ++ } ++ return result; ++]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], ++ [dnl Be pessimistic for now. ++ gl_cv_func_memchr_works="guessing no"])]) ++ if test "$gl_cv_func_memchr_works" != yes; then ++ REPLACE_MEMCHR=1 ++ fi + fi + ]) + + # Prerequisites of lib/memchr.c. + AC_DEFUN([gl_PREREQ_MEMCHR], [ +- AC_CHECK_HEADERS(bp-sym.h) ++ AC_CHECK_HEADERS([bp-sym.h]) + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/mempcpy.m4 b/xbmc/screensavers/rsxs-0.9/m4/mempcpy.m4 +index a96168d..7214a4b 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/mempcpy.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/mempcpy.m4 +@@ -1,19 +1,22 @@ +-# mempcpy.m4 serial 3 +-dnl Copyright (C) 2003, 2004 Free Software Foundation, Inc. ++# mempcpy.m4 serial 11 ++dnl Copyright (C) 2003-2004, 2006-2007, 2009-2011 Free Software Foundation, ++dnl Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + + AC_DEFUN([gl_FUNC_MEMPCPY], + [ +- AC_LIBSOURCES([mempcpy.c, mempcpy.h]) +- + dnl Persuade glibc to declare mempcpy(). +- AC_REQUIRE([AC_GNU_SOURCE]) ++ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ++ ++ dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'. ++ AC_REQUIRE([AC_C_RESTRICT]) + +- AC_REPLACE_FUNCS(mempcpy) ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) ++ AC_CHECK_FUNCS([mempcpy]) + if test $ac_cv_func_mempcpy = no; then +- gl_PREREQ_MEMPCPY ++ HAVE_MEMPCPY=0 + fi + ]) + +diff --git a/xbmc/screensavers/rsxs-0.9/m4/mmap-anon.m4 b/xbmc/screensavers/rsxs-0.9/m4/mmap-anon.m4 +new file mode 100644 +index 0000000..952536f +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/mmap-anon.m4 +@@ -0,0 +1,55 @@ ++# mmap-anon.m4 serial 9 ++dnl Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++# Detect how mmap can be used to create anonymous (not file-backed) memory ++# mappings. ++# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS ++# and MAP_ANON exist and have the same value. ++# - On HP-UX, only MAP_ANONYMOUS exists. ++# - On MacOS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. ++# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be ++# used. ++ ++AC_DEFUN([gl_FUNC_MMAP_ANON], ++[ ++ dnl Persuade glibc to define MAP_ANONYMOUS. ++ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) ++ ++ # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it ++ # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is ++ # irrelevant for anonymous mappings. ++ AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) ++ ++ # Try to allow MAP_ANONYMOUS. ++ gl_have_mmap_anonymous=no ++ if test $gl_have_mmap = yes; then ++ AC_MSG_CHECKING([for MAP_ANONYMOUS]) ++ AC_EGREP_CPP([I cant identify this map], [ ++#include ++#ifdef MAP_ANONYMOUS ++ I cant identify this map ++#endif ++], ++ [gl_have_mmap_anonymous=yes]) ++ if test $gl_have_mmap_anonymous != yes; then ++ AC_EGREP_CPP([I cant identify this map], [ ++#include ++#ifdef MAP_ANON ++ I cant identify this map ++#endif ++], ++ [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], ++ [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.]) ++ gl_have_mmap_anonymous=yes]) ++ fi ++ AC_MSG_RESULT([$gl_have_mmap_anonymous]) ++ if test $gl_have_mmap_anonymous = yes; then ++ AC_DEFINE([HAVE_MAP_ANONYMOUS], [1], ++ [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including ++ config.h and .]) ++ fi ++ fi ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/multiarch.m4 b/xbmc/screensavers/rsxs-0.9/m4/multiarch.m4 +new file mode 100644 +index 0000000..691d892 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/multiarch.m4 +@@ -0,0 +1,62 @@ ++# multiarch.m4 serial 6 ++dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++# Determine whether the compiler is or may be producing universal binaries. ++# ++# On MacOS X 10.5 and later systems, the user can create libraries and ++# executables that work on multiple system types--known as "fat" or ++# "universal" binaries--by specifying multiple '-arch' options to the ++# compiler but only a single '-arch' option to the preprocessor. Like ++# this: ++# ++# ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ ++# CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ ++# CPP="gcc -E" CXXCPP="g++ -E" ++# ++# Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly. ++ ++AC_DEFUN_ONCE([gl_MULTIARCH], ++[ ++ dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. ++ gl_cv_c_multiarch=no ++ AC_COMPILE_IFELSE( ++ [AC_LANG_SOURCE( ++ [[#ifndef __APPLE_CC__ ++ not a universal capable compiler ++ #endif ++ typedef int dummy; ++ ]])], ++ [ ++ dnl Check for potential -arch flags. It is not universal unless ++ dnl there are at least two -arch flags with different values. ++ arch= ++ prev= ++ for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do ++ if test -n "$prev"; then ++ case $word in ++ i?86 | x86_64 | ppc | ppc64) ++ if test -z "$arch" || test "$arch" = "$word"; then ++ arch="$word" ++ else ++ gl_cv_c_multiarch=yes ++ fi ++ ;; ++ esac ++ prev= ++ else ++ if test "x$word" = "x-arch"; then ++ prev=arch ++ fi ++ fi ++ done ++ ]) ++ if test $gl_cv_c_multiarch = yes; then ++ APPLE_UNIVERSAL_BUILD=1 ++ else ++ APPLE_UNIVERSAL_BUILD=0 ++ fi ++ AC_SUBST([APPLE_UNIVERSAL_BUILD]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/nocrash.m4 b/xbmc/screensavers/rsxs-0.9/m4/nocrash.m4 +new file mode 100644 +index 0000000..60aad95 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/nocrash.m4 +@@ -0,0 +1,130 @@ ++# nocrash.m4 serial 3 ++dnl Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. ++ ++AC_PREREQ([2.13]) ++ ++dnl Expands to some code for use in .c programs that will cause the configure ++dnl test to exit instead of crashing. This is useful to avoid triggering ++dnl action from a background debugger and to avoid core dumps. ++dnl Usage: ... ++dnl ]GL_NOCRASH[ ++dnl ... ++dnl int main() { nocrash_init(); ... } ++AC_DEFUN([GL_NOCRASH],[[ ++#include ++#if defined __MACH__ && defined __APPLE__ ++/* Avoid a crash on MacOS X. */ ++#include ++#include ++#include ++#include ++#include ++#include ++/* The exception port on which our thread listens. */ ++static mach_port_t our_exception_port; ++/* The main function of the thread listening for exceptions of type ++ EXC_BAD_ACCESS. */ ++static void * ++mach_exception_thread (void *arg) ++{ ++ /* Buffer for a message to be received. */ ++ struct { ++ mach_msg_header_t head; ++ mach_msg_body_t msgh_body; ++ char data[1024]; ++ } msg; ++ mach_msg_return_t retval; ++ /* Wait for a message on the exception port. */ ++ retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), ++ our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); ++ if (retval != MACH_MSG_SUCCESS) ++ abort (); ++ exit (1); ++} ++static void ++nocrash_init (void) ++{ ++ mach_port_t self = mach_task_self (); ++ /* Allocate a port on which the thread shall listen for exceptions. */ ++ if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) ++ == KERN_SUCCESS) { ++ /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ ++ if (mach_port_insert_right (self, our_exception_port, our_exception_port, ++ MACH_MSG_TYPE_MAKE_SEND) ++ == KERN_SUCCESS) { ++ /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting ++ for us. */ ++ exception_mask_t mask = EXC_MASK_BAD_ACCESS; ++ /* Create the thread listening on the exception port. */ ++ pthread_attr_t attr; ++ pthread_t thread; ++ if (pthread_attr_init (&attr) == 0 ++ && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 ++ && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { ++ pthread_attr_destroy (&attr); ++ /* Replace the exception port info for these exceptions with our own. ++ Note that we replace the exception port for the entire task, not only ++ for a particular thread. This has the effect that when our exception ++ port gets the message, the thread specific exception port has already ++ been asked, and we don't need to bother about it. ++ See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ ++ task_set_exception_ports (self, mask, our_exception_port, ++ EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); ++ } ++ } ++ } ++} ++#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++/* Avoid a crash on native Windows. */ ++#define WIN32_LEAN_AND_MEAN ++#include ++#include ++static LONG WINAPI ++exception_filter (EXCEPTION_POINTERS *ExceptionInfo) ++{ ++ switch (ExceptionInfo->ExceptionRecord->ExceptionCode) ++ { ++ case EXCEPTION_ACCESS_VIOLATION: ++ case EXCEPTION_IN_PAGE_ERROR: ++ case EXCEPTION_STACK_OVERFLOW: ++ case EXCEPTION_GUARD_PAGE: ++ case EXCEPTION_PRIV_INSTRUCTION: ++ case EXCEPTION_ILLEGAL_INSTRUCTION: ++ case EXCEPTION_DATATYPE_MISALIGNMENT: ++ case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: ++ case EXCEPTION_NONCONTINUABLE_EXCEPTION: ++ exit (1); ++ } ++ return EXCEPTION_CONTINUE_SEARCH; ++} ++static void ++nocrash_init (void) ++{ ++ SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); ++} ++#else ++/* Avoid a crash on POSIX systems. */ ++#include ++/* A POSIX signal handler. */ ++static void ++exception_handler (int sig) ++{ ++ exit (1); ++} ++static void ++nocrash_init (void) ++{ ++#ifdef SIGSEGV ++ signal (SIGSEGV, exception_handler); ++#endif ++#ifdef SIGBUS ++ signal (SIGBUS, exception_handler); ++#endif ++} ++#endif ++]]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/onceonly.m4 b/xbmc/screensavers/rsxs-0.9/m4/onceonly.m4 +new file mode 100644 +index 0000000..254217c +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/onceonly.m4 +@@ -0,0 +1,104 @@ ++# onceonly.m4 serial 8 ++dnl Copyright (C) 2002-2003, 2005-2006, 2008-2011 Free Software Foundation, ++dnl Inc. ++dnl ++dnl This file is free software; you can redistribute it and/or modify ++dnl it under the terms of the GNU General Public License as published by ++dnl the Free Software Foundation; either version 3 of the License, or ++dnl (at your option) any later version. ++dnl ++dnl This file is distributed in the hope that it will be useful, ++dnl but WITHOUT ANY WARRANTY; without even the implied warranty of ++dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++dnl GNU General Public License for more details. ++dnl ++dnl You should have received a copy of the GNU General Public License ++dnl along with this file. If not, see . ++dnl ++dnl As a special exception to the GNU General Public License, ++dnl this file may be distributed as part of a program ++dnl that contains a configuration script generated by Autoconf, under ++dnl the same distribution terms as the rest of that program. ++ ++dnl This file defines some "once only" variants of standard autoconf macros. ++dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS ++dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS ++dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS ++dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL ++dnl The advantage is that the check for each of the headers/functions/decls ++dnl will be put only once into the 'configure' file. It keeps the size of ++dnl the 'configure' file down, and avoids redundant output when 'configure' ++dnl is run. ++dnl The drawback is that the checks cannot be conditionalized. If you write ++dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi ++dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to ++dnl empty, and the check will be inserted before the body of the AC_DEFUNed ++dnl function. ++ ++dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE ++dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to ++dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested ++dnl headers at once, thus reducing the size of 'configure'. It is known to work ++dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%. ++ ++dnl Autoconf version 2.59 plus gnulib is required; this file is not needed ++dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of ++dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first ++dnl argument! ++AC_PREREQ([2.59]) ++ ++# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of ++# AC_CHECK_HEADERS(HEADER1 HEADER2 ...). ++AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ ++ : ++ m4_foreach_w([gl_HEADER_NAME], [$1], [ ++ AC_DEFUN([gl_CHECK_HEADER_]m4_quote(m4_translit(gl_HEADER_NAME, ++ [./-], [___])), [ ++ m4_divert_text([INIT_PREPARE], ++ [gl_header_list="$gl_header_list gl_HEADER_NAME"]) ++ gl_HEADERS_EXPANSION ++ AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])), ++ [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.]) ++ ]) ++ AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(m4_translit(gl_HEADER_NAME, ++ [./-], [___]))) ++ ]) ++]) ++m4_define([gl_HEADERS_EXPANSION], [ ++ m4_divert_text([DEFAULTS], [gl_header_list=]) ++ AC_CHECK_HEADERS([$gl_header_list]) ++ m4_define([gl_HEADERS_EXPANSION], []) ++]) ++ ++# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of ++# AC_CHECK_FUNCS(FUNC1 FUNC2 ...). ++AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ ++ : ++ m4_foreach_w([gl_FUNC_NAME], [$1], [ ++ AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [ ++ m4_divert_text([INIT_PREPARE], ++ [gl_func_list="$gl_func_list gl_FUNC_NAME"]) ++ gl_FUNCS_EXPANSION ++ AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])), ++ [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.]) ++ ]) ++ AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) ++ ]) ++]) ++m4_define([gl_FUNCS_EXPANSION], [ ++ m4_divert_text([DEFAULTS], [gl_func_list=]) ++ AC_CHECK_FUNCS([$gl_func_list]) ++ m4_define([gl_FUNCS_EXPANSION], []) ++]) ++ ++# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of ++# AC_CHECK_DECLS(DECL1, DECL2, ...). ++AC_DEFUN([AC_CHECK_DECLS_ONCE], [ ++ : ++ m4_foreach_w([gl_DECL_NAME], [$1], [ ++ AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [ ++ AC_CHECK_DECLS(m4_defn([gl_DECL_NAME])) ++ ]) ++ AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME])) ++ ]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/printf.m4 b/xbmc/screensavers/rsxs-0.9/m4/printf.m4 +new file mode 100644 +index 0000000..0814c91 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/printf.m4 +@@ -0,0 +1,1569 @@ ++# printf.m4 serial 46 ++dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl Test whether the *printf family of functions supports the 'j', 'z', 't', ++dnl 'L' size specifiers. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_sizes_c99. ++ ++AC_DEFUN([gl_PRINTF_SIZES_C99], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([gl_AC_HEADER_STDINT_H]) ++ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports size specifiers as in C99], ++ [gl_cv_func_printf_sizes_c99], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++#include ++#include ++#if HAVE_STDINT_H_WITH_UINTMAX ++# include ++#endif ++#if HAVE_INTTYPES_H_WITH_UINTMAX ++# include ++#endif ++static char buf[100]; ++int main () ++{ ++ int result = 0; ++#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX ++ buf[0] = '\0'; ++ if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 ++ || strcmp (buf, "12345671 33") != 0) ++ result |= 1; ++#endif ++ buf[0] = '\0'; ++ if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 ++ || strcmp (buf, "12345672 33") != 0) ++ result |= 2; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 ++ || strcmp (buf, "12345673 33") != 0) ++ result |= 4; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 ++ || strcmp (buf, "1.5 33") != 0) ++ result |= 8; ++ return result; ++}]])], ++ [gl_cv_func_printf_sizes_c99=yes], ++ [gl_cv_func_printf_sizes_c99=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # Guess yes on FreeBSD >= 5. ++ freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; ++ darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # Guess yes on OpenBSD >= 3.9. ++ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) ++ gl_cv_func_printf_sizes_c99="guessing no";; ++ openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # Guess yes on Solaris >= 2.10. ++ solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ solaris*) gl_cv_func_printf_sizes_c99="guessing no";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_printf_sizes_c99="guessing no";; ++ netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_sizes_c99="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports 'long double' ++dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_long_double. ++ ++AC_DEFUN([gl_PRINTF_LONG_DOUBLE], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports 'long double' arguments], ++ [gl_cv_func_printf_long_double], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++static char buf[10000]; ++int main () ++{ ++ int result = 0; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 ++ || strcmp (buf, "1.750000 33") != 0) ++ result |= 1; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 ++ || strcmp (buf, "1.750000e+00 33") != 0) ++ result |= 2; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 ++ || strcmp (buf, "1.75 33") != 0) ++ result |= 4; ++ return result; ++}]])], ++ [gl_cv_func_printf_long_double=yes], ++ [gl_cv_func_printf_long_double=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ beos*) gl_cv_func_printf_long_double="guessing no";; ++ mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; ++ *) gl_cv_func_printf_long_double="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports infinite and NaN ++dnl 'double' arguments and negative zero arguments in the %f, %e, %g ++dnl directives. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_infinite. ++ ++AC_DEFUN([gl_PRINTF_INFINITE], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports infinite 'double' arguments], ++ [gl_cv_func_printf_infinite], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++static int ++strisnan (const char *string, size_t start_index, size_t end_index) ++{ ++ if (start_index < end_index) ++ { ++ if (string[start_index] == '-') ++ start_index++; ++ if (start_index + 3 <= end_index ++ && memcmp (string + start_index, "nan", 3) == 0) ++ { ++ start_index += 3; ++ if (start_index == end_index ++ || (string[start_index] == '(' && string[end_index - 1] == ')')) ++ return 1; ++ } ++ } ++ return 0; ++} ++static int ++have_minus_zero () ++{ ++ static double plus_zero = 0.0; ++ double minus_zero = - plus_zero; ++ return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0; ++} ++static char buf[10000]; ++static double zero = 0.0; ++int main () ++{ ++ int result = 0; ++ if (sprintf (buf, "%f", 1.0 / zero) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ result |= 1; ++ if (sprintf (buf, "%f", -1.0 / zero) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ result |= 1; ++ if (sprintf (buf, "%f", zero / zero) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 2; ++ if (sprintf (buf, "%e", 1.0 / zero) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ result |= 4; ++ if (sprintf (buf, "%e", -1.0 / zero) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ result |= 4; ++ if (sprintf (buf, "%e", zero / zero) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 8; ++ if (sprintf (buf, "%g", 1.0 / zero) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ result |= 16; ++ if (sprintf (buf, "%g", -1.0 / zero) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ result |= 16; ++ if (sprintf (buf, "%g", zero / zero) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 32; ++ /* This test fails on HP-UX 10.20. */ ++ if (have_minus_zero ()) ++ if (sprintf (buf, "%g", - zero) < 0 ++ || strcmp (buf, "-0") != 0) ++ result |= 64; ++ return result; ++}]])], ++ [gl_cv_func_printf_infinite=yes], ++ [gl_cv_func_printf_infinite=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_infinite="guessing yes";; ++ # Guess yes on FreeBSD >= 6. ++ freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; ++ darwin*) gl_cv_func_printf_infinite="guessing yes";; ++ # Guess yes on HP-UX >= 11. ++ hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; ++ hpux*) gl_cv_func_printf_infinite="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_printf_infinite="guessing no";; ++ netbsd*) gl_cv_func_printf_infinite="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_printf_infinite="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_infinite="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports infinite and NaN ++dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_infinite_long_double. ++ ++AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE], ++[ ++ AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([gl_BIGENDIAN]) ++ AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ dnl The user can set or unset the variable gl_printf_safe to indicate ++ dnl that he wishes a safe handling of non-IEEE-754 'long double' values. ++ if test -n "$gl_printf_safe"; then ++ AC_DEFINE([CHECK_PRINTF_SAFE], [1], ++ [Define if you wish *printf() functions that have a safe handling of ++ non-IEEE-754 'long double' values.]) ++ fi ++ case "$gl_cv_func_printf_long_double" in ++ *yes) ++ AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments], ++ [gl_cv_func_printf_infinite_long_double], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++]GL_NOCRASH[ ++#include ++#include ++#include ++static int ++strisnan (const char *string, size_t start_index, size_t end_index) ++{ ++ if (start_index < end_index) ++ { ++ if (string[start_index] == '-') ++ start_index++; ++ if (start_index + 3 <= end_index ++ && memcmp (string + start_index, "nan", 3) == 0) ++ { ++ start_index += 3; ++ if (start_index == end_index ++ || (string[start_index] == '(' && string[end_index - 1] == ')')) ++ return 1; ++ } ++ } ++ return 0; ++} ++static char buf[10000]; ++static long double zeroL = 0.0L; ++int main () ++{ ++ int result = 0; ++ nocrash_init(); ++ if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ result |= 1; ++ if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ result |= 1; ++ if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 1; ++ if (sprintf (buf, "%Le", 1.0L / zeroL) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ result |= 1; ++ if (sprintf (buf, "%Le", -1.0L / zeroL) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ result |= 1; ++ if (sprintf (buf, "%Le", zeroL / zeroL) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 1; ++ if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ result |= 1; ++ if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ result |= 1; ++ if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 1; ++#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_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE ++/* Representation of an 80-bit 'long double' as an initializer for a sequence ++ of 'unsigned int' words. */ ++# ifdef WORDS_BIGENDIAN ++# define LDBL80_WORDS(exponent,manthi,mantlo) \ ++ { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ ++ ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ ++ (unsigned int) (mantlo) << 16 \ ++ } ++# else ++# define LDBL80_WORDS(exponent,manthi,mantlo) \ ++ { mantlo, manthi, exponent } ++# endif ++ { /* Quiet NaN. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 2; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 2; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 2; ++ } ++ { ++ /* Signalling NaN. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 2; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 2; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 2; ++ } ++ { /* Pseudo-NaN. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 4; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 4; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 4; ++ } ++ { /* Pseudo-Infinity. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 8; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 8; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 8; ++ } ++ { /* Pseudo-Zero. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 16; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 16; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 16; ++ } ++ { /* Unnormalized number. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 32; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 32; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 32; ++ } ++ { /* Pseudo-Denormal. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 64; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 64; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ result |= 64; ++ } ++#endif ++ return result; ++}]])], ++ [gl_cv_func_printf_infinite_long_double=yes], ++ [gl_cv_func_printf_infinite_long_double=no], ++ [ ++changequote(,)dnl ++ case "$host_cpu" in ++ # Guess no on ia64, x86_64, i386. ++ ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; ++ *) ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; ++ # Guess yes on FreeBSD >= 6. ++ freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; ++ # Guess yes on HP-UX >= 11. ++ hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; ++ hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_infinite_long_double="guessing no";; ++ esac ++ ;; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++ ;; ++ *) ++ gl_cv_func_printf_infinite_long_double="irrelevant" ++ ;; ++ esac ++]) ++ ++dnl Test whether the *printf family of functions supports the 'a' and 'A' ++dnl conversion specifier for hexadecimal output of floating-point numbers. ++dnl (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_directive_a. ++ ++AC_DEFUN([gl_PRINTF_DIRECTIVE_A], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives], ++ [gl_cv_func_printf_directive_a], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++static char buf[100]; ++static double zero = 0.0; ++int main () ++{ ++ int result = 0; ++ if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 ++ || (strcmp (buf, "0x1.922p+1 33") != 0 ++ && strcmp (buf, "0x3.244p+0 33") != 0 ++ && strcmp (buf, "0x6.488p-1 33") != 0 ++ && strcmp (buf, "0xc.91p-2 33") != 0)) ++ result |= 1; ++ if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 ++ || (strcmp (buf, "-0X1.922P+1 33") != 0 ++ && strcmp (buf, "-0X3.244P+0 33") != 0 ++ && strcmp (buf, "-0X6.488P-1 33") != 0 ++ && strcmp (buf, "-0XC.91P-2 33") != 0)) ++ result |= 2; ++ /* This catches a FreeBSD 6.1 bug: it doesn't round. */ ++ if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 ++ || (strcmp (buf, "0x1.83p+0 33") != 0 ++ && strcmp (buf, "0x3.05p-1 33") != 0 ++ && strcmp (buf, "0x6.0ap-2 33") != 0 ++ && strcmp (buf, "0xc.14p-3 33") != 0)) ++ result |= 4; ++ /* This catches a FreeBSD 6.1 bug. See ++ */ ++ if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 ++ || buf[0] == '0') ++ result |= 8; ++ /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ ++ if (sprintf (buf, "%.1a", 1.999) < 0 ++ || (strcmp (buf, "0x1.0p+1") != 0 ++ && strcmp (buf, "0x2.0p+0") != 0 ++ && strcmp (buf, "0x4.0p-1") != 0 ++ && strcmp (buf, "0x8.0p-2") != 0)) ++ result |= 16; ++ /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a ++ glibc 2.4 bug . */ ++ if (sprintf (buf, "%.1La", 1.999L) < 0 ++ || (strcmp (buf, "0x1.0p+1") != 0 ++ && strcmp (buf, "0x2.0p+0") != 0 ++ && strcmp (buf, "0x4.0p-1") != 0 ++ && strcmp (buf, "0x8.0p-2") != 0)) ++ result |= 32; ++ return result; ++}]])], ++ [gl_cv_func_printf_directive_a=yes], ++ [gl_cv_func_printf_directive_a=no], ++ [ ++ case "$host_os" in ++ # Guess yes on glibc >= 2.5 systems. ++ *-gnu*) ++ AC_EGREP_CPP([BZ2908], [ ++ #include ++ #ifdef __GNU_LIBRARY__ ++ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__ ++ BZ2908 ++ #endif ++ #endif ++ ], ++ [gl_cv_func_printf_directive_a="guessing yes"], ++ [gl_cv_func_printf_directive_a="guessing no"]) ++ ;; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_directive_a="guessing no";; ++ esac ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports the %F format ++dnl directive. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_directive_f. ++ ++AC_DEFUN([gl_PRINTF_DIRECTIVE_F], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the 'F' directive], ++ [gl_cv_func_printf_directive_f], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++static char buf[100]; ++static double zero = 0.0; ++int main () ++{ ++ int result = 0; ++ if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 ++ || strcmp (buf, "1234567.000000 33") != 0) ++ result |= 1; ++ if (sprintf (buf, "%F", 1.0 / zero) < 0 ++ || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) ++ result |= 2; ++ /* This catches a Cygwin 1.5.x bug. */ ++ if (sprintf (buf, "%.F", 1234.0) < 0 ++ || strcmp (buf, "1234") != 0) ++ result |= 4; ++ return result; ++}]])], ++ [gl_cv_func_printf_directive_f=yes], ++ [gl_cv_func_printf_directive_f=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; ++ # Guess yes on FreeBSD >= 6. ++ freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; ++ darwin*) gl_cv_func_printf_directive_f="guessing yes";; ++ # Guess yes on Solaris >= 2.10. ++ solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ solaris*) gl_cv_func_printf_sizes_c99="guessing no";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_directive_f="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports the %n format ++dnl directive. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_directive_n. ++ ++AC_DEFUN([gl_PRINTF_DIRECTIVE_N], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the 'n' directive], ++ [gl_cv_func_printf_directive_n], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++#include ++#ifdef _MSC_VER ++/* See page about "Parameter Validation" on msdn.microsoft.com. */ ++static void cdecl ++invalid_parameter_handler (const wchar_t *expression, ++ const wchar_t *function, ++ const wchar_t *file, unsigned int line, ++ uintptr_t dummy) ++{ ++ exit (1); ++} ++#endif ++static char fmtstring[10]; ++static char buf[100]; ++int main () ++{ ++ int count = -1; ++#ifdef _MSC_VER ++ _set_invalid_parameter_handler (invalid_parameter_handler); ++#endif ++ /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) ++ support %n in format strings in read-only memory but not in writable ++ memory. */ ++ strcpy (fmtstring, "%d %n"); ++ if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 ++ || strcmp (buf, "123 ") != 0 ++ || count != 4) ++ return 1; ++ return 0; ++}]])], ++ [gl_cv_func_printf_directive_n=yes], ++ [gl_cv_func_printf_directive_n=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ mingw*) gl_cv_func_printf_directive_n="guessing no";; ++ *) gl_cv_func_printf_directive_n="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports the %ls format ++dnl directive and in particular, when a precision is specified, whether ++dnl the functions stop converting the wide string argument when the number ++dnl of bytes that have been produced by this conversion equals or exceeds ++dnl the precision. ++dnl Result is gl_cv_func_printf_directive_ls. ++ ++AC_DEFUN([gl_PRINTF_DIRECTIVE_LS], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the 'ls' directive], ++ [gl_cv_func_printf_directive_ls], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++/* Tru64 with Desktop Toolkit C has a bug: must be included before ++ . ++ BSD/OS 4.0.1 has a bug: , and must be ++ included before . */ ++#include ++#include ++#include ++#include ++#include ++int main () ++{ ++ int result = 0; ++ char buf[100]; ++ /* Test whether %ls works at all. ++ This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on ++ Cygwin 1.5. */ ++ { ++ static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%ls", wstring) < 0 ++ || strcmp (buf, "abc") != 0) ++ result |= 1; ++ } ++ /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an ++ assertion failure inside libc), but not on OpenBSD 4.0. */ ++ { ++ static const wchar_t wstring[] = { 'a', 0 }; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%ls", wstring) < 0 ++ || strcmp (buf, "a") != 0) ++ result |= 2; ++ } ++ /* Test whether precisions in %ls are supported as specified in ISO C 99 ++ section 7.19.6.1: ++ "If a precision is specified, no more than that many bytes are written ++ (including shift sequences, if any), and the array shall contain a ++ null wide character if, to equal the multibyte character sequence ++ length given by the precision, the function would need to access a ++ wide character one past the end of the array." ++ This test fails on Solaris 10. */ ++ { ++ static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 }; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%.2ls", wstring) < 0 ++ || strcmp (buf, "ab") != 0) ++ result |= 8; ++ } ++ return result; ++}]])], ++ [gl_cv_func_printf_directive_ls=yes], ++ [gl_cv_func_printf_directive_ls=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ openbsd*) gl_cv_func_printf_directive_ls="guessing no";; ++ irix*) gl_cv_func_printf_directive_ls="guessing no";; ++ solaris*) gl_cv_func_printf_directive_ls="guessing no";; ++ cygwin*) gl_cv_func_printf_directive_ls="guessing no";; ++ beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; ++ *) gl_cv_func_printf_directive_ls="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports POSIX/XSI format ++dnl strings with positions. (POSIX:2001) ++dnl Result is gl_cv_func_printf_positions. ++ ++AC_DEFUN([gl_PRINTF_POSITIONS], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions], ++ [gl_cv_func_printf_positions], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++/* The string "%2$d %1$d", with dollar characters protected from the shell's ++ dollar expansion (possibly an autoconf bug). */ ++static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; ++static char buf[100]; ++int main () ++{ ++ sprintf (buf, format, 33, 55); ++ return (strcmp (buf, "55 33") != 0); ++}]])], ++ [gl_cv_func_printf_positions=yes], ++ [gl_cv_func_printf_positions=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) ++ gl_cv_func_printf_positions="guessing no";; ++ beos*) gl_cv_func_printf_positions="guessing no";; ++ mingw* | pw*) gl_cv_func_printf_positions="guessing no";; ++ *) gl_cv_func_printf_positions="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports POSIX/XSI format ++dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001) ++dnl Result is gl_cv_func_printf_flag_grouping. ++ ++AC_DEFUN([gl_PRINTF_FLAG_GROUPING], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the grouping flag], ++ [gl_cv_func_printf_flag_grouping], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++static char buf[100]; ++int main () ++{ ++ if (sprintf (buf, "%'d %d", 1234567, 99) < 0 ++ || buf[strlen (buf) - 1] != '9') ++ return 1; ++ return 0; ++}]])], ++ [gl_cv_func_printf_flag_grouping=yes], ++ [gl_cv_func_printf_flag_grouping=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; ++ netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; ++ mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; ++ *) gl_cv_func_printf_flag_grouping="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports the - flag correctly. ++dnl (ISO C99.) See ++dnl ++dnl Result is gl_cv_func_printf_flag_leftadjust. ++ ++AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly], ++ [gl_cv_func_printf_flag_leftadjust], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++static char buf[100]; ++int main () ++{ ++ /* Check that a '-' flag is not annihilated by a negative width. */ ++ if (sprintf (buf, "a%-*sc", -3, "b") < 0 ++ || strcmp (buf, "ab c") != 0) ++ return 1; ++ return 0; ++}]])], ++ [gl_cv_func_printf_flag_leftadjust=yes], ++ [gl_cv_func_printf_flag_leftadjust=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on HP-UX 11. ++ hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; ++ # Guess no on HP-UX 10 and older. ++ hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; ++ # Guess yes otherwise. ++ *) gl_cv_func_printf_flag_leftadjust="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports padding of non-finite ++dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See ++dnl ++dnl Result is gl_cv_func_printf_flag_zero. ++ ++AC_DEFUN([gl_PRINTF_FLAG_ZERO], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the zero flag correctly], ++ [gl_cv_func_printf_flag_zero], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++static char buf[100]; ++static double zero = 0.0; ++int main () ++{ ++ if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0 ++ || (strcmp (buf, " inf") != 0 ++ && strcmp (buf, " infinity") != 0)) ++ return 1; ++ return 0; ++}]])], ++ [gl_cv_func_printf_flag_zero=yes], ++ [gl_cv_func_printf_flag_zero=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_printf_flag_zero="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_flag_zero="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports large precisions. ++dnl On mingw, precisions larger than 512 are treated like 512, in integer, ++dnl floating-point or pointer output. On Solaris 10/x86, precisions larger ++dnl than 510 in floating-point output crash the program. On Solaris 10/SPARC, ++dnl precisions larger than 510 in floating-point output yield wrong results. ++dnl On AIX 7.1, precisions larger than 998 in floating-point output yield ++dnl wrong results. On BeOS, precisions larger than 1044 crash the program. ++dnl Result is gl_cv_func_printf_precision. ++ ++AC_DEFUN([gl_PRINTF_PRECISION], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports large precisions], ++ [gl_cv_func_printf_precision], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++static char buf[5000]; ++int main () ++{ ++ int result = 0; ++#ifdef __BEOS__ ++ /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ ++ return 1; ++#endif ++ if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) ++ result |= 1; ++ if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5) ++ result |= 2; ++ if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5 ++ || buf[0] != '1') ++ result |= 4; ++ if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5 ++ || buf[0] != '1') ++ result |= 4; ++ return result; ++}]])], ++ [gl_cv_func_printf_precision=yes], ++ [gl_cv_func_printf_precision=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess no only on Solaris, native Win32, and BeOS systems. ++ solaris*) gl_cv_func_printf_precision="guessing no" ;; ++ mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; ++ beos*) gl_cv_func_printf_precision="guessing no" ;; ++ *) gl_cv_func_printf_precision="guessing yes" ;; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions recovers gracefully in case ++dnl of an out-of-memory condition, or whether it crashes the entire program. ++dnl Result is gl_cv_func_printf_enomem. ++ ++AC_DEFUN([gl_PRINTF_ENOMEM], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([gl_MULTIARCH]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf survives out-of-memory conditions], ++ [gl_cv_func_printf_enomem], ++ [ ++ gl_cv_func_printf_enomem="guessing no" ++ if test "$cross_compiling" = no; then ++ if test $APPLE_UNIVERSAL_BUILD = 0; then ++ AC_LANG_CONFTEST([AC_LANG_SOURCE([ ++]GL_NOCRASH[ ++changequote(,)dnl ++#include ++#include ++#include ++#include ++#include ++int main() ++{ ++ struct rlimit limit; ++ int ret; ++ nocrash_init (); ++ /* Some printf implementations allocate temporary space with malloc. */ ++ /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ ++#ifdef RLIMIT_DATA ++ if (getrlimit (RLIMIT_DATA, &limit) < 0) ++ return 77; ++ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) ++ limit.rlim_max = 5000000; ++ limit.rlim_cur = limit.rlim_max; ++ if (setrlimit (RLIMIT_DATA, &limit) < 0) ++ return 77; ++#endif ++ /* On Linux systems, malloc() is limited by RLIMIT_AS. */ ++#ifdef RLIMIT_AS ++ if (getrlimit (RLIMIT_AS, &limit) < 0) ++ return 77; ++ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) ++ limit.rlim_max = 5000000; ++ limit.rlim_cur = limit.rlim_max; ++ if (setrlimit (RLIMIT_AS, &limit) < 0) ++ return 77; ++#endif ++ /* Some printf implementations allocate temporary space on the stack. */ ++#ifdef RLIMIT_STACK ++ if (getrlimit (RLIMIT_STACK, &limit) < 0) ++ return 77; ++ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) ++ limit.rlim_max = 5000000; ++ limit.rlim_cur = limit.rlim_max; ++ if (setrlimit (RLIMIT_STACK, &limit) < 0) ++ return 77; ++#endif ++ ret = printf ("%.5000000f", 1.0); ++ return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); ++} ++changequote([,])dnl ++ ])]) ++ if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then ++ (./conftest ++ result=$? ++ if test $result != 0 && test $result != 77; then result=1; fi ++ exit $result ++ ) >/dev/null 2>/dev/null ++ case $? in ++ 0) gl_cv_func_printf_enomem="yes" ;; ++ 77) gl_cv_func_printf_enomem="guessing no" ;; ++ *) gl_cv_func_printf_enomem="no" ;; ++ esac ++ else ++ gl_cv_func_printf_enomem="guessing no" ++ fi ++ rm -fr conftest* ++ else ++ dnl A universal build on Apple MacOS X platforms. ++ dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode. ++ dnl But we need a configuration result that is valid in both modes. ++ gl_cv_func_printf_enomem="guessing no" ++ fi ++ fi ++ if test "$gl_cv_func_printf_enomem" = "guessing no"; then ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on Solaris. ++ solaris*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on AIX. ++ aix*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on HP-UX/hppa. ++ hpux*) case "$host_cpu" in ++ hppa*) gl_cv_func_printf_enomem="guessing yes";; ++ *) gl_cv_func_printf_enomem="guessing no";; ++ esac ++ ;; ++ # Guess yes on IRIX. ++ irix*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on OSF/1. ++ osf*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on Haiku. ++ haiku*) gl_cv_func_printf_enomem="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_enomem="guessing no";; ++ esac ++changequote([,])dnl ++ fi ++ ]) ++]) ++ ++dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001) ++dnl Result is ac_cv_func_snprintf. ++ ++AC_DEFUN([gl_SNPRINTF_PRESENCE], ++[ ++ AC_CHECK_FUNCS_ONCE([snprintf]) ++]) ++ ++dnl Test whether the string produced by the snprintf function is always NUL ++dnl terminated. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_snprintf_truncation_c99. ++ ++AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_REQUIRE([gl_SNPRINTF_PRESENCE]) ++ AC_CACHE_CHECK([whether snprintf truncates the result as in C99], ++ [gl_cv_func_snprintf_truncation_c99], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++#if HAVE_SNPRINTF ++# define my_snprintf snprintf ++#else ++# include ++static int my_snprintf (char *buf, int size, const char *format, ...) ++{ ++ va_list args; ++ int ret; ++ va_start (args, format); ++ ret = vsnprintf (buf, size, format, args); ++ va_end (args); ++ return ret; ++} ++#endif ++static char buf[100]; ++int main () ++{ ++ strcpy (buf, "ABCDEF"); ++ my_snprintf (buf, 3, "%d %d", 4567, 89); ++ if (memcmp (buf, "45\0DEF", 6) != 0) ++ return 1; ++ return 0; ++}]])], ++ [gl_cv_func_snprintf_truncation_c99=yes], ++ [gl_cv_func_snprintf_truncation_c99=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on FreeBSD >= 5. ++ freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on OpenBSD >= 3.9. ++ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) ++ gl_cv_func_snprintf_truncation_c99="guessing no";; ++ openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on Solaris >= 2.6. ++ solaris2.[0-5] | solaris2.[0-5].*) ++ gl_cv_func_snprintf_truncation_c99="guessing no";; ++ solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on AIX >= 4. ++ aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on HP-UX >= 11. ++ hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on IRIX >= 6.5. ++ irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on OSF/1 >= 5. ++ osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_snprintf_truncation_c99="guessing no";; ++ netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the return value of the snprintf function is the number ++dnl of bytes (excluding the terminating NUL) that would have been produced ++dnl if the buffer had been large enough. (ISO C99, POSIX:2001) ++dnl For example, this test program fails on IRIX 6.5: ++dnl --------------------------------------------------------------------- ++dnl #include ++dnl int main() ++dnl { ++dnl static char buf[8]; ++dnl int retval = snprintf (buf, 3, "%d", 12345); ++dnl return retval >= 0 && retval < 3; ++dnl } ++dnl --------------------------------------------------------------------- ++dnl Result is gl_cv_func_snprintf_retval_c99. ++ ++AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_REQUIRE([gl_SNPRINTF_PRESENCE]) ++ AC_CACHE_CHECK([whether snprintf returns a byte count as in C99], ++ [gl_cv_func_snprintf_retval_c99], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++#if HAVE_SNPRINTF ++# define my_snprintf snprintf ++#else ++# include ++static int my_snprintf (char *buf, int size, const char *format, ...) ++{ ++ va_list args; ++ int ret; ++ va_start (args, format); ++ ret = vsnprintf (buf, size, format, args); ++ va_end (args); ++ return ret; ++} ++#endif ++static char buf[100]; ++int main () ++{ ++ strcpy (buf, "ABCDEF"); ++ if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7) ++ return 1; ++ if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7) ++ return 2; ++ if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7) ++ return 3; ++ return 0; ++}]])], ++ [gl_cv_func_snprintf_retval_c99=yes], ++ [gl_cv_func_snprintf_retval_c99=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on FreeBSD >= 5. ++ freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; ++ darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on OpenBSD >= 3.9. ++ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) ++ gl_cv_func_snprintf_retval_c99="guessing no";; ++ openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on Solaris >= 2.10. ++ solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ solaris*) gl_cv_func_printf_sizes_c99="guessing no";; ++ # Guess yes on AIX >= 4. ++ aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; ++ aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_snprintf_retval_c99="guessing no";; ++ netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_snprintf_retval_c99="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the snprintf function supports the %n format directive ++dnl also in truncated portions of the format string. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_snprintf_directive_n. ++ ++AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_REQUIRE([gl_SNPRINTF_PRESENCE]) ++ AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive], ++ [gl_cv_func_snprintf_directive_n], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++#if HAVE_SNPRINTF ++# define my_snprintf snprintf ++#else ++# include ++static int my_snprintf (char *buf, int size, const char *format, ...) ++{ ++ va_list args; ++ int ret; ++ va_start (args, format); ++ ret = vsnprintf (buf, size, format, args); ++ va_end (args); ++ return ret; ++} ++#endif ++static char fmtstring[10]; ++static char buf[100]; ++int main () ++{ ++ int count = -1; ++ /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) ++ support %n in format strings in read-only memory but not in writable ++ memory. */ ++ strcpy (fmtstring, "%d %n"); ++ my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); ++ if (count != 6) ++ return 1; ++ return 0; ++}]])], ++ [gl_cv_func_snprintf_directive_n=yes], ++ [gl_cv_func_snprintf_directive_n=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on FreeBSD >= 5. ++ freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; ++ darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on Solaris >= 2.6. ++ solaris2.[0-5] | solaris2.[0-5].*) ++ gl_cv_func_snprintf_directive_n="guessing no";; ++ solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on AIX >= 4. ++ aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; ++ aix*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on IRIX >= 6.5. ++ irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on OSF/1 >= 5. ++ osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; ++ osf*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_snprintf_directive_n="guessing no";; ++ netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_snprintf_directive_n="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the snprintf function, when passed a size = 1, writes any ++dnl output without bounds in this case, behaving like sprintf. This is the ++dnl case on Linux libc5. ++dnl Result is gl_cv_func_snprintf_size1. ++ ++AC_DEFUN([gl_SNPRINTF_SIZE1], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([gl_SNPRINTF_PRESENCE]) ++ AC_CACHE_CHECK([whether snprintf respects a size of 1], ++ [gl_cv_func_snprintf_size1], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#if HAVE_SNPRINTF ++# define my_snprintf snprintf ++#else ++# include ++static int my_snprintf (char *buf, int size, const char *format, ...) ++{ ++ va_list args; ++ int ret; ++ va_start (args, format); ++ ret = vsnprintf (buf, size, format, args); ++ va_end (args); ++ return ret; ++} ++#endif ++int main() ++{ ++ static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; ++ my_snprintf (buf, 1, "%d", 12345); ++ return buf[1] != 'E'; ++}]])], ++ [gl_cv_func_snprintf_size1=yes], ++ [gl_cv_func_snprintf_size1=no], ++ [gl_cv_func_snprintf_size1="guessing yes"]) ++ ]) ++]) ++ ++dnl Test whether the vsnprintf function, when passed a zero size, produces no ++dnl output. (ISO C99, POSIX:2001) ++dnl For example, snprintf nevertheless writes a NUL byte in this case ++dnl on OSF/1 5.1: ++dnl --------------------------------------------------------------------- ++dnl #include ++dnl int main() ++dnl { ++dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; ++dnl snprintf (buf, 0, "%d", 12345); ++dnl return buf[0] != 'D'; ++dnl } ++dnl --------------------------------------------------------------------- ++dnl And vsnprintf writes any output without bounds in this case, behaving like ++dnl vsprintf, on HP-UX 11 and OSF/1 5.1: ++dnl --------------------------------------------------------------------- ++dnl #include ++dnl #include ++dnl static int my_snprintf (char *buf, int size, const char *format, ...) ++dnl { ++dnl va_list args; ++dnl int ret; ++dnl va_start (args, format); ++dnl ret = vsnprintf (buf, size, format, args); ++dnl va_end (args); ++dnl return ret; ++dnl } ++dnl int main() ++dnl { ++dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; ++dnl my_snprintf (buf, 0, "%d", 12345); ++dnl return buf[0] != 'D'; ++dnl } ++dnl --------------------------------------------------------------------- ++dnl Result is gl_cv_func_vsnprintf_zerosize_c99. ++ ++AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99], ++ [gl_cv_func_vsnprintf_zerosize_c99], ++ [ ++ AC_RUN_IFELSE( ++ [AC_LANG_SOURCE([[ ++#include ++#include ++static int my_snprintf (char *buf, int size, const char *format, ...) ++{ ++ va_list args; ++ int ret; ++ va_start (args, format); ++ ret = vsnprintf (buf, size, format, args); ++ va_end (args); ++ return ret; ++} ++int main() ++{ ++ static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; ++ my_snprintf (buf, 0, "%d", 12345); ++ return buf[0] != 'D'; ++}]])], ++ [gl_cv_func_vsnprintf_zerosize_c99=yes], ++ [gl_cv_func_vsnprintf_zerosize_c99=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on FreeBSD >= 5. ++ freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on Cygwin. ++ cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on Solaris >= 2.6. ++ solaris2.[0-5] | solaris2.[0-5].*) ++ gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on AIX >= 4. ++ aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on IRIX >= 6.5. ++ irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on mingw. ++ mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl The results of these tests on various platforms are: ++dnl ++dnl 1 = gl_PRINTF_SIZES_C99 ++dnl 2 = gl_PRINTF_LONG_DOUBLE ++dnl 3 = gl_PRINTF_INFINITE ++dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE ++dnl 5 = gl_PRINTF_DIRECTIVE_A ++dnl 6 = gl_PRINTF_DIRECTIVE_F ++dnl 7 = gl_PRINTF_DIRECTIVE_N ++dnl 8 = gl_PRINTF_DIRECTIVE_LS ++dnl 9 = gl_PRINTF_POSITIONS ++dnl 10 = gl_PRINTF_FLAG_GROUPING ++dnl 11 = gl_PRINTF_FLAG_LEFTADJUST ++dnl 12 = gl_PRINTF_FLAG_ZERO ++dnl 13 = gl_PRINTF_PRECISION ++dnl 14 = gl_PRINTF_ENOMEM ++dnl 15 = gl_SNPRINTF_PRESENCE ++dnl 16 = gl_SNPRINTF_TRUNCATION_C99 ++dnl 17 = gl_SNPRINTF_RETVAL_C99 ++dnl 18 = gl_SNPRINTF_DIRECTIVE_N ++dnl 19 = gl_SNPRINTF_SIZE1 ++dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99 ++dnl ++dnl 1 = checking whether printf supports size specifiers as in C99... ++dnl 2 = checking whether printf supports 'long double' arguments... ++dnl 3 = checking whether printf supports infinite 'double' arguments... ++dnl 4 = checking whether printf supports infinite 'long double' arguments... ++dnl 5 = checking whether printf supports the 'a' and 'A' directives... ++dnl 6 = checking whether printf supports the 'F' directive... ++dnl 7 = checking whether printf supports the 'n' directive... ++dnl 8 = checking whether printf supports the 'ls' directive... ++dnl 9 = checking whether printf supports POSIX/XSI format strings with positions... ++dnl 10 = checking whether printf supports the grouping flag... ++dnl 11 = checking whether printf supports the left-adjust flag correctly... ++dnl 12 = checking whether printf supports the zero flag correctly... ++dnl 13 = checking whether printf supports large precisions... ++dnl 14 = checking whether printf survives out-of-memory conditions... ++dnl 15 = checking for snprintf... ++dnl 16 = checking whether snprintf truncates the result as in C99... ++dnl 17 = checking whether snprintf returns a byte count as in C99... ++dnl 18 = checking whether snprintf fully supports the 'n' directive... ++dnl 19 = checking whether snprintf respects a size of 1... ++dnl 20 = checking whether vsnprintf respects a zero size as in C99... ++dnl ++dnl . = yes, # = no. ++dnl ++dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ++dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . ++dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . ++dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . ++dnl MacOS X 10.5.8 . . . # # . . . . . . # . . . . . . . . ++dnl MacOS X 10.3.9 . . . . # . . . . . . # . # . . . . . . ++dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . ++dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . ++dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . ++dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . ++dnl Solaris 11 2010-11 . . # # # . . # . . . # . . . . . . . . ++dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . ++dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . ++dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # ++dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . . ++dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . . ++dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . . ++dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . ++dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # ++dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # ++dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . ++dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # ++dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # ++dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . ++dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? ++dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . ++dnl Haiku . . . # # # . # . . . . . ? . . ? . . . ++dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . ++dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . ++dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . ++dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . ++dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . . +diff --git a/xbmc/screensavers/rsxs-0.9/m4/rawmemchr.m4 b/xbmc/screensavers/rsxs-0.9/m4/rawmemchr.m4 +new file mode 100644 +index 0000000..3f136a6 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/rawmemchr.m4 +@@ -0,0 +1,20 @@ ++# rawmemchr.m4 serial 2 ++dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_FUNC_RAWMEMCHR], ++[ ++ dnl Persuade glibc to declare rawmemchr(). ++ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ++ ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) ++ AC_CHECK_FUNCS([rawmemchr]) ++ if test $ac_cv_func_rawmemchr = no; then ++ HAVE_RAWMEMCHR=0 ++ fi ++]) ++ ++# Prerequisites of lib/strchrnul.c. ++AC_DEFUN([gl_PREREQ_RAWMEMCHR], [:]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/size_max.m4 b/xbmc/screensavers/rsxs-0.9/m4/size_max.m4 +index 029e471..e807098 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/size_max.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/size_max.m4 +@@ -1,5 +1,5 @@ +-# size_max.m4 serial 4 +-dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc. ++# size_max.m4 serial 10 ++dnl Copyright (C) 2003, 2005-2006, 2008-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -8,11 +8,11 @@ dnl From Bruno Haible. + + AC_DEFUN([gl_SIZE_MAX], + [ +- AC_CHECK_HEADERS(stdint.h) ++ AC_CHECK_HEADERS([stdint.h]) + dnl First test whether the system already has SIZE_MAX. +- AC_MSG_CHECKING([for SIZE_MAX]) +- result= +- AC_EGREP_CPP([Found it], [ ++ AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ ++ gl_cv_size_max= ++ AC_EGREP_CPP([Found it], [ + #include + #if HAVE_STDINT_H + #include +@@ -20,41 +20,60 @@ AC_DEFUN([gl_SIZE_MAX], + #ifdef SIZE_MAX + Found it + #endif +-], result=yes) +- if test -z "$result"; then +- dnl Define it ourselves. Here we assume that the type 'size_t' is not wider +- dnl than the type 'unsigned long'. Try hard to find a definition that can +- dnl be used in a preprocessor #if, i.e. doesn't contain a cast. +- _AC_COMPUTE_INT([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1, +- [#include +-#include ], size_t_bits_minus_1=) +- _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, +- [#include ], fits_in_uint=) +- if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then +- if test $fits_in_uint = 1; then +- dnl Even though SIZE_MAX fits in an unsigned int, it must be of type +- dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. +- AC_TRY_COMPILE([#include +- extern size_t foo; +- extern unsigned long foo; +- ], [], fits_in_uint=0) +- fi +- dnl We cannot use 'expr' to simplify this expression, because 'expr' +- dnl works only with 'long' integers in the host environment, while we +- dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. +- if test $fits_in_uint = 1; then +- result="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" ++], [gl_cv_size_max=yes]) ++ if test -z "$gl_cv_size_max"; then ++ dnl Define it ourselves. Here we assume that the type 'size_t' is not wider ++ dnl than the type 'unsigned long'. Try hard to find a definition that can ++ dnl be used in a preprocessor #if, i.e. doesn't contain a cast. ++ AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], ++ [#include ++#include ], [size_t_bits_minus_1=]) ++ AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], ++ [#include ], [fits_in_uint=]) ++ if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then ++ if test $fits_in_uint = 1; then ++ dnl Even though SIZE_MAX fits in an unsigned int, it must be of type ++ dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. ++ AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ++ extern size_t foo; ++ extern unsigned long foo; ++ ]], ++ [[]])], ++ [fits_in_uint=0]) ++ fi ++ dnl We cannot use 'expr' to simplify this expression, because 'expr' ++ dnl works only with 'long' integers in the host environment, while we ++ dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. ++ if test $fits_in_uint = 1; then ++ gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" ++ else ++ gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" ++ fi + else +- result="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" ++ dnl Shouldn't happen, but who knows... ++ gl_cv_size_max='((size_t)~(size_t)0)' + fi +- else +- dnl Shouldn't happen, but who knows... +- result='((size_t)~(size_t)0)' + fi +- fi +- AC_MSG_RESULT([$result]) +- if test "$result" != yes; then +- AC_DEFINE_UNQUOTED([SIZE_MAX], [$result], ++ ]) ++ if test "$gl_cv_size_max" != yes; then ++ AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], + [Define as the maximum value of type 'size_t', if the system doesn't define it.]) + fi ++ dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after ++ dnl . Remember that the #undef in AH_VERBATIM gets replaced with ++ dnl #define by AC_DEFINE_UNQUOTED. ++ AH_VERBATIM([SIZE_MAX], ++[/* Define as the maximum value of type 'size_t', if the system doesn't define ++ it. */ ++#ifndef SIZE_MAX ++# undef SIZE_MAX ++#endif]) ++]) ++ ++dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. ++dnl Remove this when we can assume autoconf >= 2.61. ++m4_ifdef([AC_COMPUTE_INT], [], [ ++ AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/sleep.m4 b/xbmc/screensavers/rsxs-0.9/m4/sleep.m4 +new file mode 100644 +index 0000000..74362e49 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/sleep.m4 +@@ -0,0 +1,52 @@ ++# sleep.m4 serial 6 ++dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_FUNC_SLEEP], ++[ ++ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) ++ dnl We expect to see the declaration of sleep() in a header file. ++ dnl Older versions of mingw have a sleep() function that is an alias to ++ dnl _sleep() in MSVCRT. It has a different signature than POSIX sleep(): ++ dnl it takes the number of milliseconds as argument and returns void. ++ dnl mingw does not declare this function. ++ AC_CHECK_DECLS([sleep], , , [[#include ]]) ++ AC_CHECK_FUNCS_ONCE([sleep]) ++ if test $ac_cv_have_decl_sleep != yes; then ++ HAVE_SLEEP=0 ++ else ++ dnl Cygwin 1.5.x has a bug where sleep can't exceed 49.7 days. ++ AC_CACHE_CHECK([for working sleep], [gl_cv_func_sleep_works], ++ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ++#include ++#include ++#include ++static void ++handle_alarm (int sig) ++{ ++ if (sig != SIGALRM) ++ _exit (2); ++} ++]], [[ ++ /* Failure to compile this test due to missing alarm is okay, ++ since all such platforms (mingw) also lack sleep. */ ++ unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days. */ ++ unsigned int remaining; ++ signal (SIGALRM, handle_alarm); ++ alarm (1); ++ remaining = sleep (pentecost); ++ if (remaining > pentecost) ++ return 3; ++ if (remaining <= pentecost - 10) ++ return 4; ++ return 0; ++ ]])], ++ [gl_cv_func_sleep_works=yes], [gl_cv_func_sleep_works=no], ++ [gl_cv_func_sleep_works="guessing no"])]) ++ if test "$gl_cv_func_sleep_works" != yes; then ++ REPLACE_SLEEP=1 ++ fi ++ fi ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/ssize_t.m4 b/xbmc/screensavers/rsxs-0.9/m4/ssize_t.m4 +new file mode 100644 +index 0000000..d712752 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/ssize_t.m4 +@@ -0,0 +1,23 @@ ++# ssize_t.m4 serial 5 (gettext-0.18.2) ++dnl Copyright (C) 2001-2003, 2006, 2010-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Bruno Haible. ++dnl Test whether ssize_t is defined. ++ ++AC_DEFUN([gt_TYPE_SSIZE_T], ++[ ++ AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ]], ++ [[int x = sizeof (ssize_t *) + sizeof (ssize_t); ++ return !x;]])], ++ [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) ++ if test $gt_cv_ssize_t = no; then ++ AC_DEFINE([ssize_t], [int], ++ [Define as a signed type of the same size as size_t.]) ++ fi ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/stdalign.m4 b/xbmc/screensavers/rsxs-0.9/m4/stdalign.m4 +new file mode 100644 +index 0000000..2641dce +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/stdalign.m4 +@@ -0,0 +1,37 @@ ++# Check for stdalign.h that conforms to C1x. ++ ++dnl Copyright 2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++# Prepare for substituting if it is not supported. ++ ++AC_DEFUN([gl_STDALIGN_H], ++[ ++ AC_CACHE_CHECK([for working stdalign.h], ++ [gl_cv_header_working_stdalign_h], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ++ int align_int = alignof (int) + _Alignof (double); ++ ++ /* Test _Alignas only on platforms where gnulib can help. */ ++ #if \ ++ (__GNUC__ || __IBMC__ || __IBMCPP__ \ ++ || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER) ++ int alignas (8) alignas_int = 1; ++ #endif ++ ]])], ++ [gl_cv_header_working_stdalign_h=yes], ++ [gl_cv_header_working_stdalign_h=no])]) ++ ++ if test $gl_cv_header_working_stdalign_h = yes; then ++ STDALIGN_H='' ++ else ++ STDALIGN_H='stdalign.h' ++ fi ++ ++ AC_SUBST([STDALIGN_H]) ++ AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/stdbool.m4 b/xbmc/screensavers/rsxs-0.9/m4/stdbool.m4 +index 2204ecd..1ebf3e6 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/stdbool.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/stdbool.m4 +@@ -1,15 +1,17 @@ + # Check for stdbool.h that conforms to C99. + +-dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. ++dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + ++#serial 5 ++ + # Prepare for substituting if it is not supported. + + AC_DEFUN([AM_STDBOOL_H], + [ +- AC_REQUIRE([AC_HEADER_STDBOOL]) ++ AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) + + # Define two additional variables used in the Makefile substitution. + +@@ -19,6 +21,7 @@ AC_DEFUN([AM_STDBOOL_H], + STDBOOL_H='stdbool.h' + fi + AC_SUBST([STDBOOL_H]) ++ AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) + + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 +@@ -31,85 +34,67 @@ AC_DEFUN([AM_STDBOOL_H], + # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. + AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) + +-# This macro is only needed in autoconf <= 2.59. Newer versions of autoconf +-# have this macro built-in. ++# This version of the macro is needed in autoconf <= 2.68. + +-AC_DEFUN([AC_HEADER_STDBOOL], ++AC_DEFUN([AC_CHECK_HEADER_STDBOOL], + [AC_CACHE_CHECK([for stdbool.h that conforms to C99], + [ac_cv_header_stdbool_h], +- [AC_TRY_COMPILE( +- [ +- #include +- #ifndef bool +- "error: bool is not defined" +- #endif +- #ifndef false +- "error: false is not defined" +- #endif +- #if false +- "error: false is not 0" +- #endif +- #ifndef true +- "error: true is not defined" +- #endif +- #if true != 1 +- "error: true is not 1" +- #endif +- #ifndef __bool_true_false_are_defined +- "error: __bool_true_false_are_defined is not defined" +- #endif ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[ ++ #include ++ #ifndef bool ++ "error: bool is not defined" ++ #endif ++ #ifndef false ++ "error: false is not defined" ++ #endif ++ #if false ++ "error: false is not 0" ++ #endif ++ #ifndef true ++ "error: true is not defined" ++ #endif ++ #if true != 1 ++ "error: true is not 1" ++ #endif ++ #ifndef __bool_true_false_are_defined ++ "error: __bool_true_false_are_defined is not defined" ++ #endif + +- struct s { _Bool s: 1; _Bool t; } s; ++ struct s { _Bool s: 1; _Bool t; } s; + +- char a[true == 1 ? 1 : -1]; +- char b[false == 0 ? 1 : -1]; +- char c[__bool_true_false_are_defined == 1 ? 1 : -1]; +- char d[(bool) 0.5 == true ? 1 : -1]; +- bool e = &s; +- char f[(_Bool) 0.0 == false ? 1 : -1]; +- char g[true]; +- char h[sizeof (_Bool)]; +- char i[sizeof s.t]; +- enum { j = false, k = true, l = false * true, m = true * 256 }; +- _Bool n[m]; +- char o[sizeof n == m * sizeof n[0] ? 1 : -1]; +- char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; +- #if defined __xlc__ || defined __GNUC__ +- /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 +- reported by James Lemley on 2005-10-05; see +- http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html +- This test is not quite right, since xlc is allowed to +- reject this program, as the initializer for xlcbug is +- not one of the forms that C requires support for. +- However, doing the test right would require a run-time +- test, and that would make cross-compilation harder. +- Let us hope that IBM fixes the xlc bug, and also adds +- support for this kind of constant expression. In the +- meantime, this test will reject xlc, which is OK, since +- our stdbool.h substitute should suffice. We also test +- this with GCC, where it should work, to detect more +- quickly whether someone messes up the test in the +- future. */ +- char digs[] = "0123456789"; +- int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); +- #endif +- /* Catch a bug in an HP-UX C compiler. See +- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html +- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html +- */ +- _Bool q = true; +- _Bool *pq = &q; +- ], +- [ +- *pq |= q; +- *pq |= ! q; +- /* Refer to every declared value, to avoid compiler optimizations. */ +- return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l +- + !m + !n + !o + !p + !q + !pq); +- ], +- [ac_cv_header_stdbool_h=yes], +- [ac_cv_header_stdbool_h=no])]) ++ char a[true == 1 ? 1 : -1]; ++ char b[false == 0 ? 1 : -1]; ++ char c[__bool_true_false_are_defined == 1 ? 1 : -1]; ++ char d[(bool) 0.5 == true ? 1 : -1]; ++ /* See body of main program for 'e'. */ ++ char f[(_Bool) 0.0 == false ? 1 : -1]; ++ char g[true]; ++ char h[sizeof (_Bool)]; ++ char i[sizeof s.t]; ++ enum { j = false, k = true, l = false * true, m = true * 256 }; ++ /* The following fails for ++ HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ ++ _Bool n[m]; ++ char o[sizeof n == m * sizeof n[0] ? 1 : -1]; ++ char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; ++ /* Catch a bug in an HP-UX C compiler. See ++ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html ++ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html ++ */ ++ _Bool q = true; ++ _Bool *pq = &q; ++ ]], ++ [[ ++ bool e = &s; ++ *pq |= q; ++ *pq |= ! q; ++ /* Refer to every declared value, to avoid compiler optimizations. */ ++ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l ++ + !m + !n + !o + !p + !q + !pq); ++ ]])], ++ [ac_cv_header_stdbool_h=yes], ++ [ac_cv_header_stdbool_h=no])]) + AC_CHECK_TYPES([_Bool]) +- if test $ac_cv_header_stdbool_h = yes; then +- AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.]) +- fi]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/stddef_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/stddef_h.m4 +new file mode 100644 +index 0000000..1ae2344 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/stddef_h.m4 +@@ -0,0 +1,47 @@ ++dnl A placeholder for POSIX 2008 , for platforms that have issues. ++# stddef_h.m4 serial 4 ++dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_STDDEF_H], ++[ ++ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) ++ AC_REQUIRE([gt_TYPE_WCHAR_T]) ++ STDDEF_H= ++ if test $gt_cv_c_wchar_t = no; then ++ HAVE_WCHAR_T=0 ++ STDDEF_H=stddef.h ++ fi ++ AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], ++ [gl_cv_decl_null_works], ++ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ++ int test[2 * (sizeof NULL == sizeof (void *)) -1]; ++]])], ++ [gl_cv_decl_null_works=yes], ++ [gl_cv_decl_null_works=no])]) ++ if test $gl_cv_decl_null_works = no; then ++ REPLACE_NULL=1 ++ STDDEF_H=stddef.h ++ fi ++ AC_SUBST([STDDEF_H]) ++ AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) ++ if test -n "$STDDEF_H"; then ++ gl_NEXT_HEADERS([stddef.h]) ++ fi ++]) ++ ++AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) ++ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ++]) ++ ++AC_DEFUN([gl_STDDEF_H_DEFAULTS], ++[ ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) ++ HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/stdint.m4 b/xbmc/screensavers/rsxs-0.9/m4/stdint.m4 +new file mode 100644 +index 0000000..092161c +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/stdint.m4 +@@ -0,0 +1,488 @@ ++# stdint.m4 serial 41 ++dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Paul Eggert and Bruno Haible. ++dnl Test whether is supported or must be substituted. ++ ++AC_DEFUN_ONCE([gl_STDINT_H], ++[ ++ AC_PREREQ([2.59])dnl ++ ++ dnl Check for long long int and unsigned long long int. ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ++ if test $ac_cv_type_long_long_int = yes; then ++ HAVE_LONG_LONG_INT=1 ++ else ++ HAVE_LONG_LONG_INT=0 ++ fi ++ AC_SUBST([HAVE_LONG_LONG_INT]) ++ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) ++ if test $ac_cv_type_unsigned_long_long_int = yes; then ++ HAVE_UNSIGNED_LONG_LONG_INT=1 ++ else ++ HAVE_UNSIGNED_LONG_LONG_INT=0 ++ fi ++ AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) ++ ++ dnl Check for , in the same way as gl_WCHAR_H does. ++ AC_CHECK_HEADERS_ONCE([wchar.h]) ++ if test $ac_cv_header_wchar_h = yes; then ++ HAVE_WCHAR_H=1 ++ else ++ HAVE_WCHAR_H=0 ++ fi ++ AC_SUBST([HAVE_WCHAR_H]) ++ ++ dnl Check for . ++ dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. ++ if test $ac_cv_header_inttypes_h = yes; then ++ HAVE_INTTYPES_H=1 ++ else ++ HAVE_INTTYPES_H=0 ++ fi ++ AC_SUBST([HAVE_INTTYPES_H]) ++ ++ dnl Check for . ++ dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h. ++ if test $ac_cv_header_sys_types_h = yes; then ++ HAVE_SYS_TYPES_H=1 ++ else ++ HAVE_SYS_TYPES_H=0 ++ fi ++ AC_SUBST([HAVE_SYS_TYPES_H]) ++ ++ gl_CHECK_NEXT_HEADERS([stdint.h]) ++ if test $ac_cv_header_stdint_h = yes; then ++ HAVE_STDINT_H=1 ++ else ++ HAVE_STDINT_H=0 ++ fi ++ AC_SUBST([HAVE_STDINT_H]) ++ ++ dnl Now see whether we need a substitute . ++ if test $ac_cv_header_stdint_h = yes; then ++ AC_CACHE_CHECK([whether stdint.h conforms to C99], ++ [gl_cv_header_working_stdint_h], ++ [gl_cv_header_working_stdint_h=no ++ AC_COMPILE_IFELSE([ ++ AC_LANG_PROGRAM([[ ++#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ ++#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ ++#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ ++#include ++/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ ++#if !(defined WCHAR_MIN && defined WCHAR_MAX) ++#error "WCHAR_MIN, WCHAR_MAX not defined in " ++#endif ++] ++gl_STDINT_INCLUDES ++[ ++#ifdef INT8_MAX ++int8_t a1 = INT8_MAX; ++int8_t a1min = INT8_MIN; ++#endif ++#ifdef INT16_MAX ++int16_t a2 = INT16_MAX; ++int16_t a2min = INT16_MIN; ++#endif ++#ifdef INT32_MAX ++int32_t a3 = INT32_MAX; ++int32_t a3min = INT32_MIN; ++#endif ++#ifdef INT64_MAX ++int64_t a4 = INT64_MAX; ++int64_t a4min = INT64_MIN; ++#endif ++#ifdef UINT8_MAX ++uint8_t b1 = UINT8_MAX; ++#else ++typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; ++#endif ++#ifdef UINT16_MAX ++uint16_t b2 = UINT16_MAX; ++#endif ++#ifdef UINT32_MAX ++uint32_t b3 = UINT32_MAX; ++#endif ++#ifdef UINT64_MAX ++uint64_t b4 = UINT64_MAX; ++#endif ++int_least8_t c1 = INT8_C (0x7f); ++int_least8_t c1max = INT_LEAST8_MAX; ++int_least8_t c1min = INT_LEAST8_MIN; ++int_least16_t c2 = INT16_C (0x7fff); ++int_least16_t c2max = INT_LEAST16_MAX; ++int_least16_t c2min = INT_LEAST16_MIN; ++int_least32_t c3 = INT32_C (0x7fffffff); ++int_least32_t c3max = INT_LEAST32_MAX; ++int_least32_t c3min = INT_LEAST32_MIN; ++int_least64_t c4 = INT64_C (0x7fffffffffffffff); ++int_least64_t c4max = INT_LEAST64_MAX; ++int_least64_t c4min = INT_LEAST64_MIN; ++uint_least8_t d1 = UINT8_C (0xff); ++uint_least8_t d1max = UINT_LEAST8_MAX; ++uint_least16_t d2 = UINT16_C (0xffff); ++uint_least16_t d2max = UINT_LEAST16_MAX; ++uint_least32_t d3 = UINT32_C (0xffffffff); ++uint_least32_t d3max = UINT_LEAST32_MAX; ++uint_least64_t d4 = UINT64_C (0xffffffffffffffff); ++uint_least64_t d4max = UINT_LEAST64_MAX; ++int_fast8_t e1 = INT_FAST8_MAX; ++int_fast8_t e1min = INT_FAST8_MIN; ++int_fast16_t e2 = INT_FAST16_MAX; ++int_fast16_t e2min = INT_FAST16_MIN; ++int_fast32_t e3 = INT_FAST32_MAX; ++int_fast32_t e3min = INT_FAST32_MIN; ++int_fast64_t e4 = INT_FAST64_MAX; ++int_fast64_t e4min = INT_FAST64_MIN; ++uint_fast8_t f1 = UINT_FAST8_MAX; ++uint_fast16_t f2 = UINT_FAST16_MAX; ++uint_fast32_t f3 = UINT_FAST32_MAX; ++uint_fast64_t f4 = UINT_FAST64_MAX; ++#ifdef INTPTR_MAX ++intptr_t g = INTPTR_MAX; ++intptr_t gmin = INTPTR_MIN; ++#endif ++#ifdef UINTPTR_MAX ++uintptr_t h = UINTPTR_MAX; ++#endif ++intmax_t i = INTMAX_MAX; ++uintmax_t j = UINTMAX_MAX; ++ ++#include /* for CHAR_BIT */ ++#define TYPE_MINIMUM(t) \ ++ ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) ++#define TYPE_MAXIMUM(t) \ ++ ((t) ((t) 0 < (t) -1 \ ++ ? (t) -1 \ ++ : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) ++struct s { ++ int check_PTRDIFF: ++ PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) ++ && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) ++ ? 1 : -1; ++ /* Detect bug in FreeBSD 6.0 / ia64. */ ++ int check_SIG_ATOMIC: ++ SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) ++ && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) ++ ? 1 : -1; ++ int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; ++ int check_WCHAR: ++ WCHAR_MIN == TYPE_MINIMUM (wchar_t) ++ && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) ++ ? 1 : -1; ++ /* Detect bug in mingw. */ ++ int check_WINT: ++ WINT_MIN == TYPE_MINIMUM (wint_t) ++ && WINT_MAX == TYPE_MAXIMUM (wint_t) ++ ? 1 : -1; ++ ++ /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ ++ int check_UINT8_C: ++ (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; ++ int check_UINT16_C: ++ (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; ++ ++ /* Detect bugs in OpenBSD 3.9 stdint.h. */ ++#ifdef UINT8_MAX ++ int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; ++#endif ++#ifdef UINT16_MAX ++ int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; ++#endif ++#ifdef UINT32_MAX ++ int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; ++#endif ++#ifdef UINT64_MAX ++ int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; ++#endif ++ int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; ++ int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; ++ int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; ++ int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; ++ int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; ++ int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; ++ int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; ++ int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; ++ int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; ++ int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; ++ int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; ++}; ++ ]])], ++ [dnl Determine whether the various *_MIN, *_MAX macros are usable ++ dnl in preprocessor expression. We could do it by compiling a test ++ dnl program for each of these macros. It is faster to run a program ++ dnl that inspects the macro expansion. ++ dnl This detects a bug on HP-UX 11.23/ia64. ++ AC_RUN_IFELSE([ ++ AC_LANG_PROGRAM([[ ++#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ ++#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ ++#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ ++#include ++] ++gl_STDINT_INCLUDES ++[ ++#include ++#include ++#define MVAL(macro) MVAL1(macro) ++#define MVAL1(expression) #expression ++static const char *macro_values[] = ++ { ++#ifdef INT8_MAX ++ MVAL (INT8_MAX), ++#endif ++#ifdef INT16_MAX ++ MVAL (INT16_MAX), ++#endif ++#ifdef INT32_MAX ++ MVAL (INT32_MAX), ++#endif ++#ifdef INT64_MAX ++ MVAL (INT64_MAX), ++#endif ++#ifdef UINT8_MAX ++ MVAL (UINT8_MAX), ++#endif ++#ifdef UINT16_MAX ++ MVAL (UINT16_MAX), ++#endif ++#ifdef UINT32_MAX ++ MVAL (UINT32_MAX), ++#endif ++#ifdef UINT64_MAX ++ MVAL (UINT64_MAX), ++#endif ++ NULL ++ }; ++]], [[ ++ const char **mv; ++ for (mv = macro_values; *mv != NULL; mv++) ++ { ++ const char *value = *mv; ++ /* Test whether it looks like a cast expression. */ ++ if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 ++ || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 ++ || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 ++ || strncmp (value, "((int)"/*)*/, 6) == 0 ++ || strncmp (value, "((signed short)"/*)*/, 15) == 0 ++ || strncmp (value, "((signed char)"/*)*/, 14) == 0) ++ return mv - macro_values + 1; ++ } ++ return 0; ++]])], ++ [gl_cv_header_working_stdint_h=yes], ++ [], ++ [dnl When cross-compiling, assume it works. ++ gl_cv_header_working_stdint_h=yes ++ ]) ++ ]) ++ ]) ++ fi ++ if test "$gl_cv_header_working_stdint_h" = yes; then ++ STDINT_H= ++ else ++ dnl Check for , and for ++ dnl (used in Linux libc4 >= 4.6.7 and libc5). ++ AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) ++ if test $ac_cv_header_sys_inttypes_h = yes; then ++ HAVE_SYS_INTTYPES_H=1 ++ else ++ HAVE_SYS_INTTYPES_H=0 ++ fi ++ AC_SUBST([HAVE_SYS_INTTYPES_H]) ++ if test $ac_cv_header_sys_bitypes_h = yes; then ++ HAVE_SYS_BITYPES_H=1 ++ else ++ HAVE_SYS_BITYPES_H=0 ++ fi ++ AC_SUBST([HAVE_SYS_BITYPES_H]) ++ ++ gl_STDINT_TYPE_PROPERTIES ++ STDINT_H=stdint.h ++ fi ++ AC_SUBST([STDINT_H]) ++ AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) ++]) ++ ++dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) ++dnl Determine the size of each of the given types in bits. ++AC_DEFUN([gl_STDINT_BITSIZEOF], ++[ ++ dnl Use a shell loop, to avoid bloating configure, and ++ dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into ++ dnl config.h.in, ++ dnl - extra AC_SUBST calls, so that the right substitutions are made. ++ m4_foreach_w([gltype], [$1], ++ [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), ++ [Define to the number of bits in type ']gltype['.])]) ++ for gltype in $1 ; do ++ AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], ++ [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT], ++ [$2 ++#include ], [result=unknown]) ++ eval gl_cv_bitsizeof_${gltype}=\$result ++ ]) ++ eval result=\$gl_cv_bitsizeof_${gltype} ++ if test $result = unknown; then ++ dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, ++ dnl do a syntax check even on unused #if conditions and give an error ++ dnl on valid C code like this: ++ dnl #if 0 ++ dnl # if > 32 ++ dnl # endif ++ dnl #endif ++ result=0 ++ fi ++ GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` ++ AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) ++ eval BITSIZEOF_${GLTYPE}=\$result ++ done ++ m4_foreach_w([gltype], [$1], ++ [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) ++]) ++ ++dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) ++dnl Determine the signedness of each of the given types. ++dnl Define HAVE_SIGNED_TYPE if type is signed. ++AC_DEFUN([gl_CHECK_TYPES_SIGNED], ++[ ++ dnl Use a shell loop, to avoid bloating configure, and ++ dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into ++ dnl config.h.in, ++ dnl - extra AC_SUBST calls, so that the right substitutions are made. ++ m4_foreach_w([gltype], [$1], ++ [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), ++ [Define to 1 if ']gltype[' is a signed integer type.])]) ++ for gltype in $1 ; do ++ AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM([$2[ ++ int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])], ++ result=yes, result=no) ++ eval gl_cv_type_${gltype}_signed=\$result ++ ]) ++ eval result=\$gl_cv_type_${gltype}_signed ++ GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` ++ if test "$result" = yes; then ++ AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1]) ++ eval HAVE_SIGNED_${GLTYPE}=1 ++ else ++ eval HAVE_SIGNED_${GLTYPE}=0 ++ fi ++ done ++ m4_foreach_w([gltype], [$1], ++ [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) ++]) ++ ++dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) ++dnl Determine the suffix to use for integer constants of the given types. ++dnl Define t_SUFFIX for each such type. ++AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], ++[ ++ dnl Use a shell loop, to avoid bloating configure, and ++ dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into ++ dnl config.h.in, ++ dnl - extra AC_SUBST calls, so that the right substitutions are made. ++ m4_foreach_w([gltype], [$1], ++ [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], ++ [Define to l, ll, u, ul, ull, etc., as suitable for ++ constants of type ']gltype['.])]) ++ for gltype in $1 ; do ++ AC_CACHE_CHECK([for $gltype integer literal suffix], ++ [gl_cv_type_${gltype}_suffix], ++ [eval gl_cv_type_${gltype}_suffix=no ++ eval result=\$gl_cv_type_${gltype}_signed ++ if test "$result" = yes; then ++ glsufu= ++ else ++ glsufu=u ++ fi ++ for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do ++ case $glsuf in ++ '') gltype1='int';; ++ l) gltype1='long int';; ++ ll) gltype1='long long int';; ++ i64) gltype1='__int64';; ++ u) gltype1='unsigned int';; ++ ul) gltype1='unsigned long int';; ++ ull) gltype1='unsigned long long int';; ++ ui64)gltype1='unsigned __int64';; ++ esac ++ AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM([$2[ ++ extern $gltype foo; ++ extern $gltype1 foo;]])], ++ [eval gl_cv_type_${gltype}_suffix=\$glsuf]) ++ eval result=\$gl_cv_type_${gltype}_suffix ++ test "$result" != no && break ++ done]) ++ GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` ++ eval result=\$gl_cv_type_${gltype}_suffix ++ test "$result" = no && result= ++ eval ${GLTYPE}_SUFFIX=\$result ++ AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result]) ++ done ++ m4_foreach_w([gltype], [$1], ++ [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) ++]) ++ ++dnl gl_STDINT_INCLUDES ++AC_DEFUN([gl_STDINT_INCLUDES], ++[[ ++ /* BSD/OS 4.0.1 has a bug: , and must be ++ included before . */ ++ #include ++ #include ++ #if HAVE_WCHAR_H ++ # include ++ # include ++ # include ++ #endif ++]]) ++ ++dnl gl_STDINT_TYPE_PROPERTIES ++dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t ++dnl of interest to stdint.in.h. ++AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], ++[ ++ AC_REQUIRE([gl_MULTIARCH]) ++ if test $APPLE_UNIVERSAL_BUILD = 0; then ++ gl_STDINT_BITSIZEOF([ptrdiff_t size_t], ++ [gl_STDINT_INCLUDES]) ++ fi ++ gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t], ++ [gl_STDINT_INCLUDES]) ++ gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], ++ [gl_STDINT_INCLUDES]) ++ gl_cv_type_ptrdiff_t_signed=yes ++ gl_cv_type_size_t_signed=no ++ if test $APPLE_UNIVERSAL_BUILD = 0; then ++ gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t], ++ [gl_STDINT_INCLUDES]) ++ fi ++ gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], ++ [gl_STDINT_INCLUDES]) ++ ++ dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99 ++ dnl requirement that wint_t is "unchanged by default argument promotions". ++ dnl In this case gnulib's and override wint_t. ++ dnl Set the variable BITSIZEOF_WINT_T accordingly. ++ if test $BITSIZEOF_WINT_T -lt 32; then ++ BITSIZEOF_WINT_T=32 ++ fi ++]) ++ ++dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. ++dnl Remove this when we can assume autoconf >= 2.61. ++m4_ifdef([AC_COMPUTE_INT], [], [ ++ AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) ++]) ++ ++# Hey Emacs! ++# Local Variables: ++# indent-tabs-mode: nil ++# End: +diff --git a/xbmc/screensavers/rsxs-0.9/m4/stdint_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/stdint_h.m4 +index 3355f35..356b14e 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/stdint_h.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/stdint_h.m4 +@@ -1,5 +1,5 @@ +-# stdint_h.m4 serial 5 +-dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. ++# stdint_h.m4 serial 9 ++dnl Copyright (C) 1997-2004, 2006, 2008-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -11,15 +11,16 @@ dnl From Paul Eggert. + + AC_DEFUN([gl_AC_HEADER_STDINT_H], + [ +- AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, +- [AC_TRY_COMPILE( +- [#include +-#include ], +- [uintmax_t i = (uintmax_t) -1;], +- gl_cv_header_stdint_h=yes, +- gl_cv_header_stdint_h=no)]) ++ AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ++ #include ]], ++ [[uintmax_t i = (uintmax_t) -1; return !i;]])], ++ [gl_cv_header_stdint_h=yes], ++ [gl_cv_header_stdint_h=no])]) + if test $gl_cv_header_stdint_h = yes; then +- AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, ++ AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1], + [Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +diff --git a/xbmc/screensavers/rsxs-0.9/m4/stdio_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/stdio_h.m4 +new file mode 100644 +index 0000000..39bf80e +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/stdio_h.m4 +@@ -0,0 +1,195 @@ ++# stdio_h.m4 serial 40 ++dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_STDIO_H], ++[ ++ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) ++ AC_REQUIRE([AC_C_INLINE]) ++ gl_NEXT_HEADERS([stdio.h]) ++ ++ dnl No need to create extra modules for these functions. Everyone who uses ++ dnl likely needs them. ++ GNULIB_FSCANF=1 ++ GNULIB_SCANF=1 ++ GNULIB_FGETC=1 ++ GNULIB_GETC=1 ++ GNULIB_GETCHAR=1 ++ GNULIB_FGETS=1 ++ GNULIB_GETS=1 ++ GNULIB_FREAD=1 ++ dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c" ++ dnl "expected source file, required through AC_LIBSOURCES, not found". It is ++ dnl also an optimization, to avoid performing a configure check whose result ++ dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING ++ dnl or GNULIB_NONBLOCKING redundant. ++ m4_ifdef([gl_NONBLOCKING_IO], [ ++ gl_NONBLOCKING_IO ++ if test $gl_cv_have_nonblocking != yes; then ++ REPLACE_STDIO_READ_FUNCS=1 ++ AC_LIBOBJ([stdio-read]) ++ fi ++ ]) ++ ++ dnl No need to create extra modules for these functions. Everyone who uses ++ dnl likely needs them. ++ GNULIB_FPRINTF=1 ++ GNULIB_PRINTF=1 ++ GNULIB_VFPRINTF=1 ++ GNULIB_VPRINTF=1 ++ GNULIB_FPUTC=1 ++ GNULIB_PUTC=1 ++ GNULIB_PUTCHAR=1 ++ GNULIB_FPUTS=1 ++ GNULIB_PUTS=1 ++ GNULIB_FWRITE=1 ++ dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" ++ dnl "expected source file, required through AC_LIBSOURCES, not found". It is ++ dnl also an optimization, to avoid performing a configure check whose result ++ dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or ++ dnl GNULIB_SIGPIPE redundant. ++ m4_ifdef([gl_SIGNAL_SIGPIPE], [ ++ gl_SIGNAL_SIGPIPE ++ if test $gl_cv_header_signal_h_SIGPIPE != yes; then ++ REPLACE_STDIO_WRITE_FUNCS=1 ++ AC_LIBOBJ([stdio-write]) ++ fi ++ ]) ++ dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" ++ dnl "expected source file, required through AC_LIBSOURCES, not found". It is ++ dnl also an optimization, to avoid performing a configure check whose result ++ dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING ++ dnl or GNULIB_NONBLOCKING redundant. ++ m4_ifdef([gl_NONBLOCKING_IO], [ ++ gl_NONBLOCKING_IO ++ if test $gl_cv_have_nonblocking != yes; then ++ REPLACE_STDIO_WRITE_FUNCS=1 ++ AC_LIBOBJ([stdio-write]) ++ fi ++ ]) ++ ++ dnl Check for declarations of anything we want to poison if the ++ dnl corresponding gnulib module is not in use, and which is not ++ dnl guaranteed by C89. ++ gl_WARN_ON_USE_PREPARE([[#include ++ ]], [dprintf fpurge fseeko ftello getdelim getline pclose popen renameat ++ snprintf tmpfile vdprintf vsnprintf]) ++]) ++ ++AC_DEFUN([gl_STDIO_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) ++ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ++ dnl Define it also as a C macro, for the benefit of the unit tests. ++ gl_MODULE_INDICATOR_FOR_TESTS([$1]) ++]) ++ ++AC_DEFUN([gl_STDIO_H_DEFAULTS], ++[ ++ GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) ++ GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) ++ GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN]) ++ GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) ++ GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC]) ++ GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS]) ++ GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) ++ GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) ++ GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) ++ GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) ++ GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) ++ GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) ++ GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD]) ++ GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) ++ GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF]) ++ GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) ++ GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) ++ GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) ++ GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) ++ GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) ++ GNULIB_GETC=0; AC_SUBST([GNULIB_GETC]) ++ GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR]) ++ GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) ++ GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) ++ GNULIB_GETS=0; AC_SUBST([GNULIB_GETS]) ++ GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) ++ GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) ++ GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE]) ++ GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) ++ GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) ++ GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) ++ GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) ++ GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) ++ GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) ++ GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS]) ++ GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) ++ GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) ++ GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) ++ GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF]) ++ GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) ++ GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) ++ GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING]) ++ GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) ++ GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) ++ GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) ++ GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF]) ++ GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF]) ++ GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) ++ GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) ++ GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) ++ GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF]) ++ GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) ++ GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) ++ GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) ++ HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO]) ++ HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) ++ HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) ++ HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) ++ HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) ++ HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) ++ HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) ++ HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) ++ HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) ++ HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) ++ HAVE_PCLOSE=1; AC_SUBST([HAVE_PCLOSE]) ++ HAVE_POPEN=1; AC_SUBST([HAVE_POPEN]) ++ HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) ++ HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) ++ HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) ++ REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) ++ REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) ++ REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN]) ++ REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) ++ REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) ++ REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) ++ REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE]) ++ REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) ++ REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) ++ REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) ++ REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) ++ REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) ++ REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM]) ++ REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) ++ REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) ++ REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR]) ++ REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN]) ++ REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF]) ++ REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE]) ++ REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME]) ++ REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT]) ++ REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) ++ REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) ++ REPLACE_STDIO_READ_FUNCS=0; AC_SUBST([REPLACE_STDIO_READ_FUNCS]) ++ REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) ++ REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE]) ++ REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) ++ REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF]) ++ REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) ++ REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF]) ++ REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) ++ REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/stdlib_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/stdlib_h.m4 +new file mode 100644 +index 0000000..0a8a9e5 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/stdlib_h.m4 +@@ -0,0 +1,110 @@ ++# stdlib_h.m4 serial 39 ++dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_STDLIB_H], ++[ ++ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) ++ gl_NEXT_HEADERS([stdlib.h]) ++ ++ dnl Check for declarations of anything we want to poison if the ++ dnl corresponding gnulib module is not in use, and which is not ++ dnl guaranteed by C89. ++ gl_WARN_ON_USE_PREPARE([[#include ++#if HAVE_SYS_LOADAVG_H ++# include ++#endif ++#if HAVE_RANDOM_H ++# include ++#endif ++ ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt ++ initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt ++ ptsname ptsname_r random_r realpath rpmatch setenv setstate_r srandom_r ++ strtod strtoll strtoull unlockpt unsetenv]) ++]) ++ ++AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) ++ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ++ dnl Define it also as a C macro, for the benefit of the unit tests. ++ gl_MODULE_INDICATOR_FOR_TESTS([$1]) ++]) ++ ++AC_DEFUN([gl_STDLIB_H_DEFAULTS], ++[ ++ GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT]) ++ GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) ++ GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) ++ GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) ++ GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) ++ GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) ++ GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) ++ GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) ++ GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC]) ++ GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) ++ GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) ++ GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) ++ GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) ++ GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) ++ GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT]) ++ GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) ++ GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R]) ++ GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) ++ GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) ++ GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) ++ GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) ++ GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) ++ GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) ++ GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) ++ GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) ++ GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) ++ GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) ++ GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) ++ GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) ++ GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB]) ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) ++ HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) ++ HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) ++ HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) ++ HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) ++ HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) ++ HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) ++ HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) ++ HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) ++ HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) ++ HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) ++ HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT]) ++ HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) ++ HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) ++ HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H]) ++ HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) ++ HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) ++ HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) ++ HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) ++ HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) ++ HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) ++ HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) ++ HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) ++ HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) ++ HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) ++ HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) ++ HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) ++ REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) ++ REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) ++ REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) ++ REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) ++ REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) ++ REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) ++ REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) ++ REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) ++ REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) ++ REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) ++ REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) ++ REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) ++ REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/stpcpy.m4 b/xbmc/screensavers/rsxs-0.9/m4/stpcpy.m4 +new file mode 100644 +index 0000000..778cc28 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/stpcpy.m4 +@@ -0,0 +1,25 @@ ++# stpcpy.m4 serial 8 ++dnl Copyright (C) 2002, 2007, 2009-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_FUNC_STPCPY], ++[ ++ dnl Persuade glibc to declare stpcpy(). ++ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ++ ++ dnl The stpcpy() declaration in lib/string.in.h uses 'restrict'. ++ AC_REQUIRE([AC_C_RESTRICT]) ++ ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) ++ AC_CHECK_FUNCS([stpcpy]) ++ if test $ac_cv_func_stpcpy = no; then ++ HAVE_STPCPY=0 ++ fi ++]) ++ ++# Prerequisites of lib/stpcpy.c. ++AC_DEFUN([gl_PREREQ_STPCPY], [ ++ : ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/strcase.m4 b/xbmc/screensavers/rsxs-0.9/m4/strcase.m4 +index 6db401b..c676176 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/strcase.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/strcase.m4 +@@ -1,5 +1,5 @@ +-# strcase.m4 serial 3 +-dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc. ++# strcase.m4 serial 11 ++dnl Copyright (C) 2002, 2005-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -12,24 +12,30 @@ AC_DEFUN([gl_STRCASE], + + AC_DEFUN([gl_FUNC_STRCASECMP], + [ +- dnl No known system has a strcasecmp() function that works correctly in +- dnl multibyte locales. Therefore we use our version always. +- AC_LIBOBJ(strcasecmp) +- AC_DEFINE(strcasecmp, rpl_strcasecmp, [Define to rpl_strcasecmp always.]) +- gl_PREREQ_STRCASECMP ++ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) ++ AC_CHECK_FUNCS([strcasecmp]) ++ if test $ac_cv_func_strcasecmp = no; then ++ HAVE_STRCASECMP=0 ++ fi + ]) + + AC_DEFUN([gl_FUNC_STRNCASECMP], + [ +- AC_REPLACE_FUNCS(strncasecmp) +- if test $ac_cv_func_strncasecmp = no; then +- gl_PREREQ_STRNCASECMP ++ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) ++ AC_CHECK_FUNCS([strncasecmp]) ++ if test $ac_cv_func_strncasecmp = yes; then ++ HAVE_STRNCASECMP=1 ++ else ++ HAVE_STRNCASECMP=0 ++ fi ++ AC_CHECK_DECLS([strncasecmp]) ++ if test $ac_cv_have_decl_strncasecmp = no; then ++ HAVE_DECL_STRNCASECMP=0 + fi + ]) + + # Prerequisites of lib/strcasecmp.c. + AC_DEFUN([gl_PREREQ_STRCASECMP], [ +- AC_REQUIRE([gl_FUNC_MBRTOWC]) + : + ]) + +diff --git a/xbmc/screensavers/rsxs-0.9/m4/strchrnul.m4 b/xbmc/screensavers/rsxs-0.9/m4/strchrnul.m4 +index 8492b9f..d89a062 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/strchrnul.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/strchrnul.m4 +@@ -1,5 +1,5 @@ +-# strchrnul.m4 serial 3 +-dnl Copyright (C) 2003 Free Software Foundation, Inc. ++# strchrnul.m4 serial 9 ++dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -7,11 +7,42 @@ dnl with or without modifications, as long as this notice is preserved. + AC_DEFUN([gl_FUNC_STRCHRNUL], + [ + dnl Persuade glibc to declare strchrnul(). +- AC_REQUIRE([AC_GNU_SOURCE]) ++ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + +- AC_REPLACE_FUNCS(strchrnul) ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) ++ AC_CHECK_FUNCS([strchrnul]) + if test $ac_cv_func_strchrnul = no; then +- gl_PREREQ_STRCHRNUL ++ HAVE_STRCHRNUL=0 ++ else ++ AC_CACHE_CHECK([whether strchrnul works], ++ [gl_cv_func_strchrnul_works], ++ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ++#include /* for strchrnul */ ++]], [[const char *buf = "a"; ++ return strchrnul (buf, 'b') != buf + 1; ++ ]])], ++ [gl_cv_func_strchrnul_works=yes], ++ [gl_cv_func_strchrnul_works=no], ++ [dnl Cygwin 1.7.9 introduced strchrnul, but it was broken until 1.7.10 ++ AC_EGREP_CPP([Lucky user], ++ [ ++#if defined __CYGWIN__ ++ #include ++ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 9) ++ Lucky user ++ #endif ++#else ++ Lucky user ++#endif ++ ], ++ [gl_cv_func_strchrnul_works="guessing yes"], ++ [gl_cv_func_strchrnul_works="guessing no"]) ++ ]) ++ ]) ++ case "$gl_cv_func_strchrnul_works" in ++ *yes) ;; ++ *) REPLACE_STRCHRNUL=1 ;; ++ esac + fi + ]) + +diff --git a/xbmc/screensavers/rsxs-0.9/m4/strerror.m4 b/xbmc/screensavers/rsxs-0.9/m4/strerror.m4 +new file mode 100644 +index 0000000..ca05be6 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/strerror.m4 +@@ -0,0 +1,78 @@ ++# strerror.m4 serial 16 ++dnl Copyright (C) 2002, 2007-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_FUNC_STRERROR], ++[ ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) ++ AC_REQUIRE([gl_HEADER_ERRNO_H]) ++ AC_REQUIRE([gl_FUNC_STRERROR_0]) ++ m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ ++ AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) ++ ]) ++ if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then ++ AC_CACHE_CHECK([for working strerror function], ++ [gl_cv_func_working_strerror], ++ [AC_RUN_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ++ ]], ++ [[if (!*strerror (-2)) return 1;]])], ++ [gl_cv_func_working_strerror=yes], ++ [gl_cv_func_working_strerror=no], ++ [dnl Be pessimistic on cross-compiles for now. ++ gl_cv_func_working_strerror="guessing no"]) ++ ]) ++ if test "$gl_cv_func_working_strerror" != yes; then ++ dnl The system's strerror() fails to return a string for out-of-range ++ dnl integers. Replace it. ++ REPLACE_STRERROR=1 ++ fi ++ m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ ++ dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's ++ dnl buffer, we must replace strerror. ++ case "$gl_cv_func_strerror_r_works" in ++ *no) REPLACE_STRERROR=1 ;; ++ esac ++ ]) ++ else ++ dnl The system's strerror() cannot know about the new errno values we add ++ dnl to , or any fix for strerror(0). Replace it. ++ REPLACE_STRERROR=1 ++ fi ++]) ++ ++dnl Detect if strerror(0) passes (that is, does not set errno, and does not ++dnl return a string that matches strerror(-1)). ++AC_DEFUN([gl_FUNC_STRERROR_0], ++[ ++ REPLACE_STRERROR_0=0 ++ AC_CACHE_CHECK([whether strerror(0) succeeds], ++ [gl_cv_func_strerror_0_works], ++ [AC_RUN_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ++ #include ++ ]], ++ [[int result = 0; ++ char *str; ++ errno = 0; ++ str = strerror (0); ++ if (!*str) result |= 1; ++ if (errno) result |= 2; ++ if (strstr (str, "nknown") || strstr (str, "ndefined")) ++ result |= 4; ++ return result;]])], ++ [gl_cv_func_strerror_0_works=yes], ++ [gl_cv_func_strerror_0_works=no], ++ [dnl Be pessimistic on cross-compiles for now. ++ gl_cv_func_strerror_0_works="guessing no"]) ++ ]) ++ if test "$gl_cv_func_strerror_0_works" != yes; then ++ REPLACE_STRERROR_0=1 ++ AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0) ++ does not return a message implying success.]) ++ fi ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/string_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/string_h.m4 +new file mode 100644 +index 0000000..4f9f511 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/string_h.m4 +@@ -0,0 +1,120 @@ ++# Configure a GNU-like replacement for . ++ ++# Copyright (C) 2007-2011 Free Software Foundation, Inc. ++# This file is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# serial 21 ++ ++# Written by Paul Eggert. ++ ++AC_DEFUN([gl_HEADER_STRING_H], ++[ ++ dnl Use AC_REQUIRE here, so that the default behavior below is expanded ++ dnl once only, before all statements that occur in other macros. ++ AC_REQUIRE([gl_HEADER_STRING_H_BODY]) ++]) ++ ++AC_DEFUN([gl_HEADER_STRING_H_BODY], ++[ ++ AC_REQUIRE([AC_C_RESTRICT]) ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) ++ gl_NEXT_HEADERS([string.h]) ++ ++ dnl Check for declarations of anything we want to poison if the ++ dnl corresponding gnulib module is not in use, and which is not ++ dnl guaranteed by C89. ++ gl_WARN_ON_USE_PREPARE([[#include ++ ]], ++ [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul ++ strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r ++ strerror_r strsignal strverscmp]) ++]) ++ ++AC_DEFUN([gl_STRING_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) ++ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ++ dnl Define it also as a C macro, for the benefit of the unit tests. ++ gl_MODULE_INDICATOR_FOR_TESTS([$1]) ++]) ++ ++AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], ++[ ++ GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL]) ++ GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL]) ++ GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) ++ GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) ++ GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) ++ GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) ++ GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR]) ++ GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) ++ GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) ++ GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) ++ GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) ++ GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT]) ++ GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) ++ GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) ++ GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) ++ GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) ++ GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) ++ GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) ++ GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) ++ GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) ++ GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) ++ GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) ++ GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) ++ GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) ++ GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) ++ GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) ++ GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) ++ GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) ++ GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) ++ GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) ++ GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) ++ GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) ++ GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) ++ GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) ++ GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R]) ++ GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) ++ GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) ++ HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) ++ HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) ++ HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) ++ HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) ++ HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) ++ HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) ++ HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) ++ HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) ++ HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) ++ HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) ++ HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) ++ HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) ++ HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) ++ HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) ++ HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) ++ HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) ++ HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) ++ HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) ++ HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) ++ HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) ++ REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) ++ REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) ++ REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) ++ REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) ++ REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) ++ REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) ++ REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) ++ REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) ++ REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) ++ REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) ++ REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) ++ REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) ++ REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) ++ REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) ++ UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/strings_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/strings_h.m4 +new file mode 100644 +index 0000000..481f8f3 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/strings_h.m4 +@@ -0,0 +1,52 @@ ++# Configure a replacement for . ++# serial 6 ++ ++# Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. ++# This file is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_HEADER_STRINGS_H], ++[ ++ dnl Use AC_REQUIRE here, so that the default behavior below is expanded ++ dnl once only, before all statements that occur in other macros. ++ AC_REQUIRE([gl_HEADER_STRINGS_H_BODY]) ++]) ++ ++AC_DEFUN([gl_HEADER_STRINGS_H_BODY], ++[ ++ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) ++ ++ gl_CHECK_NEXT_HEADERS([strings.h]) ++ if test $ac_cv_header_strings_h = yes; then ++ HAVE_STRINGS_H=1 ++ else ++ HAVE_STRINGS_H=0 ++ fi ++ AC_SUBST([HAVE_STRINGS_H]) ++ ++ dnl Check for declarations of anything we want to poison if the ++ dnl corresponding gnulib module is not in use. ++ gl_WARN_ON_USE_PREPARE([[ ++ /* Minix 3.1.8 has a bug: must be included before ++ . */ ++ #include ++ #include ++ ]], [ffs strcasecmp strncasecmp]) ++]) ++ ++AC_DEFUN([gl_STRINGS_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) ++ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ++]) ++ ++AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS], ++[ ++ GNULIB_FFS=0; AC_SUBST([GNULIB_FFS]) ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ HAVE_FFS=1; AC_SUBST([HAVE_FFS]) ++ HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) ++ HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/strndup.m4 b/xbmc/screensavers/rsxs-0.9/m4/strndup.m4 +index 617db4c..e1ac20b 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/strndup.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/strndup.m4 +@@ -1,54 +1,55 @@ +-# strndup.m4 serial 7 +-dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc. ++# strndup.m4 serial 20 ++dnl Copyright (C) 2002-2003, 2005-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + + AC_DEFUN([gl_FUNC_STRNDUP], + [ +- AC_LIBSOURCES([strndup.c, strndup.h]) +- + dnl Persuade glibc to declare strndup(). +- AC_REQUIRE([AC_GNU_SOURCE]) ++ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_CHECK_DECLS_ONCE([strndup]) ++ AC_CHECK_FUNCS_ONCE([strndup]) ++ if test $ac_cv_have_decl_strndup = no; then ++ HAVE_DECL_STRNDUP=0 ++ fi + +- # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. +- AC_CACHE_CHECK([for working strndup], gl_cv_func_strndup, +- [AC_RUN_IFELSE([ +- AC_LANG_PROGRAM([ +-#include +-#include +- ], [[ ++ if test $ac_cv_func_strndup = yes; then ++ HAVE_STRNDUP=1 ++ # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. ++ AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works], ++ [AC_RUN_IFELSE([ ++ AC_LANG_PROGRAM([[#include ++ #include ]], [[ + #ifndef HAVE_DECL_STRNDUP +- extern char *strndup (const char *, size_t); ++ extern ++ #ifdef __cplusplus ++ "C" ++ #endif ++ char *strndup (const char *, size_t); + #endif + char *s; + s = strndup ("some longer string", 15); + free (s); + s = strndup ("shorter string", 13); + return s[13] != '\0';]])], +- [gl_cv_func_strndup=yes], +- [gl_cv_func_strndup=no], +- [AC_CHECK_FUNC([strndup], +- [AC_EGREP_CPP([too risky], [ +-#ifdef _AIX +- too risky +-#endif +- ], +- [gl_cv_func_strndup=no], +- [gl_cv_func_strndup=yes])], +- [gl_cv_func_strndup=no])])]) +- if test $gl_cv_func_strndup = yes; then +- AC_DEFINE([HAVE_STRNDUP], 1, +- [Define if you have the strndup() function and it works.]) ++ [gl_cv_func_strndup_works=yes], ++ [gl_cv_func_strndup_works=no], ++ [ ++changequote(,)dnl ++ case $host_os in ++ aix | aix[3-6]*) gl_cv_func_strndup_works="guessing no";; ++ *) gl_cv_func_strndup_works="guessing yes";; ++ esac ++changequote([,])dnl ++ ])]) ++ case $gl_cv_func_strndup_works in ++ *no) REPLACE_STRNDUP=1 ;; ++ esac + else +- AC_LIBOBJ([strndup]) +- AC_DEFINE(strndup, rpl_strndup, +- [Define to rpl_strndup if the replacement function should be used,]) +- gl_PREREQ_STRNDUP ++ HAVE_STRNDUP=0 + fi + ]) +- +-# Prerequisites of lib/strndup.c. +-AC_DEFUN([gl_PREREQ_STRNDUP], [:]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/strnlen.m4 b/xbmc/screensavers/rsxs-0.9/m4/strnlen.m4 +index 67964c8..672acfd 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/strnlen.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/strnlen.m4 +@@ -1,29 +1,30 @@ +-# strnlen.m4 serial 5 +-dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. ++# strnlen.m4 serial 13 ++dnl Copyright (C) 2002-2003, 2005-2007, 2009-2011 Free Software Foundation, ++dnl Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + + AC_DEFUN([gl_FUNC_STRNLEN], + [ +- AC_LIBSOURCES([strnlen.c, strnlen.h]) ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + + dnl Persuade glibc to declare strnlen(). +- AC_REQUIRE([AC_GNU_SOURCE]) ++ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + +- AC_FUNC_STRNLEN +- if test $ac_cv_func_strnlen_working = no; then +- # This is necessary because automake-1.6.1 doens't understand +- # that the above use of AC_FUNC_STRNLEN means we may have to use +- # lib/strnlen.c. +- #AC_LIBOBJ(strnlen) +- AC_DEFINE(strnlen, rpl_strnlen, +- [Define to rpl_strnlen if the replacement function should be used.]) +- gl_PREREQ_STRNLEN ++ AC_CHECK_DECLS_ONCE([strnlen]) ++ if test $ac_cv_have_decl_strnlen = no; then ++ HAVE_DECL_STRNLEN=0 ++ else ++ m4_pushdef([AC_LIBOBJ], [:]) ++ dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]). ++ AC_FUNC_STRNLEN ++ m4_popdef([AC_LIBOBJ]) ++ if test $ac_cv_func_strnlen_working = no; then ++ REPLACE_STRNLEN=1 ++ fi + fi + ]) + + # Prerequisites of lib/strnlen.c. +-AC_DEFUN([gl_PREREQ_STRNLEN], [ +- AC_CHECK_DECLS_ONCE(strnlen) +-]) ++AC_DEFUN([gl_PREREQ_STRNLEN], [:]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/strstr.m4 b/xbmc/screensavers/rsxs-0.9/m4/strstr.m4 +new file mode 100644 +index 0000000..bf6a750 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/strstr.m4 +@@ -0,0 +1,124 @@ ++# strstr.m4 serial 15 ++dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl Check that strstr works. ++AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], ++[ ++ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) ++ AC_REQUIRE([gl_FUNC_MEMCHR]) ++ if test "$gl_cv_func_memchr_works" != yes; then ++ REPLACE_STRSTR=1 ++ else ++ dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092. ++ AC_CACHE_CHECK([whether strstr works], ++ [gl_cv_func_strstr_works_always], ++ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ++#include /* for strstr */ ++#define P "_EF_BF_BD" ++#define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P ++#define NEEDLE P P P P P ++]], [[return !!strstr (HAYSTACK, NEEDLE); ++ ]])], ++ [gl_cv_func_strstr_works_always=yes], ++ [gl_cv_func_strstr_works_always=no], ++ [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not ++ dnl affected, since it uses different source code for strstr than ++ dnl glibc. ++ dnl Assume that it works on all other platforms, even if it is not ++ dnl linear. ++ AC_EGREP_CPP([Lucky user], ++ [ ++#ifdef __GNU_LIBRARY__ ++ #include ++ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ ++ || defined __UCLIBC__ ++ Lucky user ++ #endif ++#elif defined __CYGWIN__ ++ #include ++ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) ++ Lucky user ++ #endif ++#else ++ Lucky user ++#endif ++ ], ++ [gl_cv_func_strstr_works_always=yes], ++ [gl_cv_func_strstr_works_always="guessing no"]) ++ ]) ++ ]) ++ if test "$gl_cv_func_strstr_works_always" != yes; then ++ REPLACE_STRSTR=1 ++ fi ++ fi ++]) # gl_FUNC_STRSTR_SIMPLE ++ ++dnl Additionally, check that strstr is efficient. ++AC_DEFUN([gl_FUNC_STRSTR], ++[ ++ AC_REQUIRE([gl_FUNC_STRSTR_SIMPLE]) ++ if test $REPLACE_STRSTR = 0; then ++ AC_CACHE_CHECK([whether strstr works in linear time], ++ [gl_cv_func_strstr_linear], ++ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ++#include /* for signal */ ++#include /* for strstr */ ++#include /* for malloc */ ++#include /* for alarm */ ++static void quit (int sig) { exit (sig + 128); } ++]], [[ ++ int result = 0; ++ size_t m = 1000000; ++ char *haystack = (char *) malloc (2 * m + 2); ++ char *needle = (char *) malloc (m + 2); ++ /* Failure to compile this test due to missing alarm is okay, ++ since all such platforms (mingw) also have quadratic strstr. */ ++ signal (SIGALRM, quit); ++ alarm (5); ++ /* Check for quadratic performance. */ ++ if (haystack && needle) ++ { ++ memset (haystack, 'A', 2 * m); ++ haystack[2 * m] = 'B'; ++ haystack[2 * m + 1] = 0; ++ memset (needle, 'A', m); ++ needle[m] = 'B'; ++ needle[m + 1] = 0; ++ if (!strstr (haystack, needle)) ++ result |= 1; ++ } ++ return result; ++ ]])], ++ [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no], ++ [dnl Only glibc > 2.12 on processors without SSE 4.2 instructions and ++ dnl cygwin > 1.7.7 are known to have a bug-free strstr that works in ++ dnl linear time. ++ AC_EGREP_CPP([Lucky user], ++ [ ++#include ++#ifdef __GNU_LIBRARY__ ++ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ ++ && !(defined __i386__ || defined __x86_64__) \ ++ && !defined __UCLIBC__ ++ Lucky user ++ #endif ++#endif ++#ifdef __CYGWIN__ ++ #include ++ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) ++ Lucky user ++ #endif ++#endif ++ ], ++ [gl_cv_func_strstr_linear=yes], ++ [gl_cv_func_strstr_linear="guessing no"]) ++ ]) ++ ]) ++ if test "$gl_cv_func_strstr_linear" != yes; then ++ REPLACE_STRSTR=1 ++ fi ++ fi ++]) # gl_FUNC_STRSTR +diff --git a/xbmc/screensavers/rsxs-0.9/m4/sys_socket_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/sys_socket_h.m4 +new file mode 100644 +index 0000000..7da91a4 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/sys_socket_h.m4 +@@ -0,0 +1,177 @@ ++# sys_socket_h.m4 serial 22 ++dnl Copyright (C) 2005-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Simon Josefsson. ++ ++AC_DEFUN([gl_HEADER_SYS_SOCKET], ++[ ++ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) ++ AC_REQUIRE([AC_C_INLINE]) ++ ++ dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have ++ dnl old-style declarations (with return type 'int' instead of 'ssize_t') ++ dnl unless _POSIX_PII_SOCKET is defined. ++ case "$host_os" in ++ osf*) ++ AC_DEFINE([_POSIX_PII_SOCKET], [1], ++ [Define to 1 in order to get the POSIX compatible declarations ++ of socket functions.]) ++ ;; ++ esac ++ ++ AC_CACHE_CHECK([whether is self-contained], ++ [gl_cv_header_sys_socket_h_selfcontained], ++ [ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], ++ [gl_cv_header_sys_socket_h_selfcontained=yes], ++ [gl_cv_header_sys_socket_h_selfcontained=no]) ++ ]) ++ if test $gl_cv_header_sys_socket_h_selfcontained = yes; then ++ dnl If the shutdown function exists, should define ++ dnl SHUT_RD, SHUT_WR, SHUT_RDWR. ++ AC_CHECK_FUNCS([shutdown]) ++ if test $ac_cv_func_shutdown = yes; then ++ AC_CACHE_CHECK([whether defines the SHUT_* macros], ++ [gl_cv_header_sys_socket_h_shut], ++ [ ++ AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM([[#include ]], ++ [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])], ++ [gl_cv_header_sys_socket_h_shut=yes], ++ [gl_cv_header_sys_socket_h_shut=no]) ++ ]) ++ if test $gl_cv_header_sys_socket_h_shut = no; then ++ SYS_SOCKET_H='sys/socket.h' ++ fi ++ fi ++ fi ++ # We need to check for ws2tcpip.h now. ++ gl_PREREQ_SYS_H_SOCKET ++ AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ ++ /* sys/types.h is not needed according to POSIX, but the ++ sys/socket.h in i386-unknown-freebsd4.10 and ++ powerpc-apple-darwin5.5 required it. */ ++#include ++#ifdef HAVE_SYS_SOCKET_H ++#include ++#endif ++#ifdef HAVE_WS2TCPIP_H ++#include ++#endif ++]) ++ if test $ac_cv_type_struct_sockaddr_storage = no; then ++ HAVE_STRUCT_SOCKADDR_STORAGE=0 ++ fi ++ if test $ac_cv_type_sa_family_t = no; then ++ HAVE_SA_FAMILY_T=0 ++ fi ++ if test $ac_cv_type_struct_sockaddr_storage != no; then ++ AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], ++ [], ++ [HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0], ++ [#include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ #ifdef HAVE_WS2TCPIP_H ++ #include ++ #endif ++ ]) ++ fi ++ if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ ++ || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then ++ SYS_SOCKET_H='sys/socket.h' ++ fi ++ gl_PREREQ_SYS_H_WINSOCK2 ++ ++ dnl Check for declarations of anything we want to poison if the ++ dnl corresponding gnulib module is not in use. ++ gl_WARN_ON_USE_PREPARE([[ ++/* Some systems require prerequisite headers. */ ++#include ++#include ++ ]], [socket connect accept bind getpeername getsockname getsockopt ++ listen recv send recvfrom sendto setsockopt shutdown accept4]) ++]) ++ ++AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], ++[ ++ dnl Check prerequisites of the replacement. ++ AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) ++ gl_CHECK_NEXT_HEADERS([sys/socket.h]) ++ if test $ac_cv_header_sys_socket_h = yes; then ++ HAVE_SYS_SOCKET_H=1 ++ HAVE_WS2TCPIP_H=0 ++ else ++ HAVE_SYS_SOCKET_H=0 ++ if test $ac_cv_header_ws2tcpip_h = yes; then ++ HAVE_WS2TCPIP_H=1 ++ else ++ HAVE_WS2TCPIP_H=0 ++ fi ++ fi ++ AC_SUBST([HAVE_SYS_SOCKET_H]) ++ AC_SUBST([HAVE_WS2TCPIP_H]) ++]) ++ ++# Common prerequisites of the replacement and of the ++# replacement. ++# Sets and substitutes HAVE_WINSOCK2_H. ++AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], ++[ ++ m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])]) ++ m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])]) ++ AC_CHECK_HEADERS_ONCE([sys/socket.h]) ++ if test $ac_cv_header_sys_socket_h != yes; then ++ dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make ++ dnl the check for those headers unconditional; yet cygwin reports ++ dnl that the headers are present but cannot be compiled (since on ++ dnl cygwin, all socket information should come from sys/socket.h). ++ AC_CHECK_HEADERS([winsock2.h]) ++ fi ++ if test "$ac_cv_header_winsock2_h" = yes; then ++ HAVE_WINSOCK2_H=1 ++ UNISTD_H_HAVE_WINSOCK2_H=1 ++ SYS_IOCTL_H_HAVE_WINSOCK2_H=1 ++ else ++ HAVE_WINSOCK2_H=0 ++ fi ++ AC_SUBST([HAVE_WINSOCK2_H]) ++]) ++ ++AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) ++ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ++ dnl Define it also as a C macro, for the benefit of the unit tests. ++ gl_MODULE_INDICATOR_FOR_TESTS([$1]) ++]) ++ ++AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], ++[ ++ GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) ++ GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) ++ GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) ++ GNULIB_BIND=0; AC_SUBST([GNULIB_BIND]) ++ GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME]) ++ GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME]) ++ GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT]) ++ GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN]) ++ GNULIB_RECV=0; AC_SUBST([GNULIB_RECV]) ++ GNULIB_SEND=0; AC_SUBST([GNULIB_SEND]) ++ GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) ++ GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) ++ GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) ++ GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) ++ GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) ++ HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) ++ HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; ++ AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) ++ HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) ++ HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/sys_time_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/sys_time_h.m4 +new file mode 100644 +index 0000000..064e0de +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/sys_time_h.m4 +@@ -0,0 +1,78 @@ ++# Configure a replacement for . ++# serial 7 ++ ++# Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. ++# This file is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# Written by Paul Eggert and Martin Lambers. ++ ++AC_DEFUN([gl_HEADER_SYS_TIME_H], ++[ ++ dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement ++ dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1 ++ dnl statements that occur in other macros. ++ AC_REQUIRE([gl_HEADER_SYS_TIME_H_BODY]) ++]) ++ ++AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], ++[ ++ AC_REQUIRE([AC_C_RESTRICT]) ++ AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) ++ AC_CHECK_HEADERS_ONCE([sys/time.h]) ++ gl_CHECK_NEXT_HEADERS([sys/time.h]) ++ ++ if test $ac_cv_header_sys_time_h != yes; then ++ HAVE_SYS_TIME_H=0 ++ fi ++ ++ dnl On native Windows with MSVC, 'struct timeval' is defined in ++ dnl only. So include that header in the list. ++ gl_PREREQ_SYS_H_WINSOCK2 ++ AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#if HAVE_SYS_TIME_H ++ #include ++ #endif ++ #include ++ #if HAVE_WINSOCK2_H ++ # include ++ #endif ++ ]], ++ [[static struct timeval x; x.tv_sec = x.tv_usec;]])], ++ [gl_cv_sys_struct_timeval=yes], ++ [gl_cv_sys_struct_timeval=no])]) ++ if test $gl_cv_sys_struct_timeval != yes; then ++ HAVE_STRUCT_TIMEVAL=0 ++ fi ++ ++ dnl Check for declarations of anything we want to poison if the ++ dnl corresponding gnulib module is not in use. ++ gl_WARN_ON_USE_PREPARE([[ ++#if HAVE_SYS_TIME_H ++# include ++#endif ++#include ++ ]], [gettimeofday]) ++]) ++ ++AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) ++ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ++ dnl Define it also as a C macro, for the benefit of the unit tests. ++ gl_MODULE_INDICATOR_FOR_TESTS([$1]) ++]) ++ ++AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS], ++[ ++ GNULIB_GETTIMEOFDAY=0; AC_SUBST([GNULIB_GETTIMEOFDAY]) ++ dnl Assume POSIX behavior unless another module says otherwise. ++ HAVE_GETTIMEOFDAY=1; AC_SUBST([HAVE_GETTIMEOFDAY]) ++ HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL]) ++ HAVE_SYS_TIME_H=1; AC_SUBST([HAVE_SYS_TIME_H]) ++ REPLACE_GETTIMEOFDAY=0; AC_SUBST([REPLACE_GETTIMEOFDAY]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/sys_types_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/sys_types_h.m4 +new file mode 100644 +index 0000000..62113df +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/sys_types_h.m4 +@@ -0,0 +1,21 @@ ++# sys_types_h.m4 serial 2 ++dnl Copyright (C) 2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_SYS_TYPES_H], ++[ ++ AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) ++ gl_NEXT_HEADERS([sys/types.h]) ++ ++ dnl Ensure the type pid_t gets defined. ++ AC_REQUIRE([AC_TYPE_PID_T]) ++ ++ dnl Ensure the type mode_t gets defined. ++ AC_REQUIRE([AC_TYPE_MODE_T]) ++]) ++ ++AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], ++[ ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/sysexits.m4 b/xbmc/screensavers/rsxs-0.9/m4/sysexits.m4 +index 69d2091..cff6606 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/sysexits.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/sysexits.m4 +@@ -1,13 +1,44 @@ +-# sysexits.m4 serial 2 +-dnl Copyright (C) 2003,2005 Free Software Foundation, Inc. ++# sysexits.m4 serial 6 ++dnl Copyright (C) 2003, 2005, 2007, 2009-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + + AC_DEFUN([gl_SYSEXITS], + [ +- AC_CHECK_HEADERS(sysexits.h, +- [SYSEXITS_H=], +- [SYSEXITS_H=sysexits.h]) ++ AC_CHECK_HEADERS_ONCE([sysexits.h]) ++ if test $ac_cv_header_sysexits_h = yes; then ++ HAVE_SYSEXITS_H=1 ++ gl_CHECK_NEXT_HEADERS([sysexits.h]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], ++ [[switch (0) ++ { ++ case EX_OK: ++ case EX_USAGE: ++ case EX_DATAERR: ++ case EX_NOINPUT: ++ case EX_NOUSER: ++ case EX_NOHOST: ++ case EX_UNAVAILABLE: ++ case EX_SOFTWARE: ++ case EX_OSERR: ++ case EX_OSFILE: ++ case EX_CANTCREAT: ++ case EX_IOERR: ++ case EX_TEMPFAIL: ++ case EX_PROTOCOL: ++ case EX_NOPERM: ++ case EX_CONFIG: ++ break; ++ } ++ ]])], ++ [SYSEXITS_H=], ++ [SYSEXITS_H=sysexits.h]) ++ else ++ HAVE_SYSEXITS_H=0 ++ SYSEXITS_H=sysexits.h ++ fi ++ AC_SUBST([HAVE_SYSEXITS_H]) + AC_SUBST([SYSEXITS_H]) ++ AM_CONDITIONAL([GL_GENERATE_SYSEXITS_H], [test -n "$SYSEXITS_H"]) + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/unistd_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/unistd_h.m4 +index 9c77f9b..b4eca685 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/unistd_h.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/unistd_h.m4 +@@ -1,18 +1,177 @@ +-# unistd_h.m4 serial 2 +-dnl Copyright (C) 2006 Free Software Foundation, Inc. ++# unistd_h.m4 serial 62 ++dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + +-dnl Written by Simon Josefsson ++dnl Written by Simon Josefsson, Bruno Haible. + +-AC_DEFUN([gl_HEADER_UNISTD], ++AC_DEFUN([gl_UNISTD_H], + [ +- dnl Prerequisites of lib/unistd.h. +- AC_CHECK_HEADERS([unistd.h], [ +- UNISTD_H='' +- ], [ +- UNISTD_H='unistd.h' +- ]) +- AC_SUBST(UNISTD_H) ++ dnl Use AC_REQUIRE here, so that the default behavior below is expanded ++ dnl once only, before all statements that occur in other macros. ++ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) ++ AC_REQUIRE([AC_C_INLINE]) ++ ++ gl_CHECK_NEXT_HEADERS([unistd.h]) ++ if test $ac_cv_header_unistd_h = yes; then ++ HAVE_UNISTD_H=1 ++ else ++ HAVE_UNISTD_H=0 ++ fi ++ AC_SUBST([HAVE_UNISTD_H]) ++ ++ dnl Ensure the type pid_t gets defined. ++ AC_REQUIRE([AC_TYPE_PID_T]) ++ ++ dnl Check for declarations of anything we want to poison if the ++ dnl corresponding gnulib module is not in use. ++ gl_WARN_ON_USE_PREPARE([[ ++#if HAVE_UNISTD_H ++# include ++#endif ++/* Some systems declare various items in the wrong headers. */ ++#if !(defined __GLIBC__ && !defined __UCLIBC__) ++# include ++# include ++# include ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++# include ++# endif ++#endif ++ ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat ++ fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups ++ gethostname getlogin getlogin_r getpagesize getusershell setusershell ++ endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite ++ readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat ++ usleep]) ++]) ++ ++AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) ++ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ++ dnl Define it also as a C macro, for the benefit of the unit tests. ++ gl_MODULE_INDICATOR_FOR_TESTS([$1]) ++]) ++ ++AC_DEFUN([gl_UNISTD_H_DEFAULTS], ++[ ++ GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR]) ++ GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) ++ GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) ++ GNULIB_DUP=0; AC_SUBST([GNULIB_DUP]) ++ GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) ++ GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) ++ GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) ++ GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) ++ GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) ++ GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) ++ GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) ++ GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC]) ++ GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) ++ GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) ++ GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) ++ GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) ++ GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) ++ GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) ++ GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) ++ GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) ++ GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) ++ GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) ++ GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) ++ GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER]) ++ GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) ++ GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) ++ GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) ++ GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) ++ GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) ++ GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) ++ GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) ++ GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) ++ GNULIB_READ=0; AC_SUBST([GNULIB_READ]) ++ GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) ++ GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) ++ GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) ++ GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) ++ GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) ++ GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) ++ GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) ++ GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING]) ++ GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) ++ GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) ++ GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) ++ GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) ++ GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) ++ HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) ++ HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) ++ HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) ++ HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) ++ HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) ++ HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) ++ HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC]) ++ HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) ++ HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) ++ HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) ++ HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) ++ HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) ++ HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) ++ HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) ++ HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) ++ HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) ++ HAVE_LINK=1; AC_SUBST([HAVE_LINK]) ++ HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) ++ HAVE_PIPE=1; AC_SUBST([HAVE_PIPE]) ++ HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) ++ HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) ++ HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) ++ HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) ++ HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) ++ HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) ++ HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) ++ HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) ++ HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) ++ HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) ++ HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) ++ HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) ++ HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) ++ HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) ++ HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) ++ HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) ++ HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) ++ HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R]) ++ HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) ++ HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) ++ REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) ++ REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) ++ REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) ++ REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) ++ REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) ++ REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) ++ REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) ++ REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) ++ REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) ++ REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) ++ REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) ++ REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) ++ REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) ++ REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) ++ REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) ++ REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) ++ REPLACE_READ=0; AC_SUBST([REPLACE_READ]) ++ REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) ++ REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) ++ REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) ++ REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) ++ REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) ++ REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) ++ REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) ++ REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) ++ REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) ++ UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) ++ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; ++ AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/vasnprintf.m4 b/xbmc/screensavers/rsxs-0.9/m4/vasnprintf.m4 +index 7ff3430..da0a6d9 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/vasnprintf.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/vasnprintf.m4 +@@ -1,30 +1,38 @@ +-# vasnprintf.m4 serial 5 +-dnl Copyright (C) 2002-2004 Free Software Foundation, Inc. ++# vasnprintf.m4 serial 34 ++dnl Copyright (C) 2002-2004, 2006-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + + AC_DEFUN([gl_FUNC_VASNPRINTF], + [ +- AC_REQUIRE([gl_EOVERFLOW]) +- AC_REPLACE_FUNCS(vasnprintf) ++ AC_CHECK_FUNCS_ONCE([vasnprintf]) + if test $ac_cv_func_vasnprintf = no; then +- AC_LIBOBJ(printf-args) +- AC_LIBOBJ(printf-parse) +- AC_LIBOBJ(asnprintf) +- gl_PREREQ_PRINTF_ARGS +- gl_PREREQ_PRINTF_PARSE +- gl_PREREQ_VASNPRINTF +- gl_PREREQ_ASNPRINTF ++ gl_REPLACE_VASNPRINTF + fi + ]) + ++AC_DEFUN([gl_REPLACE_VASNPRINTF], ++[ ++ AC_CHECK_FUNCS_ONCE([vasnprintf]) ++ AC_LIBOBJ([vasnprintf]) ++ AC_LIBOBJ([printf-args]) ++ AC_LIBOBJ([printf-parse]) ++ AC_LIBOBJ([asnprintf]) ++ if test $ac_cv_func_vasnprintf = yes; then ++ AC_DEFINE([REPLACE_VASNPRINTF], [1], ++ [Define if vasnprintf exists but is overridden by gnulib.]) ++ fi ++ gl_PREREQ_PRINTF_ARGS ++ gl_PREREQ_PRINTF_PARSE ++ gl_PREREQ_VASNPRINTF ++ gl_PREREQ_ASNPRINTF ++]) ++ + # Prequisites of lib/printf-args.h, lib/printf-args.c. + AC_DEFUN([gl_PREREQ_PRINTF_ARGS], + [ +- AC_REQUIRE([bh_C_SIGNED]) +- AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) +- AC_REQUIRE([gt_TYPE_LONGDOUBLE]) ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + AC_REQUIRE([gt_TYPE_WCHAR_T]) + AC_REQUIRE([gt_TYPE_WINT_T]) + ]) +@@ -32,24 +40,250 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], + # Prequisites of lib/printf-parse.h, lib/printf-parse.c. + AC_DEFUN([gl_PREREQ_PRINTF_PARSE], + [ +- AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) +- AC_REQUIRE([gt_TYPE_LONGDOUBLE]) ++ AC_REQUIRE([gl_FEATURES_H]) ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + AC_REQUIRE([gt_TYPE_WCHAR_T]) + AC_REQUIRE([gt_TYPE_WINT_T]) + AC_REQUIRE([AC_TYPE_SIZE_T]) +- AC_CHECK_TYPES(ptrdiff_t) ++ AC_CHECK_TYPE([ptrdiff_t], , ++ [AC_DEFINE([ptrdiff_t], [long], ++ [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) ++ ]) + AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) + ]) + + # Prerequisites of lib/vasnprintf.c. +-AC_DEFUN([gl_PREREQ_VASNPRINTF], ++AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], + [ ++ AC_REQUIRE([AC_C_INLINE]) + AC_REQUIRE([AC_FUNC_ALLOCA]) +- AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) +- AC_REQUIRE([gt_TYPE_LONGDOUBLE]) ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + AC_REQUIRE([gt_TYPE_WCHAR_T]) + AC_REQUIRE([gt_TYPE_WINT_T]) +- AC_CHECK_FUNCS(snprintf wcslen) ++ AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) ++ dnl Use the _snprintf function only if it is declared (because on NetBSD it ++ dnl is defined as a weak alias of snprintf; we prefer to use the latter). ++ AC_CHECK_DECLS([_snprintf], , , [[#include ]]) ++ dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization ++ dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE. ++ AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) ++ dnl We can avoid a lot of code by assuming that snprintf's return value ++ dnl conforms to ISO C99. So check that. ++ AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) ++ case "$gl_cv_func_snprintf_retval_c99" in ++ *yes) ++ AC_DEFINE([HAVE_SNPRINTF_RETVAL_C99], [1], ++ [Define if the return value of the snprintf function is the number of ++ of bytes (excluding the terminating NUL) that would have been produced ++ if the buffer had been large enough.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting 'long double' ++# arguments. ++AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], ++[ ++ AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) ++ case "$gl_cv_func_printf_long_double" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], ++ [Define if the vasnprintf implementation needs special code for ++ 'long double' arguments.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double' ++# arguments. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE], ++[ ++ AC_REQUIRE([gl_PRINTF_INFINITE]) ++ case "$gl_cv_func_printf_infinite" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1], ++ [Define if the vasnprintf implementation needs special code for ++ infinite 'double' arguments.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double' ++# arguments. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE], ++[ ++ AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) ++ dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if ++ dnl NEED_PRINTF_LONG_DOUBLE is already set. ++ AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE]) ++ case "$gl_cv_func_printf_long_double" in ++ *yes) ++ case "$gl_cv_func_printf_infinite_long_double" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1], ++ [Define if the vasnprintf implementation needs special code for ++ infinite 'long double' arguments.]) ++ ;; ++ esac ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], ++[ ++ AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) ++ case "$gl_cv_func_printf_directive_a" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1], ++ [Define if the vasnprintf implementation needs special code for ++ the 'a' and 'A' directives.]) ++ AC_CHECK_FUNCS([nl_langinfo]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F], ++[ ++ AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) ++ case "$gl_cv_func_printf_directive_f" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1], ++ [Define if the vasnprintf implementation needs special code for ++ the 'F' directive.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS], ++[ ++ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS]) ++ case "$gl_cv_func_printf_directive_ls" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1], ++ [Define if the vasnprintf implementation needs special code for ++ the 'ls' directive.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], ++[ ++ AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) ++ case "$gl_cv_func_printf_flag_grouping" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], ++ [Define if the vasnprintf implementation needs special code for the ++ ' flag.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST], ++[ ++ AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) ++ case "$gl_cv_func_printf_flag_leftadjust" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1], ++ [Define if the vasnprintf implementation needs special code for the ++ '-' flag.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], ++[ ++ AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) ++ case "$gl_cv_func_printf_flag_zero" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1], ++ [Define if the vasnprintf implementation needs special code for the ++ 0 flag.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting large precisions. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], ++[ ++ AC_REQUIRE([gl_PRINTF_PRECISION]) ++ case "$gl_cv_func_printf_precision" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1], ++ [Define if the vasnprintf implementation needs special code for ++ supporting large precisions without arbitrary bounds.]) ++ AC_DEFINE([NEED_PRINTF_DOUBLE], [1], ++ [Define if the vasnprintf implementation needs special code for ++ 'double' arguments.]) ++ AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], ++ [Define if the vasnprintf implementation needs special code for ++ 'long double' arguments.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory ++# conditions. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], ++[ ++ AC_REQUIRE([gl_PRINTF_ENOMEM]) ++ case "$gl_cv_func_printf_enomem" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_ENOMEM], [1], ++ [Define if the vasnprintf implementation needs special code for ++ surviving out-of-memory conditions.]) ++ AC_DEFINE([NEED_PRINTF_DOUBLE], [1], ++ [Define if the vasnprintf implementation needs special code for ++ 'double' arguments.]) ++ AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], ++ [Define if the vasnprintf implementation needs special code for ++ 'long double' arguments.]) ++ ;; ++ esac ++]) ++ ++# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], ++[ ++ AC_REQUIRE([gl_PREREQ_VASNPRINTF]) ++ gl_PREREQ_VASNPRINTF_LONG_DOUBLE ++ gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE ++ gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE ++ gl_PREREQ_VASNPRINTF_DIRECTIVE_A ++ gl_PREREQ_VASNPRINTF_DIRECTIVE_F ++ gl_PREREQ_VASNPRINTF_DIRECTIVE_LS ++ gl_PREREQ_VASNPRINTF_FLAG_GROUPING ++ gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST ++ gl_PREREQ_VASNPRINTF_FLAG_ZERO ++ gl_PREREQ_VASNPRINTF_PRECISION ++ gl_PREREQ_VASNPRINTF_ENOMEM + ]) + + # Prerequisites of lib/asnprintf.c. +diff --git a/xbmc/screensavers/rsxs-0.9/m4/vsnprintf.m4 b/xbmc/screensavers/rsxs-0.9/m4/vsnprintf.m4 +index cb8a9b1..d6ce1e6 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/vsnprintf.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/vsnprintf.m4 +@@ -1,13 +1,52 @@ +-# vsnprintf.m4 serial 2 +-dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. ++# vsnprintf.m4 serial 6 ++dnl Copyright (C) 2002-2004, 2007-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + ++dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s, ++dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib ++dnl must guarantee that the decision for replacing vsnprintf is a superset ++dnl of the reasons checked by libintl. + AC_DEFUN([gl_FUNC_VSNPRINTF], + [ +- AC_REPLACE_FUNCS(vsnprintf) +- AC_CHECK_DECLS_ONCE(vsnprintf) ++ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) ++ gl_cv_func_vsnprintf_usable=no ++ AC_CHECK_FUNCS([vsnprintf]) ++ if test $ac_cv_func_vsnprintf = yes; then ++ gl_SNPRINTF_SIZE1 ++ case "$gl_cv_func_snprintf_size1" in ++ *yes) ++ gl_SNPRINTF_RETVAL_C99 ++ case "$gl_cv_func_snprintf_retval_c99" in ++ *yes) ++ gl_PRINTF_POSITIONS ++ case "$gl_cv_func_printf_positions" in ++ *yes) ++ gl_cv_func_vsnprintf_usable=yes ++ ;; ++ esac ++ ;; ++ esac ++ ;; ++ esac ++ fi ++ if test $gl_cv_func_vsnprintf_usable = no; then ++ gl_REPLACE_VSNPRINTF ++ fi ++ AC_CHECK_DECLS_ONCE([vsnprintf]) ++ if test $ac_cv_have_decl_vsnprintf = no; then ++ HAVE_DECL_VSNPRINTF=0 ++ fi ++]) ++ ++AC_DEFUN([gl_REPLACE_VSNPRINTF], ++[ ++ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) ++ AC_LIBOBJ([vsnprintf]) ++ if test $ac_cv_func_vsnprintf = yes; then ++ REPLACE_VSNPRINTF=1 ++ fi + gl_PREREQ_VSNPRINTF + ]) + +diff --git a/xbmc/screensavers/rsxs-0.9/m4/warn-on-use.m4 b/xbmc/screensavers/rsxs-0.9/m4/warn-on-use.m4 +new file mode 100644 +index 0000000..f09deef +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/warn-on-use.m4 +@@ -0,0 +1,47 @@ ++# warn-on-use.m4 serial 4 ++dnl Copyright (C) 2010-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) ++# --------------------------------------- ++# For each whitespace-separated element in the list of NAMES, define ++# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES ++# even after being undefined as a macro. ++# ++# See warn-on-use.h for some hints on how to poison function names, as ++# well as ideas on poisoning global variables and macros. NAMES may ++# include global variables, but remember that only functions work with ++# _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single ++# header, but if the replacement header pulls in other headers because ++# some systems declare functions in the wrong header, then INCLUDES ++# should do likewise. ++# ++# If you assume C89, then it is generally safe to assume declarations ++# for functions declared in that standard (such as gets) without ++# needing gl_WARN_ON_USE_PREPARE. ++AC_DEFUN([gl_WARN_ON_USE_PREPARE], ++[ ++ m4_foreach_w([gl_decl], [$2], ++ [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), ++ [Define to 1 if ]m4_defn([gl_decl])[ is declared even after ++ undefining macros.])])dnl ++dnl FIXME: gl_Symbol must be used unquoted until we can assume ++dnl autoconf 2.64 or newer. ++ for gl_func in m4_flatten([$2]); do ++ AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl ++ AC_CACHE_CHECK([whether $gl_func is declared without a macro], ++ gl_Symbol, ++ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], ++[@%:@undef $gl_func ++ (void) $gl_func;])], ++ [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) ++ AS_VAR_IF(gl_Symbol, [yes], ++ [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) ++ dnl shortcut - if the raw declaration exists, then set a cache ++ dnl variable to allow skipping any later AC_CHECK_DECL efforts ++ eval ac_cv_have_decl_$gl_func=yes]) ++ AS_VAR_POPDEF([gl_Symbol])dnl ++ done ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/wchar_h.m4 b/xbmc/screensavers/rsxs-0.9/m4/wchar_h.m4 +new file mode 100644 +index 0000000..977491f +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/m4/wchar_h.m4 +@@ -0,0 +1,225 @@ ++dnl A placeholder for ISO C99 , for platforms that have issues. ++ ++dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl Written by Eric Blake. ++ ++# wchar_h.m4 serial 39 ++ ++AC_DEFUN([gl_WCHAR_H], ++[ ++ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) ++ AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) ++ dnl Prepare for creating substitute . ++ dnl Check for (missing in Linux uClibc when built without wide ++ dnl character support). ++ dnl is always overridden, because of GNULIB_POSIXCHECK. ++ gl_CHECK_NEXT_HEADERS([wchar.h]) ++ if test $ac_cv_header_wchar_h = yes; then ++ HAVE_WCHAR_H=1 ++ else ++ HAVE_WCHAR_H=0 ++ fi ++ AC_SUBST([HAVE_WCHAR_H]) ++ ++ AC_REQUIRE([gl_FEATURES_H]) ++ ++ AC_REQUIRE([gt_TYPE_WINT_T]) ++ if test $gt_cv_c_wint_t = yes; then ++ HAVE_WINT_T=1 ++ else ++ HAVE_WINT_T=0 ++ fi ++ AC_SUBST([HAVE_WINT_T]) ++ ++ dnl Check for declarations of anything we want to poison if the ++ dnl corresponding gnulib module is not in use. ++ gl_WARN_ON_USE_PREPARE([[ ++/* Tru64 with Desktop Toolkit C has a bug: must be included before ++ . ++ BSD/OS 4.0.1 has a bug: , and must be ++ included before . */ ++#if !(defined __GLIBC__ && !defined __UCLIBC__) ++# include ++# include ++# include ++#endif ++#include ++ ]], ++ [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb ++ wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset ++ wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp ++ wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr ++ wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth ++ ]) ++]) ++ ++dnl Check whether is usable at all. ++AC_DEFUN([gl_WCHAR_H_INLINE_OK], ++[ ++ dnl Test whether suffers due to the transition from '__inline' to ++ dnl 'gnu_inline'. See ++ dnl and . In summary, ++ dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and ++ dnl the option -std=c99 or -std=gnu99, leads to a broken . ++ AC_CACHE_CHECK([whether uses 'inline' correctly], ++ [gl_cv_header_wchar_h_correct_inline], ++ [gl_cv_header_wchar_h_correct_inline=yes ++ AC_LANG_CONFTEST([ ++ AC_LANG_SOURCE([[#define wcstod renamed_wcstod ++/* Tru64 with Desktop Toolkit C has a bug: must be included before ++ . ++ BSD/OS 4.0.1 has a bug: , and must be ++ included before . */ ++#include ++#include ++#include ++#include ++extern int zero (void); ++int main () { return zero(); } ++]])]) ++ if AC_TRY_EVAL([ac_compile]); then ++ mv conftest.$ac_objext conftest1.$ac_objext ++ AC_LANG_CONFTEST([ ++ AC_LANG_SOURCE([[#define wcstod renamed_wcstod ++/* Tru64 with Desktop Toolkit C has a bug: must be included before ++ . ++ BSD/OS 4.0.1 has a bug: , and must be ++ included before . */ ++#include ++#include ++#include ++#include ++int zero (void) { return 0; } ++]])]) ++ if AC_TRY_EVAL([ac_compile]); then ++ mv conftest.$ac_objext conftest2.$ac_objext ++ if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then ++ : ++ else ++ gl_cv_header_wchar_h_correct_inline=no ++ fi ++ fi ++ fi ++ rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext ++ ]) ++ if test $gl_cv_header_wchar_h_correct_inline = no; then ++ AC_MSG_ERROR([ cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). ++This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in ++C99 mode. You have four options: ++ - Add the flag -fgnu89-inline to CC and reconfigure, or ++ - Fix your include files, using parts of ++ , or ++ - Use a gcc version older than 4.3, or ++ - Don't use the flags -std=c99 or -std=gnu99. ++Configuration aborted.]) ++ fi ++]) ++ ++AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) ++ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ++ dnl Define it also as a C macro, for the benefit of the unit tests. ++ gl_MODULE_INDICATOR_FOR_TESTS([$1]) ++]) ++ ++AC_DEFUN([gl_WCHAR_H_DEFAULTS], ++[ ++ GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) ++ GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) ++ GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) ++ GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) ++ GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) ++ GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) ++ GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) ++ GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) ++ GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) ++ GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) ++ GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) ++ GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR]) ++ GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP]) ++ GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY]) ++ GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE]) ++ GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET]) ++ GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN]) ++ GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN]) ++ GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY]) ++ GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY]) ++ GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY]) ++ GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY]) ++ GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT]) ++ GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT]) ++ GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP]) ++ GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP]) ++ GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP]) ++ GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP]) ++ GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL]) ++ GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM]) ++ GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP]) ++ GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR]) ++ GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR]) ++ GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN]) ++ GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN]) ++ GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK]) ++ GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR]) ++ GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK]) ++ GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH]) ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) ++ HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) ++ HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC]) ++ HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN]) ++ HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS]) ++ HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS]) ++ HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) ++ HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) ++ HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) ++ HAVE_WMEMCHR=1; AC_SUBST([HAVE_WMEMCHR]) ++ HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP]) ++ HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY]) ++ HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE]) ++ HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET]) ++ HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN]) ++ HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN]) ++ HAVE_WCSCPY=1; AC_SUBST([HAVE_WCSCPY]) ++ HAVE_WCPCPY=1; AC_SUBST([HAVE_WCPCPY]) ++ HAVE_WCSNCPY=1; AC_SUBST([HAVE_WCSNCPY]) ++ HAVE_WCPNCPY=1; AC_SUBST([HAVE_WCPNCPY]) ++ HAVE_WCSCAT=1; AC_SUBST([HAVE_WCSCAT]) ++ HAVE_WCSNCAT=1; AC_SUBST([HAVE_WCSNCAT]) ++ HAVE_WCSCMP=1; AC_SUBST([HAVE_WCSCMP]) ++ HAVE_WCSNCMP=1; AC_SUBST([HAVE_WCSNCMP]) ++ HAVE_WCSCASECMP=1; AC_SUBST([HAVE_WCSCASECMP]) ++ HAVE_WCSNCASECMP=1; AC_SUBST([HAVE_WCSNCASECMP]) ++ HAVE_WCSCOLL=1; AC_SUBST([HAVE_WCSCOLL]) ++ HAVE_WCSXFRM=1; AC_SUBST([HAVE_WCSXFRM]) ++ HAVE_WCSDUP=1; AC_SUBST([HAVE_WCSDUP]) ++ HAVE_WCSCHR=1; AC_SUBST([HAVE_WCSCHR]) ++ HAVE_WCSRCHR=1; AC_SUBST([HAVE_WCSRCHR]) ++ HAVE_WCSCSPN=1; AC_SUBST([HAVE_WCSCSPN]) ++ HAVE_WCSSPN=1; AC_SUBST([HAVE_WCSSPN]) ++ HAVE_WCSPBRK=1; AC_SUBST([HAVE_WCSPBRK]) ++ HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR]) ++ HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) ++ HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) ++ HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) ++ HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) ++ REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) ++ REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) ++ REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB]) ++ REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT]) ++ REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC]) ++ REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN]) ++ REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS]) ++ REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS]) ++ REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB]) ++ REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) ++ REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) ++ REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) ++ REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) ++]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/wchar_t.m4 b/xbmc/screensavers/rsxs-0.9/m4/wchar_t.m4 +index cde2129..d2c03c4 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/wchar_t.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/wchar_t.m4 +@@ -1,5 +1,5 @@ +-# wchar_t.m4 serial 1 (gettext-0.12) +-dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. ++# wchar_t.m4 serial 4 (gettext-0.18.2) ++dnl Copyright (C) 2002-2003, 2008-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -10,11 +10,15 @@ dnl Prerequisite: AC_PROG_CC + + AC_DEFUN([gt_TYPE_WCHAR_T], + [ +- AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, +- [AC_TRY_COMPILE([#include +- wchar_t foo = (wchar_t)'\0';], , +- gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) ++ AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ++ wchar_t foo = (wchar_t)'\0';]], ++ [[]])], ++ [gt_cv_c_wchar_t=yes], ++ [gt_cv_c_wchar_t=no])]) + if test $gt_cv_c_wchar_t = yes; then +- AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) ++ AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) + fi + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/wint_t.m4 b/xbmc/screensavers/rsxs-0.9/m4/wint_t.m4 +index b8fff9c..da1ce3d 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/wint_t.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/wint_t.m4 +@@ -1,5 +1,5 @@ +-# wint_t.m4 serial 1 (gettext-0.12) +-dnl Copyright (C) 2003 Free Software Foundation, Inc. ++# wint_t.m4 serial 5 (gettext-0.18.2) ++dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -10,11 +10,23 @@ dnl Prerequisite: AC_PROG_CC + + AC_DEFUN([gt_TYPE_WINT_T], + [ +- AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, +- [AC_TRY_COMPILE([#include +- wint_t foo = (wchar_t)'\0';], , +- gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) ++ AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[ ++/* Tru64 with Desktop Toolkit C has a bug: must be included before ++ . ++ BSD/OS 4.0.1 has a bug: , and must be included ++ before . */ ++#include ++#include ++#include ++#include ++ wint_t foo = (wchar_t)'\0';]], ++ [[]])], ++ [gt_cv_c_wint_t=yes], ++ [gt_cv_c_wint_t=no])]) + if test $gt_cv_c_wint_t = yes; then +- AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) ++ AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) + fi + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/m4/xsize.m4 b/xbmc/screensavers/rsxs-0.9/m4/xsize.m4 +index 85bb721..8c693bc6 100644 +--- a/xbmc/screensavers/rsxs-0.9/m4/xsize.m4 ++++ b/xbmc/screensavers/rsxs-0.9/m4/xsize.m4 +@@ -1,5 +1,5 @@ +-# xsize.m4 serial 3 +-dnl Copyright (C) 2003-2004 Free Software Foundation, Inc. ++# xsize.m4 serial 4 ++dnl Copyright (C) 2003-2004, 2008-2011 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -9,5 +9,5 @@ AC_DEFUN([gl_XSIZE], + dnl Prerequisites of lib/xsize.h. + AC_REQUIRE([gl_SIZE_MAX]) + AC_REQUIRE([AC_C_INLINE]) +- AC_CHECK_HEADERS(stdint.h) ++ AC_CHECK_HEADERS([stdint.h]) + ]) +diff --git a/xbmc/screensavers/rsxs-0.9/snippet/_Noreturn.h b/xbmc/screensavers/rsxs-0.9/snippet/_Noreturn.h +new file mode 100644 +index 0000000..1a7b4da +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/snippet/_Noreturn.h +@@ -0,0 +1,10 @@ ++#ifndef _Noreturn ++# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ ++ || 0x5110 <= __SUNPRO_C) ++# define _Noreturn __attribute__ ((__noreturn__)) ++# elif 1200 <= _MSC_VER ++# define _Noreturn __declspec (noreturn) ++# else ++# define _Noreturn ++# endif ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/snippet/arg-nonnull.h b/xbmc/screensavers/rsxs-0.9/snippet/arg-nonnull.h +new file mode 100644 +index 0000000..6c2f1e8 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/snippet/arg-nonnull.h +@@ -0,0 +1,26 @@ ++/* A C macro for declaring that specific arguments must not be NULL. ++ Copyright (C) 2009-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools ++ that the values passed as arguments n, ..., m must be non-NULL pointers. ++ n = 1 stands for the first argument, n = 2 for the second argument etc. */ ++#ifndef _GL_ARG_NONNULL ++# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 ++# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) ++# else ++# define _GL_ARG_NONNULL(params) ++# endif ++#endif +diff --git a/xbmc/screensavers/rsxs-0.9/snippet/c++defs.h b/xbmc/screensavers/rsxs-0.9/snippet/c++defs.h +new file mode 100644 +index 0000000..b6821a6 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/snippet/c++defs.h +@@ -0,0 +1,271 @@ ++/* C++ compatible function declaration macros. ++ Copyright (C) 2010-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#ifndef _GL_CXXDEFS_H ++#define _GL_CXXDEFS_H ++ ++/* The three most frequent use cases of these macros are: ++ ++ * For providing a substitute for a function that is missing on some ++ platforms, but is declared and works fine on the platforms on which ++ it exists: ++ ++ #if @GNULIB_FOO@ ++ # if !@HAVE_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on all platforms, ++ but is broken/insufficient and needs to be replaced on some platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++ ++ * For providing a replacement for a function that exists on some platforms ++ but is broken/insufficient and needs to be replaced on some of them and ++ is additionally either missing or undeclared on some other platforms: ++ ++ #if @GNULIB_FOO@ ++ # if @REPLACE_FOO@ ++ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++ # undef foo ++ # define foo rpl_foo ++ # endif ++ _GL_FUNCDECL_RPL (foo, ...); ++ _GL_CXXALIAS_RPL (foo, ...); ++ # else ++ # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ ++ _GL_FUNCDECL_SYS (foo, ...); ++ # endif ++ _GL_CXXALIAS_SYS (foo, ...); ++ # endif ++ _GL_CXXALIASWARN (foo); ++ #elif defined GNULIB_POSIXCHECK ++ ... ++ #endif ++*/ ++ ++/* _GL_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#if defined __cplusplus ++# define _GL_EXTERN_C extern "C" ++#else ++# define _GL_EXTERN_C extern ++#endif ++ ++/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); ++ declares a replacement function, named rpl_func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ ++ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) ++#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype rpl_func parameters_and_attributes ++ ++/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); ++ declares the system function, named func, with the given prototype, ++ consisting of return type, parameters, and attributes. ++ Example: ++ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) ++ _GL_ARG_NONNULL ((1))); ++ */ ++#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C rettype func parameters_and_attributes ++ ++/* _GL_CXXALIAS_RPL (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. ++ Example: ++ _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); ++ */ ++#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ ++ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = ::rpl_func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); ++ is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); ++ except that the C function rpl_func may have a slightly different ++ declaration. A cast is used to silence the "invalid conversion" error ++ that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ rettype (*const func) parameters = \ ++ reinterpret_cast(::rpl_func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS (func, rettype, parameters); ++ declares a C++ alias called GNULIB_NAMESPACE::func ++ that redirects to the system provided function func, if GNULIB_NAMESPACE ++ is defined. ++ Example: ++ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); ++ */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* If we were to write ++ rettype (*const func) parameters = ::func; ++ like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls ++ better (remove an indirection through a 'static' pointer variable), ++ but then the _GL_CXXALIASWARN macro below would cause a warning not only ++ for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = ::func; \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function func may have a slightly different declaration. ++ A cast is used to silence the "invalid conversion" error that would ++ otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast(::func); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); ++ is like _GL_CXXALIAS_SYS (func, rettype, parameters); ++ except that the C function is picked among a set of overloaded functions, ++ namely the one with rettype2 and parameters2. Two consecutive casts ++ are used to silence the "cannot find a match" and "invalid conversion" ++ errors that would otherwise occur. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++ /* The outer cast must be a reinterpret_cast. ++ The inner cast: When the function is defined as a set of overloaded ++ functions, it works as a static_cast<>, choosing the designated variant. ++ When the function is defined as a single variant, it works as a ++ reinterpret_cast<>. The parenthesized cast syntax works both ways. */ ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ namespace GNULIB_NAMESPACE \ ++ { \ ++ static rettype (*func) parameters = \ ++ reinterpret_cast( \ ++ (rettype2(*)parameters2)(::func)); \ ++ } \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#else ++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN (func); ++ causes a warning to be emitted when ::func is used but not when ++ GNULIB_NAMESPACE::func is used. func must be defined without overloaded ++ variants. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN(func) \ ++ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN_1(func,namespace) \ ++ _GL_CXXALIASWARN_2 (func, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_WARN_ON_USE (func, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN_2(func,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN(func) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); ++ causes a warning to be emitted when the given overloaded variant of ::func ++ is used but not when GNULIB_NAMESPACE::func is used. */ ++#if defined __cplusplus && defined GNULIB_NAMESPACE ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ ++ GNULIB_NAMESPACE) ++# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) ++/* To work around GCC bug , ++ we enable the warning only when not optimizing. */ ++# if !__OPTIMIZE__ ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ ++ "The symbol ::" #func " refers to the system function. " \ ++ "Use " #namespace "::" #func " instead.") ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ extern __typeof__ (func) func ++# else ++# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++# endif ++#else ++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ ++ _GL_EXTERN_C int _gl_cxxalias_dummy ++#endif ++ ++#endif /* _GL_CXXDEFS_H */ +diff --git a/xbmc/screensavers/rsxs-0.9/snippet/warn-on-use.h b/xbmc/screensavers/rsxs-0.9/snippet/warn-on-use.h +new file mode 100644 +index 0000000..2cdeec3 +--- /dev/null ++++ b/xbmc/screensavers/rsxs-0.9/snippet/warn-on-use.h +@@ -0,0 +1,109 @@ ++/* A C macro for emitting warnings if a function is used. ++ Copyright (C) 2010-2011 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* _GL_WARN_ON_USE (function, "literal string") issues a declaration ++ for FUNCTION which will then trigger a compiler warning containing ++ the text of "literal string" anywhere that function is called, if ++ supported by the compiler. If the compiler does not support this ++ feature, the macro expands to an unused extern declaration. ++ ++ This macro is useful for marking a function as a potential ++ portability trap, with the intent that "literal string" include ++ instructions on the replacement function that should be used ++ instead. However, one of the reasons that a function is a ++ portability trap is if it has the wrong signature. Declaring ++ FUNCTION with a different signature in C is a compilation error, so ++ this macro must use the same type as any existing declaration so ++ that programs that avoid the problematic FUNCTION do not fail to ++ compile merely because they included a header that poisoned the ++ function. But this implies that _GL_WARN_ON_USE is only safe to ++ use if FUNCTION is known to already have a declaration. Use of ++ this macro implies that there must not be any other macro hiding ++ the declaration of FUNCTION; but undefining FUNCTION first is part ++ of the poisoning process anyway (although for symbols that are ++ provided only via a macro, the result is a compilation error rather ++ than a warning containing "literal string"). Also note that in ++ C++, it is only safe to use if FUNCTION has no overloads. ++ ++ For an example, it is possible to poison 'getline' by: ++ - adding a call to gl_WARN_ON_USE_PREPARE([[#include ]], ++ [getline]) in configure.ac, which potentially defines ++ HAVE_RAW_DECL_GETLINE ++ - adding this code to a header that wraps the system : ++ #undef getline ++ #if HAVE_RAW_DECL_GETLINE ++ _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" ++ "not universally present; use the gnulib module getline"); ++ #endif ++ ++ It is not possible to directly poison global variables. But it is ++ possible to write a wrapper accessor function, and poison that ++ (less common usage, like &environ, will cause a compilation error ++ rather than issue the nice warning, but the end result of informing ++ the developer about their portability problem is still achieved): ++ #if HAVE_RAW_DECL_ENVIRON ++ static inline char ***rpl_environ (void) { return &environ; } ++ _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); ++ # undef environ ++ # define environ (*rpl_environ ()) ++ #endif ++ */ ++#ifndef _GL_WARN_ON_USE ++ ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++/* A compiler attribute is available in gcc versions 4.3.0 and later. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function __attribute__ ((__warning__ (message))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE(function, message) \ ++extern __typeof__ (function) function ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE(function, message) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") ++ is like _GL_WARN_ON_USE (function, "string"), except that the function is ++ declared with the given prototype, consisting of return type, parameters, ++ and attributes. ++ This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does ++ not work in this case. */ ++#ifndef _GL_WARN_ON_USE_CXX ++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes \ ++ __attribute__ ((__warning__ (msg))) ++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING ++/* Verify the existence of the function. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++extern rettype function parameters_and_attributes ++# else /* Unsupported. */ ++# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ ++_GL_WARN_EXTERN_C int _gl_warn_on_use ++# endif ++#endif ++ ++/* _GL_WARN_EXTERN_C declaration; ++ performs the declaration with C linkage. */ ++#ifndef _GL_WARN_EXTERN_C ++# if defined __cplusplus ++# define _GL_WARN_EXTERN_C extern "C" ++# else ++# define _GL_WARN_EXTERN_C extern ++# endif ++#endif +-- +1.8.1.5 + + +From 64b6ea72bdfc6649013baf9bd1ddb793160bae35 Mon Sep 17 00:00:00 2001 +From: t-nelson +Date: Tue, 9 Apr 2013 16:44:11 -0400 +Subject: [PATCH 3/3] Fixup OSX build after rsxs changes. + +--- + tools/depends/target/config.site.in | 2 +- + xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.h | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tools/depends/target/config.site.in b/tools/depends/target/config.site.in +index 7719297..26e8479 100644 +--- a/tools/depends/target/config.site.in ++++ b/tools/depends/target/config.site.in +@@ -66,7 +66,7 @@ ac_cv_func_gethostbyname_r=no + ac_cv_header_sys_un_h=yes + + #rsxs/projectm +-jm_cv_func_gettimeofday_clobber=no ++gl_cv_func_gettimeofday_clobber=no + mac_cv_pkg_ldflags=-lz + if test "@platform_os@" = "osx"; then + ac_cv_func_strnlen_working=no +diff --git a/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.h b/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.h +index f664254..7601aa8 100644 +--- a/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.h ++++ b/xbmc/screensavers/rsxs-0.9/lib/argp-fmtstream.h +@@ -241,7 +241,7 @@ extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, + Apple gcc 4.0.1 -std=gnu99 ok error warning + */ + # if defined __GNUC_STDC_INLINE__ +-# define ARGP_FS_EI inline ++# define ARGP_FS_EI static inline + # elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) + # define ARGP_FS_EI extern inline __attribute__ ((__gnu_inline__)) + # else +@@ -250,7 +250,7 @@ extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, + # else + /* With other compilers, assume the ISO C99 meaning of 'inline', if + the compiler supports 'inline' at all. */ +-# define ARGP_FS_EI inline ++# define ARGP_FS_EI static inline + # endif + #endif + +-- +1.8.1.5 + diff --git a/packages/mediacenter/xbmc/patches/74fa128/xbmc-999.08-PR2572-1.patch b/packages/mediacenter/xbmc/patches/74fa128/xbmc-999.08-PR2572-1.patch new file mode 100644 index 0000000000..283db95485 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/74fa128/xbmc-999.08-PR2572-1.patch @@ -0,0 +1,54 @@ +diff -Naur xbmc-74fa128/xbmc/screensavers/rsxs-0.9/lib/stdio.h xbmc-74fa128.patch/xbmc/screensavers/rsxs-0.9/lib/stdio.h +diff -Naur xbmc-74fa128/xbmc/screensavers/rsxs-0.9/lib/stdio.in.h xbmc-74fa128.patch/xbmc/screensavers/rsxs-0.9/lib/stdio.in.h +--- xbmc-74fa128/xbmc/screensavers/rsxs-0.9/lib/stdio.in.h 2013-04-13 23:19:12.183315057 +0200 ++++ xbmc-74fa128.patch/xbmc/screensavers/rsxs-0.9/lib/stdio.in.h 2013-04-13 23:42:24.552302369 +0200 +@@ -699,26 +699,14 @@ + # endif + #endif + +-#if @GNULIB_GETS@ +-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +-# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +-# undef gets +-# define gets rpl_gets +-# endif +-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1))); +-_GL_CXXALIAS_RPL (gets, char *, (char *s)); +-# else +-_GL_CXXALIAS_SYS (gets, char *, (char *s)); +-# undef gets +-# endif +-_GL_CXXALIASWARN (gets); + /* It is very rare that the developer ever has full control of stdin, +- so any use of gets warrants an unconditional warning. Assume it is +- always declared, since it is required by C89. */ ++ so any use of gets warrants an unconditional warning; besides, C11 ++ removed it. */ ++#undef gets ++#if HAVE_RAW_DECL_GETS + _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); + #endif + +- + #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ + struct obstack; + /* Grow an obstack with formatted output. Return the number of +diff -Naur xbmc-74fa128/xbmc/screensavers/rsxs-0.9/m4/stdio_h.m4 xbmc-74fa128.patch/xbmc/screensavers/rsxs-0.9/m4/stdio_h.m4 +--- xbmc-74fa128/xbmc/screensavers/rsxs-0.9/m4/stdio_h.m4 2013-04-13 23:19:12.216314905 +0200 ++++ xbmc-74fa128.patch/xbmc/screensavers/rsxs-0.9/m4/stdio_h.m4 2013-04-13 23:37:54.379416637 +0200 +@@ -18,7 +18,6 @@ + GNULIB_GETC=1 + GNULIB_GETCHAR=1 + GNULIB_FGETS=1 +- GNULIB_GETS=1 + GNULIB_FREAD=1 + dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c" + dnl "expected source file, required through AC_LIBSOURCES, not found". It is +@@ -113,7 +112,6 @@ + GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR]) + GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) + GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) +- GNULIB_GETS=0; AC_SUBST([GNULIB_GETS]) + GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) + GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) + GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE])