gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, ocsp, updated. gnutls_3_0_11-76-ga220518


From: Simon Josefsson
Subject: [SCM] GNU gnutls branch, ocsp, updated. gnutls_3_0_11-76-ga220518
Date: Thu, 12 Jan 2012 10:14:10 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=a2205185e6709ed9c2ded793ad7b52fec2f64872

The branch, ocsp has been updated
       via  a2205185e6709ed9c2ded793ad7b52fec2f64872 (commit)
       via  2ab2e5cd8acba95851461c880c5a57714a792d5b (commit)
       via  d22267bd36b76e5d72edd8fdb9b81bb901d6136f (commit)
       via  d6708897f61b44f6e57d4206c7a9f9fc86e26d51 (commit)
       via  404c67dc3913e1d7bcafea73788c6b83d72bf498 (commit)
       via  388524a37dbc278a697e543bd24260679ff3858f (commit)
       via  0fa6db2e68e1e0141d727cf57e9a0f9d2e56f8bd (commit)
       via  82da6fb2c6d5023d1a5628127f8016ebb92853b5 (commit)
       via  ae59e39662f934f2e697a2b546cdda4cfe4eb9b6 (commit)
       via  50bf5fce421aba5214d7260973514b05db0785a9 (commit)
       via  0ad7654f3b06d4ef2810a46289d032e6cd1509b0 (commit)
       via  009593680ab18c42bc6b80766285ddacde10c01a (commit)
       via  aea85eb5bf997f03c896b01b3839f6eb33ae41e6 (commit)
       via  1d7dd842ce72938fb1c7eb581b1cf1c58013cc4e (commit)
       via  00c60d4d655c7461cf1acb62d9dc4ad5ddcae6ef (commit)
       via  2cac1ae6f667a9bbba8fd090a7d560cb6a64db80 (commit)
       via  2aa6a1eb270188f99caaaa25f44af042f8e9a4f7 (commit)
       via  f773453757b61bae4a1a76ff413e1525d0aff630 (commit)
       via  204f8b3dbf658bdbc418227d14e400725d2646e5 (commit)
       via  676b4da6b9737e2113326c3c8e606e3616a2904b (commit)
       via  3eece98521d1965bd260b5f4a4e38835b01a9d35 (commit)
       via  8856e3cc30ef3fd3aba7cffafe8581a4287793fb (commit)
       via  db5619592b13c448c60373d4229ecc2105821c51 (commit)
       via  f1f79baf66a79227246160ea49a805f60d5d6b68 (commit)
       via  391cf5f64bc1bb263a33d1f7be9889be09161272 (commit)
       via  b0b55b40f3200cc5227d46de679e2e7311dce372 (commit)
       via  2d6fbf53e588681ed0dcca2aef4efc168cc0f64c (commit)
       via  52400b5ae463c90f83538ad43a76d61ced97f71d (commit)
       via  3dc1f4ad374c3e986fb3ab3c78442e9adfcce018 (commit)
       via  c21d24edeced2ff0b06418c25c4fdfa77b6e4e97 (commit)
       via  003bc980af051bbf2b88b4309ebea377a09192a6 (commit)
       via  9763f6735821f0df9da5d1996584f30741108130 (commit)
       via  f935f4fec2b7aae9f3b5fa3308dd6fb9483a5845 (commit)
       via  a7a6495414befe9b69578aa06cfe6c203c2d4289 (commit)
       via  f2dbc308adb7ce9523122c5e57bd93f872dc01bd (commit)
       via  54152a2f22626619575a0df9cd15027990d79529 (commit)
       via  c7f54f41d0aef87776d8c816e2e841cb94e2fc4a (commit)
       via  10267466bde4b80af1c5c7cff8129ce92da99179 (commit)
       via  543a98568b1c020444060da8279f0c2fcae1836d (commit)
       via  92c407a6981318948e68f731d3201c51fb35d013 (commit)
       via  35e26ca63c6da01db460d93e9c4bf86cd668534c (commit)
       via  38718fe94ae05a81a2acc437dd3bf24af0173143 (commit)
       via  012c3aed2d1aad76c5328503daee1b88928663d5 (commit)
       via  7f8378d85e8313f4882dc9d9ded0b29ec06b44b4 (commit)
       via  ca1014b437a5e86aa9889e4543918b266e1bae82 (commit)
       via  d067e6aa9d81b6af229495c372a1885b217a37ec (commit)
       via  98356f96e64839ff0b129659c2276283191684b4 (commit)
       via  34dedf66c517768b79df229bc0a2067e7aa7568d (commit)
       via  0050adc941008c8a4f9bc742d335e9894226e1e0 (commit)
       via  a58f394e8dab0f309f340d743a5992213a748e0c (commit)
       via  ac62c8900d2f87c4232165ab1e294b4c65ce4db1 (commit)
       via  8da72347a8ba8f2011fda06d725ee99b4901a7b1 (commit)
       via  d07a85c2437d5ce1c197d692ce9052eedff1f488 (commit)
       via  5440504c39326d35fa02bb61f1f6248dc115ee2f (commit)
       via  9710320f8e5a84b3f97efb5fbb24903e00e5fe13 (commit)
       via  da774307b84256aaf9c7c16b286baadd9c67dd55 (commit)
       via  394189a3bddb59f32c27bab388786b035591758d (commit)
       via  06c6a7ed3f7448bf2a94af14c10d872e71f97269 (commit)
       via  07cd58a5b21bca3d59d62285fae68dd341433c43 (commit)
       via  d7e446cc292403140f8462726a69d3e88c503481 (commit)
       via  10ce2625f2625149083e66232795e7b20e3609ad (commit)
       via  340a2a99d6a6b4a98fab75b876422d74ff8d22d2 (commit)
       via  f261fcd88326433616f71a190915307f371a1e5b (commit)
       via  412ea9fc5af9f54ca9375e9f73c051f510478d4c (commit)
       via  92353d742863ce89d4b1861c6fed26228e391ed2 (commit)
       via  5621ffb8c5787db64020e2a31df188e00fbc5140 (commit)
       via  78fea838ce924346b12e615c44d6b7274f3b898e (commit)
       via  c2de7463641d31662766ff95a0d2cc8aa90801b5 (commit)
       via  ed060c35c6977012e1eb5669b2af5551325c9c4e (commit)
       via  59821cf60e9ee33ee314a0c9abd8058411196f49 (commit)
       via  f6b42a5e54f4b155653dea44c51498ebfd379ffd (commit)
       via  b4abb6273b5463e478839f3c5878c7653801ecec (commit)
       via  4bcdbb03b14770ae7cd98ea4767dba9ef22c2500 (commit)
       via  05cf15edd2dac479b0eeb0fc26b33c1b9663b94e (commit)
       via  6e1f1f28325a352a8946a74a0ad16e3f17f26335 (commit)
       via  941b82caa389cca3b1dc9a951550f0dadf697aac (commit)
       via  7e93c45fcda6c686f3e7e959e00bed2ab055c80a (commit)
       via  395bcc6855c87ac90dc02652a509d14e60c95c6c (commit)
       via  60fad8ae0685be34d13580d9b6b692aadae683fd (commit)
       via  2f6f33e6f1a885f0f234974c3bce4ae65d37a86b (commit)
       via  cb9d7a311b04052dfe89f37adf6e3228051c194a (commit)
       via  4fb516a49eb273e5fa5241cc49d262ee6a038ae9 (commit)
       via  f529cabd38680a5fef482c5eb8c1bb10455fb8d1 (commit)
       via  710db6c8fc44ddbf7bd4f532c322645ce4fd590d (commit)
       via  31d6bfe0681d077bf8037a21dc812b9ed6131f70 (commit)
       via  a5740135b13ca5bf9bfbd43ce707b59fe45bb5f4 (commit)
       via  72522be784257dfaea1e204b5a80ffa14d509dad (commit)
       via  76f2856a51f4cae238aa3117e03ac7a8204dff9f (commit)
       via  78bf1de9b111485037388893bf2ccc766f8d167d (commit)
       via  8d4c4cafee906ea8e5f27de6a1c8d1cb45117eda (commit)
       via  87ed97f3046dcc7f80d4ae70b40045f3a82112ed (commit)
       via  c279f32d5ffc41ab41a1441687dcb9daea5e6475 (commit)
       via  725cf45965e66b8d5a19fa39b679d0a2c505ce0f (commit)
       via  d2ff834b0b7224f808eea3e2f3cda0b8d0f17a08 (commit)
       via  89ee549eb59e2d627548bb79e2ccfa589791d98c (commit)
       via  ed1a8c31f04de6313533db28b3154efdd4338533 (commit)
       via  7e4d424ef99f39a2a6d5fd13146281d9744d3c0b (commit)
       via  e38f4775671c15170638c865d2edf3025930ef76 (commit)
       via  7f2a529e3dfad850e2cbd599ab3c4a4febbea05c (commit)
       via  79af6bb434d646b6a05f19b699c68ceba11fb704 (commit)
      from  7a699900587e733ca174fd08089618e199b607b2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a2205185e6709ed9c2ded793ad7b52fec2f64872
Merge: 7a69990 2ab2e5c
Author: Simon Josefsson <address@hidden>
Date:   Thu Jan 12 11:12:04 2012 +0100

    Merge with master.

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                         |    7 +
 ChangeLog                                          |  372 ++++-
 GNUmakefile                                        |    6 +-
 NEWS                                               |   64 +-
 THANKS                                             |    2 +
 build-aux/config.rpath                             |    2 +-
 build-aux/pmccabe2html                             |    2 +-
 build-aux/snippet/arg-nonnull.h                    |    2 +-
 build-aux/snippet/c++defs.h                        |    2 +-
 build-aux/snippet/warn-on-use.h                    |    2 +-
 build-aux/useless-if-before-free                   |   10 +-
 build-aux/vc-list-files                            |    2 +-
 configure.ac                                       |   14 +-
 cross.mk                                           |  115 ++
 doc/Makefile.am                                    |   16 +-
 doc/cha-bib.texi                                   |    5 +
 doc/cha-cert-auth.texi                             |   49 +-
 doc/cha-cert-auth2.texi                            |  139 +-
 doc/cha-ciphersuites.texi                          |    4 +-
 doc/cha-copying.texi                               |   10 +-
 doc/cha-gtls-app.texi                              |  205 ++-
 doc/cha-gtls-examples.texi                         |   80 +-
 doc/cha-internals.texi                             |   13 +-
 doc/cha-intro-tls.texi                             |   10 +-
 doc/cha-library.texi                               |   14 +-
 doc/cha-programs.texi                              |   66 +-
 doc/cha-shared-key.texi                            |   24 +-
 doc/examples/Makefile.am                           |    8 +-
 doc/examples/{ex-client1.c => ex-client-anon.c}    |    6 +-
 doc/examples/{ex-client-udp.c => ex-client-dtls.c} |    8 +-
 doc/examples/ex-client-psk.c                       |    6 +-
 doc/examples/ex-client-resume.c                    |    6 +-
 doc/examples/ex-client-srp.c                       |    6 +-
 doc/examples/{ex-rfc2818.c => ex-client-x509.c}    |    2 +
 doc/examples/ex-serv-anon.c                        |    8 +-
 doc/examples/ex-serv-dtls.c                        |  433 +++++
 doc/examples/ex-serv-srp.c                         |    8 +-
 doc/examples/{ex-serv1.c => ex-serv-x509.c}        |   51 +-
 doc/examples/udp.c                                 |   18 +-
 doc/gnutls.texi                                    |    2 +-
 doc/latex/.gitignore                               |    1 -
 doc/latex/{cover-epub.tex => cover.tex}            |   31 +-
 doc/latex/gnutls.bib                               |    9 +
 doc/manpages/Makefile.am                           |    1 +
 extra/includes/gnutls/openssl.h                    |    2 +
 gl/Makefile.am                                     |   35 +-
 gl/accept.c                                        |    2 +-
 gl/alloca.c                                        |    2 +-
 gl/alloca.in.h                                     |    2 +-
 gl/alphasort.c                                     |    2 +-
 gl/argp-ba.c                                       |    6 +-
 gl/argp-eexst.c                                    |    2 +-
 gl/argp-fmtstream.c                                |    4 +-
 gl/argp-fmtstream.h                                |    4 +-
 gl/argp-fs-xinl.c                                  |    2 +-
 gl/argp-help.c                                     |   39 +-
 gl/argp-namefrob.h                                 |    2 +-
 gl/argp-parse.c                                    |   10 +-
 gl/argp-pin.c                                      |    2 +-
 gl/argp-pv.c                                       |    2 +-
 gl/argp-pvh.c                                      |    2 +-
 gl/argp-xinl.c                                     |    2 +-
 gl/argp.h                                          |   36 +-
 gl/arpa_inet.in.h                                  |    2 +-
 gl/asnprintf.c                                     |    2 +-
 gl/asprintf.c                                      |    2 +-
 gl/basename-lgpl.c                                 |    2 +-
 gl/bind.c                                          |    2 +-
 gl/byteswap.in.h                                   |    2 +-
 gl/c-ctype.c                                       |    2 +-
 gl/c-ctype.h                                       |   36 +-
 gl/close.c                                         |    2 +-
 gl/closedir.c                                      |    2 +-
 gl/connect.c                                       |    2 +-
 gl/dirent-private.h                                |    2 +-
 gl/dirent.in.h                                     |    2 +-
 gl/dirname-lgpl.c                                  |    8 +-
 gl/dirname.h                                       |    8 +-
 gl/dosname.h                                       |    2 +-
 gl/errno.in.h                                      |    2 +-
 gl/error.c                                         |   15 +-
 gl/error.h                                         |    8 +-
 gl/fd-hook.c                                       |    2 +-
 gl/fd-hook.h                                       |    2 +-
 gl/filename.h                                      |    4 +-
 gl/float+.h                                        |    2 +-
 gl/float.c                                         |    2 +-
 gl/float.in.h                                      |    2 +-
 gl/fpucw.h                                         |    2 +-
 gl/frexp.c                                         |    2 +-
 gl/frexpl.c                                        |    2 +-
 gl/fseek.c                                         |    2 +-
 gl/fseeko.c                                        |    2 +-
 gl/fseterr.c                                       |    2 +-
 gl/fseterr.h                                       |    2 +-
 gl/fstat.c                                         |    2 +-
 gl/ftell.c                                         |    2 +-
 gl/ftello.c                                        |    2 +-
 gl/gai_strerror.c                                  |   93 +
 gl/getaddrinfo.c                                   |  444 +++++
 gl/getdelim.c                                      |    2 +-
 gl/getline.c                                       |    2 +-
 gl/getopt.c                                        |   66 +-
 gl/getopt.in.h                                     |   54 +-
 gl/getopt1.c                                       |    6 +-
 gl/getopt_int.h                                    |   16 +-
 gl/getpass.c                                       |    2 +-
 gl/getpass.h                                       |    2 +-
 gl/getpeername.c                                   |    2 +-
 gl/getsubopt.c                                     |    2 +-
 gl/gettext.h                                       |    2 +-
 gl/gettime.c                                       |    2 +-
 gl/gettimeofday.c                                  |    2 +-
 gl/inet_ntop.c                                     |    6 +-
 gl/inet_pton.c                                     |   14 +-
 gl/intprops.h                                      |    2 +-
 gl/isnan.c                                         |    4 +-
 gl/isnand-nolibm.h                                 |    2 +-
 gl/isnand.c                                        |    2 +-
 gl/isnanf-nolibm.h                                 |    2 +-
 gl/isnanf.c                                        |    2 +-
 gl/isnanl-nolibm.h                                 |    2 +-
 gl/isnanl.c                                        |    2 +-
 gl/itold.c                                         |    2 +-
 gl/listen.c                                        |    2 +-
 gl/lseek.c                                         |    2 +-
 gl/m4/00gnulib.m4                                  |    2 +-
 gl/m4/alloca.m4                                    |   18 +-
 gl/m4/alphasort.m4                                 |    2 +-
 gl/m4/argp.m4                                      |    2 +-
 gl/m4/arpa_inet_h.m4                               |    2 +-
 gl/m4/byteswap.m4                                  |    2 +-
 gl/m4/clock_time.m4                                |    2 +-
 gl/m4/close.m4                                     |    2 +-
 gl/m4/closedir.m4                                  |    8 +-
 gl/m4/codeset.m4                                   |    2 +-
 gl/m4/dirent_h.m4                                  |    2 +-
 gl/m4/dirname.m4                                   |    2 +-
 gl/m4/double-slash-root.m4                         |    2 +-
 gl/m4/dup2.m4                                      |    8 +-
 gl/m4/eealloc.m4                                   |    2 +-
 gl/m4/environ.m4                                   |    2 +-
 gl/m4/errno_h.m4                                   |    2 +-
 gl/m4/error.m4                                     |    2 +-
 gl/m4/exponentd.m4                                 |    2 +-
 gl/m4/exponentf.m4                                 |    2 +-
 gl/m4/exponentl.m4                                 |    2 +-
 gl/m4/extensions.m4                                |    6 +-
 gl/m4/fcntl-o.m4                                   |    2 +-
 gl/m4/fcntl_h.m4                                   |    2 +-
 gl/m4/fdopen.m4                                    |    2 +-
 gl/m4/float_h.m4                                   |    2 +-
 gl/m4/fpieee.m4                                    |    2 +-
 gl/m4/frexp.m4                                     |    2 +-
 gl/m4/frexpl.m4                                    |    2 +-
 gl/m4/fseek.m4                                     |    2 +-
 gl/m4/fseeko.m4                                    |    2 +-
 gl/m4/fstat.m4                                     |    2 +-
 gl/m4/ftell.m4                                     |    2 +-
 gl/m4/ftello.m4                                    |    2 +-
 gl/m4/ftruncate.m4                                 |    2 +-
 gl/m4/func.m4                                      |    2 +-
 gl/m4/getaddrinfo.m4                               |  210 +++
 gl/m4/getcwd.m4                                    |   51 +-
 gl/m4/getdelim.m4                                  |    2 +-
 gl/m4/getline.m4                                   |    2 +-
 gl/m4/getopt.m4                                    |    6 +-
 gl/m4/getpagesize.m4                               |    2 +-
 gl/m4/getpass.m4                                   |    2 +-
 gl/m4/getsubopt.m4                                 |    2 +-
 gl/m4/gettext.m4                                   |    4 +-
 gl/m4/gettime.m4                                   |    2 +-
 gl/m4/gettimeofday.m4                              |    2 +-
 gl/m4/glibc2.m4                                    |    2 +-
 gl/m4/glibc21.m4                                   |    2 +-
 gl/m4/gnulib-cache.m4                              |    8 +-
 gl/m4/gnulib-common.m4                             |   10 +-
 gl/m4/gnulib-comp.m4                               |   41 +-
 gl/m4/gnulib-tool.m4                               |    2 +-
 gl/m4/hostent.m4                                   |   49 +
 gl/m4/iconv.m4                                     |    2 +-
 gl/m4/include_next.m4                              |    4 +-
 gl/m4/inet_ntop.m4                                 |    2 +-
 gl/m4/inet_pton.m4                                 |    2 +-
 gl/m4/intdiv0.m4                                   |    2 +-
 gl/m4/intl.m4                                      |    6 +-
 gl/m4/intldir.m4                                   |    2 +-
 gl/m4/intlmacosx.m4                                |    2 +-
 gl/m4/intmax.m4                                    |    2 +-
 gl/m4/intmax_t.m4                                  |    2 +-
 gl/m4/inttypes-pri.m4                              |    2 +-
 gl/m4/inttypes.m4                                  |   21 +-
 gl/m4/inttypes_h.m4                                |    2 +-
 gl/m4/ioctl.m4                                     |    2 +-
 gl/m4/isnand.m4                                    |    2 +-
 gl/m4/isnanf.m4                                    |    2 +-
 gl/m4/isnanl.m4                                    |    2 +-
 gl/m4/largefile.m4                                 |    2 +-
 gl/m4/lcmessage.m4                                 |    2 +-
 gl/m4/ld-output-def.m4                             |    2 +-
 gl/m4/ld-version-script.m4                         |    2 +-
 gl/m4/ldexpl.m4                                    |    2 +-
 gl/m4/lib-ld.m4                                    |    2 +-
 gl/m4/lib-link.m4                                  |    2 +-
 gl/m4/lib-prefix.m4                                |    2 +-
 gl/m4/lock.m4                                      |    2 +-
 gl/m4/longlong.m4                                  |    8 +-
 gl/m4/lseek.m4                                     |    2 +-
 gl/m4/lstat.m4                                     |    6 +-
 gl/m4/malloc.m4                                    |    2 +-
 gl/m4/malloca.m4                                   |    2 +-
 gl/m4/manywarnings.m4                              |   36 +-
 gl/m4/math_h.m4                                    |    2 +-
 gl/m4/memchr.m4                                    |    2 +-
 gl/m4/memmem.m4                                    |    2 +-
 gl/m4/mempcpy.m4                                   |    2 +-
 gl/m4/minmax.m4                                    |    2 +-
 gl/m4/mmap-anon.m4                                 |    2 +-
 gl/m4/mode_t.m4                                    |    2 +-
 gl/m4/msvc-inval.m4                                |    2 +-
 gl/m4/msvc-nothrow.m4                              |    2 +-
 gl/m4/multiarch.m4                                 |    2 +-
 gl/m4/netdb_h.m4                                   |    2 +-
 gl/m4/netinet_in_h.m4                              |    2 +-
 gl/m4/nls.m4                                       |    2 +-
 gl/m4/nocrash.m4                                   |    2 +-
 gl/m4/open.m4                                      |    2 +-
 gl/m4/opendir.m4                                   |    8 +-
 gl/m4/pathmax.m4                                   |    2 +-
 gl/m4/perror.m4                                    |    2 +-
 gl/m4/pipe.m4                                      |    2 +-
 gl/m4/po.m4                                        |    2 +-
 gl/m4/printf-frexp.m4                              |    2 +-
 gl/m4/printf-frexpl.m4                             |    2 +-
 gl/m4/printf-posix.m4                              |    2 +-
 gl/m4/printf.m4                                    |    6 +-
 gl/m4/progtest.m4                                  |    2 +-
 gl/m4/putenv.m4                                    |    2 +-
 gl/m4/rawmemchr.m4                                 |    2 +-
 gl/m4/read-file.m4                                 |    2 +-
 gl/m4/readdir.m4                                   |    2 +-
 gl/m4/realloc.m4                                   |    2 +-
 gl/m4/scandir.m4                                   |    2 +-
 gl/m4/select.m4                                    |    2 +-
 gl/m4/servent.m4                                   |   51 +
 gl/m4/setenv.m4                                    |    2 +-
 gl/m4/signal_h.m4                                  |    2 +-
 gl/m4/signbit.m4                                   |    2 +-
 gl/m4/size_max.m4                                  |    2 +-
 gl/m4/sleep.m4                                     |    2 +-
 gl/m4/snprintf.m4                                  |    2 +-
 gl/m4/socketlib.m4                                 |    2 +-
 gl/m4/sockets.m4                                   |    2 +-
 gl/m4/socklen.m4                                   |    2 +-
 gl/m4/sockpfaf.m4                                  |    2 +-
 gl/m4/ssize_t.m4                                   |    2 +-
 gl/m4/stat.m4                                      |    2 +-
 gl/m4/stdalign.m4                                  |   23 +-
 gl/m4/stdarg.m4                                    |    2 +-
 gl/m4/stdbool.m4                                   |    2 +-
 gl/m4/stddef_h.m4                                  |    2 +-
 gl/m4/stdint.m4                                    |    8 +-
 gl/m4/stdint_h.m4                                  |    2 +-
 gl/m4/stdio_h.m4                                   |    2 +-
 gl/m4/stdlib_h.m4                                  |   11 +-
 gl/m4/strcase.m4                                   |    2 +-
 gl/m4/strchrnul.m4                                 |    2 +-
 gl/m4/strdup.m4                                    |    2 +-
 gl/m4/strerror.m4                                  |    2 +-
 gl/m4/strerror_r.m4                                |    2 +-
 gl/m4/string_h.m4                                  |    2 +-
 gl/m4/strings_h.m4                                 |    2 +-
 gl/m4/strndup.m4                                   |    2 +-
 gl/m4/strnlen.m4                                   |    2 +-
 gl/m4/strverscmp.m4                                |    2 +-
 gl/m4/symlink.m4                                   |    2 +-
 gl/m4/sys_ioctl_h.m4                               |    2 +-
 gl/m4/sys_select_h.m4                              |    2 +-
 gl/m4/sys_socket_h.m4                              |    2 +-
 gl/m4/sys_stat_h.m4                                |    2 +-
 gl/m4/sys_time_h.m4                                |    2 +-
 gl/m4/sys_types_h.m4                               |    2 +-
 gl/m4/sys_uio_h.m4                                 |    2 +-
 gl/m4/sysexits.m4                                  |    2 +-
 gl/m4/thread.m4                                    |    2 +-
 gl/m4/threadlib.m4                                 |   34 +-
 gl/m4/time_h.m4                                    |    4 +-
 gl/m4/time_r.m4                                    |    2 +-
 gl/m4/timespec.m4                                  |    2 +-
 gl/m4/uintmax_t.m4                                 |    2 +-
 gl/m4/ungetc.m4                                    |    2 +-
 gl/m4/unistd_h.m4                                  |   19 +-
 gl/m4/usleep.m4                                    |   35 +
 gl/m4/valgrind-tests.m4                            |   11 +-
 gl/m4/vasnprintf.m4                                |    2 +-
 gl/m4/vasprintf.m4                                 |    2 +-
 gl/m4/version-etc.m4                               |    2 +-
 gl/m4/vfprintf-posix.m4                            |    2 +-
 gl/m4/visibility.m4                                |    2 +-
 gl/m4/vprintf-posix.m4                             |    2 +-
 gl/m4/vsnprintf.m4                                 |    2 +-
 gl/m4/warn-on-use.m4                               |    2 +-
 gl/m4/warnings.m4                                  |    2 +-
 gl/m4/wchar_h.m4                                   |    2 +-
 gl/m4/wchar_t.m4                                   |    2 +-
 gl/m4/wint_t.m4                                    |    2 +-
 gl/m4/xsize.m4                                     |    2 +-
 gl/m4/yield.m4                                     |    2 +-
 gl/malloc.c                                        |    2 +-
 gl/math.in.h                                       |    6 +-
 gl/memchr.c                                        |    2 +-
 gl/memmem.c                                        |    2 +-
 gl/mempcpy.c                                       |    2 +-
 gl/minmax.h                                        |    2 +-
 gl/msvc-inval.c                                    |    4 +-
 gl/msvc-inval.h                                    |    4 +-
 gl/msvc-nothrow.c                                  |    4 +-
 gl/msvc-nothrow.h                                  |    2 +-
 gl/netdb.in.h                                      |   20 +-
 gl/netinet_in.in.h                                 |    2 +-
 gl/opendir.c                                       |    2 +-
 gl/override/m4/valgrind-tests.m4.diff              |   20 +-
 gl/printf-args.c                                   |    2 +-
 gl/printf-args.h                                   |    2 +-
 gl/printf-frexp.c                                  |    2 +-
 gl/printf-frexp.h                                  |    2 +-
 gl/printf-frexpl.c                                 |    2 +-
 gl/printf-frexpl.h                                 |    2 +-
 gl/printf-parse.c                                  |    4 +-
 gl/printf-parse.h                                  |    2 +-
 gl/progname.c                                      |    2 +-
 gl/progname.h                                      |    2 +-
 gl/rawmemchr.c                                     |    2 +-
 gl/read-file.c                                     |    2 +-
 gl/read-file.h                                     |    2 +-
 gl/readdir.c                                       |    2 +-
 gl/realloc.c                                       |    2 +-
 gl/recv.c                                          |    2 +-
 gl/recvfrom.c                                      |    2 +-
 gl/scandir.c                                       |    2 +-
 gl/select.c                                        |   32 +-
 gl/send.c                                          |    2 +-
 gl/sendto.c                                        |    2 +-
 gl/setsockopt.c                                    |    2 +-
 gl/shutdown.c                                      |    2 +-
 gl/signal.in.h                                     |    2 +-
 gl/signbitd.c                                      |    2 +-
 gl/signbitf.c                                      |    2 +-
 gl/signbitl.c                                      |    2 +-
 gl/size_max.h                                      |    2 +-
 gl/sleep.c                                         |    2 +-
 gl/snprintf.c                                      |    2 +-
 gl/socket.c                                        |    2 +-
 gl/sockets.c                                       |    2 +-
 gl/sockets.h                                       |   15 +-
 gl/stdalign.in.h                                   |   14 +-
 gl/stdarg.in.h                                     |    2 +-
 gl/stdbool.in.h                                    |    2 +-
 gl/stddef.in.h                                     |    2 +-
 gl/stdint.in.h                                     |   21 +-
 gl/stdio-impl.h                                    |    2 +-
 gl/stdio.in.h                                      |    8 +-
 gl/stdlib.in.h                                     |   28 +-
 gl/str-two-way.h                                   |    2 +-
 gl/strcasecmp.c                                    |    2 +-
 gl/strchrnul.c                                     |    2 +-
 gl/strdup.c                                        |    2 +-
 gl/strerror-override.c                             |    2 +-
 gl/strerror-override.h                             |    2 +-
 gl/strerror.c                                      |    2 +-
 gl/string.in.h                                     |    2 +-
 gl/strings.in.h                                    |    2 +-
 gl/stripslash.c                                    |    4 +-
 gl/strncasecmp.c                                   |    2 +-
 gl/strndup.c                                       |    2 +-
 gl/strnlen.c                                       |    2 +-
 gl/strverscmp.c                                    |    4 +-
 gl/sys_select.in.h                                 |    2 +-
 gl/sys_socket.in.h                                 |    2 +-
 gl/sys_stat.in.h                                   |    2 +-
 gl/sys_time.in.h                                   |    2 +-
 gl/sys_types.in.h                                  |    2 +-
 gl/sys_uio.in.h                                    |    2 +-
 gl/sysexits.in.h                                   |    2 +-
 gl/tests/Makefile.am                               |   37 +-
 gl/tests/binary-io.h                               |    2 +-
 gl/tests/dup2.c                                    |    4 +-
 gl/tests/fcntl.in.h                                |    6 +-
 gl/tests/fdopen.c                                  |    2 +-
 gl/tests/getcwd-lgpl.c                             |    4 +-
 gl/tests/getpagesize.c                             |    4 +-
 gl/tests/glthread/lock.c                           |    4 +-
 gl/tests/glthread/lock.h                           |   16 +-
 gl/tests/glthread/thread.c                         |    4 +-
 gl/tests/glthread/thread.h                         |    6 +-
 gl/tests/glthread/threadlib.c                      |    2 +-
 gl/tests/glthread/yield.h                          |    6 +-
 gl/tests/ignore-value.h                            |    2 +-
 gl/tests/infinity.h                                |    2 +-
 gl/tests/init.sh                                   |  106 ++-
 gl/tests/inttypes.in.h                             | 1770 ++++++++++----------
 gl/tests/ioctl.c                                   |    2 +-
 gl/tests/lstat.c                                   |    8 +-
 gl/tests/macros.h                                  |    2 +-
 gl/tests/malloca.c                                 |    2 +-
 gl/tests/malloca.h                                 |    2 +-
 gl/tests/minus-zero.h                              |    2 +-
 gl/tests/nan.h                                     |    2 +-
 gl/tests/open.c                                    |    2 +-
 gl/tests/pathmax.h                                 |    2 +-
 gl/tests/perror.c                                  |    2 +-
 gl/tests/pipe.c                                    |    2 +-
 gl/tests/putenv.c                                  |    6 +-
 gl/tests/same-inode.h                              |   16 +-
 gl/tests/setenv.c                                  |   12 +-
 gl/tests/signature.h                               |    2 +-
 gl/tests/stat.c                                    |    2 +-
 gl/tests/strerror_r.c                              |   14 +-
 gl/tests/symlink.c                                 |    2 +-
 gl/tests/sys_ioctl.in.h                            |    2 +-
 gl/tests/test-accept.c                             |    2 +-
 gl/tests/test-alloca-opt.c                         |    2 +-
 gl/tests/test-argp-2.sh                            |    2 +-
 gl/tests/test-argp.c                               |    2 +-
 gl/tests/test-arpa_inet.c                          |    2 +-
 gl/tests/test-binary-io.c                          |   11 +-
 gl/tests/test-binary-io.sh                         |    1 +
 gl/tests/test-bind.c                               |    2 +-
 gl/tests/test-byteswap.c                           |    2 +-
 gl/tests/test-c-ctype.c                            |    2 +-
 gl/tests/test-close.c                              |    2 +-
 gl/tests/test-connect.c                            |    2 +-
 gl/tests/test-dirent.c                             |    2 +-
 gl/tests/test-dup2.c                               |    8 +-
 gl/tests/test-environ.c                            |    2 +-
 gl/tests/test-errno.c                              |    2 +-
 gl/tests/test-fcntl-h.c                            |    2 +-
 gl/tests/test-fdopen.c                             |    2 +-
 gl/tests/test-fgetc.c                              |    2 +-
 gl/tests/test-float.c                              |   11 +-
 gl/tests/test-fprintf-posix.h                      |    2 +-
 gl/tests/test-fputc.c                              |    2 +-
 gl/tests/test-fread.c                              |    2 +-
 gl/tests/test-frexp.c                              |    2 +-
 gl/tests/test-frexpl.c                             |    2 +-
 gl/tests/test-fseek.c                              |    2 +-
 gl/tests/test-fseeko.c                             |    2 +-
 gl/tests/test-fseeko3.c                            |    2 +-
 gl/tests/test-fseeko4.c                            |    2 +-
 gl/tests/test-fseterr.c                            |    2 +-
 gl/tests/test-fstat.c                              |    2 +-
 gl/tests/test-ftell.c                              |    2 +-
 gl/tests/test-ftell3.c                             |    2 +-
 gl/tests/test-ftello.c                             |    2 +-
 gl/tests/test-ftello3.c                            |    2 +-
 gl/tests/test-ftello4.c                            |    2 +-
 gl/tests/test-ftruncate.c                          |    2 +-
 gl/tests/test-func.c                               |    2 +-
 gl/tests/test-fwrite.c                             |    2 +-
 gl/tests/test-getaddrinfo.c                        |  168 ++
 gl/tests/test-getcwd-lgpl.c                        |    2 +-
 gl/tests/test-getdelim.c                           |    2 +-
 gl/tests/test-getline.c                            |    2 +-
 gl/tests/test-getopt.c                             |    2 +-
 gl/tests/test-getopt.h                             |    2 +-
 gl/tests/test-getopt_long.h                        |    2 +-
 gl/tests/test-getpeername.c                        |    2 +-
 gl/tests/test-gettimeofday.c                       |    2 +-
 gl/tests/test-ignore-value.c                       |    2 +-
 gl/tests/test-inet_ntop.c                          |    2 +-
 gl/tests/test-inet_pton.c                          |    2 +-
 gl/tests/test-init.sh                              |   74 +
 gl/tests/test-intprops.c                           |    2 +-
 gl/tests/test-inttypes.c                           |    5 +-
 gl/tests/test-ioctl.c                              |    2 +-
 gl/tests/test-isnand-nolibm.c                      |    2 +-
 gl/tests/test-isnand.h                             |    2 +-
 gl/tests/test-isnanf-nolibm.c                      |    2 +-
 gl/tests/test-isnanf.h                             |    2 +-
 gl/tests/test-isnanl-nolibm.c                      |    2 +-
 gl/tests/test-isnanl.h                             |    2 +-
 gl/tests/test-listen.c                             |    2 +-
 gl/tests/test-lock.c                               |   14 +-
 gl/tests/test-lstat.c                              |    2 +-
 gl/tests/test-lstat.h                              |    2 +-
 gl/tests/test-malloc-gnu.c                         |    2 +-
 gl/tests/test-malloca.c                            |    2 +-
 gl/tests/test-math.c                               |    2 +-
 gl/tests/test-memchr.c                             |    2 +-
 gl/tests/test-netdb.c                              |    2 +-
 gl/tests/test-netinet_in.c                         |    2 +-
 gl/tests/test-open.c                               |    2 +-
 gl/tests/test-open.h                               |    2 +-
 gl/tests/test-pathmax.c                            |    2 +-
 gl/tests/test-perror.c                             |    2 +-
 gl/tests/test-perror2.c                            |    2 +-
 gl/tests/test-pipe.c                               |    6 +-
 gl/tests/test-printf-frexp.c                       |    2 +-
 gl/tests/test-printf-frexpl.c                      |    2 +-
 gl/tests/test-printf-posix.h                       |    2 +-
 gl/tests/test-rawmemchr.c                          |    2 +-
 gl/tests/test-read-file.c                          |    2 +-
 gl/tests/test-recv.c                               |    2 +-
 gl/tests/test-recvfrom.c                           |    2 +-
 gl/tests/test-select-fd.c                          |    2 +-
 gl/tests/test-select-stdin.c                       |    2 +-
 gl/tests/test-select.c                             |    2 +-
 gl/tests/test-select.h                             |   10 +-
 gl/tests/test-send.c                               |    2 +-
 gl/tests/test-sendto.c                             |    2 +-
 gl/tests/test-setenv.c                             |    2 +-
 gl/tests/test-setsockopt.c                         |    2 +-
 gl/tests/test-shutdown.c                           |    2 +-
 gl/tests/test-signal-h.c                           |    2 +-
 gl/tests/test-signbit.c                            |    2 +-
 gl/tests/test-sleep.c                              |    2 +-
 gl/tests/test-snprintf.c                           |    2 +-
 gl/tests/test-sockets.c                            |    2 +-
 gl/tests/test-stat.c                               |    2 +-
 gl/tests/test-stat.h                               |    2 +-
 gl/tests/test-stdalign.c                           |    8 +-
 gl/tests/test-stdbool.c                            |    2 +-
 gl/tests/test-stddef.c                             |    2 +-
 gl/tests/test-stdint.c                             |    4 +-
 gl/tests/test-stdio.c                              |    2 +-
 gl/tests/test-stdlib.c                             |    2 +-
 gl/tests/test-strchrnul.c                          |    2 +-
 gl/tests/test-strerror.c                           |    2 +-
 gl/tests/test-strerror_r.c                         |    2 +-
 gl/tests/test-string.c                             |    2 +-
 gl/tests/test-strings.c                            |    2 +-
 gl/tests/test-strnlen.c                            |    2 +-
 gl/tests/test-strverscmp.c                         |    2 +-
 gl/tests/test-symlink.c                            |    2 +-
 gl/tests/test-symlink.h                            |    2 +-
 gl/tests/test-sys_ioctl.c                          |    2 +-
 gl/tests/test-sys_select.c                         |    2 +-
 gl/tests/test-sys_socket.c                         |    2 +-
 gl/tests/test-sys_stat.c                           |    2 +-
 gl/tests/test-sys_time.c                           |    2 +-
 gl/tests/test-sys_types.c                          |    2 +-
 gl/tests/test-sys_uio.c                            |    2 +-
 gl/tests/test-sys_wait.h                           |    2 +-
 gl/tests/test-sysexits.c                           |    2 +-
 gl/tests/test-thread_create.c                      |    4 +-
 gl/tests/test-thread_self.c                        |    2 +-
 gl/tests/test-time.c                               |    2 +-
 gl/tests/test-u64.c                                |    2 +-
 gl/tests/test-unistd.c                             |    2 +-
 gl/tests/test-unsetenv.c                           |    2 +-
 gl/tests/{test-sys_ioctl.c => test-usleep.c}       |   19 +-
 gl/tests/test-vasnprintf.c                         |    2 +-
 gl/tests/test-vasprintf.c                          |    2 +-
 gl/tests/test-vc-list-files-cvs.sh                 |    3 +-
 gl/tests/test-vc-list-files-git.sh                 |    2 +-
 gl/tests/test-verify.c                             |    2 +-
 gl/tests/test-version-etc.c                        |    2 +-
 gl/tests/test-version-etc.sh                       |    2 +-
 gl/tests/test-vfprintf-posix.c                     |    2 +-
 gl/tests/test-vprintf-posix.c                      |    2 +-
 gl/tests/test-vsnprintf.c                          |    2 +-
 gl/tests/test-wchar.c                              |    2 +-
 gl/tests/unsetenv.c                                |    4 +-
 gl/tests/w32sock.h                                 |    2 +-
 gl/tests/zerosize-ptr.h                            |    2 +-
 gl/time.in.h                                       |    2 +-
 gl/time_r.c                                        |    2 +-
 gl/timespec.h                                      |    2 +-
 gl/u64.h                                           |    2 +-
 gl/unistd.in.h                                     |   50 +-
 gl/usleep.c                                        |   58 +
 gl/vasnprintf.c                                    |    6 +-
 gl/vasnprintf.h                                    |    2 +-
 gl/vasprintf.c                                     |    2 +-
 gl/verify.h                                        |   16 +-
 gl/version-etc-fsf.c                               |    2 +-
 gl/version-etc.c                                   |    4 +-
 gl/version-etc.h                                   |    6 +-
 gl/vfprintf.c                                      |    2 +-
 gl/vprintf.c                                       |    2 +-
 gl/vsnprintf.c                                     |    2 +-
 gl/w32sock.h                                       |    2 +-
 gl/wchar.in.h                                      |    2 +-
 gl/xsize.h                                         |    2 +-
 lib/Makefile.am                                    |    3 +-
 lib/accelerated/x86/Makefile.am                    |    3 +-
 lib/algorithms/ciphers.c                           |    4 +-
 lib/algorithms/protocols.c                         |    2 +-
 lib/algorithms/publickey.c                         |    4 +-
 lib/algorithms/secparams.c                         |    6 +-
 lib/algorithms/sign.c                              |   10 +-
 lib/auth/cert.c                                    |    4 +-
 lib/auth/cert.h                                    |    4 +-
 lib/auth/dhe.c                                     |   16 +-
 lib/auth/ecdh_common.c                             |   34 +-
 lib/auth/rsa.c                                     |    4 +-
 lib/auth/rsa_export.c                              |    4 +-
 lib/auth/srp_rsa.c                                 |    4 +-
 lib/{openpgp => extras}/Makefile.am                |    7 +-
 lib/extras/randomart.c                             |  167 ++
 lib/extras/randomart.h                             |    4 +
 lib/gnutls_alert.c                                 |    1 +
 lib/gnutls_buffers.c                               |    4 +
 lib/gnutls_cert.c                                  |    2 +-
 lib/gnutls_cipher.c                                |    9 +-
 lib/gnutls_db.c                                    |    8 +-
 lib/gnutls_dh_primes.c                             |    1 +
 lib/gnutls_errors.c                                |    2 +-
 lib/gnutls_global.c                                |    9 +-
 lib/gnutls_handshake.c                             |    4 +-
 lib/gnutls_int.h                                   |    3 +-
 lib/gnutls_mem.c                                   |    9 -
 lib/gnutls_priority.c                              |    9 +-
 lib/gnutls_privkey.c                               |    2 +-
 lib/gnutls_pubkey.c                                |   55 +-
 lib/gnutls_record.c                                |    7 +-
 lib/gnutls_sig.c                                   |    8 +-
 lib/gnutls_state.c                                 |   29 +-
 lib/gnutls_ui.c                                    |   40 +-
 lib/includes/gnutls/abstract.h                     |   14 +
 lib/includes/gnutls/compat.h                       |    2 +-
 lib/includes/gnutls/gnutls.h.in                    |   20 +-
 lib/includes/gnutls/pkcs11.h                       |    9 +
 lib/includes/gnutls/x509.h                         |    3 +
 lib/libgnutls.map                                  |    4 +
 lib/nettle/ecc_projective_check_point.c            |   18 +-
 lib/nettle/ecc_shared_secret.c                     |    3 +-
 lib/nettle/mpi.c                                   |    6 -
 lib/nettle/pk.c                                    |   10 +-
 lib/nettle/rnd.c                                   |    6 +-
 lib/opencdk/Makefile.am                            |    2 +-
 lib/opencdk/armor.c                                |  139 --
 lib/opencdk/kbnode.c                               |    9 +-
 lib/opencdk/keydb.c                                |  108 +--
 lib/opencdk/main.c                                 |  339 ----
 lib/opencdk/opencdk.h                              |   74 +-
 lib/openpgp/extras.c                               |    5 +-
 lib/openpgp/gnutls_openpgp.c                       |    7 +-
 lib/openpgp/output.c                               |   23 +
 lib/openpgp/pgp.c                                  |   46 +-
 lib/openpgp/privkey.c                              |   50 +-
 lib/pkcs11_int.h                                   |    6 +-
 lib/pkcs11_privkey.c                               |    2 +-
 lib/pkcs11_write.c                                 |    4 +-
 lib/system.c                                       |   22 -
 lib/system.h                                       |    2 -
 lib/x509/common.c                                  |   21 +-
 lib/x509/common.h                                  |    2 -
 lib/x509/crl.c                                     |    8 +-
 lib/x509/dn.c                                      |   24 +-
 lib/x509/key_decode.c                              |    4 +-
 lib/x509/key_encode.c                              |    6 +-
 lib/x509/output.c                                  |   29 +-
 lib/x509/privkey.c                                 |   11 +-
 lib/x509/privkey_pkcs8.c                           |    4 +-
 lib/x509/verify.c                                  |    2 +-
 lib/x509/x509.c                                    |   65 +-
 m4/hooks.m4                                        |    6 +-
 maint.mk                                           |   49 +-
 src/benchmark-tls.c                                |   95 +-
 src/certtool-gaa.c                                 |  153 +-
 src/certtool-gaa.h                                 |   26 +-
 src/certtool.c                                     |  108 +-
 src/certtool.gaa                                   |    2 +
 src/cli.c                                          |   35 +-
 src/p11tool-gaa.c                                  |    2 +-
 src/p11tool.gaa                                    |    2 +-
 src/serv.c                                         |   37 +-
 src/udp-serv.c                                     |    3 +-
 src/udp-serv.h                                     |    2 +-
 tests/Makefile.am                                  |   10 +-
 tests/mini-deflate.c                               |   33 +-
 tests/openpgp-auth2.c                              |   10 +
 tests/openpgp-certs/testselfsigs                   |    8 +-
 tests/pathlen/ca-no-pathlen.pem                    |   14 +-
 tests/pathlen/no-ca-or-pathlen.pem                 |   14 +-
 tests/pgps2kgnu.c                                  |   14 +-
 tests/{x509sign-verify.c => rsa-encrypt-decrypt.c} |  113 +-
 tests/slow/Makefile.am                             |    3 +-
 tests/slow/gendh.c                                 |    6 +-
 tests/slow/keygen.c                                |    2 +-
 681 files changed, 5905 insertions(+), 3471 deletions(-)
 create mode 100644 cross.mk
 rename doc/examples/{ex-client1.c => ex-client-anon.c} (95%)
 rename doc/examples/{ex-client-udp.c => ex-client-dtls.c} (92%)
 rename doc/examples/{ex-rfc2818.c => ex-client-x509.c} (97%)
 create mode 100644 doc/examples/ex-serv-dtls.c
 rename doc/examples/{ex-serv1.c => ex-serv-x509.c} (80%)
 copy doc/latex/{cover-epub.tex => cover.tex} (76%)
 create mode 100644 gl/gai_strerror.c
 create mode 100644 gl/getaddrinfo.c
 create mode 100644 gl/m4/getaddrinfo.m4
 create mode 100644 gl/m4/hostent.m4
 create mode 100644 gl/m4/servent.m4
 create mode 100644 gl/m4/usleep.m4
 create mode 100644 gl/tests/test-getaddrinfo.c
 create mode 100755 gl/tests/test-init.sh
 copy gl/tests/{test-sys_ioctl.c => test-usleep.c} (68%)
 create mode 100644 gl/usleep.c
 copy lib/{openpgp => extras}/Makefile.am (85%)
 create mode 100644 lib/extras/randomart.c
 create mode 100644 lib/extras/randomart.h
 delete mode 100644 lib/opencdk/main.c
 copy tests/{x509sign-verify.c => rsa-encrypt-decrypt.c} (57%)

diff --git a/.gitignore b/.gitignore
index 90dd40c..e6a81be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -70,6 +70,7 @@ doc/examples/ex-serv-pgp
 doc/examples/ex-serv-psk
 doc/examples/ex-serv-srp
 doc/examples/ex-serv1
+doc/examples/ex-serv-dtls
 doc/examples/libexamples.la
 doc/extra.c.texi
 doc/gnutls-api.texi
@@ -334,6 +335,7 @@ lib/accelerated/x86/libx86.la
 lib/algorithms/libgnutls_alg.la
 lib/auth/libgnutls_auth.la
 lib/ext/libgnutls_ext.la
+lib/extras/libgnutls_extras.la
 lib/gcrypt/libcrypto.la
 lib/gnutls-api.texi
 lib/gnutls.pc
@@ -545,3 +547,8 @@ doc/reference/*.bak
 doc/manpages/gnutls_*.3
 doc/examples/ex-ocsp-client
 doc/examples/ex-ocsp-verify
+doc/examples/ex-client-anon
+doc/examples/ex-client-dtls
+doc/examples/ex-client-x509
+doc/examples/ex-serv-x509
+tests/slow/cipher-test
diff --git a/ChangeLog b/ChangeLog
index bfcdbbc..87146b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,375 @@
+2012-01-06  Nikos Mavrogiannopoulos <address@hidden>
+
+       * ChangeLog, NEWS: updated changelog and news for release
+
+2012-01-06  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/gnutls_cipher.c: corrected typo
+
+2012-01-06  Nikos Mavrogiannopoulos <address@hidden>
+
+       * NEWS, configure.ac, m4/hooks.m4: bumped version
+
+2012-01-06  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/gnutls_buffers.c: Corrected functionality of
+       gnutls_record_get_direction(). Reported by Philip Allison.
+
+2012-01-06  Nikos Mavrogiannopoulos <address@hidden>
+
+       * NEWS, lib/gnutls_cipher.c: provide less timing information when
+       decoding packets. Patch by Nadhem Alfardan.
+
+2012-01-04  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/serv.c: use AI_ADDRCONFIG if available.
+
+2012-01-04  Nikos Mavrogiannopoulos <address@hidden>
+
+       * configure.ac: prevent building of crywrap in windows
+
+2012-01-04  Nikos Mavrogiannopoulos <address@hidden>
+
+       * cross.mk: updated
+
+2012-01-04  Nikos Mavrogiannopoulos <address@hidden>
+
+       * ChangeLog: updated
+
+2012-01-04  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/extras/Makefile.am: added missing file
+
+2012-01-04  Nikos Mavrogiannopoulos <address@hidden>
+
+       * NEWS, configure.ac, m4/hooks.m4: bumped version
+
+2012-01-04  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/certtool-gaa.c, src/certtool-gaa.h, src/p11tool-gaa.c: Updated
+       auto-generated files
+
+2012-01-04  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/latex/.gitignore, doc/latex/cover.tex: added missing file
+
+2012-01-03  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/benchmark-tls.c: print the RSA and DH bits as well as EC bits
+       for comparison.
+
+2012-01-03  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/benchmark-tls.c: use 1840 bit DH and RSA to compare with 192
+       bits of ECDH
+
+2012-01-02  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/algorithms/publickey.c, lib/algorithms/secparams.c,
+       lib/algorithms/sign.c, lib/auth/cert.c, lib/auth/ecdh_common.c,
+       lib/gnutls_privkey.c, lib/gnutls_pubkey.c, lib/gnutls_sig.c,
+       lib/includes/gnutls/gnutls.h.in, lib/nettle/pk.c, lib/pkcs11_int.h,
+       lib/pkcs11_privkey.c, lib/pkcs11_write.c, lib/x509/key_decode.c,
+       lib/x509/key_encode.c, lib/x509/output.c, lib/x509/privkey.c,
+       lib/x509/privkey_pkcs8.c, lib/x509/verify.c, src/certtool.c,
+       src/p11tool.gaa, tests/slow/keygen.c: GNUTLS_PK_ECC -> GNUTLS_PK_EC
+
+2011-12-31  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/openpgp/gnutls_openpgp.c: CDK_EOF error code now returns
+       GNUTLS_E_PARSING_ERROR
+
+2011-12-31  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/opencdk/armor.c, lib/opencdk/opencdk.h: removed
+       cdk_armor_filter_use()
+
+2011-12-31  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/certtool.c: correctly report 0 keys on a keyring
+
+2011-12-31  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/opencdk/kbnode.c, lib/opencdk/opencdk.h,
+       lib/openpgp/gnutls_openpgp.c, lib/openpgp/pgp.c,
+       lib/openpgp/privkey.c: more opencdk simplifications
+
+2011-12-31  Nikos Mavrogiannopoulos <address@hidden>
+
+       * tests/openpgp-certs/testselfsigs: specify key type (raw) to
+       certtool
+
+2011-12-31  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/opencdk/Makefile.am, lib/opencdk/armor.c,
+       lib/opencdk/keydb.c, lib/opencdk/main.c, lib/opencdk/opencdk.h,
+       lib/openpgp/extras.c, lib/openpgp/gnutls_openpgp.c: Removed unneeded
+       opencdk functionality.
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * cross.mk: verify signatures on download
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/gnutls_global.c, lib/gnutls_mem.c: _gnutls_is_secure_memory is
+       no more.
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * NEWS, src/cli.c: gnutls-cli can now read input from win32.
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * NEWS, lib/openpgp/pgp.c, lib/openpgp/privkey.c: Avoid using base64
+       armor auto-detection which causes decoding errors in win32.  For
+       some reason reading from the stream modifies the stream and this
+       work-around avoids that issue.
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * tests/pgps2kgnu.c: enable debugging in pgps2kgnu
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * tests/Makefile.am, tests/openpgp-auth2.c: do not use valgrind in
+       windows
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * cross.mk: gmp is compiled with --enable-fat.
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * tests/Makefile.am: link libutils with libgnu.
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * .gitignore: more files to ignore
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/manpages/Makefile.am: Added missing function names.
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * cross.mk: Added a preliminary win32 compilation makefile.
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/Makefile.am: win32 fixes
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * configure.ac: do not build crywrap on win32
+
+2011-12-30  Nikos Mavrogiannopoulos <address@hidden>
+
+       * extra/includes/gnutls/openssl.h: undefine possible system macros.
+
+2011-12-29  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/examples/ex-serv-dtls.c: updated DTLS example
+
+2011-12-29  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/cha-cert-auth.texi, doc/cha-cert-auth2.texi,
+       doc/cha-programs.texi: more updates
+
+2011-12-29  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/cha-ciphersuites.texi, doc/cha-copying.texi,
+       doc/cha-gtls-app.texi, doc/cha-gtls-examples.texi,
+       doc/cha-internals.texi, doc/cha-library.texi,
+       doc/cha-shared-key.texi, doc/gnutls.texi: Small improvements in
+       documentation.
+
+2011-12-29  Nikos Mavrogiannopoulos <address@hidden>
+
+       * NEWS, lib/x509/privkey.c: corrected bug in DSA private key
+       parsing.
+
+2011-12-29  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/certtool.gaa: Added --rsa option which is a no-op for now.
+
+2011-12-29  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/extras/randomart.c, lib/extras/randomart.h, lib/gnutls_ui.c,
+       lib/openpgp/output.c, lib/x509/output.c,
+       tests/pathlen/ca-no-pathlen.pem, tests/pathlen/no-ca-or-pathlen.pem: 
+       Allow the insertion of characters to align the randomart.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/certtool.c: Print the fingerprint of PGP keys and not only the
+       key ID.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * tests/pathlen/ca-no-pathlen.pem,
+       tests/pathlen/no-ca-or-pathlen.pem: Add random art to keys.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * tests/mini-deflate.c: Skip deflate test if libz is not available.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/openpgp/output.c, lib/x509/output.c, src/certtool.c: updated
+       random art's messages.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/certtool.c: Print the pgp key's randomart as well.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/openpgp/output.c, lib/x509/output.c: Print the randomart on
+       the key ID and not the fingerprint.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/gnutls_errors.c: Updated GNUTLS_E_NO_CERTIFICATE_FOUND
+       description.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * .gitignore: more files to ignore
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/extras/randomart.c, lib/extras/randomart.h, lib/gnutls_ui.c,
+       lib/openpgp/output.c, lib/x509/output.c, src/certtool.c: print
+       randomart for private keys as well.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/extras/randomart.c, lib/system.c, lib/system.h,
+       lib/x509/output.c: gnutls_atfork was no longer in use.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * NEWS, configure.ac, lib/Makefile.am, lib/extras/Makefile.am,
+       lib/extras/randomart.c, lib/extras/randomart.h, lib/gnutls_ui.c,
+       lib/includes/gnutls/gnutls.h.in, lib/libgnutls.map,
+       lib/openpgp/output.c, lib/x509/output.c: Added function
+       gnutls_random_art() to convert fingerprints to images (currently
+       ascii-art).
+
+2011-12-28  Patrick Pelletier <address@hidden>
+
+       * doc/cha-gtls-app.texi, doc/cha-gtls-examples.texi,
+       doc/cha-internals.texi, lib/algorithms/ciphers.c,
+       lib/algorithms/protocols.c, lib/algorithms/secparams.c,
+       lib/gnutls_cert.c, lib/gnutls_cipher.c, lib/gnutls_db.c,
+       lib/gnutls_global.c, lib/gnutls_handshake.c, lib/gnutls_priority.c,
+       lib/gnutls_state.c, lib/gnutls_ui.c, lib/nettle/rnd.c: minor doc and
+       comment fixes Signed-off-by: Nikos Mavrogiannopoulos <address@hidden>
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/Makefile.am, doc/cha-gtls-app.texi,
+       doc/cha-gtls-examples.texi, doc/cha-intro-tls.texi,
+       doc/examples/Makefile.am, doc/examples/ex-client-anon.c,
+       doc/examples/ex-client-dtls.c, doc/examples/ex-client-psk.c,
+       doc/examples/ex-client-resume.c, doc/examples/ex-client-srp.c,
+       doc/examples/ex-client-udp.c, doc/examples/ex-client-x509.c,
+       doc/examples/ex-client1.c, doc/examples/ex-rfc2818.c,
+       doc/examples/ex-serv-anon.c, doc/examples/ex-serv-srp.c,
+       doc/examples/ex-serv-x509.c, doc/examples/ex-serv1.c: updated
+       examples and added new "handling alerts" section.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/cha-gtls-examples.texi, doc/examples/udp.c: updated and
+       included in the documentation the udp code.
+
+2011-12-28  Nikos Mavrogiannopoulos <address@hidden>
+
+       * NEWS, src/cli.c, src/serv.c: Set don't fragment bit in Linux as
+       well as in BSD variants.
+
+2011-12-27  Nikos Mavrogiannopoulos <address@hidden>
+
+       * .gitignore, doc/examples/ex-serv-dtls.c, doc/examples/ex-serv1.c: 
+       updated server examples
+
+2011-12-26  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/cha-cert-auth.texi, doc/cha-cert-auth2.texi,
+       doc/cha-gtls-app.texi, doc/cha-programs.texi,
+       doc/cha-shared-key.texi: smallexample is no longer used. It is
+       intended only for typesetting with smaller pages and had no relation
+       to our usage.
+
+2011-12-26  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/serv.c: prepend UDP to server application name when in UDP
+       mode.
+
+2011-12-26  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/cha-gtls-app.texi, doc/cha-gtls-examples.texi,
+       doc/examples/Makefile.am, doc/examples/ex-serv-dtls.c,
+       doc/examples/ex-serv1.c: Added DTLS server example.
+
+2011-12-26  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/udp-serv.c: corrected a leak
+
+2011-12-26  Nikos Mavrogiannopoulos <address@hidden>
+
+       * doc/cha-gtls-app.texi: Added SECP192R1 curve.
+
+2011-12-26  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/includes/gnutls/abstract.h, lib/includes/gnutls/pkcs11.h: 
+       pkcs11.h and abstract.h use extern C idiom for C++.
+
+2011-12-19  Nikos Mavrogiannopoulos <address@hidden>
+
+       * NEWS, lib/algorithms/ciphersuites.c: Added ciphersuites:
+       GNUTLS_PSK_WITH_AES_256_GCM_SHA384 and
+       GNUTLS_DHE_PSK_WITH_AES_256_GCM_SHA384.
+
+2011-12-19  Nikos Mavrogiannopoulos <address@hidden>
+
+       * NEWS, lib/algorithms/ciphersuites.c: Corrected ciphersuite
+       GNUTLS_ECDHE_PSK_AES_256_CBC_SHA384
+
+2011-12-18  Nikos Mavrogiannopoulos <address@hidden>
+
+       * src/serv.c: Only use configured interfaces. Patch by Pino Toscano.
+
+2011-12-17  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/algorithms/protocols.c: better comments.
+
+2011-12-17  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/gnutls_int.h, lib/gnutls_record.c, lib/gnutls_state.c: 
+       gnutls_protocol_get_version() and _gnutls_set_current_version() are
+       now inline functions
+
+2011-12-17  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/algorithms/ciphersuites.c: documented
+       _gnutls_supported_ciphersuites()
+
+2011-12-17  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/algorithms/ciphersuites.c: renamed the _SHA ciphersuites to
+       _SHA1.
+
+2011-12-16  Nikos Mavrogiannopoulos <address@hidden>
+
+       * lib/nettle/mpi.c: correctly set the odd bits.
+
 2011-12-13  Nikos Mavrogiannopoulos <address@hidden>
 
-       * ChangeLog, Makefile.am: make dist forces regeneration of ChangeLog
-       and manpages.
+       * ChangeLog, Makefile.am, cfg.mk: make dist forces regeneration of
+       ChangeLog and manpages.
 
 2011-12-13  Nikos Mavrogiannopoulos <address@hidden>
 
diff --git a/GNUmakefile b/GNUmakefile
index 86bc60f..d0fd3e8 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,11 +1,11 @@
-# Having a separate GNUmakefile lets me `include' the dynamically
+# Having a separate GNUmakefile lets me 'include' the dynamically
 # generated rules created via cfg.mk (package-local configuration)
 # as well as maint.mk (generic maintainer rules).
 # This makefile is used only if you run GNU Make.
 # It is necessary if you want to build targets usually of interest
 # only to the maintainer.
 
-# Copyright (C) 2001, 2003, 2006-2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2006-2012 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
@@ -114,7 +114,7 @@ endif
 
 abort-due-to-no-makefile:
        @echo There seems to be no Makefile in this directory.   1>&2
-       @echo "You must run ./configure before running \`make'." 1>&2
+       @echo "You must run ./configure before running 'make'." 1>&2
        @exit 1
 
 endif
diff --git a/NEWS b/NEWS
index 3c284cc..1cfadfa 100644
--- a/NEWS
+++ b/NEWS
@@ -1,14 +1,7 @@
 GnuTLS NEWS -- History of user-visible changes.                -*- outline -*-
-Copyright (C) 2000-2011 Free Software Foundation, Inc.
+Copyright (C) 2000-2012 Free Software Foundation, Inc.
 See the end for copying conditions.
 
-* Version 3.0.10 (unreleased)
-
-** libgnutls: Corrected ciphersuite GNUTLS_ECDHE_PSK_AES_256_CBC_SHA384
-
-** libgnutls: Added ciphersuites: GNUTLS_PSK_WITH_AES_256_GCM_SHA384
-and GNUTLS_DHE_PSK_WITH_AES_256_GCM_SHA384.
-
 ** libgnutls: Added OCSP support.
 There is a new header file gnutls/ocsp.h and a set of new functions
 under the gnutls_ocsp namespace.  Currently the functionality provided
@@ -59,9 +52,64 @@ gnutls_ocsp_req_set_nonce: Added.
 gnutls_ocsp_resp_verify: Added.
 gnutls_ocsp_req_randomize_nonce: Added.
 
+* Version 3.0.12 (unreleased)
+
+** certtool: --outder option now works for private
+and public keys as well.
+
+** libgnutls: Corrected an alignment issue in ECDH
+key generation which prevented some keys from being
+correctly aligned in rare circumstances.
+
+** libgnutls: Corrected memory leaks in DH parameter
+generation and ecc_projective_check_point().
+
+** libgnutls: Added gnutls_x509_dn_oid_name() to 
+return a descriptive name of a DN OID.
+
+** API and ABI modifications:
+gnutls_pubkey_encrypt_data: Added
+gnutls_x509_dn_oid_name: Added
+gnutls_session_resumption_requested: Added
+
+* Version 3.0.11 (released 2012-01-06)
+
+** libgnutls: Corrected functionality of 
+gnutls_record_get_direction(). Reported by Philip Allison.
+
+** libgnutls: Provide less timing information when decoding
+TLS/DTLS record packets. Patch by Nadhem Alfardan.
+
 ** API and ABI modifications:
 No changes since last version.
 
+
+* Version 3.0.10 (released 2012-01-04)
+
+** gnutls-cli/serv: Set don't fragment bit in DTLS sessions
+in Linux as well as in BSD.
+
+** gnutls-cli: Fixed reading from windows terminals.
+
+** libgnutls: When GNUTLS_OPENPGP_FMT_BASE64 is specified
+the stream is assumed to be base64 encoded (previously
+the encoding was auto-detected). This avoids a decoding
+issue in windows systems.
+
+** libgnutls: Corrected ciphersuite GNUTLS_ECDHE_PSK_AES_256_CBC_SHA384
+
+** libgnutls: Added ciphersuites: GNUTLS_PSK_WITH_AES_256_GCM_SHA384
+and GNUTLS_DHE_PSK_WITH_AES_256_GCM_SHA384.
+
+** libgnutls: Added function gnutls_random_art() to convert 
+fingerprints to images (currently ascii-art).
+
+** libgnutls: Corrected bug in DSA private key parsing, which
+prevented the verification of the key.
+
+** API and ABI modifications:
+gnutls_random_art: Added
+
 * Version 3.0.9 (released 2011-12-13)
 
 ** certtool: Added new parameter --dh-info.
diff --git a/THANKS b/THANKS
index 7252223..a54740f 100644
--- a/THANKS
+++ b/THANKS
@@ -124,6 +124,8 @@ Vincent Untz                    *vuntz [at] gnome.org*
 Jan Misiak                      *fijam [at] archlinux.us*
 David Hoyt                      *hoyt6 [at] llnl.gov*
 Joseph Graham                   *joe [at] t67.eu*
+Eli Zaretskii                   *eliz [at] gnu.org*
+Patrick Pelletier               *code [at] funwithsoftware.org*
 
 ----------------------------------------------------------------------
 Copying and distribution of this file, with or without modification,
diff --git a/build-aux/config.rpath b/build-aux/config.rpath
index 8bd7f5d..c0d31f9 100755
--- a/build-aux/config.rpath
+++ b/build-aux/config.rpath
@@ -2,7 +2,7 @@
 # Output a system dependent set of variables, describing how to set the
 # run time search path of shared libraries in an executable.
 #
-#   Copyright 1996-2011 Free Software Foundation, Inc.
+#   Copyright 1996-2012 Free Software Foundation, Inc.
 #   Taken from GNU libtool, 2001
 #   Originally by Gordon Matzigkeit <address@hidden>, 1996
 #
diff --git a/build-aux/pmccabe2html b/build-aux/pmccabe2html
index c7cf3d0..7cf8df7 100644
--- a/build-aux/pmccabe2html
+++ b/build-aux/pmccabe2html
@@ -1,6 +1,6 @@
 # pmccabe2html - AWK script to convert pmccabe output to html       -*- awk -*-
 
-# Copyright (C) 2007-2011 Free Software Foundation, Inc.
+# Copyright (C) 2007-2012 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
diff --git a/build-aux/snippet/arg-nonnull.h b/build-aux/snippet/arg-nonnull.h
index 6c2f1e8..3a9dd26 100644
--- a/build-aux/snippet/arg-nonnull.h
+++ b/build-aux/snippet/arg-nonnull.h
@@ -1,5 +1,5 @@
 /* A C macro for declaring that specific arguments must not be NULL.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/build-aux/snippet/c++defs.h b/build-aux/snippet/c++defs.h
index b6821a6..96da94b 100644
--- a/build-aux/snippet/c++defs.h
+++ b/build-aux/snippet/c++defs.h
@@ -1,5 +1,5 @@
 /* C++ compatible function declaration macros.
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 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
diff --git a/build-aux/snippet/warn-on-use.h b/build-aux/snippet/warn-on-use.h
index 2cdeec3..d4cb94f 100644
--- a/build-aux/snippet/warn-on-use.h
+++ b/build-aux/snippet/warn-on-use.h
@@ -1,5 +1,5 @@
 /* A C macro for emitting warnings if a function is used.
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 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
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index b8f5a26..2b64630 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -4,13 +4,13 @@ eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
 # Detect instances of "if (p) free (p);".
 # Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
 
-my $VERSION = '2011-04-20 13:43'; # UTC
+my $VERSION = '2012-01-06 07:23'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2008-2011 Free Software Foundation, Inc.
+# Copyright (C) 2008-2012 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
@@ -47,7 +47,7 @@ sub usage ($)
   my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
   if ($exit_code != 0)
     {
-      print $STREAM "Try `$ME --help' for more information.\n";
+      print $STREAM "Try '$ME --help' for more information.\n";
     }
   else
     {
@@ -62,7 +62,7 @@ detect free-like functions named FOO and BAR.
 OPTIONS:
 
    --list       print only the name of each matching FILE (\\0-terminated)
-   --name=N     add name N to the list of \`free\'-like functions to detect;
+   --name=N     add name N to the list of \'free\'-like functions to detect;
                   may be repeated
 
    --help       display this help and exit
@@ -125,7 +125,7 @@ sub is_NULL ($)
   foreach my $file (@ARGV)
     {
       open FH, '<', $file
-        or (warn "$ME: can't open `$file' for reading: $!\n"),
+        or (warn "$ME: can't open '$file' for reading: $!\n"),
           $err = EXIT_ERROR, next;
       while (defined (my $line = <FH>))
         {
diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files
index 405e458..d477da8 100755
--- a/build-aux/vc-list-files
+++ b/build-aux/vc-list-files
@@ -4,7 +4,7 @@
 # Print a version string.
 scriptversion=2011-05-16.22; # UTC
 
-# Copyright (C) 2006-2011 Free Software Foundation, Inc.
+# Copyright (C) 2006-2012 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
diff --git a/configure.ac b/configure.ac
index 63578e3..104b582 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure 
script.
 # USA
 
 AC_PREREQ(2.61)
-AC_INIT([GnuTLS], [3.0.9], address@hidden)
+AC_INIT([GnuTLS], [3.0.11], address@hidden)
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -276,7 +276,12 @@ if test "$gl_gcc_warnings" = yes; then
 
   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
+  gl_WARN_ADD([-Wno-format-y2k])     # Too many warnings for now
+  gl_WARN_ADD([-Wno-suggest-attribute=pure])     # Too many warnings for now
+  gl_WARN_ADD([-Wno-suggest-attribute=const])     # Too many warnings for now
+  gl_WARN_ADD([-Wno-suggest-attribute=noreturn])     # Too many warnings for 
now
   gl_WARN_ADD([-Wno-pointer-sign])     # Too many warnings for now
+  gl_WARN_ADD([-Wno-unused-value]) # warnings for things we don't want to get
   gl_WARN_ADD([-Wno-unused-result]) # warnings for things we don't want to get
   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
@@ -409,6 +414,8 @@ dnl Crywrap dependencies
 *** Checking dependencies for crywrap...
 ])
 
+if test "$have_win" != "yes"; then
+
 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/select.h sys/types.h 
sys/wait.h])
 
 dnl **********************
@@ -431,6 +438,10 @@ AC_CHECK_FUNCS([alarm atexit dup2 epoll_create kqueue 
memchr memset munmap \
 
 PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
 
+else
+libidn=no
+fi
+
 AM_CONDITIONAL(ENABLE_CRYWRAP, test "x$libidn" != "xno")
 
 dnl end of crywrap requirements
@@ -465,6 +476,7 @@ AC_CONFIG_FILES([
   lib/algorithms/Makefile
   lib/auth/Makefile
   lib/ext/Makefile
+  lib/extras/Makefile
   lib/gnutls.pc
   lib/includes/Makefile
   lib/includes/gnutls/gnutls.h
diff --git a/cross.mk b/cross.mk
new file mode 100644
index 0000000..2d80989
--- /dev/null
+++ b/cross.mk
@@ -0,0 +1,115 @@
+
+GNUTLS_FILE:=gnutls-3.0.11.tar.xz
+GNUTLS_DIR:=gnutls-3.0.11
+
+GMP_FILE:=gmp-5.0.2.tar.bz2
+GMP_DIR:=gmp-5.0.2
+
+P11_KIT_FILE:=p11-kit-0.10.tar.gz
+P11_KIT_DIR:=p11-kit-0.10
+
+NETTLE_FILE:=nettle-2.4.tar.gz
+NETTLE_DIR:=nettle-2.4
+
+CROSS_DIR:=$(PWD)/win32
+BIN_DIR:=$(CROSS_DIR)/bin
+LIB_DIR:=$(CROSS_DIR)/lib
+HEADERS_DIR:=$(LIB_DIR)/include
+
+all: update-gpg-keys gnutls-w32
+
+update-gpg-keys:
+       gpg --recv-keys 96865171 B565716F D92765AF A8F4C2FD DB899F46
+
+$(GNUTLS_DIR)-w32.zip: $(LIB_DIR) $(BIN_DIR) $(GNUTLS_DIR)/.installed
+       -mv $(CROSS_DIR)/lib/include $(CROSS_DIR)/include
+       cd $(CROSS_DIR) && zip -r $(PWD)/$@ *
+       gpg --sign --detach $(GNUTLS_DIR)-w32.zip
+
+gnutls-w32: $(GNUTLS_DIR)-w32.zip
+
+nettle: $(NETTLE_DIR)/.installed
+
+gmp: $(GMP_DIR)/.installed
+
+$(BIN_DIR):
+       mkdir -p $(BIN_DIR)
+
+$(LIB_DIR):
+       mkdir -p $(LIB_DIR)
+       mkdir -p $(HEADERS_DIR)
+
+CONFIG_FLAGS := --host=i686-w64-mingw32 --enable-shared --disable-static 
--bindir=$(BIN_DIR) --libdir=$(LIB_DIR) --includedir=$(HEADERS_DIR)
+
+$(P11_KIT_DIR)/.configured:
+       test -f $(P11_KIT_FILE) || wget 
http://p11-glue.freedesktop.org/releases/$(P11_KIT_FILE)
+       test -f $(P11_KIT_FILE).sig || wget 
http://p11-glue.freedesktop.org/releases/$(P11_KIT_FILE).sig
+       gpg --verify $(P11_KIT_FILE).sig
+       test -d $(P11_KIT_DIR) || tar -xf $(P11_KIT_FILE)
+       cd $(P11_KIT_DIR) && ./configure $(CONFIG_FLAGS) && cd ..
+       touch $@
+
+$(P11_KIT_DIR)/.installed: $(P11_KIT_DIR)/.configured
+       make -C $(P11_KIT_DIR) -j2
+       make -C $(P11_KIT_DIR) install -i
+       -rm -rf $(HEADERS_DIR)/p11-kit
+       -mv $(HEADERS_DIR)/p11-kit-1/p11-kit $(HEADERS_DIR)
+       -rmdir $(HEADERS_DIR)/p11-kit-1
+       rm -f $(BIN_DIR)/p11-kit.exe
+       touch $@
+
+$(GMP_DIR)/.configured: 
+       test -f $(GMP_FILE) || wget 
ftp://ftp.gmplib.org/pub/$(GMP_DIR)/$(GMP_FILE)
+       test -f $(GMP_FILE).sig || wget 
ftp://ftp.gmplib.org/pub/$(GMP_DIR)/$(GMP_FILE).sig
+       gpg --verify $(GMP_FILE).sig
+       test -d $(GMP_DIR) || tar -xf $(GMP_FILE)
+       cd $(GMP_DIR) && ./configure $(CONFIG_FLAGS) --enable-fat 
--exec-prefix=$(LIB_DIR) --oldincludedir=$(HEADERS_DIR) && cd ..
+       touch $@
+
+$(GMP_DIR)/.installed: $(GMP_DIR)/.configured
+       make -C $(GMP_DIR) -j2
+       make -C $(GMP_DIR) install -i
+       touch $@
+
+$(NETTLE_DIR)/.configured: $(GMP_DIR)/.installed
+       test -f $(NETTLE_FILE) || wget 
http://www.lysator.liu.se/~nisse/archive/$(NETTLE_FILE)
+       test -f $(NETTLE_FILE).sig || wget 
http://www.lysator.liu.se/~nisse/archive/$(NETTLE_FILE).sig
+       gpg --verify $(NETTLE_FILE).sig
+       test -d $(NETTLE_DIR) || tar -xf $(NETTLE_FILE)
+       cd $(NETTLE_DIR) && CFLAGS="-I$(HEADERS_DIR)" 
CXXFLAGS="-I$(HEADERS_DIR)" ./configure $(CONFIG_FLAGS) 
--with-lib-path=$(LIB_DIR) && cd ..
+       touch $@
+
+#nettle messes up installation
+$(NETTLE_DIR)/.installed: $(NETTLE_DIR)/.configured
+       make -C $(NETTLE_DIR) -j2
+       make -C $(NETTLE_DIR) install -i
+       rm -f $(LIB_DIR)/libnettle.a $(LIB_DIR)/libhogweed.a 
$(BIN_DIR)/nettle-hash.exe $(BIN_DIR)/nettle-lfib-stream.exe 
$(BIN_DIR)/pkcs1-conv.exe $(BIN_DIR)/sexp-conv.exe
+       cp $(NETTLE_DIR)/libnettle.dll.a $(NETTLE_DIR)/libhogweed.dll.a 
$(LIB_DIR)/
+       cp $(NETTLE_DIR)/libnettle*.dll $(NETTLE_DIR)/libhogweed*.dll 
$(BIN_DIR)/
+       touch $@
+
+$(GNUTLS_DIR)/.installed: $(GNUTLS_DIR)/.configured
+       make -C $(GNUTLS_DIR) -j2
+       make -C $(GNUTLS_DIR) install -i
+       cp $(GNUTLS_DIR)/COPYING $(GNUTLS_DIR)/COPYING.LESSER $(CROSS_DIR)
+       touch $@
+
+$(GNUTLS_DIR)/.configured: $(NETTLE_DIR)/.installed $(P11_KIT_DIR)/.installed
+       test -f $(GNUTLS_FILE) || wget 
ftp://ftp.gnu.org/gnu/gnutls/$(GNUTLS_FILE)
+       test -f $(GNUTLS_FILE).sig || wget 
ftp://ftp.gnu.org/gnu/gnutls/$(GNUTLS_FILE).sig
+       gpg --verify $(GNUTLS_FILE).sig
+       test -d $(GNUTLS_DIR) || tar -xf $(GNUTLS_FILE)
+       cd $(GNUTLS_DIR) && \
+               P11_KIT_CFLAGS="-I$(HEADERS_DIR)" \
+               P11_KIT_LIBS="$(LIB_DIR)/libp11-kit.la" \
+               LDFLAGS="-L$(LIB_DIR)" CFLAGS="-I$(HEADERS_DIR)" 
CXXFLAGS="-I$(HEADERS_DIR)" \
+               ./configure $(CONFIG_FLAGS) --with-libnettle-prefix=$(LIB_DIR) \
+               --disable-openssl-compatibility && cd ..
+       touch $@
+
+clean:
+       rm -rf $(CROSS_DIR) $(GNUTLS_DIR)/.installed $(NETTLE_DIR)/.installed 
$(GMP_DIR)/.installed $(P11_KIT_DIR)/.installed
+
+dirclean:
+       rm -rf $(CROSS_DIR) $(GNUTLS_DIR) $(NETTLE_DIR) $(GMP_DIR) 
$(P11_KIT_DIR)
+
diff --git a/doc/Makefile.am b/doc/Makefile.am
index c2be304..9561895 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -39,14 +39,14 @@ gnutls_TEXINFOS = gnutls.texi fdl-1.3.texi lgpl-2.1.texi 
gpl-3.0.texi       \
        cha-shared-key.texi cha-gtls-examples.texi
 
 # Examples.
-gnutls_TEXINFOS += examples/ex-client1.c                               \
+gnutls_TEXINFOS += examples/ex-client-anon.c                           \
        examples/ex-session-info.c examples/ex-verify.c                 \
        examples/ex-cert-select.c examples/ex-client-resume.c           \
-       examples/ex-client-srp.c examples/ex-rfc2818.c                  \
-       examples/ex-serv1.c examples/ex-serv-anon.c                     \
+       examples/ex-client-srp.c examples/ex-client-x509.c              \
+       examples/ex-serv-x509.c examples/ex-serv-anon.c                 \
        examples/ex-serv-pgp.c examples/ex-serv-srp.c                   \
        examples/ex-alert.c examples/ex-x509-info.c examples/ex-crq.c   \
-       examples/ex-pkcs12.c
+       examples/ex-pkcs12.c examples/ex-client-dtls.c
 
 # Images.  Make sure there are eps + png + pdf of each, plus the source dia.
 gnutls_TEXINFOS += gnutls-internals.dia gnutls-internals.eps           \
@@ -209,12 +209,16 @@ ocsp-api.texi: $(top_srcdir)/lib/includes/gnutls/ocsp.h
        mv -f address@hidden $@
 
 # Generated texinfos.
-
+# for some reason it does not work when cross compiling
+if !WINDOWS
 gnutls_TEXINFOS += error_codes.texi algorithms.texi alerts.texi  enums.texi
+endif
+
 MAINTAINERCLEANFILES += error_codes.texi algorithms.texi enums.texi
 
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/lib/includes -I$(top_builddir)/lib/includes
+       -I$(top_builddir)/lib/includes -I$(top_srcdir)/lib/includes \
+       -I$(top_builddir)/
 
 EXTRA_PROGRAMS = errcodes printlist alert-printlist
 
diff --git a/doc/cha-bib.texi b/doc/cha-bib.texi
index 3bde7da..c88d9f6 100644
--- a/doc/cha-bib.texi
+++ b/doc/cha-bib.texi
@@ -27,6 +27,11 @@ Tim Dierks and Christopher Allen, "The TLS Protocol Version 
1.0",
 January 1999, Available from
 @url{http://www.ietf.org/rfc/rfc2246.txt}.
 
address@hidden @anchor{RFC4514}[RFC4514]
+Kurt D.  Zeilenga, "Lightweight Directory Access Protocol (LDAP): String 
Representation of Distinguished Names",
+June 2006, Available from
address@hidden://www.ietf.org/rfc/rfc4513.txt}.
+
 @item @anchor{RFC4346}[RFC4346]
 Tim Dierks and Eric Rescorla, "The TLS Protocol Version 1.1", Match
 2006, Available from @url{http://www.ietf.org/rfc/rfc4346.txt}.
diff --git a/doc/cha-cert-auth.texi b/doc/cha-cert-auth.texi
index df9d388..8dcb6e9 100644
--- a/doc/cha-cert-auth.texi
+++ b/doc/cha-cert-auth.texi
@@ -2,22 +2,18 @@
 @chapter Certificate authentication
 @cindex certificate authentication
 
address@hidden
-* Introduction::
-* X.509 certificates::
-* OpenPGP certificates::
-* Digital signatures::
address@hidden menu
-
address@hidden Introduction
address@hidden Introduction
-
 The most known authentication method of @acronym{TLS} are certificates.
 The PKIX @xcite{PKIX} public key infrastructure is daily used by anyone
 using a browser today. @acronym{GnuTLS} supports both 
 @acronym{X.509} certificates @xcite{PKIX} and @acronym{OpenPGP}
 certificates using a common API.
 
address@hidden
+* X.509 certificates::
+* OpenPGP certificates::
+* Digital signatures::
address@hidden menu
+
 @node X.509 certificates
 @section @acronym{X.509} certificates
 @cindex X.509 certificates
@@ -39,6 +35,7 @@ acceptable.  The framework is illustrated on @ref{fig:x509}.
 
 @menu
 * X.509 certificate structure::
+* X.509 distinguished names::
 * Verifying X.509 certificate paths::
 * Verifying a certificate in the context of TLS session::
 @end menu
@@ -147,6 +144,34 @@ their prototypes in @file{gnutls/x509.h}. An example 
program to
 demonstrate the @acronym{X.509} parsing capabilities can be found at
 @ref{ex:x509-info}.
 
address@hidden X.509 distinguished names
address@hidden X.509 distinguished names
address@hidden X.509 distinguished name
+
+The ``subject'' of an X.509 certificate is not described by
+a single name, but rather with a distinguished name. This in
+X.509 terminology is a list of strings each associated an object
+identifier. To make things simple GnuTLS provides 
@funcref{gnutls_x509_crt_get_dn}
+which follows the rules in @xcite{RFC4514} and returns a single
+string. Access to each string by individual object identifiers
+can be accessed using @funcref{gnutls_x509_crt_get_dn_by_oid}.
+
address@hidden
address@hidden
address@hidden
+
+The more powerful @funcref{gnutls_x509_crt_get_subject} and 
address@hidden provide efficient access
+to the contents of the distinguished name structure.
+
address@hidden
address@hidden
+
+Similar functions exist to access the distinguished name
+of the issuer of the certificate.
+
address@hidden,gnutls_x509_crt_get_issuer_dn_by_oid,gnutls_x509_crt_get_issuer_dn_oid,gnutls_x509_crt_get_issuer}
+
 @node Verifying X.509 certificate paths
 @subsection Verifying @acronym{X.509} certificate paths
 @cindex verifying certificate paths
@@ -372,10 +397,10 @@ certificate chain, you can call
 @end itemize
 as in the following example:
 
address@hidden
address@hidden
   gnutls_certificate_set_verify_flags (x509cred,
                                        GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5);
address@hidden smallexample
address@hidden example
 
 This will tell the verifier algorithm to enable @code{RSA-MD5} when
 verifying the certificates.
diff --git a/doc/cha-cert-auth2.texi b/doc/cha-cert-auth2.texi
index dca61ae..9abf1c8 100644
--- a/doc/cha-cert-auth2.texi
+++ b/doc/cha-cert-auth2.texi
@@ -2,6 +2,11 @@
 @chapter More on certificate authentication
 @cindex certificate authentication
 
+Certificates are not the only structures involved in a public key
+infrastructure. Several other structures that are used for certificate
+requests, encrypted private keys, revocation lists, GnuTLS abstract key
+structures, etc., are discussed in this chapter.
+
 @menu
 * PKCS 10 certificate requests::
 * PKIX certificate revocation lists::
@@ -9,7 +14,7 @@
 * Managing encrypted keys::
 * The certtool application::
 * The ocsptool application::
-* Hardware tokens::
+* Smart cards and HSMs::
 * Abstract key types::
 @end menu
 
@@ -290,7 +295,7 @@ anchors before it can be relied upon.
 
 Transferring or storing private keys in plain might not be a
 good idea. Any access on the keys becomes a fatal compromise.
-Storing the keys in hardware tokens (see @ref{Hardware tokens})
+Storing the keys in hardware security modules (see @ref{Smart cards and HSMs})
 could solve the storage problem but it is not always practical
 or efficient enough. This section describes alternative ways
 that involve encryption of the private keys to store and
@@ -454,18 +459,18 @@ example of a template file.
 
 @subheading Diffie-Hellman parameter generation
 To generate parameters for Diffie-Hellman key exchange, use the command:
address@hidden
-$ certtool --generate-dh-params --outfile dh.pem
address@hidden smallexample
address@hidden
+$ certtool --generate-dh-params --outfile dh.pem --sec-param normal
address@hidden example
 
 @subheading Self-signed certificate generation
 
 To create a self signed certificate, use the command:
address@hidden
address@hidden
 $ certtool --generate-privkey --outfile ca-key.pem
 $ certtool --generate-self-signed --load-privkey ca-key.pem \
    --outfile ca-cert.pem
address@hidden smallexample
address@hidden example
 
 Note that a self-signed certificate usually belongs to a certificate
 authority, that signs other certificates.
@@ -473,9 +478,9 @@ authority, that signs other certificates.
 @subheading Private key generation
 To create a private key (RSA by default), run:
 
address@hidden
address@hidden
 $ certtool --generate-privkey --outfile key.pem
address@hidden smallexample
address@hidden example
 
 To create a DSA or elliptic curves (ECDSA) private key use the
 above command combined with @code{--dsa} or @code{--ecc} options.
@@ -483,63 +488,63 @@ above command combined with @code{--dsa} or @code{--ecc} 
options.
 @subheading Certificate generation
 To generate a certificate using the private key, use the command:
 
address@hidden
address@hidden
 $ certtool --generate-certificate --load-privkey key.pem \
    --outfile cert.pem --load-ca-certificate ca-cert.pem \
    --load-ca-privkey ca-key.pem
address@hidden smallexample
address@hidden example
 
 Alternatively you may create a certificate request, which is needed
 when the certificate will be signed by a third party authority.
 
address@hidden
address@hidden
 $ certtool --generate-request --load-privkey key.pem \
   --outfile request.pem
address@hidden smallexample
address@hidden example
 
 If the private key is stored in a smart card you can generate
 a request by specifying the private key object URL (see @ref{The p11tool 
application}
 on how to obtain the URL).
 
address@hidden
address@hidden
 $ certtool --generate-request --load-privkey pkcs11:(PRIVKEY URL) \
   --load-pubkey pkcs11:(PUBKEY URL) --outfile request.pem
address@hidden smallexample
address@hidden example
 
 To generate a certificate using the previous request, use the command:
 
address@hidden
address@hidden
 $ certtool --generate-certificate --load-request request.pem \
    --outfile cert.pem \
    --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
address@hidden smallexample
address@hidden example
 
 @subheading Certificate information
 To view the certificate information, use:
 
address@hidden
address@hidden
 $ certtool --certificate-info --infile cert.pem
address@hidden smallexample
address@hidden example
 
 @subheading @acronym{PKCS} #12 structure generation
 To generate a @acronym{PKCS} #12 structure using the previous key and
 certificate, use the command:
 
address@hidden
address@hidden
 $ certtool --load-certificate cert.pem --load-privkey key.pem \
   --to-p12 --outder --outfile key.p12
address@hidden smallexample
address@hidden example
 
 Some tools (reportedly web browsers) have problems with that file
 because it does not contain the CA certificate for the certificate.
 To work around that problem in the tool, you can use the
 --load-ca-certificate parameter as follows:
 
address@hidden
address@hidden
 $ certtool --load-ca-certificate ca.pem \
   --load-certificate cert.pem --load-privkey key.pem \
   --to-p12 --outder --outfile key.p12
address@hidden smallexample
address@hidden example
 
 @subheading Proxy certificate generation
 Proxy certificate can be used to delegate your credential to a
@@ -547,34 +552,34 @@ temporary, typically short-lived, certificate.  To create 
one from the
 previously created certificate, first create a temporary key and then
 generate a proxy certificate for it, using the commands:
 
address@hidden
address@hidden
 $ certtool --generate-privkey > proxy-key.pem
 $ certtool --generate-proxy --load-ca-privkey key.pem \
   --load-privkey proxy-key.pem --load-certificate cert.pem \
   --outfile proxy-cert.pem
address@hidden smallexample
address@hidden example
 
 @subheading Certificate revocation list generation
 To create an empty Certificate Revocation List (CRL) do:
 
address@hidden
address@hidden
 $ certtool --generate-crl --load-ca-privkey x509-ca-key.pem \
            --load-ca-certificate x509-ca.pem
address@hidden smallexample
address@hidden example
 
 To create a CRL that contains some revoked certificates, place the
 certificates in a file and use @code{--load-certificate} as follows:
 
address@hidden
address@hidden
 $ certtool --generate-crl --load-ca-privkey x509-ca-key.pem \
   --load-ca-certificate x509-ca.pem --load-certificate revoked-certs.pem
address@hidden smallexample
address@hidden example
 
 To verify a Certificate Revocation List (CRL) do:
 
address@hidden
address@hidden
 $ certtool --verify-crl --load-ca-certificate x509-ca.pem < crl.pem
address@hidden smallexample
address@hidden example
 
 
 
@@ -583,11 +588,11 @@ A template file can be used to avoid the interactive 
questions of
 certtool. Initially create a file named 'cert.cfg' that contains the 
information
 about the certificate. The template can be used as below:
 
address@hidden
address@hidden
 $ certtool --generate-certificate cert.pem --load-privkey key.pem  \
    --template cert.cfg \
    --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
address@hidden smallexample
address@hidden example
 
 An example certtool template file:
 
@@ -876,25 +881,14 @@ You may experiment passing different certificates to
 @code{--load-trust} and @code{--load-signer} to find common error
 conditions for OCSP response verification failures.
 
address@hidden Hardware tokens
address@hidden Security modules
address@hidden Smart cards and HSMs
address@hidden Smart cards and HSMs
 @cindex PKCS #11 tokens
 @cindex hardware tokens
 @cindex hardware security modules
 @cindex smart cards
 
address@hidden
-* Introduction on security modules::
-* PKCS11 Initialization::
-* Reading objects::
-* Writing objects::
-* Using a PKCS11 token with TLS::
-* The p11tool application::
address@hidden menu
-
address@hidden Introduction on security modules
address@hidden Introduction
-In this section we present the smart-card and hardware security module support 
+In this section we present the smart-card and hardware security module (HSM) 
support 
 in @acronym{GnuTLS} using @acronym{PKCS} #11 @xcite{PKCS11}. Hardware security
 modules and smart cards provide a way to store private keys and perform
 operations on them without exposing them. This allows decoupling cryptographic
@@ -925,6 +919,14 @@ system, being the @acronym{Gnome Keyring}.
 @caption{PKCS #11 module usage.}
 @end float
 
address@hidden
+* PKCS11 Initialization::
+* Reading objects::
+* Writing objects::
+* Using a PKCS11 token with TLS::
+* The p11tool application::
address@hidden menu
+
 @node PKCS11 Initialization
 @subsection Initialization
 To allow all the  @acronym{GnuTLS} applications to access @acronym{PKCS} #11 
tokens
@@ -933,9 +935,9 @@ These are the configuration files of 
@address@hidden@url{http://p11-
 For example a file that will load the @acronym{OpenSC} module, could be named
 @code{/etc/pkcs11/modules/opensc} and contain the following:
 
address@hidden
address@hidden
 module: /usr/lib/opensc-pkcs11.so
address@hidden smallexample
address@hidden example
 
 If you use this file, then there is no need for other initialization in
 @acronym{GnuTLS}, except for the PIN and token functions. Those allow 
retrieving a PIN
@@ -959,16 +961,16 @@ This allows for a consistent naming of objects across 
systems and applications
 in the same system. For example a public
 key on a smart card may be referenced as:
 
address@hidden
address@hidden
 pkcs11:token=Nikos;serial=307521161601031;model=PKCS%2315; \
 manufacturer=EnterSafe;object=test1;objecttype=public;\
 id=32f153f3e37990b08624141077ca5dec2d15faed
address@hidden smallexample
address@hidden example
 
 while the smart card itself can be referenced as:
address@hidden
address@hidden
 
pkcs11:token=Nikos;serial=307521161601031;model=PKCS%2315;manufacturer=EnterSafe
address@hidden smallexample
address@hidden example
 
 Objects stored in a @acronym{PKCS} #11 token can be extracted
 if they are not marked as sensitive. Usually only private keys are marked as
@@ -1049,7 +1051,7 @@ p11tool is a program that is used to access tokens
 and security modules that support the PKCS #11 API. It requires
 individual PKCS #11 modules to be loaded either with the
 @code{--provider} option, or by setting up the GnuTLS configuration
-file for PKCS #11 as in @ref{Hardware tokens}.
+file for PKCS #11 as in @ref{Smart cards and HSMs}.
 
 @example
 p11tool help
@@ -1109,32 +1111,32 @@ on them.
 Some examples on how to use p11tool are illustrated in the following  
paragraphs.
 
 @subsubheading List all tokens
address@hidden
address@hidden
 $ p11tool --list-tokens
address@hidden smallexample
address@hidden example
 
 @subsubheading List all objects
 The following command will list all objects in a token. The @code{--login}
 is required to show objects marked as private.
address@hidden
address@hidden
 $ p11tool --login --list-all
address@hidden smallexample
address@hidden example
 
 @subsubheading Exporting an object
 To retrieve an object stored in the card use the following command.
 Note however that objects marked as sensitive (typically PKCS #11 private 
keys) 
 are not allowed to be extracted from the token.
address@hidden 
address@hidden 
 $ p11tool --login --export [OBJECT URL]
address@hidden smallexample
address@hidden example
 
 @subsubheading Copy an object to a token
 To copy an object, such as a certificate or private key to a token
 use the following command.
address@hidden 
address@hidden 
 $ p11tool --login --write [TOKEN URL] \
   --load-certificate cert.pem --label "my_cert"
address@hidden smallexample
address@hidden example
 
 
 @node Abstract key types
@@ -1208,9 +1210,17 @@ but unlike public keys it cannot be exported. That is
 to allow abstraction over @acronym{PKCS} #11 keys that
 are not extractable.
 
address@hidden,gnutls_privkey_import_openpgp,gnutls_privkey_import_pkcs11,gnutls_privkey_import_ext}
address@hidden,gnutls_privkey_import_openpgp,gnutls_privkey_import_pkcs11}
+
 @showfuncB{gnutls_privkey_get_pk_algorithm,gnutls_privkey_get_type}
 
+In order to support cryptographic operations using 
+an external API, the following function is provided.
+This allows for a simple extensibility API without
+resorting to @acronym{PKCS} #11.
+
address@hidden
+
 @node Operations
 @subsection Operations
 The abstract key types can be used to access signing and
@@ -1218,8 +1228,11 @@ signature verification operations with the underlying 
keys.
 
 @showfuncdesc{gnutls_pubkey_verify_data2}
 @showfuncdesc{gnutls_pubkey_verify_hash}
address@hidden
+
 @showfuncdesc{gnutls_privkey_sign_data}
 @showfuncdesc{gnutls_privkey_sign_hash}
address@hidden
 
 Signing existing structures, such as certificates, CRLs,
 or certificate requests, as well as associating public
diff --git a/doc/cha-ciphersuites.texi b/doc/cha-ciphersuites.texi
index fcf650a..24288f8 100644
--- a/doc/cha-ciphersuites.texi
+++ b/doc/cha-ciphersuites.texi
@@ -1,5 +1,5 @@
address@hidden Supported ciphersuites in GnuTLS
address@hidden Supported Ciphersuites in @acronym{GnuTLS}
address@hidden Supported ciphersuites
address@hidden Supported Ciphersuites
 @anchor{ciphersuites}
 @cindex ciphersuites
 
diff --git a/doc/cha-copying.texi b/doc/cha-copying.texi
index 183006a..7d29cc4 100644
--- a/doc/cha-copying.texi
+++ b/doc/cha-copying.texi
@@ -1,14 +1,8 @@
 @node Copying Information
 @appendix Copying Information
-
address@hidden
-* GNU Free Documentation License::   License for copying this manual.
address@hidden menu
-
address@hidden GNU Free Documentation License
address@hidden GNU Free Documentation License
-
 @cindex FDL, GNU Free Documentation License
 
address@hidden GNU Free Documentation License
+
 @include fdl-1.3.texi
 
diff --git a/doc/cha-gtls-app.texi b/doc/cha-gtls-app.texi
index 32c806e..406e6b3 100644
--- a/doc/cha-gtls-app.texi
+++ b/doc/cha-gtls-app.texi
@@ -9,6 +9,7 @@
 * Setting up the transport layer::
 * TLS handshake::
 * Data transfer and termination::
+* Handling alerts::
 * Priority Strings::
 * Advanced and other topics::
 * Using the cryptographic library::
@@ -124,16 +125,16 @@ threads as long as a single thread accesses a single 
object. This is
 sufficient to support a server which handles several sessions per thread.
 If, however, an object needs to be shared across threads then access must be 
 protected with a mutex. Read-only access to objects, for example the
-credentials holding structures (see @ref{Authentication}), is also 
thread-safe. 
+credentials holding structures, is also thread-safe. 
 
 The random generator of the cryptographic back-end, is not thread safe and 
requires
 mutex locks which are setup by @acronym{GnuTLS}.
 Applications can either call @funcref{gnutls_global_init} which will 
initialize the default
 operating system provided locks (i.e. @code{pthreads} on GNU/Linux and
address@hidden on Windows), or specify manually the locking system using 
address@hidden on Windows), or manually specify the locking system using
 the function @funcref{gnutls_global_set_mutex} before calling 
@funcref{gnutls_global_init}. 
-Setting manually mutexes is recommended
-only to applications that have full control of the underlying libraries. If 
this
+Setting mutexes manually is recommended
+only for applications that have full control of the underlying libraries. If 
this
 is not the case, the use of the operating system defaults is recommended. An 
example of 
 non-native thread usage is shown below.
 
@@ -237,9 +238,9 @@ to be added to the compiler invocation at compile time are 
output by
 the @option{--cflags} option to @command{pkg-config gnutls}.  The
 following example shows how it can be used at the command line:
 
address@hidden
address@hidden
 gcc -c foo.c `pkg-config gnutls --cflags`
address@hidden smallexample
address@hidden example
 
 Adding the output of @samp{pkg-config gnutls --cflags} to the
 compilers command line will ensure that the compiler can find the
@@ -255,16 +256,26 @@ required to link the program with the library (for 
instance, the
 @samp{-ltasn1} option).  The example shows how to link @file{foo.o}
 with the library to a program @command{foo}.
 
address@hidden
address@hidden
 gcc -o foo foo.o `pkg-config gnutls --libs`
address@hidden smallexample
address@hidden example
 
 Of course you can also combine both examples to a single command by
 specifying both options to @command{pkg-config}:
 
address@hidden
address@hidden
 gcc -o foo foo.c `pkg-config gnutls --cflags --libs`
address@hidden smallexample
address@hidden example
+
+When a program uses the GNU autoconf system, then the following
+line or similar can be used to detect the presence of GnuTLS.
+
address@hidden
+PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.0.0])
+
+AC_SUBST([LIBGNUTLS_CFLAGS])
+AC_SUBST([LIBGNUTLS_LIBS])
address@hidden example
 
 @node Session initialization
 @section Session initialization
@@ -305,7 +316,7 @@ current session using @funcref{gnutls_credentials_set}.
 
 When using certificates the server is required to have at least one
 certificate and private key pair. Clients may not hold such
-a pair, but a server could require it. On this section we discuss
+a pair, but a server could require it. In this section we discuss
 general issues applying to both client and server certificates. The next
 section will elaborate on issues arising from client authentication only.
 
@@ -327,6 +338,10 @@ already.
 
 
@showfuncD{gnutls_certificate_set_openpgp_key_mem,gnutls_certificate_set_openpgp_key,gnutls_certificate_set_openpgp_key_file,gnutls_certificate_set_key}
 
+If multiple certificates are used with the functions above each
+client's request will be served with the certificate that matches the
+requested name (see @ref{Server name indication}).
+
 As an alternative to loading from files or buffers, a callback may be used for 
the 
 server or the client to specify the certificate and the key at the handshake 
time.
 In that case a certificate should be selected according the peer's signature
@@ -335,45 +350,23 @@ algorithm preferences. To get those preferences use
 
 
@showfuncB{gnutls_certificate_set_retrieve_function,gnutls_sign_algorithm_get_requested}
 
-Certificate verification is possible by loading the trusted
-authorities into the credentials structure by using
-the following functions, applicable to X.509 and OpenPGP certificates.
-
address@hidden,gnutls_certificate_set_openpgp_keyring_file}
+The functions above do not handle the requested server name automatically.
+A server would need to check the name requested by the client
+using @funcref{gnutls_server_name_get}, and serve the appropriate
+certificate.
 
-Note however that the peer's certificate is not automatically
-verified, you should call @funcref{gnutls_certificate_verify_peers2},
-after a successful handshake or during if 
@funcref{gnutls_certificate_set_verify_function}
-has been used, to verify the certificate's signature.
-An alternative way, which reports a more detailed
-verification output, is to use @funcref{gnutls_certificate_get_peers} to
-obtain the raw certificate of the peer and verify it using the
-functions discussed in @ref{X.509 certificates}.
-
address@hidden
-
-In a handshake, the negotiated cipher suite also depends on the
+In a handshake, the negotiated cipher suite depends on the
 certificate's parameters, so some key exchange methods might not be
-available with some certificates. @acronym{GnuTLS} will disable
+available with all certificates. @acronym{GnuTLS} will disable
 ciphersuites that are not compatible with the key, or the enabled
 authentication methods.  For example keys marked as sign-only, will
 not be able to access the plain RSA ciphersuites, that require
 decryption. It is not recommended to use RSA keys for both
 signing and encryption. If possible use a different key for the
address@hidden which uses signing and @code{RSA} that requires decryption.
address@hidden which uses signing and @code{RSA} that requires decryption.
 All the key exchange methods shown in @ref{tab:key-exchange} are
 available in certificate authentication.
 
address@hidden
-
-Note that the DHE key exchange methods are generally
address@hidden depends on the group used.  Primes with
-lesser bits are always faster, but also easier to break.  See @ref{Selecting 
cryptographic key sizes}
-for the acceptable security levels.} than the elliptic curves counterpart
-(ECDHE). Moreover the plain Diffie-Hellman key exchange
-requires parameters to be generated and associated with a credentials
-structure by the server (see @ref{Parameter generation}). 
-
 
 @subsubheading Client certificate authentication
 
@@ -392,6 +385,31 @@ signed by server's acceptable signers.
 @showfuncdesc{gnutls_certificate_send_x509_rdn_sequence}
 
 
address@hidden Client or server certificate verification
+
+Certificate verification is possible by loading the trusted
+authorities into the credentials structure by using
+the following functions, applicable to X.509 and OpenPGP certificates.
+
address@hidden,gnutls_certificate_set_openpgp_keyring_file}
+
+The peer's certificate is not automatically verified and one 
+should call @funcref{gnutls_certificate_verify_peers2}
+after a successful handshake to verify the certificate's signature.
+Alternative the verification can occur during the handshake
+by using @funcref{gnutls_certificate_set_verify_function}.
+
+In order to report a detailed verification output, an alternative
+way has to be used. For that, one should call 
@funcref{gnutls_certificate_get_peers} 
+to obtain the raw certificate of the peer and verify it using the
+functions discussed in @ref{X.509 certificates}.
+
address@hidden
+
address@hidden
+
+
+
 @node SRP credentials
 @subsection SRP
 
@@ -617,7 +635,7 @@ fatal for the protocol or can be ignored.
 
 @showfuncdesc{gnutls_error_is_fatal}
 
-In DTLS it is adviceable to use the extended receive
+In DTLS it is advisable to use the extended receive
 function shown below, because it allows the extraction
 of the sequence number. This is required in DTLS because
 messages may arrive out of order.
@@ -643,6 +661,24 @@ A session can be deinitialized with the 
@funcref{gnutls_deinit} function.
 @showfuncdesc{gnutls_bye}
 @showfuncdesc{gnutls_deinit}
 
address@hidden Handling alerts
address@hidden Handling alerts
+During a TLS connection alert messages may be exchanged by the
+two peers. Those messages may be fatal, meaning the connection
+must be terminated afterwards, or warning when something needs
+to be reported to the peer, but without interrupting the session.
+The error codes @code{GNUTLS_E_WARNING_ALERT_RECEIVED}
+or @code{GNUTLS_E_FATAL_ALERT_RECEIVED} signal those alerts
+when received, and may be returned by all GnuTLS functions that receive 
+data from the peer, being @funcref{gnutls_handshake} and 
@funcref{gnutls_record_recv}.
+Alerts messages may be sent to the peer using @funcref{gnutls_alert_send}.
+
address@hidden
+
address@hidden
+
address@hidden,gnutls_alert_get_name}
+
 
 @node Priority Strings
 @section Priority strings
@@ -670,12 +706,14 @@ included as a fallback only.  The ciphers are sorted by 
security
 margin.
 
 @item SECURE128 @tab
-Means all "secure" ciphersuites of security level 128-bit
-or more.
+Means all "secure" ciphersuites that offer a 
+security level 128-bit or more and a message authenticity
+security level of 80 bits or more.
 
 @item SECURE192 @tab
-Means all "secure" ciphersuites of security level 192-bit
-or more.
+Means all "secure" ciphersuites that offer a 
+security level 192-bit or more and a message authenticity
+security level of 128 bits or more.
 
 @item SECURE256 @tab
 Currently alias for SECURE192.
@@ -707,8 +745,16 @@ compression NULL; for certificate types X.509.
 In key exchange algorithms when in NORMAL or SECURE levels the
 perfect forward secrecy algorithms take precedence of the other
 protocols.  In all cases all the supported key exchange algorithms
- are enabled (except for the RSA-EXPORT which is only enabled in
-EXPORT level).
+are address@hidden for the RSA-EXPORT which is only enabled in
+EXPORT level.}.
+
+Note that the SECURE levels distinguish between overall security level and
+message authenticity security level. That is because the message
+authenticity security level requires the adversary to break
+the algorithms at real-time during the protocol run, whilst 
+the overall security level refers to off-line adversaries 
+(e.g. adversaries breaking the ciphertext years after it was captured).
+
 The NONE keyword, if used, must followed by the algorithms to be enabled,
 and is used to provide the exact list of requested address@hidden avoid 
collisions in order to specify a compression algorithm in
 this string you have to prefix it with "COMP-", protocol versions
@@ -750,7 +796,7 @@ COMP-NULL, COMP-DEFLATE. Catch all is COMP-ALL.
 
 @item TLS versions @tab
 VERS-SSL3.0, VERS-TLS1.0, VERS-TLS1.1,
-VERS-TLS1.2. Catch all is VERS-TLS-ALL.
+VERS-TLS1.2, VERS-DTLS1.0. Catch all is VERS-TLS-ALL.
 
 @item Signature algorithms @tab
 SIGN-RSA-SHA1, SIGN-RSA-SHA224, 
@@ -759,13 +805,19 @@ SIGN-DSA-SHA224, SIGN-DSA-SHA256, SIGN-RSA-MD5. Catch all
 is SIGN-ALL. This is only valid for TLS 1.2 and later.
 
 @item Elliptic curves @tab
-CURVE-SECP224R1, CURVE-SECP256R1, CURVE-SECP384R1, CURVE-SECP521R1. Catch all 
is CURVE-ALL.
+CURVE-SECP192R1, CURVE-SECP224R1, CURVE-SECP256R1, CURVE-SECP384R1, 
CURVE-SECP521R1. Catch all is CURVE-ALL.
 
 @end multitable
 @caption{The supported algorithm keywords in priority strings.}
 @end float
 
-
+Note that the DHE key exchange methods are generally
address@hidden depends on the group used.  Primes with
+lesser bits are always faster, but also easier to break.  See @ref{Selecting 
cryptographic key sizes}
+for the acceptable security levels.} than their elliptic curves counterpart
+(ECDHE). Moreover the plain Diffie-Hellman key exchange
+requires parameters to be generated and associated with a credentials
+structure by the server (see @ref{Parameter generation}). 
 
 @float Table,tab:prio-special
 @multitable @columnfractions .45 .45
@@ -849,32 +901,35 @@ will allow V1 CAs in chains.
 @subsubheading Client side
 
 To reduce time and roundtrips spent in a handshake the client can   
-utilize session resumption. This requires the client to retrieve and store
-the session parameters. On new sessions to the same server the parameters must
-be re-associated with sessions using @funcref{gnutls_session_set_data}.
+request session resumption from a server that previously shared
+a session with. For that the client has to retrieve and store
+the session parameters. Before establishing a new session to the same 
+server the parameters must be re-associated with the GnuTLS session
+using @funcref{gnutls_session_set_data}.
 
 
@showfuncC{gnutls_session_get_data,gnutls_session_get_id,gnutls_session_set_data}
 
-Keep in mind that sessions might be expired after some time, 
-and it may be normal for a server not to resume a session
-even it was requested.  That is to prevent temporal session keys
-from becoming long-term keys. Also note that as a client you must enable, 
using the
-priority functions, at least the algorithms used in the last session.
+Keep in mind that sessions will be expired after some time, depending
+on the server, and a server may choose not to resume a session
+even when requested to.  The expiration is to prevent temporal session keys
+from becoming long-term keys. Also note that as a client you must enable, 
+using the priority functions, at least the algorithms used in the last session.
 
-It is highly recommended clients to enable the session ticket extension using 
+It is highly recommended for clients to enable the session ticket extension 
using
 @funcref{gnutls_session_ticket_enable_client} in order to allow resumption 
with 
 servers that do not store any state.
 
 @showfuncA{gnutls_session_ticket_enable_client}
 
address@hidden
 
 @subsubheading Server side
 
-In order to support resumption a server might do it either by storing
+In order to support resumption a server can store
 the session security parameters in a local database or by using session
 tickets (see @ref{Session tickets}) to delegate storage to the client. Because
 session tickets might not be supported by all clients, servers
-might combine the two methods.
+could combine the two methods.
 
 A storing server needs to specify callback functions to store, retrieve and 
delete session data. These can be
 registered with the functions below. The stored sessions in the database can 
be checked using @funcref{gnutls_db_check_entry}
@@ -883,13 +938,14 @@ for expiration.
 
@showfuncD{gnutls_db_set_retrieve_function,gnutls_db_set_store_function,gnutls_db_set_ptr,gnutls_db_set_remove_function}
 @showfuncA{gnutls_db_check_entry}
 
-A server utilizing tickets should use
address@hidden to generate a ticket encryption key and
-call @funcref{gnutls_session_ticket_enable_server} to enable the extension.
+A server utilizing tickets should generate ticket encryption
+and authentication keys using @funcref{gnutls_session_ticket_key_generate}.
+Those keys should be associated with the GnuTLS session using
address@hidden
 
address@hidden
address@hidden
 @showfuncdesc{gnutls_session_ticket_key_generate}
-
address@hidden
 
 @node Parameter generation
 @subsection Parameter generation
@@ -913,9 +969,16 @@ of Diffie-Hellman parameters we suggest against performing 
generation
 of them within an application. The @code{certtool} tool can be used to 
 generate or export known safe values that can be stored in code
 or in a configuration file to provide the ability to replace. We also
-recommend the usage of @funcref{gnutls_sec_param_to_pk_bits} (see 
@ref{Selecting cryptographic key sizes}) to determine
+recommend the usage of @funcref{gnutls_sec_param_to_pk_bits} 
+(see @ref{Selecting cryptographic key sizes}) to determine
 the bit size of the generated parameters.
 
+Note that the information stored in the generated PKCS #3 structure
+changed with GnuTLS 3.0.9. Since that version the @code{privateValueLength}
+member of the structure is set, allowing the server utilizing the
+parameters to use keys of the size of the security parameter. This
+provides better performance in key exchange.
+
 The ciphersuites that involve the RSA-EXPORT key exchange require
 additional parameters. Those ciphersuites are rarely used today
 because they are by design insecure, thus if you have no requirement
@@ -948,13 +1011,13 @@ client or server random data first, you can set the
 For example, after establishing a TLS session using
 @funcref{gnutls_handshake}, you can invoke the TLS PRF with this call:
 
address@hidden
address@hidden
 #define MYLABEL "EXPORTER-FOO"
 #define MYCONTEXT "some context data"
 char out[32];
 rc = gnutls_prf (session, strlen (MYLABEL), MYLABEL, 0,
                  strlen (MYCONTEXT), MYCONTEXT, 32, out);
address@hidden smallexample
address@hidden example
 
 If you don't want to mix in the client/server random, there is a more
 low-level TLS PRF interface called @funcref{gnutls_prf_raw}.
@@ -979,7 +1042,7 @@ the @code{tls-unique} channel binding for TLS defined in
 The following example describes how to print the channel binding data.
 Note that it must be run after a successful TLS handshake.
 
address@hidden
address@hidden
 @{
   gnutls_datum_t cb;
   int rc;
@@ -999,7 +1062,7 @@ Note that it must be run after a successful TLS handshake.
       printf ("\n");
     @}
 @}
address@hidden smallexample
address@hidden example
 
 @node Interoperability
 @subsection Interoperability
diff --git a/doc/cha-gtls-examples.texi b/doc/cha-gtls-examples.texi
index 922c796..bd6adb7 100644
--- a/doc/cha-gtls-examples.texi
+++ b/doc/cha-gtls-examples.texi
@@ -4,6 +4,10 @@
 @cindex example programs
 @cindex examples
 
+In this chapter several examples of real-world use cases are listed.
+The examples are simplified to promote readability and contain little or 
+no error checking.  
+
 @menu
 * Client examples::
 * Server examples::
@@ -15,8 +19,7 @@
 @section Client examples
 
 This section contains examples of @acronym{TLS} and @acronym{SSL}
-clients, using @acronym{GnuTLS}.  Note that these examples contain
-little or no error checking.  Some of the examples require functions
+clients, using @acronym{GnuTLS}. Note that some of the examples require 
functions
 implemented by another example.
 
 @menu
@@ -26,11 +29,12 @@ implemented by another example.
 * Obtaining session information::
 * Using a callback to select the certificate to use::
 * Verifying a certificate::
-* Client using a PKCS 11 token with TLS::
+* Client using a smart card with TLS::
 * Client with Resume capability example::
 * Simple client example with SRP authentication::
 * Simple client example in C++::
-* Helper function for TCP connections::
+* Helper functions for TCP connections::
+* Helper functions for UDP connections::
 @end menu
 
 @node Simple client example with anonymous authentication
@@ -40,9 +44,10 @@ The simplest client using TLS is the one that doesn't do any
 authentication.  This means no external certificates or passwords are
 needed to set up the connection.  As could be expected, the connection
 is vulnerable to man-in-the-middle (active or redirection) attacks.
-However, the data is integrity and privacy protected.
+However, the data are integrity protected and encrypted from
+passive eavesdroppers.
 
address@hidden examples/ex-client1.c
address@hidden examples/ex-client-anon.c
 
 @node Simple client example with X.509 certificate support
 @subsection Simple client example with @acronym{X.509} certificate support
@@ -55,16 +60,16 @@ a very simple @acronym{TLS} client, which uses the high 
level verification
 functions for certificates, but does not support session
 resumption. 
 
address@hidden examples/ex-rfc2818.c
address@hidden examples/ex-client-x509.c
 
 @node Simple Datagram TLS client example
 @subsection Simple datagram @acronym{TLS} client example
 
 This is a client that uses @acronym{UDP} to connect to a
-server. This is the @acronym{DTLS} equivalent to the example
-in @ref{Simple client example with X.509 certificate support}.
+server. This is the @acronym{DTLS} equivalent to the TLS example
+with X.509 certificates.
 
address@hidden examples/ex-client-udp.c
address@hidden examples/ex-client-dtls.c
 
 @node Obtaining session information
 @subsection Obtaining session information
@@ -96,12 +101,14 @@ functions to verify a given certificate list.
 
 @verbatiminclude examples/ex-verify.c
 
address@hidden Client using a PKCS 11 token with TLS
address@hidden Using a @acronym{PKCS} #11 token with TLS
address@hidden Client using a smart card with TLS
address@hidden Using a smart card with TLS
 @anchor{ex:pkcs11-client}
address@hidden Smart card example
 
 This example will demonstrate how to load keys and certificates
-from a @acronym{PKCS} #11 token, and use it with a TLS connection.
+from a smart-card or any other @acronym{PKCS} #11 token, and 
+use it in a TLS connection.
 
 @verbatiminclude examples/ex-cert-select-pkcs11.c
 
@@ -136,14 +143,22 @@ the GnuTLS C++ API.
 
 @verbatiminclude examples/ex-cxx.cpp
 
address@hidden Helper function for TCP connections
address@hidden Helper function for TCP connections
address@hidden Helper functions for TCP connections
address@hidden Helper functions for TCP connections
 
-This helper function abstracts away TCP connection handling from the
+Those helper function abstract away TCP connection handling from the
 other examples.  It is required to build some examples.
 
 @verbatiminclude examples/tcp.c
 
address@hidden Helper functions for UDP connections
address@hidden Helper functions for UDP connections
+
+The UDP helper functions abstract away UDP connection handling from the
+other examples.  It is required to build the examples using UDP.
+
address@hidden examples/udp.c
+
 @node Server examples
 @section Server examples
 
@@ -151,21 +166,22 @@ This section contains examples of @acronym{TLS} and 
@acronym{SSL}
 servers, using @acronym{GnuTLS}.
 
 @menu
-* Echo Server with X.509 authentication::
-* Echo Server with OpenPGP authentication::
-* Echo Server with SRP authentication::
-* Echo Server with anonymous authentication::
+* Echo server with X.509 authentication::
+* Echo server with OpenPGP authentication::
+* Echo server with SRP authentication::
+* Echo server with anonymous authentication::
+* DTLS echo server with X.509 authentication::
 @end menu
 
address@hidden Echo Server with X.509 authentication
address@hidden Echo server with X.509 authentication
 @subsection Echo server with @acronym{X.509} authentication
 
 This example is a very simple echo server which supports
address@hidden authentication, using the RSA ciphersuites.
address@hidden authentication.
 
address@hidden examples/ex-serv1.c
address@hidden examples/ex-serv-x509.c
 
address@hidden Echo Server with OpenPGP authentication
address@hidden Echo server with OpenPGP authentication
 @subsection Echo server with @acronym{OpenPGP} authentication
 @cindex OpenPGP server
 
@@ -177,7 +193,7 @@ them to keep these examples as simple as possible.
 
 @verbatiminclude examples/ex-serv-pgp.c
 
address@hidden Echo Server with SRP authentication
address@hidden Echo server with SRP authentication
 @subsection Echo server with @acronym{SRP} authentication
 
 This is a server which supports @acronym{SRP} authentication. It is
@@ -186,10 +202,10 @@ server. Here it is separate for simplicity.
 
 @verbatiminclude examples/ex-serv-srp.c
 
address@hidden Echo Server with anonymous authentication
address@hidden Echo Server with anonymous authentication
address@hidden Echo server with anonymous authentication
address@hidden Echo server with anonymous authentication
 
-This example server support anonymous authentication, and could be
+This example server supports anonymous authentication, and could be
 used to serve the example client for anonymous authentication.
 
 @verbatiminclude examples/ex-serv-anon.c
@@ -216,6 +232,14 @@ A small tool to verify OCSP responses.
 
 @verbatiminclude examples/ex-ocsp-verify.c
 
address@hidden DTLS echo server with X.509 authentication
address@hidden DTLS echo server with @acronym{X.509} authentication
+
+This example is a very simple echo server using Datagram TLS and 
address@hidden authentication.
+
address@hidden examples/ex-serv-dtls.c
+
 @node Miscellaneous examples
 @section Miscellaneous examples
 
diff --git a/doc/cha-internals.texi b/doc/cha-internals.texi
index 81eb8e6..649144e 100644
--- a/doc/cha-internals.texi
+++ b/doc/cha-internals.texi
@@ -117,12 +117,7 @@ together with the extension number they handle, they have 
to be registered
 using @funcintref{_gnutls_ext_register} in
 @code{gnutls_extensions.c} typically within @funcintref{_gnutls_ext_init}.
 
address@hidden
-* Adding a new TLS extension::
address@hidden menu
-
address@hidden Adding a new TLS extension
address@hidden Adding a new TLS extension
address@hidden Adding a new TLS extension
 
 Adding support for a new TLS extension is done from time to time, and
 the process to do so is not difficult.  Here are the steps you need to
@@ -250,7 +245,7 @@ parsing incoming extension data (both in the client and 
server).
 The @funcintref{_foobar_send_params} function is responsible for
 sending extension data (both in the client and server).
 
-If you receive length fields that doesn't match, return
+If you receive length fields that don't match, return
 @address@hidden@address@hidden  If you receive invalid
 data, return @address@hidden@address@hidden  You can use
 other error codes from the list in @ref{Error codes}.  Return 0 on success.
@@ -346,12 +341,12 @@ The TLS layer uses a cryptographic provider layer, that 
will in turn either
 use the default crypto provider -- a software crypto library, or use an 
external
 crypto provider, if available.
 
address@hidden Cryptographic library layer
address@hidden Cryptographic library layer
 The Cryptographic library layer, currently supports only
 libnettle. Other cryptographic libraries might be supported
 in the future.
 
address@hidden External cryptography provider
address@hidden External cryptography provider
 Systems that include a cryptographic co-processor, typically come with
 kernel drivers to utilize the operations from software. For this reason 
 GnuTLS provides a layer where each individual algorithm used can be replaced
diff --git a/doc/cha-intro-tls.texi b/doc/cha-intro-tls.texi
index 5f5f77d..6b1bb72 100644
--- a/doc/cha-intro-tls.texi
+++ b/doc/cha-intro-tls.texi
@@ -271,18 +271,10 @@ warning. Fatal alerts always terminate the current 
connection, and
 prevent future re-negotiations using the current session ID. All alert
 messages are summarized in @ref{tab:alerts}.
 
-
 The alert messages are protected by the record protocol, thus the
 information that is included does not leak. You must take extreme care
 for the alert information not to leak to a possible attacker, via
-public log files etc. The available functions to control the alert
-protocol are shown below.
-
address@hidden
-
address@hidden
-
address@hidden,gnutls_alert_get_name}
+public log files etc. 
 
 @include alerts.texi
 
diff --git a/doc/cha-library.texi b/doc/cha-library.texi
index 1ee6c51..32ac13e 100644
--- a/doc/cha-library.texi
+++ b/doc/cha-library.texi
@@ -1,15 +1,6 @@
 @node Introduction to GnuTLS
 @chapter Introduction to GnuTLS
 
address@hidden
-* GnuTLS introduction::
-* Downloading and installing::
-* Document overview::
address@hidden menu
-
address@hidden GnuTLS introduction
address@hidden Introduction
-
 In brief @acronym{GnuTLS} can be described as a library which offers an API
 to access secure communication protocols. These protocols provide
 privacy over insecure lines, and were designed to prevent
@@ -49,6 +40,11 @@ address@hidden@url{http://www.gnu.org/software/libtasn1/}} 
library.
 The ``Cryptographic back-end'' is provided by the 
address@hidden@url{http://www.lysator.liu.se/~nisse/nettle/}}
 library. 
 
address@hidden
+* Downloading and installing::
+* Document overview::
address@hidden menu
+
 @node Downloading and installing
 @section Downloading and installing
 @cindex installation
diff --git a/doc/cha-programs.texi b/doc/cha-programs.texi
index 2327e85..ece7049 100644
--- a/doc/cha-programs.texi
+++ b/doc/cha-programs.texi
@@ -73,19 +73,14 @@ Usage:  gnutls-cli [options] hostname
      -v, --version            prints the program's version number
 @end example
 
address@hidden
-* Example client PSK connection::
address@hidden menu
-
address@hidden Example client PSK connection
address@hidden Example client PSK connection
address@hidden Example client PSK connection
 @cindex PSK client
 
 To connect to a server using PSK authentication, you need to enable
 the choice of PSK by using a cipher priority parameter such as in the
 example below.
 
address@hidden
address@hidden
 $ ./gnutls-cli -p 5556 localhost --pskusername psk_identity \
   --pskkey 88f3824b3e5659f52d00e959bacab954b6540344 \
   --priority NORMAL:-KX-ALL:+ECDHE-PSK:+DHE-PSK:+PSK
@@ -100,7 +95,7 @@ Connecting to '127.0.0.1:5556'...
 - Handshake was completed
 
 - Simple Client Mode:
address@hidden smallexample
address@hidden example
 
 By keeping the @code{--pskusername} parameter and removing the
 @code{--pskkey} parameter, it will query only for the password during
@@ -164,12 +159,7 @@ Usage: gnutls-serv [options]
      -v, --version            prints the program's version number
 @end example
 
address@hidden
-* Setting up a test HTTPS server::
address@hidden menu
-
address@hidden Setting up a test HTTPS server
address@hidden Setting up a test HTTPS server
address@hidden Setting up a test HTTPS server
 @cindex HTTPS server
 @cindex debug server
 
@@ -179,16 +169,16 @@ use @code{gnutls-serv} as a simple HTTPS server.
 
 The most basic server can be started as:
 
address@hidden
address@hidden
 gnutls-serv --http
address@hidden smallexample
address@hidden example
 
 It will only support anonymous ciphersuites, which many TLS clients
 refuse to use.
 
 The next step is to add support for X.509.  First we generate a CA:
 
address@hidden
address@hidden
 $ certtool --generate-privkey > x509-ca-key.pem
 $ echo 'cn = GnuTLS test CA' > ca.tmpl
 $ echo 'ca' >> ca.tmpl
@@ -196,7 +186,7 @@ $ echo 'cert_signing_key' >> ca.tmpl
 $ certtool --generate-self-signed --load-privkey x509-ca-key.pem \
   --template ca.tmpl --outfile x509-ca.pem
 ...
address@hidden smallexample
address@hidden example
 
 Then generate a server certificate.  Remember to change the dns_name
 value to the name of your server host, or skip that command to avoid
@@ -235,15 +225,15 @@ To be able to import the client key/certificate into some
 applications, you will need to convert them into a PKCS#12 structure.
 This also encrypts the security sensitive key with a password.
 
address@hidden
address@hidden
 $ certtool --to-p12 --load-ca-certificate x509-ca.pem \
   --load-privkey x509-client-key.pem --load-certificate x509-client.pem \
   --outder --outfile x509-client.p12
address@hidden smallexample
address@hidden example
 
 For icing, we'll create a proxy certificate for the client too.
 
address@hidden
address@hidden
 $ certtool --generate-privkey > x509-proxy-key.pem
 $ echo 'cn = GnuTLS test client proxy' > proxy.tmpl
 $ certtool --generate-proxy --load-privkey x509-proxy-key.pem \
@@ -251,16 +241,16 @@ $ certtool --generate-proxy --load-privkey 
x509-proxy-key.pem \
   --load-certificate x509-client.pem --template proxy.tmpl \
   --outfile x509-proxy.pem
 ...
address@hidden smallexample
address@hidden example
 
 Then start the server again:
 
address@hidden
address@hidden
 $ gnutls-serv --http \
             --x509cafile x509-ca.pem \
             --x509keyfile x509-server-key.pem \
             --x509certfile x509-server.pem
address@hidden smallexample
address@hidden example
 
 Try connecting to the server using your web browser.  Note that the
 server listens to port 5556 by default.
@@ -269,62 +259,62 @@ While you are at it, to allow connections using DSA, you 
can also
 create a DSA key and certificate for the server.  These credentials
 will be used in the final example below.
 
address@hidden
address@hidden
 $ certtool --generate-privkey --dsa > x509-server-key-dsa.pem
 $ certtool --generate-certificate --load-privkey x509-server-key-dsa.pem \
   --load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem \
   --template server.tmpl --outfile x509-server-dsa.pem
 ...
address@hidden smallexample
address@hidden example
 
 The next step is to create OpenPGP credentials for the server.
 
address@hidden
address@hidden
 gpg --gen-key
 ...enter whatever details you want, use 'test.gnutls.org' as name...
address@hidden smallexample
address@hidden example
 
 Make a note of the OpenPGP key identifier of the newly generated key,
 here it was @code{5D1D14D8}.  You will need to export the key for
 GnuTLS to be able to use it.
 
address@hidden
address@hidden
 gpg -a --export 5D1D14D8 > openpgp-server.txt
 gpg --export 5D1D14D8 > openpgp-server.bin
 gpg --export-secret-keys 5D1D14D8 > openpgp-server-key.bin
 gpg -a --export-secret-keys 5D1D14D8 > openpgp-server-key.txt
address@hidden smallexample
address@hidden example
 
 Let's start the server with support for OpenPGP credentials:
 
address@hidden
address@hidden
 gnutls-serv --http \
             --pgpkeyfile openpgp-server-key.txt \
             --pgpcertfile openpgp-server.txt
address@hidden smallexample
address@hidden example
 
 The next step is to add support for SRP authentication. This requires
 an SRP password file (see @ref{Invoking srptool}).
 To start the server with SRP support:
 
address@hidden
address@hidden
 gnutls-serv --http \
             --srppasswdconf srp-tpasswd.conf \
             --srppasswd srp-passwd.txt
address@hidden smallexample
address@hidden example
 
 Let's also start a server with support for PSK. This would require
 a password file created with @code{psktool} (see @ref{Invoking psktool}).
 
address@hidden
address@hidden
 gnutls-serv --http \
             --pskpasswd psk-passwd.txt
address@hidden smallexample
address@hidden example
 
 Finally, we start the server with all the earlier parameters and you
 get this command:
 
address@hidden
address@hidden
 gnutls-serv --http \
             --x509cafile x509-ca.pem \
             --x509keyfile x509-server-key.pem \
@@ -336,7 +326,7 @@ gnutls-serv --http \
             --srppasswdconf srp-tpasswd.conf \
             --srppasswd srp-passwd.txt \
             --pskpasswd psk-passwd.txt
address@hidden smallexample
address@hidden example
 
 
 @node The gnutls-cli-debug tool
diff --git a/doc/cha-shared-key.texi b/doc/cha-shared-key.texi
index 50f4585..28405aa 100644
--- a/doc/cha-shared-key.texi
+++ b/doc/cha-shared-key.texi
@@ -1,6 +1,10 @@
 @node Shared-key and anonymous authentication
 @chapter Shared-key and anonymous authentication
 
+In addition to certificate authentication, the TLS protocol may be
+used with password, shared-key and anonymous authentication methods.
+The rest of this chapter discusses details of these methods.
+
 @menu
 * SRP authentication::
 * PSK authentication::
@@ -83,26 +87,26 @@ and @code{tpasswd.conf} which holds generators and primes.
 To create tpasswd.conf which holds the generator and prime values for
 the @acronym{SRP} protocol, run:
 
address@hidden
address@hidden
 $ srptool --create-conf /etc/tpasswd.conf
address@hidden smallexample
address@hidden example
 
 This command will create /etc/tpasswd and will add user 'test' (you
 will also be prompted for a password).  Verifiers are stored in a way that
 is compatible with libsrp.
 
address@hidden
address@hidden
 $ srptool --passwd /etc/tpasswd \
     --passwd-conf /etc/tpasswd.conf -u test
address@hidden smallexample
address@hidden example
 
 This command will check against a password.  If the password matches
 the one in /etc/tpasswd you will get an ok.
 
address@hidden
address@hidden
 $ srptool --passwd /etc/tpasswd \
     --passwd-conf /etc/tpasswd.conf --verify -u test
address@hidden smallexample
address@hidden example
 
 @node PSK authentication
 @section PSK authentication
@@ -153,7 +157,7 @@ This is a program to manage @acronym{PSK} username and keys.
 It will generate random keys for the indicated username, 
 using a simple password file format.
 
address@hidden
address@hidden
 PSKtool help
 Usage : psktool [options]
      -u, --username username
@@ -162,19 +166,19 @@ Usage : psktool [options]
      -s, --keysize SIZE       specify the key size in bytes.
      -v, --version            prints the program's version number
      -h, --help               shows this help text
address@hidden smallexample
address@hidden example
 
 The generation of a PSK password file is illustrated in the example below. 
 The password is provided in the prompt.
 
address@hidden
address@hidden
 $ ./psktool -u psk_identity -p psks.txt
 Generating a random key for user 'psk_identity'
 Key stored to psks.txt
 $ cat psks.txt
 psk_identity:88f3824b3e5659f52d00e959bacab954b6540344
 $
address@hidden smallexample
address@hidden example
 
 @node Anonymous authentication
 @section Anonymous authentication
diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
index 4f57353..56e57fa 100644
--- a/doc/examples/Makefile.am
+++ b/doc/examples/Makefile.am
@@ -40,11 +40,11 @@ LDADD = libexamples.la                              \
 CXX_LDADD = $(LDADD) \
        ../../lib/libgnutlsxx.la
 
-noinst_PROGRAMS = ex-client-resume ex-client-udp
-noinst_PROGRAMS += ex-cert-select ex-rfc2818
+noinst_PROGRAMS = ex-client-resume ex-client-dtls
+noinst_PROGRAMS += ex-cert-select ex-client-x509
 
 if ENABLE_PKI
-noinst_PROGRAMS += ex-crq ex-serv1
+noinst_PROGRAMS += ex-crq ex-serv-x509 ex-serv-dtls
 endif
 
 if ENABLE_CXX
@@ -54,7 +54,7 @@ noinst_PROGRAMS += ex-cxx
 endif
 
 if ENABLE_ANON
-noinst_PROGRAMS += ex-client1 ex-serv-anon
+noinst_PROGRAMS += ex-client-anon ex-serv-anon
 endif
 
 if ENABLE_OPENPGP
diff --git a/doc/examples/ex-client1.c b/doc/examples/ex-client-anon.c
similarity index 95%
rename from doc/examples/ex-client1.c
rename to doc/examples/ex-client-anon.c
index 322e400..8c06bda 100644
--- a/doc/examples/ex-client1.c
+++ b/doc/examples/ex-client-anon.c
@@ -55,7 +55,11 @@ main (void)
 
   /* Perform the TLS handshake
    */
-  ret = gnutls_handshake (session);
+  do
+    {
+      ret = gnutls_handshake (session);
+    }
+  while (gnutls_error_is_fatal (ret) == 0);
 
   if (ret < 0)
     {
diff --git a/doc/examples/ex-client-udp.c b/doc/examples/ex-client-dtls.c
similarity index 92%
rename from doc/examples/ex-client-udp.c
rename to doc/examples/ex-client-dtls.c
index 7a0721a..222762a 100644
--- a/doc/examples/ex-client-udp.c
+++ b/doc/examples/ex-client-dtls.c
@@ -59,6 +59,8 @@ main (void)
 
   /* put the x509 credentials to the current session */
   gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred);
+  gnutls_server_name_set (session, GNUTLS_NAME_DNS, "my_host_name", 
+                          strlen("my_host_name"));
 
   /* connect to the peer */
   sd = udp_connect ();
@@ -69,7 +71,11 @@ main (void)
   gnutls_dtls_set_mtu (session, 1000);
 
   /* Perform the TLS handshake */
-  ret = gnutls_handshake (session);
+  do
+    {
+      ret = gnutls_handshake (session);
+    }
+  while (gnutls_error_is_fatal (ret) == 0);
 
   if (ret < 0)
     {
diff --git a/doc/examples/ex-client-psk.c b/doc/examples/ex-client-psk.c
index 2264f07..7c0bd7e 100644
--- a/doc/examples/ex-client-psk.c
+++ b/doc/examples/ex-client-psk.c
@@ -65,7 +65,11 @@ main (void)
 
   /* Perform the TLS handshake
    */
-  ret = gnutls_handshake (session);
+  do
+    {
+      ret = gnutls_handshake (session);
+    }
+  while (gnutls_error_is_fatal (ret) == 0);
 
   if (ret < 0)
     {
diff --git a/doc/examples/ex-client-resume.c b/doc/examples/ex-client-resume.c
index 9e6e9b6..5aeae58 100644
--- a/doc/examples/ex-client-resume.c
+++ b/doc/examples/ex-client-resume.c
@@ -63,7 +63,11 @@ main (void)
 
       /* Perform the TLS handshake
        */
-      ret = gnutls_handshake (session);
+      do
+        {
+          ret = gnutls_handshake (session);
+        }
+      while (gnutls_error_is_fatal (ret) == 0);
 
       if (ret < 0)
         {
diff --git a/doc/examples/ex-client-srp.c b/doc/examples/ex-client-srp.c
index b8ecc2b..5a753ab 100644
--- a/doc/examples/ex-client-srp.c
+++ b/doc/examples/ex-client-srp.c
@@ -62,7 +62,11 @@ main (void)
 
   /* Perform the TLS handshake
    */
-  ret = gnutls_handshake (session);
+  do
+    {
+      ret = gnutls_handshake (session);
+    }
+  while (gnutls_error_is_fatal (ret) == 0);
 
   if (ret < 0)
     {
diff --git a/doc/examples/ex-rfc2818.c b/doc/examples/ex-client-x509.c
similarity index 97%
rename from doc/examples/ex-rfc2818.c
rename to doc/examples/ex-client-x509.c
index f7aa08d..c82df65 100644
--- a/doc/examples/ex-rfc2818.c
+++ b/doc/examples/ex-client-x509.c
@@ -46,6 +46,8 @@ int main (void)
   gnutls_init (&session, GNUTLS_CLIENT);
 
   gnutls_session_set_ptr (session, (void *) "my_host_name");
+  gnutls_server_name_set (session, GNUTLS_NAME_DNS, "my_host_name", 
+                          strlen("my_host_name"));
 
   /* Use default priorities */
   ret = gnutls_priority_set_direct (session, "NORMAL", &err);
diff --git a/doc/examples/ex-serv-anon.c b/doc/examples/ex-serv-anon.c
index ade01f4..93c8a70 100644
--- a/doc/examples/ex-serv-anon.c
+++ b/doc/examples/ex-serv-anon.c
@@ -116,7 +116,13 @@ main (void)
                          sizeof (topbuf)), ntohs (sa_cli.sin_port));
 
       gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
-      ret = gnutls_handshake (session);
+
+      do
+        {
+          ret = gnutls_handshake (session);
+        }
+      while (gnutls_error_is_fatal (ret) == 0);
+
       if (ret < 0)
         {
           close (sd);
diff --git a/doc/examples/ex-serv-dtls.c b/doc/examples/ex-serv-dtls.c
new file mode 100644
index 0000000..355f7b9
--- /dev/null
+++ b/doc/examples/ex-serv-dtls.c
@@ -0,0 +1,433 @@
+/* This example code is placed in the public domain. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <sys/select.h>
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+#include <gnutls/gnutls.h>
+#include <gnutls/dtls.h>
+
+#define KEYFILE "key.pem"
+#define CERTFILE "cert.pem"
+#define CAFILE "ca.pem"
+#define CRLFILE "crl.pem"
+
+/* This is a sample DTLS echo server, using X.509 authentication.
+ * Note that error checking is minimal to simplify the example.
+ */
+
+#define MAX_BUFFER 1024
+#define PORT 5556
+
+typedef struct
+{
+  gnutls_session_t session;
+  int fd;
+  struct sockaddr *cli_addr;
+  socklen_t cli_addr_size;
+} priv_data_st;
+
+static int pull_timeout_func (gnutls_transport_ptr_t ptr, unsigned int ms);
+static ssize_t push_func (gnutls_transport_ptr_t p, const void *data,
+                          size_t size);
+static ssize_t pull_func (gnutls_transport_ptr_t p, void *data, size_t size);
+static const char *human_addr (const struct sockaddr *sa, socklen_t salen,
+                               char *buf, size_t buflen);
+static int wait_for_connection (int fd);
+static gnutls_session_t initialize_tls_session (void);
+static int generate_dh_params (void);
+
+/* Use global credentials and parameters to simplify
+ * the example. */
+static gnutls_certificate_credentials_t x509_cred;
+static gnutls_priority_t priority_cache;
+static gnutls_dh_params_t dh_params;
+
+int
+main (void)
+{
+  int listen_sd;
+  int sock, ret;
+  struct sockaddr_in sa_serv;
+  struct sockaddr_in cli_addr;
+  socklen_t cli_addr_size;
+  gnutls_session_t session;
+  char buffer[MAX_BUFFER];
+  priv_data_st priv;
+  gnutls_datum_t cookie_key;
+  gnutls_dtls_prestate_st prestate;
+  int mtu = 1400;
+  unsigned char sequence[8];
+
+  /* this must be called once in the program
+   */
+  gnutls_global_init ();
+
+  gnutls_certificate_allocate_credentials (&x509_cred);
+  gnutls_certificate_set_x509_trust_file (x509_cred, CAFILE,
+                                          GNUTLS_X509_FMT_PEM);
+
+  gnutls_certificate_set_x509_crl_file (x509_cred, CRLFILE,
+                                        GNUTLS_X509_FMT_PEM);
+
+  ret = gnutls_certificate_set_x509_key_file (x509_cred, CERTFILE, KEYFILE,
+                                        GNUTLS_X509_FMT_PEM);
+  if (ret < 0)
+    {
+      printf("No certificate or key were found\n");
+      exit(1);
+    }
+
+  generate_dh_params ();
+
+  gnutls_certificate_set_dh_params (x509_cred, dh_params);
+
+  gnutls_priority_init (&priority_cache,
+                        
"PERFORMANCE:-VERS-TLS-ALL:+VERS-DTLS1.0:%SERVER_PRECEDENCE", 
+                        NULL);
+
+  gnutls_key_generate (&cookie_key, GNUTLS_COOKIE_KEY_SIZE);
+
+  /* Socket operations
+   */
+  listen_sd = socket (AF_INET, SOCK_DGRAM, 0);
+
+  memset (&sa_serv, '\0', sizeof (sa_serv));
+  sa_serv.sin_family = AF_INET;
+  sa_serv.sin_addr.s_addr = INADDR_ANY;
+  sa_serv.sin_port = htons (PORT);
+
+  { /* DTLS requires the IP don't fragment (DF) bit to be set */
+#if defined(IP_DONTFRAG)
+    int optval = 1;
+    setsockopt (listen_sd, IPPROTO_IP, IP_DONTFRAG,
+                (const void *) &optval, sizeof (optval));
+#elif defined(IP_MTU_DISCOVER)
+    int optval = IP_PMTUDISC_DO;
+    setsockopt(listen_sd, IPPROTO_IP, IP_MTU_DISCOVER, 
+               (const void*) &optval, sizeof (optval));
+#endif
+  }
+
+  bind (listen_sd, (struct sockaddr *) &sa_serv, sizeof (sa_serv));
+
+  printf ("UDP server ready. Listening to port '%d'.\n\n", PORT);
+
+  for (;;)
+    {
+      printf ("Waiting for connection...\n");
+      sock = wait_for_connection (listen_sd);
+      if (sock < 0)
+        continue;
+
+      cli_addr_size = sizeof (cli_addr);
+      ret = recvfrom (sock, buffer, sizeof (buffer), MSG_PEEK,
+                      (struct sockaddr *) &cli_addr, &cli_addr_size);
+      if (ret > 0)
+        {
+          memset (&prestate, 0, sizeof (prestate));
+          ret = gnutls_dtls_cookie_verify (&cookie_key, &cli_addr,
+                                           sizeof (cli_addr), buffer, ret,
+                                           &prestate);
+          if (ret < 0)          /* cookie not valid */
+            {
+              priv_data_st s;
+
+              memset (&s, 0, sizeof (s));
+              s.fd = sock;
+              s.cli_addr = (void *) &cli_addr;
+              s.cli_addr_size = sizeof (cli_addr);
+
+              printf ("Sending hello verify request to %s\n",
+                      human_addr ((struct sockaddr *) &cli_addr,
+                                  sizeof (cli_addr), buffer,
+                                  sizeof (buffer)));
+
+              gnutls_dtls_cookie_send (&cookie_key, &cli_addr,
+                                       sizeof (cli_addr), &prestate,
+                                       (gnutls_transport_ptr_t) & s,
+                                       push_func);
+
+              /* discard peeked data */
+              recvfrom (sock, buffer, sizeof (buffer), 0,
+                        (struct sockaddr *) &cli_addr, &cli_addr_size);
+              usleep (100);
+              continue;
+            }
+          printf ("Accepted connection from %s\n",
+                  human_addr ((struct sockaddr *)
+                              &cli_addr, sizeof (cli_addr), buffer,
+                              sizeof (buffer)));
+        }
+      else
+        continue;
+
+      session = initialize_tls_session ();
+      gnutls_dtls_prestate_set (session, &prestate);
+      gnutls_dtls_set_mtu (session, mtu);
+
+      priv.session = session;
+      priv.fd = sock;
+      priv.cli_addr = (struct sockaddr *) &cli_addr;
+      priv.cli_addr_size = sizeof (cli_addr);
+
+      gnutls_transport_set_ptr (session, &priv);
+      gnutls_transport_set_push_function (session, push_func);
+      gnutls_transport_set_pull_function (session, pull_func);
+      gnutls_transport_set_pull_timeout_function (session, pull_timeout_func);
+
+      do
+        {
+          ret = gnutls_handshake (session);
+        }
+      while (gnutls_error_is_fatal (ret) == 0);
+
+      if (ret < 0)
+        {
+          fprintf (stderr, "Error in handshake(): %s\n",
+                   gnutls_strerror (ret));
+          gnutls_deinit (session);
+          continue;
+        }
+
+      printf ("- Handshake was completed\n");
+
+      for (;;)
+        {
+          do
+            {
+              ret = gnutls_record_recv_seq (session, buffer, MAX_BUFFER,
+                                            sequence);
+            }
+          while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
+
+          if (ret < 0)
+            {
+              fprintf (stderr, "Error in recv(): %s\n",
+                       gnutls_strerror (ret));
+              break;
+            }
+          if (ret == 0)
+            {
+              printf ("EOF\n\n");
+              break;
+            }
+          buffer[ret] = 0;
+          printf ("received[%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x]: %s\n",
+                  sequence[0], sequence[1], sequence[2], sequence[3],
+                  sequence[4], sequence[5], sequence[6], sequence[7], buffer);
+
+          /* reply back */
+          ret = gnutls_record_send (session, buffer, ret);
+          if (ret < 0)
+            {
+              fprintf (stderr, "Error in send(): %s\n",
+                       gnutls_strerror (ret));
+              break;
+            }
+        }
+
+      gnutls_bye (session, GNUTLS_SHUT_WR);
+      gnutls_deinit (session);
+
+    }
+  close (listen_sd);
+
+  gnutls_certificate_free_credentials (x509_cred);
+  gnutls_priority_deinit (priority_cache);
+
+  gnutls_global_deinit ();
+
+  return 0;
+
+}
+
+static int
+wait_for_connection (int fd)
+{
+  fd_set rd, wr;
+  int n;
+
+  FD_ZERO (&rd);
+  FD_ZERO (&wr);
+
+  FD_SET (fd, &rd);
+
+  /* waiting part */
+  n = select (fd + 1, &rd, &wr, NULL, NULL);
+  if (n == -1 && errno == EINTR)
+    return -1;
+  if (n < 0)
+    {
+      perror ("select()");
+      exit (1);
+    }
+
+  return fd;
+}
+
+/* Wait for data to be received within a timeout period in milliseconds
+ */
+static int
+pull_timeout_func (gnutls_transport_ptr_t ptr, unsigned int ms)
+{
+  fd_set rfds;
+  struct timeval tv;
+  priv_data_st *priv = ptr;
+  struct sockaddr_in cli_addr;
+  socklen_t cli_addr_size;
+  int ret;
+  char c;
+
+  FD_ZERO (&rfds);
+  FD_SET (priv->fd, &rfds);
+
+  tv.tv_sec = 0;
+  tv.tv_usec = ms * 1000;
+
+  ret = select (priv->fd + 1, &rfds, NULL, NULL, &tv);
+
+  if (ret <= 0)
+    return ret;
+
+  /* only report ok if the next message is from the peer we expect
+   * from 
+   */
+  cli_addr_size = sizeof (cli_addr);
+  ret =
+    recvfrom (priv->fd, &c, 1, MSG_PEEK, (struct sockaddr *) &cli_addr,
+              &cli_addr_size);
+  if (ret > 0)
+    {
+      if (cli_addr_size == priv->cli_addr_size
+          && memcmp (&cli_addr, priv->cli_addr, sizeof (cli_addr)) == 0)
+        return 1;
+    }
+
+  return 0;
+}
+
+static ssize_t
+push_func (gnutls_transport_ptr_t p, const void *data, size_t size)
+{
+  priv_data_st *priv = p;
+
+  return sendto (priv->fd, data, size, 0, priv->cli_addr,
+                 priv->cli_addr_size);
+}
+
+static ssize_t
+pull_func (gnutls_transport_ptr_t p, void *data, size_t size)
+{
+  priv_data_st *priv = p;
+  struct sockaddr_in cli_addr;
+  socklen_t cli_addr_size;
+  char buffer[64];
+  int ret;
+
+  cli_addr_size = sizeof (cli_addr);
+  ret =
+    recvfrom (priv->fd, data, size, 0, (struct sockaddr *) &cli_addr,
+              &cli_addr_size);
+  if (ret == -1)
+    return ret;
+
+  if (cli_addr_size == priv->cli_addr_size
+      && memcmp (&cli_addr, priv->cli_addr, sizeof (cli_addr)) == 0)
+    return ret;
+
+  printf ("Denied connection from %s\n",
+          human_addr ((struct sockaddr *)
+                      &cli_addr, sizeof (cli_addr), buffer, sizeof (buffer)));
+
+  gnutls_transport_set_errno (priv->session, EAGAIN);
+  return -1;
+}
+
+static const char *
+human_addr (const struct sockaddr *sa, socklen_t salen,
+            char *buf, size_t buflen)
+{
+  const char *save_buf = buf;
+  size_t l;
+
+  if (!buf || !buflen)
+    return NULL;
+
+  *buf = '\0';
+
+  switch (sa->sa_family)
+    {
+#if HAVE_IPV6
+    case AF_INET6:
+      snprintf (buf, buflen, "IPv6 ");
+      break;
+#endif
+
+    case AF_INET:
+      snprintf (buf, buflen, "IPv4 ");
+      break;
+    }
+
+  l = strlen (buf);
+  buf += l;
+  buflen -= l;
+
+  if (getnameinfo (sa, salen, buf, buflen, NULL, 0, NI_NUMERICHOST) != 0)
+    return NULL;
+
+  l = strlen (buf);
+  buf += l;
+  buflen -= l;
+
+  strncat (buf, " port ", buflen);
+
+  l = strlen (buf);
+  buf += l;
+  buflen -= l;
+
+  if (getnameinfo (sa, salen, NULL, 0, buf, buflen, NI_NUMERICSERV) != 0)
+    return NULL;
+
+  return save_buf;
+}
+
+static gnutls_session_t
+initialize_tls_session (void)
+{
+  gnutls_session_t session;
+
+  gnutls_init (&session, GNUTLS_SERVER | GNUTLS_DATAGRAM);
+
+  gnutls_priority_set (session, priority_cache);
+
+  gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, x509_cred);
+
+  return session;
+}
+
+static int
+generate_dh_params (void)
+{
+  int bits = gnutls_sec_param_to_pk_bits (GNUTLS_PK_DH, GNUTLS_SEC_PARAM_LOW);
+
+  /* Generate Diffie-Hellman parameters - for use with DHE
+   * kx algorithms. When short bit length is used, it might
+   * be wise to regenerate parameters often.
+   */
+  gnutls_dh_params_init (&dh_params);
+  gnutls_dh_params_generate2 (dh_params, bits);
+
+  return 0;
+}
diff --git a/doc/examples/ex-serv-srp.c b/doc/examples/ex-serv-srp.c
index 5dbd8cf..0cff30c 100644
--- a/doc/examples/ex-serv-srp.c
+++ b/doc/examples/ex-serv-srp.c
@@ -117,7 +117,13 @@ main (void)
                          sizeof (topbuf)), ntohs (sa_cli.sin_port));
 
       gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
-      ret = gnutls_handshake (session);
+
+      do
+        {
+          ret = gnutls_handshake (session);
+        }
+      while (gnutls_error_is_fatal (ret) == 0);
+
       if (ret < 0)
         {
           close (sd);
diff --git a/doc/examples/ex-serv1.c b/doc/examples/ex-serv-x509.c
similarity index 80%
rename from doc/examples/ex-serv1.c
rename to doc/examples/ex-serv-x509.c
index 7166657..5383fb3 100644
--- a/doc/examples/ex-serv1.c
+++ b/doc/examples/ex-serv-x509.c
@@ -23,12 +23,8 @@
 /* This is a sample TLS 1.0 echo server, using X.509 authentication.
  */
 
-
-#define SA struct sockaddr
-#define SOCKET_ERR(err,s) if(err==-1) {perror(s);return(1);}
 #define MAX_BUF 1024
 #define PORT 5556               /* listen to 5556 port */
-#define DH_BITS 1024
 
 /* These are global */
 gnutls_certificate_credentials_t x509_cred;
@@ -45,14 +41,10 @@ initialize_tls_session (void)
 
   gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, x509_cred);
 
-  /* request client certificate if any.
-   */
-  gnutls_certificate_server_set_request (session, GNUTLS_CERT_REQUEST);
-
-  /* Set maximum compatibility mode. This is only suggested on public 
webservers
-   * that need to trade security for compatibility
+  /* We don't request any certificate from the client.
+   * If we did we would need to verify it.
    */
-  gnutls_session_enable_compatibility_mode (session);
+  gnutls_certificate_server_set_request (session, GNUTLS_CERT_IGNORE);
 
   return session;
 }
@@ -62,16 +54,14 @@ static gnutls_dh_params_t dh_params;
 static int
 generate_dh_params (void)
 {
+  int bits = gnutls_sec_param_to_pk_bits (GNUTLS_PK_DH, GNUTLS_SEC_PARAM_LOW);
 
   /* Generate Diffie-Hellman parameters - for use with DHE
    * kx algorithms. When short bit length is used, it might
-   * be wise to regenerate parameters.
-   *
-   * Check the ex-serv-export.c example for using static
-   * parameters.
+   * be wise to regenerate parameters often.
    */
   gnutls_dh_params_init (&dh_params);
-  gnutls_dh_params_generate2 (dh_params, DH_BITS);
+  gnutls_dh_params_generate2 (dh_params, bits);
 
   return 0;
 }
@@ -79,7 +69,7 @@ generate_dh_params (void)
 int
 main (void)
 {
-  int err, listen_sd;
+  int listen_sd;
   int sd, ret;
   struct sockaddr_in sa_serv;
   struct sockaddr_in sa_cli;
@@ -100,12 +90,17 @@ main (void)
   gnutls_certificate_set_x509_crl_file (x509_cred, CRLFILE,
                                         GNUTLS_X509_FMT_PEM);
 
-  gnutls_certificate_set_x509_key_file (x509_cred, CERTFILE, KEYFILE,
+  ret = gnutls_certificate_set_x509_key_file (x509_cred, CERTFILE, KEYFILE,
                                         GNUTLS_X509_FMT_PEM);
+  if (ret < 0)
+    {
+      printf("No certificate or key were found\n");
+      exit(1);
+    }
 
   generate_dh_params ();
 
-  gnutls_priority_init (&priority_cache, "NORMAL", NULL);
+  gnutls_priority_init (&priority_cache, "PERFORMANCE:%SERVER_PRECEDENCE", 
NULL);
 
 
   gnutls_certificate_set_dh_params (x509_cred, dh_params);
@@ -113,7 +108,6 @@ main (void)
   /* Socket operations
    */
   listen_sd = socket (AF_INET, SOCK_STREAM, 0);
-  SOCKET_ERR (listen_sd, "socket");
 
   memset (&sa_serv, '\0', sizeof (sa_serv));
   sa_serv.sin_family = AF_INET;
@@ -123,10 +117,9 @@ main (void)
   setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval,
               sizeof (int));
 
-  err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv));
-  SOCKET_ERR (err, "bind");
-  err = listen (listen_sd, 1024);
-  SOCKET_ERR (err, "listen");
+  bind (listen_sd, (struct sockaddr *) & sa_serv, sizeof (sa_serv));
+
+  listen (listen_sd, 1024);
 
   printf ("Server ready. Listening to port '%d'.\n\n", PORT);
 
@@ -135,14 +128,20 @@ main (void)
     {
       session = initialize_tls_session ();
 
-      sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
+      sd = accept (listen_sd, (struct sockaddr *) & sa_cli, &client_len);
 
       printf ("- connection from %s, port %d\n",
               inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
                          sizeof (topbuf)), ntohs (sa_cli.sin_port));
 
       gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
-      ret = gnutls_handshake (session);
+
+      do
+        {
+          ret = gnutls_handshake (session);
+        }
+      while (gnutls_error_is_fatal (ret) == 0);
+
       if (ret < 0)
         {
           close (sd);
diff --git a/doc/examples/udp.c b/doc/examples/udp.c
index 3eb567a..0c48ac1 100644
--- a/doc/examples/udp.c
+++ b/doc/examples/udp.c
@@ -13,9 +13,7 @@
 #include <netinet/in.h>
 #include <unistd.h>
 
-#define SA struct sockaddr
-
-/* tcp.c */
+/* udp.c */
 int udp_connect (void);
 void udp_close (int sd);
 
@@ -27,7 +25,7 @@ udp_connect (void)
 {
   const char *PORT = "5557";
   const char *SERVER = "127.0.0.1";
-  int err, sd;
+  int err, sd, optval;
   struct sockaddr_in sa;
 
   /* connects to server
@@ -39,7 +37,17 @@ udp_connect (void)
   sa.sin_port = htons (atoi (PORT));
   inet_pton (AF_INET, SERVER, &sa.sin_addr);
 
-  err = connect (sd, (SA *) & sa, sizeof (sa));
+#if defined(IP_DONTFRAG)
+  optval = 1;
+  setsockopt (sd, IPPROTO_IP, IP_DONTFRAG,
+              (const void *) &optval, sizeof (optval));
+#elif defined(IP_MTU_DISCOVER)
+  optval = IP_PMTUDISC_DO;
+  setsockopt(sd, IPPROTO_IP, IP_MTU_DISCOVER, 
+             (const void*) &optval, sizeof (optval));
+#endif
+
+  err = connect (sd, (struct sockaddr *) & sa, sizeof (sa));
   if (err < 0)
     {
       fprintf (stderr, "Connect error\n");
diff --git a/doc/gnutls.texi b/doc/gnutls.texi
index 2f8164b..e538d09 100644
--- a/doc/gnutls.texi
+++ b/doc/gnutls.texi
@@ -158,7 +158,7 @@ Documentation License''.
 * Support::
 * Error codes::
 * API reference::
-* Supported ciphersuites in GnuTLS::
+* Supported ciphersuites::
 * Copying Information::
 * Concept Index::
 * Function and Data Index::
diff --git a/doc/latex/.gitignore b/doc/latex/.gitignore
index ab0ce42..dbc59cd 100644
--- a/doc/latex/.gitignore
+++ b/doc/latex/.gitignore
@@ -11,7 +11,6 @@ gnutls.toc
 missfont.log
 extra-api.tex
 gnutls-api.tex
-cover.tex
 error_codes.tex
 cha-tls-app.tex
 cha-support.tex
diff --git a/doc/latex/cover-epub.tex b/doc/latex/cover.tex
similarity index 76%
copy from doc/latex/cover-epub.tex
copy to doc/latex/cover.tex
index 43a9efb..b0d6d84 100644
--- a/doc/latex/cover-epub.tex
+++ b/doc/latex/cover.tex
@@ -1,28 +1,10 @@
 \thispagestyle{empty}
-
-\vspace*{\stretch{2}}
-\begin{center}
-\huge{The GnuTLS manual}
-\vspace*{\stretch{2}}
-\end{center}
-
-%\newpage
-%\vspace*{\stretch{2}}
-%\begin{center}
-%\includegraphics[width=6cm]{../gnutls-logo}
-%\end{center}
-
-%\vspace*{\stretch{2}}
-
-\newpage
-
-\thispagestyle{empty}
 \vspace*{\stretch{2}}
 
 
-\begin{flushleft}
+\begin{quotation}
 Copyright \copyright{} 2011 Free Software Foundation, Inc.
-\end{flushleft}
+\end{quotation}
 
 \begin{flushleft}
 Permission is granted to copy, distribute and/or modify this document
@@ -33,3 +15,12 @@ copy of the license is included in the section entitled 
``GNU Free
 Documentation License''.
 \end{flushleft}
 
+\newpage
+\thispagestyle{empty}
+
+\vspace*{\stretch{2}}
+\begin{center}
+\includegraphics[width=6cm]{../gnutls-logo.pdf}
+\end{center}
+
+\vspace*{\stretch{2}}
diff --git a/doc/latex/gnutls.bib b/doc/latex/gnutls.bib
index a0c9f63..1eac296 100644
--- a/doc/latex/gnutls.bib
+++ b/doc/latex/gnutls.bib
@@ -7,6 +7,15 @@
        url = "http://www.ietf.org/rfc/rfc2246.txt";
 }
 
address@hidden RFC4514,
+       author = "Kurt D.  Zeilenga",
+       title = "{Lightweight Directory Access Protocol (LDAP): String 
Representation of Distinguished Names}",
+       month = "June",
+       year = "2006",
+       note = "Available from \url{http://www.ietf.org/rfc/rfc4514.txt}";,
+       url = "http://www.ietf.org/rfc/rfc4514.txt";
+}
+
 @misc{RFC3820,
   author="Steven Tuecke and Von Welch and Doug Engert and Laura Pearlman and 
Mary Thompson", 
   title="Internet {X.509} Public Key Infrastructure {(PKI)} Proxy Certificate 
Profile", 
diff --git a/doc/manpages/Makefile.am b/doc/manpages/Makefile.am
index a804745..8aeaf35 100644
--- a/doc/manpages/Makefile.am
+++ b/doc/manpages/Makefile.am
@@ -298,6 +298,7 @@ APIMANS += gnutls_session_set_ptr.3
 APIMANS += gnutls_session_get_ptr.3
 APIMANS += gnutls_openpgp_send_cert.3
 APIMANS += gnutls_fingerprint.3
+APIMANS += gnutls_random_art.3
 APIMANS += gnutls_srp_free_client_credentials.3
 APIMANS += gnutls_srp_allocate_client_credentials.3
 APIMANS += gnutls_srp_set_client_credentials.3
diff --git a/extra/includes/gnutls/openssl.h b/extra/includes/gnutls/openssl.h
index 86ae199..d176c15 100644
--- a/extra/includes/gnutls/openssl.h
+++ b/extra/includes/gnutls/openssl.h
@@ -92,6 +92,8 @@ extern "C"
 #define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER (0x2)
 #define SSL_MODE_AUTO_RETRY (0x4)
 
+#undef X509_NAME
+#undef X509
   typedef gnutls_x509_dn X509_NAME;
   typedef gnutls_datum_t X509;
 
diff --git a/gl/Makefile.am b/gl/Makefile.am
index e5e0b6a..ed4c9fd 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2011 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 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
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override 
--lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc 
--tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests 
--avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl 
--no-vc-files accept alloca alphasort argp bind byteswap c-ctype close connect 
error extensions func getpass getsubopt gettext gettime havelib inet_ntop 
inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile 
manywarnings memmem-simple minmax netdb netinet_in pmccabe2html progname 
read-file recv recvfrom scandir select send sendto setsockopt shutdown snprintf 
socket sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r 
timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf 
vfprintf-posix vprintf-posix vsnprintf warnings
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override 
--lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc 
--tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests 
--avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl 
--no-vc-files accept alloca alphasort argp bind byteswap c-ctype close connect 
error extensions freeaddrinfo func getaddrinfo getnameinfo getpass getsubopt 
gettext gettime havelib inet_ntop inet_pton lib-msvc-compat lib-symbol-versions 
listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in 
pmccabe2html progname read-file recv recvfrom scandir select send sendto 
setsockopt shutdown snprintf socket sockets socklen stdint strcase strverscmp 
sys_socket sys_stat time_r timespec u64 unistd usleep valgrind-tests vasprintf 
version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
@@ -51,12 +51,15 @@ libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
 EXTRA_libgnu_la_SOURCES =
 libgnu_la_LDFLAGS = $(AM_LDFLAGS)
 libgnu_la_LDFLAGS += -no-undefined
+libgnu_la_LDFLAGS += $(GETADDRINFO_LIB)
+libgnu_la_LDFLAGS += $(HOSTENT_LIB)
 libgnu_la_LDFLAGS += $(INET_NTOP_LIB)
 libgnu_la_LDFLAGS += $(INET_PTON_LIB)
 libgnu_la_LDFLAGS += $(LIBSOCKET)
 libgnu_la_LDFLAGS += $(LIB_CLOCK_GETTIME)
 libgnu_la_LDFLAGS += $(LIB_SELECT)
 libgnu_la_LDFLAGS += $(LTLIBINTL)
+libgnu_la_LDFLAGS += $(SERVENT_LIB)
 
 ## begin gnulib module accept
 
@@ -450,6 +453,15 @@ EXTRA_libgnu_la_SOURCES += ftello.c
 
 ## end   gnulib module ftello
 
+## begin gnulib module getaddrinfo
+
+
+EXTRA_DIST += gai_strerror.c getaddrinfo.c
+
+EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c
+
+## end   gnulib module getaddrinfo
+
 ## begin gnulib module getdelim
 
 
@@ -1598,6 +1610,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -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' \
@@ -1625,6 +1638,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -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' \
@@ -1642,6 +1656,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -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' \
@@ -2226,6 +2241,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -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_ISATTY''@/$(GNULIB_ISATTY)/g' \
              -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \
              -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \
              -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \
@@ -2238,11 +2254,12 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \
              -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \
              -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \
+             -e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/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''@/$(GNULIB_UNISTD_H_GETOPT)/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' \
@@ -2275,6 +2292,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
+             -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
              -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
              -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
@@ -2287,6 +2305,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -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_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|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' \
@@ -2301,6 +2320,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -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_ISATTY''@|$(REPLACE_ISATTY)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
              -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
@@ -2337,6 +2357,15 @@ EXTRA_DIST += 
$(top_srcdir)/build-aux/useless-if-before-free
 
 ## end   gnulib module useless-if-before-free
 
+## begin gnulib module usleep
+
+
+EXTRA_DIST += usleep.c
+
+EXTRA_libgnu_la_SOURCES += usleep.c
+
+## end   gnulib module usleep
+
 ## begin gnulib module vasnprintf
 
 
diff --git a/gl/accept.c b/gl/accept.c
index 01faf54..8775aae 100644
--- a/gl/accept.c
+++ b/gl/accept.c
@@ -1,6 +1,6 @@
 /* accept.c --- wrappers for Windows accept function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/alloca.c b/gl/alloca.c
index 06b12a7..ee0f018 100644
--- a/gl/alloca.c
+++ b/gl/alloca.c
@@ -475,4 +475,4 @@ i00afunc (long address)
 #  endif /* CRAY */
 
 # endif /* no alloca */
-#endif /* not GCC version 3 */
+#endif /* not GCC 2 */
diff --git a/gl/alloca.in.h b/gl/alloca.in.h
index 5b69c6c..ca9e7fe 100644
--- a/gl/alloca.in.h
+++ b/gl/alloca.in.h
@@ -1,6 +1,6 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2011 Free Software Foundation,
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2012 Free Software Foundation,
    Inc.
 
    This program is free software; you can redistribute it and/or modify it
diff --git a/gl/alphasort.c b/gl/alphasort.c
index 25319dc..636c74a 100644
--- a/gl/alphasort.c
+++ b/gl/alphasort.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1997-1998, 2009-2011 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1997-1998, 2009-2012 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
diff --git a/gl/argp-ba.c b/gl/argp-ba.c
index a03b134..0b3d0bd 100644
--- a/gl/argp-ba.c
+++ b/gl/argp-ba.c
@@ -1,5 +1,5 @@
 /* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
-   Copyright (C) 1996-1997, 1999, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1996-1997, 1999, 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
@@ -19,8 +19,8 @@
 /* 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.'.  */
+   messages), embedded in a sentence that says something like "Report bugs to
+   ADDR."  */
 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
diff --git a/gl/argp-eexst.c b/gl/argp-eexst.c
index 1082a39..dcb10a6 100644
--- a/gl/argp-eexst.c
+++ b/gl/argp-eexst.c
@@ -1,5 +1,5 @@
 /* Default definition for ARGP_ERR_EXIT_STATUS
-   Copyright (C) 1997, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
diff --git a/gl/argp-fmtstream.c b/gl/argp-fmtstream.c
index c308eb6..70e3eb8 100644
--- a/gl/argp-fmtstream.c
+++ b/gl/argp-fmtstream.c
@@ -1,5 +1,5 @@
 /* Word-wrapping and line-truncating streams
-   Copyright (C) 1997-1999, 2001-2003, 2005, 2009-2011 Free Software
+   Copyright (C) 1997-1999, 2001-2003, 2005, 2009-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
@@ -17,7 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* This package emulates glibc `line_wrap_stream' semantics for systems that
+/* This package emulates glibc 'line_wrap_stream' semantics for systems that
    don't have that.  */
 
 #ifdef HAVE_CONFIG_H
diff --git a/gl/argp-fmtstream.h b/gl/argp-fmtstream.h
index f664254..a891c3d 100644
--- a/gl/argp-fmtstream.h
+++ b/gl/argp-fmtstream.h
@@ -1,5 +1,5 @@
 /* Word-wrapping and line-truncating streams.
-   Copyright (C) 1997, 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2006-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
@@ -16,7 +16,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* This package emulates glibc `line_wrap_stream' semantics for systems that
+/* This package emulates glibc 'line_wrap_stream' semantics for systems that
    don't have that.  If the system does have it, it is just a wrapper for
    that.  This header file is only used internally while compiling argp, and
    shouldn't be installed.  */
diff --git a/gl/argp-fs-xinl.c b/gl/argp-fs-xinl.c
index 8dd679c..b030e58 100644
--- a/gl/argp-fs-xinl.c
+++ b/gl/argp-fs-xinl.c
@@ -1,5 +1,5 @@
 /* Real definitions for extern inline functions in argp-fmtstream.h
-   Copyright (C) 1997, 2003-2004, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2003-2004, 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
diff --git a/gl/argp-help.c b/gl/argp-help.c
index 0cc5838..6d2903e 100644
--- a/gl/argp-help.c
+++ b/gl/argp-help.c
@@ -1,5 +1,5 @@
 /* Hierarchial argument parsing help output
-   Copyright (C) 1995-2005, 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1995-2005, 2007, 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
@@ -56,7 +56,7 @@
 
 /* User-selectable (using an environment variable) formatting parameters.
 
-   These may be specified in an environment variable called `ARGP_HELP_FMT',
+   These may be specified in an environment variable called 'ARGP_HELP_FMT',
    with a contents like:  VAR1=VAL1,VAR2=VAL2,BOOLVAR2,no-BOOLVAR2
    Where VALn must be a positive integer.  The list of variables is in the
    UPARAM_NAMES vector, below.  */
@@ -73,13 +73,13 @@
 #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.  */
+   They must all be of type 'int' for the parsing code to work.  */
 struct uparams
 {
   /* If true, arguments for an option are shown with both short and long
-     options, even when a given option has both, e.g. `-x ARG, --longx=ARG'.
+     options, even when a given option has both, e.g. '-x ARG, --longx=ARG'.
      If false, then if an option has both, the argument is only shown with
-     the long one, e.g., `-x, --longx=ARG', and a message indicating that
+     the long one, e.g., '-x, --longx=ARG', and a message indicating that
      this really means both is printed below the options.  */
   int dup_args;
 
@@ -111,7 +111,7 @@ static struct uparams uparams = {
 struct uparam_name
 {
   const char *name;             /* User name.  */
-  int is_bool;                  /* Whether it's `boolean'.  */
+  int is_bool;                  /* Whether it's 'boolean'.  */
   size_t uparams_offs;          /* Location of the (int) field in UPARAMS.  */
 };
 
@@ -728,7 +728,7 @@ canon_doc_option (const char **name)
       /* Skip initial whitespace.  */
       while (isspace ((unsigned char) **name))
         (*name)++;
-      /* Decide whether this looks like an option (leading `-') or not.  */
+      /* Decide whether this looks like an option (leading '-') or not.  */
       non_opt = (**name != '-');
       /* Skip until part of name used for sorting.  */
       while (**name && !isalnum ((unsigned char) **name))
@@ -755,7 +755,7 @@ hol_entry_cmp (const struct hol_entry *entry1,
       /* The entries are not within the same cluster, so we can't compare them
          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
+        /* 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.  */
@@ -785,7 +785,7 @@ hol_entry_cmp (const struct hol_entry *entry1,
         doc2 = canon_doc_option (&long2);
 
       if (doc1 != doc2)
-        /* `documentation' options always follow normal options (or
+        /* "documentation" options always follow normal options (or
            documentation options that *look* like normal options).  */
         return doc1 - doc2;
       else if (!short1 && !short2 && long1 && long2)
@@ -891,7 +891,8 @@ hol_append (struct hol *hol, struct hol *more)
 
           /* 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);
+            e->short_options =
+              short_options + (e->short_options - hol->short_options);
 
           /* Now add the short options from MORE, fixing up its entries
              too.  */
@@ -1144,7 +1145,7 @@ hol_entry_help (struct hol_entry *entry, const struct 
argp_state *state,
 
   /* Now, long options.  */
   if (odoc (real))
-    /* A `documentation' option.  */
+    /* A "documentation" option.  */
     {
       __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col);
       for (opt = real, num = entry->num; num > 0; opt++, num--)
@@ -1438,7 +1439,7 @@ argp_args_usage (const struct argp *argp, const struct 
argp_state *state,
       const char *cp = fdoc;
       nl = __strchrnul (cp, '\n');
       if (*nl != '\0')
-        /* This is a `multi-level' args doc; advance to the correct position
+        /* This is a "multi-level" args doc; advance to the correct position
            as determined by our state in LEVELS, and update LEVELS.  */
         {
           int i;
@@ -1479,9 +1480,9 @@ argp_args_usage (const struct argp *argp, const struct 
argp_state *state,
 }
 
 /* Print the documentation for ARGP to STREAM; if POST is false, then
-   everything preceeding a `\v' character in the documentation strings (or
+   everything preceeding a '\v' character in the documentation strings (or
    the whole string, for those with none) is printed, otherwise, everything
-   following the `\v' character (nothing for strings without).  Each separate
+   following the '\v' character (nothing for strings without).  Each separate
    bit of documentation is separated a blank line, and if PRE_BLANK is true,
    then the first is as well.  If FIRST_ONLY is true, only the first
    occurrence is output.  Returns true if anything was output.  */
@@ -1579,7 +1580,7 @@ argp_doc (const struct argp *argp, const struct 
argp_state *state,
 
 /* Output a usage message for ARGP to STREAM.  If called from
    argp_state_help, STATE is the relevent parsing state.  FLAGS are from the
-   set ARGP_HELP_*.  NAME is what to use wherever a `program name' is
+   set ARGP_HELP_*.  NAME is what to use wherever a "program name" is
    needed. */
 static void
 _help (const struct argp *argp, const struct argp_state *state, FILE *stream,
@@ -1620,7 +1621,7 @@ _help (const struct argp *argp, const struct argp_state 
*state, FILE *stream,
     }
 
   if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE))
-    /* Print a short `Usage:' message.  */
+    /* Print a short "Usage:" message.  */
     {
       int first_pattern = 1, more_patterns;
       size_t num_pattern_levels = argp_args_levels (argp);
@@ -1680,7 +1681,7 @@ _help (const struct argp *argp, const struct argp_state 
*state, FILE *stream,
   if (flags & ARGP_HELP_SEE)
     {
       __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "\
-Try `%s --help' or `%s --usage' for more information.\n"),
+Try '%s --help' or '%s --usage' for more information.\n"),
                                name, name);
       anything = 1;
     }
@@ -1723,7 +1724,7 @@ Try `%s --help' or `%s --usage' for more information.\n"),
 }
 
 /* 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. */
+   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)
 {
@@ -1781,7 +1782,7 @@ weak_alias (__argp_state_help, argp_state_help)
 #endif
 
 /* If appropriate, print the printf string FMT and following args, preceded
-   by the program name and `:', to stderr, and followed by a `Try ... --help'
+   by the program name and ':', to stderr, and followed by a "Try ... --help"
    message, then exit (1).  */
 void
 __argp_error (const struct argp_state *state, const char *fmt, ...)
diff --git a/gl/argp-namefrob.h b/gl/argp-namefrob.h
index 5f6b020..a6df978 100644
--- a/gl/argp-namefrob.h
+++ b/gl/argp-namefrob.h
@@ -1,5 +1,5 @@
 /* Name frobnication for compiling argp outside of glibc
-   Copyright (C) 1997, 2003, 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2003, 2007, 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
diff --git a/gl/argp-parse.c b/gl/argp-parse.c
index 64360be..39b8336 100644
--- a/gl/argp-parse.c
+++ b/gl/argp-parse.c
@@ -1,5 +1,5 @@
 /* Hierarchial argument parsing, layered over getopt
-   Copyright (C) 1995-2000, 2002-2004, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2002-2004, 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
@@ -187,7 +187,7 @@ find_long_option (struct option *long_options, const char 
*name)
 }
 
 
-/* The state of a `group' during parsing.  Each group corresponds to a
+/* The state of a "group" during parsing.  Each group corresponds to a
    particular argp structure from the tree of such descending from the top
    level argp passed to argp_parse.  */
 struct group
@@ -439,7 +439,7 @@ calc_sizes (const struct argp *argp,  struct parser_sizes 
*szs)
           int num_opts = 0;
           while (!__option_is_end (opt++))
             num_opts++;
-          szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */
+          szs->short_len += num_opts * 3; /* opt + up to 2 ':'s */
           szs->long_len += num_opts;
         }
     }
@@ -781,7 +781,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
 
   if (parser->state.quoted && parser->state.next < parser->state.quoted)
     /* The next argument pointer has been moved to before the quoted
-       region, so pretend we never saw the quoting `--', and give getopt
+       region, so pretend we never saw the quoting "--", and give getopt
        another chance.  If the user hasn't removed it, getopt will just
        process it again.  */
     parser->state.quoted = 0;
@@ -813,7 +813,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
               && 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
+               "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;
diff --git a/gl/argp-pin.c b/gl/argp-pin.c
index c966756..e50dad8 100644
--- a/gl/argp-pin.c
+++ b/gl/argp-pin.c
@@ -1,5 +1,5 @@
 /* Full and short program names for argp module
-   Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2009-2012 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
diff --git a/gl/argp-pv.c b/gl/argp-pv.c
index 7a8cba7..1d5a010 100644
--- a/gl/argp-pv.c
+++ b/gl/argp-pv.c
@@ -1,5 +1,5 @@
 /* Default definition for ARGP_PROGRAM_VERSION.
-   Copyright (C) 1996-1997, 1999, 2006, 2009-2011 Free Software Foundation,
+   Copyright (C) 1996-1997, 1999, 2006, 2009-2012 Free Software Foundation,
    Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
diff --git a/gl/argp-pvh.c b/gl/argp-pvh.c
index 04f6603..5c858b3 100644
--- a/gl/argp-pvh.c
+++ b/gl/argp-pvh.c
@@ -1,5 +1,5 @@
 /* Default definition for ARGP_PROGRAM_VERSION_HOOK.
-   Copyright (C) 1996-1997, 1999, 2004, 2009-2011 Free Software Foundation,
+   Copyright (C) 1996-1997, 1999, 2004, 2009-2012 Free Software Foundation,
    Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
diff --git a/gl/argp-xinl.c b/gl/argp-xinl.c
index 5b1f6fb..7d45fcb 100644
--- a/gl/argp-xinl.c
+++ b/gl/argp-xinl.c
@@ -1,5 +1,5 @@
 /* Real definitions for extern inline functions in argp.h
-   Copyright (C) 1997-1998, 2004, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-1998, 2004, 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
diff --git a/gl/argp.h b/gl/argp.h
index c0483ab..f9f266e 100644
--- a/gl/argp.h
+++ b/gl/argp.h
@@ -1,5 +1,5 @@
 /* Hierarchial argument parsing, layered over getopt.
-   Copyright (C) 1995-1999, 2003-2011 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2003-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
@@ -94,7 +94,7 @@ 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.  */
@@ -124,21 +124,21 @@ struct argp_option
 /* This option isn't actually an option (and so should be ignored by the
    actual option parser), but rather an arbitrary piece of documentation that
    should be displayed in much the same manner as the options.  If this flag
-   is set, then the option NAME field is displayed unmodified (e.g., no `--'
+   is set, then the option NAME field is displayed unmodified (e.g., no '--'
    prefix is added) at the left-margin (where a *short* option would normally
    be displayed), and the documentation string in the normal place. The NAME
    field will be translated using gettext, unless OPTION_NO_TRANS is set (see
    below). For purposes of sorting, any leading whitespace and punctuation is
-   ignored, except that if the first non-whitespace character is not `-', this
+   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.  */
+   '-') in the same group.  */
 #define OPTION_DOC              0x8
 
-/* This option shouldn't be included in `long' usage messages (but is still
+/* This option shouldn't be included in "long" usage messages (but is still
    included in help messages).  This is mainly intended for options that are
    completely documented in an argp's ARGS_DOC field, in which case including
    the option in the generic usage list would be redundant.  For instance,
-   if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to
+   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
@@ -167,7 +167,7 @@ typedef error_t (*argp_parser_t) (int key, char *arg,
    ARGP_ERR_UNKNOWN should be returned if they aren't understood.
 
    The sequence of keys to a parsing function is either (where each
-   uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key):
+   uppercased word should be prefixed by 'ARGP_KEY_' and opt is a user key):
 
        INIT opt... NO_ARGS END SUCCESS  -- No non-option arguments at all
    or  INIT (opt | ARG)... END SUCCESS  -- All non-option args parsed
@@ -238,15 +238,15 @@ struct argp
   argp_parser_t parser;
 
   /* A string describing what other arguments are wanted by this program.  It
-     is only used by argp_usage to print the `Usage:' message.  If it
+     is only used by argp_usage to print the "Usage:" message.  If it
      contains newlines, the strings separated by them are considered
      alternative usage patterns, and printed on separate lines (lines after
-     the first are prefix by `  or: ' instead of `Usage:').  */
+     the first are prefix by "  or: " instead of "Usage:").  */
   const char *args_doc;
 
   /* If non-NULL, a string containing extra text to be printed before and
      after the options in a long help message (separated by a vertical tab
-     `\v' character).
+     '\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;
@@ -265,7 +265,7 @@ struct argp
      defines, below, describing which other help text TEXT is.  The function
      should return either TEXT, if it should be used as-is, a replacement
      string, which should be malloced, and will be freed by argp, or NULL,
-     meaning `print nothing'.  The value for TEXT is *after* any translation
+     meaning "print nothing".  The value for TEXT is *after* any translation
      has been done, so if any of the replacement text also needs translation,
      that should be done by the filter function.  INPUT is either the input
      supplied to argp_parse, or NULL, if argp_help was called directly.  */
@@ -304,7 +304,7 @@ struct argp_child
      printing a header string, use a value of "".  */
   const char *header;
 
-  /* Where to group the child options relative to the other (`consolidated')
+  /* Where to group the child options relative to the other ("consolidated")
      options in the parent argp; the values are the same as the GROUP field
      in argp_option structs, but all child-groupings follow parent options at
      a particular group level.  If both this field and HEADER are zero, then
@@ -337,7 +337,7 @@ struct argp_state
   unsigned arg_num;
 
   /* If non-zero, the index in ARGV of the first argument following a special
-     `--' argument (which prevents anything following being interpreted as an
+     '--' argument (which prevents anything following being interpreted as an
      option).  Only set once argument parsing has proceeded past this point. */
   int quoted;
 
@@ -399,7 +399,7 @@ struct argp_state
 /* Don't exit on errors (they may still result in error messages).  */
 #define ARGP_NO_EXIT    0x20
 
-/* Use the gnu getopt `long-only' rules for parsing arguments.  */
+/* Use the gnu getopt "long-only" rules for parsing arguments.  */
 #define ARGP_LONG_ONLY  0x40
 
 /* Turns off any message-printing/exiting options.  */
@@ -456,7 +456,7 @@ extern void (*argp_program_version_hook) (FILE *__restrict 
__stream,
    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.'.  */
+   "Report bugs to ADDR."  */
 extern const char *argp_program_bug_address;
 
 /* The exit status that argp will use when exiting due to a parsing error.
@@ -467,7 +467,7 @@ 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_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.  */
@@ -526,7 +526,7 @@ 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'
+   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, ...)
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h
index 5264853..91b1008 100644
--- a/gl/arpa_inet.in.h
+++ b/gl/arpa_inet.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <arpa/inet.h>.
 
-   Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2012 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
diff --git a/gl/asnprintf.c b/gl/asnprintf.c
index e4fd95c..416a586 100644
--- a/gl/asnprintf.c
+++ b/gl/asnprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006, 2009-2012 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
diff --git a/gl/asprintf.c b/gl/asprintf.c
index 2f13126..b8b405f 100644
--- a/gl/asprintf.c
+++ b/gl/asprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation,
+   Copyright (C) 1999, 2002, 2006-2007, 2009-2012 Free Software Foundation,
    Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/basename-lgpl.c b/gl/basename-lgpl.c
index 529bc35..43ef8c2 100644
--- a/gl/basename-lgpl.c
+++ b/gl/basename-lgpl.c
@@ -1,6 +1,6 @@
 /* basename.c -- return the last element in a file name
 
-   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2011 Free Software
+   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/bind.c b/gl/bind.c
index baaea59..0045c9d 100644
--- a/gl/bind.c
+++ b/gl/bind.c
@@ -1,6 +1,6 @@
 /* bind.c --- wrappers for Windows bind function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/byteswap.in.h b/gl/byteswap.in.h
index 6114916..e356699 100644
--- a/gl/byteswap.in.h
+++ b/gl/byteswap.in.h
@@ -1,5 +1,5 @@
 /* byteswap.h - Byte swapping
-   Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009-2012 Free Software Foundation, Inc.
    Written by Oskar Liljeblad <address@hidden>, 2005.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/c-ctype.c b/gl/c-ctype.c
index 0fb4295..6ca7992 100644
--- a/gl/c-ctype.c
+++ b/gl/c-ctype.c
@@ -1,6 +1,6 @@
 /* Character handling in C locale.
 
-   Copyright 2000-2003, 2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright 2000-2003, 2006, 2009-2012 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
diff --git a/gl/c-ctype.h b/gl/c-ctype.h
index 57e71ee..a857748 100644
--- a/gl/c-ctype.h
+++ b/gl/c-ctype.h
@@ -5,7 +5,7 @@
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
-   Copyright (C) 2000-2003, 2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2006, 2008-2012 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
@@ -118,23 +118,23 @@ extern "C" {
          if (c_isalpha (*s)) ...
  */
 
-extern bool c_isascii (int c); /* not locale dependent */
-
-extern bool c_isalnum (int c);
-extern bool c_isalpha (int c);
-extern bool c_isblank (int c);
-extern bool c_iscntrl (int c);
-extern bool c_isdigit (int c);
-extern bool c_islower (int c);
-extern bool c_isgraph (int c);
-extern bool c_isprint (int c);
-extern bool c_ispunct (int c);
-extern bool c_isspace (int c);
-extern bool c_isupper (int c);
-extern bool c_isxdigit (int c);
-
-extern int c_tolower (int c);
-extern int c_toupper (int c);
+extern bool c_isascii (int c) _GL_ATTRIBUTE_CONST; /* not locale dependent */
+
+extern bool c_isalnum (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isalpha (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isblank (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_iscntrl (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isdigit (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_islower (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isgraph (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isprint (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_ispunct (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isspace (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isupper (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isxdigit (int c) _GL_ATTRIBUTE_CONST;
+
+extern int c_tolower (int c) _GL_ATTRIBUTE_CONST;
+extern int c_toupper (int c) _GL_ATTRIBUTE_CONST;
 
 
 #if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && 
!defined NO_C_CTYPE_MACROS
diff --git a/gl/close.c b/gl/close.c
index c2197fe..4b7accb 100644
--- a/gl/close.c
+++ b/gl/close.c
@@ -1,5 +1,5 @@
 /* close replacement.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/closedir.c b/gl/closedir.c
index 0fdce18..df31e86 100644
--- a/gl/closedir.c
+++ b/gl/closedir.c
@@ -1,5 +1,5 @@
 /* Stop reading the entries of a directory.
-   Copyright (C) 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 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
diff --git a/gl/connect.c b/gl/connect.c
index afd13b9..939b399 100644
--- a/gl/connect.c
+++ b/gl/connect.c
@@ -1,6 +1,6 @@
 /* connect.c --- wrappers for Windows connect function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/dirent-private.h b/gl/dirent-private.h
index 74632ff..b60203c 100644
--- a/gl/dirent-private.h
+++ b/gl/dirent-private.h
@@ -1,5 +1,5 @@
 /* Private details of the DIR type.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/dirent.in.h b/gl/dirent.in.h
index cbcf841..808b360 100644
--- a/gl/dirent.in.h
+++ b/gl/dirent.in.h
@@ -1,5 +1,5 @@
 /* A GNU-like <dirent.h>.
-   Copyright (C) 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 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
diff --git a/gl/dirname-lgpl.c b/gl/dirname-lgpl.c
index f5b0c0f..2895cbc 100644
--- a/gl/dirname-lgpl.c
+++ b/gl/dirname-lgpl.c
@@ -1,6 +1,6 @@
 /* dirname.c -- return all but the last element in a file name
 
-   Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2011 Free Software
+   Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -25,7 +25,7 @@
 
 /* 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
+   even though 'dir_name (FILE)' will return ".".  Works properly even
    if there are trailing slashes (by effectively ignoring them).  */
 
 size_t
@@ -53,9 +53,9 @@ dir_len (char const *file)
 }
 
 
-/* In general, we can't use the builtin `dirname' function if available,
+/* 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.
+   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
diff --git a/gl/dirname.h b/gl/dirname.h
index 2ef9882..51a685c 100644
--- a/gl/dirname.h
+++ b/gl/dirname.h
@@ -1,6 +1,6 @@
 /*  Take file names apart into directory and base names.
 
-    Copyright (C) 1998, 2001, 2003-2006, 2009-2011 Free Software Foundation,
+    Copyright (C) 1998, 2001, 2003-2006, 2009-2012 Free Software Foundation,
     Inc.
 
     This program is free software: you can redistribute it and/or modify
@@ -37,9 +37,9 @@ char *dir_name (char const *file);
 # endif
 
 char *mdir_name (char const *file);
-size_t base_len (char const *file);
-size_t dir_len (char const *file);
-char *last_component (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/gl/dosname.h b/gl/dosname.h
index acdd03b..0468ce4 100644
--- a/gl/dosname.h
+++ b/gl/dosname.h
@@ -1,6 +1,6 @@
 /* File names on MS-DOS/Windows systems.
 
-   Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2004-2006, 2009-2012 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
diff --git a/gl/errno.in.h b/gl/errno.in.h
index b6014b4..5271bcd 100644
--- a/gl/errno.in.h
+++ b/gl/errno.in.h
@@ -1,6 +1,6 @@
 /* A POSIX-like <errno.h>.
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/error.c b/gl/error.c
index 5ebe8bf..dc8c65f 100644
--- a/gl/error.c
+++ b/gl/error.c
@@ -1,5 +1,5 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2007, 2009-2012 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
@@ -54,7 +54,7 @@
    function without parameters instead.  */
 void (*error_print_progname) (void);
 
-/* This variable is incremented each time `error' is called.  */
+/* This variable is incremented each time 'error' is called.  */
 unsigned int error_message_count;
 
 #ifdef _LIBC
@@ -65,7 +65,7 @@ unsigned int error_message_count;
 # include <limits.h>
 # include <libio/libioP.h>
 
-/* In GNU libc we want do not want to use the common name `error' directly.
+/* In GNU libc we want do not want to use the common name 'error' directly.
    Instead make it a weak alias.  */
 extern void __error (int status, int errnum, const char *message, ...)
      __attribute__ ((__format__ (__printf__, 3, 4)));
@@ -89,7 +89,7 @@ extern void __error_at_line (int status, int errnum, const 
char *file_name,
 # include <unistd.h>
 
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Get declarations of the Win32 API functions.  */
+/* Get declarations of the native Windows API functions.  */
 #  define WIN32_LEAN_AND_MEAN
 #  include <windows.h>
 /* Get _get_osfhandle.  */
@@ -125,9 +125,10 @@ static inline int
 is_open (int fd)
 {
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* On Win32: The initial state of unassigned standard file descriptors is
-     that they are open but point to an INVALID_HANDLE_VALUE.  There is no
-     fcntl, and the gnulib replacement fcntl does not support F_GETFL.  */
+  /* On native Windows: The initial state of unassigned standard file
+     descriptors is that they are open but point to an INVALID_HANDLE_VALUE.
+     There is no fcntl, and the gnulib replacement fcntl does not support
+     F_GETFL.  */
   return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
 # else
 #  ifndef F_GETFL
diff --git a/gl/error.h b/gl/error.h
index 80f81bc..9c2cb8b 100644
--- a/gl/error.h
+++ b/gl/error.h
@@ -1,5 +1,5 @@
 /* Declaration for error-reporting function
-   Copyright (C) 1995-1997, 2003, 2006, 2008-2011 Free Software Foundation,
+   Copyright (C) 1995-1997, 2003, 2006, 2008-2012 Free Software Foundation,
    Inc.
    This file is part of the GNU C Library.
 
@@ -35,9 +35,9 @@
 extern "C" {
 #endif
 
-/* Print a message with `fprintf (stderr, FORMAT, ...)';
+/* Print a message with 'fprintf (stderr, FORMAT, ...)';
    if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
-   If STATUS is nonzero, terminate the program with `exit (STATUS)'.  */
+   If STATUS is nonzero, terminate the program with 'exit (STATUS)'.  */
 
 extern void error (int __status, int __errnum, const char *__format, ...)
      _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4));
@@ -51,7 +51,7 @@ extern void error_at_line (int __status, int __errnum, const 
char *__fname,
    function without parameters instead.  */
 extern void (*error_print_progname) (void);
 
-/* This variable is incremented each time `error' is called.  */
+/* This variable is incremented each time 'error' is called.  */
 extern unsigned int error_message_count;
 
 /* Sometimes we want to have at most one error per line.  This
diff --git a/gl/fd-hook.c b/gl/fd-hook.c
index b58300d..8f4ffe2 100644
--- a/gl/fd-hook.c
+++ b/gl/fd-hook.c
@@ -1,5 +1,5 @@
 /* Hook for making making file descriptor functions close(), ioctl() 
extensible.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2009.
 
    This program is free software: you can redistribute it and/or modify it
diff --git a/gl/fd-hook.h b/gl/fd-hook.h
index ada4c87..721e9ad 100644
--- a/gl/fd-hook.h
+++ b/gl/fd-hook.h
@@ -1,5 +1,5 @@
 /* Hook for making making file descriptor functions close(), ioctl() 
extensible.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/filename.h b/gl/filename.h
index 7827c11..7b89d0d 100644
--- a/gl/filename.h
+++ b/gl/filename.h
@@ -1,5 +1,5 @@
 /* Basic filename support macros.
-   Copyright (C) 2001-2004, 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2007-2012 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
@@ -29,7 +29,7 @@ extern "C" {
    IS_PATH_WITH_DIR(P)  tests whether P contains a directory specification.
  */
 #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined 
__EMX__ || defined __DJGPP__
-  /* Win32, Cygwin, OS/2, DOS */
+  /* Native Windows, Cygwin, OS/2, DOS */
 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
 # define HAS_DEVICE(P) \
     ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
diff --git a/gl/float+.h b/gl/float+.h
index 2e84489..c294350 100644
--- a/gl/float+.h
+++ b/gl/float+.h
@@ -1,5 +1,5 @@
 /* Supplemental information about the floating-point formats.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2007.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/float.c b/gl/float.c
index b05b40c..ea31866 100644
--- a/gl/float.c
+++ b/gl/float.c
@@ -1,5 +1,5 @@
 /* Auxiliary definitions for <float.h>.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2011.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/float.in.h b/gl/float.in.h
index d5b2258..b420510 100644
--- a/gl/float.in.h
+++ b/gl/float.in.h
@@ -1,6 +1,6 @@
 /* A correct <float.h>.
 
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/fpucw.h b/gl/fpucw.h
index 07403bf..a62c51d 100644
--- a/gl/fpucw.h
+++ b/gl/fpucw.h
@@ -1,5 +1,5 @@
 /* Manipulating the FPU control word.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2007.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/frexp.c b/gl/frexp.c
index 26bdec9..4f5d0c0 100644
--- a/gl/frexp.c
+++ b/gl/frexp.c
@@ -1,5 +1,5 @@
 /* Split a double into fraction and mantissa.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/frexpl.c b/gl/frexpl.c
index c468937..b74ceeb 100644
--- a/gl/frexpl.c
+++ b/gl/frexpl.c
@@ -1,5 +1,5 @@
 /* Split a 'long double' into fraction and mantissa.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/fseek.c b/gl/fseek.c
index bcb76d8..20f5e2c 100644
--- a/gl/fseek.c
+++ b/gl/fseek.c
@@ -1,5 +1,5 @@
 /* An fseek() function that, together with fflush(), is POSIX compliant.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/fseeko.c b/gl/fseeko.c
index 87d6638..eae1b72 100644
--- a/gl/fseeko.c
+++ b/gl/fseeko.c
@@ -1,5 +1,5 @@
 /* An fseeko() function that, together with fflush(), is POSIX compliant.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/fseterr.c b/gl/fseterr.c
index eaad702..30b41e1 100644
--- a/gl/fseterr.c
+++ b/gl/fseterr.c
@@ -1,5 +1,5 @@
 /* Set the error indicator of a stream.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/fseterr.h b/gl/fseterr.h
index e4b061b..b3930c5 100644
--- a/gl/fseterr.h
+++ b/gl/fseterr.h
@@ -1,5 +1,5 @@
 /* Set the error indicator of a stream.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/fstat.c b/gl/fstat.c
index db5b17c..4918495 100644
--- a/gl/fstat.c
+++ b/gl/fstat.c
@@ -1,5 +1,5 @@
 /* fstat() replacement.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/ftell.c b/gl/ftell.c
index 74ec986..817e9ff 100644
--- a/gl/ftell.c
+++ b/gl/ftell.c
@@ -1,5 +1,5 @@
 /* An ftell() function that works around platform bugs.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/ftello.c b/gl/ftello.c
index fbdc44f..1beb202 100644
--- a/gl/ftello.c
+++ b/gl/ftello.c
@@ -1,5 +1,5 @@
 /* An ftello() function that works around platform bugs.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/gai_strerror.c b/gl/gai_strerror.c
new file mode 100644
index 0000000..b846e48
--- /dev/null
+++ b/gl/gai_strerror.c
@@ -0,0 +1,93 @@
+/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2012 Free Software
+   Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Philip Blundell <address@hidden>, 1997.
+
+   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 _LIBC
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <netdb.h>
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "gettext.h"
+# define _(String) gettext (String)
+# define N_(String) String
+#endif
+
+#if HAVE_DECL_GAI_STRERROR
+
+# include <sys/socket.h>
+# undef gai_strerror
+# if HAVE_DECL_GAI_STRERRORA
+#  define gai_strerror gai_strerrorA
+# endif
+
+const char *
+rpl_gai_strerror (int code)
+{
+  return gai_strerror (code);
+}
+
+#else /* !HAVE_DECL_GAI_STRERROR */
+
+static struct
+  {
+    int code;
+    const char *msg;
+  }
+values[] =
+  {
+    { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
+    { EAI_AGAIN, N_("Temporary failure in name resolution") },
+    { EAI_BADFLAGS, N_("Bad value for ai_flags") },
+    { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
+    { EAI_FAMILY, N_("ai_family not supported") },
+    { EAI_MEMORY, N_("Memory allocation failure") },
+    { EAI_NODATA, N_("No address associated with hostname") },
+    { EAI_NONAME, N_("Name or service not known") },
+    { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
+    { EAI_SOCKTYPE, N_("ai_socktype not supported") },
+    { EAI_SYSTEM, N_("System error") },
+    { EAI_OVERFLOW, N_("Argument buffer too small") },
+#ifdef EAI_INPROGRESS
+    { EAI_INPROGRESS, N_("Processing request in progress") },
+    { EAI_CANCELED, N_("Request canceled") },
+    { EAI_NOTCANCELED, N_("Request not canceled") },
+    { EAI_ALLDONE, N_("All requests done") },
+    { EAI_INTR, N_("Interrupted by a signal") },
+    { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
+#endif
+  };
+
+const char *
+gai_strerror (int code)
+{
+  size_t i;
+  for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
+    if (values[i].code == code)
+      return _(values[i].msg);
+
+  return _("Unknown error");
+}
+# ifdef _LIBC
+libc_hidden_def (gai_strerror)
+# endif
+#endif /* !HAVE_DECL_GAI_STRERROR */
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c
new file mode 100644
index 0000000..c538967
--- /dev/null
+++ b/gl/getaddrinfo.c
@@ -0,0 +1,444 @@
+/* Get address information (partial implementation).
+   Copyright (C) 1997, 2001-2002, 2004-2012 Free Software Foundation, Inc.
+   Contributed by Simon Josefsson <address@hidden>.
+
+   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.  */
+
+#include <config.h>
+
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the sa == NULL test below.  */
+#define _GL_ARG_NONNULL(params)
+
+#include <netdb.h>
+
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+
+/* Get inet_ntop.  */
+#include <arpa/inet.h>
+
+/* Get calloc. */
+#include <stdlib.h>
+
+/* Get memcpy, strdup. */
+#include <string.h>
+
+/* Get snprintf. */
+#include <stdio.h>
+
+#include <stdbool.h>
+
+#include "gettext.h"
+#define _(String) gettext (String)
+#define N_(String) String
+
+/* BeOS has AF_INET, but not PF_INET.  */
+#ifndef PF_INET
+# define PF_INET AF_INET
+#endif
+/* BeOS also lacks PF_UNSPEC.  */
+#ifndef PF_UNSPEC
+# define PF_UNSPEC 0
+#endif
+
+#if defined _WIN32 || defined __WIN32__
+# define WINDOWS_NATIVE
+#endif
+
+/* gl_sockets_startup */
+#include "sockets.h"
+
+#ifdef WINDOWS_NATIVE
+typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
+                                        const struct addrinfo*,
+                                        struct addrinfo**);
+typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
+typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
+                                        socklen_t, char*, DWORD,
+                                        char*, DWORD, int);
+
+static getaddrinfo_func getaddrinfo_ptr = NULL;
+static freeaddrinfo_func freeaddrinfo_ptr = NULL;
+static getnameinfo_func getnameinfo_ptr = NULL;
+
+static int
+use_win32_p (void)
+{
+  static int done = 0;
+  HMODULE h;
+
+  if (done)
+    return getaddrinfo_ptr ? 1 : 0;
+
+  done = 1;
+
+  h = GetModuleHandle ("ws2_32.dll");
+
+  if (h)
+    {
+      getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo");
+      freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, 
"freeaddrinfo");
+      getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo");
+    }
+
+  /* If either is missing, something is odd. */
+  if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr)
+    {
+      getaddrinfo_ptr = NULL;
+      freeaddrinfo_ptr = NULL;
+      getnameinfo_ptr = NULL;
+      return 0;
+    }
+
+  gl_sockets_startup (SOCKETS_1_1);
+
+  return 1;
+}
+#endif
+
+static inline bool
+validate_family (int family)
+{
+  /* FIXME: Support more families. */
+#if HAVE_IPV4
+     if (family == PF_INET)
+       return true;
+#endif
+#if HAVE_IPV6
+     if (family == PF_INET6)
+       return true;
+#endif
+     if (family == PF_UNSPEC)
+       return true;
+     return false;
+}
+
+/* Translate name of a service location and/or a service name to set of
+   socket addresses. */
+int
+getaddrinfo (const char *restrict nodename,
+             const char *restrict servname,
+             const struct addrinfo *restrict hints,
+             struct addrinfo **restrict res)
+{
+  struct addrinfo *tmp;
+  int port = 0;
+  struct hostent *he;
+  void *storage;
+  size_t size;
+#if HAVE_IPV6
+  struct v6_pair {
+    struct addrinfo addrinfo;
+    struct sockaddr_in6 sockaddr_in6;
+  };
+#endif
+#if HAVE_IPV4
+  struct v4_pair {
+    struct addrinfo addrinfo;
+    struct sockaddr_in sockaddr_in;
+  };
+#endif
+
+#ifdef WINDOWS_NATIVE
+  if (use_win32_p ())
+    return getaddrinfo_ptr (nodename, servname, hints, res);
+#endif
+
+  if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE)))
+    /* FIXME: Support more flags. */
+    return EAI_BADFLAGS;
+
+  if (hints && !validate_family (hints->ai_family))
+    return EAI_FAMILY;
+
+  if (hints &&
+      hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM)
+    /* FIXME: Support other socktype. */
+    return EAI_SOCKTYPE; /* FIXME: Better return code? */
+
+  if (!nodename)
+    {
+      if (!(hints->ai_flags & AI_PASSIVE))
+        return EAI_NONAME;
+
+#ifdef HAVE_IPV6
+      nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
+#else
+      nodename = "0.0.0.0";
+#endif
+    }
+
+  if (servname)
+    {
+      struct servent *se = NULL;
+      const char *proto =
+        (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
+
+      if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
+        /* FIXME: Use getservbyname_r if available. */
+        se = getservbyname (servname, proto);
+
+      if (!se)
+        {
+          char *c;
+          if (!(*servname >= '0' && *servname <= '9'))
+            return EAI_NONAME;
+          port = strtoul (servname, &c, 10);
+          if (*c || port > 0xffff)
+            return EAI_NONAME;
+          port = htons (port);
+        }
+      else
+        port = se->s_port;
+    }
+
+  /* FIXME: Use gethostbyname_r if available. */
+  he = gethostbyname (nodename);
+  if (!he || he->h_addr_list[0] == NULL)
+    return EAI_NONAME;
+
+  switch (he->h_addrtype)
+    {
+#if HAVE_IPV6
+    case PF_INET6:
+      size = sizeof (struct v6_pair);
+      break;
+#endif
+
+#if HAVE_IPV4
+    case PF_INET:
+      size = sizeof (struct v4_pair);
+      break;
+#endif
+
+    default:
+      return EAI_NODATA;
+    }
+
+  storage = calloc (1, size);
+  if (!storage)
+    return EAI_MEMORY;
+
+  switch (he->h_addrtype)
+    {
+#if HAVE_IPV6
+    case PF_INET6:
+      {
+        struct v6_pair *p = storage;
+        struct sockaddr_in6 *sinp = &p->sockaddr_in6;
+        tmp = &p->addrinfo;
+
+        if (port)
+          sinp->sin6_port = port;
+
+        if (he->h_length != sizeof (sinp->sin6_addr))
+          {
+            free (storage);
+            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
+          }
+
+        memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
+
+        tmp->ai_addr = (struct sockaddr *) sinp;
+        tmp->ai_addrlen = sizeof *sinp;
+      }
+      break;
+#endif
+
+#if HAVE_IPV4
+    case PF_INET:
+      {
+        struct v4_pair *p = storage;
+        struct sockaddr_in *sinp = &p->sockaddr_in;
+        tmp = &p->addrinfo;
+
+        if (port)
+          sinp->sin_port = port;
+
+        if (he->h_length != sizeof (sinp->sin_addr))
+          {
+            free (storage);
+            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
+          }
+
+        memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
+
+        tmp->ai_addr = (struct sockaddr *) sinp;
+        tmp->ai_addrlen = sizeof *sinp;
+      }
+      break;
+#endif
+
+    default:
+      free (storage);
+      return EAI_NODATA;
+    }
+
+  if (hints && hints->ai_flags & AI_CANONNAME)
+    {
+      const char *cn;
+      if (he->h_name)
+        cn = he->h_name;
+      else
+        cn = nodename;
+
+      tmp->ai_canonname = strdup (cn);
+      if (!tmp->ai_canonname)
+        {
+          free (storage);
+          return EAI_MEMORY;
+        }
+    }
+
+  tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
+  tmp->ai_socktype = (hints) ? hints->ai_socktype : 0;
+  tmp->ai_addr->sa_family = he->h_addrtype;
+  tmp->ai_family = he->h_addrtype;
+
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+  switch (he->h_addrtype)
+    {
+#if HAVE_IPV4
+    case AF_INET:
+      tmp->ai_addr->sa_len = sizeof (struct sockaddr_in);
+      break;
+#endif
+#if HAVE_IPV6
+    case AF_INET6:
+      tmp->ai_addr->sa_len = sizeof (struct sockaddr_in6);
+      break;
+#endif
+    }
+#endif
+
+  /* FIXME: If more than one address, create linked list of addrinfo's. */
+
+  *res = tmp;
+
+  return 0;
+}
+
+/* Free 'addrinfo' structure AI including associated storage.  */
+void
+freeaddrinfo (struct addrinfo *ai)
+{
+#ifdef WINDOWS_NATIVE
+  if (use_win32_p ())
+    {
+      freeaddrinfo_ptr (ai);
+      return;
+    }
+#endif
+
+  while (ai)
+    {
+      struct addrinfo *cur;
+
+      cur = ai;
+      ai = ai->ai_next;
+
+      free (cur->ai_canonname);
+      free (cur);
+    }
+}
+
+int
+getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
+             char *restrict node, socklen_t nodelen,
+             char *restrict service, socklen_t servicelen,
+             int flags)
+{
+#ifdef WINDOWS_NATIVE
+  if (use_win32_p ())
+    return getnameinfo_ptr (sa, salen, node, nodelen,
+                            service, servicelen, flags);
+#endif
+
+  /* FIXME: Support other flags. */
+  if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) ||
+      (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) ||
+      (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV)))
+    return EAI_BADFLAGS;
+
+  if (sa == NULL || salen < sizeof (sa->sa_family))
+    return EAI_FAMILY;
+
+  switch (sa->sa_family)
+    {
+#if HAVE_IPV4
+    case AF_INET:
+      if (salen < sizeof (struct sockaddr_in))
+        return EAI_FAMILY;
+      break;
+#endif
+#if HAVE_IPV6
+    case AF_INET6:
+      if (salen < sizeof (struct sockaddr_in6))
+        return EAI_FAMILY;
+      break;
+#endif
+    default:
+      return EAI_FAMILY;
+    }
+
+  if (node && nodelen > 0 && flags & NI_NUMERICHOST)
+    {
+      switch (sa->sa_family)
+        {
+#if HAVE_IPV4
+        case AF_INET:
+          if (!inet_ntop (AF_INET,
+                          &(((const struct sockaddr_in *) sa)->sin_addr),
+                          node, nodelen))
+            return EAI_SYSTEM;
+          break;
+#endif
+
+#if HAVE_IPV6
+        case AF_INET6:
+          if (!inet_ntop (AF_INET6,
+                          &(((const struct sockaddr_in6 *) sa)->sin6_addr),
+                          node, nodelen))
+            return EAI_SYSTEM;
+          break;
+#endif
+
+        default:
+          return EAI_FAMILY;
+        }
+    }
+
+  if (service && servicelen > 0 && flags & NI_NUMERICSERV)
+    switch (sa->sa_family)
+      {
+#if HAVE_IPV4
+      case AF_INET:
+#endif
+#if HAVE_IPV6
+      case AF_INET6:
+#endif
+        {
+          unsigned short int port
+            = ntohs (((const struct sockaddr_in *) sa)->sin_port);
+          if (servicelen <= snprintf (service, servicelen, "%u", port))
+            return EAI_OVERFLOW;
+        }
+        break;
+      }
+
+  return 0;
+}
diff --git a/gl/getdelim.c b/gl/getdelim.c
index 14a8bce..d80c583 100644
--- a/gl/getdelim.c
+++ b/gl/getdelim.c
@@ -1,5 +1,5 @@
 /* getdelim.c --- Implementation of replacement getdelim function.
-   Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2011 Free Software
+   Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
diff --git a/gl/getline.c b/gl/getline.c
index e6e9187..ab64d80 100644
--- a/gl/getline.c
+++ b/gl/getline.c
@@ -1,5 +1,5 @@
 /* getline.c --- Implementation of replacement getline function.
-   Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2007, 2009-2012 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
diff --git a/gl/getopt.c b/gl/getopt.c
index 7c9f704..4342a34 100644
--- a/gl/getopt.c
+++ b/gl/getopt.c
@@ -2,7 +2,7 @@
    NOTE: getopt is part of the C library, so if you don't know what
    "Keep this file name-space clean" means, talk to address@hidden
    before changing it!
-   Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2011 Free Software
+   Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -41,15 +41,15 @@
 # include <wchar.h>
 #endif
 
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
+/* 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,
+   As 'getopt_long' works, it permutes the elements of ARGV so that,
    when it is done, all the options precede everything else.  Thus
    all application programs are extended to handle flexible argument order.
 
-   Using `getopt' or setting the environment variable POSIXLY_CORRECT
+   Using 'getopt' or setting the environment variable POSIXLY_CORRECT
    disables permutation.
    Then the behavior is completely standard.
 
@@ -58,24 +58,24 @@
 
 #include "getopt_int.h"
 
-/* For communication from `getopt' to the caller.
-   When `getopt' finds an option that takes an argument,
+/* 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,
+   Also, when 'ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
 
 char *optarg;
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
-   and for communication between successive calls to `getopt'.
+   and for communication between successive calls to 'getopt'.
 
-   On entry to `getopt', zero means this is the first call; initialize.
+   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
+   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
+   Otherwise, 'optind' communicates from one call to the next
    how much of ARGV has been scanned so far.  */
 
 /* 1003.2 says this must be 1 before any call.  */
@@ -137,7 +137,7 @@ extern char *__getopt_nonoption_flags;
    The other is elements [last_nonopt,optind), which contains all
    the options processed since those non-options were skipped.
 
-   `first_nonopt' and `last_nonopt' are relocated so that they describe
+   'first_nonopt' and 'last_nonopt' are relocated so that they describe
    the new indices of the non-options in ARGV after they are moved.  */
 
 static void
@@ -154,7 +154,7 @@ exchange (char **argv, struct _getopt_data *d)
      but it consists of two parts that need to be swapped next.  */
 
 #if defined _LIBC && defined USE_NONOPTION_FLAGS
-  /* First make sure the handling of the `__getopt_nonoption_flags'
+  /* First make sure the handling of the '__getopt_nonoption_flags'
      string can work normally.  Our top argument must be in the range
      of the string.  */
   if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len)
@@ -291,48 +291,48 @@ _getopt_initialize (int argc _GL_UNUSED,
 
    If an element of ARGV starts with '-', and is not exactly "-" or "--",
    then it is an option element.  The characters of this element
-   (aside from the initial '-') are option characters.  If `getopt'
+   (aside from the initial '-') are option characters.  If 'getopt'
    is called repeatedly, it returns successively each of the option characters
    from each of the option elements.
 
-   If `getopt' finds another option character, it returns that character,
-   updating `optind' and `nextchar' so that the next call to `getopt' can
+   If 'getopt' finds another option character, it returns that character,
+   updating 'optind' and 'nextchar' so that the next call to 'getopt' can
    resume the scan with the following option character or ARGV-element.
 
-   If there are no more option characters, `getopt' returns -1.
-   Then `optind' is the index in ARGV of the first ARGV-element
+   If there are no more option characters, 'getopt' returns -1.
+   Then 'optind' is the index in ARGV of the first ARGV-element
    that is not an option.  (The ARGV-elements have been permuted
    so that those that are not options now come last.)
 
    OPTSTRING is a string containing the legitimate option characters.
    If an option character is seen that is not listed in OPTSTRING,
-   return '?' after printing an error message.  If you set `opterr' to
+   return '?' after printing an error message.  If you set 'opterr' to
    zero, the error message is suppressed but we still return '?'.
 
    If a char in OPTSTRING is followed by a colon, that means it wants an arg,
    so the following text in the same ARGV-element, or the text of the following
-   ARGV-element, is returned in `optarg'.  Two colons mean an option that
+   ARGV-element, is returned in 'optarg'.  Two colons mean an option that
    wants an optional arg; if there is text in the current ARGV-element,
-   it is returned in `optarg', otherwise `optarg' is set to zero.
+   it is returned in 'optarg', otherwise 'optarg' is set to zero.
 
-   If OPTSTRING starts with `-' or `+', it requests different methods of
+   If OPTSTRING starts with '-' or '+', it requests different methods of
    handling the non-option ARGV-elements.
    See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
 
-   Long-named options begin with `--' instead of `-'.
+   Long-named options begin with '--' instead of '-'.
    Their names may be abbreviated as long as the abbreviation is unique
    or is an exact match for some defined option.  If they have an
    argument, it follows the option name in the same ARGV-element, separated
-   from the option name by a `=', or else the in next ARGV-element.
-   When `getopt' finds a long-named option, it returns 0 if that option's
-   `flag' field is nonzero, the value of the option's `val' field
-   if the `flag' field is zero.
+   from the option name by a '=', or else the in next ARGV-element.
+   When 'getopt' finds a long-named option, it returns 0 if that option's
+   'flag' field is nonzero, the value of the option's 'val' field
+   if the 'flag' field is zero.
 
    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
+   LONGOPTS is a vector of 'struct option' terminated by an
    element containing a name which is zero.
 
    LONGIND returns the index in LONGOPT of the long-named option found.
@@ -409,7 +409,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
           d->__last_nonopt = d->optind;
         }
 
-      /* The special ARGV-element `--' means premature end of options.
+      /* 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.  */
@@ -788,7 +788,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
     char c = *d->__nextchar++;
     const char *temp = strchr (optstring, c);
 
-    /* Increment `optind' when we start to process its last character.  */
+    /* Increment 'optind' when we start to process its last character.  */
     if (*d->__nextchar == '\0')
       ++d->optind;
 
@@ -887,7 +887,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
             return c;
           }
         else
-          /* We already incremented `d->optind' once;
+          /* We already incremented 'd->optind' once;
              increment it again when taking next ARGV-elt as argument.  */
           d->optarg = argv[d->optind++];
 
@@ -1114,7 +1114,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                   c = '?';
               }
             else
-              /* We already incremented `optind' once;
+              /* We already incremented 'optind' once;
                  increment it again when taking next ARGV-elt as argument.  */
               d->optarg = argv[d->optind++];
             d->__nextchar = NULL;
@@ -1177,7 +1177,7 @@ __posix_getopt (int argc, char *const *argv, const char 
*optstring)
 #ifdef TEST
 
 /* Compile with -DTEST to make an executable for use in testing
-   the above definition of `getopt'.  */
+   the above definition of 'getopt'.  */
 
 int
 main (int argc, char **argv)
diff --git a/gl/getopt.in.h b/gl/getopt.in.h
index 0f3918a..06b6dfc 100644
--- a/gl/getopt.in.h
+++ b/gl/getopt.in.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2011 Free Software
+   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -82,7 +82,7 @@
    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',
+   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.
@@ -128,29 +128,29 @@
 extern "C" {
 #endif
 
-/* For communication from `getopt' to the caller.
-   When `getopt' finds an option that takes an argument,
+/* 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,
+   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'.
+   and for communication between successive calls to 'getopt'.
 
-   On entry to `getopt', zero means this is the first call; initialize.
+   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
+   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
+   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
+/* Callers store zero here to inhibit the error message 'getopt' prints
    for unrecognized options.  */
 
 extern int opterr;
@@ -162,24 +162,24 @@ 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
+   of 'struct option' terminated by an element containing a name which is
    zero.
 
-   The field `has_arg' is:
+   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
+   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
+   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.  */
+   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
@@ -194,7 +194,7 @@ struct option
 #  define GNULIB_defined_struct_option 1
 # endif
 
-/* Names for the values of the `has_arg' field of `struct option'.  */
+/* Names for the values of the 'has_arg' field of 'struct option'.  */
 
 # define no_argument            0
 # define required_argument      1
@@ -208,23 +208,23 @@ struct option
 
    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
+   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'.
+   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'.
+   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
+   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
+   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
+   '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)
diff --git a/gl/getopt1.c b/gl/getopt1.c
index 3656802..fb2a8f5 100644
--- a/gl/getopt1.c
+++ b/gl/getopt1.c
@@ -1,5 +1,5 @@
 /* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2011 Free Software
+   Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -141,11 +141,11 @@ main (int argc, char **argv)
           break;
 
         case 'c':
-          printf ("option c with value `%s'\n", optarg);
+          printf ("option c with value '%s'\n", optarg);
           break;
 
         case 'd':
-          printf ("option d with value `%s'\n", optarg);
+          printf ("option d with value '%s'\n", optarg);
           break;
 
         case '?':
diff --git a/gl/getopt_int.h b/gl/getopt_int.h
index 9f0c713..2da020c 100644
--- a/gl/getopt_int.h
+++ b/gl/getopt_int.h
@@ -1,5 +1,5 @@
 /* Internal declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2011 Free Software
+   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -40,7 +40,7 @@ extern int _getopt_internal (int ___argc, char **___argv,
    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
+   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
@@ -52,12 +52,12 @@ extern int _getopt_internal (int ___argc, char **___argv,
    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
+   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.  */
+   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
   {
@@ -99,8 +99,8 @@ struct _getopt_data
   /* Handle permutation of arguments.  */
 
   /* Describe the part of ARGV that contains non-options that have
-     been skipped.  `first_nonopt' is the index in ARGV of the first
-     of them; `last_nonopt' is the index after the last of them.  */
+     been skipped.  'first_nonopt' is the index in ARGV of the first
+     of them; 'last_nonopt' is the index after the last of them.  */
 
   int __first_nonopt;
   int __last_nonopt;
diff --git a/gl/getpass.c b/gl/getpass.c
index 90392f9..25f1e18 100644
--- a/gl/getpass.c
+++ b/gl/getpass.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2001, 2003-2007, 2009-2012 Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
 
diff --git a/gl/getpass.h b/gl/getpass.h
index f1e67b5..0d923c6 100644
--- a/gl/getpass.h
+++ b/gl/getpass.h
@@ -1,5 +1,5 @@
 /* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin.
-   Copyright (C) 2004, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2009-2012 Free Software Foundation, Inc.
    Contributed by Simon Josefsson <address@hidden>, 2004.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/getpeername.c b/gl/getpeername.c
index abe5a40..01493aa 100644
--- a/gl/getpeername.c
+++ b/gl/getpeername.c
@@ -1,6 +1,6 @@
 /* getpeername.c --- wrappers for Windows getpeername function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/getsubopt.c b/gl/getsubopt.c
index ab74d03..105ceed 100644
--- a/gl/getsubopt.c
+++ b/gl/getsubopt.c
@@ -1,5 +1,5 @@
 /* Parse comma separated list into words.
-   Copyright (C) 1996-1997, 1999, 2004, 2007, 2009-2011 Free Software
+   Copyright (C) 1996-1997, 1999, 2004, 2007, 2009-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <address@hidden>, 1996.
diff --git a/gl/gettext.h b/gl/gettext.h
index 792e506..050134a 100644
--- a/gl/gettext.h
+++ b/gl/gettext.h
@@ -1,5 +1,5 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/gettime.c b/gl/gettime.c
index 6dbb457..8075bfa 100644
--- a/gl/gettime.c
+++ b/gl/gettime.c
@@ -1,6 +1,6 @@
 /* gettime -- get the system clock
 
-   Copyright (C) 2002, 2004-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004-2007, 2009-2012 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
diff --git a/gl/gettimeofday.c b/gl/gettimeofday.c
index adfb51f..3c0fdd9 100644
--- a/gl/gettimeofday.c
+++ b/gl/gettimeofday.c
@@ -1,6 +1,6 @@
 /* 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.
+   Copyright (C) 2001-2003, 2005-2007, 2009-2012 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
diff --git a/gl/inet_ntop.c b/gl/inet_ntop.c
index c11b1e0..eeffcbe 100644
--- a/gl/inet_ntop.c
+++ b/gl/inet_ntop.c
@@ -1,6 +1,6 @@
 /* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
 
-   Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2012 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
@@ -74,7 +74,7 @@ static const char *inet_ntop6 (const unsigned char *src, char 
*dst, socklen_t si
  * inet_ntop(af, src, dst, size)
  *      convert a network format address to presentation format.
  * return:
- *      pointer to presentation format address (`dst'), or NULL (see errno).
+ *      pointer to presentation format address ('dst'), or NULL (see errno).
  * author:
  *      Paul Vixie, 1996.
  */
@@ -105,7 +105,7 @@ inet_ntop (int af, const void *restrict src,
  * inet_ntop4(src, dst, size)
  *      format an IPv4 address
  * return:
- *      `dst' (as a const)
+ *      'dst' (as a const)
  * notes:
  *      (1) uses no statics
  *      (2) takes a u_char* not an in_addr as input
diff --git a/gl/inet_pton.c b/gl/inet_pton.c
index cb1a872..4096365 100644
--- a/gl/inet_pton.c
+++ b/gl/inet_pton.c
@@ -1,6 +1,6 @@
 /* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
 
-   Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2008-2012 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
@@ -73,8 +73,8 @@ static int inet_pton6 (const char *src, unsigned char *dst);
  *      to network format (which is usually some kind of binary format).
  * return:
  *      1 if the address was valid for the specified address family
- *      0 if the address wasn't valid (`dst' is untouched in this case)
- *      -1 if some other error occurred (`dst' is untouched in this case, too)
+ *      0 if the address wasn't valid ('dst' is untouched in this case)
+ *      -1 if some other error occurred ('dst' is untouched in this case, too)
  * author:
  *      Paul Vixie, 1996.
  */
@@ -103,9 +103,9 @@ inet_pton (int af, const char *restrict src, void *restrict 
dst)
  *      like inet_aton() but without all the hexadecimal, octal (with the
  *      exception of 0) and shorthand.
  * return:
- *      1 if `src' is a valid dotted quad, else 0.
+ *      1 if 'src' is a valid dotted quad, else 0.
  * notice:
- *      does not touch `dst' unless it's returning 1.
+ *      does not touch 'dst' unless it's returning 1.
  * author:
  *      Paul Vixie, 1996.
  */
@@ -159,9 +159,9 @@ inet_pton4 (const char *restrict src, unsigned char 
*restrict dst)
  * inet_pton6(src, dst)
  *      convert presentation level address to network order binary form.
  * return:
- *      1 if `src' is a valid [RFC1884 2.2] address, else 0.
+ *      1 if 'src' is a valid [RFC1884 2.2] address, else 0.
  * notice:
- *      (1) does not touch `dst' unless it's returning 1.
+ *      (1) does not touch 'dst' unless it's returning 1.
  *      (2) :: in a full address is silently ignored.
  * credit:
  *      inspired by Mark Andrews.
diff --git a/gl/intprops.h b/gl/intprops.h
index 1f6a539..2485c78 100644
--- a/gl/intprops.h
+++ b/gl/intprops.h
@@ -1,6 +1,6 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001-2005, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2001-2005, 2009-2012 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
diff --git a/gl/isnan.c b/gl/isnan.c
index 1d0754c..a5a7d92 100644
--- a/gl/isnan.c
+++ b/gl/isnan.c
@@ -1,5 +1,5 @@
 /* Test for NaN that does not need libm.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
@@ -21,7 +21,7 @@
 /* Specification.  */
 #ifdef USE_LONG_DOUBLE
 /* Specification found in math.h or isnanl-nolibm.h.  */
-extern int rpl_isnanl (long double x);
+extern int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
 #elif ! defined USE_FLOAT
 /* Specification found in math.h or isnand-nolibm.h.  */
 extern int rpl_isnand (double x);
diff --git a/gl/isnand-nolibm.h b/gl/isnand-nolibm.h
index 4c49c32..56fb270 100644
--- a/gl/isnand-nolibm.h
+++ b/gl/isnand-nolibm.h
@@ -1,5 +1,5 @@
 /* Test for NaN that does not need libm.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/isnand.c b/gl/isnand.c
index c47ff25..ef815f3 100644
--- a/gl/isnand.c
+++ b/gl/isnand.c
@@ -1,5 +1,5 @@
 /* Test for NaN that does not need libm.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/isnanf-nolibm.h b/gl/isnanf-nolibm.h
index 1a1cbf9..5270387 100644
--- a/gl/isnanf-nolibm.h
+++ b/gl/isnanf-nolibm.h
@@ -1,5 +1,5 @@
 /* Test for NaN that does not need libm.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/isnanf.c b/gl/isnanf.c
index adb7059..0816704 100644
--- a/gl/isnanf.c
+++ b/gl/isnanf.c
@@ -1,5 +1,5 @@
 /* Test for NaN that does not need libm.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/isnanl-nolibm.h b/gl/isnanl-nolibm.h
index bf14228..58d963d 100644
--- a/gl/isnanl-nolibm.h
+++ b/gl/isnanl-nolibm.h
@@ -1,5 +1,5 @@
 /* Test for NaN that does not need libm.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/isnanl.c b/gl/isnanl.c
index 1482fb2..597ac2a 100644
--- a/gl/isnanl.c
+++ b/gl/isnanl.c
@@ -1,5 +1,5 @@
 /* Test for NaN that does not need libm.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/itold.c b/gl/itold.c
index 0236f33..95ff7e1 100644
--- a/gl/itold.c
+++ b/gl/itold.c
@@ -1,5 +1,5 @@
 /* Replacement for 'int' to 'long double' conversion routine.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2011.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/listen.c b/gl/listen.c
index b7d070e..a1b2ab7 100644
--- a/gl/listen.c
+++ b/gl/listen.c
@@ -1,6 +1,6 @@
 /* listen.c --- wrappers for Windows listen function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/lseek.c b/gl/lseek.c
index 8c9834f..5433678 100644
--- a/gl/lseek.c
+++ b/gl/lseek.c
@@ -1,5 +1,5 @@
 /* An lseek() function that detects pipes.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4
index 7feed46..d978cb8 100644
--- a/gl/m4/00gnulib.m4
+++ b/gl/m4/00gnulib.m4
@@ -1,5 +1,5 @@
 # 00gnulib.m4 serial 2
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 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.
diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4
index a8744a8..656924b 100644
--- a/gl/m4/alloca.m4
+++ b/gl/m4/alloca.m4
@@ -1,5 +1,5 @@
-# alloca.m4 serial 13
-dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation,
+# alloca.m4 serial 14
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2012 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,
@@ -53,8 +53,8 @@ m4_version_prereq([2.69], [] ,[
 
 # _AC_LIBOBJ_ALLOCA
 # -----------------
-# Set up the LIBOBJ replacement of `alloca'.  Well, not exactly
-# AC_LIBOBJ since we actually set the output variable `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
@@ -63,9 +63,9 @@ m4_define([_AC_LIBOBJ_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_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_CACHE_CHECK(whether 'alloca.c' needs Cray hooks, ac_cv_os_cray,
 [AC_EGREP_CPP(webecray,
 [#if defined CRAY && ! defined CRAY2
 webecray
@@ -77,10 +77,10 @@ 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
+                                      [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.])
+                                       'alloca.c' support on those systems.])
     break])
   done
 fi
diff --git a/gl/m4/alphasort.m4 b/gl/m4/alphasort.m4
index e59aa74..6ca985e 100644
--- a/gl/m4/alphasort.m4
+++ b/gl/m4/alphasort.m4
@@ -1,5 +1,5 @@
 # alphasort.m4 serial 2
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 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.
diff --git a/gl/m4/argp.m4 b/gl/m4/argp.m4
index a9963ee..87c7da6 100644
--- a/gl/m4/argp.m4
+++ b/gl/m4/argp.m4
@@ -1,5 +1,5 @@
 # argp.m4 serial 13
-dnl Copyright (C) 2003-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2012 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.
diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4
index 1df7401..36915d1 100644
--- a/gl/m4/arpa_inet_h.m4
+++ b/gl/m4/arpa_inet_h.m4
@@ -1,5 +1,5 @@
 # arpa_inet_h.m4 serial 13
-dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2012 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.
diff --git a/gl/m4/byteswap.m4 b/gl/m4/byteswap.m4
index 2d4de46..f3b7ec9 100644
--- a/gl/m4/byteswap.m4
+++ b/gl/m4/byteswap.m4
@@ -1,5 +1,5 @@
 # byteswap.m4 serial 4
-dnl Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2007, 2009-2012 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.
diff --git a/gl/m4/clock_time.m4 b/gl/m4/clock_time.m4
index 3c08512..0bec0ef 100644
--- a/gl/m4/clock_time.m4
+++ b/gl/m4/clock_time.m4
@@ -1,5 +1,5 @@
 # clock_time.m4 serial 10
-dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2012 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.
diff --git a/gl/m4/close.m4 b/gl/m4/close.m4
index f860a32..379e70d 100644
--- a/gl/m4/close.m4
+++ b/gl/m4/close.m4
@@ -1,5 +1,5 @@
 # close.m4 serial 8
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/closedir.m4 b/gl/m4/closedir.m4
index 1b7912a..8a2fba4 100644
--- a/gl/m4/closedir.m4
+++ b/gl/m4/closedir.m4
@@ -1,5 +1,5 @@
-# closedir.m4 serial 1
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+# closedir.m4 serial 2
+dnl Copyright (C) 2011-2012 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.
@@ -17,7 +17,9 @@ AC_DEFUN([gl_FUNC_CLOSEDIR],
   m4_ifdef([gl_FUNC_FCHDIR], [
     gl_TEST_FCHDIR
     if test $HAVE_FCHDIR = 0; then
-      REPLACE_CLOSEDIR=1
+      if test $HAVE_CLOSEDIR = 1; then
+        REPLACE_CLOSEDIR=1
+      fi
     fi
   ])
 ])
diff --git a/gl/m4/codeset.m4 b/gl/m4/codeset.m4
index da73552..cf53d24 100644
--- a/gl/m4/codeset.m4
+++ b/gl/m4/codeset.m4
@@ -1,5 +1,5 @@
 # codeset.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2000-2002, 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2006, 2008-2012 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.
diff --git a/gl/m4/dirent_h.m4 b/gl/m4/dirent_h.m4
index ab45170..f6c0fa7 100644
--- a/gl/m4/dirent_h.m4
+++ b/gl/m4/dirent_h.m4
@@ -1,5 +1,5 @@
 # dirent_h.m4 serial 16
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/dirname.m4 b/gl/m4/dirname.m4
index dcec7e4..65639ec 100644
--- a/gl/m4/dirname.m4
+++ b/gl/m4/dirname.m4
@@ -1,5 +1,5 @@
 #serial 10   -*- autoconf -*-
-dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2012 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.
diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4
index 16a4e3e..1e03751 100644
--- a/gl/m4/double-slash-root.m4
+++ b/gl/m4/double-slash-root.m4
@@ -1,5 +1,5 @@
 # double-slash-root.m4 serial 4   -*- Autoconf -*-
-dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2012 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.
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4
index cd9d254..dec27fa 100644
--- a/gl/m4/dup2.m4
+++ b/gl/m4/dup2.m4
@@ -1,5 +1,5 @@
-#serial 16
-dnl Copyright (C) 2002, 2005, 2007, 2009-2011 Free Software Foundation, Inc.
+#serial 17
+dnl Copyright (C) 2002, 2005, 2007, 2009-2012 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.
@@ -67,7 +67,9 @@ AC_DEFUN([gl_FUNC_DUP2],
   m4_ifdef([gl_FUNC_FCHDIR], [
     gl_TEST_FCHDIR
     if test $HAVE_FCHDIR = 0; then
-      REPLACE_DUP2=1
+      if test $HAVE_DUP2 = 1; then
+        REPLACE_DUP2=1
+      fi
     fi
   ])
 ])
diff --git a/gl/m4/eealloc.m4 b/gl/m4/eealloc.m4
index 3006c48..75f17e2 100644
--- a/gl/m4/eealloc.m4
+++ b/gl/m4/eealloc.m4
@@ -1,5 +1,5 @@
 # eealloc.m4 serial 2
-dnl Copyright (C) 2003, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2009-2012 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.
diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4
index 6c7982f..8eb57c9 100644
--- a/gl/m4/environ.m4
+++ b/gl/m4/environ.m4
@@ -1,5 +1,5 @@
 # environ.m4 serial 6
-dnl Copyright (C) 2001-2004, 2006-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2004, 2006-2012 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.
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4
index 560adba..4f0bb83 100644
--- a/gl/m4/errno_h.m4
+++ b/gl/m4/errno_h.m4
@@ -1,5 +1,5 @@
 # errno_h.m4 serial 10
-dnl Copyright (C) 2004, 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006, 2008-2012 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.
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4
index e7022fe..5d9c70a 100644
--- a/gl/m4/error.m4
+++ b/gl/m4/error.m4
@@ -1,6 +1,6 @@
 #serial 14
 
-# Copyright (C) 1996-1998, 2001-2004, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 1996-1998, 2001-2004, 2009-2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/gl/m4/exponentd.m4 b/gl/m4/exponentd.m4
index 7e91924..48df999 100644
--- a/gl/m4/exponentd.m4
+++ b/gl/m4/exponentd.m4
@@ -1,5 +1,5 @@
 # exponentd.m4 serial 2
-dnl Copyright (C) 2007-2008, 2010-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2008, 2010-2012 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.
diff --git a/gl/m4/exponentf.m4 b/gl/m4/exponentf.m4
index 3a00840..94d1167 100644
--- a/gl/m4/exponentf.m4
+++ b/gl/m4/exponentf.m4
@@ -1,5 +1,5 @@
 # exponentf.m4 serial 2
-dnl Copyright (C) 2007-2008, 2010-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2008, 2010-2012 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.
diff --git a/gl/m4/exponentl.m4 b/gl/m4/exponentl.m4
index 2e706b2..a7cd13b 100644
--- a/gl/m4/exponentl.m4
+++ b/gl/m4/exponentl.m4
@@ -1,5 +1,5 @@
 # exponentl.m4 serial 3
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
index 22156e0..0bfaef6 100644
--- a/gl/m4/extensions.m4
+++ b/gl/m4/extensions.m4
@@ -1,7 +1,7 @@
-# serial 10  -*- Autoconf -*-
+# serial 11  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2012 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.
@@ -43,7 +43,7 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
   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
+      [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
diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4
index bee6edc..9862741 100644
--- a/gl/m4/fcntl-o.m4
+++ b/gl/m4/fcntl-o.m4
@@ -1,5 +1,5 @@
 # fcntl-o.m4 serial 4
-dnl Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2009-2012 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.
diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4
index 03a41e6..cac28ae 100644
--- a/gl/m4/fcntl_h.m4
+++ b/gl/m4/fcntl_h.m4
@@ -1,6 +1,6 @@
 # serial 15
 # Configure fcntl.h.
-dnl Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2007, 2009-2012 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.
diff --git a/gl/m4/fdopen.m4 b/gl/m4/fdopen.m4
index 8cae2fc..9ca9d2a 100644
--- a/gl/m4/fdopen.m4
+++ b/gl/m4/fdopen.m4
@@ -1,5 +1,5 @@
 # fdopen.m4 serial 2
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2012 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.
diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4
index 0420e06..51c9c7b 100644
--- a/gl/m4/float_h.m4
+++ b/gl/m4/float_h.m4
@@ -1,5 +1,5 @@
 # float_h.m4 serial 9
-dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/fpieee.m4 b/gl/m4/fpieee.m4
index 7872876..93b8d90 100644
--- a/gl/m4/fpieee.m4
+++ b/gl/m4/fpieee.m4
@@ -1,5 +1,5 @@
 # fpieee.m4 serial 1
-dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/frexp.m4 b/gl/m4/frexp.m4
index b0bdd10..4162195 100644
--- a/gl/m4/frexp.m4
+++ b/gl/m4/frexp.m4
@@ -1,5 +1,5 @@
 # frexp.m4 serial 13
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/frexpl.m4 b/gl/m4/frexpl.m4
index 91f2a35..8e71420 100644
--- a/gl/m4/frexpl.m4
+++ b/gl/m4/frexpl.m4
@@ -1,5 +1,5 @@
 # frexpl.m4 serial 18
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4
index 135a22b..d9cd70a 100644
--- a/gl/m4/fseek.m4
+++ b/gl/m4/fseek.m4
@@ -1,5 +1,5 @@
 # fseek.m4 serial 4
-dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4
index 391948d..be5bb35 100644
--- a/gl/m4/fseeko.m4
+++ b/gl/m4/fseeko.m4
@@ -1,5 +1,5 @@
 # fseeko.m4 serial 15
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/fstat.m4 b/gl/m4/fstat.m4
index 0daea88..e3f8f3e 100644
--- a/gl/m4/fstat.m4
+++ b/gl/m4/fstat.m4
@@ -1,5 +1,5 @@
 # fstat.m4 serial 1
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2012 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.
diff --git a/gl/m4/ftell.m4 b/gl/m4/ftell.m4
index c529c50..ed8d014 100644
--- a/gl/m4/ftell.m4
+++ b/gl/m4/ftell.m4
@@ -1,5 +1,5 @@
 # ftell.m4 serial 3
-dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4
index 10cf429..42be83e 100644
--- a/gl/m4/ftello.m4
+++ b/gl/m4/ftello.m4
@@ -1,5 +1,5 @@
 # ftello.m4 serial 10
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/ftruncate.m4 b/gl/m4/ftruncate.m4
index 4a47ba4..1007f34 100644
--- a/gl/m4/ftruncate.m4
+++ b/gl/m4/ftruncate.m4
@@ -2,7 +2,7 @@
 
 # See if we need to emulate a missing ftruncate function using chsize.
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2012 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.
diff --git a/gl/m4/func.m4 b/gl/m4/func.m4
index dcd2d4f..13c204d 100644
--- a/gl/m4/func.m4
+++ b/gl/m4/func.m4
@@ -1,5 +1,5 @@
 # func.m4 serial 2
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
new file mode 100644
index 0000000..9cd3e67
--- /dev/null
+++ b/gl/m4/getaddrinfo.m4
@@ -0,0 +1,210 @@
+# getaddrinfo.m4 serial 29
+dnl Copyright (C) 2004-2012 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_GETADDRINFO],
+[
+  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+  AC_REQUIRE([gl_HEADER_NETDB])dnl for HAVE_NETDB_H
+  AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo])
+  GETADDRINFO_LIB=
+  gai_saved_LIBS="$LIBS"
+
+  dnl Where is getaddrinfo()?
+  dnl - On Solaris, it is in libsocket.
+  dnl - On Haiku, it is in libnetwork.
+  dnl - On BeOS, it is in libnet.
+  dnl - On native Windows, it is in ws2_32.dll.
+  dnl - Otherwise it is in libc.
+  AC_SEARCH_LIBS([getaddrinfo], [socket network net],
+    [if test "$ac_cv_search_getaddrinfo" != "none required"; then
+       GETADDRINFO_LIB="$ac_cv_search_getaddrinfo"
+     fi])
+  LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
+
+  HAVE_GETADDRINFO=1
+  AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#include <stddef.h>
+]], [[getaddrinfo("", "", NULL, NULL);]])],
+      [gl_cv_func_getaddrinfo=yes],
+      [gl_cv_func_getaddrinfo=no])])
+  if test $gl_cv_func_getaddrinfo = no; then
+    AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32],
+                   gl_cv_w32_getaddrinfo, [
+      gl_cv_w32_getaddrinfo=no
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS -lws2_32"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#include <stddef.h>
+]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes])
+      LIBS="$am_save_LIBS"
+    ])
+    if test "$gl_cv_w32_getaddrinfo" = "yes"; then
+      GETADDRINFO_LIB="-lws2_32"
+      LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
+    else
+      HAVE_GETADDRINFO=0
+    fi
+  fi
+
+  # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
+  # inline function declared in ws2tcpip.h, so we need to get that
+  # header included somehow.
+  AC_CHECK_DECLS([gai_strerror], [], [], [[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#include <stddef.h>
+]])
+  if test $ac_cv_have_decl_gai_strerror = yes; then
+    AC_CHECK_DECLS([gai_strerrorA], [], [], [[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#include <stddef.h>
+]])
+    dnl check for correct signature
+    AC_CACHE_CHECK([for gai_strerror with POSIX signature],
+     [gl_cv_func_gai_strerror_posix_signature], [
+      AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#include <stddef.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *gai_strerror(int);]])],
+        [gl_cv_func_gai_strerror_posix_signature=yes],
+        [gl_cv_func_gai_strerror_posix_signature=no])])
+    if test $gl_cv_func_gai_strerror_posix_signature = no; then
+      REPLACE_GAI_STRERROR=1
+    fi
+  fi
+
+  LIBS="$gai_saved_LIBS"
+
+  gl_PREREQ_GETADDRINFO
+
+  AC_SUBST([GETADDRINFO_LIB])
+])
+
+# Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c.
+AC_DEFUN([gl_PREREQ_GETADDRINFO], [
+  AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+  AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB
+  AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB
+  AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([gl_SOCKET_FAMILIES])
+  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+  AC_REQUIRE([AC_C_INLINE])
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl Including sys/socket.h is wrong for Windows, but Windows does not
+  dnl have sa_len so the result is correct anyway.
+  AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [
+#include <sys/types.h>
+#include <sys/socket.h>
+])
+
+  AC_CHECK_HEADERS_ONCE([netinet/in.h])
+
+  AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, getnameinfo],,,[[
+  /* 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 <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+]])
+  if test $ac_cv_have_decl_getaddrinfo = no; then
+    HAVE_DECL_GETADDRINFO=0
+  fi
+  if test $ac_cv_have_decl_freeaddrinfo = no; then
+    HAVE_DECL_FREEADDRINFO=0
+  fi
+  if test $ac_cv_have_decl_gai_strerror = no; then
+    HAVE_DECL_GAI_STRERROR=0
+  fi
+  if test $ac_cv_have_decl_getnameinfo = no; then
+    HAVE_DECL_GETNAMEINFO=0
+  fi
+
+  AC_CHECK_TYPES([struct addrinfo],,,[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+])
+  if test $ac_cv_type_struct_addrinfo = no; then
+    HAVE_STRUCT_ADDRINFO=0
+  fi
+
+  dnl Append $HOSTENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
+  case " $GETADDRINFO_LIB " in
+    *" $HOSTENT_LIB "*) ;;
+    *) GETADDRINFO_LIB="$GETADDRINFO_LIB $HOSTENT_LIB" ;;
+  esac
+
+  dnl Append $SERVENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
+  case " $GETADDRINFO_LIB " in
+    *" $SERVENT_LIB "*) ;;
+    *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;;
+  esac
+
+  dnl Append $INET_NTOP_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
+  case " $GETADDRINFO_LIB " in
+    *" $INET_NTOP_LIB "*) ;;
+    *) GETADDRINFO_LIB="$GETADDRINFO_LIB $INET_NTOP_LIB" ;;
+  esac
+])
diff --git a/gl/m4/getcwd.m4 b/gl/m4/getcwd.m4
index f828cf3..ccb1f47 100644
--- a/gl/m4/getcwd.m4
+++ b/gl/m4/getcwd.m4
@@ -1,12 +1,12 @@
 # getcwd.m4 - check for working getcwd that is compatible with glibc
 
-# Copyright (C) 2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003-2007, 2009-2012 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.
-# serial 9
+# serial 11
 
 AC_DEFUN([gl_FUNC_GETCWD_NULL],
   [
@@ -108,20 +108,43 @@ AC_DEFUN([gl_FUNC_GETCWD],
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
 
   gl_abort_bug=no
-  case $gl_cv_func_getcwd_null,$host_os in
-  *,mingw*)
-    gl_cv_func_getcwd_path_max=yes;;
-  yes,*)
-    gl_FUNC_GETCWD_PATH_MAX
-    gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes]);;
+  case "$host_os" in
+    mingw*)
+      gl_cv_func_getcwd_path_max=yes
+      ;;
+    *)
+      gl_FUNC_GETCWD_PATH_MAX
+      case "$gl_cv_func_getcwd_null" in
+        *yes)
+          gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes])
+          ;;
+      esac
+      ;;
   esac
-
-  case 
$gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature$gl_cv_func_getcwd_path_max,$gl_abort_bug
 in
-  *yes,yes,yes,no) ;;
-  *)
-    dnl Full replacement lib/getcwd.c, overrides LGPL replacement.
-    REPLACE_GETCWD=1;;
+  dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD
+  dnl if appropriate.
+  case "$gl_cv_func_getcwd_path_max" in
+    "no, it has the AIX bug") ;;
+    *)
+      AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1],
+        [Define to 1 if getcwd minimally works, that is, its result can be
+         trusted when it succeeds.])
+      ;;
+  esac
+  case "$gl_cv_func_getcwd_path_max" in
+    "no, but it is partly working")
+      AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1],
+        [Define to 1 if getcwd works, except it sometimes fails when it
+         shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.])
+      ;;
   esac
+
+  if { case "$gl_cv_func_getcwd_null" in *yes) false;; *) true;; esac; } \
+     || test $gl_cv_func_getcwd_posix_signature != yes \
+     || test "$gl_cv_func_getcwd_path_max" != yes \
+     || test $gl_abort_bug = yes; then
+    REPLACE_GETCWD=1
+  fi
 ])
 
 # Prerequisites of lib/getcwd.c, when full replacement is in effect.
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4
index 6a0f632..8bd3d3f 100644
--- a/gl/m4/getdelim.m4
+++ b/gl/m4/getdelim.m4
@@ -1,6 +1,6 @@
 # getdelim.m4 serial 9
 
-dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2007, 2009-2012 Free Software Foundation, Inc.
 dnl
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4
index 4c57797..01f38cf 100644
--- a/gl/m4/getline.m4
+++ b/gl/m4/getline.m4
@@ -1,6 +1,6 @@
 # getline.m4 serial 25
 
-dnl Copyright (C) 1998-2003, 2005-2007, 2009-2011 Free Software Foundation,
+dnl Copyright (C) 1998-2003, 2005-2007, 2009-2012 Free Software Foundation,
 dnl Inc.
 dnl
 dnl This file is free software; the Free Software Foundation
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
index 047a3db..2aea895 100644
--- a/gl/m4/getopt.m4
+++ b/gl/m4/getopt.m4
@@ -1,5 +1,5 @@
-# getopt.m4 serial 38
-dnl Copyright (C) 2002-2006, 2008-2011 Free Software Foundation, Inc.
+# getopt.m4 serial 39
+dnl Copyright (C) 2002-2006, 2008-2012 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.
@@ -25,8 +25,6 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX],
   if test $REPLACE_GETOPT = 1; then
     dnl Arrange for getopt.h to be created.
     gl_GETOPT_SUBSTITUTE_HEADER
-    dnl Arrange for unistd.h to include getopt.h.
-    GNULIB_UNISTD_H_GETOPT=1
   fi
 ])
 
diff --git a/gl/m4/getpagesize.m4 b/gl/m4/getpagesize.m4
index f7ac1ef..156133a 100644
--- a/gl/m4/getpagesize.m4
+++ b/gl/m4/getpagesize.m4
@@ -1,5 +1,5 @@
 # getpagesize.m4 serial 9
-dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2011 Free Software Foundation,
+dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2012 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,
diff --git a/gl/m4/getpass.m4 b/gl/m4/getpass.m4
index 13e55f6..2a7e160 100644
--- a/gl/m4/getpass.m4
+++ b/gl/m4/getpass.m4
@@ -1,5 +1,5 @@
 # getpass.m4 serial 14
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2012 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,
diff --git a/gl/m4/getsubopt.m4 b/gl/m4/getsubopt.m4
index 827d8c5..5538941 100644
--- a/gl/m4/getsubopt.m4
+++ b/gl/m4/getsubopt.m4
@@ -1,5 +1,5 @@
 # getsubopt.m4 serial 5
-dnl Copyright (C) 2004, 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2007, 2009-2012 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.
diff --git a/gl/m4/gettext.m4 b/gl/m4/gettext.m4
index cab4dfc..5415f88 100644
--- a/gl/m4/gettext.m4
+++ b/gl/m4/gettext.m4
@@ -1,5 +1,5 @@
 # gettext.m4 serial 64 (gettext-0.18.2)
-dnl Copyright (C) 1995-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2012 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.
@@ -35,7 +35,7 @@ dnl    will be ignored.  If NEEDSYMBOL is specified and is
 dnl    'need-formatstring-macros', then GNU gettext implementations that don't
 dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
 dnl INTLDIR is used to find the intl libraries.  If empty,
-dnl    the value `$(top_builddir)/intl/' is used.
+dnl    the value '$(top_builddir)/intl/' is used.
 dnl
 dnl The result of the configuration is one of three cases:
 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
diff --git a/gl/m4/gettime.m4 b/gl/m4/gettime.m4
index f2122dc..7d03d12 100644
--- a/gl/m4/gettime.m4
+++ b/gl/m4/gettime.m4
@@ -1,5 +1,5 @@
 # gettime.m4 serial 8
-dnl Copyright (C) 2002, 2004-2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004-2006, 2009-2012 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.
diff --git a/gl/m4/gettimeofday.m4 b/gl/m4/gettimeofday.m4
index 47c1e1d..2385e39 100644
--- a/gl/m4/gettimeofday.m4
+++ b/gl/m4/gettimeofday.m4
@@ -1,6 +1,6 @@
 # serial 17
 
-# Copyright (C) 2001-2003, 2005, 2007, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2001-2003, 2005, 2007, 2009-2012 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.
diff --git a/gl/m4/glibc2.m4 b/gl/m4/glibc2.m4
index a5fe3cf..f4c4ad1 100644
--- a/gl/m4/glibc2.m4
+++ b/gl/m4/glibc2.m4
@@ -1,5 +1,5 @@
 # glibc2.m4 serial 3
-dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2011 Free Software Foundation,
+dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2012 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,
diff --git a/gl/m4/glibc21.m4 b/gl/m4/glibc21.m4
index bc81c11..c938fb1 100644
--- a/gl/m4/glibc21.m4
+++ b/gl/m4/glibc21.m4
@@ -1,5 +1,5 @@
 # glibc21.m4 serial 5
-dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2011 Free Software Foundation,
+dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2012 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,
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index 409b70b..74c1b39 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2011 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 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
@@ -27,7 +27,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu 
--source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests 
--aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests 
--no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept 
alloca alphasort argp bind byteswap c-ctype close connect error extensions func 
getpass getsubopt gettext gettime havelib inet_ntop inet_pton lib-msvc-compat 
lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple 
minmax netdb netinet_in pmccabe2html progname read-file recv recvfrom scandir 
select send sendto setsockopt shutdown snprintf socket sockets socklen stdint 
strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd 
valgrind-tests vasprintf version-etc version-etc-fsf vfprintf-posix 
vprintf-posix vsnprintf warnings
+#   gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu 
--source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests 
--aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests 
--no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept 
alloca alphasort argp bind byteswap c-ctype close connect error extensions 
freeaddrinfo func getaddrinfo getnameinfo getpass getsubopt gettext gettime 
havelib inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen 
maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in 
pmccabe2html progname read-file recv recvfrom scandir select send sendto 
setsockopt shutdown snprintf socket sockets socklen stdint strcase strverscmp 
sys_socket sys_stat time_r timespec u64 unistd usleep valgrind-tests vasprintf 
version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([gl/override])
@@ -43,7 +43,10 @@ gl_MODULES([
   connect
   error
   extensions
+  freeaddrinfo
   func
+  getaddrinfo
+  getnameinfo
   getpass
   getsubopt
   gettext
@@ -84,6 +87,7 @@ gl_MODULES([
   timespec
   u64
   unistd
+  usleep
   valgrind-tests
   vasprintf
   version-etc
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index 7d83299..ae4d254 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
-# gnulib-common.m4 serial 31
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 32
+dnl Copyright (C) 2007-2012 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.
@@ -13,12 +13,12 @@ AC_DEFUN([gl_COMMON], [
 ])
 AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([_Noreturn],
-[/* The _Noreturn keyword of draft C1X.  */
+[/* The _Noreturn keyword of C11.  */
 #ifndef _Noreturn
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
-# elif 1200 <= _MSC_VER
+# elif defined _MSC_VER && 1200 <= _MSC_VER
 #  define _Noreturn __declspec (noreturn)
 # else
 #  define _Noreturn
@@ -224,7 +224,7 @@ m4_ifndef([AS_VAR_IF],
 # - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options
 #   to CC twice
 #   <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00431.html>.
-# - AC_PROG_CC_STDC is likely to change when C1X is an ISO standard.
+# - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard.
 AC_DEFUN([gl_PROG_CC_C99],
 [
   dnl Change that version number to the minimum Autoconf version that supports
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index fe23cdf..fcf7b8d 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2011 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 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
@@ -113,6 +113,8 @@ AC_DEFUN([gl_EARLY],
   # Code from module func:
   # Code from module func-tests:
   # Code from module fwrite-tests:
+  # Code from module getaddrinfo:
+  # Code from module getaddrinfo-tests:
   # Code from module getcwd-lgpl:
   # Code from module getcwd-lgpl-tests:
   # Code from module getdelim:
@@ -134,6 +136,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module gettimeofday-tests:
   # Code from module gnumakefile:
   # Code from module havelib:
+  # Code from module hostent:
   # Code from module ignore-value:
   # Code from module ignore-value-tests:
   # Code from module include_next:
@@ -222,6 +225,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module send-tests:
   # Code from module sendto:
   # Code from module sendto-tests:
+  # Code from module servent:
   # Code from module setenv:
   # Code from module setenv-tests:
   # Code from module setsockopt:
@@ -303,6 +307,8 @@ AC_DEFUN([gl_EARLY],
   # Code from module sys_uio-tests:
   # Code from module sysexits:
   # Code from module sysexits-tests:
+  # Code from module test-framework-sh:
+  # Code from module test-framework-sh-tests:
   # Code from module thread:
   # Code from module thread-tests:
   # Code from module threadlib:
@@ -318,6 +324,8 @@ AC_DEFUN([gl_EARLY],
   # Code from module unsetenv:
   # Code from module unsetenv-tests:
   # Code from module useless-if-before-free:
+  # Code from module usleep:
+  # Code from module usleep-tests:
   # Code from module valgrind-tests:
   # Code from module vasnprintf:
   # Code from module vasnprintf-tests:
@@ -457,6 +465,14 @@ if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
 fi
 gl_STDIO_MODULE_INDICATOR([ftello])
 gl_FUNC
+gl_GETADDRINFO
+if test $HAVE_GETADDRINFO = 0; then
+  AC_LIBOBJ([getaddrinfo])
+fi
+if test $HAVE_DECL_GAI_STRERROR = 0 || test $REPLACE_GAI_STRERROR = 1; then
+  AC_LIBOBJ([gai_strerror])
+fi
+gl_NETDB_MODULE_INDICATOR([getaddrinfo])
 gl_FUNC_GETDELIM
 if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then
   AC_LIBOBJ([getdelim])
@@ -474,14 +490,20 @@ 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])
 gl_FUNC_GETPASS
 if test $HAVE_GETPASS = 0; then
   AC_LIBOBJ([getpass])
@@ -519,6 +541,7 @@ m4_if(m4_version_compare([2.61a.100],
         m4_defn([m4_PACKAGE_VERSION])), [1], [],
       [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
         [GNUmakefile=$GNUmakefile])])
+gl_HOSTENT
 gl_FUNC_INET_NTOP
 if test $HAVE_INET_NTOP = 0 || test $REPLACE_INET_NTOP = 1; then
   AC_LIBOBJ([inet_ntop])
@@ -660,6 +683,7 @@ if test "$ac_cv_header_winsock2_h" = yes; then
   AC_LIBOBJ([sendto])
 fi
 gl_SYS_SOCKET_MODULE_INDICATOR([sendto])
+gl_SERVENT
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
 if test "$ac_cv_header_winsock2_h" = yes; then
   AC_LIBOBJ([setsockopt])
@@ -787,6 +811,11 @@ gl_TIME_MODULE_INDICATOR([time_r])
 gl_TIMESPEC
 AC_REQUIRE([AC_C_INLINE])
 gl_UNISTD_H
+gl_FUNC_USLEEP
+if test $HAVE_USLEEP = 0 || test $REPLACE_USLEEP = 1; then
+  AC_LIBOBJ([usleep])
+fi
+gl_UNISTD_MODULE_INDICATOR([usleep])
 gl_VALGRIND_TESTS
 gl_FUNC_VASNPRINTF
 gl_FUNC_VASPRINTF
@@ -1138,6 +1167,8 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/fstat.c
   lib/ftell.c
   lib/ftello.c
+  lib/gai_strerror.c
+  lib/getaddrinfo.c
   lib/getdelim.c
   lib/getline.c
   lib/getopt.c
@@ -1247,6 +1278,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/timespec.h
   lib/u64.h
   lib/unistd.in.h
+  lib/usleep.c
   lib/vasnprintf.c
   lib/vasnprintf.h
   lib/vasprintf.c
@@ -1296,6 +1328,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/ftello.m4
   m4/ftruncate.m4
   m4/func.m4
+  m4/getaddrinfo.m4
   m4/getcwd.m4
   m4/getdelim.m4
   m4/getline.m4
@@ -1309,6 +1342,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/glibc2.m4
   m4/glibc21.m4
   m4/gnulib-common.m4
+  m4/hostent.m4
   m4/iconv.m4
   m4/include_next.m4
   m4/inet_ntop.m4
@@ -1373,6 +1407,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/realloc.m4
   m4/scandir.m4
   m4/select.m4
+  m4/servent.m4
   m4/setenv.m4
   m4/signal_h.m4
   m4/signbit.m4
@@ -1420,6 +1455,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/uintmax_t.m4
   m4/ungetc.m4
   m4/unistd_h.m4
+  m4/usleep.m4
   m4/valgrind-tests.m4
   m4/vasnprintf.m4
   m4/vasprintf.m4
@@ -1492,6 +1528,7 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-ftruncate.sh
   tests/test-func.c
   tests/test-fwrite.c
+  tests/test-getaddrinfo.c
   tests/test-getcwd-lgpl.c
   tests/test-getdelim.c
   tests/test-getline.c
@@ -1503,6 +1540,7 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-ignore-value.c
   tests/test-inet_ntop.c
   tests/test-inet_pton.c
+  tests/test-init.sh
   tests/test-intprops.c
   tests/test-inttypes.c
   tests/test-ioctl.c
@@ -1585,6 +1623,7 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-u64.c
   tests/test-unistd.c
   tests/test-unsetenv.c
+  tests/test-usleep.c
   tests/test-vasnprintf.c
   tests/test-vasprintf.c
   tests/test-vc-list-files-cvs.sh
diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4
index ed41e9d..a09ffc1 100644
--- a/gl/m4/gnulib-tool.m4
+++ b/gl/m4/gnulib-tool.m4
@@ -1,5 +1,5 @@
 # gnulib-tool.m4 serial 2
-dnl Copyright (C) 2004-2005, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2005, 2009-2012 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.
diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4
new file mode 100644
index 0000000..5134775
--- /dev/null
+++ b/gl/m4/hostent.m4
@@ -0,0 +1,49 @@
+# hostent.m4 serial 2
+dnl Copyright (C) 2008, 2010-2012 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_HOSTENT],
+[
+  dnl Where are gethostent(), sethostent(), endhostent(), gethostbyname(),
+  dnl gethostbyaddr() defined?
+  dnl - On Solaris, they are in libnsl. Ignore libxnet.
+  dnl - On Haiku, they are in libnetwork.
+  dnl - On BeOS, they are in libnet.
+  dnl - On native Windows, they are in ws2_32.dll.
+  dnl - Otherwise they are in libc.
+  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+  HOSTENT_LIB=
+  gl_saved_libs="$LIBS"
+  AC_SEARCH_LIBS([gethostbyname], [nsl network net],
+    [if test "$ac_cv_search_gethostbyname" != "none required"; then
+       HOSTENT_LIB="$ac_cv_search_gethostbyname"
+     fi])
+  LIBS="$gl_saved_libs"
+  if test -z "$HOSTENT_LIB"; then
+    AC_CHECK_FUNCS([gethostbyname], , [
+      AC_CACHE_CHECK([for gethostbyname in winsock2.h and -lws2_32],
+        [gl_cv_w32_gethostbyname],
+        [gl_cv_w32_gethostbyname=no
+         gl_save_LIBS="$LIBS"
+         LIBS="$LIBS -lws2_32"
+         AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#include <stddef.h>
+              ]],
+              [[gethostbyname(NULL);]])],
+           [gl_cv_w32_gethostbyname=yes])
+         LIBS="$gl_save_LIBS"
+        ])
+      if test "$gl_cv_w32_gethostbyname" = "yes"; then
+        HOSTENT_LIB="-lws2_32"
+      fi
+    ])
+  fi
+  AC_SUBST([HOSTENT_LIB])
+])
diff --git a/gl/m4/iconv.m4 b/gl/m4/iconv.m4
index 98fcd64..6a47236 100644
--- a/gl/m4/iconv.m4
+++ b/gl/m4/iconv.m4
@@ -1,5 +1,5 @@
 # iconv.m4 serial 18 (gettext-0.18.2)
-dnl Copyright (C) 2000-2002, 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2007-2012 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.
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4
index 8a1fab6..a60a261 100644
--- a/gl/m4/include_next.m4
+++ b/gl/m4/include_next.m4
@@ -1,5 +1,5 @@
 # include_next.m4 serial 23
-dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2012 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.
@@ -143,7 +143,7 @@ choke me
 # 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.
+# 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.
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4
index 4936fa3..1ebd960 100644
--- a/gl/m4/inet_ntop.m4
+++ b/gl/m4/inet_ntop.m4
@@ -1,5 +1,5 @@
 # inet_ntop.m4 serial 19
-dnl Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2006, 2008-2012 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.
diff --git a/gl/m4/inet_pton.m4 b/gl/m4/inet_pton.m4
index e64da7b..e7b44e2 100644
--- a/gl/m4/inet_pton.m4
+++ b/gl/m4/inet_pton.m4
@@ -1,5 +1,5 @@
 # inet_pton.m4 serial 17
-dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2012 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.
diff --git a/gl/m4/intdiv0.m4 b/gl/m4/intdiv0.m4
index 58e8a73..6d89aeb 100644
--- a/gl/m4/intdiv0.m4
+++ b/gl/m4/intdiv0.m4
@@ -1,5 +1,5 @@
 # intdiv0.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2002, 2007-2008, 2010-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2007-2008, 2010-2012 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.
diff --git a/gl/m4/intl.m4 b/gl/m4/intl.m4
index 96031eb..d67e29c 100644
--- a/gl/m4/intl.m4
+++ b/gl/m4/intl.m4
@@ -1,5 +1,5 @@
-# intl.m4 serial 17b
-dnl Copyright (C) 1995-2011 Free Software Foundation, Inc.
+# intl.m4 serial 17c
+dnl Copyright (C) 1995-2012 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.
@@ -296,5 +296,5 @@ AC_DEFUN([gt_CHECK_DECL],
     gt_value=0
   fi
   AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
-    [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
+    [Define to 1 if you have the declaration of '$1', and to 0 if you don't.])
 ])
diff --git a/gl/m4/intldir.m4 b/gl/m4/intldir.m4
index 31507d1..b81de61 100644
--- a/gl/m4/intldir.m4
+++ b/gl/m4/intldir.m4
@@ -1,5 +1,5 @@
 # intldir.m4 serial 2 (gettext-0.18)
-dnl Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2009-2012 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.
diff --git a/gl/m4/intlmacosx.m4 b/gl/m4/intlmacosx.m4
index 51f8547..dc2ddfe 100644
--- a/gl/m4/intlmacosx.m4
+++ b/gl/m4/intlmacosx.m4
@@ -1,5 +1,5 @@
 # intlmacosx.m4 serial 4 (gettext-0.18.2)
-dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2012 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.
diff --git a/gl/m4/intmax.m4 b/gl/m4/intmax.m4
index 9d28921..e3b251f 100644
--- a/gl/m4/intmax.m4
+++ b/gl/m4/intmax.m4
@@ -1,5 +1,5 @@
 # intmax.m4 serial 6 (gettext-0.18.2)
-dnl Copyright (C) 2002-2005, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2005, 2008-2012 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.
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4
index 7341054..c1a4a75 100644
--- a/gl/m4/intmax_t.m4
+++ b/gl/m4/intmax_t.m4
@@ -1,5 +1,5 @@
 # intmax_t.m4 serial 8
-dnl Copyright (C) 1997-2004, 2006-2007, 2009-2011 Free Software Foundation,
+dnl Copyright (C) 1997-2004, 2006-2007, 2009-2012 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,
diff --git a/gl/m4/inttypes-pri.m4 b/gl/m4/inttypes-pri.m4
index e252b27..977206f 100644
--- a/gl/m4/inttypes-pri.m4
+++ b/gl/m4/inttypes-pri.m4
@@ -1,5 +1,5 @@
 # inttypes-pri.m4 serial 7 (gettext-0.18.2)
-dnl Copyright (C) 1997-2002, 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2002, 2006, 2008-2012 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.
diff --git a/gl/m4/inttypes.m4 b/gl/m4/inttypes.m4
index cc027a4..eec4f41 100644
--- a/gl/m4/inttypes.m4
+++ b/gl/m4/inttypes.m4
@@ -1,5 +1,5 @@
-# inttypes.m4 serial 24
-dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
+# inttypes.m4 serial 26
+dnl Copyright (C) 2006-2012 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.
@@ -24,22 +24,6 @@ AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE],
 
   AC_REQUIRE([gl_MULTIARCH])
 
-  dnl Ensure that <stdint.h> defines the limit macros, since gnulib's
-  dnl <inttypes.h> relies on them.  This macro is only needed when a
-  dnl C++ compiler is in use; it has no effect for a C compiler.
-  dnl Also be careful to define __STDC_LIMIT_MACROS only when gnulib's
-  dnl <inttypes.h> is going to be created, and to avoid redefinition warnings
-  dnl if the __STDC_LIMIT_MACROS is already defined through the CPPFLAGS.
-  AC_DEFINE([GL_TRIGGER_STDC_LIMIT_MACROS], [1],
-    [Define to make the limit macros in <stdint.h> visible.])
-  AH_VERBATIM([__STDC_LIMIT_MACROS_ZZZ],
-[/* Ensure that <stdint.h> defines the limit macros, since gnulib's
-   <inttypes.h> relies on them.  */
-#if defined __cplusplus && !defined __STDC_LIMIT_MACROS && 
GL_TRIGGER_STDC_LIMIT_MACROS
-# define __STDC_LIMIT_MACROS 1
-#endif
-])
-
   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 <inttypes.h>
@@ -163,6 +147,7 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
   HAVE_DECL_IMAXDIV=1;   AC_SUBST([HAVE_DECL_IMAXDIV])
   HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
   HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
+  REPLACE_STRTOIMAX=0;   AC_SUBST([REPLACE_STRTOIMAX])
   INT32_MAX_LT_INTMAX_MAX=1;  AC_SUBST([INT32_MAX_LT_INTMAX_MAX])
   INT64_MAX_EQ_LONG_MAX='defined _LP64';  AC_SUBST([INT64_MAX_EQ_LONG_MAX])
   PRI_MACROS_BROKEN=0;   AC_SUBST([PRI_MACROS_BROKEN])
diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4
index f10fd54..91c7bca 100644
--- a/gl/m4/inttypes_h.m4
+++ b/gl/m4/inttypes_h.m4
@@ -1,5 +1,5 @@
 # inttypes_h.m4 serial 10
-dnl Copyright (C) 1997-2004, 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2012 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.
diff --git a/gl/m4/ioctl.m4 b/gl/m4/ioctl.m4
index a1db8fc..ec0b728 100644
--- a/gl/m4/ioctl.m4
+++ b/gl/m4/ioctl.m4
@@ -1,5 +1,5 @@
 # ioctl.m4 serial 4
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/isnand.m4 b/gl/m4/isnand.m4
index 48f1a48..54b64a4 100644
--- a/gl/m4/isnand.m4
+++ b/gl/m4/isnand.m4
@@ -1,5 +1,5 @@
 # isnand.m4 serial 11
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/isnanf.m4 b/gl/m4/isnanf.m4
index 66ed954..97f638a 100644
--- a/gl/m4/isnanf.m4
+++ b/gl/m4/isnanf.m4
@@ -1,5 +1,5 @@
 # isnanf.m4 serial 14
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/isnanl.m4 b/gl/m4/isnanl.m4
index daabe2a..81469ab 100644
--- a/gl/m4/isnanl.m4
+++ b/gl/m4/isnanl.m4
@@ -1,5 +1,5 @@
 # isnanl.m4 serial 17
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4
index d83fea1..1369bbe 100644
--- a/gl/m4/largefile.m4
+++ b/gl/m4/largefile.m4
@@ -1,6 +1,6 @@
 # Enable large files on systems where this is not the default.
 
-# Copyright 1992-1996, 1998-2011 Free Software Foundation, Inc.
+# Copyright 1992-1996, 1998-2012 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.
diff --git a/gl/m4/lcmessage.m4 b/gl/m4/lcmessage.m4
index baf41c5..4ed0eb6 100644
--- a/gl/m4/lcmessage.m4
+++ b/gl/m4/lcmessage.m4
@@ -1,5 +1,5 @@
 # lcmessage.m4 serial 7 (gettext-0.18.2)
-dnl Copyright (C) 1995-2002, 2004-2005, 2008-2011 Free Software Foundation,
+dnl Copyright (C) 1995-2002, 2004-2005, 2008-2012 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,
diff --git a/gl/m4/ld-output-def.m4 b/gl/m4/ld-output-def.m4
index 2169f51..3511684 100644
--- a/gl/m4/ld-output-def.m4
+++ b/gl/m4/ld-output-def.m4
@@ -1,5 +1,5 @@
 # ld-output-def.m4 serial 2
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/ld-version-script.m4 b/gl/m4/ld-version-script.m4
index aec2f41..fd8c043 100644
--- a/gl/m4/ld-version-script.m4
+++ b/gl/m4/ld-version-script.m4
@@ -1,5 +1,5 @@
 # ld-version-script.m4 serial 2
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/ldexpl.m4 b/gl/m4/ldexpl.m4
index f5d15fd..9c9ec67 100644
--- a/gl/m4/ldexpl.m4
+++ b/gl/m4/ldexpl.m4
@@ -1,5 +1,5 @@
 # ldexpl.m4 serial 14
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4
index ae003f7..4e1374d 100644
--- a/gl/m4/lib-ld.m4
+++ b/gl/m4/lib-ld.m4
@@ -1,5 +1,5 @@
 # lib-ld.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 1996-2003, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 1996-2003, 2009-2012 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.
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4
index e7c9ba9..d11b4b4 100644
--- a/gl/m4/lib-link.m4
+++ b/gl/m4/lib-link.m4
@@ -1,5 +1,5 @@
 # lib-link.m4 serial 26 (gettext-0.18.2)
-dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2012 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.
diff --git a/gl/m4/lib-prefix.m4 b/gl/m4/lib-prefix.m4
index 7e5f0bd..007aa05 100644
--- a/gl/m4/lib-prefix.m4
+++ b/gl/m4/lib-prefix.m4
@@ -1,5 +1,5 @@
 # lib-prefix.m4 serial 7 (gettext-0.18)
-dnl Copyright (C) 2001-2005, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2005, 2008-2012 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.
diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4
index 9686945..c0a6206 100644
--- a/gl/m4/lock.m4
+++ b/gl/m4/lock.m4
@@ -1,5 +1,5 @@
 # lock.m4 serial 11 (gettext-0.18.2)
-dnl Copyright (C) 2005-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2012 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.
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4
index aed816c..b9c65c7 100644
--- a/gl/m4/longlong.m4
+++ b/gl/m4/longlong.m4
@@ -1,5 +1,5 @@
-# longlong.m4 serial 16
-dnl Copyright (C) 1999-2007, 2009-2011 Free Software Foundation, Inc.
+# longlong.m4 serial 17
+dnl Copyright (C) 1999-2007, 2009-2012 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.
@@ -51,7 +51,7 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
       fi])
   if test $ac_cv_type_long_long_int = yes; then
     AC_DEFINE([HAVE_LONG_LONG_INT], [1],
-      [Define to 1 if the system has the type `long long int'.])
+      [Define to 1 if the system has the type 'long long int'.])
   fi
 ])
 
@@ -77,7 +77,7 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
      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'.])
+      [Define to 1 if the system has the type 'unsigned long long int'.])
   fi
 ])
 
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4
index 73c4069..86db59e 100644
--- a/gl/m4/lseek.m4
+++ b/gl/m4/lseek.m4
@@ -1,5 +1,5 @@
 # lseek.m4 serial 8
-dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/lstat.m4 b/gl/m4/lstat.m4
index fe161d4..b83858b 100644
--- a/gl/m4/lstat.m4
+++ b/gl/m4/lstat.m4
@@ -1,6 +1,6 @@
-# serial 23
+# serial 24
 
-# Copyright (C) 1997-2001, 2003-2011 Free Software Foundation, Inc.
+# Copyright (C) 1997-2001, 2003-2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -65,6 +65,6 @@ AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
     ])
   test $gl_cv_func_lstat_dereferences_slashed_symlink = yes &&
     AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
-      [Define to 1 if `lstat' dereferences a symlink specified
+      [Define to 1 if 'lstat' dereferences a symlink specified
        with a trailing slash.])
 ])
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
index 87018ec..d3c39f5 100644
--- a/gl/m4/malloc.m4
+++ b/gl/m4/malloc.m4
@@ -1,5 +1,5 @@
 # malloc.m4 serial 13
-dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/malloca.m4 b/gl/m4/malloca.m4
index aec43f5..7841979 100644
--- a/gl/m4/malloca.m4
+++ b/gl/m4/malloca.m4
@@ -1,5 +1,5 @@
 # malloca.m4 serial 1
-dnl Copyright (C) 2003-2004, 2006-2007, 2009-2011 Free Software Foundation,
+dnl Copyright (C) 2003-2004, 2006-2007, 2009-2012 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,
diff --git a/gl/m4/manywarnings.m4 b/gl/m4/manywarnings.m4
index 67db064..fd0e372 100644
--- a/gl/m4/manywarnings.m4
+++ b/gl/m4/manywarnings.m4
@@ -1,5 +1,5 @@
-# manywarnings.m4 serial 1
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+# manywarnings.m4 serial 3
+dnl Copyright (C) 2008-2012 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.
@@ -30,9 +30,9 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT],
 
 # gl_MANYWARN_ALL_GCC(VARIABLE)
 # -----------------------------
-# Add all documented GCC (currently as per version 4.4) warning
-# parameters to variable VARIABLE.  Note that you need to test them
-# using gl_WARN_ADD if you want to make sure your gcc understands it.
+# Add all documented GCC warning parameters to variable VARIABLE.
+# Note that you need to test them using gl_WARN_ADD if you want to
+# make sure your gcc understands it.
 AC_DEFUN([gl_MANYWARN_ALL_GCC],
 [
   dnl First, check if -Wno-missing-field-initializers is needed.
@@ -148,6 +148,32 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
     ; do
     gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
   done
+  # More warnings from gcc 4.6.2 --help=warnings.
+  for gl_manywarn_item in \
+    -Wabi \
+    -Wcpp \
+    -Wdeprecated \
+    -Wdeprecated-declarations \
+    -Wdiv-by-zero \
+    -Wdouble-promotion \
+    -Wendif-labels \
+    -Wextra \
+    -Wformat-contains-nul \
+    -Wformat-extra-args \
+    -Wformat-zero-length \
+    -Wformat=2 \
+    -Wmultichar \
+    -Wnormalized=nfc \
+    -Woverflow \
+    -Wpointer-to-int-cast \
+    -Wpragmas \
+    -Wsuggest-attribute=const \
+    -Wsuggest-attribute=noreturn \
+    -Wsuggest-attribute=pure \
+    -Wtrampolines \
+    ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
 
   # Disable the missing-field-initializers warning if needed
   if test "$gl_cv_cc_nomfi_needed" = yes; then
diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4
index e58a9e9..5d7d52b 100644
--- a/gl/m4/math_h.m4
+++ b/gl/m4/math_h.m4
@@ -1,5 +1,5 @@
 # math_h.m4 serial 56
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4
index f6dc3e7..0040294 100644
--- a/gl/m4/memchr.m4
+++ b/gl/m4/memchr.m4
@@ -1,5 +1,5 @@
 # memchr.m4 serial 12
-dnl Copyright (C) 2002-2004, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2009-2012 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.
diff --git a/gl/m4/memmem.m4 b/gl/m4/memmem.m4
index e912205..eebe94c 100644
--- a/gl/m4/memmem.m4
+++ b/gl/m4/memmem.m4
@@ -1,5 +1,5 @@
 # memmem.m4 serial 23
-dnl Copyright (C) 2002-2004, 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2007-2012 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.
diff --git a/gl/m4/mempcpy.m4 b/gl/m4/mempcpy.m4
index 7214a4b..c926941 100644
--- a/gl/m4/mempcpy.m4
+++ b/gl/m4/mempcpy.m4
@@ -1,5 +1,5 @@
 # mempcpy.m4 serial 11
-dnl Copyright (C) 2003-2004, 2006-2007, 2009-2011 Free Software Foundation,
+dnl Copyright (C) 2003-2004, 2006-2007, 2009-2012 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,
diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4
index beb9cb1..45c6230 100644
--- a/gl/m4/minmax.m4
+++ b/gl/m4/minmax.m4
@@ -1,5 +1,5 @@
 # minmax.m4 serial 4
-dnl Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009-2012 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.
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4
index 952536f..4613cbe 100644
--- a/gl/m4/mmap-anon.m4
+++ b/gl/m4/mmap-anon.m4
@@ -1,5 +1,5 @@
 # mmap-anon.m4 serial 9
-dnl Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2007, 2009-2012 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.
diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4
index f9cf704..40f612a 100644
--- a/gl/m4/mode_t.m4
+++ b/gl/m4/mode_t.m4
@@ -1,5 +1,5 @@
 # mode_t.m4 serial 2
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 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.
diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4
index fb797f0..8db4617 100644
--- a/gl/m4/msvc-inval.m4
+++ b/gl/m4/msvc-inval.m4
@@ -1,5 +1,5 @@
 # msvc-inval.m4 serial 1
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2012 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.
diff --git a/gl/m4/msvc-nothrow.m4 b/gl/m4/msvc-nothrow.m4
index b2f6bb4..0125050 100644
--- a/gl/m4/msvc-nothrow.m4
+++ b/gl/m4/msvc-nothrow.m4
@@ -1,5 +1,5 @@
 # msvc-nothrow.m4 serial 1
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2012 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.
diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4
index 691d892..b424dce 100644
--- a/gl/m4/multiarch.m4
+++ b/gl/m4/multiarch.m4
@@ -1,5 +1,5 @@
 # multiarch.m4 serial 6
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4
index a54d670..e0f3ee8 100644
--- a/gl/m4/netdb_h.m4
+++ b/gl/m4/netdb_h.m4
@@ -1,5 +1,5 @@
 # netdb_h.m4 serial 11
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4
index 87235b7..e181388 100644
--- a/gl/m4/netinet_in_h.m4
+++ b/gl/m4/netinet_in_h.m4
@@ -1,5 +1,5 @@
 # netinet_in_h.m4 serial 5
-dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2012 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.
diff --git a/gl/m4/nls.m4 b/gl/m4/nls.m4
index 6a21216..0866677 100644
--- a/gl/m4/nls.m4
+++ b/gl/m4/nls.m4
@@ -1,5 +1,5 @@
 # nls.m4 serial 5 (gettext-0.18)
-dnl Copyright (C) 1995-2003, 2005-2006, 2008-2011 Free Software Foundation,
+dnl Copyright (C) 1995-2003, 2005-2006, 2008-2012 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,
diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4
index 60aad95..08ef825 100644
--- a/gl/m4/nocrash.m4
+++ b/gl/m4/nocrash.m4
@@ -1,5 +1,5 @@
 # nocrash.m4 serial 3
-dnl Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009-2012 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.
diff --git a/gl/m4/open.m4 b/gl/m4/open.m4
index d819184..c85971d 100644
--- a/gl/m4/open.m4
+++ b/gl/m4/open.m4
@@ -1,5 +1,5 @@
 # open.m4 serial 13
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/opendir.m4 b/gl/m4/opendir.m4
index fa315b9..08da440 100644
--- a/gl/m4/opendir.m4
+++ b/gl/m4/opendir.m4
@@ -1,5 +1,5 @@
-# opendir.m4 serial 1
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+# opendir.m4 serial 2
+dnl Copyright (C) 2011-2012 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.
@@ -17,7 +17,9 @@ AC_DEFUN([gl_FUNC_OPENDIR],
   m4_ifdef([gl_FUNC_FCHDIR], [
     gl_TEST_FCHDIR
     if test $HAVE_FCHDIR = 0; then
-      REPLACE_OPENDIR=1
+      if test $HAVE_OPENDIR = 1; then
+        REPLACE_OPENDIR=1
+      fi
     fi
   ])
 ])
diff --git a/gl/m4/pathmax.m4 b/gl/m4/pathmax.m4
index 4913fa0..0117861 100644
--- a/gl/m4/pathmax.m4
+++ b/gl/m4/pathmax.m4
@@ -1,5 +1,5 @@
 # pathmax.m4 serial 10
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2012 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,
diff --git a/gl/m4/perror.m4 b/gl/m4/perror.m4
index cb17ba3..369a824 100644
--- a/gl/m4/perror.m4
+++ b/gl/m4/perror.m4
@@ -1,5 +1,5 @@
 # perror.m4 serial 6
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/pipe.m4 b/gl/m4/pipe.m4
index 9013174..37aef11 100644
--- a/gl/m4/pipe.m4
+++ b/gl/m4/pipe.m4
@@ -1,5 +1,5 @@
 # pipe.m4 serial 2
-dnl Copyright (C) 2010-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2010-2012 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.
diff --git a/gl/m4/po.m4 b/gl/m4/po.m4
index 9a0cca8..6bf122a 100644
--- a/gl/m4/po.m4
+++ b/gl/m4/po.m4
@@ -1,5 +1,5 @@
 # po.m4 serial 17a
-dnl Copyright (C) 1995-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2012 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.
diff --git a/gl/m4/printf-frexp.m4 b/gl/m4/printf-frexp.m4
index 83ff9ce..de5d641 100644
--- a/gl/m4/printf-frexp.m4
+++ b/gl/m4/printf-frexp.m4
@@ -1,5 +1,5 @@
 # printf-frexp.m4 serial 5
-dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/printf-frexpl.m4 b/gl/m4/printf-frexpl.m4
index e15628a..55dd6bc 100644
--- a/gl/m4/printf-frexpl.m4
+++ b/gl/m4/printf-frexpl.m4
@@ -1,5 +1,5 @@
 # printf-frexpl.m4 serial 9
-dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/printf-posix.m4 b/gl/m4/printf-posix.m4
index a9b91f7..0b9da42 100644
--- a/gl/m4/printf-posix.m4
+++ b/gl/m4/printf-posix.m4
@@ -1,5 +1,5 @@
 # printf-posix.m4 serial 6 (gettext-0.18.2)
-dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007, 2009-2012 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.
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4
index 0814c91..6d1fa54 100644
--- a/gl/m4/printf.m4
+++ b/gl/m4/printf.m4
@@ -1,5 +1,5 @@
-# printf.m4 serial 46
-dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc.
+# printf.m4 serial 47
+dnl Copyright (C) 2003, 2007-2012 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.
@@ -952,7 +952,7 @@ int main ()
         [
 changequote(,)dnl
          case "$host_os" in
-           # Guess no only on Solaris, native Win32, and BeOS systems.
+           # Guess no only on Solaris, native Windows, 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" ;;
diff --git a/gl/m4/progtest.m4 b/gl/m4/progtest.m4
index 5130d56..ce3abbc 100644
--- a/gl/m4/progtest.m4
+++ b/gl/m4/progtest.m4
@@ -1,5 +1,5 @@
 # progtest.m4 serial 7 (gettext-0.18.2)
-dnl Copyright (C) 1996-2003, 2005, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 1996-2003, 2005, 2008-2012 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.
diff --git a/gl/m4/putenv.m4 b/gl/m4/putenv.m4
index 1497b4a..1cb23a5 100644
--- a/gl/m4/putenv.m4
+++ b/gl/m4/putenv.m4
@@ -1,5 +1,5 @@
 # putenv.m4 serial 18
-dnl Copyright (C) 2002-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2012 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.
diff --git a/gl/m4/rawmemchr.m4 b/gl/m4/rawmemchr.m4
index 3f136a6..1930164 100644
--- a/gl/m4/rawmemchr.m4
+++ b/gl/m4/rawmemchr.m4
@@ -1,5 +1,5 @@
 # rawmemchr.m4 serial 2
-dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2012 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.
diff --git a/gl/m4/read-file.m4 b/gl/m4/read-file.m4
index 93e0ac3..3665247 100644
--- a/gl/m4/read-file.m4
+++ b/gl/m4/read-file.m4
@@ -1,5 +1,5 @@
 # read-file.m4 serial 3
-dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2012 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.
diff --git a/gl/m4/readdir.m4 b/gl/m4/readdir.m4
index cfeed08..437ec08 100644
--- a/gl/m4/readdir.m4
+++ b/gl/m4/readdir.m4
@@ -1,5 +1,5 @@
 # readdir.m4 serial 1
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2012 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.
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4
index 5cc1340..039ed19 100644
--- a/gl/m4/realloc.m4
+++ b/gl/m4/realloc.m4
@@ -1,5 +1,5 @@
 # realloc.m4 serial 12
-dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/scandir.m4 b/gl/m4/scandir.m4
index 25ebe06..24a3af4 100644
--- a/gl/m4/scandir.m4
+++ b/gl/m4/scandir.m4
@@ -1,5 +1,5 @@
 # scandir.m4 serial 2
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 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.
diff --git a/gl/m4/select.m4 b/gl/m4/select.m4
index a58f0ac..037b3d3 100644
--- a/gl/m4/select.m4
+++ b/gl/m4/select.m4
@@ -1,5 +1,5 @@
 # select.m4 serial 6
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 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.
diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4
new file mode 100644
index 0000000..21da957
--- /dev/null
+++ b/gl/m4/servent.m4
@@ -0,0 +1,51 @@
+# servent.m4 serial 2
+dnl Copyright (C) 2008, 2010-2012 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_SERVENT],
+[
+  dnl Where are getservent(), setservent(), endservent(), getservbyname(),
+  dnl getservbyport() defined?
+  dnl Where are getprotoent(), setprotoent(), endprotoent(), getprotobyname(),
+  dnl getprotobynumber() defined?
+  dnl - On Solaris, they are in libsocket. Ignore libxnet.
+  dnl - On Haiku, they are in libnetwork.
+  dnl - On BeOS, they are in libnet.
+  dnl - On native Windows, they are in ws2_32.dll.
+  dnl - Otherwise they are in libc.
+  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+  SERVENT_LIB=
+  gl_saved_libs="$LIBS"
+  AC_SEARCH_LIBS([getservbyname], [socket network net],
+    [if test "$ac_cv_search_getservbyname" != "none required"; then
+       SERVENT_LIB="$ac_cv_search_getservbyname"
+     fi])
+  LIBS="$gl_saved_libs"
+  if test -z "$SERVENT_LIB"; then
+    AC_CHECK_FUNCS([getservbyname], , [
+      AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32],
+        [gl_cv_w32_getservbyname],
+        [gl_cv_w32_getservbyname=no
+         gl_save_LIBS="$LIBS"
+         LIBS="$LIBS -lws2_32"
+         AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#include <stddef.h>
+              ]],
+              [[getservbyname(NULL,NULL);]])],
+           [gl_cv_w32_getservbyname=yes])
+         LIBS="$gl_save_LIBS"
+        ])
+      if test "$gl_cv_w32_getservbyname" = "yes"; then
+        SERVENT_LIB="-lws2_32"
+      fi
+    ])
+  fi
+  AC_SUBST([SERVENT_LIB])
+])
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4
index bc215a6..a1f30bc 100644
--- a/gl/m4/setenv.m4
+++ b/gl/m4/setenv.m4
@@ -1,5 +1,5 @@
 # setenv.m4 serial 25
-dnl Copyright (C) 2001-2004, 2006-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2004, 2006-2012 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.
diff --git a/gl/m4/signal_h.m4 b/gl/m4/signal_h.m4
index 5cf54a0..ed4d730 100644
--- a/gl/m4/signal_h.m4
+++ b/gl/m4/signal_h.m4
@@ -1,5 +1,5 @@
 # signal_h.m4 serial 18
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/signbit.m4 b/gl/m4/signbit.m4
index bbeb1f4..8955326 100644
--- a/gl/m4/signbit.m4
+++ b/gl/m4/signbit.m4
@@ -1,5 +1,5 @@
 # signbit.m4 serial 11
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4
index e807098..5a8162b 100644
--- a/gl/m4/size_max.m4
+++ b/gl/m4/size_max.m4
@@ -1,5 +1,5 @@
 # size_max.m4 serial 10
-dnl Copyright (C) 2003, 2005-2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2006, 2008-2012 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.
diff --git a/gl/m4/sleep.m4 b/gl/m4/sleep.m4
index 74362e4..7e736d4 100644
--- a/gl/m4/sleep.m4
+++ b/gl/m4/sleep.m4
@@ -1,5 +1,5 @@
 # sleep.m4 serial 6
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4
index 6f71623..de94edd 100644
--- a/gl/m4/snprintf.m4
+++ b/gl/m4/snprintf.m4
@@ -1,5 +1,5 @@
 # snprintf.m4 serial 6
-dnl Copyright (C) 2002-2004, 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2007-2012 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.
diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4
index 2aa972d..92a1af2 100644
--- a/gl/m4/socketlib.m4
+++ b/gl/m4/socketlib.m4
@@ -1,5 +1,5 @@
 # socketlib.m4 serial 1
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4
index cbe754f..e3738d9 100644
--- a/gl/m4/sockets.m4
+++ b/gl/m4/sockets.m4
@@ -1,5 +1,5 @@
 # sockets.m4 serial 7
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4
index 4475154..a4ab43b 100644
--- a/gl/m4/socklen.m4
+++ b/gl/m4/socklen.m4
@@ -1,5 +1,5 @@
 # socklen.m4 serial 10
-dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2007, 2009-2012 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.
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4
index c38daea..5f97c3e 100644
--- a/gl/m4/sockpfaf.m4
+++ b/gl/m4/sockpfaf.m4
@@ -1,5 +1,5 @@
 # sockpfaf.m4 serial 8
-dnl Copyright (C) 2004, 2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006, 2009-2012 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.
diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4
index d712752..209d64c 100644
--- a/gl/m4/ssize_t.m4
+++ b/gl/m4/ssize_t.m4
@@ -1,5 +1,5 @@
 # ssize_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2001-2003, 2006, 2010-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2003, 2006, 2010-2012 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.
diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4
index c63f59f..d67dbcd 100644
--- a/gl/m4/stat.m4
+++ b/gl/m4/stat.m4
@@ -1,6 +1,6 @@
 # serial 8
 
-# Copyright (C) 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2009-2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4
index da64dc6..9752ba5 100644
--- a/gl/m4/stdalign.m4
+++ b/gl/m4/stdalign.m4
@@ -1,6 +1,6 @@
-# Check for stdalign.h that conforms to C1x.
+# Check for stdalign.h that conforms to C11.
 
-dnl Copyright 2011 Free Software Foundation, Inc.
+dnl Copyright 2011-2012 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,9 +9,24 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_STDALIGN_H],
 [
-  AC_CHECK_HEADERS_ONCE([stdalign.h])
+  AC_CACHE_CHECK([for working stdalign.h],
+    [gl_cv_header_working_stdalign_h],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdalign.h>
+            int align_int = alignof (int) + _Alignof (double);
 
-  if test $ac_cv_header_stdalign_h = yes; then
+            /* 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'
diff --git a/gl/m4/stdarg.m4 b/gl/m4/stdarg.m4
index 5705de9..5c313cb 100644
--- a/gl/m4/stdarg.m4
+++ b/gl/m4/stdarg.m4
@@ -1,5 +1,5 @@
 # stdarg.m4 serial 6
-dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2012 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.
diff --git a/gl/m4/stdbool.m4 b/gl/m4/stdbool.m4
index 1ebf3e6..eabfa64 100644
--- a/gl/m4/stdbool.m4
+++ b/gl/m4/stdbool.m4
@@ -1,6 +1,6 @@
 # Check for stdbool.h that conforms to C99.
 
-dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2012 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.
diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4
index 1ae2344..cc11609 100644
--- a/gl/m4/stddef_h.m4
+++ b/gl/m4/stddef_h.m4
@@ -1,6 +1,6 @@
 dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
 # stddef_h.m4 serial 4
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 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.
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
index 092161c..28d342e 100644
--- a/gl/m4/stdint.m4
+++ b/gl/m4/stdint.m4
@@ -1,5 +1,5 @@
-# stdint.m4 serial 41
-dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
+# stdint.m4 serial 43
+dnl Copyright (C) 2001-2012 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.
@@ -69,8 +69,6 @@ AC_DEFUN_ONCE([gl_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 <stdint.h>
 /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>.  */
@@ -219,8 +217,6 @@ struct s {
           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 <stdint.h>
 ]
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4
index 356b14e..581de96 100644
--- a/gl/m4/stdint_h.m4
+++ b/gl/m4/stdint_h.m4
@@ -1,5 +1,5 @@
 # stdint_h.m4 serial 9
-dnl Copyright (C) 1997-2004, 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2012 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.
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4
index 39bf80e..1973e8d 100644
--- a/gl/m4/stdio_h.m4
+++ b/gl/m4/stdio_h.m4
@@ -1,5 +1,5 @@
 # stdio_h.m4 serial 40
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index fbdba98..bcb4cb8 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,5 +1,5 @@
-# stdlib_h.m4 serial 37
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+# stdlib_h.m4 serial 39
+dnl Copyright (C) 2007-2012 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.
@@ -21,8 +21,8 @@ AC_DEFUN([gl_STDLIB_H],
 #endif
     ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
     initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt
-    ptsname random_r realpath rpmatch setenv setstate_r srandom_r strtod
-    strtoll strtoull unlockpt unsetenv])
+    ptsname ptsname_r random_r realpath rpmatch setenv setstate_r srandom_r
+    strtod strtoll strtoull unlockpt unsetenv])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -52,6 +52,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   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])
@@ -79,6 +80,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   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])
@@ -97,6 +99,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   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])
diff --git a/gl/m4/strcase.m4 b/gl/m4/strcase.m4
index c676176..717fa9c 100644
--- a/gl/m4/strcase.m4
+++ b/gl/m4/strcase.m4
@@ -1,5 +1,5 @@
 # strcase.m4 serial 11
-dnl Copyright (C) 2002, 2005-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2012 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.
diff --git a/gl/m4/strchrnul.m4 b/gl/m4/strchrnul.m4
index d89a062..d3dfb9a 100644
--- a/gl/m4/strchrnul.m4
+++ b/gl/m4/strchrnul.m4
@@ -1,5 +1,5 @@
 # strchrnul.m4 serial 9
-dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007, 2009-2012 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.
diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4
index d744ad5..db0c8c1 100644
--- a/gl/m4/strdup.m4
+++ b/gl/m4/strdup.m4
@@ -1,6 +1,6 @@
 # strdup.m4 serial 13
 
-dnl Copyright (C) 2002-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2012 Free Software Foundation, Inc.
 
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4
index ca05be6..6bf14ef 100644
--- a/gl/m4/strerror.m4
+++ b/gl/m4/strerror.m4
@@ -1,5 +1,5 @@
 # strerror.m4 serial 16
-dnl Copyright (C) 2002, 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2007-2012 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.
diff --git a/gl/m4/strerror_r.m4 b/gl/m4/strerror_r.m4
index 1d4a653..5bdf0ab 100644
--- a/gl/m4/strerror_r.m4
+++ b/gl/m4/strerror_r.m4
@@ -1,5 +1,5 @@
 # strerror_r.m4 serial 14
-dnl Copyright (C) 2002, 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2007-2012 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.
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4
index 4f9f511..5677e09 100644
--- a/gl/m4/string_h.m4
+++ b/gl/m4/string_h.m4
@@ -1,6 +1,6 @@
 # Configure a GNU-like replacement for <string.h>.
 
-# Copyright (C) 2007-2011 Free Software Foundation, Inc.
+# Copyright (C) 2007-2012 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.
diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4
index 481f8f3..a057e1c 100644
--- a/gl/m4/strings_h.m4
+++ b/gl/m4/strings_h.m4
@@ -1,7 +1,7 @@
 # Configure a replacement for <strings.h>.
 # serial 6
 
-# Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/strndup.m4 b/gl/m4/strndup.m4
index e1ac20b..bdde5fe 100644
--- a/gl/m4/strndup.m4
+++ b/gl/m4/strndup.m4
@@ -1,5 +1,5 @@
 # strndup.m4 serial 20
-dnl Copyright (C) 2002-2003, 2005-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2005-2012 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.
diff --git a/gl/m4/strnlen.m4 b/gl/m4/strnlen.m4
index 672acfd..d97e307 100644
--- a/gl/m4/strnlen.m4
+++ b/gl/m4/strnlen.m4
@@ -1,5 +1,5 @@
 # strnlen.m4 serial 13
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2011 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2012 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,
diff --git a/gl/m4/strverscmp.m4 b/gl/m4/strverscmp.m4
index 394b4c3..d744647 100644
--- a/gl/m4/strverscmp.m4
+++ b/gl/m4/strverscmp.m4
@@ -1,5 +1,5 @@
 # strverscmp.m4 serial 8
-dnl Copyright (C) 2002, 2005-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2012 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.
diff --git a/gl/m4/symlink.m4 b/gl/m4/symlink.m4
index 680c14f..f84b21e 100644
--- a/gl/m4/symlink.m4
+++ b/gl/m4/symlink.m4
@@ -1,7 +1,7 @@
 # serial 5
 # See if we need to provide symlink replacement.
 
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 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.
diff --git a/gl/m4/sys_ioctl_h.m4 b/gl/m4/sys_ioctl_h.m4
index 8c7d112..94a2669 100644
--- a/gl/m4/sys_ioctl_h.m4
+++ b/gl/m4/sys_ioctl_h.m4
@@ -1,5 +1,5 @@
 # sys_ioctl_h.m4 serial 10
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/sys_select_h.m4 b/gl/m4/sys_select_h.m4
index b1914fb..eaf056a 100644
--- a/gl/m4/sys_select_h.m4
+++ b/gl/m4/sys_select_h.m4
@@ -1,5 +1,5 @@
 # sys_select_h.m4 serial 20
-dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2012 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.
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index 7da91a4..8d4e7e1 100644
--- a/gl/m4/sys_socket_h.m4
+++ b/gl/m4/sys_socket_h.m4
@@ -1,5 +1,5 @@
 # sys_socket_h.m4 serial 22
-dnl Copyright (C) 2005-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2012 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.
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
index 83ebac6..a0b96bc 100644
--- a/gl/m4/sys_stat_h.m4
+++ b/gl/m4/sys_stat_h.m4
@@ -1,5 +1,5 @@
 # sys_stat_h.m4 serial 26   -*- Autoconf -*-
-dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2012 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.
diff --git a/gl/m4/sys_time_h.m4 b/gl/m4/sys_time_h.m4
index 064e0de..bed3797 100644
--- a/gl/m4/sys_time_h.m4
+++ b/gl/m4/sys_time_h.m4
@@ -1,7 +1,7 @@
 # Configure a replacement for <sys/time.h>.
 # serial 7
 
-# Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009-2012 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.
diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4
index 62113df..8d18ddb 100644
--- a/gl/m4/sys_types_h.m4
+++ b/gl/m4/sys_types_h.m4
@@ -1,5 +1,5 @@
 # sys_types_h.m4 serial 2
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2012 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.
diff --git a/gl/m4/sys_uio_h.m4 b/gl/m4/sys_uio_h.m4
index bafa0ac..ddf844b 100644
--- a/gl/m4/sys_uio_h.m4
+++ b/gl/m4/sys_uio_h.m4
@@ -1,5 +1,5 @@
 # sys_uio_h.m4 serial 1
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2012 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.
diff --git a/gl/m4/sysexits.m4 b/gl/m4/sysexits.m4
index cff6606..c5741d2 100644
--- a/gl/m4/sysexits.m4
+++ b/gl/m4/sysexits.m4
@@ -1,5 +1,5 @@
 # sysexits.m4 serial 6
-dnl Copyright (C) 2003, 2005, 2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005, 2007, 2009-2012 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.
diff --git a/gl/m4/thread.m4 b/gl/m4/thread.m4
index 49a4bc7..cd66c3e 100644
--- a/gl/m4/thread.m4
+++ b/gl/m4/thread.m4
@@ -1,5 +1,5 @@
 # thread.m4 serial 2
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/threadlib.m4 b/gl/m4/threadlib.m4
index 8a621fd..9cedb67 100644
--- a/gl/m4/threadlib.m4
+++ b/gl/m4/threadlib.m4
@@ -1,5 +1,5 @@
-# threadlib.m4 serial 8 (gettext-0.18.2)
-dnl Copyright (C) 2005-2011 Free Software Foundation, Inc.
+# threadlib.m4 serial 9 (gettext-0.18.2)
+dnl Copyright (C) 2005-2012 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.
@@ -15,7 +15,7 @@ dnl default is 'no', otherwise it is system dependent. In 
both cases, the user
 dnl can change the choice through the options --enable-threads=choice or
 dnl --disable-threads.
 dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS,
-dnl USE_PTH_THREADS, USE_WIN32_THREADS
+dnl USE_PTH_THREADS, USE_WINDOWS_THREADS
 dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
 dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with
 dnl libtool).
@@ -53,7 +53,7 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
     [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
     [m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
   AC_ARG_ENABLE([threads],
-AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify 
multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
+AC_HELP_STRING([--enable-threads={posix|solaris|pth|windows}], [specify 
multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
 AC_HELP_STRING([--disable-threads], [build without multithread safety])]),
     [gl_use_threads=$enableval],
     [if test -n "$gl_use_threads_default"; then
@@ -276,17 +276,19 @@ int main ()
       fi
     fi
     if test -z "$gl_have_pthread"; then
-      if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then
-        if { case "$host_os" in
-               mingw*) true;;
-               *) false;;
-             esac
-           }; then
-          gl_threads_api=win32
-          AC_DEFINE([USE_WIN32_THREADS], [1],
-            [Define if the Win32 multithreading API can be used.])
-        fi
-      fi
+      case "$gl_use_threads" in
+        yes | windows | win32) # The 'win32' is for backward compatibility.
+          if { case "$host_os" in
+                 mingw*) true;;
+                 *) false;;
+               esac
+             }; then
+            gl_threads_api=windows
+            AC_DEFINE([USE_WINDOWS_THREADS], [1],
+              [Define if the native Windows multithreading API can be used.])
+          fi
+          ;;
+      esac
     fi
   fi
   AC_MSG_CHECKING([for multithread API to use])
@@ -358,7 +360,7 @@ dnl Cygwin            posix       -lpthread       Y      OK
 dnl
 dnl Any of the above  pth         -lpth                  0.0
 dnl
-dnl Mingw             win32                       N      OK
+dnl Mingw             windows                     N      OK
 dnl
 dnl BeOS 5            --
 dnl
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
index 3454b23..b88da76 100644
--- a/gl/m4/time_h.m4
+++ b/gl/m4/time_h.m4
@@ -1,6 +1,6 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2012 Free Software Foundation, Inc.
 
 # serial 6
 
@@ -25,7 +25,7 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY],
   AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
 ])
 
-dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
+dnl Define HAVE_STRUCT_TIMESPEC if 'struct timespec' is declared
 dnl in time.h, sys/time.h, or pthread.h.
 
 AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4
index d646edc..c3579fb 100644
--- a/gl/m4/time_r.m4
+++ b/gl/m4/time_r.m4
@@ -1,6 +1,6 @@
 dnl Reentrant time functions: localtime_r, gmtime_r.
 
-dnl Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2006-2012 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.
diff --git a/gl/m4/timespec.m4 b/gl/m4/timespec.m4
index 4a1c7ad..597b9c2 100644
--- a/gl/m4/timespec.m4
+++ b/gl/m4/timespec.m4
@@ -1,6 +1,6 @@
 #serial 14
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2012 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/gl/m4/uintmax_t.m4 b/gl/m4/uintmax_t.m4
index c1f954e..983b675 100644
--- a/gl/m4/uintmax_t.m4
+++ b/gl/m4/uintmax_t.m4
@@ -1,5 +1,5 @@
 # uintmax_t.m4 serial 12
-dnl Copyright (C) 1997-2004, 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2007-2012 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.
diff --git a/gl/m4/ungetc.m4 b/gl/m4/ungetc.m4
index 749f6bd..95bb3eb 100644
--- a/gl/m4/ungetc.m4
+++ b/gl/m4/ungetc.m4
@@ -1,5 +1,5 @@
 # ungetc.m4 serial 2
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 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.
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 57c8094..7595534 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,5 +1,5 @@
-# unistd_h.m4 serial 61
-dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
+# unistd_h.m4 serial 63
+dnl Copyright (C) 2006-2012 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.
@@ -41,10 +41,11 @@ AC_DEFUN([gl_UNISTD_H],
 #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])
+    gethostname getlogin getlogin_r getpagesize
+    getusershell setusershell endusershell
+    group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite
+    readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r
+    unlink unlinkat usleep])
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -82,6 +83,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_GETPAGESIZE=0;          AC_SUBST([GNULIB_GETPAGESIZE])
   GNULIB_GETUSERSHELL=0;         AC_SUBST([GNULIB_GETUSERSHELL])
   GNULIB_GROUP_MEMBER=0;         AC_SUBST([GNULIB_GROUP_MEMBER])
+  GNULIB_ISATTY=0;               AC_SUBST([GNULIB_ISATTY])
   GNULIB_LCHOWN=0;               AC_SUBST([GNULIB_LCHOWN])
   GNULIB_LINK=0;                 AC_SUBST([GNULIB_LINK])
   GNULIB_LINKAT=0;               AC_SUBST([GNULIB_LINKAT])
@@ -94,11 +96,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_READLINK=0;             AC_SUBST([GNULIB_READLINK])
   GNULIB_READLINKAT=0;           AC_SUBST([GNULIB_READLINKAT])
   GNULIB_RMDIR=0;                AC_SUBST([GNULIB_RMDIR])
+  GNULIB_SETHOSTNAME=0;          AC_SUBST([GNULIB_SETHOSTNAME])
   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_GETOPT=0;      AC_SUBST([GNULIB_UNISTD_H_GETOPT])
   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])
@@ -131,6 +133,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_PWRITE=1;          AC_SUBST([HAVE_PWRITE])
   HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
   HAVE_READLINKAT=1;      AC_SUBST([HAVE_READLINKAT])
+  HAVE_SETHOSTNAME=1;     AC_SUBST([HAVE_SETHOSTNAME])
   HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
   HAVE_SYMLINK=1;         AC_SUBST([HAVE_SYMLINK])
   HAVE_SYMLINKAT=1;       AC_SUBST([HAVE_SYMLINKAT])
@@ -143,6 +146,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   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_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME])
   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])
@@ -156,6 +160,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_GETLOGIN_R=0;   AC_SUBST([REPLACE_GETLOGIN_R])
   REPLACE_GETGROUPS=0;    AC_SUBST([REPLACE_GETGROUPS])
   REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
+  REPLACE_ISATTY=0;       AC_SUBST([REPLACE_ISATTY])
   REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
   REPLACE_LINK=0;         AC_SUBST([REPLACE_LINK])
   REPLACE_LINKAT=0;       AC_SUBST([REPLACE_LINKAT])
diff --git a/gl/m4/usleep.m4 b/gl/m4/usleep.m4
new file mode 100644
index 0000000..07fa9e9
--- /dev/null
+++ b/gl/m4/usleep.m4
@@ -0,0 +1,35 @@
+# usleep.m4 serial 2
+dnl Copyright (C) 2009-2012 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 macro intentionally does not check for select or nanosleep;
+dnl both of those modules can require external libraries.
+AC_DEFUN([gl_FUNC_USLEEP],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  dnl usleep was required in POSIX 2001, but dropped as obsolete in
+  dnl POSIX 2008; therefore, it is not always exposed in headers.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([usleep])
+  AC_CHECK_TYPE([useconds_t], [],
+    [AC_DEFINE([useconds_t], [unsigned int], [Define to an unsigned 32-bit
+      type if <sys/types.h> lacks this type.])])
+  if test $ac_cv_func_usleep = no; then
+    HAVE_USLEEP=0
+  else
+    dnl POSIX allows implementations to reject arguments larger than
+    dnl 999999, but GNU guarantees it will work.
+    AC_CACHE_CHECK([whether usleep allows large arguments],
+      [gl_cv_func_usleep_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <unistd.h>
+]], [[return !!usleep (1000000);]])],
+        [gl_cv_func_usleep_works=yes], [gl_cv_func_usleep_works=no],
+        [gl_cv_func_usleep_works="guessing no"])])
+    if test "$gl_cv_func_usleep_works" != yes; then
+      REPLACE_USLEEP=1
+    fi
+  fi
+])
diff --git a/gl/m4/valgrind-tests.m4 b/gl/m4/valgrind-tests.m4
index 9c4d029..077e025 100644
--- a/gl/m4/valgrind-tests.m4
+++ b/gl/m4/valgrind-tests.m4
@@ -1,5 +1,5 @@
-# valgrind-tests.m4 serial 2
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+# valgrind-tests.m4 serial 3
+dnl Copyright (C) 2008-2012 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.
@@ -21,9 +21,12 @@ AC_DEFUN([gl_VALGRIND_TESTS],
     AC_CHECK_PROGS(VALGRIND, valgrind)
   fi
 
-  if test -n "$VALGRIND" && $VALGRIND -q true > /dev/null 2>&1; then
+  OPTS="-q --error-exitcode=1 --suppressions=suppressions.valgrind"
+
+  if test -n "$VALGRIND" \
+     && $VALGRIND $OPTS $SHELL -c 'exit 0' > /dev/null 2>&1; then
     opt_valgrind_tests=yes
-    VALGRIND="$VALGRIND -q --error-exitcode=1 
--suppressions=suppressions.valgrind"
+    VALGRIND="$VALGRIND $OPTS"
   else
     opt_valgrind_tests=no
     VALGRIND=
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4
index da0a6d9..61fe499 100644
--- a/gl/m4/vasnprintf.m4
+++ b/gl/m4/vasnprintf.m4
@@ -1,5 +1,5 @@
 # vasnprintf.m4 serial 34
-dnl Copyright (C) 2002-2004, 2006-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006-2012 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.
diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4
index 6db52b1..205ceea 100644
--- a/gl/m4/vasprintf.m4
+++ b/gl/m4/vasprintf.m4
@@ -1,5 +1,5 @@
 # vasprintf.m4 serial 6
-dnl Copyright (C) 2002-2003, 2006-2007, 2009-2011 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2006-2007, 2009-2012 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,
diff --git a/gl/m4/version-etc.m4 b/gl/m4/version-etc.m4
index 5032bf8..4c6c678 100644
--- a/gl/m4/version-etc.m4
+++ b/gl/m4/version-etc.m4
@@ -1,5 +1,5 @@
 # version-etc.m4 serial 1
-# Copyright (C) 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2009-2012 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.
diff --git a/gl/m4/vfprintf-posix.m4 b/gl/m4/vfprintf-posix.m4
index 5ec93d1..441bd57 100644
--- a/gl/m4/vfprintf-posix.m4
+++ b/gl/m4/vfprintf-posix.m4
@@ -1,5 +1,5 @@
 # vfprintf-posix.m4 serial 14
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4
index 75c34b6..7b24d39 100644
--- a/gl/m4/visibility.m4
+++ b/gl/m4/visibility.m4
@@ -1,5 +1,5 @@
 # visibility.m4 serial 4 (gettext-0.18.2)
-dnl Copyright (C) 2005, 2008, 2010-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2008, 2010-2012 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.
diff --git a/gl/m4/vprintf-posix.m4 b/gl/m4/vprintf-posix.m4
index 299ff7e..0320352 100644
--- a/gl/m4/vprintf-posix.m4
+++ b/gl/m4/vprintf-posix.m4
@@ -1,5 +1,5 @@
 # vprintf-posix.m4 serial 3
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4
index d6ce1e6..22ec57b 100644
--- a/gl/m4/vsnprintf.m4
+++ b/gl/m4/vsnprintf.m4
@@ -1,5 +1,5 @@
 # vsnprintf.m4 serial 6
-dnl Copyright (C) 2002-2004, 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2007-2012 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.
diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4
index f09deef..03b113c 100644
--- a/gl/m4/warn-on-use.m4
+++ b/gl/m4/warn-on-use.m4
@@ -1,5 +1,5 @@
 # warn-on-use.m4 serial 4
-dnl Copyright (C) 2010-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2010-2012 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.
diff --git a/gl/m4/warnings.m4 b/gl/m4/warnings.m4
index a4a750a..69d05a6 100644
--- a/gl/m4/warnings.m4
+++ b/gl/m4/warnings.m4
@@ -1,5 +1,5 @@
 # warnings.m4 serial 5
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2012 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.
diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4
index 977491f..c7a8b2d 100644
--- a/gl/m4/wchar_h.m4
+++ b/gl/m4/wchar_h.m4
@@ -1,6 +1,6 @@
 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
 
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 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.
diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4
index d2c03c4..534735d 100644
--- a/gl/m4/wchar_t.m4
+++ b/gl/m4/wchar_t.m4
@@ -1,5 +1,5 @@
 # wchar_t.m4 serial 4 (gettext-0.18.2)
-dnl Copyright (C) 2002-2003, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2008-2012 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.
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4
index da1ce3d..3260cce 100644
--- a/gl/m4/wint_t.m4
+++ b/gl/m4/wint_t.m4
@@ -1,5 +1,5 @@
 # wint_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2012 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.
diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4
index 8c693bc..b3b7fee 100644
--- a/gl/m4/xsize.m4
+++ b/gl/m4/xsize.m4
@@ -1,5 +1,5 @@
 # xsize.m4 serial 4
-dnl Copyright (C) 2003-2004, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2004, 2008-2012 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.
diff --git a/gl/m4/yield.m4 b/gl/m4/yield.m4
index 15d5ac2..94e69c4 100644
--- a/gl/m4/yield.m4
+++ b/gl/m4/yield.m4
@@ -1,5 +1,5 @@
 # yield.m4 serial 2
-dnl Copyright (C) 2005-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2012 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.
diff --git a/gl/malloc.c b/gl/malloc.c
index da45618..ffe042b 100644
--- a/gl/malloc.c
+++ b/gl/malloc.c
@@ -1,6 +1,6 @@
 /* malloc() function that is glibc compatible.
 
-   Copyright (C) 1997-1998, 2006-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-1998, 2006-2007, 2009-2012 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
diff --git a/gl/math.in.h b/gl/math.in.h
index eadb489..0271afe 100644
--- a/gl/math.in.h
+++ b/gl/math.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <math.h>.
 
-   Copyright (C) 2002-2003, 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2007-2012 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
@@ -1246,7 +1246,7 @@ _GL_EXTERN_C int isnand (double x);
 /* Test whether X is a NaN.  */
 #  undef isnanl
 #  define isnanl rpl_isnanl
-_GL_EXTERN_C int isnanl (long double x);
+_GL_EXTERN_C int isnanl (long double x) _GL_ATTRIBUTE_CONST;
 # endif
 #endif
 
@@ -1272,7 +1272,7 @@ _GL_EXTERN_C int rpl_isnand (double x);
 #  if @HAVE_ISNANL@ && __GNUC__ >= 4
 #   define gl_isnan_l(x) __builtin_isnanl ((long double)(x))
 #  else
-_GL_EXTERN_C int rpl_isnanl (long double x);
+_GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
 #   define gl_isnan_l(x) rpl_isnanl (x)
 #  endif
 #  undef isnan
diff --git a/gl/memchr.c b/gl/memchr.c
index 6d903b1..b8fb0ef 100644
--- a/gl/memchr.c
+++ b/gl/memchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2011
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2012
    Free Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (address@hidden),
diff --git a/gl/memmem.c b/gl/memmem.c
index acd1a3e..3d97864 100644
--- a/gl/memmem.c
+++ b/gl/memmem.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2011 Free Software
+/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
diff --git a/gl/mempcpy.c b/gl/mempcpy.c
index 6a148a9..db7cdc9 100644
--- a/gl/mempcpy.c
+++ b/gl/mempcpy.c
@@ -1,5 +1,5 @@
 /* Copy memory area and return pointer after last written byte.
-   Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2007, 2009-2012 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
diff --git a/gl/minmax.h b/gl/minmax.h
index 172fafe..7f581c7 100644
--- a/gl/minmax.h
+++ b/gl/minmax.h
@@ -1,5 +1,5 @@
 /* MIN, MAX macros.
-   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2011 Free Software
+   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/msvc-inval.c b/gl/msvc-inval.c
index d10099e..b7a917d 100644
--- a/gl/msvc-inval.c
+++ b/gl/msvc-inval.c
@@ -1,5 +1,5 @@
 /* Invalid parameter handler for MSVC runtime libraries.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
@@ -40,7 +40,7 @@ gl_msvc_invalid_parameter_handler (const wchar_t *expression,
 
 # else
 
-/* Get declarations of the Win32 API functions.  */
+/* Get declarations of the native Windows API functions.  */
 #  define WIN32_LEAN_AND_MEAN
 #  include <windows.h>
 
diff --git a/gl/msvc-inval.h b/gl/msvc-inval.h
index 393272e..373f9bf 100644
--- a/gl/msvc-inval.h
+++ b/gl/msvc-inval.h
@@ -1,5 +1,5 @@
 /* Invalid parameter handler for MSVC runtime libraries.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
@@ -207,7 +207,7 @@ extern struct gl_msvc_inval_per_thread 
*gl_msvc_inval_current (void);
    or when SANE_LIBRARY_HANDLING is desired.  */
 
 /* The braces here avoid GCC warnings like
-   "warning: suggest explicit braces to avoid ambiguous `else'".  */
+   "warning: suggest explicit braces to avoid ambiguous 'else'".  */
 # define TRY_MSVC_INVAL \
     do                                                                         
\
       {                                                                        
\
diff --git a/gl/msvc-nothrow.c b/gl/msvc-nothrow.c
index 8965140..f0fea17 100644
--- a/gl/msvc-nothrow.c
+++ b/gl/msvc-nothrow.c
@@ -1,6 +1,6 @@
 /* Wrappers that don't throw invalid parameter notifications
    with MSVC runtime libraries.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
@@ -21,7 +21,7 @@
 /* Specification.  */
 #include "msvc-nothrow.h"
 
-/* Get declarations of the Win32 API functions.  */
+/* Get declarations of the native Windows API functions.  */
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
diff --git a/gl/msvc-nothrow.h b/gl/msvc-nothrow.h
index 462fb67..e066b24 100644
--- a/gl/msvc-nothrow.h
+++ b/gl/msvc-nothrow.h
@@ -1,6 +1,6 @@
 /* Wrappers that don't throw invalid parameter notifications
    with MSVC runtime libraries.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/netdb.in.h b/gl/netdb.in.h
index 69b6d5d..ddc97b9 100644
--- a/gl/netdb.in.h
+++ b/gl/netdb.in.h
@@ -1,5 +1,5 @@
 /* Provide a netdb.h header file for systems lacking it (read: MinGW).
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
@@ -80,9 +80,9 @@ struct addrinfo
 
 # endif
 
-/* Possible values for `ai_flags' field in `addrinfo' structure.  */
+/* Possible values for 'ai_flags' field in 'addrinfo' structure.  */
 # ifndef AI_PASSIVE
-#  define AI_PASSIVE    0x0001  /* Socket address is intended for `bind'.  */
+#  define AI_PASSIVE    0x0001  /* Socket address is intended for 'bind'.  */
 # endif
 # ifndef AI_CANONNAME
 #  define AI_CANONNAME  0x0002  /* Request for canonical name.  */
@@ -111,16 +111,16 @@ struct addrinfo
                                       returned address type.  */
 # endif
 
-/* Error values for `getaddrinfo' function.  */
+/* Error values for 'getaddrinfo' function.  */
 # ifndef EAI_BADFLAGS
-#  define EAI_BADFLAGS    -1    /* Invalid value for `ai_flags' field.  */
+#  define EAI_BADFLAGS    -1    /* Invalid value for 'ai_flags' field.  */
 #  define EAI_NONAME      -2    /* NAME or SERVICE is unknown.  */
 #  define EAI_AGAIN       -3    /* Temporary failure in name resolution.  */
 #  define EAI_FAIL        -4    /* Non-recoverable failure in name res.  */
 #  define EAI_NODATA      -5    /* No address associated with NAME.  */
-#  define EAI_FAMILY      -6    /* `ai_family' not supported.  */
-#  define EAI_SOCKTYPE    -7    /* `ai_socktype' not supported.  */
-#  define EAI_SERVICE     -8    /* SERVICE not supported for `ai_socktype'.  */
+#  define EAI_FAMILY      -6    /* 'ai_family' not supported.  */
+#  define EAI_SOCKTYPE    -7    /* 'ai_socktype' not supported.  */
+#  define EAI_SERVICE     -8    /* SERVICE not supported for 'ai_socktype'.  */
 #  define EAI_MEMORY      -10   /* Memory allocation failure.  */
 # endif
 
@@ -141,7 +141,7 @@ struct addrinfo
 # endif
 # ifndef EAI_SYSTEM
 /* Not defined on mingw32. */
-#  define EAI_SYSTEM      -11   /* System error returned in `errno'.  */
+#  define EAI_SYSTEM      -11   /* System error returned in 'errno'.  */
 # endif
 
 # if 0
@@ -179,7 +179,7 @@ _GL_CXXALIAS_SYS (getaddrinfo, int,
 _GL_CXXALIASWARN (getaddrinfo);
 
 # if address@hidden@
-/* Free `addrinfo' structure AI including associated storage.
+/* Free 'addrinfo' structure AI including associated storage.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
 _GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
diff --git a/gl/netinet_in.in.h b/gl/netinet_in.in.h
index 966d6a5..e06dfe0 100644
--- a/gl/netinet_in.in.h
+++ b/gl/netinet_in.in.h
@@ -1,5 +1,5 @@
 /* Substitute for <netinet/in.h>.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/opendir.c b/gl/opendir.c
index 20ae75e..50e25e3 100644
--- a/gl/opendir.c
+++ b/gl/opendir.c
@@ -1,5 +1,5 @@
 /* Start reading the entries of a directory.
-   Copyright (C) 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 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
diff --git a/gl/override/m4/valgrind-tests.m4.diff 
b/gl/override/m4/valgrind-tests.m4.diff
index dac9a24..d94b157 100644
--- a/gl/override/m4/valgrind-tests.m4.diff
+++ b/gl/override/m4/valgrind-tests.m4.diff
@@ -1,11 +1,11 @@
---- valgrind-tests.m4.orig     2011-05-21 09:37:17.415555504 +0200
-+++ valgrind-tests.m4  2011-05-21 09:37:34.600259721 +0200
-@@ -23,7 +23,7 @@
+--- valgrind-tests.m4.orig
++++ valgrind-tests.m4
+@@ -21,7 +21,7 @@ AC_DEFUN([gl_VALGRIND_TESTS],
+     AC_CHECK_PROGS(VALGRIND, valgrind)
+   fi
  
-   if test -n "$VALGRIND" && $VALGRIND -q true > /dev/null 2>&1; then
-     opt_valgrind_tests=yes
--    VALGRIND="$VALGRIND -q --error-exitcode=1 --leak-check=full"
-+    VALGRIND="$VALGRIND -q --error-exitcode=1 
--suppressions=suppressions.valgrind"
-   else
-     opt_valgrind_tests=no
-     VALGRIND=
+-  OPTS="-q --error-exitcode=1 --leak-check=full"
++  OPTS="-q --error-exitcode=1 --suppressions=suppressions.valgrind"
+ 
+   if test -n "$VALGRIND" \
+      && $VALGRIND $OPTS $SHELL -c 'exit 0' > /dev/null 2>&1; then
diff --git a/gl/printf-args.c b/gl/printf-args.c
index 8f3727b..979435f 100644
--- a/gl/printf-args.c
+++ b/gl/printf-args.c
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2011 Free Software
+   Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/printf-args.h b/gl/printf-args.h
index 70cca4f..39ec7f4 100644
--- a/gl/printf-args.h
+++ b/gl/printf-args.h
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2006-2007, 2011 Free Software
+   Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/printf-frexp.c b/gl/printf-frexp.c
index 267081c..eb47205 100644
--- a/gl/printf-frexp.c
+++ b/gl/printf-frexp.c
@@ -1,5 +1,5 @@
 /* Split a double into fraction and mantissa, for hexadecimal printf.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/printf-frexp.h b/gl/printf-frexp.h
index 10dd371..985d7d2 100644
--- a/gl/printf-frexp.h
+++ b/gl/printf-frexp.h
@@ -1,5 +1,5 @@
 /* Split a double into fraction and mantissa, for hexadecimal printf.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/printf-frexpl.c b/gl/printf-frexpl.c
index 2de6528..568d2ff 100644
--- a/gl/printf-frexpl.c
+++ b/gl/printf-frexpl.c
@@ -1,5 +1,5 @@
 /* Split a 'long double' into fraction and mantissa, for hexadecimal printf.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/printf-frexpl.h b/gl/printf-frexpl.h
index a8cbcbf..341dded 100644
--- a/gl/printf-frexpl.h
+++ b/gl/printf-frexpl.h
@@ -1,5 +1,5 @@
 /* Split a 'long double' into fraction and mantissa, for hexadecimal printf.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/printf-parse.c b/gl/printf-parse.c
index ff24ba4..d2a58a1 100644
--- a/gl/printf-parse.c
+++ b/gl/printf-parse.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999-2000, 2002-2003, 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2003, 2006-2012 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
@@ -421,7 +421,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, 
arguments *a)
                     }
 #endif
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                  /* On native Win32, PRIdMAX is defined as "I64d".
+                  /* On native Windows, 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')
diff --git a/gl/printf-parse.h b/gl/printf-parse.h
index 76e5ba3..3830f3c 100644
--- a/gl/printf-parse.h
+++ b/gl/printf-parse.h
@@ -1,5 +1,5 @@
 /* Parse printf format string.
-   Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2011 Free Software
+   Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/progname.c b/gl/progname.c
index 2465748..bdd4dd7 100644
--- a/gl/progname.c
+++ b/gl/progname.c
@@ -1,5 +1,5 @@
 /* Program name management.
-   Copyright (C) 2001-2003, 2005-2011 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2001.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/progname.h b/gl/progname.h
index 0844066..a75a02e 100644
--- a/gl/progname.h
+++ b/gl/progname.h
@@ -1,5 +1,5 @@
 /* Program name management.
-   Copyright (C) 2001-2004, 2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2006, 2009-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2001.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/rawmemchr.c b/gl/rawmemchr.c
index 095a50a..c94a0e1 100644
--- a/gl/rawmemchr.c
+++ b/gl/rawmemchr.c
@@ -1,5 +1,5 @@
 /* Searching in a string.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/read-file.c b/gl/read-file.c
index bcbfbbb..72ab4e8 100644
--- a/gl/read-file.c
+++ b/gl/read-file.c
@@ -1,5 +1,5 @@
 /* read-file.c -- read file contents into a string
-   Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
    Written by Simon Josefsson and Bruno Haible.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/read-file.h b/gl/read-file.h
index 42663ef..b45b76d 100644
--- a/gl/read-file.h
+++ b/gl/read-file.h
@@ -1,5 +1,5 @@
 /* read-file.h -- read file contents into a string
-   Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/readdir.c b/gl/readdir.c
index 04858b0..28aff9c 100644
--- a/gl/readdir.c
+++ b/gl/readdir.c
@@ -1,5 +1,5 @@
 /* Read the next entry of a directory.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/realloc.c b/gl/realloc.c
index 0c96ffa..99556cc 100644
--- a/gl/realloc.c
+++ b/gl/realloc.c
@@ -1,6 +1,6 @@
 /* realloc() function that is glibc compatible.
 
-   Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2011 Free Software
+   Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/recv.c b/gl/recv.c
index 4755f63..c6e2c00 100644
--- a/gl/recv.c
+++ b/gl/recv.c
@@ -1,6 +1,6 @@
 /* recv.c --- wrappers for Windows recv function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/recvfrom.c b/gl/recvfrom.c
index 5ce2b12..2f0ecdb 100644
--- a/gl/recvfrom.c
+++ b/gl/recvfrom.c
@@ -1,6 +1,6 @@
 /* recvfrom.c --- wrappers for Windows recvfrom function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/scandir.c b/gl/scandir.c
index 0ce67f0..da1287b 100644
--- a/gl/scandir.c
+++ b/gl/scandir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-1998, 2000, 2002-2003, 2009-2011 Free Software
+/* Copyright (C) 1992-1998, 2000, 2002-2003, 2009-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
diff --git a/gl/select.c b/gl/select.c
index 236b951..8bcfef0 100644
--- a/gl/select.c
+++ b/gl/select.c
@@ -1,7 +1,7 @@
 /* Emulation for select(2)
    Contributed by Paolo Bonzini.
 
-   Copyright 2008-2011 Free Software Foundation, Inc.
+   Copyright 2008-2012 Free Software Foundation, Inc.
 
    This file is part of gnulib.
 
@@ -24,7 +24,7 @@
 #include <assert.h>
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Native Win32.  */
+/* Native Windows.  */
 
 #include <sys/types.h>
 #include <errno.h>
@@ -78,6 +78,8 @@ typedef DWORD (WINAPI *PNtQueryInformationFile)
 #define PIPE_BUF        512
 #endif
 
+/* Optimized test whether a HANDLE refers to a console.
+   See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>.  
*/
 #define IsConsoleHandle(h) (((long) (h) & 3) == 3)
 
 static BOOL
@@ -95,11 +97,14 @@ IsSocketHandle (HANDLE h)
   return ev.lNetworkEvents != 0xDEADBEEF;
 }
 
-/* Compute output fd_sets for libc descriptor FD (whose Win32 handle is H).  */
+/* Compute output fd_sets for libc descriptor FD (whose Windows handle is
+   H).  */
 
 static int
-win32_poll_handle (HANDLE h, int fd, struct bitset *rbits, struct bitset 
*wbits,
-                   struct bitset *xbits)
+windows_poll_handle (HANDLE h, int fd,
+                    struct bitset *rbits,
+                    struct bitset *wbits,
+                     struct bitset *xbits)
 {
   BOOL read, write, except;
   int i, ret;
@@ -140,11 +145,12 @@ win32_poll_handle (HANDLE h, int fd, struct bitset 
*rbits, struct bitset *wbits,
         {
           /* It was the write-end of the pipe.  Check if it is writable.
              If NtQueryInformationFile fails, optimistically assume the pipe is
-             writable.  This could happen on Win9x, where 
NtQueryInformationFile
-             is not available, or if we inherit a pipe that doesn't permit
-             FILE_READ_ATTRIBUTES access on the write end (I think this should
-             not happen since WinXP SP2; WINE seems fine too).  Otherwise,
-             ensure that enough space is available for atomic writes.  */
+             writable.  This could happen on Windows 9x, where
+             NtQueryInformationFile is not available, or if we inherit a pipe
+             that doesn't permit FILE_READ_ATTRIBUTES access on the write end
+             (I think this should not happen since Windows XP SP2; WINE seems
+             fine too).  Otherwise, ensure that enough space is available for
+             atomic writes.  */
           memset (&iosb, 0, sizeof (iosb));
           memset (&fpli, 0, sizeof (fpli));
 
@@ -369,7 +375,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
 
           /* Poll now.  If we get an event, do not wait below.  */
           if (wait_timeout != 0
-              && win32_poll_handle (h, i, &rbits, &wbits, &xbits))
+              && windows_poll_handle (h, i, &rbits, &wbits, &xbits))
             wait_timeout = 0;
         }
     }
@@ -446,7 +452,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
         {
           /* Not a socket.  */
           nhandles++;
-          win32_poll_handle (h, i, &rbits, &wbits, &xbits);
+          windows_poll_handle (h, i, &rbits, &wbits, &xbits);
           if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
             {
               rc++;
@@ -468,7 +474,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
   return rc;
 }
 
-#else /* ! Native Win32.  */
+#else /* ! Native Windows.  */
 
 #include <sys/select.h>
 
diff --git a/gl/send.c b/gl/send.c
index cd21482..83fe8e6 100644
--- a/gl/send.c
+++ b/gl/send.c
@@ -1,6 +1,6 @@
 /* send.c --- wrappers for Windows send function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/sendto.c b/gl/sendto.c
index 95efab8..ab575f4 100644
--- a/gl/sendto.c
+++ b/gl/sendto.c
@@ -1,6 +1,6 @@
 /* sendto.c --- wrappers for Windows sendto function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/setsockopt.c b/gl/setsockopt.c
index 6a7ca5e..9f414d5 100644
--- a/gl/setsockopt.c
+++ b/gl/setsockopt.c
@@ -1,6 +1,6 @@
 /* setsockopt.c --- wrappers for Windows setsockopt function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/shutdown.c b/gl/shutdown.c
index 1c302a2..ea19421 100644
--- a/gl/shutdown.c
+++ b/gl/shutdown.c
@@ -1,6 +1,6 @@
 /* shutdown.c --- wrappers for Windows shutdown function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/signal.in.h b/gl/signal.in.h
index e18e0b2..e0f0554 100644
--- a/gl/signal.in.h
+++ b/gl/signal.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <signal.h>.
 
-   Copyright (C) 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 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
diff --git a/gl/signbitd.c b/gl/signbitd.c
index 4042349..7629ff5 100644
--- a/gl/signbitd.c
+++ b/gl/signbitd.c
@@ -1,5 +1,5 @@
 /* signbit() macro: Determine the sign bit of a floating-point number.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/signbitf.c b/gl/signbitf.c
index 3ec472f..f99f992 100644
--- a/gl/signbitf.c
+++ b/gl/signbitf.c
@@ -1,5 +1,5 @@
 /* signbit() macro: Determine the sign bit of a floating-point number.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/signbitl.c b/gl/signbitl.c
index 4453d8f..35afcf1 100644
--- a/gl/signbitl.c
+++ b/gl/signbitl.c
@@ -1,5 +1,5 @@
 /* signbit() macro: Determine the sign bit of a floating-point number.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/size_max.h b/gl/size_max.h
index d5f3152..e669bf1 100644
--- a/gl/size_max.h
+++ b/gl/size_max.h
@@ -1,5 +1,5 @@
 /* size_max.h -- declare SIZE_MAX through system headers
-   Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2012 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/sleep.c b/gl/sleep.c
index 45b9d80..e5d3299 100644
--- a/gl/sleep.c
+++ b/gl/sleep.c
@@ -1,5 +1,5 @@
 /* Pausing execution of the current thread.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2007.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/snprintf.c b/gl/snprintf.c
index 9db2379..bb01880 100644
--- a/gl/snprintf.c
+++ b/gl/snprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 2004, 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006-2012 Free Software Foundation, Inc.
    Written by Simon Josefsson and Paul Eggert.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/socket.c b/gl/socket.c
index af6be25..c668df0 100644
--- a/gl/socket.c
+++ b/gl/socket.c
@@ -1,6 +1,6 @@
 /* socket.c --- wrappers for Windows socket function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/sockets.c b/gl/sockets.c
index 39939b0..3daec45 100644
--- a/gl/sockets.c
+++ b/gl/sockets.c
@@ -1,6 +1,6 @@
 /* sockets.c --- wrappers for Windows socket functions
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/sockets.h b/gl/sockets.h
index 323f68c..2efa413 100644
--- a/gl/sockets.h
+++ b/gl/sockets.h
@@ -1,6 +1,6 @@
 /* sockets.h - wrappers for Windows socket functions
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
@@ -26,8 +26,17 @@
 #define SOCKETS_2_1 0x201
 #define SOCKETS_2_2 0x202
 
-int gl_sockets_startup (int version);
-int gl_sockets_cleanup (void);
+int gl_sockets_startup (int version)
+#if !WINDOWS_SOCKETS
+  _GL_ATTRIBUTE_CONST
+#endif
+  ;
+
+int gl_sockets_cleanup (void)
+#if !WINDOWS_SOCKETS
+  _GL_ATTRIBUTE_CONST
+#endif
+  ;
 
 /* This function is useful it you create a socket using gnulib's
    Winsock wrappers but needs to pass on the socket handle to some
diff --git a/gl/stdalign.in.h b/gl/stdalign.in.h
index 79e5691..ae8d5b9 100644
--- a/gl/stdalign.in.h
+++ b/gl/stdalign.in.h
@@ -1,6 +1,6 @@
-/* A substitute for ISO C 1x <stdalign.h>.
+/* A substitute for ISO C11 <stdalign.h>.
 
-   Copyright 2011 Free Software Foundation, Inc.
+   Copyright 2011-2012 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
@@ -21,12 +21,14 @@
 #ifndef _GL_STDALIGN_H
 #define _GL_STDALIGN_H
 
-/* ISO C1X <stdalign.h> for platforms that lack it.
+/* ISO C11 <stdalign.h> for platforms that lack it.
 
    References:
-   ISO C1X <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>
+   ISO C11 (latest free draft
+   <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>)
    sections 6.5.3.4, 6.7.5, 7.15.
-   C++0X <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>
+   C++11 (latest free draft
+   <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>)
    section 18.10. */
 
 /* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
@@ -68,7 +70,7 @@
    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:
+   The following C11 requirements are not supported here:
 
      - If A is zero, alignas has no effect.
      - alignas can be used multiple times; the strictest one wins.
diff --git a/gl/stdarg.in.h b/gl/stdarg.in.h
index 43f9607..3e0e43f 100644
--- a/gl/stdarg.in.h
+++ b/gl/stdarg.in.h
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <stdarg.h>.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/stdbool.in.h b/gl/stdbool.in.h
index b64dc75..cabe4b8 100644
--- a/gl/stdbool.in.h
+++ b/gl/stdbool.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2001.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/stddef.in.h b/gl/stddef.in.h
index c7b98e7..65e1775 100644
--- a/gl/stddef.in.h
+++ b/gl/stddef.in.h
@@ -1,6 +1,6 @@
 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
 
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/stdint.in.h b/gl/stdint.in.h
index b6d08c7..6129f1a 100644
--- a/gl/stdint.in.h
+++ b/gl/stdint.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2012 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
@@ -49,6 +49,17 @@
       diagnostics.  */
 #  define __STDINT_H__
 # endif
+
+  /* Some pre-C++11 <stdint.h> implementations need this.  */
+# ifdef __cplusplus
+#  ifndef __STDC_CONSTANT_MACROS
+#   define __STDC_CONSTANT_MACROS 1
+#  endif
+#  ifndef __STDC_LIMIT_MACROS
+#   define __STDC_LIMIT_MACROS 1
+#  endif
+# endif
+
   /* Other systems may have an incomplete or buggy <stdint.h>.
      Include it before <inttypes.h>, since any "#include <stdint.h>"
      in <inttypes.h> would reinclude us, skipping our contents because
@@ -313,8 +324,6 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof 
(uintmax_t)
 
 /* 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
@@ -534,12 +543,8 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == 
sizeof (uintmax_t)
 #define WINT_MAX  \
    _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, address@hidden@)
 
-#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 */
 
@@ -600,7 +605,5 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof 
(uintmax_t)
 # endif
 #endif
 
-#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
-
 #endif /* address@hidden@_STDINT_H */
 #endif /* !defined address@hidden@_STDINT_H && !defined 
_GL_JUST_INCLUDE_SYSTEM_STDINT_H */
diff --git a/gl/stdio-impl.h b/gl/stdio-impl.h
index d41c32f..a065c1a 100644
--- a/gl/stdio-impl.h
+++ b/gl/stdio-impl.h
@@ -1,5 +1,5 @@
 /* Implementation details of FILE streams.
-   Copyright (C) 2007-2008, 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2008, 2010-2012 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
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index ce00af5..0481930 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2012 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
@@ -186,7 +186,7 @@ _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 - "
+_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX 
compliant - "
                  "use gnulib module fdopen for portability");
 #endif
 
@@ -259,7 +259,7 @@ _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 - "
+_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX 
compliant - "
                  "use gnulib module fopen for portability");
 #endif
 
@@ -387,7 +387,7 @@ _GL_CXXALIASWARN (freopen);
 # undef freopen
 /* Assume freopen is always declared.  */
 _GL_WARN_ON_USE (freopen,
-                 "freopen on Win32 platforms is not POSIX compatible - "
+                 "freopen on native Windows platforms is not POSIX compliant - 
"
                  "use gnulib module freopen for portability");
 #endif
 
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index 1a8df49..ea1c1c3 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2012 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
@@ -455,6 +455,32 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
 # 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 address@hidden@
+_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)
diff --git a/gl/str-two-way.h b/gl/str-two-way.h
index 08a6cd3..c47503f 100644
--- a/gl/str-two-way.h
+++ b/gl/str-two-way.h
@@ -1,5 +1,5 @@
 /* Byte-wise substring search, using the Two-Way algorithm.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Eric Blake <address@hidden>, 2008.
 
diff --git a/gl/strcasecmp.c b/gl/strcasecmp.c
index 9a77bb5..bc2bd12 100644
--- a/gl/strcasecmp.c
+++ b/gl/strcasecmp.c
@@ -1,5 +1,5 @@
 /* Case-insensitive string comparison function.
-   Copyright (C) 1998-1999, 2005-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2007, 2009-2012 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
diff --git a/gl/strchrnul.c b/gl/strchrnul.c
index 61db4e8..1be4249 100644
--- a/gl/strchrnul.c
+++ b/gl/strchrnul.c
@@ -1,5 +1,5 @@
 /* Searching in a string.
-   Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2007-2012 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
diff --git a/gl/strdup.c b/gl/strdup.c
index ba7e76b..c083551 100644
--- a/gl/strdup.c
+++ b/gl/strdup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2011 Free Software
+/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2012 Free Software
    Foundation, Inc.
 
    This file is part of the GNU C Library.
diff --git a/gl/strerror-override.c b/gl/strerror-override.c
index 4e2c32b..9ca6523 100644
--- a/gl/strerror-override.c
+++ b/gl/strerror-override.c
@@ -1,6 +1,6 @@
 /* strerror-override.c --- POSIX compatible system error routine
 
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 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
diff --git a/gl/strerror-override.h b/gl/strerror-override.h
index 09540b9..09526ea 100644
--- a/gl/strerror-override.h
+++ b/gl/strerror-override.h
@@ -1,6 +1,6 @@
 /* strerror-override.h --- POSIX compatible system error routine
 
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 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
diff --git a/gl/strerror.c b/gl/strerror.c
index 63899ca..587bd21 100644
--- a/gl/strerror.c
+++ b/gl/strerror.c
@@ -1,6 +1,6 @@
 /* strerror.c --- POSIX compatible system error routine
 
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/string.in.h b/gl/string.in.h
index 62d7994..93f70de 100644
--- a/gl/string.in.h
+++ b/gl/string.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <string.h>.
 
-   Copyright (C) 1995-1996, 2001-2011 Free Software Foundation, Inc.
+   Copyright (C) 1995-1996, 2001-2012 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
diff --git a/gl/strings.in.h b/gl/strings.in.h
index 8bb455e..4724eee 100644
--- a/gl/strings.in.h
+++ b/gl/strings.in.h
@@ -1,6 +1,6 @@
 /* A substitute <strings.h>.
 
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/stripslash.c b/gl/stripslash.c
index 1212440..ef458c6 100644
--- a/gl/stripslash.c
+++ b/gl/stripslash.c
@@ -1,6 +1,6 @@
 /* stripslash.c -- remove redundant trailing slashes from a file name
 
-   Copyright (C) 1990, 2001, 2003-2006, 2009-2011 Free Software Foundation,
+   Copyright (C) 1990, 2001, 2003-2006, 2009-2012 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -35,7 +35,7 @@ strip_trailing_slashes (char *file)
   bool had_slash;
 
   /* last_component returns "" for file system roots, but we need to turn
-     `///' into `/'.  */
+     "///" into "/".  */
   if (! *base)
     base = file;
   base_lim = base + base_len (base);
diff --git a/gl/strncasecmp.c b/gl/strncasecmp.c
index 1e0d75f..fa65ba0 100644
--- a/gl/strncasecmp.c
+++ b/gl/strncasecmp.c
@@ -1,5 +1,5 @@
 /* strncasecmp.c -- case insensitive string comparator
-   Copyright (C) 1998-1999, 2005-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2007, 2009-2012 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
diff --git a/gl/strndup.c b/gl/strndup.c
index 4a3bece..6d0eaf2 100644
--- a/gl/strndup.c
+++ b/gl/strndup.c
@@ -1,6 +1,6 @@
 /* A replacement function, for systems that lack strndup.
 
-   Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2011 Free Software
+   Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
diff --git a/gl/strnlen.c b/gl/strnlen.c
index 3cefa97..7778537 100644
--- a/gl/strnlen.c
+++ b/gl/strnlen.c
@@ -1,5 +1,5 @@
 /* Find the length of STRING, but scan at most MAXLEN characters.
-   Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2007, 2009-2012 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/strverscmp.c b/gl/strverscmp.c
index bbcad44..6a34933 100644
--- a/gl/strverscmp.c
+++ b/gl/strverscmp.c
@@ -1,5 +1,5 @@
 /* Compare strings while treating digits characters numerically.
-   Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2011 Free Software
+   Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jean-François Bignolles <address@hidden>, 1997.
@@ -43,7 +43,7 @@
    - It's typically faster.
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
    isdigit unless it's important to use the locale's definition
-   of `digit' even when the host does not conform to POSIX.  */
+   of "digit" even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
 #undef __strverscmp
diff --git a/gl/sys_select.in.h b/gl/sys_select.in.h
index 4406a7a..5f93fb1 100644
--- a/gl/sys_select.in.h
+++ b/gl/sys_select.in.h
@@ -1,5 +1,5 @@
 /* Substitute for <sys/select.h>.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h
index 43681a4..49b61de 100644
--- a/gl/sys_socket.in.h
+++ b/gl/sys_socket.in.h
@@ -1,6 +1,6 @@
 /* Provide a sys/socket header file for systems lacking it (read: MinGW)
    and for systems where it is incomplete.
-   Copyright (C) 2005-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2012 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h
index 77a7177..d93d3fd 100644
--- a/gl/sys_stat.in.h
+++ b/gl/sys_stat.in.h
@@ -1,5 +1,5 @@
 /* Provide a more complete sys/stat header file.
-   Copyright (C) 2005-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2012 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
diff --git a/gl/sys_time.in.h b/gl/sys_time.in.h
index db4eeae..c9ee565 100644
--- a/gl/sys_time.in.h
+++ b/gl/sys_time.in.h
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/time.h.
 
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/sys_types.in.h b/gl/sys_types.in.h
index 63389de..f37b999 100644
--- a/gl/sys_types.in.h
+++ b/gl/sys_types.in.h
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/types.h.
 
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/sys_uio.in.h b/gl/sys_uio.in.h
index 6995e6c..07b9629 100644
--- a/gl/sys_uio.in.h
+++ b/gl/sys_uio.in.h
@@ -1,5 +1,5 @@
 /* Substitute for <sys/uio.h>.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/sysexits.in.h b/gl/sysexits.in.h
index f925b69..8e8c962 100644
--- a/gl/sysexits.in.h
+++ b/gl/sysexits.in.h
@@ -1,5 +1,5 @@
 /* exit() exit codes for some BSD system programs.
-   Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2012 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
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index 0edbe38..e7f83f3 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2011 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 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
@@ -388,6 +388,15 @@ EXTRA_DIST += test-fwrite.c signature.h macros.h
 
 ## end   gnulib module fwrite-tests
 
+## begin gnulib module getaddrinfo-tests
+
+TESTS += test-getaddrinfo
+check_PROGRAMS += test-getaddrinfo
+test_getaddrinfo_LDADD = $(LDADD) @GETADDRINFO_LIB@ @LIBINTL@
+EXTRA_DIST += signature.h test-getaddrinfo.c
+
+## end   gnulib module getaddrinfo-tests
+
 ## begin gnulib module getcwd-lgpl
 
 
@@ -507,7 +516,7 @@ BUILT_SOURCES += inttypes.h
 
 # We need the following in order to create <inttypes.h> when the system
 # doesn't have one that works with the given compiler.
-inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) 
$(ARG_NONNULL_H)
+inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
@@ -528,10 +537,12 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status 
$(WARN_ON_USE_H) $(ARG_N
              -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
              -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
              -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
+             -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \
              -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' 
\
              -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
              -e 
's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
              -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/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)/inttypes.in.h; \
@@ -738,7 +749,7 @@ EXTRA_libtests_a_SOURCES += perror.c
 
 TESTS += test-perror.sh test-perror2
 check_PROGRAMS += test-perror test-perror2
-EXTRA_DIST += init.sh macros.h signature.h test-perror.c test-perror2.c 
test-perror.sh
+EXTRA_DIST += macros.h signature.h test-perror.c test-perror2.c test-perror.sh
 
 ## end   gnulib module perror-tests
 
@@ -1258,6 +1269,14 @@ EXTRA_DIST += test-sysexits.c
 
 ## end   gnulib module sysexits-tests
 
+## begin gnulib module test-framework-sh-tests
+
+TESTS += test-init.sh
+EXTRA_DIST += init.sh
+EXTRA_DIST += test-init.sh
+
+## end   gnulib module test-framework-sh-tests
+
 ## begin gnulib module thread
 
 libtests_a_SOURCES += glthread/thread.h glthread/thread.c
@@ -1323,6 +1342,14 @@ EXTRA_DIST += test-unsetenv.c signature.h macros.h
 
 ## end   gnulib module unsetenv-tests
 
+## begin gnulib module usleep-tests
+
+TESTS += test-usleep
+check_PROGRAMS += test-usleep
+EXTRA_DIST += test-usleep.c signature.h macros.h
+
+## end   gnulib module usleep-tests
+
 ## begin gnulib module vasnprintf-tests
 
 TESTS += test-vasnprintf
@@ -1346,7 +1373,7 @@ EXTRA_DIST += test-vasprintf.c signature.h macros.h
 TESTS += test-vc-list-files-git.sh
 TESTS += test-vc-list-files-cvs.sh
 TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)'
-EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh init.sh
+EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh
 
 ## end   gnulib module vc-list-files-tests
 
@@ -1355,7 +1382,7 @@ EXTRA_DIST += test-vc-list-files-git.sh 
test-vc-list-files-cvs.sh init.sh
 TESTS_ENVIRONMENT += MAKE='$(MAKE)'
 TESTS += test-verify test-verify.sh
 check_PROGRAMS += test-verify
-EXTRA_DIST += test-verify.c test-verify.sh init.sh
+EXTRA_DIST += test-verify.c test-verify.sh
 
 ## end   gnulib module verify-tests
 
diff --git a/gl/tests/binary-io.h b/gl/tests/binary-io.h
index c09dbf5..824ad5b 100644
--- a/gl/tests/binary-io.h
+++ b/gl/tests/binary-io.h
@@ -1,5 +1,5 @@
 /* Binary mode I/O.
-   Copyright (C) 2001, 2003, 2005, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2005, 2008-2012 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
diff --git a/gl/tests/dup2.c b/gl/tests/dup2.c
index 790c98a..f6d0f1c 100644
--- a/gl/tests/dup2.c
+++ b/gl/tests/dup2.c
@@ -1,6 +1,6 @@
 /* Duplicate an open file descriptor to a specified file descriptor.
 
-   Copyright (C) 1999, 2004-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004-2007, 2009-2012 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
@@ -31,7 +31,7 @@
 
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
-/* Get declarations of the Win32 API functions.  */
+/* Get declarations of the native Windows API functions.  */
 #  define WIN32_LEAN_AND_MEAN
 #  include <windows.h>
 
diff --git a/gl/tests/fcntl.in.h b/gl/tests/fcntl.in.h
index 0a07221..84ae3ee 100644
--- a/gl/tests/fcntl.in.h
+++ b/gl/tests/fcntl.in.h
@@ -1,6 +1,6 @@
 /* Like <fcntl.h>, but with non-working flags defined to 0.
 
-   Copyright (C) 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 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
@@ -177,12 +177,12 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
 /* Fix up the O_* macros.  */
 
 #if !defined O_DIRECT && defined O_DIRECTIO
-/* Tru64 spells it `O_DIRECTIO'.  */
+/* Tru64 spells it 'O_DIRECTIO'.  */
 # define O_DIRECT O_DIRECTIO
 #endif
 
 #if !defined O_CLOEXEC && defined O_NOINHERIT
-/* Mingw spells it `O_NOINHERIT'.  */
+/* Mingw spells it 'O_NOINHERIT'.  */
 # define O_CLOEXEC O_NOINHERIT
 #endif
 
diff --git a/gl/tests/fdopen.c b/gl/tests/fdopen.c
index 50c889b..6595b16 100644
--- a/gl/tests/fdopen.c
+++ b/gl/tests/fdopen.c
@@ -1,5 +1,5 @@
 /* Open a stream with a given file descriptor.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/getcwd-lgpl.c b/gl/tests/getcwd-lgpl.c
index 2761422..f1e821b 100644
--- a/gl/tests/getcwd-lgpl.c
+++ b/gl/tests/getcwd-lgpl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2012 Free Software Foundation, Inc.
    This file is part of gnulib.
 
    This program is free software: you can redistribute it and/or modify
@@ -32,7 +32,7 @@ typedef int dummy;
    (perhaps because the absolute name was longer than PATH_MAX, or
    because of missing read/search permissions on parent directories)
    or SIZE was too small.  If successful, returns BUF.  If BUF is
-   NULL, an array is allocated with `malloc'; the array is SIZE bytes
+   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.  */
 
diff --git a/gl/tests/getpagesize.c b/gl/tests/getpagesize.c
index d7c1ba8..02c00fb 100644
--- a/gl/tests/getpagesize.c
+++ b/gl/tests/getpagesize.c
@@ -1,6 +1,6 @@
 /* getpagesize emulation for systems where it cannot be done in a C macro.
 
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
@@ -22,7 +22,7 @@
 /* Specification. */
 #include <unistd.h>
 
-/* This implementation is only for native Win32 systems.  */
+/* This implementation is only for native Windows systems.  */
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
 # define WIN32_LEAN_AND_MEAN
diff --git a/gl/tests/glthread/lock.c b/gl/tests/glthread/lock.c
index 64dbd3f..3ab4fad 100644
--- a/gl/tests/glthread/lock.c
+++ b/gl/tests/glthread/lock.c
@@ -1,5 +1,5 @@
 /* Locking in multithreaded situations.
-   Copyright (C) 2005-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2012 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
@@ -630,7 +630,7 @@ glthread_once_singlethreaded (gl_once_t *once_control)
 
 /* ========================================================================= */
 
-#if USE_WIN32_THREADS
+#if USE_WINDOWS_THREADS
 
 /* -------------------------- gl_lock_t datatype -------------------------- */
 
diff --git a/gl/tests/glthread/lock.h b/gl/tests/glthread/lock.h
index 028d881..02377cd 100644
--- a/gl/tests/glthread/lock.h
+++ b/gl/tests/glthread/lock.h
@@ -1,5 +1,5 @@
 /* Locking in multithreaded situations.
-   Copyright (C) 2005-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2012 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
@@ -614,7 +614,7 @@ extern int glthread_once_singlethreaded (gl_once_t 
*once_control);
 
 /* ========================================================================= */
 
-#if USE_WIN32_THREADS
+#if USE_WINDOWS_THREADS
 
 # define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 # include <windows.h>
@@ -623,8 +623,8 @@ extern int glthread_once_singlethreaded (gl_once_t 
*once_control);
 extern "C" {
 # endif
 
-/* We can use CRITICAL_SECTION directly, rather than the Win32 Event, Mutex,
-   Semaphore types, because
+/* We can use CRITICAL_SECTION directly, rather than the native Windows Event,
+   Mutex, Semaphore types, because
      - we need only to synchronize inside a single process (address space),
        not inter-process locking,
      - we don't need to support trylock operations.  (TryEnterCriticalSection
@@ -710,9 +710,9 @@ extern int glthread_rwlock_destroy_func (gl_rwlock_t *lock);
 
 /* --------------------- gl_recursive_lock_t datatype --------------------- */
 
-/* The Win32 documentation says that CRITICAL_SECTION already implements a
-   recursive lock.  But we need not rely on it: It's easy to implement a
-   recursive lock without this assumption.  */
+/* The native Windows documentation says that CRITICAL_SECTION already
+   implements a recursive lock.  But we need not rely on it: It's easy to
+   implement a recursive lock without this assumption.  */
 
 typedef struct
         {
@@ -764,7 +764,7 @@ extern void glthread_once_func (gl_once_t *once_control, 
void (*initfunction) (v
 
 /* ========================================================================= */
 
-#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || 
USE_WIN32_THREADS)
+#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || 
USE_WINDOWS_THREADS)
 
 /* Provide dummy implementation if threads are not supported.  */
 
diff --git a/gl/tests/glthread/thread.c b/gl/tests/glthread/thread.c
index 83b8c57..be0a871 100644
--- a/gl/tests/glthread/thread.c
+++ b/gl/tests/glthread/thread.c
@@ -1,5 +1,5 @@
 /* Creating and controlling threads.
-   Copyright (C) 2005-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2012 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
@@ -43,7 +43,7 @@ const gl_thread_t gl_null_thread /* = { .p = NULL } */;
 
 /* ========================================================================= */
 
-#if USE_WIN32_THREADS
+#if USE_WINDOWS_THREADS
 
 #include <process.h>
 
diff --git a/gl/tests/glthread/thread.h b/gl/tests/glthread/thread.h
index 064d72f..b95d6a2 100644
--- a/gl/tests/glthread/thread.h
+++ b/gl/tests/glthread/thread.h
@@ -1,5 +1,5 @@
 /* Creating and controlling threads.
-   Copyright (C) 2005-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2012 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
@@ -290,7 +290,7 @@ typedef thread_t gl_thread_t;
 
 /* ========================================================================= */
 
-#if USE_WIN32_THREADS
+#if USE_WINDOWS_THREADS
 
 # define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 # include <windows.h>
@@ -337,7 +337,7 @@ extern int gl_thread_exit_func (void *retval);
 
 /* ========================================================================= */
 
-#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || 
USE_WIN32_THREADS)
+#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || 
USE_WINDOWS_THREADS)
 
 /* Provide dummy implementation if threads are not supported.  */
 
diff --git a/gl/tests/glthread/threadlib.c b/gl/tests/glthread/threadlib.c
index 646defa..30d6d51 100644
--- a/gl/tests/glthread/threadlib.c
+++ b/gl/tests/glthread/threadlib.c
@@ -1,5 +1,5 @@
 /* Multithreading primitives.
-   Copyright (C) 2005-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2012 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
diff --git a/gl/tests/glthread/yield.h b/gl/tests/glthread/yield.h
index 4fa2d8b..040afe3 100644
--- a/gl/tests/glthread/yield.h
+++ b/gl/tests/glthread/yield.h
@@ -1,5 +1,5 @@
 /* Yielding the processor to other threads and processes.
-   Copyright (C) 2005-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2012 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
@@ -89,7 +89,7 @@ extern "C" {
 
 /* ========================================================================= */
 
-#if USE_WIN32_THREADS
+#if USE_WINDOWS_THREADS
 
 # define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 # include <windows.h>
@@ -109,7 +109,7 @@ extern "C" {
 
 /* ========================================================================= */
 
-#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || 
USE_WIN32_THREADS)
+#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || 
USE_WINDOWS_THREADS)
 
 /* Provide dummy implementation if threads are not supported.  */
 
diff --git a/gl/tests/ignore-value.h b/gl/tests/ignore-value.h
index f021a1a..92f2fbc 100644
--- a/gl/tests/ignore-value.h
+++ b/gl/tests/ignore-value.h
@@ -1,6 +1,6 @@
 /* ignore a function return without a compiler warning
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/infinity.h b/gl/tests/infinity.h
index 19a6873..631473e 100644
--- a/gl/tests/infinity.h
+++ b/gl/tests/infinity.h
@@ -1,5 +1,5 @@
 /* Macros for infinity.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/init.sh b/gl/tests/init.sh
index 373d9d4..5985552 100644
--- a/gl/tests/init.sh
+++ b/gl/tests/init.sh
@@ -1,6 +1,6 @@
 # source this file; set up for tests
 
-# Copyright (C) 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2009-2012 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
@@ -61,7 +61,7 @@ ME_=`expr "./$0" : '.*/\(.*\)$'`
 
 # We use a trap below for cleanup.  This requires us to go through
 # hoops to get the right exit status transported through the handler.
-# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
+# So use 'Exit STATUS' instead of 'exit STATUS' inside of the tests.
 # Turn off errexit here so that we don't trip the bug with OSF1/Tru64
 # sh inside this function.
 Exit () { set +e; (exit $1); exit $1; }
@@ -172,7 +172,7 @@ else
     if test "$re_shell_" = __current__; then
       # 'eval'ing this code makes Solaris 10's /bin/sh exit with
       # $? set to 2.  It does not evaluate any of the code after the
-      # "unexpected" first `('.  Thus, we must run it in a subshell.
+      # "unexpected" first '('.  Thus, we must run it in a subshell.
       ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
     else
       "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
@@ -221,16 +221,102 @@ export MALLOC_PERTURB_
 # a partition, or to undo any other global state changes.
 cleanup_ () { :; }
 
-if ( diff -u "$0" "$0" < /dev/null ) > /dev/null 2>&1; then
-  compare () { diff -u "$@"; }
-elif ( diff -c "$0" "$0" < /dev/null ) > /dev/null 2>&1; then
-  compare () { diff -c "$@"; }
+# Emit a header similar to that from diff -u;  Print the simulated "diff"
+# command so that the order of arguments is clear.  Don't bother with @@ lines.
+emit_diff_u_header_ ()
+{
+  printf '%s\n' "diff -u $*" \
+    "--- $1    1970-01-01" \
+    "+++ $2    1970-01-01"
+}
+
+# Arrange not to let diff or cmp operate on /dev/null,
+# since on some systems (at least OSF/1 5.1), that doesn't work.
+# When there are not two arguments, or no argument is /dev/null, return 2.
+# When one argument is /dev/null and the other is not empty,
+# cat the nonempty file to stderr and return 1.
+# Otherwise, return 0.
+compare_dev_null_ ()
+{
+  test $# = 2 || return 2
+
+  if test "x$1" = x/dev/null; then
+    test -s "$2" || return 0
+    emit_diff_u_header_ "$@"; sed 's/^/+/' "$2"
+    return 1
+  fi
+
+  if test "x$2" = x/dev/null; then
+    test -s "$1" || return 0
+    emit_diff_u_header_ "$@"; sed 's/^/-/' "$1"
+    return 1
+  fi
+
+  return 2
+}
+
+if diff_out_=`exec 2>/dev/null; diff -u "$0" "$0" < /dev/null`; then
+  if test -z "$diff_out_"; then
+    compare_ () { diff -u "$@"; }
+  else
+    compare_ ()
+    {
+      if diff -u "$@" > diff.out; then
+        # No differences were found, but Solaris 'diff' produces output
+        # "No differences encountered". Hide this output.
+        rm -f diff.out
+        true
+      else
+        cat diff.out
+        rm -f diff.out
+        false
+      fi
+    }
+  fi
+elif diff_out_=`exec 2>/dev/null; diff -c "$0" "$0" < /dev/null`; then
+  if test -z "$diff_out_"; then
+    compare_ () { diff -c "$@"; }
+  else
+    compare_ ()
+    {
+      if diff -c "$@" > diff.out; then
+        # No differences were found, but AIX and HP-UX 'diff' produce output
+        # "No differences encountered" or "There are no differences between the
+        # files.". Hide this output.
+        rm -f diff.out
+        true
+      else
+        cat diff.out
+        rm -f diff.out
+        false
+      fi
+    }
+  fi
 elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
-  compare () { cmp -s "$@"; }
+  compare_ () { cmp -s "$@"; }
 else
-  compare () { cmp "$@"; }
+  compare_ () { cmp "$@"; }
 fi
 
+# Usage: compare EXPECTED ACTUAL
+#
+# Given compare_dev_null_'s preprocessing, defer to compare_ if 2 or more.
+# Otherwise, propagate $? to caller: any diffs have already been printed.
+compare ()
+{
+  # This looks like it can be factored to use a simple "case $?"
+  # after unchecked compare_dev_null_ invocation, but that would
+  # fail in a "set -e" environment.
+  if compare_dev_null_ "$@"; then
+    return 0
+  else
+    case $? in
+      1) return 1;;
+      *) compare_ "$@";;
+    esac
+  fi
+}
+
 # An arbitrary prefix to help distinguish test directories.
 testdir_prefix_ () { printf gt; }
 
@@ -441,7 +527,7 @@ mktempd_ ()
   esac
 
   # First, try to use mktemp.
-  d=`unset TMPDIR; mktemp -d -t -p "$destdir_" "$template_" 2>/dev/null` \
+  d=`unset TMPDIR; { mktemp -d -t -p "$destdir_" "$template_"; } 2>/dev/null` \
     || fail=1
 
   # The resulting name must be in the specified directory.
diff --git a/gl/tests/inttypes.in.h b/gl/tests/inttypes.in.h
index 7abf394..b9da2b5 100644
--- a/gl/tests/inttypes.in.h
+++ b/gl/tests/inttypes.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006-2011 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2012 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Derek Price.
    This file is part of gnulib.
 
@@ -31,6 +31,12 @@
    The include_next requires a split double-inclusion guard.  */
 #if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 # if @HAVE_INTTYPES_H@
+
+   /* Some pre-C++11 <stdint.h> implementations need this.  */
+#  if defined __cplusplus && ! defined __STDC_FORMAT_MACROS
+#   define __STDC_FORMAT_MACROS 1
+#  endif
+
 #  @INCLUDE_NEXT@ @NEXT_INTTYPES_H@
 # endif
 #endif
@@ -50,994 +56,992 @@
 # error "This file assumes that 'int' has exactly 32 bits. Please report your 
platform and compiler to <address@hidden>."
 #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.  */
 
 /* 7.8.1 Macros for format specifiers */
 
-#if ! defined __cplusplus || defined __STDC_FORMAT_MACROS
-
-# if defined _TNS_R_TARGET
+#if defined _TNS_R_TARGET
    /* Tandem NonStop R series and compatible platforms released before
       July 2005 support %Ld but not %lld.  */
-#  define _LONG_LONG_FORMAT_PREFIX "L"
-# else
-#  define _LONG_LONG_FORMAT_PREFIX "ll"
-# endif
+# define _LONG_LONG_FORMAT_PREFIX "L"
+#else
+# define _LONG_LONG_FORMAT_PREFIX "ll"
+#endif
 
-# if !defined PRId8 || @PRI_MACROS_BROKEN@
-#  undef PRId8
-#  ifdef INT8_MAX
-#   define PRId8 "d"
-#  endif
+#if !defined PRId8 || @PRI_MACROS_BROKEN@
+# undef PRId8
+# ifdef INT8_MAX
+#  define PRId8 "d"
 # endif
-# if !defined PRIi8 || @PRI_MACROS_BROKEN@
-#  undef PRIi8
-#  ifdef INT8_MAX
-#   define PRIi8 "i"
-#  endif
+#endif
+#if !defined PRIi8 || @PRI_MACROS_BROKEN@
+# undef PRIi8
+# ifdef INT8_MAX
+#  define PRIi8 "i"
 # endif
-# if !defined PRIo8 || @PRI_MACROS_BROKEN@
-#  undef PRIo8
-#  ifdef UINT8_MAX
-#   define PRIo8 "o"
-#  endif
+#endif
+#if !defined PRIo8 || @PRI_MACROS_BROKEN@
+# undef PRIo8
+# ifdef UINT8_MAX
+#  define PRIo8 "o"
 # endif
-# if !defined PRIu8 || @PRI_MACROS_BROKEN@
-#  undef PRIu8
-#  ifdef UINT8_MAX
-#   define PRIu8 "u"
-#  endif
+#endif
+#if !defined PRIu8 || @PRI_MACROS_BROKEN@
+# undef PRIu8
+# ifdef UINT8_MAX
+#  define PRIu8 "u"
 # endif
-# if !defined PRIx8 || @PRI_MACROS_BROKEN@
-#  undef PRIx8
-#  ifdef UINT8_MAX
-#   define PRIx8 "x"
-#  endif
+#endif
+#if !defined PRIx8 || @PRI_MACROS_BROKEN@
+# undef PRIx8
+# ifdef UINT8_MAX
+#  define PRIx8 "x"
 # endif
-# if !defined PRIX8 || @PRI_MACROS_BROKEN@
-#  undef PRIX8
-#  ifdef UINT8_MAX
-#   define PRIX8 "X"
-#  endif
+#endif
+#if !defined PRIX8 || @PRI_MACROS_BROKEN@
+# undef PRIX8
+# ifdef UINT8_MAX
+#  define PRIX8 "X"
 # endif
-# if !defined PRId16 || @PRI_MACROS_BROKEN@
-#  undef PRId16
-#  ifdef INT16_MAX
-#   define PRId16 "d"
-#  endif
+#endif
+#if !defined PRId16 || @PRI_MACROS_BROKEN@
+# undef PRId16
+# ifdef INT16_MAX
+#  define PRId16 "d"
 # endif
-# if !defined PRIi16 || @PRI_MACROS_BROKEN@
-#  undef PRIi16
-#  ifdef INT16_MAX
-#   define PRIi16 "i"
-#  endif
+#endif
+#if !defined PRIi16 || @PRI_MACROS_BROKEN@
+# undef PRIi16
+# ifdef INT16_MAX
+#  define PRIi16 "i"
 # endif
-# if !defined PRIo16 || @PRI_MACROS_BROKEN@
-#  undef PRIo16
-#  ifdef UINT16_MAX
-#   define PRIo16 "o"
-#  endif
+#endif
+#if !defined PRIo16 || @PRI_MACROS_BROKEN@
+# undef PRIo16
+# ifdef UINT16_MAX
+#  define PRIo16 "o"
 # endif
-# if !defined PRIu16 || @PRI_MACROS_BROKEN@
-#  undef PRIu16
-#  ifdef UINT16_MAX
-#   define PRIu16 "u"
-#  endif
+#endif
+#if !defined PRIu16 || @PRI_MACROS_BROKEN@
+# undef PRIu16
+# ifdef UINT16_MAX
+#  define PRIu16 "u"
 # endif
-# if !defined PRIx16 || @PRI_MACROS_BROKEN@
-#  undef PRIx16
-#  ifdef UINT16_MAX
-#   define PRIx16 "x"
-#  endif
+#endif
+#if !defined PRIx16 || @PRI_MACROS_BROKEN@
+# undef PRIx16
+# ifdef UINT16_MAX
+#  define PRIx16 "x"
 # endif
-# if !defined PRIX16 || @PRI_MACROS_BROKEN@
-#  undef PRIX16
-#  ifdef UINT16_MAX
-#   define PRIX16 "X"
-#  endif
+#endif
+#if !defined PRIX16 || @PRI_MACROS_BROKEN@
+# undef PRIX16
+# ifdef UINT16_MAX
+#  define PRIX16 "X"
 # endif
-# if !defined PRId32 || @PRI_MACROS_BROKEN@
-#  undef PRId32
-#  ifdef INT32_MAX
-#   define PRId32 "d"
-#  endif
+#endif
+#if !defined PRId32 || @PRI_MACROS_BROKEN@
+# undef PRId32
+# ifdef INT32_MAX
+#  define PRId32 "d"
 # endif
-# if !defined PRIi32 || @PRI_MACROS_BROKEN@
-#  undef PRIi32
-#  ifdef INT32_MAX
-#   define PRIi32 "i"
-#  endif
+#endif
+#if !defined PRIi32 || @PRI_MACROS_BROKEN@
+# undef PRIi32
+# ifdef INT32_MAX
+#  define PRIi32 "i"
 # endif
-# if !defined PRIo32 || @PRI_MACROS_BROKEN@
-#  undef PRIo32
-#  ifdef UINT32_MAX
-#   define PRIo32 "o"
-#  endif
+#endif
+#if !defined PRIo32 || @PRI_MACROS_BROKEN@
+# undef PRIo32
+# ifdef UINT32_MAX
+#  define PRIo32 "o"
 # endif
-# if !defined PRIu32 || @PRI_MACROS_BROKEN@
-#  undef PRIu32
-#  ifdef UINT32_MAX
-#   define PRIu32 "u"
-#  endif
+#endif
+#if !defined PRIu32 || @PRI_MACROS_BROKEN@
+# undef PRIu32
+# ifdef UINT32_MAX
+#  define PRIu32 "u"
 # endif
-# if !defined PRIx32 || @PRI_MACROS_BROKEN@
-#  undef PRIx32
-#  ifdef UINT32_MAX
-#   define PRIx32 "x"
-#  endif
+#endif
+#if !defined PRIx32 || @PRI_MACROS_BROKEN@
+# undef PRIx32
+# ifdef UINT32_MAX
+#  define PRIx32 "x"
 # endif
-# if !defined PRIX32 || @PRI_MACROS_BROKEN@
-#  undef PRIX32
-#  ifdef UINT32_MAX
-#   define PRIX32 "X"
-#  endif
+#endif
+#if !defined PRIX32 || @PRI_MACROS_BROKEN@
+# undef PRIX32
+# ifdef UINT32_MAX
+#  define PRIX32 "X"
 # endif
-# ifdef INT64_MAX
-#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
-#   define _PRI64_PREFIX "l"
-#  elif defined _MSC_VER || defined __MINGW32__
-#   define _PRI64_PREFIX "I64"
-#  elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-#   define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
-#  endif
-#  if !defined PRId64 || @PRI_MACROS_BROKEN@
-#   undef PRId64
-#   define PRId64 _PRI64_PREFIX "d"
-#  endif
-#  if !defined PRIi64 || @PRI_MACROS_BROKEN@
-#   undef PRIi64
-#   define PRIi64 _PRI64_PREFIX "i"
-#  endif
+#endif
+#ifdef INT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
+#  define _PRI64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _PRI64_PREFIX "I64"
+# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+#  define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined PRId64 || @PRI_MACROS_BROKEN@
+#  undef PRId64
+#  define PRId64 _PRI64_PREFIX "d"
+# endif
+# if !defined PRIi64 || @PRI_MACROS_BROKEN@
+#  undef PRIi64
+#  define PRIi64 _PRI64_PREFIX "i"
 # endif
-# ifdef UINT64_MAX
-#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
-#   define _PRIu64_PREFIX "l"
-#  elif defined _MSC_VER || defined __MINGW32__
-#   define _PRIu64_PREFIX "I64"
-#  elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-#   define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
-#  endif
-#  if !defined PRIo64 || @PRI_MACROS_BROKEN@
-#   undef PRIo64
-#   define PRIo64 _PRIu64_PREFIX "o"
-#  endif
-#  if !defined PRIu64 || @PRI_MACROS_BROKEN@
-#   undef PRIu64
-#   define PRIu64 _PRIu64_PREFIX "u"
-#  endif
-#  if !defined PRIx64 || @PRI_MACROS_BROKEN@
-#   undef PRIx64
-#   define PRIx64 _PRIu64_PREFIX "x"
-#  endif
-#  if !defined PRIX64 || @PRI_MACROS_BROKEN@
-#   undef PRIX64
-#   define PRIX64 _PRIu64_PREFIX "X"
-#  endif
+#endif
+#ifdef UINT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
+#  define _PRIu64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _PRIu64_PREFIX "I64"
+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+#  define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined PRIo64 || @PRI_MACROS_BROKEN@
+#  undef PRIo64
+#  define PRIo64 _PRIu64_PREFIX "o"
+# endif
+# if !defined PRIu64 || @PRI_MACROS_BROKEN@
+#  undef PRIu64
+#  define PRIu64 _PRIu64_PREFIX "u"
+# endif
+# if !defined PRIx64 || @PRI_MACROS_BROKEN@
+#  undef PRIx64
+#  define PRIx64 _PRIu64_PREFIX "x"
+# endif
+# if !defined PRIX64 || @PRI_MACROS_BROKEN@
+#  undef PRIX64
+#  define PRIX64 _PRIu64_PREFIX "X"
 # endif
+#endif
 
-# if !defined PRIdLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIdLEAST8
-#  define PRIdLEAST8 "d"
-# endif
-# if !defined PRIiLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIiLEAST8
-#  define PRIiLEAST8 "i"
-# endif
-# if !defined PRIoLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIoLEAST8
-#  define PRIoLEAST8 "o"
-# endif
-# if !defined PRIuLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIuLEAST8
-#  define PRIuLEAST8 "u"
-# endif
-# if !defined PRIxLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIxLEAST8
-#  define PRIxLEAST8 "x"
-# endif
-# if !defined PRIXLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIXLEAST8
-#  define PRIXLEAST8 "X"
-# endif
-# if !defined PRIdLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIdLEAST16
-#  define PRIdLEAST16 "d"
-# endif
-# if !defined PRIiLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIiLEAST16
-#  define PRIiLEAST16 "i"
-# endif
-# if !defined PRIoLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIoLEAST16
-#  define PRIoLEAST16 "o"
-# endif
-# if !defined PRIuLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIuLEAST16
-#  define PRIuLEAST16 "u"
-# endif
-# if !defined PRIxLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIxLEAST16
-#  define PRIxLEAST16 "x"
-# endif
-# if !defined PRIXLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIXLEAST16
-#  define PRIXLEAST16 "X"
-# endif
-# if !defined PRIdLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIdLEAST32
-#  define PRIdLEAST32 "d"
-# endif
-# if !defined PRIiLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIiLEAST32
-#  define PRIiLEAST32 "i"
-# endif
-# if !defined PRIoLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIoLEAST32
-#  define PRIoLEAST32 "o"
-# endif
-# if !defined PRIuLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIuLEAST32
-#  define PRIuLEAST32 "u"
-# endif
-# if !defined PRIxLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIxLEAST32
-#  define PRIxLEAST32 "x"
-# endif
-# if !defined PRIXLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIXLEAST32
-#  define PRIXLEAST32 "X"
-# endif
-# ifdef INT64_MAX
-#  if !defined PRIdLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIdLEAST64
-#   define PRIdLEAST64 PRId64
-#  endif
-#  if !defined PRIiLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIiLEAST64
-#   define PRIiLEAST64 PRIi64
-#  endif
+#if !defined PRIdLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIdLEAST8
+# define PRIdLEAST8 "d"
+#endif
+#if !defined PRIiLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIiLEAST8
+# define PRIiLEAST8 "i"
+#endif
+#if !defined PRIoLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIoLEAST8
+# define PRIoLEAST8 "o"
+#endif
+#if !defined PRIuLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIuLEAST8
+# define PRIuLEAST8 "u"
+#endif
+#if !defined PRIxLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIxLEAST8
+# define PRIxLEAST8 "x"
+#endif
+#if !defined PRIXLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIXLEAST8
+# define PRIXLEAST8 "X"
+#endif
+#if !defined PRIdLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIdLEAST16
+# define PRIdLEAST16 "d"
+#endif
+#if !defined PRIiLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIiLEAST16
+# define PRIiLEAST16 "i"
+#endif
+#if !defined PRIoLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIoLEAST16
+# define PRIoLEAST16 "o"
+#endif
+#if !defined PRIuLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIuLEAST16
+# define PRIuLEAST16 "u"
+#endif
+#if !defined PRIxLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIxLEAST16
+# define PRIxLEAST16 "x"
+#endif
+#if !defined PRIXLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIXLEAST16
+# define PRIXLEAST16 "X"
+#endif
+#if !defined PRIdLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIdLEAST32
+# define PRIdLEAST32 "d"
+#endif
+#if !defined PRIiLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIiLEAST32
+# define PRIiLEAST32 "i"
+#endif
+#if !defined PRIoLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIoLEAST32
+# define PRIoLEAST32 "o"
+#endif
+#if !defined PRIuLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIuLEAST32
+# define PRIuLEAST32 "u"
+#endif
+#if !defined PRIxLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIxLEAST32
+# define PRIxLEAST32 "x"
+#endif
+#if !defined PRIXLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIXLEAST32
+# define PRIXLEAST32 "X"
+#endif
+#ifdef INT64_MAX
+# if !defined PRIdLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIdLEAST64
+#  define PRIdLEAST64 PRId64
 # endif
-# ifdef UINT64_MAX
-#  if !defined PRIoLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIoLEAST64
-#   define PRIoLEAST64 PRIo64
-#  endif
-#  if !defined PRIuLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIuLEAST64
-#   define PRIuLEAST64 PRIu64
-#  endif
-#  if !defined PRIxLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIxLEAST64
-#   define PRIxLEAST64 PRIx64
-#  endif
-#  if !defined PRIXLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIXLEAST64
-#   define PRIXLEAST64 PRIX64
-#  endif
+# if !defined PRIiLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIiLEAST64
+#  define PRIiLEAST64 PRIi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined PRIoLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIoLEAST64
+#  define PRIoLEAST64 PRIo64
+# endif
+# if !defined PRIuLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIuLEAST64
+#  define PRIuLEAST64 PRIu64
+# endif
+# if !defined PRIxLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIxLEAST64
+#  define PRIxLEAST64 PRIx64
 # endif
+# if !defined PRIXLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIXLEAST64
+#  define PRIXLEAST64 PRIX64
+# endif
+#endif
 
-# if !defined PRIdFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIdFAST8
-#  if INT_FAST8_MAX > INT32_MAX
-#   define PRIdFAST8 PRId64
-#  else
-#   define PRIdFAST8 "d"
-#  endif
+#if !defined PRIdFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIdFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define PRIdFAST8 PRId64
+# else
+#  define PRIdFAST8 "d"
 # endif
-# if !defined PRIiFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIiFAST8
-#  if INT_FAST8_MAX > INT32_MAX
-#   define PRIiFAST8 PRIi64
-#  else
-#   define PRIiFAST8 "i"
-#  endif
+#endif
+#if !defined PRIiFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIiFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define PRIiFAST8 PRIi64
+# else
+#  define PRIiFAST8 "i"
 # endif
-# if !defined PRIoFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIoFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define PRIoFAST8 PRIo64
-#  else
-#   define PRIoFAST8 "o"
-#  endif
+#endif
+#if !defined PRIoFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIoFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIoFAST8 PRIo64
+# else
+#  define PRIoFAST8 "o"
 # endif
-# if !defined PRIuFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIuFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define PRIuFAST8 PRIu64
-#  else
-#   define PRIuFAST8 "u"
-#  endif
+#endif
+#if !defined PRIuFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIuFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIuFAST8 PRIu64
+# else
+#  define PRIuFAST8 "u"
 # endif
-# if !defined PRIxFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIxFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define PRIxFAST8 PRIx64
-#  else
-#   define PRIxFAST8 "x"
-#  endif
+#endif
+#if !defined PRIxFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIxFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIxFAST8 PRIx64
+# else
+#  define PRIxFAST8 "x"
 # endif
-# if !defined PRIXFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIXFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define PRIXFAST8 PRIX64
-#  else
-#   define PRIXFAST8 "X"
-#  endif
+#endif
+#if !defined PRIXFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIXFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIXFAST8 PRIX64
+# else
+#  define PRIXFAST8 "X"
 # endif
-# if !defined PRIdFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIdFAST16
-#  if INT_FAST16_MAX > INT32_MAX
-#   define PRIdFAST16 PRId64
-#  else
-#   define PRIdFAST16 "d"
-#  endif
+#endif
+#if !defined PRIdFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIdFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define PRIdFAST16 PRId64
+# else
+#  define PRIdFAST16 "d"
 # endif
-# if !defined PRIiFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIiFAST16
-#  if INT_FAST16_MAX > INT32_MAX
-#   define PRIiFAST16 PRIi64
-#  else
-#   define PRIiFAST16 "i"
-#  endif
+#endif
+#if !defined PRIiFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIiFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define PRIiFAST16 PRIi64
+# else
+#  define PRIiFAST16 "i"
 # endif
-# if !defined PRIoFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIoFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define PRIoFAST16 PRIo64
-#  else
-#   define PRIoFAST16 "o"
-#  endif
+#endif
+#if !defined PRIoFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIoFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIoFAST16 PRIo64
+# else
+#  define PRIoFAST16 "o"
 # endif
-# if !defined PRIuFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIuFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define PRIuFAST16 PRIu64
-#  else
-#   define PRIuFAST16 "u"
-#  endif
+#endif
+#if !defined PRIuFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIuFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIuFAST16 PRIu64
+# else
+#  define PRIuFAST16 "u"
 # endif
-# if !defined PRIxFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIxFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define PRIxFAST16 PRIx64
-#  else
-#   define PRIxFAST16 "x"
-#  endif
+#endif
+#if !defined PRIxFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIxFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIxFAST16 PRIx64
+# else
+#  define PRIxFAST16 "x"
 # endif
-# if !defined PRIXFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIXFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define PRIXFAST16 PRIX64
-#  else
-#   define PRIXFAST16 "X"
-#  endif
+#endif
+#if !defined PRIXFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIXFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIXFAST16 PRIX64
+# else
+#  define PRIXFAST16 "X"
 # endif
-# if !defined PRIdFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIdFAST32
-#  if INT_FAST32_MAX > INT32_MAX
-#   define PRIdFAST32 PRId64
-#  else
-#   define PRIdFAST32 "d"
-#  endif
+#endif
+#if !defined PRIdFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIdFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define PRIdFAST32 PRId64
+# else
+#  define PRIdFAST32 "d"
 # endif
-# if !defined PRIiFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIiFAST32
-#  if INT_FAST32_MAX > INT32_MAX
-#   define PRIiFAST32 PRIi64
-#  else
-#   define PRIiFAST32 "i"
-#  endif
+#endif
+#if !defined PRIiFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIiFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define PRIiFAST32 PRIi64
+# else
+#  define PRIiFAST32 "i"
 # endif
-# if !defined PRIoFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIoFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define PRIoFAST32 PRIo64
-#  else
-#   define PRIoFAST32 "o"
-#  endif
+#endif
+#if !defined PRIoFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIoFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIoFAST32 PRIo64
+# else
+#  define PRIoFAST32 "o"
 # endif
-# if !defined PRIuFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIuFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define PRIuFAST32 PRIu64
-#  else
-#   define PRIuFAST32 "u"
-#  endif
+#endif
+#if !defined PRIuFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIuFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIuFAST32 PRIu64
+# else
+#  define PRIuFAST32 "u"
 # endif
-# if !defined PRIxFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIxFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define PRIxFAST32 PRIx64
-#  else
-#   define PRIxFAST32 "x"
-#  endif
+#endif
+#if !defined PRIxFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIxFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIxFAST32 PRIx64
+# else
+#  define PRIxFAST32 "x"
 # endif
-# if !defined PRIXFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIXFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define PRIXFAST32 PRIX64
-#  else
-#   define PRIXFAST32 "X"
-#  endif
+#endif
+#if !defined PRIXFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIXFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIXFAST32 PRIX64
+# else
+#  define PRIXFAST32 "X"
 # endif
-# ifdef INT64_MAX
-#  if !defined PRIdFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIdFAST64
-#   define PRIdFAST64 PRId64
-#  endif
-#  if !defined PRIiFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIiFAST64
-#   define PRIiFAST64 PRIi64
-#  endif
+#endif
+#ifdef INT64_MAX
+# if !defined PRIdFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIdFAST64
+#  define PRIdFAST64 PRId64
 # endif
-# ifdef UINT64_MAX
-#  if !defined PRIoFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIoFAST64
-#   define PRIoFAST64 PRIo64
-#  endif
-#  if !defined PRIuFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIuFAST64
-#   define PRIuFAST64 PRIu64
-#  endif
-#  if !defined PRIxFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIxFAST64
-#   define PRIxFAST64 PRIx64
-#  endif
-#  if !defined PRIXFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIXFAST64
-#   define PRIXFAST64 PRIX64
-#  endif
+# if !defined PRIiFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIiFAST64
+#  define PRIiFAST64 PRIi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined PRIoFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIoFAST64
+#  define PRIoFAST64 PRIo64
+# endif
+# if !defined PRIuFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIuFAST64
+#  define PRIuFAST64 PRIu64
+# endif
+# if !defined PRIxFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIxFAST64
+#  define PRIxFAST64 PRIx64
 # endif
+# if !defined PRIXFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIXFAST64
+#  define PRIXFAST64 PRIX64
+# endif
+#endif
 
-# if !defined PRIdMAX || @PRI_MACROS_BROKEN@
-#  undef PRIdMAX
-#  if @INT32_MAX_LT_INTMAX_MAX@
-#   define PRIdMAX PRId64
-#  else
-#   define PRIdMAX "ld"
-#  endif
+#if !defined PRIdMAX || @PRI_MACROS_BROKEN@
+# undef PRIdMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define PRIdMAX PRId64
+# else
+#  define PRIdMAX "ld"
 # endif
-# if !defined PRIiMAX || @PRI_MACROS_BROKEN@
-#  undef PRIiMAX
-#  if @INT32_MAX_LT_INTMAX_MAX@
-#   define PRIiMAX PRIi64
-#  else
-#   define PRIiMAX "li"
-#  endif
+#endif
+#if !defined PRIiMAX || @PRI_MACROS_BROKEN@
+# undef PRIiMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define PRIiMAX PRIi64
+# else
+#  define PRIiMAX "li"
 # endif
-# if !defined PRIoMAX || @PRI_MACROS_BROKEN@
-#  undef PRIoMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define PRIoMAX PRIo64
-#  else
-#   define PRIoMAX "lo"
-#  endif
+#endif
+#if !defined PRIoMAX || @PRI_MACROS_BROKEN@
+# undef PRIoMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIoMAX PRIo64
+# else
+#  define PRIoMAX "lo"
 # endif
-# if !defined PRIuMAX || @PRI_MACROS_BROKEN@
-#  undef PRIuMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define PRIuMAX PRIu64
-#  else
-#   define PRIuMAX "lu"
-#  endif
+#endif
+#if !defined PRIuMAX || @PRI_MACROS_BROKEN@
+# undef PRIuMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIuMAX PRIu64
+# else
+#  define PRIuMAX "lu"
 # endif
-# if !defined PRIxMAX || @PRI_MACROS_BROKEN@
-#  undef PRIxMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define PRIxMAX PRIx64
-#  else
-#   define PRIxMAX "lx"
-#  endif
+#endif
+#if !defined PRIxMAX || @PRI_MACROS_BROKEN@
+# undef PRIxMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIxMAX PRIx64
+# else
+#  define PRIxMAX "lx"
 # endif
-# if !defined PRIXMAX || @PRI_MACROS_BROKEN@
-#  undef PRIXMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define PRIXMAX PRIX64
-#  else
-#   define PRIXMAX "lX"
-#  endif
+#endif
+#if !defined PRIXMAX || @PRI_MACROS_BROKEN@
+# undef PRIXMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIXMAX PRIX64
+# else
+#  define PRIXMAX "lX"
 # endif
+#endif
 
-# if !defined PRIdPTR || @PRI_MACROS_BROKEN@
-#  undef PRIdPTR
-#  ifdef INTPTR_MAX
-#   define PRIdPTR @PRIPTR_PREFIX@ "d"
-#  endif
+#if !defined PRIdPTR || @PRI_MACROS_BROKEN@
+# undef PRIdPTR
+# ifdef INTPTR_MAX
+#  define PRIdPTR @PRIPTR_PREFIX@ "d"
 # endif
-# if !defined PRIiPTR || @PRI_MACROS_BROKEN@
-#  undef PRIiPTR
-#  ifdef INTPTR_MAX
-#   define PRIiPTR @PRIPTR_PREFIX@ "i"
-#  endif
+#endif
+#if !defined PRIiPTR || @PRI_MACROS_BROKEN@
+# undef PRIiPTR
+# ifdef INTPTR_MAX
+#  define PRIiPTR @PRIPTR_PREFIX@ "i"
 # endif
-# if !defined PRIoPTR || @PRI_MACROS_BROKEN@
-#  undef PRIoPTR
-#  ifdef UINTPTR_MAX
-#   define PRIoPTR @PRIPTR_PREFIX@ "o"
-#  endif
+#endif
+#if !defined PRIoPTR || @PRI_MACROS_BROKEN@
+# undef PRIoPTR
+# ifdef UINTPTR_MAX
+#  define PRIoPTR @PRIPTR_PREFIX@ "o"
 # endif
-# if !defined PRIuPTR || @PRI_MACROS_BROKEN@
-#  undef PRIuPTR
-#  ifdef UINTPTR_MAX
-#   define PRIuPTR @PRIPTR_PREFIX@ "u"
-#  endif
+#endif
+#if !defined PRIuPTR || @PRI_MACROS_BROKEN@
+# undef PRIuPTR
+# ifdef UINTPTR_MAX
+#  define PRIuPTR @PRIPTR_PREFIX@ "u"
 # endif
-# if !defined PRIxPTR || @PRI_MACROS_BROKEN@
-#  undef PRIxPTR
-#  ifdef UINTPTR_MAX
-#   define PRIxPTR @PRIPTR_PREFIX@ "x"
-#  endif
+#endif
+#if !defined PRIxPTR || @PRI_MACROS_BROKEN@
+# undef PRIxPTR
+# ifdef UINTPTR_MAX
+#  define PRIxPTR @PRIPTR_PREFIX@ "x"
 # endif
-# if !defined PRIXPTR || @PRI_MACROS_BROKEN@
-#  undef PRIXPTR
-#  ifdef UINTPTR_MAX
-#   define PRIXPTR @PRIPTR_PREFIX@ "X"
-#  endif
+#endif
+#if !defined PRIXPTR || @PRI_MACROS_BROKEN@
+# undef PRIXPTR
+# ifdef UINTPTR_MAX
+#  define PRIXPTR @PRIPTR_PREFIX@ "X"
 # endif
+#endif
 
-# if !defined SCNd8 || @PRI_MACROS_BROKEN@
-#  undef SCNd8
-#  ifdef INT8_MAX
-#   define SCNd8 "hhd"
-#  endif
+#if !defined SCNd8 || @PRI_MACROS_BROKEN@
+# undef SCNd8
+# ifdef INT8_MAX
+#  define SCNd8 "hhd"
 # endif
-# if !defined SCNi8 || @PRI_MACROS_BROKEN@
-#  undef SCNi8
-#  ifdef INT8_MAX
-#   define SCNi8 "hhi"
-#  endif
+#endif
+#if !defined SCNi8 || @PRI_MACROS_BROKEN@
+# undef SCNi8
+# ifdef INT8_MAX
+#  define SCNi8 "hhi"
 # endif
-# if !defined SCNo8 || @PRI_MACROS_BROKEN@
-#  undef SCNo8
-#  ifdef UINT8_MAX
-#   define SCNo8 "hho"
-#  endif
+#endif
+#if !defined SCNo8 || @PRI_MACROS_BROKEN@
+# undef SCNo8
+# ifdef UINT8_MAX
+#  define SCNo8 "hho"
 # endif
-# if !defined SCNu8 || @PRI_MACROS_BROKEN@
-#  undef SCNu8
-#  ifdef UINT8_MAX
-#   define SCNu8 "hhu"
-#  endif
+#endif
+#if !defined SCNu8 || @PRI_MACROS_BROKEN@
+# undef SCNu8
+# ifdef UINT8_MAX
+#  define SCNu8 "hhu"
 # endif
-# if !defined SCNx8 || @PRI_MACROS_BROKEN@
-#  undef SCNx8
-#  ifdef UINT8_MAX
-#   define SCNx8 "hhx"
-#  endif
+#endif
+#if !defined SCNx8 || @PRI_MACROS_BROKEN@
+# undef SCNx8
+# ifdef UINT8_MAX
+#  define SCNx8 "hhx"
 # endif
-# if !defined SCNd16 || @PRI_MACROS_BROKEN@
-#  undef SCNd16
-#  ifdef INT16_MAX
-#   define SCNd16 "hd"
-#  endif
+#endif
+#if !defined SCNd16 || @PRI_MACROS_BROKEN@
+# undef SCNd16
+# ifdef INT16_MAX
+#  define SCNd16 "hd"
 # endif
-# if !defined SCNi16 || @PRI_MACROS_BROKEN@
-#  undef SCNi16
-#  ifdef INT16_MAX
-#   define SCNi16 "hi"
-#  endif
+#endif
+#if !defined SCNi16 || @PRI_MACROS_BROKEN@
+# undef SCNi16
+# ifdef INT16_MAX
+#  define SCNi16 "hi"
 # endif
-# if !defined SCNo16 || @PRI_MACROS_BROKEN@
-#  undef SCNo16
-#  ifdef UINT16_MAX
-#   define SCNo16 "ho"
-#  endif
+#endif
+#if !defined SCNo16 || @PRI_MACROS_BROKEN@
+# undef SCNo16
+# ifdef UINT16_MAX
+#  define SCNo16 "ho"
 # endif
-# if !defined SCNu16 || @PRI_MACROS_BROKEN@
-#  undef SCNu16
-#  ifdef UINT16_MAX
-#   define SCNu16 "hu"
-#  endif
+#endif
+#if !defined SCNu16 || @PRI_MACROS_BROKEN@
+# undef SCNu16
+# ifdef UINT16_MAX
+#  define SCNu16 "hu"
 # endif
-# if !defined SCNx16 || @PRI_MACROS_BROKEN@
-#  undef SCNx16
-#  ifdef UINT16_MAX
-#   define SCNx16 "hx"
-#  endif
+#endif
+#if !defined SCNx16 || @PRI_MACROS_BROKEN@
+# undef SCNx16
+# ifdef UINT16_MAX
+#  define SCNx16 "hx"
 # endif
-# if !defined SCNd32 || @PRI_MACROS_BROKEN@
-#  undef SCNd32
-#  ifdef INT32_MAX
-#   define SCNd32 "d"
-#  endif
+#endif
+#if !defined SCNd32 || @PRI_MACROS_BROKEN@
+# undef SCNd32
+# ifdef INT32_MAX
+#  define SCNd32 "d"
 # endif
-# if !defined SCNi32 || @PRI_MACROS_BROKEN@
-#  undef SCNi32
-#  ifdef INT32_MAX
-#   define SCNi32 "i"
-#  endif
+#endif
+#if !defined SCNi32 || @PRI_MACROS_BROKEN@
+# undef SCNi32
+# ifdef INT32_MAX
+#  define SCNi32 "i"
 # endif
-# if !defined SCNo32 || @PRI_MACROS_BROKEN@
-#  undef SCNo32
-#  ifdef UINT32_MAX
-#   define SCNo32 "o"
-#  endif
+#endif
+#if !defined SCNo32 || @PRI_MACROS_BROKEN@
+# undef SCNo32
+# ifdef UINT32_MAX
+#  define SCNo32 "o"
 # endif
-# if !defined SCNu32 || @PRI_MACROS_BROKEN@
-#  undef SCNu32
-#  ifdef UINT32_MAX
-#   define SCNu32 "u"
-#  endif
+#endif
+#if !defined SCNu32 || @PRI_MACROS_BROKEN@
+# undef SCNu32
+# ifdef UINT32_MAX
+#  define SCNu32 "u"
 # endif
-# if !defined SCNx32 || @PRI_MACROS_BROKEN@
-#  undef SCNx32
-#  ifdef UINT32_MAX
-#   define SCNx32 "x"
-#  endif
+#endif
+#if !defined SCNx32 || @PRI_MACROS_BROKEN@
+# undef SCNx32
+# ifdef UINT32_MAX
+#  define SCNx32 "x"
 # endif
-# ifdef INT64_MAX
-#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
-#   define _SCN64_PREFIX "l"
-#  elif defined _MSC_VER || defined __MINGW32__
-#   define _SCN64_PREFIX "I64"
-#  elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-#   define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
-#  endif
-#  if !defined SCNd64 || @PRI_MACROS_BROKEN@
-#   undef SCNd64
-#   define SCNd64 _SCN64_PREFIX "d"
-#  endif
-#  if !defined SCNi64 || @PRI_MACROS_BROKEN@
-#   undef SCNi64
-#   define SCNi64 _SCN64_PREFIX "i"
-#  endif
+#endif
+#ifdef INT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
+#  define _SCN64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _SCN64_PREFIX "I64"
+# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+#  define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined SCNd64 || @PRI_MACROS_BROKEN@
+#  undef SCNd64
+#  define SCNd64 _SCN64_PREFIX "d"
+# endif
+# if !defined SCNi64 || @PRI_MACROS_BROKEN@
+#  undef SCNi64
+#  define SCNi64 _SCN64_PREFIX "i"
 # endif
-# ifdef UINT64_MAX
-#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
-#   define _SCNu64_PREFIX "l"
-#  elif defined _MSC_VER || defined __MINGW32__
-#   define _SCNu64_PREFIX "I64"
-#  elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-#   define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
-#  endif
-#  if !defined SCNo64 || @PRI_MACROS_BROKEN@
-#   undef SCNo64
-#   define SCNo64 _SCNu64_PREFIX "o"
-#  endif
-#  if !defined SCNu64 || @PRI_MACROS_BROKEN@
-#   undef SCNu64
-#   define SCNu64 _SCNu64_PREFIX "u"
-#  endif
-#  if !defined SCNx64 || @PRI_MACROS_BROKEN@
-#   undef SCNx64
-#   define SCNx64 _SCNu64_PREFIX "x"
-#  endif
+#endif
+#ifdef UINT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
+#  define _SCNu64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _SCNu64_PREFIX "I64"
+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+#  define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined SCNo64 || @PRI_MACROS_BROKEN@
+#  undef SCNo64
+#  define SCNo64 _SCNu64_PREFIX "o"
+# endif
+# if !defined SCNu64 || @PRI_MACROS_BROKEN@
+#  undef SCNu64
+#  define SCNu64 _SCNu64_PREFIX "u"
+# endif
+# if !defined SCNx64 || @PRI_MACROS_BROKEN@
+#  undef SCNx64
+#  define SCNx64 _SCNu64_PREFIX "x"
 # endif
+#endif
 
-# if !defined SCNdLEAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNdLEAST8
-#  define SCNdLEAST8 "hhd"
-# endif
-# if !defined SCNiLEAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNiLEAST8
-#  define SCNiLEAST8 "hhi"
-# endif
-# if !defined SCNoLEAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNoLEAST8
-#  define SCNoLEAST8 "hho"
-# endif
-# if !defined SCNuLEAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNuLEAST8
-#  define SCNuLEAST8 "hhu"
-# endif
-# if !defined SCNxLEAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNxLEAST8
-#  define SCNxLEAST8 "hhx"
-# endif
-# if !defined SCNdLEAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNdLEAST16
-#  define SCNdLEAST16 "hd"
-# endif
-# if !defined SCNiLEAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNiLEAST16
-#  define SCNiLEAST16 "hi"
-# endif
-# if !defined SCNoLEAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNoLEAST16
-#  define SCNoLEAST16 "ho"
-# endif
-# if !defined SCNuLEAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNuLEAST16
-#  define SCNuLEAST16 "hu"
-# endif
-# if !defined SCNxLEAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNxLEAST16
-#  define SCNxLEAST16 "hx"
-# endif
-# if !defined SCNdLEAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNdLEAST32
-#  define SCNdLEAST32 "d"
-# endif
-# if !defined SCNiLEAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNiLEAST32
-#  define SCNiLEAST32 "i"
-# endif
-# if !defined SCNoLEAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNoLEAST32
-#  define SCNoLEAST32 "o"
-# endif
-# if !defined SCNuLEAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNuLEAST32
-#  define SCNuLEAST32 "u"
-# endif
-# if !defined SCNxLEAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNxLEAST32
-#  define SCNxLEAST32 "x"
-# endif
-# ifdef INT64_MAX
-#  if !defined SCNdLEAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNdLEAST64
-#   define SCNdLEAST64 SCNd64
-#  endif
-#  if !defined SCNiLEAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNiLEAST64
-#   define SCNiLEAST64 SCNi64
-#  endif
+#if !defined SCNdLEAST8 || @PRI_MACROS_BROKEN@
+# undef SCNdLEAST8
+# define SCNdLEAST8 "hhd"
+#endif
+#if !defined SCNiLEAST8 || @PRI_MACROS_BROKEN@
+# undef SCNiLEAST8
+# define SCNiLEAST8 "hhi"
+#endif
+#if !defined SCNoLEAST8 || @PRI_MACROS_BROKEN@
+# undef SCNoLEAST8
+# define SCNoLEAST8 "hho"
+#endif
+#if !defined SCNuLEAST8 || @PRI_MACROS_BROKEN@
+# undef SCNuLEAST8
+# define SCNuLEAST8 "hhu"
+#endif
+#if !defined SCNxLEAST8 || @PRI_MACROS_BROKEN@
+# undef SCNxLEAST8
+# define SCNxLEAST8 "hhx"
+#endif
+#if !defined SCNdLEAST16 || @PRI_MACROS_BROKEN@
+# undef SCNdLEAST16
+# define SCNdLEAST16 "hd"
+#endif
+#if !defined SCNiLEAST16 || @PRI_MACROS_BROKEN@
+# undef SCNiLEAST16
+# define SCNiLEAST16 "hi"
+#endif
+#if !defined SCNoLEAST16 || @PRI_MACROS_BROKEN@
+# undef SCNoLEAST16
+# define SCNoLEAST16 "ho"
+#endif
+#if !defined SCNuLEAST16 || @PRI_MACROS_BROKEN@
+# undef SCNuLEAST16
+# define SCNuLEAST16 "hu"
+#endif
+#if !defined SCNxLEAST16 || @PRI_MACROS_BROKEN@
+# undef SCNxLEAST16
+# define SCNxLEAST16 "hx"
+#endif
+#if !defined SCNdLEAST32 || @PRI_MACROS_BROKEN@
+# undef SCNdLEAST32
+# define SCNdLEAST32 "d"
+#endif
+#if !defined SCNiLEAST32 || @PRI_MACROS_BROKEN@
+# undef SCNiLEAST32
+# define SCNiLEAST32 "i"
+#endif
+#if !defined SCNoLEAST32 || @PRI_MACROS_BROKEN@
+# undef SCNoLEAST32
+# define SCNoLEAST32 "o"
+#endif
+#if !defined SCNuLEAST32 || @PRI_MACROS_BROKEN@
+# undef SCNuLEAST32
+# define SCNuLEAST32 "u"
+#endif
+#if !defined SCNxLEAST32 || @PRI_MACROS_BROKEN@
+# undef SCNxLEAST32
+# define SCNxLEAST32 "x"
+#endif
+#ifdef INT64_MAX
+# if !defined SCNdLEAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNdLEAST64
+#  define SCNdLEAST64 SCNd64
 # endif
-# ifdef UINT64_MAX
-#  if !defined SCNoLEAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNoLEAST64
-#   define SCNoLEAST64 SCNo64
-#  endif
-#  if !defined SCNuLEAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNuLEAST64
-#   define SCNuLEAST64 SCNu64
-#  endif
-#  if !defined SCNxLEAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNxLEAST64
-#   define SCNxLEAST64 SCNx64
-#  endif
+# if !defined SCNiLEAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNiLEAST64
+#  define SCNiLEAST64 SCNi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined SCNoLEAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNoLEAST64
+#  define SCNoLEAST64 SCNo64
+# endif
+# if !defined SCNuLEAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNuLEAST64
+#  define SCNuLEAST64 SCNu64
+# endif
+# if !defined SCNxLEAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNxLEAST64
+#  define SCNxLEAST64 SCNx64
 # endif
+#endif
 
-# if !defined SCNdFAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNdFAST8
-#  if INT_FAST8_MAX > INT32_MAX
-#   define SCNdFAST8 SCNd64
-#  elif INT_FAST8_MAX == 0x7fff
-#   define SCNdFAST8 "hd"
-#  elif INT_FAST8_MAX == 0x7f
-#   define SCNdFAST8 "hhd"
-#  else
-#   define SCNdFAST8 "d"
-#  endif
+#if !defined SCNdFAST8 || @PRI_MACROS_BROKEN@
+# undef SCNdFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define SCNdFAST8 SCNd64
+# elif INT_FAST8_MAX == 0x7fff
+#  define SCNdFAST8 "hd"
+# elif INT_FAST8_MAX == 0x7f
+#  define SCNdFAST8 "hhd"
+# else
+#  define SCNdFAST8 "d"
 # endif
-# if !defined SCNiFAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNiFAST8
-#  if INT_FAST8_MAX > INT32_MAX
-#   define SCNiFAST8 SCNi64
-#  elif INT_FAST8_MAX == 0x7fff
-#   define SCNiFAST8 "hi"
-#  elif INT_FAST8_MAX == 0x7f
-#   define SCNiFAST8 "hhi"
-#  else
-#   define SCNiFAST8 "i"
-#  endif
+#endif
+#if !defined SCNiFAST8 || @PRI_MACROS_BROKEN@
+# undef SCNiFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define SCNiFAST8 SCNi64
+# elif INT_FAST8_MAX == 0x7fff
+#  define SCNiFAST8 "hi"
+# elif INT_FAST8_MAX == 0x7f
+#  define SCNiFAST8 "hhi"
+# else
+#  define SCNiFAST8 "i"
 # endif
-# if !defined SCNoFAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNoFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define SCNoFAST8 SCNo64
-#  elif UINT_FAST8_MAX == 0xffff
-#   define SCNoFAST8 "ho"
-#  elif UINT_FAST8_MAX == 0xff
-#   define SCNoFAST8 "hho"
-#  else
-#   define SCNoFAST8 "o"
-#  endif
+#endif
+#if !defined SCNoFAST8 || @PRI_MACROS_BROKEN@
+# undef SCNoFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define SCNoFAST8 SCNo64
+# elif UINT_FAST8_MAX == 0xffff
+#  define SCNoFAST8 "ho"
+# elif UINT_FAST8_MAX == 0xff
+#  define SCNoFAST8 "hho"
+# else
+#  define SCNoFAST8 "o"
 # endif
-# if !defined SCNuFAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNuFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define SCNuFAST8 SCNu64
-#  elif UINT_FAST8_MAX == 0xffff
-#   define SCNuFAST8 "hu"
-#  elif UINT_FAST8_MAX == 0xff
-#   define SCNuFAST8 "hhu"
-#  else
-#   define SCNuFAST8 "u"
-#  endif
+#endif
+#if !defined SCNuFAST8 || @PRI_MACROS_BROKEN@
+# undef SCNuFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define SCNuFAST8 SCNu64
+# elif UINT_FAST8_MAX == 0xffff
+#  define SCNuFAST8 "hu"
+# elif UINT_FAST8_MAX == 0xff
+#  define SCNuFAST8 "hhu"
+# else
+#  define SCNuFAST8 "u"
 # endif
-# if !defined SCNxFAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNxFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define SCNxFAST8 SCNx64
-#  elif UINT_FAST8_MAX == 0xffff
-#   define SCNxFAST8 "hx"
-#  elif UINT_FAST8_MAX == 0xff
-#   define SCNxFAST8 "hhx"
-#  else
-#   define SCNxFAST8 "x"
-#  endif
+#endif
+#if !defined SCNxFAST8 || @PRI_MACROS_BROKEN@
+# undef SCNxFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define SCNxFAST8 SCNx64
+# elif UINT_FAST8_MAX == 0xffff
+#  define SCNxFAST8 "hx"
+# elif UINT_FAST8_MAX == 0xff
+#  define SCNxFAST8 "hhx"
+# else
+#  define SCNxFAST8 "x"
 # endif
-# if !defined SCNdFAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNdFAST16
-#  if INT_FAST16_MAX > INT32_MAX
-#   define SCNdFAST16 SCNd64
-#  elif INT_FAST16_MAX == 0x7fff
-#   define SCNdFAST16 "hd"
-#  else
-#   define SCNdFAST16 "d"
-#  endif
+#endif
+#if !defined SCNdFAST16 || @PRI_MACROS_BROKEN@
+# undef SCNdFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define SCNdFAST16 SCNd64
+# elif INT_FAST16_MAX == 0x7fff
+#  define SCNdFAST16 "hd"
+# else
+#  define SCNdFAST16 "d"
 # endif
-# if !defined SCNiFAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNiFAST16
-#  if INT_FAST16_MAX > INT32_MAX
-#   define SCNiFAST16 SCNi64
-#  elif INT_FAST16_MAX == 0x7fff
-#   define SCNiFAST16 "hi"
-#  else
-#   define SCNiFAST16 "i"
-#  endif
+#endif
+#if !defined SCNiFAST16 || @PRI_MACROS_BROKEN@
+# undef SCNiFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define SCNiFAST16 SCNi64
+# elif INT_FAST16_MAX == 0x7fff
+#  define SCNiFAST16 "hi"
+# else
+#  define SCNiFAST16 "i"
 # endif
-# if !defined SCNoFAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNoFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define SCNoFAST16 SCNo64
-#  elif UINT_FAST16_MAX == 0xffff
-#   define SCNoFAST16 "ho"
-#  else
-#   define SCNoFAST16 "o"
-#  endif
+#endif
+#if !defined SCNoFAST16 || @PRI_MACROS_BROKEN@
+# undef SCNoFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define SCNoFAST16 SCNo64
+# elif UINT_FAST16_MAX == 0xffff
+#  define SCNoFAST16 "ho"
+# else
+#  define SCNoFAST16 "o"
 # endif
-# if !defined SCNuFAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNuFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define SCNuFAST16 SCNu64
-#  elif UINT_FAST16_MAX == 0xffff
-#   define SCNuFAST16 "hu"
-#  else
-#   define SCNuFAST16 "u"
-#  endif
+#endif
+#if !defined SCNuFAST16 || @PRI_MACROS_BROKEN@
+# undef SCNuFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define SCNuFAST16 SCNu64
+# elif UINT_FAST16_MAX == 0xffff
+#  define SCNuFAST16 "hu"
+# else
+#  define SCNuFAST16 "u"
 # endif
-# if !defined SCNxFAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNxFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define SCNxFAST16 SCNx64
-#  elif UINT_FAST16_MAX == 0xffff
-#   define SCNxFAST16 "hx"
-#  else
-#   define SCNxFAST16 "x"
-#  endif
+#endif
+#if !defined SCNxFAST16 || @PRI_MACROS_BROKEN@
+# undef SCNxFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define SCNxFAST16 SCNx64
+# elif UINT_FAST16_MAX == 0xffff
+#  define SCNxFAST16 "hx"
+# else
+#  define SCNxFAST16 "x"
 # endif
-# if !defined SCNdFAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNdFAST32
-#  if INT_FAST32_MAX > INT32_MAX
-#   define SCNdFAST32 SCNd64
-#  else
-#   define SCNdFAST32 "d"
-#  endif
+#endif
+#if !defined SCNdFAST32 || @PRI_MACROS_BROKEN@
+# undef SCNdFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define SCNdFAST32 SCNd64
+# else
+#  define SCNdFAST32 "d"
 # endif
-# if !defined SCNiFAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNiFAST32
-#  if INT_FAST32_MAX > INT32_MAX
-#   define SCNiFAST32 SCNi64
-#  else
-#   define SCNiFAST32 "i"
-#  endif
+#endif
+#if !defined SCNiFAST32 || @PRI_MACROS_BROKEN@
+# undef SCNiFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define SCNiFAST32 SCNi64
+# else
+#  define SCNiFAST32 "i"
 # endif
-# if !defined SCNoFAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNoFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define SCNoFAST32 SCNo64
-#  else
-#   define SCNoFAST32 "o"
-#  endif
+#endif
+#if !defined SCNoFAST32 || @PRI_MACROS_BROKEN@
+# undef SCNoFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define SCNoFAST32 SCNo64
+# else
+#  define SCNoFAST32 "o"
 # endif
-# if !defined SCNuFAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNuFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define SCNuFAST32 SCNu64
-#  else
-#   define SCNuFAST32 "u"
-#  endif
+#endif
+#if !defined SCNuFAST32 || @PRI_MACROS_BROKEN@
+# undef SCNuFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define SCNuFAST32 SCNu64
+# else
+#  define SCNuFAST32 "u"
 # endif
-# if !defined SCNxFAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNxFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define SCNxFAST32 SCNx64
-#  else
-#   define SCNxFAST32 "x"
-#  endif
+#endif
+#if !defined SCNxFAST32 || @PRI_MACROS_BROKEN@
+# undef SCNxFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define SCNxFAST32 SCNx64
+# else
+#  define SCNxFAST32 "x"
 # endif
-# ifdef INT64_MAX
-#  if !defined SCNdFAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNdFAST64
-#   define SCNdFAST64 SCNd64
-#  endif
-#  if !defined SCNiFAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNiFAST64
-#   define SCNiFAST64 SCNi64
-#  endif
+#endif
+#ifdef INT64_MAX
+# if !defined SCNdFAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNdFAST64
+#  define SCNdFAST64 SCNd64
 # endif
-# ifdef UINT64_MAX
-#  if !defined SCNoFAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNoFAST64
-#   define SCNoFAST64 SCNo64
-#  endif
-#  if !defined SCNuFAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNuFAST64
-#   define SCNuFAST64 SCNu64
-#  endif
-#  if !defined SCNxFAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNxFAST64
-#   define SCNxFAST64 SCNx64
-#  endif
+# if !defined SCNiFAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNiFAST64
+#  define SCNiFAST64 SCNi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined SCNoFAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNoFAST64
+#  define SCNoFAST64 SCNo64
 # endif
+# if !defined SCNuFAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNuFAST64
+#  define SCNuFAST64 SCNu64
+# endif
+# if !defined SCNxFAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNxFAST64
+#  define SCNxFAST64 SCNx64
+# endif
+#endif
 
-# if !defined SCNdMAX || @PRI_MACROS_BROKEN@
-#  undef SCNdMAX
-#  if @INT32_MAX_LT_INTMAX_MAX@
-#   define SCNdMAX SCNd64
-#  else
-#   define SCNdMAX "ld"
-#  endif
+#if !defined SCNdMAX || @PRI_MACROS_BROKEN@
+# undef SCNdMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define SCNdMAX SCNd64
+# else
+#  define SCNdMAX "ld"
 # endif
-# if !defined SCNiMAX || @PRI_MACROS_BROKEN@
-#  undef SCNiMAX
-#  if @INT32_MAX_LT_INTMAX_MAX@
-#   define SCNiMAX SCNi64
-#  else
-#   define SCNiMAX "li"
-#  endif
+#endif
+#if !defined SCNiMAX || @PRI_MACROS_BROKEN@
+# undef SCNiMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define SCNiMAX SCNi64
+# else
+#  define SCNiMAX "li"
 # endif
-# if !defined SCNoMAX || @PRI_MACROS_BROKEN@
-#  undef SCNoMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define SCNoMAX SCNo64
-#  else
-#   define SCNoMAX "lo"
-#  endif
+#endif
+#if !defined SCNoMAX || @PRI_MACROS_BROKEN@
+# undef SCNoMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define SCNoMAX SCNo64
+# else
+#  define SCNoMAX "lo"
 # endif
-# if !defined SCNuMAX || @PRI_MACROS_BROKEN@
-#  undef SCNuMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define SCNuMAX SCNu64
-#  else
-#   define SCNuMAX "lu"
-#  endif
+#endif
+#if !defined SCNuMAX || @PRI_MACROS_BROKEN@
+# undef SCNuMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define SCNuMAX SCNu64
+# else
+#  define SCNuMAX "lu"
 # endif
-# if !defined SCNxMAX || @PRI_MACROS_BROKEN@
-#  undef SCNxMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define SCNxMAX SCNx64
-#  else
-#   define SCNxMAX "lx"
-#  endif
+#endif
+#if !defined SCNxMAX || @PRI_MACROS_BROKEN@
+# undef SCNxMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define SCNxMAX SCNx64
+# else
+#  define SCNxMAX "lx"
 # endif
+#endif
 
-# if !defined SCNdPTR || @PRI_MACROS_BROKEN@
-#  undef SCNdPTR
-#  ifdef INTPTR_MAX
-#   define SCNdPTR @PRIPTR_PREFIX@ "d"
-#  endif
+#if !defined SCNdPTR || @PRI_MACROS_BROKEN@
+# undef SCNdPTR
+# ifdef INTPTR_MAX
+#  define SCNdPTR @PRIPTR_PREFIX@ "d"
 # endif
-# if !defined SCNiPTR || @PRI_MACROS_BROKEN@
-#  undef SCNiPTR
-#  ifdef INTPTR_MAX
-#   define SCNiPTR @PRIPTR_PREFIX@ "i"
-#  endif
+#endif
+#if !defined SCNiPTR || @PRI_MACROS_BROKEN@
+# undef SCNiPTR
+# ifdef INTPTR_MAX
+#  define SCNiPTR @PRIPTR_PREFIX@ "i"
 # endif
-# if !defined SCNoPTR || @PRI_MACROS_BROKEN@
-#  undef SCNoPTR
-#  ifdef UINTPTR_MAX
-#   define SCNoPTR @PRIPTR_PREFIX@ "o"
-#  endif
+#endif
+#if !defined SCNoPTR || @PRI_MACROS_BROKEN@
+# undef SCNoPTR
+# ifdef UINTPTR_MAX
+#  define SCNoPTR @PRIPTR_PREFIX@ "o"
 # endif
-# if !defined SCNuPTR || @PRI_MACROS_BROKEN@
-#  undef SCNuPTR
-#  ifdef UINTPTR_MAX
-#   define SCNuPTR @PRIPTR_PREFIX@ "u"
-#  endif
+#endif
+#if !defined SCNuPTR || @PRI_MACROS_BROKEN@
+# undef SCNuPTR
+# ifdef UINTPTR_MAX
+#  define SCNuPTR @PRIPTR_PREFIX@ "u"
 # endif
-# if !defined SCNxPTR || @PRI_MACROS_BROKEN@
-#  undef SCNxPTR
-#  ifdef UINTPTR_MAX
-#   define SCNxPTR @PRIPTR_PREFIX@ "x"
-#  endif
+#endif
+#if !defined SCNxPTR || @PRI_MACROS_BROKEN@
+# undef SCNxPTR
+# ifdef UINTPTR_MAX
+#  define SCNxPTR @PRIPTR_PREFIX@ "x"
 # endif
-
 #endif
 
 /* 7.8.2 Functions for greatest-width integer types */
@@ -1075,10 +1079,23 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
 #endif
 
 #if @GNULIB_STRTOIMAX@
-# if address@hidden@
-#  undef strtoimax
-extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1));
+# if @REPLACE_STRTOIMAX@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strtoimax
+#   define strtoimax rpl_strtoimax
+#  endif
+_GL_FUNCDECL_RPL (strtoimax, intmax_t,
+                  (const char *, char **, int) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoimax, intmax_t, (const char *, char **, int));
+# else
+#  if address@hidden@
+#   undef strtoimax
+_GL_FUNCDECL_SYS (strtoimax, intmax_t,
+                  (const char *, char **, int) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtoimax, intmax_t, (const char *, char **, int));
 # endif
+_GL_CXXALIASWARN (strtoimax);
 #elif defined GNULIB_POSIXCHECK
 # undef strtoimax
 # if HAVE_RAW_DECL_STRTOIMAX
@@ -1090,8 +1107,11 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
 #if @GNULIB_STRTOUMAX@
 # if address@hidden@
 #  undef strtoumax
-extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
+                  (const char *, char **, int) _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *, char **, int));
+_GL_CXXALIASWARN (strtoumax);
 #elif defined GNULIB_POSIXCHECK
 # undef strtoumax
 # if HAVE_RAW_DECL_STRTOUMAX
diff --git a/gl/tests/ioctl.c b/gl/tests/ioctl.c
index c6ba989..8701b7a 100644
--- a/gl/tests/ioctl.c
+++ b/gl/tests/ioctl.c
@@ -1,6 +1,6 @@
 /* ioctl.c --- wrappers for Windows ioctl function
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/lstat.c b/gl/tests/lstat.c
index d786288..db119a1 100644
--- a/gl/tests/lstat.c
+++ b/gl/tests/lstat.c
@@ -1,6 +1,6 @@
 /* Work around a bug of lstat on some systems
 
-   Copyright (C) 1997-2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-2006, 2008-2012 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
@@ -51,11 +51,11 @@ orig_lstat (const char *filename, struct stat *buf)
 # include <errno.h>
 
 /* lstat works differently on Linux and Solaris systems.  POSIX (see
-   `pathname resolution' in the glossary) requires that programs like
-   `ls' take into consideration the fact that FILE has a trailing slash
+   "pathname resolution" in the glossary) requires that programs like
+   'ls' take into consideration the fact that FILE has a trailing slash
    when FILE is a symbolic link.  On Linux and Solaris 10 systems, the
    lstat function already has the desired semantics (in treating
-   `lstat ("symlink/", sbuf)' just like `lstat ("symlink/.", sbuf)',
+   'lstat ("symlink/", sbuf)' just like 'lstat ("symlink/.", sbuf)',
    but on Solaris 9 and earlier it does not.
 
    If FILE has a trailing slash and specifies a symbolic link,
diff --git a/gl/tests/macros.h b/gl/tests/macros.h
index adb3744..77a92f8 100644
--- a/gl/tests/macros.h
+++ b/gl/tests/macros.h
@@ -1,5 +1,5 @@
 /* Common macros used by gnulib tests.
-   Copyright (C) 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 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
diff --git a/gl/tests/malloca.c b/gl/tests/malloca.c
index ce071f1..3309088 100644
--- a/gl/tests/malloca.c
+++ b/gl/tests/malloca.c
@@ -1,5 +1,5 @@
 /* Safe automatic memory allocation.
-   Copyright (C) 2003, 2006-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2007, 2009-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2003.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/tests/malloca.h b/gl/tests/malloca.h
index 7083a58..725cc22 100644
--- a/gl/tests/malloca.h
+++ b/gl/tests/malloca.h
@@ -1,5 +1,5 @@
 /* Safe automatic memory allocation.
-   Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003-2007, 2009-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2003.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/tests/minus-zero.h b/gl/tests/minus-zero.h
index 9429781..491cef3 100644
--- a/gl/tests/minus-zero.h
+++ b/gl/tests/minus-zero.h
@@ -1,5 +1,5 @@
 /* Macros for floating-point negative zero.
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 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
diff --git a/gl/tests/nan.h b/gl/tests/nan.h
index eb5fd95..2f75da1 100644
--- a/gl/tests/nan.h
+++ b/gl/tests/nan.h
@@ -1,5 +1,5 @@
 /* Macros for not-a-number.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/open.c b/gl/tests/open.c
index 8dc36ef..27801b9 100644
--- a/gl/tests/open.c
+++ b/gl/tests/open.c
@@ -1,5 +1,5 @@
 /* Open a descriptor to a file.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/pathmax.h b/gl/tests/pathmax.h
index c47618a..0fd9296 100644
--- a/gl/tests/pathmax.h
+++ b/gl/tests/pathmax.h
@@ -1,5 +1,5 @@
 /* Define PATH_MAX somehow.  Requires sys/types.h.
-   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2011 Free Software
+   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/tests/perror.c b/gl/tests/perror.c
index af4b56c..4853d1b 100644
--- a/gl/tests/perror.c
+++ b/gl/tests/perror.c
@@ -1,5 +1,5 @@
 /* Print a message describing error code.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 Free Software Foundation, Inc.
    Written by Bruno Haible and Simon Josefsson.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/pipe.c b/gl/tests/pipe.c
index 425dd70..eb05f44 100644
--- a/gl/tests/pipe.c
+++ b/gl/tests/pipe.c
@@ -1,5 +1,5 @@
 /* Create a pipe.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/putenv.c b/gl/tests/putenv.c
index 2da3376..3c0f7ea 100644
--- a/gl/tests/putenv.c
+++ b/gl/tests/putenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2011 Free Software
+/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2012 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
@@ -43,7 +43,7 @@ extern char **environ;
 #endif
 
 #if _LIBC
-/* This lock protects against simultaneous modifications of `environ'.  */
+/* This lock protects against simultaneous modifications of 'environ'.  */
 # include <bits/libc-lock.h>
 __libc_lock_define_initialized (static, envlock)
 # define LOCK   __libc_lock_lock (envlock)
@@ -91,7 +91,7 @@ _unsetenv (const char *name)
 
 
 /* Put STRING, which is of the form "NAME=VALUE", in the environment.
-   If STRING contains no `=', then remove STRING from the environment.  */
+   If STRING contains no '=', then remove STRING from the environment.  */
 int
 putenv (char *string)
 {
diff --git a/gl/tests/same-inode.h b/gl/tests/same-inode.h
index d434b94..8c3900d 100644
--- a/gl/tests/same-inode.h
+++ b/gl/tests/same-inode.h
@@ -1,6 +1,6 @@
 /* Determine whether two stat buffers refer to the same file.
 
-   Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2012 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
@@ -18,8 +18,16 @@
 #ifndef SAME_INODE_H
 # define SAME_INODE_H 1
 
-# define SAME_INODE(Stat_buf_1, Stat_buf_2) \
-   ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
-    && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
+# ifdef __VMS
+#  define SAME_INODE(a, b)             \
+    ((a).st_ino[0] == (b).st_ino[0]    \
+     && (a).st_ino[1] == (b).st_ino[1] \
+     && (a).st_ino[2] == (b).st_ino[2] \
+     && (a).st_dev == (b).st_dev)
+# else
+#  define SAME_INODE(a, b)    \
+    ((a).st_ino == (b).st_ino \
+     && (a).st_dev == (b).st_dev)
+# endif
 
 #endif
diff --git a/gl/tests/setenv.c b/gl/tests/setenv.c
index 0a5f67d..8201be2 100644
--- a/gl/tests/setenv.c
+++ b/gl/tests/setenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2003, 2005-2011 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2003, 2005-2012 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
@@ -49,7 +49,7 @@
 #endif
 
 #if _LIBC
-/* This lock protects against simultaneous modifications of `environ'.  */
+/* This lock protects against simultaneous modifications of 'environ'.  */
 # include <bits/libc-lock.h>
 __libc_lock_define_initialized (static, envlock)
 # define LOCK   __libc_lock_lock (envlock)
@@ -103,11 +103,11 @@ static void *known_values;
 static char **last_environ;
 
 
-/* This function is used by `setenv' and `putenv'.  The difference between
+/* This function is used by 'setenv' and 'putenv'.  The difference between
    the two functions is that for the former must create a new string which
-   is then placed in the environment, while the argument of `putenv'
+   is then placed in the environment, while the argument of 'putenv'
    must be used directly.  This is all complicated by the fact that we try
-   to reuse values once generated for a `setenv' call since we can never
+   to reuse values once generated for a 'setenv' call since we can never
    free the strings.  */
 int
 __add_to_environ (const char *name, const char *value, const char *combined,
@@ -299,7 +299,7 @@ setenv (const char *name, const char *value, int replace)
   return __add_to_environ (name, value, NULL, replace);
 }
 
-/* The `clearenv' was planned to be added to POSIX.1 but probably
+/* The 'clearenv' was planned to be added to POSIX.1 but probably
    never made it.  Nevertheless the POSIX.9 standard (POSIX bindings
    for Fortran 77) requires this function.  */
 int
diff --git a/gl/tests/signature.h b/gl/tests/signature.h
index 8256989..d9d8b47 100644
--- a/gl/tests/signature.h
+++ b/gl/tests/signature.h
@@ -1,5 +1,5 @@
 /* Macro for checking that a function declaration is compliant.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/stat.c b/gl/tests/stat.c
index 1397aa9..9ea53c1 100644
--- a/gl/tests/stat.c
+++ b/gl/tests/stat.c
@@ -1,5 +1,5 @@
 /* Work around platform bugs in stat.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/strerror_r.c b/gl/tests/strerror_r.c
index e6cf99b..be76b0d 100644
--- a/gl/tests/strerror_r.c
+++ b/gl/tests/strerror_r.c
@@ -1,6 +1,6 @@
 /* strerror_r.c --- POSIX compatible system error routine
 
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 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
@@ -241,13 +241,13 @@ strerror_r (int errnum, char *buf, size_t buflen)
     /* Try to do what strerror (errnum) does, but without clobbering the
        buffer used by strerror().  */
 
-# if defined __NetBSD__ || defined __hpux || ((defined _WIN32 || defined 
__WIN32__) && !defined __CYGWIN__) || defined __CYGWIN__ /* NetBSD, HP-UX, 
native Win32, Cygwin */
+# if defined __NetBSD__ || defined __hpux || ((defined _WIN32 || defined 
__WIN32__) && !defined __CYGWIN__) || defined __CYGWIN__ /* NetBSD, HP-UX, 
native Windows, Cygwin */
 
-    /* NetBSD:        sys_nerr, sys_errlist are declared through _NETBSD_SOURCE
-                      and <errno.h> above.
-       HP-UX:         sys_nerr, sys_errlist are declared explicitly above.
-       native Win32:  sys_nerr, sys_errlist are declared in <stdlib.h>.
-       Cygwin:        sys_nerr, sys_errlist are declared in <errno.h>.  */
+    /* NetBSD:         sys_nerr, sys_errlist are declared through 
_NETBSD_SOURCE
+                       and <errno.h> above.
+       HP-UX:          sys_nerr, sys_errlist are declared explicitly above.
+       native Windows: sys_nerr, sys_errlist are declared in <stdlib.h>.
+       Cygwin:         sys_nerr, sys_errlist are declared in <errno.h>.  */
     if (errnum >= 0 && errnum < sys_nerr)
       {
 #  if HAVE_CATGETS && (defined __NetBSD__ || defined __hpux)
diff --git a/gl/tests/symlink.c b/gl/tests/symlink.c
index 2896cc9..642ca66 100644
--- a/gl/tests/symlink.c
+++ b/gl/tests/symlink.c
@@ -1,5 +1,5 @@
 /* Stub for symlink().
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/sys_ioctl.in.h b/gl/tests/sys_ioctl.in.h
index dc8aeda..f213411 100644
--- a/gl/tests/sys_ioctl.in.h
+++ b/gl/tests/sys_ioctl.in.h
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <sys/ioctl.h>.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-accept.c b/gl/tests/test-accept.c
index 75161a4..201e130 100644
--- a/gl/tests/test-accept.c
+++ b/gl/tests/test-accept.c
@@ -1,5 +1,5 @@
 /* Test accepting a connection to a server socket.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-alloca-opt.c b/gl/tests/test-alloca-opt.c
index 5aa1645..4e814c6 100644
--- a/gl/tests/test-alloca-opt.c
+++ b/gl/tests/test-alloca-opt.c
@@ -1,5 +1,5 @@
 /* Test of optional automatic memory allocation.
-   Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009-2012 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
diff --git a/gl/tests/test-argp-2.sh b/gl/tests/test-argp-2.sh
index 20e0d9e..49eff9c 100755
--- a/gl/tests/test-argp-2.sh
+++ b/gl/tests/test-argp-2.sh
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Test suite for argp.
-# Copyright (C) 2006-2011 Free Software Foundation, Inc.
+# Copyright (C) 2006-2012 Free Software Foundation, Inc.
 # This file is part of the GNUlib Library.
 #
 # This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-argp.c b/gl/tests/test-argp.c
index 8fab727..6ba55e9 100644
--- a/gl/tests/test-argp.c
+++ b/gl/tests/test-argp.c
@@ -1,5 +1,5 @@
 /* Test suite for argp.
-   Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNUlib Library.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-arpa_inet.c b/gl/tests/test-arpa_inet.c
index ce7d19f..bda6709 100644
--- a/gl/tests/test-arpa_inet.c
+++ b/gl/tests/test-arpa_inet.c
@@ -1,5 +1,5 @@
 /* Test of <arpa/inet.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-binary-io.c b/gl/tests/test-binary-io.c
index 8e5d193..c695454 100644
--- a/gl/tests/test-binary-io.c
+++ b/gl/tests/test-binary-io.c
@@ -1,5 +1,5 @@
 /* Test of binary mode I/O.
-   Copyright (C) 2005, 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007-2012 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
@@ -46,19 +46,10 @@ main ()
       exit (1);
     ASSERT (statbuf.st_size == 6);
   }
-  unlink ("t-bin-out2.tmp");
 
   /* Test the SET_BINARY macro.  */
   SET_BINARY (1);
   fputs ("Hello\n", stdout);
-  fclose (stdout);
-  fclose (stderr);
-  {
-    struct stat statbuf;
-    if (stat ("t-bin-out1.tmp", &statbuf) < 0)
-      exit (1);
-    ASSERT (statbuf.st_size == 6);
-  }
 
   return 0;
 }
diff --git a/gl/tests/test-binary-io.sh b/gl/tests/test-binary-io.sh
index 33e128c..272edef 100755
--- a/gl/tests/test-binary-io.sh
+++ b/gl/tests/test-binary-io.sh
@@ -5,6 +5,7 @@ trap 'rm -fr $tmpfiles' 1 2 3 15
 
 tmpfiles="$tmpfiles t-bin-out1.tmp t-bin-out2.tmp"
 ./test-binary-io${EXEEXT} > t-bin-out1.tmp || exit 1
+cmp t-bin-out1.tmp t-bin-out2.tmp > /dev/null || exit 1
 
 rm -fr $tmpfiles
 
diff --git a/gl/tests/test-bind.c b/gl/tests/test-bind.c
index 490c2fb..b4b5739 100644
--- a/gl/tests/test-bind.c
+++ b/gl/tests/test-bind.c
@@ -1,5 +1,5 @@
 /* Test binding a server socket to a port.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-byteswap.c b/gl/tests/test-byteswap.c
index e9878b3..9893b1d 100644
--- a/gl/tests/test-byteswap.c
+++ b/gl/tests/test-byteswap.c
@@ -1,5 +1,5 @@
 /* Test of <byteswap.h> substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-c-ctype.c b/gl/tests/test-c-ctype.c
index 9d748ff..a9cb655 100644
--- a/gl/tests/test-c-ctype.c
+++ b/gl/tests/test-c-ctype.c
@@ -1,5 +1,5 @@
 /* Test of character handling in C locale.
-   Copyright (C) 2005, 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007-2012 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
diff --git a/gl/tests/test-close.c b/gl/tests/test-close.c
index 2b87db1..83f71c0 100644
--- a/gl/tests/test-close.c
+++ b/gl/tests/test-close.c
@@ -1,5 +1,5 @@
 /* Test closing a file or socket.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-connect.c b/gl/tests/test-connect.c
index 84f00b5..6e43bf8 100644
--- a/gl/tests/test-connect.c
+++ b/gl/tests/test-connect.c
@@ -1,5 +1,5 @@
 /* Test connecting a client socket.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-dirent.c b/gl/tests/test-dirent.c
index 212644a..24e1759 100644
--- a/gl/tests/test-dirent.c
+++ b/gl/tests/test-dirent.c
@@ -1,5 +1,5 @@
 /* Test of <dirent.h> substitute.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-dup2.c b/gl/tests/test-dup2.c
index a14807a..5043c0c 100644
--- a/gl/tests/test-dup2.c
+++ b/gl/tests/test-dup2.c
@@ -1,5 +1,5 @@
 /* Test duplicating file descriptors.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
@@ -33,7 +33,7 @@ SIGNATURE_CHECK (dup2, int, (int, int));
 #endif
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Get declarations of the Win32 API functions.  */
+/* Get declarations of the native Windows API functions.  */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* Get _get_osfhandle.  */
@@ -47,7 +47,7 @@ static int
 is_open (int fd)
 {
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* On Win32, the initial state of unassigned standard file
+  /* On native Windows, the initial state of unassigned standard file
      descriptors is that they are open but point to an
      INVALID_HANDLE_VALUE, and there is no fcntl.  */
   return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
@@ -65,7 +65,7 @@ static int
 is_inheritable (int fd)
 {
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* On Win32, the initial state of unassigned standard file
+  /* On native Windows, the initial state of unassigned standard file
      descriptors is that they are open but point to an
      INVALID_HANDLE_VALUE, and there is no fcntl.  */
   HANDLE h = (HANDLE) _get_osfhandle (fd);
diff --git a/gl/tests/test-environ.c b/gl/tests/test-environ.c
index 11df789..972ed06 100644
--- a/gl/tests/test-environ.c
+++ b/gl/tests/test-environ.c
@@ -1,5 +1,5 @@
 /* Test of environ variable.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-errno.c b/gl/tests/test-errno.c
index 7851c22..d9a030f 100644
--- a/gl/tests/test-errno.c
+++ b/gl/tests/test-errno.c
@@ -1,5 +1,5 @@
 /* Test of <errno.h> substitute.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-fcntl-h.c b/gl/tests/test-fcntl-h.c
index 7f350b4..00c5468 100644
--- a/gl/tests/test-fcntl-h.c
+++ b/gl/tests/test-fcntl-h.c
@@ -1,5 +1,5 @@
 /* Test of <fcntl.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-fdopen.c b/gl/tests/test-fdopen.c
index 304e520..8e2f7bf 100644
--- a/gl/tests/test-fdopen.c
+++ b/gl/tests/test-fdopen.c
@@ -1,5 +1,5 @@
 /* Test opening a stream with a file descriptor.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-fgetc.c b/gl/tests/test-fgetc.c
index 4df46fb..669a71e 100644
--- a/gl/tests/test-fgetc.c
+++ b/gl/tests/test-fgetc.c
@@ -1,5 +1,5 @@
 /* Test of fgetc() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-float.c b/gl/tests/test-float.c
index 57a472f..f3691be 100644
--- a/gl/tests/test-float.c
+++ b/gl/tests/test-float.c
@@ -1,5 +1,5 @@
 /* Test of <float.h> substitute.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
@@ -298,14 +298,7 @@ test_long_double (void)
 
   /* Check that 'long double' is at least as wide as 'double'.  */
   ASSERT (LDBL_MANT_DIG >= DBL_MANT_DIG);
-
-  /* Normally, we would also assert this:
-       ASSERT (LDBL_MIN_EXP <= DBL_MIN_EXP);
-     but at least on powerpc64 with gcc-4.4.4, it would fail:
-     $ :|gcc -dD -E -include stddef.h -|grep -E 'L?DBL_MIN_EXP'
-     #define __DBL_MIN_EXP__ (-1021)
-     #define __LDBL_MIN_EXP__ (-968)
-  */
+  ASSERT (LDBL_MIN_EXP - LDBL_MANT_DIG <= DBL_MIN_EXP - DBL_MANT_DIG);
   ASSERT (LDBL_MAX_EXP >= DBL_MAX_EXP);
 
   /* Check the value of LDBL_DIG.  */
diff --git a/gl/tests/test-fprintf-posix.h b/gl/tests/test-fprintf-posix.h
index e0fa537..561c69f 100644
--- a/gl/tests/test-fprintf-posix.h
+++ b/gl/tests/test-fprintf-posix.h
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible vsprintf() and sprintf() functions.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-fputc.c b/gl/tests/test-fputc.c
index 03a3716..924c222 100644
--- a/gl/tests/test-fputc.c
+++ b/gl/tests/test-fputc.c
@@ -1,5 +1,5 @@
 /* Test of fputc() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-fread.c b/gl/tests/test-fread.c
index e205c9e..fd2ac83 100644
--- a/gl/tests/test-fread.c
+++ b/gl/tests/test-fread.c
@@ -1,5 +1,5 @@
 /* Test of fread() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-frexp.c b/gl/tests/test-frexp.c
index a7ec639..7158c8f 100644
--- a/gl/tests/test-frexp.c
+++ b/gl/tests/test-frexp.c
@@ -1,5 +1,5 @@
 /* Test of splitting a double into fraction and mantissa.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-frexpl.c b/gl/tests/test-frexpl.c
index 905b293..ca28f8a 100644
--- a/gl/tests/test-frexpl.c
+++ b/gl/tests/test-frexpl.c
@@ -1,5 +1,5 @@
 /* Test of splitting a 'long double' into fraction and mantissa.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-fseek.c b/gl/tests/test-fseek.c
index 150b5f0..1dc03c5 100644
--- a/gl/tests/test-fseek.c
+++ b/gl/tests/test-fseek.c
@@ -1,5 +1,5 @@
 /* Test of fseek() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-fseeko.c b/gl/tests/test-fseeko.c
index ad5eec8..d2b348e 100644
--- a/gl/tests/test-fseeko.c
+++ b/gl/tests/test-fseeko.c
@@ -1,5 +1,5 @@
 /* Test of fseeko() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-fseeko3.c b/gl/tests/test-fseeko3.c
index 41f2233..ffeb50f 100644
--- a/gl/tests/test-fseeko3.c
+++ b/gl/tests/test-fseeko3.c
@@ -1,5 +1,5 @@
 /* Test of fseeko() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-fseeko4.c b/gl/tests/test-fseeko4.c
index 61559e1..3642d3c 100644
--- a/gl/tests/test-fseeko4.c
+++ b/gl/tests/test-fseeko4.c
@@ -1,5 +1,5 @@
 /* Test of fseeko() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-fseterr.c b/gl/tests/test-fseterr.c
index cbd97fa..611b0e4 100644
--- a/gl/tests/test-fseterr.c
+++ b/gl/tests/test-fseterr.c
@@ -1,5 +1,5 @@
 /* Test setting the error indicator of a stream.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-fstat.c b/gl/tests/test-fstat.c
index 6c120d9..7f3c3c4 100644
--- a/gl/tests/test-fstat.c
+++ b/gl/tests/test-fstat.c
@@ -1,5 +1,5 @@
 /* Tests of fstat() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-ftell.c b/gl/tests/test-ftell.c
index 54ede05..08c76aa 100644
--- a/gl/tests/test-ftell.c
+++ b/gl/tests/test-ftell.c
@@ -1,5 +1,5 @@
 /* Test of ftell() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-ftell3.c b/gl/tests/test-ftell3.c
index a5167ef..9d225a3 100644
--- a/gl/tests/test-ftell3.c
+++ b/gl/tests/test-ftell3.c
@@ -1,5 +1,5 @@
 /* Test of ftell() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-ftello.c b/gl/tests/test-ftello.c
index 636da81..5df97cf 100644
--- a/gl/tests/test-ftello.c
+++ b/gl/tests/test-ftello.c
@@ -1,5 +1,5 @@
 /* Test of ftello() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-ftello3.c b/gl/tests/test-ftello3.c
index 50d4b88..6908add 100644
--- a/gl/tests/test-ftello3.c
+++ b/gl/tests/test-ftello3.c
@@ -1,5 +1,5 @@
 /* Test of ftello() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-ftello4.c b/gl/tests/test-ftello4.c
index d503f71..7c46d0c 100644
--- a/gl/tests/test-ftello4.c
+++ b/gl/tests/test-ftello4.c
@@ -1,5 +1,5 @@
 /* Test of ftello() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-ftruncate.c b/gl/tests/test-ftruncate.c
index c5da4eb..9a85314 100644
--- a/gl/tests/test-ftruncate.c
+++ b/gl/tests/test-ftruncate.c
@@ -1,5 +1,5 @@
 /* Test truncating a file.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-func.c b/gl/tests/test-func.c
index 19de6d3..0767104 100644
--- a/gl/tests/test-func.c
+++ b/gl/tests/test-func.c
@@ -1,5 +1,5 @@
 /* Test whether __func__ is available
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-fwrite.c b/gl/tests/test-fwrite.c
index 76ed05c..d69f463 100644
--- a/gl/tests/test-fwrite.c
+++ b/gl/tests/test-fwrite.c
@@ -1,5 +1,5 @@
 /* Test of fwrite() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-getaddrinfo.c b/gl/tests/test-getaddrinfo.c
new file mode 100644
index 0000000..5123196
--- /dev/null
+++ b/gl/tests/test-getaddrinfo.c
@@ -0,0 +1,168 @@
+/* Test the getaddrinfo module.
+
+   Copyright (C) 2006-2012 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 <http://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson.  */
+
+#include <config.h>
+
+#include <netdb.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (freeaddrinfo, void, (struct addrinfo *));
+SIGNATURE_CHECK (gai_strerror, char const *, (int));
+SIGNATURE_CHECK (getaddrinfo, int, (char const *, char const *,
+                                    struct addrinfo const *,
+                                    struct addrinfo **));
+
+#include <arpa/inet.h>
+#include <errno.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <string.h>
+
+/* Whether to print debugging messages.  */
+#define ENABLE_DEBUGGING 0
+
+#if ENABLE_DEBUGGING
+# define dbgprintf printf
+#else
+# define dbgprintf if (0) printf
+#endif
+
+/* BeOS does not have AF_UNSPEC.  */
+#ifndef AF_UNSPEC
+# define AF_UNSPEC 0
+#endif
+
+#ifndef EAI_SERVICE
+# define EAI_SERVICE 0
+#endif
+
+static int
+simple (char const *host, char const *service)
+{
+  char buf[BUFSIZ];
+  static int skip = 0;
+  struct addrinfo hints;
+  struct addrinfo *ai0, *ai;
+  int res;
+  int err;
+
+  /* Once we skipped the test, do not try anything else */
+  if (skip)
+    return 0;
+
+  dbgprintf ("Finding %s service %s...\n", host, service);
+
+  /* This initializes "hints" but does not use it.  Is there a reason
+     for this?  If so, please fix this comment.  */
+  memset (&hints, 0, sizeof (hints));
+  hints.ai_flags = AI_CANONNAME;
+  hints.ai_family = AF_UNSPEC;
+  hints.ai_socktype = SOCK_STREAM;
+
+  res = getaddrinfo (host, service, 0, &ai0);
+  err = errno;
+
+  dbgprintf ("res %d: %s\n", res, gai_strerror (res));
+
+  if (res != 0)
+    {
+      /* EAI_AGAIN is returned if no network is available. Don't fail
+         the test merely because someone is down the country on their
+         in-law's farm. */
+      if (res == EAI_AGAIN)
+        {
+          skip++;
+          fprintf (stderr, "skipping getaddrinfo test: no network?\n");
+          return 77;
+        }
+      /* IRIX reports EAI_NONAME for "https".  Don't fail the test
+         merely because of this.  */
+      if (res == EAI_NONAME)
+        return 0;
+      /* Solaris reports EAI_SERVICE for "http" and "https".  Don't
+         fail the test merely because of this.  */
+      if (res == EAI_SERVICE)
+        return 0;
+#ifdef EAI_NODATA
+      /* AIX reports EAI_NODATA for "https".  Don't fail the test
+         merely because of this.  */
+      if (res == EAI_NODATA)
+        return 0;
+#endif
+      /* Provide details if errno was set.  */
+      if (res == EAI_SYSTEM)
+        fprintf (stderr, "system error: %s\n", strerror (err));
+
+      return 1;
+    }
+
+  for (ai = ai0; ai; ai = ai->ai_next)
+    {
+      dbgprintf ("\tflags %x\n", ai->ai_flags);
+      dbgprintf ("\tfamily %x\n", ai->ai_family);
+      dbgprintf ("\tsocktype %x\n", ai->ai_socktype);
+      dbgprintf ("\tprotocol %x\n", ai->ai_protocol);
+      dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen);
+      dbgprintf ("\tFound %s\n",
+                 inet_ntop (ai->ai_family,
+                            &((struct sockaddr_in *)
+                              ai->ai_addr)->sin_addr,
+                            buf, sizeof (buf) - 1));
+      if (ai->ai_canonname)
+        dbgprintf ("\tFound %s...\n", ai->ai_canonname);
+
+      {
+        char ipbuf[BUFSIZ];
+        char portbuf[BUFSIZ];
+
+        res = getnameinfo (ai->ai_addr, ai->ai_addrlen,
+                           ipbuf, sizeof (ipbuf) - 1,
+                           portbuf, sizeof (portbuf) - 1,
+                           NI_NUMERICHOST|NI_NUMERICSERV);
+        dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res));
+        if (res == 0)
+          {
+            dbgprintf ("\t\tip %s\n", ipbuf);
+            dbgprintf ("\t\tport %s\n", portbuf);
+          }
+      }
+
+    }
+
+  freeaddrinfo (ai0);
+
+  return 0;
+}
+
+#define HOST1 "www.gnu.org"
+#define SERV1 "http"
+#define HOST2 "www.ibm.com"
+#define SERV2 "https"
+#define HOST3 "microsoft.com"
+#define SERV3 "http"
+#define HOST4 "google.org"
+#define SERV4 "ldap"
+
+int main (void)
+{
+  return simple (HOST1, SERV1)
+    + simple (HOST2, SERV2)
+    + simple (HOST3, SERV3)
+    + simple (HOST4, SERV4);
+}
diff --git a/gl/tests/test-getcwd-lgpl.c b/gl/tests/test-getcwd-lgpl.c
index 69a7b90..3010760 100644
--- a/gl/tests/test-getcwd-lgpl.c
+++ b/gl/tests/test-getcwd-lgpl.c
@@ -1,5 +1,5 @@
 /* Test of getcwd() function.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-getdelim.c b/gl/tests/test-getdelim.c
index f4d1c9d..08c6197 100644
--- a/gl/tests/test-getdelim.c
+++ b/gl/tests/test-getdelim.c
@@ -1,5 +1,5 @@
 /* Test of getdelim() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-getline.c b/gl/tests/test-getline.c
index bead4b6..d8bb8a3 100644
--- a/gl/tests/test-getline.c
+++ b/gl/tests/test-getline.c
@@ -1,5 +1,5 @@
 /* Test of getline() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-getopt.c b/gl/tests/test-getopt.c
index 69f2cfa..e08a834 100644
--- a/gl/tests/test-getopt.c
+++ b/gl/tests/test-getopt.c
@@ -1,5 +1,5 @@
 /* Test of command line argument processing.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-getopt.h b/gl/tests/test-getopt.h
index f7b3911..978b753 100644
--- a/gl/tests/test-getopt.h
+++ b/gl/tests/test-getopt.h
@@ -1,5 +1,5 @@
 /* Test of command line argument processing.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-getopt_long.h b/gl/tests/test-getopt_long.h
index c1035b1..9d55c65 100644
--- a/gl/tests/test-getopt_long.h
+++ b/gl/tests/test-getopt_long.h
@@ -1,5 +1,5 @@
 /* Test of command line argument processing.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-getpeername.c b/gl/tests/test-getpeername.c
index 1ccd9b4..f15b32f 100644
--- a/gl/tests/test-getpeername.c
+++ b/gl/tests/test-getpeername.c
@@ -1,5 +1,5 @@
 /* Test getpeername() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-gettimeofday.c b/gl/tests/test-gettimeofday.c
index 7d09fc3..4a9d264 100644
--- a/gl/tests/test-gettimeofday.c
+++ b/gl/tests/test-gettimeofday.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc.
+ * Copyright (C) 2005, 2007, 2009-2012 Free Software Foundation, Inc.
  * Written by Jim Meyering.
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-ignore-value.c b/gl/tests/test-ignore-value.c
index 6953f4c..f036134 100644
--- a/gl/tests/test-ignore-value.c
+++ b/gl/tests/test-ignore-value.c
@@ -1,6 +1,6 @@
 /* Test the "ignore-value" module.
 
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-inet_ntop.c b/gl/tests/test-inet_ntop.c
index ebb7c1c..34de5f6 100644
--- a/gl/tests/test-inet_ntop.c
+++ b/gl/tests/test-inet_ntop.c
@@ -1,5 +1,5 @@
 /* Test of inet_ntop function.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-inet_pton.c b/gl/tests/test-inet_pton.c
index 49c140c..844908c 100644
--- a/gl/tests/test-inet_pton.c
+++ b/gl/tests/test-inet_pton.c
@@ -1,5 +1,5 @@
 /* Test of inet_pton function.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-init.sh b/gl/tests/test-init.sh
new file mode 100755
index 0000000..3368a99
--- /dev/null
+++ b/gl/tests/test-init.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+# Unit tests for init.sh
+# Copyright (C) 2011-2012 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <http://www.gnu.org/licenses/>.  */
+
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ .
+
+fail=0
+
+test_compare()
+{
+  touch empty || fail=1
+  echo xyz > in || fail=1
+
+  compare /dev/null /dev/null >out 2>err || fail=1
+  test -s out && fail_ "out not empty: $(cat out)"
+  # "err" should be empty, too, but has "set -x" output when VERBOSE=yes
+  case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
+
+  compare /dev/null empty >out 2>err || fail=1
+  test -s out && fail_ "out not empty: $(cat out)"
+  case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
+
+  compare in in >out 2>err || fail=1
+  test -s out && fail_ "out not empty: $(cat out)"
+  case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
+
+  compare /dev/null in >out 2>err && fail=1
+  cat <<\EOF > exp
+diff -u /dev/null in
+--- /dev/null  1970-01-01
++++ in 1970-01-01
++xyz
+EOF
+  compare exp out || fail=1
+  case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
+
+  compare empty in >out 2>err && fail=1
+  # Remove the TAB-date suffix on each --- and +++ line,
+  # for both the expected and the actual output files.
+  # Also remove the @@ line, since Solaris 5.10 and GNU diff formats differ:
+  # -@@ -0,0 +1 @@
+  # +@@ -1,0 +1,1 @@
+  cat <<\EOF > exp
+--- empty
++++ in
++xyz
+EOF
+  sed 's/      .*//;/^@@/d' out > k && mv k out
+
+  # Compare against expected output only if compare is using diff -u.
+  if (diff -u out out < /dev/null) > /dev/null 2>&1; then
+    compare exp out || fail=1
+  fi
+  case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
+}
+
+test_compare
+
+Exit $fail
diff --git a/gl/tests/test-intprops.c b/gl/tests/test-intprops.c
index 1a34d77..aeb1168 100644
--- a/gl/tests/test-intprops.c
+++ b/gl/tests/test-intprops.c
@@ -1,5 +1,5 @@
 /* Test intprops.h.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-inttypes.c b/gl/tests/test-inttypes.c
index 5bf952c..698d3dc 100644
--- a/gl/tests/test-inttypes.c
+++ b/gl/tests/test-inttypes.c
@@ -1,5 +1,5 @@
 /* Test of <inttypes.h> substitute.
-   Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2007, 2009-2012 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
@@ -18,9 +18,6 @@
 
 #include <config.h>
 
-#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 __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */
 #include <inttypes.h>
 
 #include <stddef.h>
diff --git a/gl/tests/test-ioctl.c b/gl/tests/test-ioctl.c
index 130ee42..c3aadce 100644
--- a/gl/tests/test-ioctl.c
+++ b/gl/tests/test-ioctl.c
@@ -1,5 +1,5 @@
 /* Test of ioctl() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-isnand-nolibm.c b/gl/tests/test-isnand-nolibm.c
index d120459..d35e9b3 100644
--- a/gl/tests/test-isnand-nolibm.c
+++ b/gl/tests/test-isnand-nolibm.c
@@ -1,5 +1,5 @@
 /* Test of isnand() substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-isnand.h b/gl/tests/test-isnand.h
index 181e36f..52d35bf 100644
--- a/gl/tests/test-isnand.h
+++ b/gl/tests/test-isnand.h
@@ -1,5 +1,5 @@
 /* Test of isnand() substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-isnanf-nolibm.c b/gl/tests/test-isnanf-nolibm.c
index 6d720be..cef9925 100644
--- a/gl/tests/test-isnanf-nolibm.c
+++ b/gl/tests/test-isnanf-nolibm.c
@@ -1,5 +1,5 @@
 /* Test of isnanf() substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-isnanf.h b/gl/tests/test-isnanf.h
index 4a33508..10adf30 100644
--- a/gl/tests/test-isnanf.h
+++ b/gl/tests/test-isnanf.h
@@ -1,5 +1,5 @@
 /* Test of isnanf() substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-isnanl-nolibm.c b/gl/tests/test-isnanl-nolibm.c
index 5322087..96159f8 100644
--- a/gl/tests/test-isnanl-nolibm.c
+++ b/gl/tests/test-isnanl-nolibm.c
@@ -1,5 +1,5 @@
 /* Test of isnanl() substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-isnanl.h b/gl/tests/test-isnanl.h
index 9f1d763..8a9e684 100644
--- a/gl/tests/test-isnanl.h
+++ b/gl/tests/test-isnanl.h
@@ -1,5 +1,5 @@
 /* Test of isnanl() substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-listen.c b/gl/tests/test-listen.c
index becc453..3ea82d4 100644
--- a/gl/tests/test-listen.c
+++ b/gl/tests/test-listen.c
@@ -1,5 +1,5 @@
 /* Test listen() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-lock.c b/gl/tests/test-lock.c
index 3f8846b..06bb3df 100644
--- a/gl/tests/test-lock.c
+++ b/gl/tests/test-lock.c
@@ -1,5 +1,5 @@
 /* Test of locking in multithreaded situations.
-   Copyright (C) 2005, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2008-2012 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
@@ -18,7 +18,7 @@
 
 #include <config.h>
 
-#if USE_POSIX_THREADS || USE_SOLARIS_THREADS || USE_PTH_THREADS || 
USE_WIN32_THREADS
+#if USE_POSIX_THREADS || USE_SOLARIS_THREADS || USE_PTH_THREADS || 
USE_WINDOWS_THREADS
 
 #if USE_POSIX_THREADS
 # define TEST_POSIX_THREADS 1
@@ -29,8 +29,8 @@
 #if USE_PTH_THREADS
 # define TEST_PTH_THREADS 1
 #endif
-#if USE_WIN32_THREADS
-# define TEST_WIN32_THREADS 1
+#if USE_WINDOWS_THREADS
+# define TEST_WINDOWS_THREADS 1
 #endif
 
 /* Whether to enable locking.
@@ -69,7 +69,7 @@
 # undef USE_POSIX_THREADS
 # undef USE_SOLARIS_THREADS
 # undef USE_PTH_THREADS
-# undef USE_WIN32_THREADS
+# undef USE_WINDOWS_THREADS
 #endif
 #include "glthread/lock.h"
 
@@ -83,8 +83,8 @@
 # if TEST_PTH_THREADS
 #  define USE_PTH_THREADS 1
 # endif
-# if TEST_WIN32_THREADS
-#  define USE_WIN32_THREADS 1
+# if TEST_WINDOWS_THREADS
+#  define USE_WINDOWS_THREADS 1
 # endif
 #endif
 
diff --git a/gl/tests/test-lstat.c b/gl/tests/test-lstat.c
index 372e056..459bf88 100644
--- a/gl/tests/test-lstat.c
+++ b/gl/tests/test-lstat.c
@@ -1,5 +1,5 @@
 /* Test of lstat() function.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-lstat.h b/gl/tests/test-lstat.h
index 883c4e8..4a81494 100644
--- a/gl/tests/test-lstat.h
+++ b/gl/tests/test-lstat.h
@@ -1,5 +1,5 @@
 /* Test of lstat() function.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-malloc-gnu.c b/gl/tests/test-malloc-gnu.c
index c2a3d6b..16b3a0a 100644
--- a/gl/tests/test-malloc-gnu.c
+++ b/gl/tests/test-malloc-gnu.c
@@ -1,5 +1,5 @@
 /* Test of malloc function.
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 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
diff --git a/gl/tests/test-malloca.c b/gl/tests/test-malloca.c
index 92c86f2..d7732c3 100644
--- a/gl/tests/test-malloca.c
+++ b/gl/tests/test-malloca.c
@@ -1,5 +1,5 @@
 /* Test of safe automatic memory allocation.
-   Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009-2012 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
diff --git a/gl/tests/test-math.c b/gl/tests/test-math.c
index 8565925..f6e61a7 100644
--- a/gl/tests/test-math.c
+++ b/gl/tests/test-math.c
@@ -1,5 +1,5 @@
 /* Test of <math.h> substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-memchr.c b/gl/tests/test-memchr.c
index a11f6cd..1298c27 100644
--- a/gl/tests/test-memchr.c
+++ b/gl/tests/test-memchr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2011 Free Software Foundation, Inc.
+ * Copyright (C) 2008-2012 Free Software Foundation, Inc.
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-netdb.c b/gl/tests/test-netdb.c
index 13a8925..2312f3f 100644
--- a/gl/tests/test-netdb.c
+++ b/gl/tests/test-netdb.c
@@ -1,5 +1,5 @@
 /* Test of <netdb.h> substitute.
-   Copyright (C) 2007-2008, 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2008, 2010-2012 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
diff --git a/gl/tests/test-netinet_in.c b/gl/tests/test-netinet_in.c
index b1edc66..d318e47 100644
--- a/gl/tests/test-netinet_in.c
+++ b/gl/tests/test-netinet_in.c
@@ -1,5 +1,5 @@
 /* Test of <netinet/in.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-open.c b/gl/tests/test-open.c
index 3c5b2ab..b9ec9bf 100644
--- a/gl/tests/test-open.c
+++ b/gl/tests/test-open.c
@@ -1,5 +1,5 @@
 /* Test of opening a file descriptor.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-open.h b/gl/tests/test-open.h
index 2ba5d13..cab1d27 100644
--- a/gl/tests/test-open.h
+++ b/gl/tests/test-open.h
@@ -1,5 +1,5 @@
 /* Test of opening a file descriptor.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-pathmax.c b/gl/tests/test-pathmax.c
index 96a1364..c6d0ccc 100644
--- a/gl/tests/test-pathmax.c
+++ b/gl/tests/test-pathmax.c
@@ -1,5 +1,5 @@
 /* Test of "pathmax.h".
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-perror.c b/gl/tests/test-perror.c
index d3751d8..dbbeb33 100644
--- a/gl/tests/test-perror.c
+++ b/gl/tests/test-perror.c
@@ -1,5 +1,5 @@
 /* Test of perror() function.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-perror2.c b/gl/tests/test-perror2.c
index e230f92..446bce9 100644
--- a/gl/tests/test-perror2.c
+++ b/gl/tests/test-perror2.c
@@ -1,5 +1,5 @@
 /* Test of perror() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-pipe.c b/gl/tests/test-pipe.c
index 90f41f9..ebee805 100644
--- a/gl/tests/test-pipe.c
+++ b/gl/tests/test-pipe.c
@@ -1,5 +1,5 @@
 /* Test of pipe.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
@@ -26,7 +26,7 @@ SIGNATURE_CHECK (pipe, int, (int[2]));
 #include <stdbool.h>
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Get declarations of the Win32 API functions.  */
+/* Get declarations of the native Windows API functions.  */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* Get _get_osfhandle.  */
@@ -41,7 +41,7 @@ static bool
 is_open (int fd)
 {
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* On Win32, the initial state of unassigned standard file
+  /* On native Windows, the initial state of unassigned standard file
      descriptors is that they are open but point to an
      INVALID_HANDLE_VALUE, and there is no fcntl.  */
   return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
diff --git a/gl/tests/test-printf-frexp.c b/gl/tests/test-printf-frexp.c
index d1b0d84..d144a52 100644
--- a/gl/tests/test-printf-frexp.c
+++ b/gl/tests/test-printf-frexp.c
@@ -1,5 +1,5 @@
 /* Test of splitting a double into fraction and mantissa.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-printf-frexpl.c b/gl/tests/test-printf-frexpl.c
index 4e9704f..ac77781 100644
--- a/gl/tests/test-printf-frexpl.c
+++ b/gl/tests/test-printf-frexpl.c
@@ -1,5 +1,5 @@
 /* Test of splitting a 'long double' into fraction and mantissa.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-printf-posix.h b/gl/tests/test-printf-posix.h
index 3d29212..53ef905 100644
--- a/gl/tests/test-printf-posix.h
+++ b/gl/tests/test-printf-posix.h
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible vsprintf() and sprintf() functions.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-rawmemchr.c b/gl/tests/test-rawmemchr.c
index be8feac..9e31500 100644
--- a/gl/tests/test-rawmemchr.c
+++ b/gl/tests/test-rawmemchr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2011 Free Software Foundation, Inc.
+ * Copyright (C) 2008-2012 Free Software Foundation, Inc.
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-read-file.c b/gl/tests/test-read-file.c
index de7a0bb..aec3c4b 100644
--- a/gl/tests/test-read-file.c
+++ b/gl/tests/test-read-file.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2007, 2010-2011 Free Software Foundation, Inc.
+ * Copyright (C) 2006-2007, 2010-2012 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-recv.c b/gl/tests/test-recv.c
index ae811b6..a147d5d 100644
--- a/gl/tests/test-recv.c
+++ b/gl/tests/test-recv.c
@@ -1,5 +1,5 @@
 /* Test the recv() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-recvfrom.c b/gl/tests/test-recvfrom.c
index 069b9cf..1447620 100644
--- a/gl/tests/test-recvfrom.c
+++ b/gl/tests/test-recvfrom.c
@@ -1,5 +1,5 @@
 /* Test the recvfrom() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-select-fd.c b/gl/tests/test-select-fd.c
index de2f3e9..32df4b7 100644
--- a/gl/tests/test-select-fd.c
+++ b/gl/tests/test-select-fd.c
@@ -1,5 +1,5 @@
 /* Test of select() substitute, reading or writing from a given file 
descriptor.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-select-stdin.c b/gl/tests/test-select-stdin.c
index 5a6f81a..75dd855 100644
--- a/gl/tests/test-select-stdin.c
+++ b/gl/tests/test-select-stdin.c
@@ -1,5 +1,5 @@
 /* Test of select() substitute, reading from stdin.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-select.c b/gl/tests/test-select.c
index 9c6fb9d..f6e193e 100644
--- a/gl/tests/test-select.c
+++ b/gl/tests/test-select.c
@@ -1,5 +1,5 @@
 /* Test of select() substitute.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-select.h b/gl/tests/test-select.h
index 4612dfc..9fe998c 100644
--- a/gl/tests/test-select.h
+++ b/gl/tests/test-select.h
@@ -1,5 +1,5 @@
 /* Test of select() substitute.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
@@ -30,7 +30,7 @@
 #include "macros.h"
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# define WIN32_NATIVE
+# define WINDOWS_NATIVE
 #endif
 
 #ifdef HAVE_SYS_WAIT_H
@@ -121,7 +121,7 @@ connect_to_socket (bool blocking)
 
   if (!blocking)
     {
-#ifdef WIN32_NATIVE
+#ifdef WINDOWS_NATIVE
       unsigned long iMode = 1;
       ioctl (s, FIONBIO, (char *) &iMode);
 
@@ -262,7 +262,7 @@ static void
 test_bad_fd (select_fn my_select)
 {
   /* This tests fails on OSF/1 and native Windows, even with fd = 16.  */
-#if !(defined __osf__ || defined WIN32_NATIVE)
+#if !(defined __osf__ || defined WINDOWS_NATIVE)
   int fd;
 
   /* On Linux, MacOS X, *BSD, values of fd like 99 or 399 are discarded
@@ -318,7 +318,7 @@ test_connect_first (select_fn my_select)
 static void
 test_accept_first (select_fn my_select)
 {
-#ifndef WIN32_NATIVE
+#ifndef WINDOWS_NATIVE
   int s = open_server_socket ();
   struct sockaddr_in ia;
   socklen_t addrlen;
diff --git a/gl/tests/test-send.c b/gl/tests/test-send.c
index 9fb24d4..febbe20 100644
--- a/gl/tests/test-send.c
+++ b/gl/tests/test-send.c
@@ -1,5 +1,5 @@
 /* Test the send() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-sendto.c b/gl/tests/test-sendto.c
index 9e8a519..88fad93 100644
--- a/gl/tests/test-sendto.c
+++ b/gl/tests/test-sendto.c
@@ -1,5 +1,5 @@
 /* Test the sendto() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-setenv.c b/gl/tests/test-setenv.c
index 50eb71b..4752a11 100644
--- a/gl/tests/test-setenv.c
+++ b/gl/tests/test-setenv.c
@@ -1,5 +1,5 @@
 /* Tests of setenv.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-setsockopt.c b/gl/tests/test-setsockopt.c
index 7a16cfa..cc78a1b 100644
--- a/gl/tests/test-setsockopt.c
+++ b/gl/tests/test-setsockopt.c
@@ -1,5 +1,5 @@
 /* Test setsockopt() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-shutdown.c b/gl/tests/test-shutdown.c
index d154f8e..91d979a 100644
--- a/gl/tests/test-shutdown.c
+++ b/gl/tests/test-shutdown.c
@@ -1,5 +1,5 @@
 /* Test the shutdown() function.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-signal-h.c b/gl/tests/test-signal-h.c
index 7103e1f..9529017 100644
--- a/gl/tests/test-signal-h.c
+++ b/gl/tests/test-signal-h.c
@@ -1,5 +1,5 @@
 /* Test of <signal.h> substitute.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-signbit.c b/gl/tests/test-signbit.c
index 940156e..d9ff91d 100644
--- a/gl/tests/test-signbit.c
+++ b/gl/tests/test-signbit.c
@@ -1,5 +1,5 @@
 /* Test of signbit() substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-sleep.c b/gl/tests/test-sleep.c
index 3550e2b..a0a2e77 100644
--- a/gl/tests/test-sleep.c
+++ b/gl/tests/test-sleep.c
@@ -1,5 +1,5 @@
 /* Test of sleep() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-snprintf.c b/gl/tests/test-snprintf.c
index 2b5a54c..bd66449 100644
--- a/gl/tests/test-snprintf.c
+++ b/gl/tests/test-snprintf.c
@@ -1,5 +1,5 @@
 /* Test of snprintf() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-sockets.c b/gl/tests/test-sockets.c
index 0170d37..f43e011 100644
--- a/gl/tests/test-sockets.c
+++ b/gl/tests/test-sockets.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2011 Free Software Foundation, Inc.
+ * Copyright (C) 2008-2012 Free Software Foundation, Inc.
  * Written by Simon Josefsson.
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-stat.c b/gl/tests/test-stat.c
index cd74491..db9adf9 100644
--- a/gl/tests/test-stat.c
+++ b/gl/tests/test-stat.c
@@ -1,5 +1,5 @@
 /* Tests of stat.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-stat.h b/gl/tests/test-stat.h
index 3c8f7ad..2c9afc0 100644
--- a/gl/tests/test-stat.h
+++ b/gl/tests/test-stat.h
@@ -1,5 +1,5 @@
 /* Tests of stat.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-stdalign.c b/gl/tests/test-stdalign.c
index 7090a26..d4c1d2e 100644
--- a/gl/tests/test-stdalign.c
+++ b/gl/tests/test-stdalign.c
@@ -1,5 +1,5 @@
 /* Test of <stdalign.h>.
-   Copyright 2009-2011 Free Software Foundation, Inc.
+   Copyright 2009-2012 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
@@ -71,7 +71,7 @@ CHECK_STATIC (int64_t);
 #endif
 CHECK_STATIC (float);
 CHECK_STATIC (double);
-CHECK_STATIC (longdouble);
+/* CHECK_STATIC (longdouble); */
 CHECK_STATIC (struct1);
 CHECK_STATIC (struct2);
 CHECK_STATIC (struct3);
@@ -101,8 +101,8 @@ main ()
   CHECK_ALIGNED (static_float_Alignas);
   CHECK_ALIGNED (static_double_alignas);
   CHECK_ALIGNED (static_double_Alignas);
-  CHECK_ALIGNED (static_longdouble_alignas);
-  CHECK_ALIGNED (static_longdouble_Alignas);
+  /* CHECK_ALIGNED (static_longdouble_alignas); */
+  /* CHECK_ALIGNED (static_longdouble_Alignas); */
   CHECK_ALIGNED (static_struct1_alignas);
   CHECK_ALIGNED (static_struct1_Alignas);
   CHECK_ALIGNED (static_struct2_alignas);
diff --git a/gl/tests/test-stdbool.c b/gl/tests/test-stdbool.c
index e115ba2..c22ca1f 100644
--- a/gl/tests/test-stdbool.c
+++ b/gl/tests/test-stdbool.c
@@ -1,5 +1,5 @@
 /* Test of <stdbool.h> substitute.
-   Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2002-2007, 2009-2012 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
diff --git a/gl/tests/test-stddef.c b/gl/tests/test-stddef.c
index c929af8..d7237b3 100644
--- a/gl/tests/test-stddef.c
+++ b/gl/tests/test-stddef.c
@@ -1,5 +1,5 @@
 /* Test of <stddef.h> substitute.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-stdint.c b/gl/tests/test-stdint.c
index f606cc3..23b2b28 100644
--- a/gl/tests/test-stdint.c
+++ b/gl/tests/test-stdint.c
@@ -1,5 +1,5 @@
 /* Test of <stdint.h> substitute.
-   Copyright (C) 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 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
@@ -21,8 +21,6 @@
 /* Whether to enable pedantic checks. */
 #define DO_PEDANTIC 0
 
-#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_CONSTANT_MACROS 1 /* likewise */
 #include <stdint.h>
 
 #include "verify.h"
diff --git a/gl/tests/test-stdio.c b/gl/tests/test-stdio.c
index 7e7a206..7bd67c2 100644
--- a/gl/tests/test-stdio.c
+++ b/gl/tests/test-stdio.c
@@ -1,5 +1,5 @@
 /* Test of <stdio.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-stdlib.c b/gl/tests/test-stdlib.c
index 210aab4..7eeb410 100644
--- a/gl/tests/test-stdlib.c
+++ b/gl/tests/test-stdlib.c
@@ -1,5 +1,5 @@
 /* Test of <stdlib.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-strchrnul.c b/gl/tests/test-strchrnul.c
index 6ea8adc..f1d0928 100644
--- a/gl/tests/test-strchrnul.c
+++ b/gl/tests/test-strchrnul.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2011 Free Software Foundation, Inc.
+ * Copyright (C) 2008-2012 Free Software Foundation, Inc.
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-strerror.c b/gl/tests/test-strerror.c
index 3ffb12e..a40c079 100644
--- a/gl/tests/test-strerror.c
+++ b/gl/tests/test-strerror.c
@@ -1,5 +1,5 @@
 /* Test of strerror() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-strerror_r.c b/gl/tests/test-strerror_r.c
index 956c458..0539de2 100644
--- a/gl/tests/test-strerror_r.c
+++ b/gl/tests/test-strerror_r.c
@@ -1,5 +1,5 @@
 /* Test of strerror_r() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-string.c b/gl/tests/test-string.c
index 54c49a9..56e5974 100644
--- a/gl/tests/test-string.c
+++ b/gl/tests/test-string.c
@@ -1,5 +1,5 @@
 /* Test of <string.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-strings.c b/gl/tests/test-strings.c
index ee2ad62..1805e16 100644
--- a/gl/tests/test-strings.c
+++ b/gl/tests/test-strings.c
@@ -1,5 +1,5 @@
 /* Test of <strings.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-strnlen.c b/gl/tests/test-strnlen.c
index 18d6fcd..cbc1883 100644
--- a/gl/tests/test-strnlen.c
+++ b/gl/tests/test-strnlen.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2011 Free Software Foundation, Inc.
+ * Copyright (C) 2010-2012 Free Software Foundation, Inc.
  * Written by Eric Blake
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-strverscmp.c b/gl/tests/test-strverscmp.c
index 9a9da10..d58cec2 100644
--- a/gl/tests/test-strverscmp.c
+++ b/gl/tests/test-strverscmp.c
@@ -1,5 +1,5 @@
 /* Test of strverscmp() function.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/test-symlink.c b/gl/tests/test-symlink.c
index 367e045..b3caac9 100644
--- a/gl/tests/test-symlink.c
+++ b/gl/tests/test-symlink.c
@@ -1,5 +1,5 @@
 /* Tests of symlink.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-symlink.h b/gl/tests/test-symlink.h
index 4d93929..a7c4079 100644
--- a/gl/tests/test-symlink.h
+++ b/gl/tests/test-symlink.h
@@ -1,5 +1,5 @@
 /* Tests of symlink.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-sys_ioctl.c b/gl/tests/test-sys_ioctl.c
index dd01b4a..725cabf 100644
--- a/gl/tests/test-sys_ioctl.c
+++ b/gl/tests/test-sys_ioctl.c
@@ -1,5 +1,5 @@
 /* Test of <sys/ioctl.h> substitute.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-sys_select.c b/gl/tests/test-sys_select.c
index 76596db..a473eba 100644
--- a/gl/tests/test-sys_select.c
+++ b/gl/tests/test-sys_select.c
@@ -1,5 +1,5 @@
 /* Test of <sys/select.h> substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-sys_socket.c b/gl/tests/test-sys_socket.c
index 58c1899..271815d 100644
--- a/gl/tests/test-sys_socket.c
+++ b/gl/tests/test-sys_socket.c
@@ -1,5 +1,5 @@
 /* Test of <sys/socket.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-sys_stat.c b/gl/tests/test-sys_stat.c
index 3303bad..0702e04 100644
--- a/gl/tests/test-sys_stat.c
+++ b/gl/tests/test-sys_stat.c
@@ -1,5 +1,5 @@
 /* Test of <sys/stat.h> substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-sys_time.c b/gl/tests/test-sys_time.c
index da64b85..a9ac5e3 100644
--- a/gl/tests/test-sys_time.c
+++ b/gl/tests/test-sys_time.c
@@ -1,5 +1,5 @@
 /* Test of <sys/time.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-sys_types.c b/gl/tests/test-sys_types.c
index 816c9d6..c2af992 100644
--- a/gl/tests/test-sys_types.c
+++ b/gl/tests/test-sys_types.c
@@ -1,5 +1,5 @@
 /* Test of <sys/types.h> substitute.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-sys_uio.c b/gl/tests/test-sys_uio.c
index 7855a6b..ffb46ce 100644
--- a/gl/tests/test-sys_uio.c
+++ b/gl/tests/test-sys_uio.c
@@ -1,5 +1,5 @@
 /* Test of <sys/uio.h> substitute.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-sys_wait.h b/gl/tests/test-sys_wait.h
index 3c9b322..d3726df 100644
--- a/gl/tests/test-sys_wait.h
+++ b/gl/tests/test-sys_wait.h
@@ -1,5 +1,5 @@
 /* Test of macros shared between <sys/wait.h> and <stdlib.h>.
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 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
diff --git a/gl/tests/test-sysexits.c b/gl/tests/test-sysexits.c
index 0d9a22c..a5333d0 100644
--- a/gl/tests/test-sysexits.c
+++ b/gl/tests/test-sysexits.c
@@ -1,5 +1,5 @@
 /* Test of <sysexits.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-thread_create.c b/gl/tests/test-thread_create.c
index 1348c8c..0f86771 100644
--- a/gl/tests/test-thread_create.c
+++ b/gl/tests/test-thread_create.c
@@ -1,5 +1,5 @@
 /* Test of gl_thread_create () macro.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
@@ -67,7 +67,7 @@ main ()
     }
   else
     {
-#if USE_POSIX_THREADS || USE_SOLARIS_THREADS || USE_PTH_THREADS || 
USE_WIN32_THREADS
+#if USE_POSIX_THREADS || USE_SOLARIS_THREADS || USE_PTH_THREADS || 
USE_WINDOWS_THREADS
       fputs ("glthread_create failed\n", stderr);
       return 1;
 #else
diff --git a/gl/tests/test-thread_self.c b/gl/tests/test-thread_self.c
index 816ee09..707f7fe 100644
--- a/gl/tests/test-thread_self.c
+++ b/gl/tests/test-thread_self.c
@@ -1,5 +1,5 @@
 /* Test of gl_thread_self () macro.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
diff --git a/gl/tests/test-time.c b/gl/tests/test-time.c
index d499a5c..acf3d2d 100644
--- a/gl/tests/test-time.c
+++ b/gl/tests/test-time.c
@@ -1,5 +1,5 @@
 /* Test of <time.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-u64.c b/gl/tests/test-u64.c
index bdfc95f..8be841d 100644
--- a/gl/tests/test-u64.c
+++ b/gl/tests/test-u64.c
@@ -1,5 +1,5 @@
 /* Test of <u64.h>
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-unistd.c b/gl/tests/test-unistd.c
index be1ae06..e53fd7a 100644
--- a/gl/tests/test-unistd.c
+++ b/gl/tests/test-unistd.c
@@ -1,5 +1,5 @@
 /* Test of <unistd.h> substitute.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/tests/test-unsetenv.c b/gl/tests/test-unsetenv.c
index 9c9443b..926526d 100644
--- a/gl/tests/test-unsetenv.c
+++ b/gl/tests/test-unsetenv.c
@@ -1,5 +1,5 @@
 /* Tests of unsetenv.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/tests/test-sys_ioctl.c b/gl/tests/test-usleep.c
similarity index 68%
copy from gl/tests/test-sys_ioctl.c
copy to gl/tests/test-usleep.c
index dd01b4a..1e4cac1 100644
--- a/gl/tests/test-sys_ioctl.c
+++ b/gl/tests/test-usleep.c
@@ -1,5 +1,5 @@
-/* Test of <sys/ioctl.h> substitute.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+/* Test of usleep() function.
+   Copyright (C) 2009-2012 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
@@ -18,10 +18,23 @@
 
 #include <config.h>
 
-#include <sys/ioctl.h>
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (usleep, int, (useconds_t));
+
+#include <time.h>
+
+#include "macros.h"
 
 int
 main (void)
 {
+  time_t start = time (NULL);
+  ASSERT (usleep (1000000) == 0);
+  ASSERT (start < time (NULL));
+
+  ASSERT (usleep (0) == 0);
+
   return 0;
 }
diff --git a/gl/tests/test-vasnprintf.c b/gl/tests/test-vasnprintf.c
index 6b2a0ff..4e548b1 100644
--- a/gl/tests/test-vasnprintf.c
+++ b/gl/tests/test-vasnprintf.c
@@ -1,5 +1,5 @@
 /* Test of vasnprintf() and asnprintf() functions.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-vasprintf.c b/gl/tests/test-vasprintf.c
index 6882d18..4d7635b 100644
--- a/gl/tests/test-vasprintf.c
+++ b/gl/tests/test-vasprintf.c
@@ -1,5 +1,5 @@
 /* Test of vasprintf() and asprintf() functions.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-vc-list-files-cvs.sh 
b/gl/tests/test-vc-list-files-cvs.sh
index 531b269..68b0a0f 100755
--- a/gl/tests/test-vc-list-files-cvs.sh
+++ b/gl/tests/test-vc-list-files-cvs.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Unit tests for vc-list-files
-# Copyright (C) 2008-2011 Free Software Foundation, Inc.
+# Copyright (C) 2008-2012 Free Software Foundation, Inc.
 # This file is part of the GNUlib Library.
 #
 # This program is free software: you can redistribute it and/or modify
@@ -36,7 +36,6 @@ for i in with-cvsu without; do
   ok=0
   mkdir $tmpdir && cd $tmpdir &&
     # without cvs, skip the test
-    # The double use of 'exit' is needed for the reference to $? inside the 
trap.
     { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \
       || skip_ "cvs not found in PATH"; } &&
     mkdir w && cd w &&
diff --git a/gl/tests/test-vc-list-files-git.sh 
b/gl/tests/test-vc-list-files-git.sh
index 523b2a9..1ea6d89 100755
--- a/gl/tests/test-vc-list-files-git.sh
+++ b/gl/tests/test-vc-list-files-git.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Unit tests for vc-list-files
-# Copyright (C) 2008-2011 Free Software Foundation, Inc.
+# Copyright (C) 2008-2012 Free Software Foundation, Inc.
 # This file is part of the GNUlib Library.
 #
 # This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-verify.c b/gl/tests/test-verify.c
index 454f4f4..5ab9c58 100644
--- a/gl/tests/test-verify.c
+++ b/gl/tests/test-verify.c
@@ -1,6 +1,6 @@
 /* Test the "verify" module.
 
-   Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2009-2012 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
diff --git a/gl/tests/test-version-etc.c b/gl/tests/test-version-etc.c
index 00a5d7c..36ced60 100644
--- a/gl/tests/test-version-etc.c
+++ b/gl/tests/test-version-etc.c
@@ -1,5 +1,5 @@
 /* Test suite for version-etc.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNUlib Library.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-version-etc.sh b/gl/tests/test-version-etc.sh
index c1ed827..945383b 100755
--- a/gl/tests/test-version-etc.sh
+++ b/gl/tests/test-version-etc.sh
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Test suite for version-etc.
-# Copyright (C) 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2009-2012 Free Software Foundation, Inc.
 # This file is part of the GNUlib Library.
 #
 # This program is free software: you can redistribute it and/or modify
diff --git a/gl/tests/test-vfprintf-posix.c b/gl/tests/test-vfprintf-posix.c
index 1db3112..706ee70 100644
--- a/gl/tests/test-vfprintf-posix.c
+++ b/gl/tests/test-vfprintf-posix.c
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible vfprintf() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-vprintf-posix.c b/gl/tests/test-vprintf-posix.c
index fcad8af..f64bf83 100644
--- a/gl/tests/test-vprintf-posix.c
+++ b/gl/tests/test-vprintf-posix.c
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible vfprintf() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-vsnprintf.c b/gl/tests/test-vsnprintf.c
index 7a52082..9ee61c0 100644
--- a/gl/tests/test-vsnprintf.c
+++ b/gl/tests/test-vsnprintf.c
@@ -1,5 +1,5 @@
 /* Test of vsnprintf() function.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/test-wchar.c b/gl/tests/test-wchar.c
index 2d3bad7..0d72005 100644
--- a/gl/tests/test-wchar.c
+++ b/gl/tests/test-wchar.c
@@ -1,5 +1,5 @@
 /* Test of <wchar.h> substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/tests/unsetenv.c b/gl/tests/unsetenv.c
index 16b50d1..ddbe9a4 100644
--- a/gl/tests/unsetenv.c
+++ b/gl/tests/unsetenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2002, 2005-2011 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2002, 2005-2012 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
@@ -36,7 +36,7 @@
 #endif
 
 #if _LIBC
-/* This lock protects against simultaneous modifications of `environ'.  */
+/* This lock protects against simultaneous modifications of 'environ'.  */
 # include <bits/libc-lock.h>
 __libc_lock_define_initialized (static, envlock)
 # define LOCK   __libc_lock_lock (envlock)
diff --git a/gl/tests/w32sock.h b/gl/tests/w32sock.h
index 0b8334e..846c342 100644
--- a/gl/tests/w32sock.h
+++ b/gl/tests/w32sock.h
@@ -1,6 +1,6 @@
 /* w32sock.h --- internal auxilliary functions for Windows socket functions
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/tests/zerosize-ptr.h b/gl/tests/zerosize-ptr.h
index beeb3da..9c060e7 100644
--- a/gl/tests/zerosize-ptr.h
+++ b/gl/tests/zerosize-ptr.h
@@ -1,5 +1,5 @@
 /* Return a pointer to a zero-size object in memory.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 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
diff --git a/gl/time.in.h b/gl/time.in.h
index 1fbebf4..5080d45 100644
--- a/gl/time.in.h
+++ b/gl/time.in.h
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/time_r.c b/gl/time_r.c
index 31d010e..dbde157 100644
--- a/gl/time_r.c
+++ b/gl/time_r.c
@@ -1,6 +1,6 @@
 /* Reentrant time functions like localtime_r.
 
-   Copyright (C) 2003, 2006-2007, 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2007, 2010-2012 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
diff --git a/gl/timespec.h b/gl/timespec.h
index acf815c..388ddb8 100644
--- a/gl/timespec.h
+++ b/gl/timespec.h
@@ -1,6 +1,6 @@
 /* timespec -- System time interface
 
-   Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2011 Free Software
+   Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/gl/u64.h b/gl/u64.h
index 182d649..dadd6d7 100644
--- a/gl/u64.h
+++ b/gl/u64.h
@@ -1,6 +1,6 @@
 /* uint64_t-like operations that work even on hosts lacking uint64_t
 
-   Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2012 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
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 77e5675..6aac9c3 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2003-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003-2012 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
@@ -935,6 +935,27 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable 
- "
 #endif
 
 
+#if @GNULIB_ISATTY@
+# if @REPLACE_ISATTY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef isatty
+#   define isatty rpl_isatty
+#  endif
+_GL_FUNCDECL_RPL (isatty, int, (int fd));
+_GL_CXXALIAS_RPL (isatty, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (isatty, int, (int fd));
+# endif
+_GL_CXXALIASWARN (isatty);
+#elif defined GNULIB_POSIXCHECK
+# undef isatty
+# if HAVE_RAW_DECL_ISATTY
+_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
+                 "use gnulib module isatty 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.
@@ -1268,6 +1289,33 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
 #endif
 
 
+#if @GNULIB_SETHOSTNAME@
+/* Set the host name of the machine.
+   The host name may or may not be fully qualified.
+
+   Put LEN bytes of NAME into the host name.
+   Return 0 if successful, otherwise, set errno and return -1.
+
+   Platforms with no ability to set the hostname return -1 and set
+   errno = ENOSYS.  */
+# if address@hidden@ || address@hidden@
+_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
+                                    _GL_ARG_NONNULL ((1)));
+# endif
+/* Need to cast, because on Solaris 11 2011-10, MacOS X 10.5, IRIX 6.5
+   and FreeBSD 6.4 the second parameter is int.  On Solaris 11
+   2011-10, the first parameter is not const.  */
+_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
+_GL_CXXALIASWARN (sethostname);
+#elif defined GNULIB_POSIXCHECK
+# undef sethostname
+# if HAVE_RAW_DECL_SETHOSTNAME
+_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
+                 "use gnulib module sethostname 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.
diff --git a/gl/usleep.c b/gl/usleep.c
new file mode 100644
index 0000000..ea640bf
--- /dev/null
+++ b/gl/usleep.c
@@ -0,0 +1,58 @@
+/* Pausing execution of the current thread.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
+   Written by Eric Blake <address@hidden>, 2009.
+
+   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 <http://www.gnu.org/licenses/>.  */
+
+/* This file is _intentionally_ light-weight.  Rather than using
+   select or nanosleep, both of which drag in external libraries on
+   some platforms, this merely rounds up to the nearest second if
+   usleep() does not exist.  If sub-second resolution is important,
+   then use a more powerful interface to begin with.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+
+#ifndef HAVE_USLEEP
+# define HAVE_USLEEP 0
+#endif
+
+/* Sleep for MICRO microseconds, which can be greater than 1 second.
+   Return -1 and set errno to EINVAL on range error (about 4295
+   seconds), or 0 on success.  Interaction with SIGALARM is
+   unspecified.  */
+
+int
+usleep (useconds_t micro)
+{
+  unsigned int seconds = micro / 1000000;
+  if (sizeof seconds < sizeof micro && micro / 1000000 != seconds)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  if (!HAVE_USLEEP && micro % 1000000)
+    seconds++;
+  while ((seconds = sleep (seconds)) != 0);
+
+#undef usleep
+#if !HAVE_USLEEP
+# define usleep(x) 0
+#endif
+  return usleep (micro % 1000000);
+}
diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c
index 71f8d80..16fca49 100644
--- a/gl/vasnprintf.c
+++ b/gl/vasnprintf.c
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 1999, 2002-2011 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2012 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
@@ -4885,7 +4885,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                    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
+                /* On native Windows 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
@@ -4894,7 +4894,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      - 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
+                   On native Windows systems (such as mingw) where the OS is
                    Windows Vista, the use of %n in format strings by default
                    crashes the program. See
                      <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
diff --git a/gl/vasnprintf.h b/gl/vasnprintf.h
index c9f4c21..fdd5868 100644
--- a/gl/vasnprintf.h
+++ b/gl/vasnprintf.h
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2004, 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004, 2007-2012 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
diff --git a/gl/vasprintf.c b/gl/vasprintf.c
index 3001c26..6d1cd97 100644
--- a/gl/vasprintf.c
+++ b/gl/vasprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006-2012 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
diff --git a/gl/verify.h b/gl/verify.h
index 9a8caad..cef14ad 100644
--- a/gl/verify.h
+++ b/gl/verify.h
@@ -1,6 +1,6 @@
 /* Compile-time assert-like macros.
 
-   Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2012 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
@@ -21,13 +21,11 @@
 # 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 C11.
+   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).
+   Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11.
    This will likely be supported by future GCC versions, in C++ mode.
 
    Use this only with GCC.  If we were willing to slow 'configure'
@@ -188,7 +186,7 @@ template <int w>
    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
+   Unfortunately, unlike C11, this implementation must appear as an
    ordinary declaration, and cannot appear inside struct { ... }.  */
 
 # ifdef _GL_HAVE__STATIC_ASSERT
@@ -205,7 +203,7 @@ template <int w>
 #   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.  */
+#   define static_assert _Static_assert /* C11 requires this #define.  */
 #  endif
 # endif
 
diff --git a/gl/version-etc-fsf.c b/gl/version-etc-fsf.c
index c821583..c452f40 100644
--- a/gl/version-etc-fsf.c
+++ b/gl/version-etc-fsf.c
@@ -1,5 +1,5 @@
 /* Variable with FSF copyright information, for version-etc.
-   Copyright (C) 1999-2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1999-2006, 2009-2012 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
diff --git a/gl/version-etc.c b/gl/version-etc.c
index b8d4724..ae1e44d 100644
--- a/gl/version-etc.c
+++ b/gl/version-etc.c
@@ -1,5 +1,5 @@
 /* Print --version and bug-reporting information in a consistent format.
-   Copyright (C) 1999-2011 Free Software Foundation, Inc.
+   Copyright (C) 1999-2012 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
@@ -38,7 +38,7 @@
 # define PACKAGE PACKAGE_TARNAME
 #endif
 
-enum { COPYRIGHT_YEAR = 2011 };
+enum { COPYRIGHT_YEAR = 2012 };
 
 /* The three functions below display the --version information the
    standard way.
diff --git a/gl/version-etc.h b/gl/version-etc.h
index a9b313d..c62704c 100644
--- a/gl/version-etc.h
+++ b/gl/version-etc.h
@@ -1,5 +1,5 @@
 /* Print --version and bug-reporting information in a consistent format.
-   Copyright (C) 1999, 2003, 2005, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2003, 2005, 2009-2012 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
@@ -22,7 +22,7 @@
 # include <stdarg.h>
 # include <stdio.h>
 
-/* The `sentinel' attribute was added in gcc 4.0.  */
+/* The 'sentinel' attribute was added in gcc 4.0.  */
 #ifndef _GL_ATTRIBUTE_SENTINEL
 # if 4 <= __GNUC__
 #  define _GL_ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
@@ -72,7 +72,7 @@ extern void version_etc (FILE *stream,
                          /* const char *author1, ..., NULL */ ...)
   _GL_ATTRIBUTE_SENTINEL;
 
-/* Display the usual `Report bugs to' stanza */
+/* Display the usual "Report bugs to" stanza.  */
 extern void emit_bug_reporting_address (void);
 
 #endif /* VERSION_ETC_H */
diff --git a/gl/vfprintf.c b/gl/vfprintf.c
index 55486d6..bc1bec9 100644
--- a/gl/vfprintf.c
+++ b/gl/vfprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to a stream.
-   Copyright (C) 2004, 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006-2012 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
diff --git a/gl/vprintf.c b/gl/vprintf.c
index 0388713..075b3d9 100644
--- a/gl/vprintf.c
+++ b/gl/vprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to a stream.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2012 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
diff --git a/gl/vsnprintf.c b/gl/vsnprintf.c
index 3f6f6a8..ac2637e 100644
--- a/gl/vsnprintf.c
+++ b/gl/vsnprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 2004, 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006-2012 Free Software Foundation, Inc.
    Written by Simon Josefsson and Yoann Vandoorselaere <address@hidden>.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/gl/w32sock.h b/gl/w32sock.h
index 0b8334e..846c342 100644
--- a/gl/w32sock.h
+++ b/gl/w32sock.h
@@ -1,6 +1,6 @@
 /* w32sock.h --- internal auxilliary functions for Windows socket functions
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 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
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index 1ed4521..86c97ff 100644
--- a/gl/wchar.in.h
+++ b/gl/wchar.in.h
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
 
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 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
diff --git a/gl/xsize.h b/gl/xsize.h
index 6505c42..4c1e615 100644
--- a/gl/xsize.h
+++ b/gl/xsize.h
@@ -1,6 +1,6 @@
 /* xsize.h -- Checked size_t computations.
 
-   Copyright (C) 2003, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2008-2012 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
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d944c2f..7fd533a 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -20,7 +20,7 @@
 
 ACLOCAL_AMFLAGS = -I ../m4 -I ../gl/m4
 
-SUBDIRS = includes x509 accelerated auth ext algorithms
+SUBDIRS = includes x509 accelerated auth ext algorithms extras
 if ENABLE_MINITASN1
 SUBDIRS += minitasn1
 endif
@@ -114,6 +114,7 @@ libgnutls_la_LDFLAGS = -no-undefined \
 libgnutls_la_LIBADD = ../gl/libgnu.la x509/libgnutls_x509.la \
        accelerated/libaccelerated.la ext/libgnutls_ext.la \
        auth/libgnutls_auth.la algorithms/libgnutls_alg.la \
+       extras/libgnutls_extras.la \
        $(LTLIBZ)  $(LTLIBINTL) $(LIBSOCKET) $(LTLIBDL) \
        $(LTLIBPTHREAD) $(P11_KIT_LIBS)
 
diff --git a/lib/accelerated/x86/Makefile.am b/lib/accelerated/x86/Makefile.am
index 79acf96..d96837c 100644
--- a/lib/accelerated/x86/Makefile.am
+++ b/lib/accelerated/x86/Makefile.am
@@ -20,8 +20,7 @@
 
 AM_LIBTOOLFLAGS=--tag=CC
 AM_CFLAGS = $(WERROR_CFLAGS) $(WSTACK_CFLAGS) $(WARN_CFLAGS)
-AM_CPPFLAGS = \
-       -I$(srcdir)/../../../gl         \
+AM_CPPFLAGS = -I$(srcdir)/../../../gl          \
        -I$(builddir)/../../../gl               \
        -I$(srcdir)/../../includes      \
        -I$(builddir)/../../includes    \
diff --git a/lib/algorithms/ciphers.c b/lib/algorithms/ciphers.c
index 198844f..f8e1469 100644
--- a/lib/algorithms/ciphers.c
+++ b/lib/algorithms/ciphers.c
@@ -43,7 +43,7 @@ typedef struct gnutls_cipher_entry gnutls_cipher_entry;
  * View first: "The order of encryption and authentication for
  * protecting communications" by Hugo Krawczyk - CRYPTO 2001
  *
- * Make sure to updated MAX_CIPHER_BLOCK_SIZE and MAX_CIPHER_KEY_SIZE as well.
+ * Make sure to update MAX_CIPHER_BLOCK_SIZE and MAX_CIPHER_KEY_SIZE as well.
  */
 static const gnutls_cipher_entry algorithms[] = {
   {"AES-256-CBC", GNUTLS_CIPHER_AES_256_CBC, 16, 32, CIPHER_BLOCK, 16, 0, 0},
@@ -203,7 +203,7 @@ gnutls_cipher_get_name (gnutls_cipher_algorithm_t algorithm)
 
 /**
  * gnutls_cipher_get_id:
- * @name: is a MAC algorithm name
+ * @name: is a cipher algorithm name
  *
  * The names are compared in a case insensitive way.
  *
diff --git a/lib/algorithms/protocols.c b/lib/algorithms/protocols.c
index 6d6b04c..e59c8fd 100644
--- a/lib/algorithms/protocols.c
+++ b/lib/algorithms/protocols.c
@@ -162,7 +162,7 @@ gnutls_protocol_get_id (const char *name)
  *
  * Get a list of supported protocols, e.g. SSL 3.0, TLS 1.0 etc.
  *
- * This function is not threat safe.
+ * This function is not thread safe.
  *
  * Returns: a (0)-terminated list of #gnutls_protocol_t integers
  * indicating the available protocols.
diff --git a/lib/algorithms/publickey.c b/lib/algorithms/publickey.c
index 0b25655..e9f9b3e 100644
--- a/lib/algorithms/publickey.c
+++ b/lib/algorithms/publickey.c
@@ -51,7 +51,7 @@ static const gnutls_pk_map pk_mappings[] = {
   {GNUTLS_KX_DHE_RSA, GNUTLS_PK_RSA, CIPHER_SIGN},
   {GNUTLS_KX_SRP_RSA, GNUTLS_PK_RSA, CIPHER_SIGN},
   {GNUTLS_KX_ECDHE_RSA, GNUTLS_PK_RSA, CIPHER_SIGN},
-  {GNUTLS_KX_ECDHE_ECDSA, GNUTLS_PK_ECC, CIPHER_SIGN},
+  {GNUTLS_KX_ECDHE_ECDSA, GNUTLS_PK_EC, CIPHER_SIGN},
   {GNUTLS_KX_DHE_DSS, GNUTLS_PK_DSA, CIPHER_SIGN},
   {GNUTLS_KX_SRP_DSS, GNUTLS_PK_DSA, CIPHER_SIGN},
   {0, 0, 0}
@@ -97,7 +97,7 @@ static const gnutls_pk_entry pk_algorithms[] = {
   {"DSA", PK_DSA_OID, GNUTLS_PK_DSA},
   {"GOST R 34.10-2001", PK_GOST_R3410_2001_OID, GNUTLS_PK_UNKNOWN},
   {"GOST R 34.10-94", PK_GOST_R3410_94_OID, GNUTLS_PK_UNKNOWN},
-  {"ECC", "1.2.840.10045.2.1", GNUTLS_PK_ECC},
+  {"EC", "1.2.840.10045.2.1", GNUTLS_PK_EC},
   {0, 0, 0}
 };
 
diff --git a/lib/algorithms/secparams.c b/lib/algorithms/secparams.c
index ba6c7d5..2584c25 100644
--- a/lib/algorithms/secparams.c
+++ b/lib/algorithms/secparams.c
@@ -82,7 +82,7 @@ gnutls_sec_param_to_pk_bits (gnutls_pk_algorithm_t algo,
       );
       return ret;
     }
-  else if (algo == GNUTLS_PK_ECC)
+  else if (algo == GNUTLS_PK_EC)
     {
       GNUTLS_SEC_PARAM_LOOP (if (p->sec_param == param)
                              {
@@ -127,7 +127,7 @@ _gnutls_pk_bits_to_subgroup_bits (unsigned int pk_bits)
  * Convert a #gnutls_sec_param_t value to a string.
  *
  * Returns: a pointer to a string that contains the name of the
- *   specified public key algorithm, or %NULL.
+ *   specified security level, or %NULL.
  *
  * Since: 2.12.0
  **/
@@ -166,7 +166,7 @@ gnutls_pk_bits_to_sec_param (gnutls_pk_algorithm_t algo, 
unsigned int bits)
   if (bits == 0)
     return GNUTLS_SEC_PARAM_UNKNOWN;
 
-  if (algo == GNUTLS_PK_ECC)
+  if (algo == GNUTLS_PK_EC)
     {
       GNUTLS_SEC_PARAM_LOOP (if (p->ecc_bits > bits)
                          {
diff --git a/lib/algorithms/sign.c b/lib/algorithms/sign.c
index edbca4b..ba98d6b 100644
--- a/lib/algorithms/sign.c
+++ b/lib/algorithms/sign.c
@@ -66,11 +66,11 @@ static const gnutls_sign_entry sign_algorithms[] = {
    GNUTLS_MAC_MD5, {1, 1}},
   {"RSA-MD2", SIG_RSA_MD2_OID, GNUTLS_SIGN_RSA_MD2, GNUTLS_PK_RSA,
    GNUTLS_MAC_MD2, TLS_SIGN_AID_UNKNOWN},
-  {"ECDSA-SHA1", "1.2.840.10045.4.1", GNUTLS_SIGN_ECDSA_SHA1, GNUTLS_PK_ECC, 
GNUTLS_MAC_SHA1, {2, 3}},
-  {"ECDSA-SHA224", "1.2.840.10045.4.3.1", GNUTLS_SIGN_ECDSA_SHA224, 
GNUTLS_PK_ECC, GNUTLS_MAC_SHA224, {3, 3}},
-  {"ECDSA-SHA256", "1.2.840.10045.4.3.2", GNUTLS_SIGN_ECDSA_SHA256, 
GNUTLS_PK_ECC, GNUTLS_MAC_SHA256, {4, 3}},
-  {"ECDSA-SHA384", "1.2.840.10045.4.3.3", GNUTLS_SIGN_ECDSA_SHA384, 
GNUTLS_PK_ECC, GNUTLS_MAC_SHA384, {5, 3}},
-  {"ECDSA-SHA512", "1.2.840.10045.4.3.4", GNUTLS_SIGN_ECDSA_SHA512, 
GNUTLS_PK_ECC, GNUTLS_MAC_SHA512, {6, 3}},
+  {"ECDSA-SHA1", "1.2.840.10045.4.1", GNUTLS_SIGN_ECDSA_SHA1, GNUTLS_PK_EC, 
GNUTLS_MAC_SHA1, {2, 3}},
+  {"ECDSA-SHA224", "1.2.840.10045.4.3.1", GNUTLS_SIGN_ECDSA_SHA224, 
GNUTLS_PK_EC, GNUTLS_MAC_SHA224, {3, 3}},
+  {"ECDSA-SHA256", "1.2.840.10045.4.3.2", GNUTLS_SIGN_ECDSA_SHA256, 
GNUTLS_PK_EC, GNUTLS_MAC_SHA256, {4, 3}},
+  {"ECDSA-SHA384", "1.2.840.10045.4.3.3", GNUTLS_SIGN_ECDSA_SHA384, 
GNUTLS_PK_EC, GNUTLS_MAC_SHA384, {5, 3}},
+  {"ECDSA-SHA512", "1.2.840.10045.4.3.4", GNUTLS_SIGN_ECDSA_SHA512, 
GNUTLS_PK_EC, GNUTLS_MAC_SHA512, {6, 3}},
   {"GOST R 34.10-2001", SIG_GOST_R3410_2001_OID, 0, 0, 0,
    TLS_SIGN_AID_UNKNOWN},
   {"GOST R 34.10-94", SIG_GOST_R3410_94_OID, 0, 0, 0, TLS_SIGN_AID_UNKNOWN},
diff --git a/lib/auth/cert.c b/lib/auth/cert.c
index c60bdf4..38d2c00 100644
--- a/lib/auth/cert.c
+++ b/lib/auth/cert.c
@@ -1401,7 +1401,7 @@ cleanup:
 #endif
 
 int
-_gnutls_proc_cert_server_certificate (gnutls_session_t session,
+_gnutls_proc_certificate (gnutls_session_t session,
                                       opaque * data, size_t data_size)
 {
   int ret;
@@ -1458,7 +1458,7 @@ _gnutls_check_supported_sign_algo (CertificateSigType 
algo)
     case DSA_SIGN:
       return GNUTLS_PK_DSA;
     case ECDSA_SIGN:
-      return GNUTLS_PK_ECC;
+      return GNUTLS_PK_EC;
     }
 
   return -1;
diff --git a/lib/auth/cert.h b/lib/auth/cert.h
index 176d214..7ef0e92 100644
--- a/lib/auth/cert.h
+++ b/lib/auth/cert.h
@@ -128,7 +128,7 @@ int _gnutls_gen_cert_client_cert_vrfy (gnutls_session_t, 
gnutls_buffer_st *);
 int _gnutls_gen_cert_server_cert_req (gnutls_session_t, gnutls_buffer_st *);
 int _gnutls_proc_cert_cert_req (gnutls_session_t, opaque *, size_t);
 int _gnutls_proc_cert_client_cert_vrfy (gnutls_session_t, opaque *, size_t);
-int _gnutls_proc_cert_server_certificate (gnutls_session_t, opaque *, size_t);
+int _gnutls_proc_certificate (gnutls_session_t, opaque *, size_t);
 int _gnutls_get_selected_cert (gnutls_session_t session,
                                gnutls_pcert_st ** apr_cert_list,
                                int *apr_cert_list_length,
@@ -141,8 +141,6 @@ void _gnutls_selected_certs_set (gnutls_session_t session,
                                  gnutls_pcert_st * certs, int ncerts,
                                  gnutls_privkey_t key, int need_free);
 
-#define _gnutls_proc_cert_client_certificate 
_gnutls_proc_cert_server_certificate
-
 gnutls_rsa_params_t _gnutls_certificate_get_rsa_params (gnutls_rsa_params_t
                                                         rsa_params,
                                                         gnutls_params_function
diff --git a/lib/auth/dhe.c b/lib/auth/dhe.c
index 87496af..c21405d 100644
--- a/lib/auth/dhe.c
+++ b/lib/auth/dhe.c
@@ -53,8 +53,8 @@ const mod_auth_st ecdhe_ecdsa_auth_struct = {
   _gnutls_gen_cert_client_cert_vrfy,
   _gnutls_gen_cert_server_cert_req,
 
-  _gnutls_proc_cert_server_certificate,
-  _gnutls_proc_cert_client_certificate,
+  _gnutls_proc_certificate,
+  _gnutls_proc_certificate,
   proc_dhe_server_kx,
   proc_dhe_client_kx,
   _gnutls_proc_cert_client_cert_vrfy,
@@ -70,8 +70,8 @@ const mod_auth_st ecdhe_rsa_auth_struct = {
   _gnutls_gen_cert_client_cert_vrfy,
   _gnutls_gen_cert_server_cert_req,
 
-  _gnutls_proc_cert_server_certificate,
-  _gnutls_proc_cert_client_certificate,
+  _gnutls_proc_certificate,
+  _gnutls_proc_certificate,
   proc_dhe_server_kx,
   proc_dhe_client_kx,
   _gnutls_proc_cert_client_cert_vrfy,
@@ -87,8 +87,8 @@ const mod_auth_st dhe_rsa_auth_struct = {
   _gnutls_gen_cert_client_cert_vrfy,    /* gen client cert vrfy */
   _gnutls_gen_cert_server_cert_req,     /* server cert request */
 
-  _gnutls_proc_cert_server_certificate,
-  _gnutls_proc_cert_client_certificate,
+  _gnutls_proc_certificate,
+  _gnutls_proc_certificate,
   proc_dhe_server_kx,
   proc_dhe_client_kx,
   _gnutls_proc_cert_client_cert_vrfy,   /* proc client cert vrfy */
@@ -104,8 +104,8 @@ const mod_auth_st dhe_dss_auth_struct = {
   _gnutls_gen_cert_client_cert_vrfy,    /* gen client cert vrfy */
   _gnutls_gen_cert_server_cert_req,     /* server cert request */
 
-  _gnutls_proc_cert_server_certificate,
-  _gnutls_proc_cert_client_certificate,
+  _gnutls_proc_certificate,
+  _gnutls_proc_certificate,
   proc_dhe_server_kx,
   proc_dhe_client_kx,
   _gnutls_proc_cert_client_cert_vrfy,   /* proc client cert vrfy */
diff --git a/lib/auth/ecdh_common.c b/lib/auth/ecdh_common.c
index 2ea3d95..f1beda8 100644
--- a/lib/auth/ecdh_common.c
+++ b/lib/auth/ecdh_common.c
@@ -46,27 +46,23 @@ static int calc_ecdh_key( gnutls_session_t session, 
gnutls_datum_t * psk_key)
 gnutls_pk_params_st pub;
 int ret;
 
-  pub.params[0] = session->key->ecdh_params.params[0];
-  pub.params[1] = session->key->ecdh_params.params[1];
-  pub.params[2] = session->key->ecdh_params.params[2];
-  pub.params[3] = session->key->ecdh_params.params[3];
-  pub.params[4] = session->key->ecdh_params.params[4];
-  pub.params[5] = session->key->ecdh_params.params[5];
-  pub.params[6] = session->key->ecdh_x;
-  pub.params[7] = session->key->ecdh_y;
-  pub.params[8] = _gnutls_mpi_new(1);
-  if (pub.params[8] == NULL)
-    return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
-  
-  _gnutls_mpi_set_ui(pub.params[8], 1);
-  
+  memset(&pub,0,sizeof(pub));
+  pub.params[ECC_PRIME] = session->key->ecdh_params.params[ECC_PRIME];
+  pub.params[ECC_ORDER] = session->key->ecdh_params.params[ECC_ORDER];
+  pub.params[ECC_A] = session->key->ecdh_params.params[ECC_A];
+  pub.params[ECC_B] = session->key->ecdh_params.params[ECC_B];
+  pub.params[ECC_GX] = session->key->ecdh_params.params[ECC_GX];
+  pub.params[ECC_GY] = session->key->ecdh_params.params[ECC_GY];
+  pub.params[ECC_X] = session->key->ecdh_x;
+  pub.params[ECC_Y] = session->key->ecdh_y;
+
   if (psk_key == NULL)
-    ret = _gnutls_pk_derive(GNUTLS_PK_ECC, &session->key->key, 
&session->key->ecdh_params, &pub);
+    ret = _gnutls_pk_derive(GNUTLS_PK_EC, &session->key->key, 
&session->key->ecdh_params, &pub);
   else
     {
       gnutls_datum_t tmp_dh_key;
 
-      ret = _gnutls_pk_derive(GNUTLS_PK_ECC, &tmp_dh_key, 
&session->key->ecdh_params, &pub);
+      ret = _gnutls_pk_derive(GNUTLS_PK_EC, &tmp_dh_key, 
&session->key->ecdh_params, &pub);
       if (ret < 0)
         {
           ret = gnutls_assert_val(ret);
@@ -87,8 +83,6 @@ int ret;
   ret = 0;
 
 cleanup:
-  _gnutls_mpi_release(&pub.params[8]);
-  
   /* no longer needed */
   _gnutls_mpi_release (&session->key->ecdh_x);
   _gnutls_mpi_release (&session->key->ecdh_y);
@@ -145,7 +139,7 @@ _gnutls_gen_ecdh_common_client_kx_int (gnutls_session_t 
session,
   int curve = _gnutls_session_ecc_curve_get(session);
 
   /* generate temporal key */
-  ret = _gnutls_pk_generate(GNUTLS_PK_ECC, curve, &session->key->ecdh_params);
+  ret = _gnutls_pk_generate(GNUTLS_PK_EC, curve, &session->key->ecdh_params);
   if (ret < 0)
     return gnutls_assert_val(ret);
 
@@ -231,7 +225,7 @@ int _gnutls_ecdh_common_print_server_kx (gnutls_session_t 
session, gnutls_buffer
     return gnutls_assert_val(ret);
 
   /* generate temporal key */
-  ret = _gnutls_pk_generate(GNUTLS_PK_ECC, curve, &session->key->ecdh_params);
+  ret = _gnutls_pk_generate(GNUTLS_PK_EC, curve, &session->key->ecdh_params);
   if (ret < 0)
     return gnutls_assert_val(ret);
 
diff --git a/lib/auth/rsa.c b/lib/auth/rsa.c
index d07e5e5..0806d03 100644
--- a/lib/auth/rsa.c
+++ b/lib/auth/rsa.c
@@ -54,8 +54,8 @@ const mod_auth_st rsa_auth_struct = {
   _gnutls_gen_cert_client_cert_vrfy,    /* gen client cert vrfy */
   _gnutls_gen_cert_server_cert_req,     /* server cert request */
 
-  _gnutls_proc_cert_server_certificate,
-  _gnutls_proc_cert_client_certificate,
+  _gnutls_proc_certificate,
+  _gnutls_proc_certificate,
   NULL,                         /* proc server kx */
   proc_rsa_client_kx,           /* proc client kx */
   _gnutls_proc_cert_client_cert_vrfy,   /* proc client cert vrfy */
diff --git a/lib/auth/rsa_export.c b/lib/auth/rsa_export.c
index fca2826..4bd9750 100644
--- a/lib/auth/rsa_export.c
+++ b/lib/auth/rsa_export.c
@@ -58,8 +58,8 @@ const mod_auth_st rsa_export_auth_struct = {
   _gnutls_gen_cert_client_cert_vrfy,    /* gen client cert vrfy */
   _gnutls_gen_cert_server_cert_req,     /* server cert request */
 
-  _gnutls_proc_cert_server_certificate,
-  _gnutls_proc_cert_client_certificate,
+  _gnutls_proc_certificate,
+  _gnutls_proc_certificate,
   proc_rsa_export_server_kx,
   proc_rsa_export_client_kx,    /* proc client kx */
   _gnutls_proc_cert_client_cert_vrfy,   /* proc client cert vrfy */
diff --git a/lib/auth/srp_rsa.c b/lib/auth/srp_rsa.c
index 614425b..e3b8785 100644
--- a/lib/auth/srp_rsa.c
+++ b/lib/auth/srp_rsa.c
@@ -52,7 +52,7 @@ const mod_auth_st srp_rsa_auth_struct = {
   NULL,
   NULL,
 
-  _gnutls_proc_cert_server_certificate,
+  _gnutls_proc_certificate,
   NULL,                         /* certificate */
   proc_srp_cert_server_kx,
   _gnutls_proc_srp_client_kx,
@@ -69,7 +69,7 @@ const mod_auth_st srp_dss_auth_struct = {
   NULL,
   NULL,
 
-  _gnutls_proc_cert_server_certificate,
+  _gnutls_proc_certificate,
   NULL,                         /* certificate */
   proc_srp_cert_server_kx,
   _gnutls_proc_srp_client_kx,
diff --git a/lib/openpgp/Makefile.am b/lib/extras/Makefile.am
similarity index 85%
copy from lib/openpgp/Makefile.am
copy to lib/extras/Makefile.am
index 4d06564..eec0581 100644
--- a/lib/openpgp/Makefile.am
+++ b/lib/extras/Makefile.am
@@ -32,9 +32,6 @@ if ENABLE_MINITASN1
 AM_CPPFLAGS += -I$(srcdir)/../minitasn1
 endif
 
-noinst_LTLIBRARIES = libgnutls_openpgp.la
+noinst_LTLIBRARIES = libgnutls_extras.la
 
-COBJECTS = pgp.c pgpverify.c extras.c compat.c privkey.c output.c      \
-       gnutls_openpgp.c
-
-libgnutls_openpgp_la_SOURCES = $(COBJECTS) openpgp_int.h gnutls_openpgp.h
+libgnutls_extras_la_SOURCES = randomart.c randomart.h
diff --git a/lib/extras/randomart.c b/lib/extras/randomart.c
new file mode 100644
index 0000000..70becaf
--- /dev/null
+++ b/lib/extras/randomart.c
@@ -0,0 +1,167 @@
+/* $OpenBSD: key.c,v 1.98 2011/10/18 04:58:26 djm Exp $ */
+/*
+ * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
+ * Copyright (c) 2008 Alexander von Gernler.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <gnutls_int.h>
+#include <gnutls_errors.h>
+#include <randomart.h>
+
+/*
+ * Draw an ASCII-Art representing the fingerprint so human brain can
+ * profit from its built-in pattern recognition ability.
+ * This technique is called "random art" and can be found in some
+ * scientific publications like this original paper:
+ *
+ * "Hash Visualization: a New Technique to improve Real-World Security",
+ * Perrig A. and Song D., 1999, International Workshop on Cryptographic
+ * Techniques and E-Commerce (CrypTEC '99)
+ * sparrow.ece.cmu.edu/~adrian/projects/validation/validation.pdf
+ *
+ * The subject came up in a talk by Dan Kaminsky, too.
+ *
+ * If you see the picture is different, the key is different.
+ * If the picture looks the same, you still know nothing.
+ *
+ * The algorithm used here is a worm crawling over a discrete plane,
+ * leaving a trace (augmenting the field) everywhere it goes.
+ * Movement is taken from dgst_raw 2bit-wise.  Bumping into walls
+ * makes the respective movement vector be ignored for this turn.
+ * Graphs are not unambiguous, because circles in graphs can be
+ * walked in either direction.
+ */
+
+/*
+ * Field sizes for the random art.  Have to be odd, so the starting point
+ * can be in the exact middle of the picture, and FLDBASE should be >=8 .
+ * Else pictures would be too dense, and drawing the frame would
+ * fail, too, because the key type would not fit in anymore.
+ */
+#define        FLDBASE         8
+#define        FLDSIZE_Y       (FLDBASE + 1)
+#define        FLDSIZE_X       (FLDBASE * 2 + 1)
+char *
+_gnutls_key_fingerprint_randomart (uint8_t * dgst_raw, u_int dgst_raw_len,
+                                   const char *key_type, unsigned int key_size,
+                                   const char* prefix)
+{
+  /*
+   * Chars to be used after each other every time the worm
+   * intersects with itself.  Matter of taste.
+   */
+  const char augmentation_string[] = " address@hidden&#/^SE";
+  char *retval, *p;
+  uint8_t field[FLDSIZE_X][FLDSIZE_Y];
+  u_int i, b;
+  int x, y;
+  const size_t len = sizeof(augmentation_string) - 2;
+  int prefix_len = 0;
+  
+  if (prefix)
+    prefix_len = strlen(prefix);
+
+  retval = gnutls_calloc (1, (FLDSIZE_X + 3 + prefix_len) * (FLDSIZE_Y + 2));
+  if (retval == NULL)
+    {
+      gnutls_assert();
+      return NULL;
+    }
+
+  /* initialize field */
+  memset (field, 0, FLDSIZE_X * FLDSIZE_Y * sizeof (char));
+  x = FLDSIZE_X / 2;
+  y = FLDSIZE_Y / 2;
+
+  /* process raw key */
+  for (i = 0; i < dgst_raw_len; i++)
+    {
+      int input;
+      /* each byte conveys four 2-bit move commands */
+      input = dgst_raw[i];
+      for (b = 0; b < 4; b++)
+        {
+          /* evaluate 2 bit, rest is shifted later */
+          x += (input & 0x1) ? 1 : -1;
+          y += (input & 0x2) ? 1 : -1;
+
+          /* assure we are still in bounds */
+          x = MAX (x, 0);
+          y = MAX (y, 0);
+          x = MIN (x, FLDSIZE_X - 1);
+          y = MIN (y, FLDSIZE_Y - 1);
+
+          /* augment the field */
+          if (field[x][y] < len - 2)
+            field[x][y]++;
+          input = input >> 2;
+        }
+    }
+
+  /* mark starting point and end point */
+  field[FLDSIZE_X / 2][FLDSIZE_Y / 2] = len - 1;
+  field[x][y] = len;
+
+  /* fill in retval */
+  if (prefix_len)
+    snprintf (retval, FLDSIZE_X + prefix_len, "%s+--[%4s %4u]", prefix, 
key_type, key_size);
+  else
+    snprintf (retval, FLDSIZE_X, "+--[%4s %4u]", key_type, key_size);
+  p = strchr (retval, '\0');
+
+  /* output upper border */
+  for (i = p - retval - 1; i < FLDSIZE_X + prefix_len; i++)
+    *p++ = '-';
+  *p++ = '+';
+  *p++ = '\n';
+  
+  if (prefix_len)
+    {
+      memcpy(p, prefix, prefix_len);
+      p += prefix_len;
+    }
+
+  /* output content */
+  for (y = 0; y < FLDSIZE_Y; y++)
+    {
+      *p++ = '|';
+      for (x = 0; x < FLDSIZE_X; x++)
+        *p++ = augmentation_string[MIN (field[x][y], len)];
+      *p++ = '|';
+      *p++ = '\n';
+
+      if (prefix_len)
+        {
+          memcpy(p, prefix, prefix_len);
+          p += prefix_len;
+        }
+    }
+
+  /* output lower border */
+  *p++ = '+';
+  for (i = 0; i < FLDSIZE_X; i++)
+    *p++ = '-';
+  *p++ = '+';
+
+  return retval;
+}
diff --git a/lib/extras/randomart.h b/lib/extras/randomart.h
new file mode 100644
index 0000000..07c44c1
--- /dev/null
+++ b/lib/extras/randomart.h
@@ -0,0 +1,4 @@
+char *
+_gnutls_key_fingerprint_randomart (uint8_t * dgst_raw, u_int dgst_raw_len,
+                                   const char *key_type, unsigned int key_size,
+                                   const char* prefix);
diff --git a/lib/gnutls_alert.c b/lib/gnutls_alert.c
index cb269cf..3482185 100644
--- a/lib/gnutls_alert.c
+++ b/lib/gnutls_alert.c
@@ -244,6 +244,7 @@ gnutls_error_to_alert (int err, int *level)
       break;
     case GNUTLS_E_UNEXPECTED_PACKET:
     case GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET:
+    case GNUTLS_E_PREMATURE_TERMINATION:
       ret = GNUTLS_A_UNEXPECTED_MESSAGE;
       _level = GNUTLS_AL_FATAL;
       break;
diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c
index b93d4c4..db91066 100644
--- a/lib/gnutls_buffers.c
+++ b/lib/gnutls_buffers.c
@@ -510,6 +510,10 @@ _gnutls_io_write_buffered (gnutls_session_t session,
 {
   mbuffer_head_st *const send_buffer = &session->internals.record_send_buffer;
 
+  /* to know where the procedure was interrupted.
+   */
+  session->internals.direction = 1;
+
   _mbuffer_enqueue (send_buffer, bufel);
 
   _gnutls_write_log
diff --git a/lib/gnutls_cert.c b/lib/gnutls_cert.c
index 75638b9..66d0a9f 100644
--- a/lib/gnutls_cert.c
+++ b/lib/gnutls_cert.c
@@ -129,7 +129,7 @@ gnutls_certificate_get_issuer 
(gnutls_certificate_credentials_t sc,
  * sending the names of it would just consume bandwidth without providing 
  * information to client.
  *
- * CA names are used by servers to advertize the CAs they support to
+ * CA names are used by servers to advertise the CAs they support to
  * clients.
  **/
 void
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
index c157843..bd8b14a 100644
--- a/lib/gnutls_cipher.c
+++ b/lib/gnutls_cipher.c
@@ -253,7 +253,7 @@ calc_enc_length (gnutls_session_t session, int data_size,
 #define MAX_PREAMBLE_SIZE 16
 
 /* generates the authentication data (data to be hashed only
- * and are not to be send). Returns their size.
+ * and are not to be sent). Returns their size.
  */
 static inline int
 make_preamble (opaque * uint64_data, opaque type, int length,
@@ -560,7 +560,12 @@ ciphertext_to_compressed (gnutls_session_t session,
           }
 
       if (length < 0)
-        length = 0;
+        {
+          /* Setting a proper length to prevent timing differences in
+           * processing of records with invalid encryption.
+           */
+          length = ciphertext->size - tag_size;
+        }
 
       /* Pass the type, version, length and compressed through
        * MAC.
diff --git a/lib/gnutls_db.c b/lib/gnutls_db.c
index 5e07b04..ed91fe7 100644
--- a/lib/gnutls_db.c
+++ b/lib/gnutls_db.c
@@ -76,8 +76,8 @@ gnutls_db_set_remove_function (gnutls_session_t session,
  * @session: is a #gnutls_session_t structure.
  * @store_func: is the function
  *
- * Sets the function that will be used to store data from the resumed
- * sessions database. This function must remove 0 on success.
+ * Sets the function that will be used to store data in the resumed
+ * sessions database. This function must return 0 on success.
  *
  * The first argument to @store_func will be null unless
  * gnutls_db_set_ptr() has been called.
@@ -124,7 +124,7 @@ gnutls_db_get_ptr (gnutls_session_t session)
  * @seconds: is the number of seconds.
  *
  * Set the expiration time for resumed sessions. The default is 3600
- * (one hour) at the time writing this.
+ * (one hour) at the time of this writing.
  **/
 void
 gnutls_db_set_cache_expiration (gnutls_session_t session, int seconds)
@@ -138,7 +138,7 @@ gnutls_db_set_cache_expiration (gnutls_session_t session, 
int seconds)
  * @session_entry: is the session data (not key)
  *
  * Check if database entry has expired.  This function is to be used
- * when you want to clear unnesessary session which occupy space in
+ * when you want to clear unnecessary sessions which occupy space in
  * your backend.
  *
  * Returns: Returns %GNUTLS_E_EXPIRED, if the database entry has
diff --git a/lib/gnutls_dh_primes.c b/lib/gnutls_dh_primes.c
index f4fac9f..bd0b956 100644
--- a/lib/gnutls_dh_primes.c
+++ b/lib/gnutls_dh_primes.c
@@ -155,6 +155,7 @@ gnutls_dh_params_cpy (gnutls_dh_params_t dst, 
gnutls_dh_params_t src)
 
   dst->params[0] = _gnutls_mpi_copy (src->params[0]);
   dst->params[1] = _gnutls_mpi_copy (src->params[1]);
+  dst->q_bits = src->q_bits;
 
   if (dst->params[0] == NULL || dst->params[1] == NULL)
     return GNUTLS_E_MEMORY_ERROR;
diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c
index b978d1d..3b5397a 100644
--- a/lib/gnutls_errors.c
+++ b/lib/gnutls_errors.c
@@ -90,7 +90,7 @@ static const gnutls_error_entry error_algorithms[] = {
   ERROR_ENTRY (N_
                ("An error was encountered at the TLS Finished packet 
calculation."),
                GNUTLS_E_ERROR_IN_FINISHED_PACKET, 1),
-  ERROR_ENTRY (N_("The peer did not send any certificate."),
+  ERROR_ENTRY (N_("No certificate was found."),
                GNUTLS_E_NO_CERTIFICATE_FOUND, 1),
   ERROR_ENTRY (N_("The given DSA key is incompatible with the selected TLS 
protocol."),
                GNUTLS_E_INCOMPAT_DSA_KEY_WITH_TLS_PROTOCOL, 1),
diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c
index 010e614..14fc212 100644
--- a/lib/gnutls_global.c
+++ b/lib/gnutls_global.c
@@ -130,7 +130,7 @@ gnutls_global_set_log_level (int level)
  * @realloc_func: A realloc function
  * @free_func: The function that frees allocated data. Must accept a NULL 
pointer.
  *
- * This is the function were you set the memory allocation functions
+ * This is the function where you set the memory allocation functions
  * gnutls is going to use. By default the libc's allocation functions
  * (malloc(), free()), are used by gnutls, to allocate both sensitive
  * and not sensitive data.  This function is provided to set the
@@ -151,11 +151,6 @@ gnutls_global_set_mem_functions (gnutls_alloc_function 
alloc_func,
   gnutls_realloc = realloc_func;
   gnutls_free = free_func;
 
-  if (is_secure_func != NULL)
-    _gnutls_is_secure_memory = is_secure_func;
-  else
-    _gnutls_is_secure_memory = _gnutls_is_secure_mem_null;
-
   /* if using the libc's default malloc
    * use libc's calloc as well.
    */
@@ -184,7 +179,7 @@ static int _gnutls_init = 0;
  * Note that this function will also initialize the underlying crypto
  * backend, if it has not been initialized before.  
  *
- * This function increment a global counter, so that
+ * This function increments a global counter, so that
  * gnutls_global_deinit() only releases resources when it has been
  * called as many times as gnutls_global_init().  This is useful when
  * GnuTLS is used by more than one library in an application.  This
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
index bf75919..36cf8a7 100644
--- a/lib/gnutls_handshake.c
+++ b/lib/gnutls_handshake.c
@@ -441,6 +441,8 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque 
* data,
   session_id = &data[pos];
   ret = _gnutls_server_restore_session (session, session_id, session_id_len);
   pos += session_id_len;
+  
+  if (session_id_len > 0) session->internals.resumption_requested = 1;
 
   if (ret == 0)
     {                           /* resumed using default TLS resumption! */
@@ -2324,7 +2326,7 @@ cleanup:
  *
  * The non-fatal errors such as %GNUTLS_E_AGAIN and
  * %GNUTLS_E_INTERRUPTED interrupt the handshake procedure, which
- * should be later be resumed.  Call this function again, until it
+ * should be resumed later.  Call this function again, until it
  * returns 0; cf.  gnutls_record_get_direction() and
  * gnutls_error_is_fatal().
  *
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index 0895491..d2119e1 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -683,7 +683,8 @@ typedef struct
   struct gnutls_priority_st priorities;
 
   /* resumed session */
-  unsigned int resumed:1;                /* RESUME_TRUE or FALSE - if we are 
resuming a session */
+  unsigned int resumed:1;  /* RESUME_TRUE or FALSE - if we are resuming a 
session */
+  unsigned int resumption_requested:1; /* non-zero if resumption was requested 
by client */
   security_parameters_st resumed_security_parameters;
 
   /* These buffers are used in the handshake
diff --git a/lib/gnutls_mem.c b/lib/gnutls_mem.c
index e780c3a..c1b6d65 100644
--- a/lib/gnutls_mem.c
+++ b/lib/gnutls_mem.c
@@ -34,15 +34,6 @@ gnutls_realloc_function gnutls_realloc = realloc;
 void *(*gnutls_calloc) (size_t, size_t) = calloc;
 char *(*gnutls_strdup) (const char *) = _gnutls_strdup;
 
-int
-_gnutls_is_secure_mem_null (const void *ign)
-{
-  return 0;
-}
-
-int (*_gnutls_is_secure_memory) (const void *) = _gnutls_is_secure_mem_null;
-
-
 void *
 _gnutls_calloc (size_t nmemb, size_t size)
 {
diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c
index 8ac89a5..79573ed 100644
--- a/lib/gnutls_priority.c
+++ b/lib/gnutls_priority.c
@@ -285,7 +285,7 @@ static const int kx_priority_export[] = {
 
 static const int kx_priority_secure[] = {
   /* The ciphersuites that offer forward secrecy take
-   * precendance
+   * precedence
    */
   GNUTLS_KX_ECDHE_ECDSA,
   GNUTLS_KX_ECDHE_RSA,
@@ -370,7 +370,9 @@ static const int cipher_priority_secure128[] = {
   GNUTLS_CIPHER_AES_128_CBC,
   GNUTLS_CIPHER_CAMELLIA_128_CBC,
   GNUTLS_CIPHER_AES_128_GCM,
-  GNUTLS_CIPHER_3DES_CBC,
+  GNUTLS_CIPHER_AES_256_CBC,
+  GNUTLS_CIPHER_CAMELLIA_256_CBC,
+  GNUTLS_CIPHER_AES_256_GCM,
   0
 };
 
@@ -396,7 +398,7 @@ static const int cipher_priority_export[] = {
 };
 
 static const int comp_priority[] = {
-  /* compression should be explicitely requested to be enabled */
+  /* compression should be explicitly requested to be enabled */
   GNUTLS_COMP_NULL,
   0
 };
@@ -474,6 +476,7 @@ static const int mac_priority_suiteb192[] = {
 };
 
 static const int mac_priority_secure128[] = {
+  GNUTLS_MAC_SHA1,
   GNUTLS_MAC_SHA256,
   GNUTLS_MAC_SHA384,
   GNUTLS_MAC_AEAD,
diff --git a/lib/gnutls_privkey.c b/lib/gnutls_privkey.c
index 3b43eaf..453a210 100644
--- a/lib/gnutls_privkey.c
+++ b/lib/gnutls_privkey.c
@@ -157,7 +157,7 @@ privkey_to_pubkey (gnutls_pk_algorithm_t pk,
         }
 
       break;
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
       pub->params[0] = _gnutls_mpi_copy (priv->params[0]);
       pub->params[1] = _gnutls_mpi_copy (priv->params[1]);
       pub->params[2] = _gnutls_mpi_copy (priv->params[2]);
diff --git a/lib/gnutls_pubkey.c b/lib/gnutls_pubkey.c
index f9d8d2f..0a8a4c4 100644
--- a/lib/gnutls_pubkey.c
+++ b/lib/gnutls_pubkey.c
@@ -71,7 +71,7 @@ int pubkey_to_bits(gnutls_pk_algorithm_t pk, 
gnutls_pk_params_st* params)
         return _gnutls_mpi_get_nbits(params->params[0]);
       case GNUTLS_PK_DSA:
         return _gnutls_mpi_get_nbits(params->params[3]);
-      case GNUTLS_PK_ECC:
+      case GNUTLS_PK_EC:
         return gnutls_ecc_curve_get_size(params->flags)*8;
       default:
         return 0;
@@ -302,7 +302,7 @@ gnutls_pubkey_import_pkcs11 (gnutls_pubkey_t key,
                                           &obj->pubkey[1],
                                           &obj->pubkey[2], &obj->pubkey[3]);
       break;
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
       ret = gnutls_pubkey_import_ecc_x962 (key, &obj->pubkey[0],
                                           &obj->pubkey[1]);
       break;
@@ -731,7 +731,7 @@ gnutls_pubkey_get_pk_ecc_raw (gnutls_pubkey_t key, 
gnutls_ecc_curve_t *curve,
       return GNUTLS_E_INVALID_REQUEST;
     }
 
-  if (key->pk_algorithm != GNUTLS_PK_ECC)
+  if (key->pk_algorithm != GNUTLS_PK_EC)
     {
       gnutls_assert ();
       return GNUTLS_E_INVALID_REQUEST;
@@ -778,7 +778,7 @@ int gnutls_pubkey_get_pk_ecc_x962 (gnutls_pubkey_t key, 
gnutls_datum_t* paramete
 {
   int ret;
 
-  if (key == NULL || key->pk_algorithm != GNUTLS_PK_ECC)
+  if (key == NULL || key->pk_algorithm != GNUTLS_PK_EC)
     return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
 
   ret = _gnutls_x509_write_ecc_pubkey(&key->params, ecpoint);
@@ -1152,7 +1152,7 @@ gnutls_pubkey_import_ecc_raw (gnutls_pubkey_t key,
       goto cleanup;
     }
   key->params.params_nr++;
-  key->pk_algorithm = GNUTLS_PK_ECC;
+  key->pk_algorithm = GNUTLS_PK_EC;
 
   return 0;
 
@@ -1206,7 +1206,7 @@ gnutls_pubkey_import_ecc_x962 (gnutls_pubkey_t key,
       goto cleanup;
     }
   key->params.params_nr+=2;
-  key->pk_algorithm = GNUTLS_PK_ECC;
+  key->pk_algorithm = GNUTLS_PK_EC;
 
   return 0;
 
@@ -1373,13 +1373,13 @@ gnutls_pubkey_verify_data2 (gnutls_pubkey_t pubkey,
 
 /**
  * gnutls_pubkey_verify_hash:
- * @key: Holds the certificate
+ * @key: Holds the public key
  * @flags: should be 0 for now
  * @hash: holds the hash digest to be verified
  * @signature: contains the signature
  *
  * This function will verify the given signed digest, using the
- * parameters from the certificate.
+ * parameters from the public key.
  *
  * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
  *   negative error value (%GNUTLS_E_PK_SIG_VERIFY_FAILED in verification 
failure).
@@ -1407,6 +1407,37 @@ gnutls_pubkey_verify_hash (gnutls_pubkey_t key, unsigned 
int flags,
 }
 
 /**
+ * gnutls_pubkey_encrypt_data:
+ * @key: Holds the public key
+ * @flags: should be 0 for now
+ * @plaintext: The data to be encrypted
+ * @ciphertext: contains the encrypted data
+ *
+ * This function will encrypt the given data, using the public
+ * key.
+ *
+ * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
+ *   negative error value.
+ *
+ * Since: 3.0.0
+ **/
+int
+gnutls_pubkey_encrypt_data (gnutls_pubkey_t key, unsigned int flags,
+                           const gnutls_datum_t * plaintext,
+                           gnutls_datum_t * ciphertext)
+{
+  if (key == NULL || key->pk_algorithm != GNUTLS_PK_RSA)
+    {
+      gnutls_assert ();
+      return GNUTLS_E_INVALID_REQUEST;
+    }
+
+  return _gnutls_pkcs1_rsa_encrypt (ciphertext, plaintext,
+                                    &key->params,
+                                    2);
+}
+
+/**
  * gnutls_pubkey_get_verify_algorithm:
  * @key: Holds the certificate
  * @signature: contains the signature
@@ -1462,7 +1493,7 @@ int hash_algo;
         }
         
     }
-  else if (pubkey->pk_algorithm == GNUTLS_PK_ECC)
+  else if (pubkey->pk_algorithm == GNUTLS_PK_EC)
     {
       if (_gnutls_version_has_selectable_sighash (ver) && sign != 
GNUTLS_SIGN_UNKNOWN)
         {
@@ -1658,7 +1689,7 @@ pubkey_verify_hashed_data (gnutls_pk_algorithm_t pk,
       return 1;
       break;
 
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
     case GNUTLS_PK_DSA:
       if (dsa_verify_hashed_data(hash, signature, pk, issuer_params) != 0)
         {
@@ -1700,7 +1731,7 @@ pubkey_verify_data (gnutls_pk_algorithm_t pk,
       return 1;
       break;
 
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
     case GNUTLS_PK_DSA:
       if (dsa_verify_data(pk, algo, data, signature, issuer_params) != 0)
         {
@@ -1724,7 +1755,7 @@ _gnutls_dsa_q_to_hash (gnutls_pk_algorithm_t algo, const 
gnutls_pk_params_st* pa
   
   if (algo == GNUTLS_PK_DSA)
     bits = _gnutls_mpi_get_nbits (params->params[1]);
-  else if (algo == GNUTLS_PK_ECC)
+  else if (algo == GNUTLS_PK_EC)
     bits = gnutls_ecc_curve_get_size(params->flags)*8;
 
   if (bits <= 160)
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
index db9ef2a..8d73e98 100644
--- a/lib/gnutls_record.c
+++ b/lib/gnutls_record.c
@@ -822,8 +822,11 @@ gnutls_datum_t raw; /* raw headers */
     {
       if (gnutls_error_is_fatal (ret) == 0)
         return ret;
-
-      return gnutls_assert_val(GNUTLS_E_UNEXPECTED_PACKET_LENGTH);
+      
+      if (ret >= 0)
+        ret = GNUTLS_E_UNEXPECTED_PACKET_LENGTH;
+      
+      return gnutls_assert_val(ret);
     }
 
   ret = _mbuffer_linearize (&session->internals.record_recv_buffer);
diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c
index cdd46fe..16db728 100644
--- a/lib/gnutls_sig.c
+++ b/lib/gnutls_sig.c
@@ -136,7 +136,7 @@ _gnutls_handshake_sign_data (gnutls_session_t session, 
gnutls_pcert_st* cert,
         }
       break;
     case GNUTLS_PK_DSA:
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
       _gnutls_hash_deinit (&td_sha, concat);
 
       if (!IS_SHA(hash_algo))
@@ -314,7 +314,7 @@ verify_tls_hash (gnutls_protocol_t ver, gnutls_pcert_st* 
cert,
 
       break;
     case GNUTLS_PK_DSA:
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
 
       vdata.data = &hash_concat->data[sha1pos];
       vdata.size = hash_concat->size - sha1pos;
@@ -705,7 +705,7 @@ _gnutls_handshake_sign_cert_vrfy (gnutls_session_t session,
       dconcat.size = 36;
       break;
     case GNUTLS_PK_DSA:
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
 
       dconcat.data = &concat[16];
       dconcat.size = 20;
@@ -779,7 +779,7 @@ pk_prepare_hash (gnutls_pk_algorithm_t pk,
       _gnutls_free_datum (&old_digest);
       break;
     case GNUTLS_PK_DSA:
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
       break;
     default:
       gnutls_assert ();
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index d1b9561..4f20465 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * Author: Nikos Mavrogiannopoulos
  *
@@ -725,9 +724,9 @@ gnutls_openpgp_send_cert (gnutls_session_t session,
  *
  * If status is non zero, this function will order gnutls not to send
  * the rdnSequence in the certificate request message. That is the
- * server will not advertize it's trusted CAs to the peer. If status
+ * server will not advertise its trusted CAs to the peer. If status
  * is zero then the default behaviour will take effect, which is to
- * advertize the server's trusted CAs.
+ * advertise the server's trusted CAs.
  *
  * This function has no effect in clients, and in authentication
  * methods other than certificate with X.509 certificates.
@@ -1112,6 +1111,28 @@ gnutls_session_is_resumed (gnutls_session_t session)
   return 0;
 }
 
+/**
+ * gnutls_session_resumption_requested:
+ * @session: is a #gnutls_session_t structure.
+ *
+ * Check whether the client has asked for session resumption.
+ * This function is valid only on server side.
+ *
+ * Returns: non zero if session resumption was asked, or a zero if not.
+ **/
+int
+gnutls_session_resumption_requested(gnutls_session_t session)
+{
+  if (session->security_parameters.entity == GNUTLS_CLIENT)
+    {
+      return 0;
+    }
+  else
+    {
+      return session->internals.resumption_requested;
+    }
+}
+
 /*-
  * _gnutls_session_is_export - Used to check whether this session is of export 
grade
  * @session: is a #gnutls_session_t structure.
diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c
index 248c8a0..34b6ad6 100644
--- a/lib/gnutls_ui.c
+++ b/lib/gnutls_ui.c
@@ -22,7 +22,7 @@
  */
 
 /* This file contains certificate authentication functions to be exported in 
the
- * API and did not fit elsewhere.
+ * API which did not fit elsewhere.
  */
 
 #include <gnutls_int.h>
@@ -34,6 +34,40 @@
 #include <gnutls_auth.h>
 #include <gnutls_state.h>
 #include <gnutls_datum.h>
+#include <extras/randomart.h>
+
+/**
+ * gnutls_random_art:
+ * @type: The type of the random art
+ * @key_type: The type of the key (RSA, DSA etc.)
+ * @key_size: The size of the key in bits
+ * @fpr: The fingerprint of the key
+ * @fpr_size: The size of the fingerprint
+ * @art: The returned random art
+ *
+ * This function will convert a given fingerprint to an "artistic"
+ * image. The returned image is allocated using gnutls_malloc()
+ *
+ * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise
+ *   an error code is returned.
+ *
+ **/
+int gnutls_random_art (gnutls_random_art_t type, 
+                       const char* key_type, unsigned int key_size,
+                       void * fpr, size_t fpr_size,
+                       gnutls_datum_t* art)
+{
+  if (type != GNUTLS_RANDOM_ART_OPENSSH)
+    return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
+
+  art->data = _gnutls_key_fingerprint_randomart(fpr, fpr_size, key_type, 
key_size, NULL);
+  if (art->data == NULL)
+    return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
+  
+  art->size = strlen(art->data);
+  
+  return 0;
+}
 
 /* ANON & DHE */
 
@@ -42,7 +76,7 @@
  * @session: is a #gnutls_session_t structure.
  * @bits: is the number of bits
  *
- * This function sets the number of bits, for use in an Diffie-Hellman
+ * This function sets the number of bits, for use in a Diffie-Hellman
  * key exchange.  This is used both in DH ephemeral and DH anonymous
  * cipher suites.  This will set the minimum size of the prime that
  * will be used for the handshake.
@@ -313,7 +347,7 @@ mpi_buf2bits (gnutls_datum_t * mpi_buf)
  * This function will return the bits of the prime used in the last
  * Diffie-Hellman key exchange with the peer.  Should be used for both
  * anonymous and ephemeral Diffie-Hellman.  Note that some ciphers,
- * like RSA and DSA without DHE, does not use a Diffie-Hellman key
+ * like RSA and DSA without DHE, do not use a Diffie-Hellman key
  * exchange, and then this function will return 0.
  *
  * Returns: The Diffie-Hellman bit strength is returned, or 0 if no
diff --git a/lib/includes/gnutls/abstract.h b/lib/includes/gnutls/abstract.h
index 02821de..ce043c1 100644
--- a/lib/includes/gnutls/abstract.h
+++ b/lib/includes/gnutls/abstract.h
@@ -29,6 +29,11 @@
 #include <gnutls/pkcs11.h>
 #include <gnutls/openpgp.h>
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 /* Public key operations */
 
 struct gnutls_pubkey_st;
@@ -121,6 +126,11 @@ gnutls_pubkey_import_ecc_raw (gnutls_pubkey_t key,
                               const gnutls_datum_t * x,
                               const gnutls_datum_t * y);
 
+int
+gnutls_pubkey_encrypt_data (gnutls_pubkey_t key, unsigned int flags,
+                           const gnutls_datum_t * plaintext,
+                           gnutls_datum_t * ciphertext);
+
 int gnutls_x509_crt_set_pubkey (gnutls_x509_crt_t crt, gnutls_pubkey_t key);
 
 int gnutls_x509_crq_set_pubkey (gnutls_x509_crq_t crq, gnutls_pubkey_t key);
@@ -280,4 +290,8 @@ gnutls_certificate_set_key 
(gnutls_certificate_credentials_t res,
                             int pcert_list_size,
                             gnutls_privkey_t key);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/lib/includes/gnutls/compat.h b/lib/includes/gnutls/compat.h
index d18424b..58d55ef 100644
--- a/lib/includes/gnutls/compat.h
+++ b/lib/includes/gnutls/compat.h
@@ -192,7 +192,7 @@ void
    func) _GNUTLS_GCC_ATTR_DEPRECATED;
 
   /* External signing callback.  No longer supported because it
-   * was deprecated by the PKCS #11 API and gnutls_privkey_t. */
+   * was deprecated by the PKCS #11 API or gnutls_privkey_import_ext. */
 typedef int (*gnutls_sign_func) (gnutls_session_t session,
                                  void *userdata,
                                  gnutls_certificate_type_t cert_type,
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index 2906eaa..296ca4a 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -1,5 +1,5 @@
 /* -*- c -*-
- * Copyright (C) 2000-2011 Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * Author: Nikos Mavrogiannopoulos
  *
@@ -562,13 +562,14 @@ extern "C"
     GNUTLS_CRT_PRINT_UNSIGNED_FULL = 2
   } gnutls_certificate_print_formats_t;
 
+#define GNUTLS_PK_ECC GNUTLS_PK_EC
 /**
  * gnutls_pk_algorithm_t:
  * @GNUTLS_PK_UNKNOWN: Unknown public-key algorithm.
  * @GNUTLS_PK_RSA: RSA public-key algorithm.
  * @GNUTLS_PK_DSA: DSA public-key algorithm.
  * @GNUTLS_PK_DH: Diffie-Hellman algorithm. Used to generate parameters.
- * @GNUTLS_PK_ECC: Elliptic curve algorithm. Used to generate parameters.
+ * @GNUTLS_PK_EC: Elliptic curve algorithm. Used to generate parameters.
  *
  * Enumeration of different public-key algorithms.
  */
@@ -578,7 +579,7 @@ extern "C"
     GNUTLS_PK_RSA = 1,
     GNUTLS_PK_DSA = 2,
     GNUTLS_PK_DH = 3,
-    GNUTLS_PK_ECC = 4,
+    GNUTLS_PK_EC = 4,
   } gnutls_pk_algorithm_t;
 
   const char *gnutls_pk_algorithm_get_name (gnutls_pk_algorithm_t algorithm);
@@ -958,6 +959,7 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t 
session);
 /* checks if this session is a resumed one 
  */
   int gnutls_session_is_resumed (gnutls_session_t session);
+  int gnutls_session_resumption_requested (gnutls_session_t session);
 
   typedef int (*gnutls_db_store_func) (void *, gnutls_datum_t key,
                                        gnutls_datum_t data);
@@ -1268,13 +1270,21 @@ gnutls_ecc_curve_t 
gnutls_ecc_curve_get(gnutls_session_t session);
   void gnutls_openpgp_send_cert (gnutls_session_t session,
                                  gnutls_openpgp_crt_status_t status);
 
-/* fingerprint 
- * Actually this function returns the hash of the given data.
+/* This function returns the hash of the given data.
  */
   int gnutls_fingerprint (gnutls_digest_algorithm_t algo,
                           const gnutls_datum_t * data, void *result,
                           size_t * result_size);
 
+  typedef enum gnutls_random_art
+  {
+    GNUTLS_RANDOM_ART_OPENSSH=1,
+  } gnutls_random_art_t;
+
+  int gnutls_random_art (gnutls_random_art_t type, 
+                         const char* key_name, unsigned int key_size,
+                         void * fpr, size_t fpr_size,
+                         gnutls_datum_t* art);
 
 /* SRP 
  */
diff --git a/lib/includes/gnutls/pkcs11.h b/lib/includes/gnutls/pkcs11.h
index 31fa551..14576f2 100644
--- a/lib/includes/gnutls/pkcs11.h
+++ b/lib/includes/gnutls/pkcs11.h
@@ -28,6 +28,11 @@
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 #define GNUTLS_PKCS11_MAX_PIN_LEN 32
 
 /**
@@ -343,4 +348,8 @@ gnutls_pkcs11_privkey_generate (const char* url,
   gnutls_pk_algorithm_t pk, unsigned int bits, 
   const char* label, unsigned int flags);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/lib/includes/gnutls/x509.h b/lib/includes/gnutls/x509.h
index 2ade033..5b20bef 100644
--- a/lib/includes/gnutls/x509.h
+++ b/lib/includes/gnutls/x509.h
@@ -295,6 +295,9 @@ extern "C"
 
   int gnutls_x509_dn_oid_known (const char *oid);
 
+#define GNUTLS_X509_DN_OID_RETURN_OID 1
+  const char* gnutls_x509_dn_oid_name (const char *oid, unsigned int flags);
+
   /* Read extensions by OID. */
   int gnutls_x509_crt_get_extension_oid (gnutls_x509_crt_t cert, int indx,
                                          void *oid, size_t * oid_size);
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index b7be867..09887f5 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -758,6 +758,10 @@ GNUTLS_3_0_0 {
        gnutls_srp_4096_group_prime;
        gnutls_x509_privkey_verify_params;
        gnutls_priority_get_cipher_suite_index;
+       gnutls_random_art;
+       gnutls_pubkey_encrypt_data;
+       gnutls_x509_dn_oid_name;
+       gnutls_session_resumption_requested;
 } GNUTLS_2_12;
 
 GNUTLS_PRIVATE {
diff --git a/lib/nettle/ecc_projective_check_point.c 
b/lib/nettle/ecc_projective_check_point.c
index 42abeea..5649779 100644
--- a/lib/nettle/ecc_projective_check_point.c
+++ b/lib/nettle/ecc_projective_check_point.c
@@ -42,17 +42,17 @@ int ecc_projective_check_point (ecc_point * P, mpz_t b, 
mpz_t modulus)
     if (P == NULL || b == NULL || modulus == NULL)
        return -1;
 
-    if ((err = mp_init_multi (&t1, &t2, &t3, NULL)) != 0)
-      {
-         return err;
-      }
-
     if (mpz_cmp_ui (P->z, 1) != 0)
       {
          gnutls_assert ();
          return -1;
       }
 
+    if ((err = mp_init_multi (&t1, &t2, &t3, NULL)) != 0)
+      {
+         return err;
+      }
+
     /* t1 = Z * Z */
     mpz_mul (t1, P->y, P->y);
     mpz_mod (t1, t1, modulus); /* t1 = y^2 */
@@ -95,12 +95,16 @@ int ecc_projective_check_point (ecc_point * P, mpz_t b, 
mpz_t modulus)
 
     if (mpz_cmp_ui (t1, 0) != 0)
       {
-         return -1;
+         err = -1;
       }
     else
       {
-         return 0;
+         err = 0;
       }
+
+    mp_clear_multi(&t1, &t2, &t3, NULL);
+    
+    return err;
 }
 
 #endif
diff --git a/lib/nettle/ecc_shared_secret.c b/lib/nettle/ecc_shared_secret.c
index 46a0793..4e3ef35 100644
--- a/lib/nettle/ecc_shared_secret.c
+++ b/lib/nettle/ecc_shared_secret.c
@@ -76,8 +76,7 @@ ecc_shared_secret (ecc_key * private_key, ecc_key * 
public_key,
       err = -1;
       goto done;
     }
-  memset (out, 0, x);
-  nettle_mpz_get_str_256(x, out + (x - nettle_mpz_sizeinbase_256_u 
(result->x)), result->x);
+  nettle_mpz_get_str_256(x, out, result->x);
 
   err = 0;
   *outlen = x;
diff --git a/lib/nettle/mpi.c b/lib/nettle/mpi.c
index f1342ec..1f5b293 100644
--- a/lib/nettle/mpi.c
+++ b/lib/nettle/mpi.c
@@ -421,9 +421,6 @@ gen_group (mpz_t * prime, mpz_t * generator, unsigned int 
nbits, unsigned int *q
   unsigned int q_bytes, w_bytes, r_bytes, w_bits;
   int ret;
 
-  mpz_init (*prime);
-  mpz_init (*generator);
-
   /* security level enforcement. 
    * Values for q are selected according to ECRYPT II recommendations.
    */
@@ -454,8 +451,6 @@ gen_group (mpz_t * prime, mpz_t * generator, unsigned int 
nbits, unsigned int *q
       return GNUTLS_E_MEMORY_ERROR;
     }
 
-  mpz_init2 (*prime, nbits);
-  mpz_init (*generator);
   mpz_init (q);
   mpz_init (w);
   mpz_init (r);
@@ -531,7 +526,6 @@ gen_group (mpz_t * prime, mpz_t * generator, unsigned int 
nbits, unsigned int *q
    * c = r^(2w)
    * if c!=1 c is the generator for the subgroup of order q-1
    * 
-   * (here we reuse q as r)
    */
   r_bytes = p_bytes;
 
diff --git a/lib/nettle/pk.c b/lib/nettle/pk.c
index 7e73d51..6228307 100644
--- a/lib/nettle/pk.c
+++ b/lib/nettle/pk.c
@@ -127,7 +127,7 @@ static int _wrap_nettle_pk_derive(gnutls_pk_algorithm_t 
algo, gnutls_datum_t * o
 
   switch (algo)
     {
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
       {
         ecc_key ecc_pub, ecc_priv;
         int curve = priv->flags;
@@ -373,7 +373,7 @@ _wrap_nettle_pk_sign (gnutls_pk_algorithm_t algo,
 
   switch (algo)
     {
-    case GNUTLS_PK_ECC: /* we do ECDSA */
+    case GNUTLS_PK_EC: /* we do ECDSA */
       {
         ecc_key priv;
         struct dsa_signature sig;
@@ -555,7 +555,7 @@ _wrap_nettle_pk_verify (gnutls_pk_algorithm_t algo,
 
   switch (algo)
     {
-    case GNUTLS_PK_ECC: /* ECDSA */
+    case GNUTLS_PK_EC: /* ECDSA */
       {
         ecc_key pub;
         struct dsa_signature sig;
@@ -784,7 +784,7 @@ rsa_fail:
 
         break;
       }
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
       {
         ecc_key key;
         ecc_set_type tls_ecc_set;
@@ -953,7 +953,7 @@ dsa_cleanup:
       }
 
       break;
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
       {
         int curve = params->flags;
         ecc_key ecc_priv;
diff --git a/lib/nettle/rnd.c b/lib/nettle/rnd.c
index 3f611f1..792d65c 100644
--- a/lib/nettle/rnd.c
+++ b/lib/nettle/rnd.c
@@ -116,7 +116,7 @@ do_device_source (int init)
       && (init || ((now - device_last_read) > DEVICE_READ_INTERVAL)))
     {
 
-      /* More than a minute since we last read the device */
+      /* More than 20 minutes since we last read the device */
       uint8_t buf[DEVICE_READ_SIZE_MAX];
 
       if (!CryptGenRandom (device_fd, (DWORD) read_size, buf))
@@ -250,7 +250,7 @@ do_device_source_urandom (int init)
   if ((device_fd > 0)
       && (init || ((now - device_last_read) > DEVICE_READ_INTERVAL)))
     {
-      /* More than a minute since we last read the device */
+      /* More than 20 minutes since we last read the device */
       uint8_t buf[DEVICE_READ_SIZE_MAX];
       uint32_t done;
 
@@ -312,7 +312,7 @@ do_device_source_egd (int init)
       && (init || ((now - device_last_read) > DEVICE_READ_INTERVAL)))
     {
 
-      /* More than a minute since we last read the device */
+      /* More than 20 minutes since we last read the device */
       uint8_t buf[DEVICE_READ_SIZE_MAX];
       uint32_t done;
 
diff --git a/lib/opencdk/Makefile.am b/lib/opencdk/Makefile.am
index fd8ea23..3f31c29 100644
--- a/lib/opencdk/Makefile.am
+++ b/lib/opencdk/Makefile.am
@@ -32,7 +32,7 @@ endif
 
 noinst_LTLIBRARIES = libminiopencdk.la
 
-libminiopencdk_la_SOURCES = armor.c filters.h keydb.h main.c types.h   \
+libminiopencdk_la_SOURCES = armor.c filters.h keydb.h types.h  \
        kbnode.c main.h packet.h sig-check.c hash.c \
        keydb.c pubkey.c stream.c write-packet.c misc.c seskey.c \
        context.h literal.c new-packet.c read-packet.c stream.h opencdk.h
diff --git a/lib/opencdk/armor.c b/lib/opencdk/armor.c
index 9462b2b..8169980 100644
--- a/lib/opencdk/armor.c
+++ b/lib/opencdk/armor.c
@@ -426,35 +426,6 @@ armor_encode (void *data, FILE * in, FILE * out)
   return 0;
 }
 
-
-/**
- * cdk_armor_filter_use:
- * @inp: the stream to check
- *
- * Check if the stream contains armored data.
- **/
-int
-cdk_armor_filter_use (cdk_stream_t inp)
-{
-  int c, check;
-  int zipalgo;
-
-  zipalgo = 0;
-  c = cdk_stream_getc (inp);
-  if (c == EOF)
-    return 0;                   /* EOF, doesn't matter whether armored or not 
*/
-  cdk_stream_seek (inp, 0);
-  check = is_armored (c);
-  if (check)
-    {
-      check = check_armor (inp, &zipalgo);
-      if (zipalgo)
-        _cdk_stream_set_compress_algo (inp, zipalgo);
-    }
-  return check;
-}
-
-
 static int
 search_header (const char *buf, const char **array)
 {
@@ -463,7 +434,6 @@ search_header (const char *buf, const char **array)
 
   if (strlen (buf) < 5 || strncmp (buf, "-----", 5))
     {
-      gnutls_assert ();
       return -1;
     }
   for (i = 0; (s = array[i]); i++)
@@ -517,7 +487,6 @@ armor_decode (void *data, FILE * in, FILE * out)
 
   if (feof (in) || !pgp_data)
     {
-      gnutls_assert ();
       return CDK_Armor_Error;   /* no data found */
     }
 
@@ -616,114 +585,6 @@ armor_decode (void *data, FILE * in, FILE * out)
   return rc;
 }
 
-
-/**
- * cdk_file_armor:
- * @hd: Handle
- * @file: Name of the file to protect.
- * @output: Output filename.
- *
- * Protect a file with ASCII armor.
- **/
-cdk_error_t
-cdk_file_armor (cdk_ctx_t hd, const char *file, const char *output)
-{
-  cdk_stream_t inp, out;
-  cdk_error_t rc;
-
-  rc = _cdk_check_args (hd->opt.overwrite, file, output);
-  if (rc)
-    return rc;
-
-  rc = cdk_stream_open (file, &inp);
-  if (rc)
-    {
-      gnutls_assert ();
-      return rc;
-    }
-
-  rc = cdk_stream_new (output, &out);
-  if (rc)
-    {
-      cdk_stream_close (inp);
-      gnutls_assert ();
-      return rc;
-    }
-
-  cdk_stream_set_armor_flag (out, CDK_ARMOR_MESSAGE);
-  if (hd->opt.compress)
-    rc = cdk_stream_set_compress_flag (out, hd->compress.algo,
-                                       hd->compress.level);
-  if (!rc)
-    rc = cdk_stream_set_literal_flag (out, 0, file);
-  if (!rc)
-    rc = cdk_stream_kick_off (inp, out);
-  if (!rc)
-    rc = _cdk_stream_get_errno (out);
-
-  cdk_stream_close (out);
-  cdk_stream_close (inp);
-  return rc;
-}
-
-
-/**
- * cdk_file_dearmor:
- * @file: Name of the file to unprotect.
- * @output: Output filename.
- *
- * Remove ASCII armor from a file.
- **/
-cdk_error_t
-cdk_file_dearmor (const char *file, const char *output)
-{
-  cdk_stream_t inp, out;
-  cdk_error_t rc;
-  int zipalgo;
-
-  rc = _cdk_check_args (1, file, output);
-  if (rc)
-    {
-      gnutls_assert ();
-      return rc;
-    }
-
-  rc = cdk_stream_open (file, &inp);
-  if (rc)
-    {
-      gnutls_assert ();
-      return rc;
-    }
-
-  rc = cdk_stream_create (output, &out);
-  if (rc)
-    {
-      cdk_stream_close (inp);
-      gnutls_assert ();
-      return rc;
-    }
-
-  if (cdk_armor_filter_use (inp))
-    {
-      rc = cdk_stream_set_literal_flag (inp, 0, NULL);
-      zipalgo = cdk_stream_is_compressed (inp);
-      if (zipalgo)
-        rc = cdk_stream_set_compress_flag (inp, zipalgo, 0);
-      if (!rc)
-        rc = cdk_stream_set_armor_flag (inp, 0);
-      if (!rc)
-        rc = cdk_stream_kick_off (inp, out);
-      if (!rc)
-        rc = _cdk_stream_get_errno (inp);
-    }
-
-  cdk_stream_close (inp);
-  cdk_stream_close (out);
-  gnutls_assert ();
-  return rc;
-}
-
-
 int
 _cdk_filter_armor (void *data, int ctl, FILE * in, FILE * out)
 {
diff --git a/lib/opencdk/kbnode.c b/lib/opencdk/kbnode.c
index 8b91e19..3fc7674 100644
--- a/lib/opencdk/kbnode.c
+++ b/lib/opencdk/kbnode.c
@@ -1,6 +1,5 @@
 /* kbnode.c -  keyblock node utility functions
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008, 2010
- * Free Software Foundation, Inc.
+ * Copyright (C) 1998-2003, 2007-2011 Free Software Foundation, Inc.
  *
  * Author: Timo Schulz
  *
@@ -396,6 +395,7 @@ cdk_kbnode_get_packet (cdk_kbnode_t node)
 /**
  * cdk_kbnode_read_from_mem:
  * @ret_node: the new key node
+ * @armor: whether base64 or not
  * @buf: the buffer which stores the key sequence
  * @buflen: the length of the buffer
  *
@@ -403,6 +403,7 @@ cdk_kbnode_get_packet (cdk_kbnode_t node)
  **/
 cdk_error_t
 cdk_kbnode_read_from_mem (cdk_kbnode_t * ret_node,
+                          int armor,
                           const byte * buf, size_t buflen)
 {
   cdk_stream_t inp;
@@ -418,6 +419,10 @@ cdk_kbnode_read_from_mem (cdk_kbnode_t * ret_node,
   rc = cdk_stream_tmp_from_mem (buf, buflen, &inp);
   if (rc)
     return rc;
+  
+  if (armor)
+    cdk_stream_set_armor_flag (inp, 0);
+
   rc = cdk_keydb_get_keyblock (inp, ret_node);
   if (rc)
     gnutls_assert ();
diff --git a/lib/opencdk/keydb.c b/lib/opencdk/keydb.c
index c47154e..10e46a7 100644
--- a/lib/opencdk/keydb.c
+++ b/lib/opencdk/keydb.c
@@ -279,13 +279,15 @@ keydb_idx_search (cdk_stream_t inp, u32 * keyid, const 
byte * fpr,
 /**
  * cdk_keydb_new_from_mem:
  * @r_hd: The keydb output handle.
+ * @secret: does the stream contain secret key data
+ * @armor: the stream is base64
  * @data: The raw key data.
  * @datlen: The length of the raw data.
  * 
  * Create a new keyring db handle from the contents of a buffer.
  */
 cdk_error_t
-cdk_keydb_new_from_mem (cdk_keydb_hd_t * r_db, int secret,
+cdk_keydb_new_from_mem (cdk_keydb_hd_t * r_db, int secret, int armor,
                         const void *data, size_t datlen)
 {
   cdk_keydb_hd_t db;
@@ -305,7 +307,8 @@ cdk_keydb_new_from_mem (cdk_keydb_hd_t * r_db, int secret,
       gnutls_assert ();
       return rc;
     }
-  if (cdk_armor_filter_use (db->fp))
+
+  if (armor)
     cdk_stream_set_armor_flag (db->fp, 0);
   db->type = CDK_DBTYPE_DATA;
   db->secret = secret;
@@ -313,102 +316,6 @@ cdk_keydb_new_from_mem (cdk_keydb_hd_t * r_db, int secret,
   return 0;
 }
 
-
-/**
- * cdk_keydb_new_from_stream:
- * @r_hd: the output keydb handle
- * @secret: does the stream contain secret key data
- * @in: the input stream to use
- * 
- * This function creates a new keydb handle based on the given
- * stream. The stream is not closed in cdk_keydb_free() and it
- * is up to the caller to close it. No decoding is done.
- */
-cdk_error_t
-cdk_keydb_new_from_stream (cdk_keydb_hd_t * r_hd, int secret, cdk_stream_t in)
-{
-  cdk_keydb_hd_t hd;
-
-  if (!r_hd)
-    {
-      gnutls_assert ();
-      return CDK_Inv_Value;
-    }
-  *r_hd = NULL;
-
-  hd = calloc (1, sizeof *hd);
-  hd->fp = in;
-  hd->fp_ref = 1;
-  hd->type = CDK_DBTYPE_STREAM;
-  hd->secret = secret;
-  *r_hd = hd;
-
-  /* We do not push any filters and thus we expect that the format
-     of the stream has the format the user wanted. */
-
-  return 0;
-}
-
-
-cdk_error_t
-cdk_keydb_new_from_file (cdk_keydb_hd_t * r_hd, int secret, const char *fname)
-{
-  cdk_keydb_hd_t hd;
-
-  if (!r_hd)
-    {
-      gnutls_assert ();
-      return CDK_Inv_Value;
-    }
-  *r_hd = NULL;
-  hd = calloc (1, sizeof *hd);
-  hd->name = cdk_strdup (fname);
-  if (!hd->name)
-    {
-      cdk_free (hd);
-      gnutls_assert ();
-      return CDK_Out_Of_Core;
-    }
-  hd->type = secret ? CDK_DBTYPE_SK_KEYRING : CDK_DBTYPE_PK_KEYRING;
-  hd->secret = secret;
-  *r_hd = hd;
-  return 0;
-}
-
-
-
-/**
- * cdk_keydb_new:
- * @r_hd: handle to store the new keydb object
- * @type: type of the keyring
- * @data: data which depends on the keyring type
- * @count: length of the data
- *
- * Create a new keydb object
- **/
-cdk_error_t
-cdk_keydb_new (cdk_keydb_hd_t * r_hd, int type, void *data, size_t count)
-{
-  switch (type)
-    {
-    case CDK_DBTYPE_PK_KEYRING:
-    case CDK_DBTYPE_SK_KEYRING:
-      return cdk_keydb_new_from_file (r_hd, type == CDK_DBTYPE_SK_KEYRING,
-                                      (const char *) data);
-
-    case CDK_DBTYPE_DATA:
-      return cdk_keydb_new_from_mem (r_hd, 0, data, count);
-
-    case CDK_DBTYPE_STREAM:
-      return cdk_keydb_new_from_stream (r_hd, 0, (cdk_stream_t) data);
-
-    default:
-      gnutls_assert ();
-      return CDK_Inv_Mode;
-    }
-}
-
-
 /**
  * cdk_keydb_free:
  * @hd: the keydb object
@@ -453,7 +360,7 @@ _cdk_keydb_open (cdk_keydb_hd_t hd, cdk_stream_t * ret_kr)
     }
 
   rc = 0;
-  if ((hd->type == CDK_DBTYPE_DATA || hd->type == CDK_DBTYPE_STREAM)
+  if ((hd->type == CDK_DBTYPE_DATA)
       && hd->fp)
     {
       kr = hd->fp;
@@ -466,9 +373,6 @@ _cdk_keydb_open (cdk_keydb_hd_t hd, cdk_stream_t * ret_kr)
 
       if (rc)
         goto leave;
-
-      if (cdk_armor_filter_use (kr))
-        cdk_stream_set_armor_flag (kr, 0);
     }
   else
     {
diff --git a/lib/opencdk/main.c b/lib/opencdk/main.c
deleted file mode 100644
index bb1a163..0000000
--- a/lib/opencdk/main.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/* main.c
- * Copyright (C) 2001, 2002, 2003, 2007, 2008, 2010 Free Software
- * Foundation, Inc.
- *
- * Author: Timo Schulz
- *
- * This file is part of OpenCDK.
- *
- * The OpenCDK library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <errno.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include "opencdk.h"
-#include "main.h"
-#include "packet.h"
-
-
-/* Set a default cipher algorithm and a digest algorithm.
-   Even if AES and SHA-256 are not 'MUST' in the latest
-   OpenPGP draft, AES seems to be a good choice. */
-#define DEFAULT_DIGEST_ALGO GNUTLS_DIG_SHA256
-
-/* Use the passphrase callback in the handle HD or
-   return NULL if there is no valid callback. */
-char *
-_cdk_passphrase_get (cdk_ctx_t hd, const char *prompt)
-{
-  if (!hd || !hd->passphrase_cb)
-    return NULL;
-  return hd->passphrase_cb (hd->passphrase_cb_value, prompt);
-}
-
-
-static void
-handle_set_digest (cdk_ctx_t hd, int digest)
-{
-  if (!hd)
-    return;
-  if (_gnutls_hash_get_algo_len (digest) <= 0)
-    digest = DEFAULT_DIGEST_ALGO;
-  hd->digest_algo = digest;
-}
-
-
-static void
-handle_set_s2k (cdk_ctx_t hd, int mode, int digest)
-{
-  if (!hd)
-    return;
-  if (_gnutls_hash_get_algo_len (digest) <= 0)
-    digest = DEFAULT_DIGEST_ALGO;
-  if (mode != CDK_S2K_SIMPLE &&
-      mode != CDK_S2K_SALTED && mode != CDK_S2K_ITERSALTED)
-    mode = CDK_S2K_ITERSALTED;
-  hd->_s2k.mode = mode;
-  hd->_s2k.digest_algo = digest;
-}
-
-
-static void
-handle_set_compress (cdk_ctx_t hd, int algo, int level)
-{
-  if (!hd)
-    return;
-  if (algo < 0 || algo > 2)
-    algo = 0;
-  hd->compress.algo = algo;
-  if (!algo)
-    hd->opt.compress = 0;
-  else
-    {
-      if (level > 0 && level < 10)
-        hd->compress.level = level;
-      else
-        hd->compress.level = 6;
-    }
-}
-
-
-/**
- * cdk_handle_control:
- * @hd: session handle
- * @action: flag which indicates whether put or get is requested
- * @cmd: command id
- *
- * Perform various control operations for the current session.
- **/
-int
-cdk_handle_control (cdk_ctx_t hd, int action, int cmd, ...)
-{
-  va_list arg_ptr;
-  int set = action == CDK_CTLF_SET, val = 0;
-
-  if (!hd)
-    return -1;
-
-  if (action != CDK_CTLF_SET && action != CDK_CTLF_GET)
-    return -1;
-  va_start (arg_ptr, cmd);
-  switch (cmd)
-    {
-    case CDK_CTL_ARMOR:
-      if (set)
-        hd->opt.armor = va_arg (arg_ptr, int);
-      else
-        val = hd->opt.armor;
-      break;
-
-    case CDK_CTL_DIGEST:
-      if (set)
-        handle_set_digest (hd, va_arg (arg_ptr, int));
-      else
-        val = hd->digest_algo;
-      break;
-
-    case CDK_CTL_OVERWRITE:
-      if (set)
-        hd->opt.overwrite = va_arg (arg_ptr, int);
-      else
-        val = hd->opt.overwrite;
-      break;
-
-    case CDK_CTL_COMPRESS:
-      if (set)
-        {
-          int algo = va_arg (arg_ptr, int);
-          int level = va_arg (arg_ptr, int);
-          handle_set_compress (hd, algo, level);
-        }
-      else
-        val = hd->compress.algo;
-      break;
-
-    case CDK_CTL_S2K:
-      if (set)
-        {
-          int mode = va_arg (arg_ptr, int);
-          int digest = va_arg (arg_ptr, int);
-          handle_set_s2k (hd, mode, digest);
-        }
-      else
-        val = hd->_s2k.mode;
-      break;
-
-    case CDK_CTL_FORCE_DIGEST:
-      if (set)
-        hd->opt.force_digest = va_arg (arg_ptr, int);
-      else
-        val = hd->opt.force_digest;
-      break;
-
-    case CDK_CTL_BLOCKMODE_ON:
-      if (set)
-        hd->opt.blockmode = va_arg (arg_ptr, int);
-      else
-        val = hd->opt.blockmode;
-      break;
-
-    default:
-      val = -1;
-      break;
-    }
-  va_end (arg_ptr);
-  return val;
-}
-
-
-
-/**
- * cdk_handle_new:
- * @r_ctx: context to store the handle
- *
- * create a new session handle.
- **/
-cdk_error_t
-cdk_handle_new (cdk_ctx_t * r_ctx)
-{
-  cdk_ctx_t c;
-
-  if (!r_ctx)
-    return CDK_Inv_Value;
-
-  c = cdk_calloc (1, sizeof *c);
-  if (!c)
-    return CDK_Out_Of_Core;
-
-  /* For S2K use the iterated and salted mode and use the
-     default digest and cipher algorithms. Because the MDC
-     feature will be used, the default cipher should use a 
-     blocksize of 128 bits. */
-  c->_s2k.mode = CDK_S2K_ITERSALTED;
-  c->_s2k.digest_algo = DEFAULT_DIGEST_ALGO;
-
-  c->opt.mdc = 1;
-  c->opt.compress = 1;
-  c->opt.armor = 0;
-  c->opt.textmode = 0;
-
-  c->digest_algo = DEFAULT_DIGEST_ALGO;
-
-  c->compress.algo = CDK_COMPRESS_ZIP;
-  c->compress.level = 6;
-
-  *r_ctx = c;
-  return 0;
-}
-
-
-/**
- * cdk_handle_set_keyring:
- * @hd: session handle
- * @type: public=0 or secret=1 keyring type
- * @kringname: file name of the keyring which shall be used.
- * 
- * Convenient function to set the keyring for the current session.
- */
-cdk_error_t
-cdk_handle_set_keyring (cdk_ctx_t hd, int type, const char *kringname)
-{
-  cdk_keydb_hd_t db;
-  cdk_error_t err;
-
-  err = cdk_keydb_new_from_file (&db, type, kringname);
-  if (err)
-    return err;
-
-  if (!type)
-    hd->db.pub = db;
-  else
-    hd->db.sec = db;
-  hd->db.close_db = 1;
-  return 0;
-}
-
-
-/**
- * cdk_handle_set_keydb:
- * @hd: session handle
- * @db: the database handle
- *
- * set the key database handle.
- * the function automatically detects whether this is a public or
- * secret keyring and the right handle is set.
- **/
-void
-cdk_handle_set_keydb (cdk_ctx_t hd, cdk_keydb_hd_t db)
-{
-  if (!hd)
-    return;
-  if (_cdk_keydb_is_secret (db))
-    hd->db.sec = db;
-  else
-    hd->db.pub = db;
-}
-
-
-/**
- * cdk_handle_get_keydb:
- * @hd: session handle
- * @type: type of the keyring
- *
- * Return the keydb handle from the session handle.
- * The caller should not free these handles.
- **/
-cdk_keydb_hd_t
-cdk_handle_get_keydb (cdk_ctx_t hd, int type)
-{
-  if (!hd)
-    return NULL;
-  if (type == CDK_DBTYPE_PK_KEYRING)
-    return hd->db.pub;
-  else if (type == CDK_DBTYPE_SK_KEYRING)
-    return hd->db.sec;
-  return NULL;
-}
-
-
-/**
- * cdk_handle_set_passphrase_cb:
- * @hd: session handle
- * @cb: callback function
- * @cb_value: the opaque value for the cb function
- *
- * set the passphrase callback.
- **/
-void
-cdk_handle_set_passphrase_cb (cdk_ctx_t hd,
-                              char *(*cb) (void *opa, const char *prompt),
-                              void *cb_value)
-{
-  if (!hd)
-    return;
-  hd->passphrase_cb = cb;
-  hd->passphrase_cb_value = cb_value;
-}
-
-/**
- * cdk_handle_free:
- * @hd: the handle
- *
- * Release the main handle.
- **/
-void
-cdk_handle_free (cdk_ctx_t hd)
-{
-  if (!hd)
-    return;
-
-  /* If cdk_handle_set_keyring() were used, we need to free the key db
-     handles here because the handles are not controlled by the user. */
-  if (hd->db.close_db)
-    {
-      if (hd->db.pub)
-        cdk_keydb_free (hd->db.pub);
-      if (hd->db.sec)
-        cdk_keydb_free (hd->db.sec);
-      hd->db.pub = hd->db.sec = NULL;
-    }
-  cdk_free (hd);
-}
diff --git a/lib/opencdk/opencdk.h b/lib/opencdk/opencdk.h
index 113e64e..335f9a7 100644
--- a/lib/opencdk/opencdk.h
+++ b/lib/opencdk/opencdk.h
@@ -258,7 +258,6 @@ extern "C"
     CDK_DBTYPE_PK_KEYRING = 100,        /* A file with one or more public keys 
*/
     CDK_DBTYPE_SK_KEYRING = 101,        /* A file with one or more secret keys 
*/
     CDK_DBTYPE_DATA = 102,      /* A buffer with at least one public key */
-    CDK_DBTYPE_STREAM = 103     /* A stream is used to read keys from */
   };
 
 
@@ -576,56 +575,6 @@ extern "C"
   };
   typedef struct cdk_packet_s *cdk_packet_t;
 
-/* Session handle routines */
-  cdk_error_t cdk_handle_new (cdk_ctx_t * r_ctx);
-  void cdk_handle_free (cdk_ctx_t c);
-
-/* Set the key database handle for the given session handle.
-   The type of the key db handle (public or secret) decides
-   which session key db handle to use. */
-  void cdk_handle_set_keydb (cdk_ctx_t hd, cdk_keydb_hd_t db);
-
-/* Convenient function to avoid to open a key db first.
-   The user can directly use the file name, the rest is
-   done internally. */
-  cdk_error_t cdk_handle_set_keyring (cdk_ctx_t hd, int type,
-                                      const char *kringname);
-
-/* Return keydb handle stored in the session handle. */
-  cdk_keydb_hd_t cdk_handle_get_keydb (cdk_ctx_t hd, int type);
-  int cdk_handle_control (cdk_ctx_t hd, int action, int cmd, ...);
-
-/* Set a passphrase callback for the given session handle. */
-  void cdk_handle_set_passphrase_cb (cdk_ctx_t hd,
-                                     char *(*cb) (void *opa,
-                                                  const char *prompt),
-                                     void *cb_value);
-
-/* shortcuts for some controls */
-
-/* Enable or disable armor output. */
-#define cdk_handle_set_armor(a, val) \
-  cdk_handle_control ((a), CDK_CTLF_SET, CDK_CTL_ARMOR, (val))
-
-/* Set the compression algorithm and level. 0 means disable compression. */
-#define cdk_handle_set_compress(a, algo, level) \
-  cdk_handle_control ((a), CDK_CTLF_SET, CDK_CTL_COMPRESS, (algo), (level))
-
-/* Activate partial bodies for the output. This is needed if the length
-   of the data is not known in advance or for the use with sockets
-   or pipes. */
-#define cdk_handle_set_blockmode(a, val) \
-  cdk_handle_control ((a), CDK_CTLF_SET, CDK_CTL_BLOCKMODE_ON, (val))
-
-/* Set the digest for the PK signing operation. */
-#define cdk_handle_set_digest(a, val) \
-  cdk_handle_control ((a), CDK_CTLF_SET, CDK_CTL_DIGEST, (val))
-
-/* Set the mode and the digest for the S2K operation. */
-#define cdk_handle_set_s2k(a, val1, val2) \
-  cdk_handle_control ((a), CDK_CTLF_SET, CDK_CTL_S2K, (val1), (val2))
-/* Raw packet routines. */
-
 /* Allocate a new packet or a new packet with the given packet type. */
   cdk_error_t cdk_pkt_new (cdk_packet_t * r_pkt);
   cdk_error_t cdk_pkt_alloc (cdk_packet_t * r_pkt, cdk_packet_type_t pkttype);
@@ -750,11 +699,6 @@ extern "C"
                            const unsigned char *salt);
   void cdk_s2k_free (cdk_s2k_t s2k);
 
-  cdk_error_t cdk_file_armor (cdk_ctx_t hd, const char *file,
-                              const char *output);
-  cdk_error_t cdk_file_dearmor (const char *file, const char *output);
-  int cdk_armor_filter_use (cdk_stream_t inp);
-
 /* Protect the inbuf with ASCII armor of the specified type.
    If @outbuf and @outlen are NULL, the function returns the calculated
    size of the base64 encoded data in @nwritten. */
@@ -833,26 +777,11 @@ extern "C"
    the requested amount of bytes. */
   int cdk_stream_peek (cdk_stream_t inp, unsigned char *buf, size_t buflen);
 
-/* A wrapper around the various new_from_XXX functions. Because
-   the function does not support all combinations, the dedicated
-   functions should be preferred. */
-  cdk_error_t cdk_keydb_new (cdk_keydb_hd_t * r_hd, int type, void *data,
-                             size_t count);
-
 /* Create a new key db handle from a memory buffer. */
   cdk_error_t cdk_keydb_new_from_mem (cdk_keydb_hd_t * r_hd, int secret,
+                                      int armor,
                                       const void *data, size_t datlen);
 
-/* Create a new key db which uses an existing file. */
-  cdk_error_t cdk_keydb_new_from_file (cdk_keydb_hd_t * r_hd, int secret,
-                                       const char *fname);
-
-/* Uses a stream as the key db input. For searching it is important
-   that the seek function is supported on the stream. Furthermore,
-   the stream is not closed in cdk_keydb_free(). The caller must do it. */
-  cdk_error_t cdk_keydb_new_from_stream (cdk_keydb_hd_t * r_hd, int secret,
-                                         cdk_stream_t in);
-
 /* Check that a secret key with the given key ID is available. */
   cdk_error_t cdk_keydb_check_sk (cdk_keydb_hd_t hd, unsigned int *keyid);
 
@@ -921,6 +850,7 @@ extern "C"
 
   cdk_kbnode_t cdk_kbnode_new (cdk_packet_t pkt);
   cdk_error_t cdk_kbnode_read_from_mem (cdk_kbnode_t * ret_node,
+                                        int armor,
                                         const unsigned char *buf,
                                         size_t buflen);
   cdk_error_t cdk_kbnode_write_to_mem (cdk_kbnode_t node,
diff --git a/lib/openpgp/extras.c b/lib/openpgp/extras.c
index 6e1e297..726379f 100644
--- a/lib/openpgp/extras.c
+++ b/lib/openpgp/extras.c
@@ -147,7 +147,7 @@ gnutls_openpgp_keyring_import (gnutls_openpgp_keyring_t 
keyring,
       size_t written = 0;
 
       err = cdk_stream_tmp_from_mem (data->data, data->size, &input);
-      if (!err)
+      if (err == 0)
         err = cdk_stream_set_armor_flag (input, 0);
       if (err)
         {
@@ -183,7 +183,6 @@ gnutls_openpgp_keyring_import (gnutls_openpgp_keyring_t 
keyring,
       while (written < raw_len && err != EOF && err > 0);
 
       raw_len = written;
-
     }
   else
     {                           /* RAW */
@@ -191,7 +190,7 @@ gnutls_openpgp_keyring_import (gnutls_openpgp_keyring_t 
keyring,
       raw_data = data->data;
     }
 
-  err = cdk_keydb_new (&keyring->db, CDK_DBTYPE_DATA, raw_data, raw_len);
+  err = cdk_keydb_new_from_mem (&keyring->db, 0, 0, raw_data, raw_len);
   if (err)
     gnutls_assert ();
 
diff --git a/lib/openpgp/gnutls_openpgp.c b/lib/openpgp/gnutls_openpgp.c
index ae7320a..d344b18 100644
--- a/lib/openpgp/gnutls_openpgp.c
+++ b/lib/openpgp/gnutls_openpgp.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2002-2011 Free Software Foundation, Inc.
  *
  * Author: Timo Schulz, Nikos Mavrogiannopoulos
  *
@@ -45,6 +44,8 @@ _gnutls_map_cdk_rc (int rc)
     {
     case CDK_Success:
       return 0;
+    case CDK_EOF:
+      return GNUTLS_E_PARSING_ERROR;
     case CDK_Too_Short:
       return GNUTLS_E_SHORT_MEMORY_BUFFER;
     case CDK_General_Error:
@@ -499,7 +500,7 @@ gnutls_openpgp_count_key_names (const gnutls_datum_t * cert)
       return 0;
     }
 
-  if (cdk_kbnode_read_from_mem (&knode, cert->data, cert->size))
+  if (cdk_kbnode_read_from_mem (&knode, 0, cert->data, cert->size))
     {
       gnutls_assert ();
       return 0;
diff --git a/lib/openpgp/output.c b/lib/openpgp/output.c
index 2b5f12d..55a2376 100644
--- a/lib/openpgp/output.c
+++ b/lib/openpgp/output.c
@@ -26,6 +26,7 @@
 #include <gnutls_int.h>
 #include <gnutls/openpgp.h>
 #include <gnutls_errors.h>
+#include <extras/randomart.h>
 
 /* I18n of error codes. */
 #include "gettext.h"
@@ -88,6 +89,7 @@ print_key_id (gnutls_buffer_st * str, gnutls_openpgp_crt_t 
cert, int idx)
       _gnutls_buffer_hexprint (str, id, sizeof (id));
       addf (str, "\n");
     }
+
 }
 
 /* idx == -1 indicates main key
@@ -99,6 +101,9 @@ print_key_fingerprint (gnutls_buffer_st * str, 
gnutls_openpgp_crt_t cert)
   char fpr[128];
   size_t fpr_size = sizeof (fpr);
   int err;
+  const char* name;
+  char* p;
+  unsigned int bits;
 
   err = gnutls_openpgp_crt_get_fingerprint (cert, fpr, &fpr_size);
   if (err < 0)
@@ -109,6 +114,24 @@ print_key_fingerprint (gnutls_buffer_st * str, 
gnutls_openpgp_crt_t cert)
       _gnutls_buffer_hexprint (str, fpr, fpr_size);
       addf (str, "\n");
     }
+
+  err = gnutls_openpgp_crt_get_pk_algorithm (cert, &bits);
+  if (err < 0)
+    return;
+    
+  name = gnutls_pk_get_name(err);
+  if (name == NULL)
+    return;
+
+  p = _gnutls_key_fingerprint_randomart(fpr, fpr_size, name, bits, "\t\t");
+  if (p == NULL)
+    return;
+  
+  adds (str, _("\tFingerprint's random art:\n"));
+  adds (str, p);
+  adds (str, "\n");
+
+  gnutls_free(p);
 }
 
 static void
diff --git a/lib/openpgp/pgp.c b/lib/openpgp/pgp.c
index 2510ae9..c74dc8d 100644
--- a/lib/openpgp/pgp.c
+++ b/lib/openpgp/pgp.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
- * Free Software Foundation, Inc.
+ * Copyright (C) 2002-2011 Free Software Foundation, Inc.
  *
  * Author: Timo Schulz, Nikos Mavrogiannopoulos
  *
@@ -89,9 +88,8 @@ gnutls_openpgp_crt_import (gnutls_openpgp_crt_t key,
                            const gnutls_datum_t * data,
                            gnutls_openpgp_crt_fmt_t format)
 {
-  cdk_stream_t inp;
   cdk_packet_t pkt;
-  int rc;
+  int rc, armor;
 
   if (data->data == NULL || data->size == 0)
     {
@@ -99,39 +97,15 @@ gnutls_openpgp_crt_import (gnutls_openpgp_crt_t key,
       return GNUTLS_E_OPENPGP_GETKEY_FAILED;
     }
 
-  if (format == GNUTLS_OPENPGP_FMT_RAW)
-    {
-      rc = cdk_kbnode_read_from_mem (&key->knode, data->data, data->size);
-      if (rc)
-        {
-          rc = _gnutls_map_cdk_rc (rc);
-          gnutls_assert ();
-          return rc;
-        }
-    }
-  else
+  if (format == GNUTLS_OPENPGP_FMT_RAW) armor = 0;
+  else armor = 1;
+
+  rc = cdk_kbnode_read_from_mem (&key->knode, armor, data->data, data->size);
+  if (rc)
     {
-      rc = cdk_stream_tmp_from_mem (data->data, data->size, &inp);
-      if (rc)
-        {
-          rc = _gnutls_map_cdk_rc (rc);
-          gnutls_assert ();
-          return rc;
-        }
-      if (cdk_armor_filter_use (inp))
-        rc = cdk_stream_set_armor_flag (inp, 0);
-      if (!rc)
-        rc = cdk_keydb_get_keyblock (inp, &key->knode);
-      cdk_stream_close (inp);
-      if (rc)
-        {
-          if (rc == CDK_Inv_Packet)
-            rc = GNUTLS_E_OPENPGP_GETKEY_FAILED;
-          else
-            rc = _gnutls_map_cdk_rc (rc);
-          gnutls_assert ();
-          return rc;
-        }
+      rc = _gnutls_map_cdk_rc (rc);
+      gnutls_assert ();
+      return rc;
     }
 
   /* Test if the import was successful. */
diff --git a/lib/openpgp/privkey.c b/lib/openpgp/privkey.c
index 0ee0532..81b0e43 100644
--- a/lib/openpgp/privkey.c
+++ b/lib/openpgp/privkey.c
@@ -169,9 +169,8 @@ gnutls_openpgp_privkey_import (gnutls_openpgp_privkey_t key,
                                gnutls_openpgp_crt_fmt_t format,
                                const char *password, unsigned int flags)
 {
-  cdk_stream_t inp;
   cdk_packet_t pkt;
-  int rc;
+  int rc, armor;
 
   if (data->data == NULL || data->size == 0)
     {
@@ -180,46 +179,15 @@ gnutls_openpgp_privkey_import (gnutls_openpgp_privkey_t 
key,
     }
 
   if (format == GNUTLS_OPENPGP_FMT_RAW)
-    {
-      rc = cdk_kbnode_read_from_mem (&key->knode, data->data, data->size);
-      if (rc != 0)
-        {
-          rc = _gnutls_map_cdk_rc (rc);
-          gnutls_assert ();
-          return rc;
-        }
-    }
-  else
-    {
-      rc = cdk_stream_tmp_from_mem (data->data, data->size, &inp);
-      if (rc != 0)
-        {
-          rc = _gnutls_map_cdk_rc (rc);
-          gnutls_assert ();
-          return rc;
-        }
-
-      if (cdk_armor_filter_use (inp))
-        {
-          rc = cdk_stream_set_armor_flag (inp, 0);
-          if (rc != 0)
-            {
-              rc = _gnutls_map_cdk_rc (rc);
-              cdk_stream_close (inp);
-              gnutls_assert ();
-              return rc;
-            }
-        }
-
-      rc = cdk_keydb_get_keyblock (inp, &key->knode);
-      cdk_stream_close (inp);
+    armor = 0;
+  else armor = 1;
 
-      if (rc != 0)
-        {
-          rc = _gnutls_map_cdk_rc (rc);
-          gnutls_assert ();
-          return rc;
-        }
+  rc = cdk_kbnode_read_from_mem (&key->knode, armor, data->data, data->size);
+  if (rc != 0)
+    {
+       rc = _gnutls_map_cdk_rc (rc);
+       gnutls_assert ();
+       return rc;
     }
 
   /* Test if the import was successful. */
diff --git a/lib/pkcs11_int.h b/lib/pkcs11_int.h
index 2480da7..7d2cbe4 100644
--- a/lib/pkcs11_int.h
+++ b/lib/pkcs11_int.h
@@ -100,7 +100,7 @@ static inline int pk_to_mech(gnutls_pk_algorithm_t pk)
 {
   if (pk == GNUTLS_PK_DSA)
     return CKM_DSA;
-  else if (pk == GNUTLS_PK_ECC)
+  else if (pk == GNUTLS_PK_EC)
     return CKM_ECDSA;
   else 
     return CKM_RSA_PKCS;
@@ -113,7 +113,7 @@ static inline gnutls_pk_algorithm_t 
mech_to_pk(ck_key_type_t m)
   else if (m == CKK_DSA)
     return GNUTLS_PK_DSA;
   else  if (m == CKK_ECDSA)
-    return GNUTLS_PK_ECC;
+    return GNUTLS_PK_EC;
   else return GNUTLS_PK_UNKNOWN;
 }
 
@@ -121,7 +121,7 @@ static inline int pk_to_genmech(gnutls_pk_algorithm_t pk)
 {
   if (pk == GNUTLS_PK_DSA)
     return CKM_DSA_KEY_PAIR_GEN;
-  else if (pk == GNUTLS_PK_ECC)
+  else if (pk == GNUTLS_PK_EC)
     return CKM_ECDSA_KEY_PAIR_GEN;
   else 
     return CKM_RSA_PKCS_KEY_PAIR_GEN;
diff --git a/lib/pkcs11_privkey.c b/lib/pkcs11_privkey.c
index 8210874..a44e87b 100644
--- a/lib/pkcs11_privkey.c
+++ b/lib/pkcs11_privkey.c
@@ -500,7 +500,7 @@ gnutls_pkcs11_privkey_generate (const char* url,
         a[a_val].value_len = sizeof (_bits);
         a_val++;
         break;
-      case GNUTLS_PK_ECC:
+      case GNUTLS_PK_EC:
         p[p_val].type = CKA_SIGN;
         p[p_val].value = (void*)&tval;
         p[p_val].value_len = sizeof (tval);
diff --git a/lib/pkcs11_write.c b/lib/pkcs11_write.c
index 005b92d..b61c356 100644
--- a/lib/pkcs11_write.c
+++ b/lib/pkcs11_write.c
@@ -438,7 +438,7 @@ gnutls_pkcs11_copy_x509_privkey (const char *token_url,
 
         break;
       }
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
       {
         ret = _gnutls_x509_write_ecc_params(&key->params, &p);
         if (ret < 0)
@@ -509,7 +509,7 @@ cleanup:
         gnutls_free (x.data);
         break;
       }
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
       {
         gnutls_free (p.data);
         gnutls_free (x.data);
diff --git a/lib/system.c b/lib/system.c
index 88468d6..e5440fe 100644
--- a/lib/system.c
+++ b/lib/system.c
@@ -185,14 +185,6 @@ gnutls_system_mutex_unlock (void **priv)
   return 0;
 }
 
-int
-_gnutls_atfork (void (*prepare) (void), void (*parent) (void),
-                void (*child) (void))
-{
-  return 0;
-}
-
-
 #endif /* WIN32_LOCKS */
 
 #ifdef HAVE_PTHREAD_LOCKS
@@ -251,13 +243,6 @@ gnutls_system_mutex_unlock (void **priv)
   return 0;
 }
 
-int
-_gnutls_atfork (void (*prepare) (void), void (*parent) (void),
-                void (*child) (void))
-{
-  return pthread_atfork (prepare, parent, child);
-}
-
 #endif /* PTHREAD_LOCKS */
 
 #ifdef HAVE_NO_LOCKS
@@ -286,13 +271,6 @@ gnutls_system_mutex_unlock (void **priv)
   return 0;
 }
 
-int
-_gnutls_atfork (void (*prepare) (void), void (*parent) (void),
-                void (*child) (void))
-{
-  return 0;
-}
-
 #endif /* NO_LOCKS */
 
 gnutls_time_func gnutls_time = time;
diff --git a/lib/system.h b/lib/system.h
index 7029c9c..e3b47b8 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -34,8 +34,6 @@ ssize_t system_read_peek (gnutls_transport_ptr_t ptr, void 
*data,
 #endif
 #endif
 
-int _gnutls_atfork (void (*prepare) (void), void (*parent) (void),
-                    void (*child) (void));
 extern gnutls_time_func gnutls_time;
 
 static inline void millisleep(unsigned int ms)
diff --git a/lib/x509/common.c b/lib/x509/common.c
index 69db11d..0bed0e7 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -171,8 +171,22 @@ _gnutls_x509_oid_data_choice (const char *oid)
   return 0;
 }
 
-const char *
-_gnutls_x509_oid2ldap_string (const char *oid)
+/**
+ * gnutls_x509_dn_oid_name:
+ * @oid: holds an Object Identifier in a null terminated string
+ * @flags: 0 or %GNUTLS_X509_DN_OID_*
+ *
+ * This function will return the name of a known DN OID. If
+ * %GNUTLS_X509_DN_OID_RETURN_OID is specified this function
+ * will return the given OID if no descriptive name has been
+ * found.
+ *
+ * Returns: A null terminated string or NULL otherwise.
+ *
+ * Since: 3.0.0
+ **/
+const char*
+gnutls_x509_dn_oid_name (const char *oid, unsigned int flags)
 {
   int i = 0;
 
@@ -184,7 +198,8 @@ _gnutls_x509_oid2ldap_string (const char *oid)
     }
   while (_oid2str[i].oid != NULL);
 
-  return NULL;
+  if (flags & GNUTLS_X509_DN_OID_RETURN_OID) return oid;
+  else return NULL;
 }
 
 const char *
diff --git a/lib/x509/common.h b/lib/x509/common.h
index 1d6caaf..ec6a6cd 100644
--- a/lib/x509/common.h
+++ b/lib/x509/common.h
@@ -79,8 +79,6 @@ int _gnutls_x509_data2hex (const opaque * data, size_t 
data_size,
 
 const char *_gnutls_x509_oid2asn_string (const char *oid);
 
-const char *_gnutls_x509_oid2ldap_string (const char *OID);
-
 int _gnutls_x509_oid_data_choice (const char *OID);
 int _gnutls_x509_oid_data_printable (const char *OID);
 
diff --git a/lib/x509/crl.c b/lib/x509/crl.c
index d8056d3..895addd 100644
--- a/lib/x509/crl.c
+++ b/lib/x509/crl.c
@@ -168,7 +168,7 @@ cleanup:
  *
  * This function will copy the name of the CRL issuer in the provided
  * buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
- * described in RFC2253. The output string will be ASCII or UTF-8
+ * described in RFC4514. The output string will be ASCII or UTF-8
  * encoded, depending on the certificate data.
  *
  * If buf is %NULL then only the size will be filled.
@@ -204,13 +204,13 @@ gnutls_x509_crl_get_issuer_dn (const gnutls_x509_crl_t 
crl, char *buf,
  *
  * This function will extract the part of the name of the CRL issuer
  * specified by the given OID. The output will be encoded as described
- * in RFC2253. The output string will be ASCII or UTF-8 encoded,
+ * in RFC4514. The output string will be ASCII or UTF-8 encoded,
  * depending on the certificate data.
  *
  * Some helper macros with popular OIDs can be found in gnutls/x509.h
  * If raw flag is (0), this function will only return known OIDs as
- * text. Other OIDs will be DER encoded, as described in RFC2253 -- in
- * hex format with a '\#' prefix.  You can check about known OIDs
+ * text. Other OIDs will be DER encoded, as described in RFC4514 -- in
+ * hex format with a '#' prefix.  You can check about known OIDs
  * using gnutls_x509_dn_oid_known().
  *
  * If buf is null then only the size will be filled.
diff --git a/lib/x509/dn.c b/lib/x509/dn.c
index 1cfe3a0..bf349c9 100644
--- a/lib/x509/dn.c
+++ b/lib/x509/dn.c
@@ -34,23 +34,7 @@
  * Name (you need a parser just to read a name in the X.509 protoocols!!!)
  */
 
-/* Converts the given OID to an ldap acceptable string or
- * a dotted OID.
- */
-static const char *
-oid2ldap_string (const char *oid)
-{
-  const char *ret;
-
-  ret = _gnutls_x509_oid2ldap_string (oid);
-  if (ret)
-    return ret;
-
-  /* else return the OID in dotted format */
-  return oid;
-}
-
-/* Escapes a string following the rules from RFC2253.
+/* Escapes a string following the rules from RFC4514.
  */
 static char *
 str_escape (char *str, char *buffer, unsigned int buffer_size)
@@ -236,7 +220,7 @@ _gnutls_x509_parse_dn (ASN1_TYPE asn1_struct,
                 }
             }
 
-          ldap_desc = oid2ldap_string (oid);
+          ldap_desc = gnutls_x509_dn_oid_name (oid, 
GNUTLS_X509_DN_OID_RETURN_OID);
           printable = _gnutls_x509_oid_data_printable (oid);
 
           /* leading #, hex encoded value and terminating NULL */
@@ -1030,7 +1014,7 @@ gnutls_x509_dn_deinit (gnutls_x509_dn_t dn)
  *
  * This function will return the name of the given RDN sequence.  The
  * name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in
- * RFC2253.
+ * RFC4514.
  *
  * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, or
  * %GNUTLS_E_SHORT_MEMORY_BUFFER is returned and address@hidden is
@@ -1090,7 +1074,7 @@ gnutls_x509_rdn_get (const gnutls_datum_t * idn,
  *
  * This function will return the name of the given Object identifier,
  * of the RDN sequence.  The name will be encoded using the rules
- * from RFC2253.
+ * from RFC4514.
  *
  * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, or
  * %GNUTLS_E_SHORT_MEMORY_BUFFER is returned and address@hidden is
diff --git a/lib/x509/key_decode.c b/lib/x509/key_decode.c
index 8383a94..da44020 100644
--- a/lib/x509/key_decode.c
+++ b/lib/x509/key_decode.c
@@ -253,7 +253,7 @@ int ret;
         ret = _gnutls_x509_read_dsa_pubkey(der, dersize, params);
         if (ret >= 0) params->params_nr = DSA_PUBLIC_PARAMS;
         break;
-      case GNUTLS_PK_ECC:
+      case GNUTLS_PK_EC:
         ret = _gnutls_x509_read_ecc_pubkey(der, dersize, params);
         if (ret >= 0) params->params_nr = ECC_PUBLIC_PARAMS;
         break;
@@ -273,7 +273,7 @@ int _gnutls_x509_read_pubkey_params (gnutls_pk_algorithm_t 
algo, opaque * der, i
         return 0;
       case GNUTLS_PK_DSA:
         return _gnutls_x509_read_dsa_params(der, dersize, params);
-      case GNUTLS_PK_ECC:
+      case GNUTLS_PK_EC:
         return _gnutls_x509_read_ecc_params(der, dersize, params);
       default:
         return gnutls_assert_val(GNUTLS_E_UNIMPLEMENTED_FEATURE);
diff --git a/lib/x509/key_encode.c b/lib/x509/key_encode.c
index 926148a..2b6c838 100644
--- a/lib/x509/key_encode.c
+++ b/lib/x509/key_encode.c
@@ -142,7 +142,7 @@ _gnutls_x509_write_pubkey_params (gnutls_pk_algorithm_t 
algo,
         memcpy(der->data, ASN1_NULL, ASN1_NULL_SIZE);
         der->size = ASN1_NULL_SIZE;
         return 0;
-      case GNUTLS_PK_ECC:
+      case GNUTLS_PK_EC:
         return _gnutls_x509_write_ecc_params(params, der);
       default:
         return gnutls_assert_val(GNUTLS_E_UNIMPLEMENTED_FEATURE);
@@ -160,7 +160,7 @@ _gnutls_x509_write_pubkey (gnutls_pk_algorithm_t algo,
         return _gnutls_x509_write_dsa_pubkey(params, der);
       case GNUTLS_PK_RSA:
         return _gnutls_x509_write_rsa_pubkey(params, der);
-      case GNUTLS_PK_ECC:
+      case GNUTLS_PK_EC:
         return _gnutls_x509_write_ecc_pubkey(params, der);
       default:
         return gnutls_assert_val(GNUTLS_E_UNIMPLEMENTED_FEATURE);
@@ -780,7 +780,7 @@ int _gnutls_asn1_encode_privkey (gnutls_pk_algorithm_t pk, 
ASN1_TYPE * c2, gnutl
         return _gnutls_asn1_encode_rsa(c2, params);
       case GNUTLS_PK_DSA:
         return _gnutls_asn1_encode_dsa(c2, params);
-      case GNUTLS_PK_ECC:
+      case GNUTLS_PK_EC:
         return _gnutls_asn1_encode_ecc(c2, params);
       default:
         return GNUTLS_E_UNIMPLEMENTED_FEATURE;
diff --git a/lib/x509/output.c b/lib/x509/output.c
index b0e8640..ab056de 100644
--- a/lib/x509/output.c
+++ b/lib/x509/output.c
@@ -29,6 +29,7 @@
 #include <x509_int.h>
 #include <gnutls_num.h>
 #include <gnutls_errors.h>
+#include <extras/randomart.h>
 
 /* I18n of error codes. */
 #include "gettext.h"
@@ -965,7 +966,7 @@ print_extensions (gnutls_buffer_st * str, const char 
*prefix, int type,
       else if (strcmp (oid, "1.3.6.1.5.5.7.1.1") == 0)
         {
           addf (str, _("%s\t\tAuthority Information "
-                      "Access Information (%s):\n"), prefix,
+                      "Access (%s):\n"), prefix,
                 critical ? _("critical") : _("not critical"));
 
           if (type == TYPE_CRT)
@@ -1216,7 +1217,7 @@ print_cert (gnutls_buffer_st * str, gnutls_x509_crt_t 
cert, int notsigned)
             }
             break;
 
-          case GNUTLS_PK_ECC:
+          case GNUTLS_PK_EC:
             {
               gnutls_datum_t x, y;
               gnutls_ecc_curve_t curve;
@@ -1348,7 +1349,7 @@ print_fingerprint (gnutls_buffer_st * str, 
gnutls_x509_crt_t cert,
   int err;
   char buffer[MAX_HASH_SIZE];
   size_t size = sizeof (buffer);
-
+  
   err = gnutls_x509_crt_get_fingerprint (cert, algo, buffer, &size);
   if (err < 0)
     {
@@ -1370,6 +1371,9 @@ print_keyid (gnutls_buffer_st * str, gnutls_x509_crt_t 
cert)
   int err;
   char buffer[32];
   size_t size = sizeof(buffer);
+  const char* name;
+  char* p;
+  unsigned int bits;
 
   err = gnutls_x509_crt_get_key_id (cert, 0, buffer, &size);
   if (err < 0)
@@ -1381,6 +1385,24 @@ print_keyid (gnutls_buffer_st * str, gnutls_x509_crt_t 
cert)
   adds (str, _("\tPublic Key Id:\n\t\t"));
   _gnutls_buffer_hexprint (str, buffer, size);
   adds (str, "\n");
+
+  err = gnutls_x509_crt_get_pk_algorithm (cert, &bits);
+  if (err < 0)
+    return;
+    
+  name = gnutls_pk_get_name(err);
+  if (name == NULL)
+    return;
+
+  p = _gnutls_key_fingerprint_randomart(buffer, size, name, bits, "\t\t");
+  if (p == NULL)
+    return;
+  
+  adds (str, _("\tPublic key's random art:\n"));
+  adds (str, p);
+  adds (str, "\n");
+
+  gnutls_free(p);
 }
 
 static void
@@ -1388,7 +1410,6 @@ print_other (gnutls_buffer_st * str, gnutls_x509_crt_t 
cert, int notsigned)
 {
   if (!notsigned)
     {
-      print_fingerprint (str, cert, GNUTLS_DIG_MD5);
       print_fingerprint (str, cert, GNUTLS_DIG_SHA1);
     }
   print_keyid (str, cert);
diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c
index 8e42dd4..d320aa8 100644
--- a/lib/x509/privkey.c
+++ b/lib/x509/privkey.c
@@ -360,7 +360,6 @@ decode_dsa_key (const gnutls_datum_t * raw_key, 
gnutls_x509_privkey_t pkey)
       gnutls_assert ();
       goto error;
     }
-  pkey->params.params_nr++;
 
   if ((result = _gnutls_x509_read_int (dsa_asn, "p", &pkey->params.params[0])) 
< 0)
     {
@@ -477,7 +476,7 @@ gnutls_x509_privkey_import (gnutls_x509_privkey_t key,
                 _gnutls_fbase64_decode (PEM_KEY_ECC, data->data, data->size,
                                     &out);
               if (result >= 0)
-                key->pk_algorithm = GNUTLS_PK_ECC;
+                key->pk_algorithm = GNUTLS_PK_EC;
              }
         }
 
@@ -505,7 +504,7 @@ gnutls_x509_privkey_import (gnutls_x509_privkey_t key,
       if (key->key == NULL)
         gnutls_assert ();
     }
-  else if (key->pk_algorithm == GNUTLS_PK_ECC)
+  else if (key->pk_algorithm == GNUTLS_PK_EC)
     {
       key->key = _gnutls_privkey_decode_ecc_key (&_data, key);
       if (key->key == NULL)
@@ -884,7 +883,7 @@ gnutls_x509_privkey_import_ecc_raw (gnutls_x509_privkey_t 
key,
     }
   key->params.params_nr++;
 
-  key->pk_algorithm = GNUTLS_PK_ECC;
+  key->pk_algorithm = GNUTLS_PK_EC;
 
   return 0;
 
@@ -956,7 +955,7 @@ gnutls_x509_privkey_export (gnutls_x509_privkey_t key,
     msg = PEM_KEY_RSA;
   else if (key->pk_algorithm == GNUTLS_PK_DSA)
     msg = PEM_KEY_DSA;
-  else if (key->pk_algorithm == GNUTLS_PK_ECC)
+  else if (key->pk_algorithm == GNUTLS_PK_EC)
     msg = PEM_KEY_ECC;
   else
     msg = "UNKNOWN";
@@ -1336,7 +1335,7 @@ gnutls_x509_privkey_generate (gnutls_x509_privkey_t key,
 
   gnutls_pk_params_init(&key->params);
   
-  if (algo == GNUTLS_PK_ECC)
+  if (algo == GNUTLS_PK_EC)
     bits = _gnutls_ecc_bits_to_curve(bits);
 
   ret = _gnutls_pk_generate (algo, bits, &key->params);
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c
index 4421c73..065e552 100644
--- a/lib/x509/privkey_pkcs8.c
+++ b/lib/x509/privkey_pkcs8.c
@@ -140,7 +140,7 @@ _encode_privkey (gnutls_x509_privkey_t pkey, gnutls_datum_t 
* raw)
   switch (pkey->pk_algorithm)
     {
     case GNUTLS_PK_RSA:
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
       ret =
         gnutls_x509_privkey_export (pkey, GNUTLS_X509_FMT_DER, NULL, &size);
       if (ret != GNUTLS_E_SHORT_MEMORY_BUFFER)
@@ -1132,7 +1132,7 @@ decode_private_key_info (const gnutls_datum_t * der,
     result = _decode_pkcs8_rsa_key (pkcs8_asn, pkey);
   else if (pkey->pk_algorithm == GNUTLS_PK_DSA)
     result = _decode_pkcs8_dsa_key (pkcs8_asn, pkey);
-  else if (pkey->pk_algorithm == GNUTLS_PK_ECC)
+  else if (pkey->pk_algorithm == GNUTLS_PK_EC)
     result = _decode_pkcs8_ecc_key (pkcs8_asn, pkey);
   else return gnutls_assert_val(GNUTLS_E_UNIMPLEMENTED_FEATURE);
 
diff --git a/lib/x509/verify.c b/lib/x509/verify.c
index ff67ea9..90d3c28 100644
--- a/lib/x509/verify.c
+++ b/lib/x509/verify.c
@@ -691,7 +691,7 @@ _gnutls_x509_verify_algorithm (gnutls_mac_algorithm_t * 
hash,
   switch (pk)
     {
     case GNUTLS_PK_DSA:
-    case GNUTLS_PK_ECC:
+    case GNUTLS_PK_EC:
 
       if (hash)
         *hash = _gnutls_dsa_q_to_hash (pk, issuer_params, NULL);
diff --git a/lib/x509/x509.c b/lib/x509/x509.c
index f186a6f..0d61c1a 100644
--- a/lib/x509/x509.c
+++ b/lib/x509/x509.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
- * Software Foundation, Inc.
+ * Copyright (C) 2003-2012 Free Software Foundation, Inc.
  * Author: Nikos Mavrogiannopoulos, Simon Josefsson, Howard Chu
  *
  * This file is part of GnuTLS.
@@ -255,12 +254,10 @@ cleanup:
  *
  * This function will copy the name of the Certificate issuer in the
  * provided buffer. The name will be in the form
- * "C=xxxx,O=yyyy,CN=zzzz" as described in RFC2253. The output string
+ * "C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. The output string
  * will be ASCII or UTF-8 encoded, depending on the certificate data.
  *
- * If @buf is null then only the size will be filled. If the @raw_flag
- * is not specified the output is always null terminated, although the
- * @buf_size will not include the null character.
+ * If @buf is null then only the size will be filled. 
  *
  * Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not
  * long enough, and in that case the @buf_size will be updated with
@@ -292,13 +289,13 @@ gnutls_x509_crt_get_issuer_dn (gnutls_x509_crt_t cert, 
char *buf,
  *
  * This function will extract the part of the name of the Certificate
  * issuer specified by the given OID. The output, if the raw flag is not
- * used, will be encoded as described in RFC2253. Thus a string that is
+ * used, will be encoded as described in RFC4514. Thus a string that is
  * ASCII or UTF-8 encoded, depending on the certificate data.
  *
  * Some helper macros with popular OIDs can be found in gnutls/x509.h
  * If raw flag is (0), this function will only return known OIDs as
- * text. Other OIDs will be DER encoded, as described in RFC2253 --
- * in hex format with a '\#' prefix.  You can check about known OIDs
+ * text. Other OIDs will be DER encoded, as described in RFC4514 --
+ * in hex format with a '#' prefix.  You can check about known OIDs
  * using gnutls_x509_dn_oid_known().
  *
  * If @buf is null then only the size will be filled. If the @raw_flag
@@ -336,9 +333,9 @@ gnutls_x509_crt_get_issuer_dn_by_oid (gnutls_x509_crt_t 
cert,
  * This function will extract the OIDs of the name of the Certificate
  * issuer specified by the given index.
  *
- * If @oid is null then only the size will be filled. If the @raw_flag
- * is not specified the output is always null terminated, although the
- * @oid_size will not include the null character.
+ * If @oid is null then only the size will be filled. The @oid
+ * returned will be null terminated, although @oid_size will not
+ * account for the trailing null.
  *
  * Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not
  *   long enough, and in that case the @oid_size will be updated
@@ -367,12 +364,10 @@ gnutls_x509_crt_get_issuer_dn_oid (gnutls_x509_crt_t cert,
  *
  * This function will copy the name of the Certificate in the provided
  * buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
- * described in RFC2253. The output string will be ASCII or UTF-8
+ * described in RFC4514. The output string will be ASCII or UTF-8
  * encoded, depending on the certificate data.
  *
- * If @buf is null then only the size will be filled. If the @raw_flag
- * is not specified the output is always null terminated, although the
- * @buf_size will not include the null character.
+ * If @buf is null then only the size will be filled. 
  *
  * Returns: %GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not
  *   long enough, and in that case the @buf_size will be updated
@@ -404,13 +399,13 @@ gnutls_x509_crt_get_dn (gnutls_x509_crt_t cert, char *buf,
  *
  * This function will extract the part of the name of the Certificate
  * subject specified by the given OID. The output, if the raw flag is
- * not used, will be encoded as described in RFC2253. Thus a string
+ * not used, will be encoded as described in RFC4514. Thus a string
  * that is ASCII or UTF-8 encoded, depending on the certificate data.
  *
  * Some helper macros with popular OIDs can be found in gnutls/x509.h
  * If raw flag is (0), this function will only return known OIDs as
- * text. Other OIDs will be DER encoded, as described in RFC2253 --
- * in hex format with a '\#' prefix.  You can check about known OIDs
+ * text. Other OIDs will be DER encoded, as described in RFC4514 --
+ * in hex format with a '#' prefix.  You can check about known OIDs
  * using gnutls_x509_dn_oid_known().
  *
  * If @buf is null then only the size will be filled. If the @raw_flag
@@ -447,9 +442,9 @@ gnutls_x509_crt_get_dn_by_oid (gnutls_x509_crt_t cert, 
const char *oid,
  * This function will extract the OIDs of the name of the Certificate
  * subject specified by the given index.
  *
- * If @oid is null then only the size will be filled. If the @raw_flag
- * is not specified the output is always null terminated, although the
- * @oid_size will not include the null character.
+ * If @oid is null then only the size will be filled. The @oid
+ * returned will be null terminated, although @oid_size will not
+ * account for the trailing null.
  *
  * Returns: %GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is
  *   not long enough, and in that case the @oid_size will be updated
@@ -1336,9 +1331,9 @@ gnutls_x509_crt_get_issuer_alt_name2 (gnutls_x509_crt_t 
cert,
  * gnutls_x509_crt_get_subject_alt_name() returned
  * %GNUTLS_SAN_OTHERNAME.
  *
- * If @oid is null then only the size will be filled. If the @raw_flag
- * is not specified the output is always null terminated, although the
- * @oid_size will not include the null character.
+ * If @oid is null then only the size will be filled. The @oid
+ * returned will be null terminated, although @oid_size will not
+ * account for the trailing null.
  *
  * Returns: the alternative subject name type on success, one of the
  * enumerated gnutls_x509_subject_alt_name_t.  For supported OIDs, it
@@ -1370,9 +1365,9 @@ gnutls_x509_crt_get_subject_alt_othername_oid 
(gnutls_x509_crt_t cert,
  * Alternative Name, contained in the given certificate, and return
  * the type as an enumerated element.
  *
- * If @oid is null then only the size will be filled. If the @raw_flag
- * is not specified the output is always null terminated, although the
- * @oid_size will not include the null character.
+ * If @oid is null then only the size will be filled. The @oid
+ * returned will be null terminated, although @oid_size will not
+ * account for the trailing null.
  *
  * This function is only useful if
  * gnutls_x509_crt_get_issuer_alt_name() returned
@@ -1690,6 +1685,9 @@ gnutls_x509_crt_get_extension_by_oid (gnutls_x509_crt_t 
cert,
  * This function will return the requested extension OID in the certificate.
  * The extension OID will be stored as a string in the provided buffer.
  *
+ * The @oid returned will be null terminated, although @oid_size will not
+ * account for the trailing null.
+ *
  * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned,
  *   otherwise a negative error code is returned.  If you have reached the
  *   last extension available %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE
@@ -1732,8 +1730,9 @@ gnutls_x509_crt_get_extension_oid (gnutls_x509_crt_t 
cert, int indx,
  * gnutls_x509_crt_get_extension_data() to extract the data.
  *
  * If the buffer provided is not long enough to hold the output, then
- * address@hidden is updated and %GNUTLS_E_SHORT_MEMORY_BUFFER will be
- * returned.
+ * @oid_size is updated and %GNUTLS_E_SHORT_MEMORY_BUFFER will be
+ * returned. The @oid returned will be null terminated, although 
+ * @oid_size will not account for the trailing null.
  *
  * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned,
  *   otherwise a negative error code is returned.  If you have reached the
@@ -2719,9 +2718,9 @@ gnutls_x509_crt_get_crl_dist_points (gnutls_x509_crt_t 
cert,
  * Usage extension (2.5.29.37) See the GNUTLS_KP_* definitions for
  * human readable names.
  *
- * If @oid is null then only the size will be filled. If the @raw_flag
- * is not specified the output is always null terminated, although the
- * @oid_size will not include the null character.
+ * If @oid is null then only the size will be filled. The @oid
+ * returned will be null terminated, although @oid_size will not
+ * account for the trailing null.
  *
  * Returns: %GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is
  *   not long enough, and in that case the *oid_size will be updated
diff --git a/m4/hooks.m4 b/m4/hooks.m4
index ec32861..5d66b7c 100644
--- a/m4/hooks.m4
+++ b/m4/hooks.m4
@@ -40,9 +40,9 @@ AC_DEFUN([LIBGNUTLS_HOOKS],
   # Interfaces changed/added/removed:   CURRENT++       REVISION=0
   # Interfaces added:                             AGE++
   # Interfaces removed:                           AGE=0
-  AC_SUBST(LT_CURRENT, 32)
-  AC_SUBST(LT_REVISION, 0)
-  AC_SUBST(LT_AGE, 4)
+  AC_SUBST(LT_CURRENT, 33)
+  AC_SUBST(LT_REVISION, 1)
+  AC_SUBST(LT_AGE, 5)
 
   AC_SUBST(LT_SSL_CURRENT, 27)
   AC_SUBST(LT_SSL_REVISION, 1)
diff --git a/maint.mk b/maint.mk
index d2f5830..3e16b50 100644
--- a/maint.mk
+++ b/maint.mk
@@ -2,7 +2,7 @@
 # This Makefile fragment tries to be general-purpose enough to be
 # used by many projects via the gnulib maintainer-makefile module.
 
-## Copyright (C) 2001-2011 Free Software Foundation, Inc.
+## Copyright (C) 2001-2012 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
@@ -126,7 +126,7 @@ export LC_ALL = C
 
 _cfg_mk := $(shell test -f $(srcdir)/cfg.mk && echo '$(srcdir)/cfg.mk')
 
-# Collect the names of rules starting with `sc_'.
+# Collect the names of rules starting with 'sc_'.
 syntax-check-rules := $(sort $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' 
\
                        $(srcdir)/$(ME) $(_cfg_mk)))
 .PHONY: $(syntax-check-rules)
@@ -221,15 +221,6 @@ define _sc_say_and_exit
    { printf '%s\n' "$(ME): $$msg" 1>&2; exit 1; };
 endef
 
-# _sc_search_regexp used to be named _prohibit_regexp.  However,
-# upgrading to the new definition and leaving the old name undefined
-# would usually convert each custom rule using $(_prohibit_regexp)
-# (usually defined in cfg.mk) into a no-op.  This definition ensures
-# that people know right away if they're still using the old name.
-# FIXME: remove in 2012.
-_prohibit_regexp = \
-  $(error '*** you need to s/_prohibit_regexp/_sc_search_regexp/, and adapt')
-
 define _sc_search_regexp
    dummy=; : so we do not need a semicolon before each use;            \
                                                                        \
@@ -303,7 +294,7 @@ sc_space_tab:
        halt='found SPACE-TAB sequence; remove the SPACE'               \
          $(_sc_search_regexp)
 
-# Don't use *scanf or the old ato* functions in `real' code.
+# Don't use *scanf or the old ato* functions in "real" code.
 # They provide no error checking mechanism.
 # Instead, use strto* functions.
 sc_prohibit_atoi_atof:
@@ -335,15 +326,15 @@ sc_prohibit_magic_number_exit:
          $(_sc_search_regexp)
 
 # Using EXIT_SUCCESS as the first argument to error is misleading,
-# since when that parameter is 0, error does not exit.  Use `0' instead.
+# since when that parameter is 0, error does not exit.  Use '0' instead.
 sc_error_exit_success:
        @prohibit='error *\(EXIT_SUCCESS,'                              \
        in_vc_files='\.[chly]$$'                                        \
        halt='found error (EXIT_SUCCESS'                                \
         $(_sc_search_regexp)
 
-# `FATAL:' should be fully upper-cased in error messages
-# `WARNING:' should be fully upper-cased, or fully lower-cased
+# "FATAL:" should be fully upper-cased in error messages
+# "WARNING:" should be fully upper-cased, or fully lower-cased
 sc_error_message_warn_fatal:
        @grep -nEA2 '[^rp]error *\(' $$($(VC_LIST_EXCEPT))              \
            | grep -E '"Warning|"Fatal|"fatal' &&                       \
@@ -1087,15 +1078,15 @@ sc_po_check:
 
 # Sometimes it is useful to change the PATH environment variable
 # in Makefiles.  When doing so, it's better not to use the Unix-centric
-# path separator of `:', but rather the automake-provided `$(PATH_SEPARATOR)'.
-msg = '$(ME): Do not use `:'\'' above; use $$(PATH_SEPARATOR) instead'
+# path separator of ':', but rather the automake-provided '$(PATH_SEPARATOR)'.
+msg = '$(ME): Do not use '\'':'\'' above; use $$(PATH_SEPARATOR) instead'
 sc_makefile_path_separator_check:
        @prohibit='PATH[=].*:'                                          \
        in_vc_files='akefile|\.mk$$'                                    \
        halt=$(msg)                                                     \
          $(_sc_search_regexp)
 
-# Check that `make alpha' will not fail at the end of the process,
+# Check that 'make alpha' will not fail at the end of the process,
 # i.e., when pkg-M.N.tar.xz already exists (either in "." or in ../release)
 # and is read-only.
 writable-files:
@@ -1157,6 +1148,16 @@ sc_cross_check_PATH_usage_in_tests:
                1>&2; exit 1; } || :;                                   \
        fi
 
+# BRE regex of file contents to identify a test script.
+_test_script_regex ?= \<init\.sh\>
+
+# In tests, use "compare expected actual", not the reverse.
+sc_prohibit_reversed_compare_failure:
+       @prohibit='\<compare [^ ]+ ([^ ]*exp|/dev/null)'                \
+       containing='$(_test_script_regex)'                              \
+       halt='reversed compare arguments'                               \
+         $(_sc_search_regexp)
+
 # #if HAVE_... will evaluate to false for any non numeric string.
 # That would be flagged by using -Wundef, however gnulib currently
 # tests many undefined macros, and so we can't enable that option.
@@ -1438,16 +1439,16 @@ sc_tight_scope: tight-scope.mk
 
 tight-scope.mk: $(ME)
        @rm -f $@ address@hidden
-       @perl -ne '/^# TS-start/.../^# TS-end/ and print' $(ME) > address@hidden
+       @perl -ne '/^# TS-start/.../^# TS-end/ and print' $(srcdir)/$(ME) > 
address@hidden
        @chmod a=r address@hidden && mv address@hidden $@
 
 ifeq (a,b)
 # TS-start
 
 # Most functions should have static scope.
-# Any that don't must be marked with `extern', but `main'
-# and `usage' are exceptions: they're always extern, but
-# do not need to be marked.  Symbols matching `__.*' are
+# Any that don't must be marked with 'extern', but 'main'
+# and 'usage' are exceptions: they're always extern, but
+# do not need to be marked.  Symbols matching '__.*' are
 # reserved by the compiler, so are automatically excluded below.
 _gl_TS_unmarked_extern_functions ?= main usage
 _gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\S+) *\(/
@@ -1457,9 +1458,9 @@ _gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\S+) 
*\(/
 # export _gl_TS_extern = extern|XTERN
 _gl_TS_extern ?= extern
 
-# The second nm|grep checks for file-scope variables with `extern' scope.
+# The second nm|grep checks for file-scope variables with 'extern' scope.
 # Without gnulib's progname module, you might put program_name here.
-# Symbols matching `__.*' are reserved by the compiler,
+# Symbols matching '__.*' are reserved by the compiler,
 # so are automatically excluded below.
 _gl_TS_unmarked_extern_vars ?=
 
diff --git a/src/benchmark-tls.c b/src/benchmark-tls.c
index d2a742d..4528b77 100644
--- a/src/benchmark-tls.c
+++ b/src/benchmark-tls.c
@@ -53,6 +53,9 @@
 // #define PARAMS_1024 
 
 #ifdef PARAMS_1024
+
+static const int rsa_bits = 1024, ec_bits = 192;
+
 const char *pkcs3 = 
   "-----BEGIN DH PARAMETERS-----\n"
   "MIIBCwKBgQCsIrA9BK23OUVIwrC4c65YJ2t8bqoGpJpuISjO07lAbWHWa47Kf9/t\n"
@@ -97,54 +100,70 @@ static unsigned char server_key_pem[] =
   "-----END RSA PRIVATE KEY-----\n";
 
 #else
-/* DH of 1248 bits that is pretty close equivalent to 192 bits of ECDH.
+
+static const int rsa_bits = 1840, ec_bits = 192;
+
+/* DH of 1840 bits that is pretty close equivalent to 192 bits of ECDH.
  */
 const char *pkcs3 =
   "-----BEGIN DH PARAMETERS-----\n"
-  "MIIBQwKBnQDgLx3SqWyHOfGn/03r1tRwf3pByo3C4V1YIjjDQUoIzn82tRMPEKsL\n"
-  "vos7WXjKgF1+S+T5Y9A7XqivGv1XJ1ZmDvewXVRByxjGRZbkoqCPw4Zv0Uyl9pjV\n"
-  "WaR/Y/emZrN51K0zkdFJCzCt3lPlO3UprnYYHkySRpxTJ4ab5iXRFXETA5rJ5WH0\n"
-  "itGpoR5xb2fR1Gmg5kXCNutkZ9cCgZwqJUZwqKIHJ9cYtzvZXFpjZNgF+mRWyiFr\n"
-  "AQooJbFbVX3o2seJZl3mMqaetaLHF+L8anZFQipNgxenzQgEWEv8FubHXStaOnX1\n"
-  "cwjwwxmCUK4lpfCQZtJ1K3os2JCcNaTBUyxAfiXFIYJmO/os0hFhR6a4EjIlkcq0\n"
-  "yDDLN1weTNOpBPstp1WGHZCsKdJZzgfVvYL6er4zVBtBS0cCAgCg\n"
+  "MIIB1gKB5kX/Dun+gVTZ1WXWxpS5efQUQY8XNGxi2V0IYHSqKMkrt8UGruv4Gqop\n"
+  "vAoG/+llD/t84cIdUxNwHtLd5y/ae7lFOKFNhP+glvK/GsCfTcACRy9OFKphWi6E\n"
+  "NDMyWV0miiZgIc/LrXgC4RcDMlmxRR3UW/+eVu1ti6PLMLYSooMwn60K6CWmgaM6\n"
+  "VZaiD++gQtsgJdJv2+eNiVotodBPItJ5KcaPNVEdP1D8MzljO98UIOBR3YnalIAW\n"
+  "oyTjWMcX5oxwIR4eSywPeUQokMFFAKxZfo6/IUv05sQ9semagqAilg52Q5CfAoHm\n"
+  "RL1euKirrpaXqUtrV8r0l962oVFlLD92ReJOcjHFni8FY26qZ4IZba1lLP2Q4DTX\n"
+  "ovR7HPMaa6Ss6EdR2hba8Q1LAiCCUFH5jiKjMU8bSM2Zi23GOdoHqYpHMbcSKkpX\n"
+  "IQpbHHNap53/VxcPj4PK9SbQLt0KWe/253l8Ib5zivb6jKSOY/KzwoXO+MiPae01\n"
+  "BdQhrMtsdntRWo5jChSBUidGP7orra3gPBOXhWdNeeTTshc0AZdSWP3NicokW/q7\n"
+  "jHBuaadmhVv3yd6BvFkSePhVWcSKXXG27K9d3RNsXmaBasNYIhsCAgDf\n"
   "-----END DH PARAMETERS-----\n";
 
 static unsigned char server_cert_pem[] =
   "-----BEGIN CERTIFICATE-----\n"
-  "MIICPjCCAYugAwIBAgIETuIMgTANBgkqhkiG9w0BAQsFADAcMQswCQYDVQQGEwJC\n"
-  "RTENMAsGA1UEChMEVGVzdDAeFw0xMTEyMDkxMzI2MjZaFw0yMDA1MDcxMzI2Mjha\n"
-  "MBwxCzAJBgNVBAYTAkJFMQ0wCwYDVQQKEwRUZXN0MIG7MA0GCSqGSIb3DQEBAQUA\n"
-  "A4GpADCBpQKBnQDTfzWWQ0miI6Gll+Vy4Cv/SSSCJssOZpQmKOHCUFzRO83/iSvb\n"
-  "zJqZlyHB8YuPhM8sXv8MQqblbLZKhqbF5dyCbaZi5U3Emis6HS9epyjiifEPxPl2\n"
-  "ph6dWCy9QjMkkcTCAANgiszc6Vz1M0gx7shaZXnjHpUByWwdRuVo9GLZRmfr916s\n"
-  "8TnJdOihzNy+P9z9akUtepM7DQhyCgUCAwEAAaNVMFMwDAYDVR0TAQH/BAIwADAT\n"
-  "BgNVHSUEDDAKBggrBgEFBQcDATAPBgNVHQ8BAf8EBQMDB6AAMB0GA1UdDgQWBBTC\n"
-  "8dyNXAOY/Uxa2V/QzsDserss6TANBgkqhkiG9w0BAQsFAAOBnQAfBWi5NIKO3/pY\n"
-  "SrADjk5lCjysCheEfnb6hMU6ZVfauwm3ZCzkjYS8r936BC/fWss1oASxnUnznQvz\n"
-  "TV/nJPz3LjXWHg+cmihM5WtEc0wANvpgnWme2AsO3zLecNRziEU4PU/9Al+I8v9S\n"
-  "hCjm85krIhIb3tG6K08sUtPRV6lK47J+KudgCFwXaRMsG6w05Z2Lo3HCk02uenSz\n"
-  "flQ=\n"
+  "MIIC3TCCAeCgAwIBAgIETwIyNzANBgkqhkiG9w0BAQsFADAhMQswCQYDVQQGEwJH\n"
+  "UjESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEyMDEwMjIyMzk1MloXDTE3MDYwNjIy\n"
+  "Mzk1NlowITELMAkGA1UEBhMCR1IxEjAQBgNVBAMTCWxvY2FsaG9zdDCCAQUwDQYJ\n"
+  "KoZIhvcNAQEBBQADgfMAMIHvAoHnAMnMTaYe76aNxyhPDDZ1YWuj8SQh9PC7PRDD\n"
+  "8qL+G8se+DwiJOL3fjRCXi2R1zt6gUrJmycmW+1xc9GdVST6oO09ZG6NQ8CRvU+K\n"
+  "EcaDRQojUFM9QLmkDO1MyEZDMuXBpM+9TFkyDWgrsgYgcNU+Y9FN9Y45OT780+kl\n"
+  "DjZItjl1jnD3tfWaYORQE//Xy4i2HrxTgikP26PB+3ynI+SDj7Sdt4oasgUo1Fpd\n"
+  "OWDQ0hYQ6sn51mOYUnhYZax5y4lI6Cm4KOQc1NMn3iaX5+nS5YGcFhS/Usb8KsX1\n"
+  "fHGsvePSyS/oxTMlAgMBAAGjVTBTMAwGA1UdEwEB/wQCMAAwEwYDVR0lBAwwCgYI\n"
+  "KwYBBQUHAwEwDwYDVR0PAQH/BAUDAwegADAdBgNVHQ4EFgQUgQI1pnj7olEUcUu3\n"
+  "SVCbJwYyuF4wDQYJKoZIhvcNAQELBQADgecAs2veVEtkSIlj2nEy1NI/lr0Wf51K\n"
+  "0E2/oAeZJGoGo4wK5HUDfW2HlO+UVTkPei2Zk5Kjl/hpd9zG4BhTurL5mncPntXx\n"
+  "Q6F3FMklBld4AYKeq5SSl+GG/PoEDzEJjazABCWgLa/U3EYjuwSXZj9RMibB6NQX\n"
+  "bKCaj4cjRZSa1UmdLl2KTgRfG1ZDU4EBObagkdaOGD0XJ8EEZaBRktMtT8byxM8A\n"
+  "m2pRMdwPvbxENmMhLXcIPQTaPaEYZyq9LA8Pee5wJosN66l8JVlsz2XEcH35DcG0\n"
+  "bSUX8CSDmUPyHRyzVNeEcHc=\n"
   "-----END CERTIFICATE-----\n";
 
 static unsigned char server_key_pem[] =
   "-----BEGIN RSA PRIVATE KEY-----\n"
-  "MIIC2gIBAAKBnQDTfzWWQ0miI6Gll+Vy4Cv/SSSCJssOZpQmKOHCUFzRO83/iSvb\n"
-  "zJqZlyHB8YuPhM8sXv8MQqblbLZKhqbF5dyCbaZi5U3Emis6HS9epyjiifEPxPl2\n"
-  "ph6dWCy9QjMkkcTCAANgiszc6Vz1M0gx7shaZXnjHpUByWwdRuVo9GLZRmfr916s\n"
-  "8TnJdOihzNy+P9z9akUtepM7DQhyCgUCAwEAAQKBnQDDsmSCOpbKmY+8KtXbusPb\n"
-  "PvGyIHUpSQ9yU8e5xiRsUpslBOb5RdQTpD1PONK7JNeSJgB3dsD5buMqCHgOi8fD\n"
-  "Q/R+c9DGxySSbGjle2Nwhm0gSKgLWZDGTewu+NPiL/RsS5TZja7lNOO6Bbnb064Q\n"
-  "iawYLjsDv1jgeBHMBgqD4nwoGMsgA2vy6kIBhyIgMDRlLxUA4K2zQa3gTy0CTwDX\n"
-  "pEfrmNgPuFvrP5CGjG442H1MkLA/Wlb27S0ZYmbYKjxpjgKFJnGWxTCX5L4Ce4DL\n"
-  "a6gJDDkyGW+md1HTtxBrM84TGnz/Zt/YY62YQ4MCTwD7FFghc0zsEwpocZlIzbor\n"
-  "HHqpOq92kov3CF7kOS/uyn7LPcTgKk1qDW/mFkl584EseCNH3WZpnvAbtjPmGvMt\n"
-  "p8Fva3qWeBzKLDkOndcCTjgsY0/MEPyHWep+NHfYPR4xxvIa/s6CCgVo40api4Dj\n"
-  "/7i/dYiZ6x0LYQ0wWQ7sfTCAatVwibWzSpJior40AeLrK9NuIwGlGsqTrLTtYQJO\n"
-  "CeJfJdH4MUL+oeX29trCfXf9jDP3PF/AitUVhz6JGIl4PGAOJBUGPyqQQSqXcemY\n"
-  "KDwCh427vmS3Zx/hIynkcOOtxckhZlMMLxlWlbC5Ak4HC5VbKuw7nqMmDAnJ9kAO\n"
-  "bJAUaXQAEw4BnUY/+8oZe/4KIgrWkwIS+cWtMzEQenQ/uJn08nhIEHMPsa/hYHTm\n"
-  "jNKkrVgy360hqYj0lm4=\n"
+  "MIIEKQIBAAKB5wDJzE2mHu+mjccoTww2dWFro/EkIfTwuz0Qw/Ki/hvLHvg8IiTi\n"
+  "9340Ql4tkdc7eoFKyZsnJlvtcXPRnVUk+qDtPWRujUPAkb1PihHGg0UKI1BTPUC5\n"
+  "pAztTMhGQzLlwaTPvUxZMg1oK7IGIHDVPmPRTfWOOTk+/NPpJQ42SLY5dY5w97X1\n"
+  "mmDkUBP/18uIth68U4IpD9ujwft8pyPkg4+0nbeKGrIFKNRaXTlg0NIWEOrJ+dZj\n"
+  "mFJ4WGWsecuJSOgpuCjkHNTTJ94ml+fp0uWBnBYUv1LG/CrF9XxxrL3j0skv6MUz\n"
+  "JQIDAQABAoHnALSPqarKY4STt2/JyxOvU8wMlOfPumrsHmex7JkK5bOJsnOb2YV8\n"
+  "DeCUwc/kfsEpjCZu3fTZzcdXjFoyfMzptLSSChshK05TGSDiWaVWL6AymNziIdf5\n"
+  "gdeSrGCyIAiUi/OVXYsxze03q8LvpAYqHQZayysto69IOe6P5Qt17xYPgsRIA6k9\n"
+  "LAgBIjCN2ukgR/fWERGSn2jC/aBlO3jwmG80LsdPNaQ6+esQcwjwMjFajkf5A1XE\n"
+  "OiYlIdmUS2liuWnUQK+D76WSUTrlwKKjxQiB0A9wugCN43BWHfV/Kf6ohIM1kIAB\n"
+  "AnQA/g8rrF0cTe6ZsiZU0m7nyIQkmATENlLhu37DtcsdqTAwV3+UqzLIh46sHiRa\n"
+  "D3SKlhhNs6iTqw/Wv02ZHy+//pxCmWWNAxhhwPCM6/OO6i5oEYU4uH+llEcu5Flh\n"
+  "udFt7fMy/tzpwPsZRFpXaO1wScU2AQJ0AMtW7rsVrdqZqOdVGNI7vRsLC1SM26j4\n"
+  "2bouNvKPuaLOsLBSlFopSpFRDgOxe+OOqk9Reg6RzO/q+496bEOqixofCE5Gfc/I\n"
+  "pwlwwRGTP7sA0w6Y+Vo+qiATht/YaruscXL3AdQ3BulaqunAzsKN0Iz2ZSUCdACu\n"
+  "bTX74fVj4BPvxvdnfrNt7KO/J06bSW4nr1GpB6n2ldoqyLIGlBgvUZoEG8slX0si\n"
+  "387BMVUpFffHYfxl9/+mTBxBewJEhMHgmIb4HEEbsP7MQJ3/tcu1sOWV63P4Aryp\n"
+  "qNZzOrLWRs9DKY9nv9TfISIBAnMFNzCeadrwvXpAnMUrN08Nb4YV4BsORXvIM8FD\n"
+  "DX60d1q+2w9lFKQOACc83wOPfaxOpodb8k9wY/WZ44j9X1V8EQm0gEhf2QS30EWT\n"
+  "ftRmponDWRckQnE4q2eNPE7Yi37JdR594/9wYtv5bPGgueR8iSFlAnQAjinshgPe\n"
+  "kfAYhgSBbyJJvmCCp3jSra5JzoBnmMy2JyEJT+trCs9pmaP79GP/6BjPXHImnN0w\n"
+  "PsTvmNPD3U2BqsGRuu6OGg9VRP/LDLpPGmV7j8nTraVJCkc4w/n/gazAbPydZZbz\n"
+  "qRP/3et96JUHZnmn6g==\n"
   "-----END RSA PRIVATE KEY-----\n";
 #endif
 
@@ -410,7 +429,7 @@ void benchmark_tls(int debug_level)
     test_ciphersuite(PRIO_CAMELLIA_CBC_SHA1, 8 * 1024);
     test_ciphersuite(PRIO_CAMELLIA_CBC_SHA1, 15 * 1024);
 
-    printf("\nTesting key exchanges:\n");
+    printf("\nTesting key exchanges (RSA/DH bits: %d, EC bits: %d):\n", 
rsa_bits, ec_bits);
     test_ciphersuite_kx(PRIO_DH);
     test_ciphersuite_kx(PRIO_ECDH);
     test_ciphersuite_kx(PRIO_ECDHE_ECDSA);
diff --git a/src/certtool-gaa.c b/src/certtool-gaa.c
index f0b1cb4..1e33cd2 100644
--- a/src/certtool-gaa.c
+++ b/src/certtool-gaa.c
@@ -168,6 +168,7 @@ void gaa_help(void)
        __gaa_helpsingle(0, "to-p8", "", "Generate a PKCS #8 key structure.");
        __gaa_helpsingle('8', "pkcs8", "", "Use PKCS #8 format for private 
keys.");
        __gaa_helpsingle(0, "dsa", "", "Use DSA keys.");
+       __gaa_helpsingle(0, "rsa", "", "Use RSA keys.");
        __gaa_helpsingle(0, "ecc", "", "Use ECC (ECDSA) keys.");
        __gaa_helpsingle(0, "hash", "STR ", "Hash algorithm to use for signing 
(MD5,SHA1,RMD160,SHA256,SHA384,SHA512).");
        __gaa_helpsingle(0, "export-ciphers", "", "Use weak encryption 
algorithms.");
@@ -199,31 +200,31 @@ typedef struct _gaainfo gaainfo;
 
 struct _gaainfo
 {
-#line 146 "certtool.gaa"
+#line 148 "certtool.gaa"
        int debug;
-#line 143 "certtool.gaa"
+#line 145 "certtool.gaa"
        char *pkcs_cipher;
-#line 140 "certtool.gaa"
+#line 142 "certtool.gaa"
        char *template;
-#line 137 "certtool.gaa"
+#line 139 "certtool.gaa"
        char *infile;
-#line 134 "certtool.gaa"
+#line 136 "certtool.gaa"
        char *outfile;
-#line 131 "certtool.gaa"
+#line 133 "certtool.gaa"
        int quick_random;
-#line 128 "certtool.gaa"
+#line 130 "certtool.gaa"
        char* sec_param;
-#line 125 "certtool.gaa"
+#line 127 "certtool.gaa"
        int bits;
-#line 121 "certtool.gaa"
+#line 123 "certtool.gaa"
        int outcert_format;
-#line 117 "certtool.gaa"
+#line 119 "certtool.gaa"
        int incert_format;
-#line 114 "certtool.gaa"
+#line 116 "certtool.gaa"
        int export;
-#line 111 "certtool.gaa"
+#line 113 "certtool.gaa"
        char *hash;
-#line 108 "certtool.gaa"
+#line 110 "certtool.gaa"
        int ecc;
 #line 105 "certtool.gaa"
        int dsa;
@@ -307,7 +308,7 @@ static int gaa_error = 0;
 #define GAA_MULTIPLE_OPTION     3
 
 #define GAA_REST                0
-#define GAA_NB_OPTION           56
+#define GAA_NB_OPTION           57
 #define GAAOPTID_version       1
 #define GAAOPTID_help  2
 #define GAAOPTID_debug 3
@@ -325,45 +326,46 @@ static int gaa_error = 0;
 #define GAAOPTID_export_ciphers        15
 #define GAAOPTID_hash  16
 #define GAAOPTID_ecc   17
-#define GAAOPTID_dsa   18
-#define GAAOPTID_pkcs8 19
-#define GAAOPTID_to_p8 20
-#define GAAOPTID_to_p12        21
-#define GAAOPTID_v1    22
-#define GAAOPTID_fix_key       23
-#define GAAOPTID_pubkey_info   24
-#define GAAOPTID_pgp_key_info  25
-#define GAAOPTID_key_info      26
-#define GAAOPTID_smime_to_p7   27
-#define GAAOPTID_p7_info       28
-#define GAAOPTID_p12_info      29
-#define GAAOPTID_no_crq_extensions     30
-#define GAAOPTID_crq_info      31
-#define GAAOPTID_crl_info      32
-#define GAAOPTID_pgp_ring_info 33
-#define GAAOPTID_pgp_certificate_info  34
-#define GAAOPTID_certificate_pubkey    35
-#define GAAOPTID_certificate_info      36
-#define GAAOPTID_password      37
-#define GAAOPTID_load_ca_certificate   38
-#define GAAOPTID_load_ca_privkey       39
-#define GAAOPTID_load_certificate      40
-#define GAAOPTID_load_request  41
-#define GAAOPTID_load_pubkey   42
-#define GAAOPTID_load_privkey  43
-#define GAAOPTID_dh_info       44
-#define GAAOPTID_get_dh_params 45
-#define GAAOPTID_generate_dh_params    46
-#define GAAOPTID_verify_crl    47
-#define GAAOPTID_verify        48
-#define GAAOPTID_verify_chain  49
-#define GAAOPTID_generate_request      50
-#define GAAOPTID_generate_privkey      51
-#define GAAOPTID_update_certificate    52
-#define GAAOPTID_generate_crl  53
-#define GAAOPTID_generate_proxy        54
-#define GAAOPTID_generate_certificate  55
-#define GAAOPTID_generate_self_signed  56
+#define GAAOPTID_rsa   18
+#define GAAOPTID_dsa   19
+#define GAAOPTID_pkcs8 20
+#define GAAOPTID_to_p8 21
+#define GAAOPTID_to_p12        22
+#define GAAOPTID_v1    23
+#define GAAOPTID_fix_key       24
+#define GAAOPTID_pubkey_info   25
+#define GAAOPTID_pgp_key_info  26
+#define GAAOPTID_key_info      27
+#define GAAOPTID_smime_to_p7   28
+#define GAAOPTID_p7_info       29
+#define GAAOPTID_p12_info      30
+#define GAAOPTID_no_crq_extensions     31
+#define GAAOPTID_crq_info      32
+#define GAAOPTID_crl_info      33
+#define GAAOPTID_pgp_ring_info 34
+#define GAAOPTID_pgp_certificate_info  35
+#define GAAOPTID_certificate_pubkey    36
+#define GAAOPTID_certificate_info      37
+#define GAAOPTID_password      38
+#define GAAOPTID_load_ca_certificate   39
+#define GAAOPTID_load_ca_privkey       40
+#define GAAOPTID_load_certificate      41
+#define GAAOPTID_load_request  42
+#define GAAOPTID_load_pubkey   43
+#define GAAOPTID_load_privkey  44
+#define GAAOPTID_dh_info       45
+#define GAAOPTID_get_dh_params 46
+#define GAAOPTID_generate_dh_params    47
+#define GAAOPTID_verify_crl    48
+#define GAAOPTID_verify        49
+#define GAAOPTID_verify_chain  50
+#define GAAOPTID_generate_request      51
+#define GAAOPTID_generate_privkey      52
+#define GAAOPTID_update_certificate    53
+#define GAAOPTID_generate_crl  54
+#define GAAOPTID_generate_proxy        55
+#define GAAOPTID_generate_certificate  56
+#define GAAOPTID_generate_self_signed  57
 
 #line 168 "gaa.skel"
 
@@ -695,6 +697,7 @@ static int gaa_get_option_num(char *str, int status)
                        GAA_CHECK1STR("", GAAOPTID_inder);
                        GAA_CHECK1STR("", GAAOPTID_export_ciphers);
                        GAA_CHECK1STR("", GAAOPTID_ecc);
+                       GAA_CHECK1STR("", GAAOPTID_rsa);
                        GAA_CHECK1STR("", GAAOPTID_dsa);
                        GAA_CHECK1STR("8", GAAOPTID_pkcs8);
                        GAA_CHECK1STR("", GAAOPTID_to_p8);
@@ -748,6 +751,7 @@ static int gaa_get_option_num(char *str, int status)
                        GAA_CHECKSTR("export-ciphers", GAAOPTID_export_ciphers);
                        GAA_CHECKSTR("hash", GAAOPTID_hash);
                        GAA_CHECKSTR("ecc", GAAOPTID_ecc);
+                       GAA_CHECKSTR("rsa", GAAOPTID_rsa);
                        GAA_CHECKSTR("dsa", GAAOPTID_dsa);
                        GAA_CHECKSTR("pkcs8", GAAOPTID_pkcs8);
                        GAA_CHECKSTR("to-p8", GAAOPTID_to_p8);
@@ -836,14 +840,14 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo 
*gaaval, char *opt_list)
     {
        case GAAOPTID_version:
        OK = 0;
-#line 151 "certtool.gaa"
+#line 153 "certtool.gaa"
 { certtool_version(); exit(0); ;};
 
                return GAA_OK;
                break;
        case GAAOPTID_help:
        OK = 0;
-#line 149 "certtool.gaa"
+#line 151 "certtool.gaa"
 { gaa_help(); exit(0); ;};
 
                return GAA_OK;
@@ -853,7 +857,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo 
*gaaval, char *opt_list)
                GAA_TESTMOREARGS;
                GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1);
                gaa_index++;
-#line 147 "certtool.gaa"
+#line 149 "certtool.gaa"
 { gaaval->debug = GAATMP_debug.arg1 ;};
 
                return GAA_OK;
@@ -863,7 +867,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo 
*gaaval, char *opt_list)
                GAA_TESTMOREARGS;
                GAA_FILL(GAATMP_pkcs_cipher.arg1, gaa_getstr, 
GAATMP_pkcs_cipher.size1);
                gaa_index++;
-#line 144 "certtool.gaa"
+#line 146 "certtool.gaa"
 { gaaval->pkcs_cipher = GAATMP_pkcs_cipher.arg1 ;};
 
                return GAA_OK;
@@ -873,7 +877,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo 
*gaaval, char *opt_list)
                GAA_TESTMOREARGS;
                GAA_FILL(GAATMP_template.arg1, gaa_getstr, 
GAATMP_template.size1);
                gaa_index++;
-#line 141 "certtool.gaa"
+#line 143 "certtool.gaa"
 { gaaval->template = GAATMP_template.arg1 ;};
 
                return GAA_OK;
@@ -883,7 +887,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo 
*gaaval, char *opt_list)
                GAA_TESTMOREARGS;
                GAA_FILL(GAATMP_infile.arg1, gaa_getstr, GAATMP_infile.size1);
                gaa_index++;
-#line 138 "certtool.gaa"
+#line 140 "certtool.gaa"
 { gaaval->infile = GAATMP_infile.arg1 ;};
 
                return GAA_OK;
@@ -893,14 +897,14 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo 
*gaaval, char *opt_list)
                GAA_TESTMOREARGS;
                GAA_FILL(GAATMP_outfile.arg1, gaa_getstr, GAATMP_outfile.size1);
                gaa_index++;
-#line 135 "certtool.gaa"
+#line 137 "certtool.gaa"
 { gaaval->outfile = GAATMP_outfile.arg1 ;};
 
                return GAA_OK;
                break;
        case GAAOPTID_disable_quick_random:
        OK = 0;
-#line 132 "certtool.gaa"
+#line 134 "certtool.gaa"
 { gaaval->quick_random = 0; ;};
 
                return GAA_OK;
@@ -910,7 +914,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo 
*gaaval, char *opt_list)
                GAA_TESTMOREARGS;
                GAA_FILL(GAATMP_sec_param.arg1, gaa_getstr, 
GAATMP_sec_param.size1);
                gaa_index++;
-#line 129 "certtool.gaa"
+#line 131 "certtool.gaa"
 { gaaval->sec_param = GAATMP_sec_param.arg1 ;};
 
                return GAA_OK;
@@ -920,42 +924,42 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo 
*gaaval, char *opt_list)
                GAA_TESTMOREARGS;
                GAA_FILL(GAATMP_bits.arg1, gaa_getint, GAATMP_bits.size1);
                gaa_index++;
-#line 126 "certtool.gaa"
+#line 128 "certtool.gaa"
 { gaaval->bits = GAATMP_bits.arg1 ;};
 
                return GAA_OK;
                break;
        case GAAOPTID_outraw:
        OK = 0;
-#line 123 "certtool.gaa"
+#line 125 "certtool.gaa"
 { gaaval->outcert_format=1 ;};
 
                return GAA_OK;
                break;
        case GAAOPTID_outder:
        OK = 0;
-#line 122 "certtool.gaa"
+#line 124 "certtool.gaa"
 { gaaval->outcert_format=1 ;};
 
                return GAA_OK;
                break;
        case GAAOPTID_inraw:
        OK = 0;
-#line 119 "certtool.gaa"
+#line 121 "certtool.gaa"
 { gaaval->incert_format=1 ;};
 
                return GAA_OK;
                break;
        case GAAOPTID_inder:
        OK = 0;
-#line 118 "certtool.gaa"
+#line 120 "certtool.gaa"
 { gaaval->incert_format=1 ;};
 
                return GAA_OK;
                break;
        case GAAOPTID_export_ciphers:
        OK = 0;
-#line 115 "certtool.gaa"
+#line 117 "certtool.gaa"
 { gaaval->export=1 ;};
 
                return GAA_OK;
@@ -965,18 +969,25 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo 
*gaaval, char *opt_list)
                GAA_TESTMOREARGS;
                GAA_FILL(GAATMP_hash.arg1, gaa_getstr, GAATMP_hash.size1);
                gaa_index++;
-#line 112 "certtool.gaa"
+#line 114 "certtool.gaa"
 { gaaval->hash = GAATMP_hash.arg1 ;};
 
                return GAA_OK;
                break;
        case GAAOPTID_ecc:
        OK = 0;
-#line 109 "certtool.gaa"
+#line 111 "certtool.gaa"
 { gaaval->ecc=1 ;};
 
                return GAA_OK;
                break;
+       case GAAOPTID_rsa:
+       OK = 0;
+#line 108 "certtool.gaa"
+{ ;};
+
+               return GAA_OK;
+               break;
        case GAAOPTID_dsa:
        OK = 0;
 #line 106 "certtool.gaa"
@@ -1295,7 +1306,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval)
     if(inited == 0)
     {
 
-#line 153 "certtool.gaa"
+#line 155 "certtool.gaa"
 { gaaval->bits = 0; gaaval->pkcs8 = 0; gaaval->privkey = NULL; 
gaaval->ca=NULL; gaaval->ca_privkey = NULL;
        gaaval->debug=1; gaaval->request = NULL; gaaval->infile = NULL; 
gaaval->outfile = NULL; gaaval->cert = NULL; 
        gaaval->incert_format = 0; gaaval->outcert_format = 0; 
gaaval->action=-1; gaaval->pass = NULL; gaaval->v1_cert = 0;
diff --git a/src/certtool-gaa.h b/src/certtool-gaa.h
index fa684de..06f9998 100644
--- a/src/certtool-gaa.h
+++ b/src/certtool-gaa.h
@@ -8,31 +8,31 @@ typedef struct _gaainfo gaainfo;
 
 struct _gaainfo
 {
-#line 146 "certtool.gaa"
+#line 148 "certtool.gaa"
        int debug;
-#line 143 "certtool.gaa"
+#line 145 "certtool.gaa"
        char *pkcs_cipher;
-#line 140 "certtool.gaa"
+#line 142 "certtool.gaa"
        char *template;
-#line 137 "certtool.gaa"
+#line 139 "certtool.gaa"
        char *infile;
-#line 134 "certtool.gaa"
+#line 136 "certtool.gaa"
        char *outfile;
-#line 131 "certtool.gaa"
+#line 133 "certtool.gaa"
        int quick_random;
-#line 128 "certtool.gaa"
+#line 130 "certtool.gaa"
        char* sec_param;
-#line 125 "certtool.gaa"
+#line 127 "certtool.gaa"
        int bits;
-#line 121 "certtool.gaa"
+#line 123 "certtool.gaa"
        int outcert_format;
-#line 117 "certtool.gaa"
+#line 119 "certtool.gaa"
        int incert_format;
-#line 114 "certtool.gaa"
+#line 116 "certtool.gaa"
        int export;
-#line 111 "certtool.gaa"
+#line 113 "certtool.gaa"
        char *hash;
-#line 108 "certtool.gaa"
+#line 110 "certtool.gaa"
        int ecc;
 #line 105 "certtool.gaa"
        int dsa;
diff --git a/src/certtool.c b/src/certtool.c
index 110fdeb..d740474 100644
--- a/src/certtool.c
+++ b/src/certtool.c
@@ -196,7 +196,7 @@ generate_private_key_int (void)
   if (info.dsa)
     key_type = GNUTLS_PK_DSA;
   else if (info.ecc)
-    key_type = GNUTLS_PK_ECC;
+    key_type = GNUTLS_PK_EC;
   else
     key_type = GNUTLS_PK_RSA;
 
@@ -275,7 +275,8 @@ print_private_key (gnutls_x509_privkey_t key)
   if (!key)
     return;
 
-  privkey_info_int(key);
+  if (info.outcert_format == GNUTLS_X509_FMT_PEM)
+    privkey_info_int(key);
 
   if (!info.pkcs8)
     {
@@ -1198,16 +1199,18 @@ certificate_info (int pubkey, common_info_st * cinfo)
       if (info.outcert_format == GNUTLS_X509_FMT_PEM)
         print_certificate_info (crt[i], outfile, 1);
 
-      size = buffer_size;
-      ret = gnutls_x509_crt_export (crt[i], info.outcert_format, buffer,
-                                    &size);
-      if (ret < 0)
-        error (EXIT_FAILURE, 0, "export error: %s", gnutls_strerror (ret));
-
-      fwrite (buffer, 1, size, outfile);
-
       if (pubkey)
         pubkey_info (crt[i], cinfo);
+      else
+        {
+          size = buffer_size;
+          ret = gnutls_x509_crt_export (crt[i], info.outcert_format, buffer,
+                                        &size);
+          if (ret < 0)
+            error (EXIT_FAILURE, 0, "export error: %s", gnutls_strerror (ret));
+
+          fwrite (buffer, 1, size, outfile);
+        }
 
       gnutls_x509_crt_deinit (crt[i]);
     }
@@ -1285,7 +1288,7 @@ pgp_privkey_info (void)
   gnutls_openpgp_privkey_t key;
   unsigned char keyid[GNUTLS_OPENPGP_KEYID_SIZE];
   size_t size;
-  int ret, i, subkeys;
+  int ret, i, subkeys, bits = 0;
   gnutls_datum_t pem;
   const char *cprint;
 
@@ -1352,6 +1355,7 @@ pgp_privkey_info (void)
           else
             print_rsa_pkey (&m, &e, &d, &p, &q, &u, NULL, NULL);
 
+          bits = m.size * 8;
         }
       else if (ret == GNUTLS_PK_DSA)
         {
@@ -1369,6 +1373,8 @@ pgp_privkey_info (void)
                      gnutls_strerror (ret));
           else
             print_dsa_pkey (&x, &y, &p, &q, &g);
+            
+          bits = y.size * 8;
         }
 
       fprintf (outfile, "\n");
@@ -1386,9 +1392,33 @@ pgp_privkey_info (void)
         }
       else
         {
-          fprintf (outfile, "Public Key ID: %s\n", raw_to_string (keyid, 8));
+          fprintf (outfile, "Public key ID: %s\n", raw_to_string (keyid, 8));
         }
 
+      size = buffer_size;
+      if (i == -1)
+        ret = gnutls_openpgp_privkey_get_fingerprint (key, buffer, &size);
+      else
+        ret = gnutls_openpgp_privkey_get_subkey_fingerprint (key, i, buffer, 
&size);
+
+      if (ret < 0)
+        {
+          fprintf (stderr, "Error in fingerprint calculation: %s\n",
+                   gnutls_strerror (ret));
+        }
+      else
+        {
+          gnutls_datum_t art;
+
+          fprintf (outfile, "Fingerprint: %s\n", raw_to_string (buffer, size));
+
+          ret = gnutls_random_art(GNUTLS_RANDOM_ART_OPENSSH, cprint, bits, 
buffer, size, &art);
+          if (ret >= 0)
+            {
+              fprintf (outfile, "Fingerprint's random art:\n%s\n\n", art.data);
+              gnutls_free(art.data);
+            }
+        }
     }
 
   size = buffer_size;
@@ -1427,7 +1457,7 @@ pgp_ring_info (void)
   free (pem.data);
 
   count = gnutls_openpgp_keyring_get_crt_count (ring);
-  if (count > 0)
+  if (count >= 0)
     fprintf (outfile, "Keyring contains %d OpenPGP certificates\n\n", count);
   else
     error (EXIT_FAILURE, 0, "keyring error: %s", gnutls_strerror (count));
@@ -1618,7 +1648,7 @@ crq_info (void)
 
 static void privkey_info_int (gnutls_x509_privkey_t key)
 {
-int ret;
+int ret, key_type, bits = 0;
 size_t size;
 const char *cprint;
 
@@ -1628,14 +1658,16 @@ const char *cprint;
   ret = gnutls_x509_privkey_get_pk_algorithm (key);
   fprintf (outfile, "\tPublic Key Algorithm: ");
 
-  cprint = gnutls_pk_algorithm_get_name (ret);
+  key_type = ret;
+
+  cprint = gnutls_pk_algorithm_get_name (key_type);
   fprintf (outfile, "%s\n", cprint ? cprint : "Unknown");
   fprintf (outfile, "\tKey Security Level: %s\n\n",
            gnutls_sec_param_get_name (gnutls_x509_privkey_sec_param (key)));
 
   /* Print the raw public and private keys
    */
-  if (ret == GNUTLS_PK_RSA)
+  if (key_type == GNUTLS_PK_RSA)
     {
       gnutls_datum_t m, e, d, p, q, u, exp1, exp2;
 
@@ -1648,6 +1680,8 @@ const char *cprint;
       else
         {
           print_rsa_pkey (&m, &e, &d, &p, &q, &u, &exp1, &exp2);
+          bits = m.size * 8;
+
           gnutls_free (m.data);
           gnutls_free (e.data);
           gnutls_free (d.data);
@@ -1658,7 +1692,7 @@ const char *cprint;
           gnutls_free (exp2.data);
         }
     }
-  else if (ret == GNUTLS_PK_DSA)
+  else if (key_type == GNUTLS_PK_DSA)
     {
       gnutls_datum_t p, q, g, y, x;
 
@@ -1669,6 +1703,8 @@ const char *cprint;
       else
         {
           print_dsa_pkey (&x, &y, &p, &q, &g);
+          bits = y.size * 8;
+
           gnutls_free (x.data);
           gnutls_free (y.data);
           gnutls_free (p.data);
@@ -1676,7 +1712,7 @@ const char *cprint;
           gnutls_free (g.data);
         }
     }
-  else if (ret == GNUTLS_PK_ECC)
+  else if (key_type == GNUTLS_PK_EC)
     {
       gnutls_datum_t y, x, k;
       gnutls_ecc_curve_t curve;
@@ -1688,6 +1724,8 @@ const char *cprint;
       else
         {
           print_ecc_pkey (curve, &k, &x, &y);
+          bits = gnutls_ecc_curve_get_size(curve) * 8;
+
           gnutls_free (x.data);
           gnutls_free (y.data);
           gnutls_free (k.data);
@@ -1704,7 +1742,16 @@ const char *cprint;
     }
   else
     {
+      gnutls_datum_t art;
+
       fprintf (outfile, "Public Key ID: %s\n", raw_to_string (buffer, size));
+      
+      ret = gnutls_random_art(GNUTLS_RANDOM_ART_OPENSSH, cprint, bits, buffer, 
size, &art);
+      if (ret >= 0)
+        {
+          fprintf (outfile, "Public key's random art:\n%s\n", art.data);
+          gnutls_free(art.data);
+        }
     }
   fprintf (outfile, "\n");
 
@@ -1744,7 +1791,8 @@ privkey_info (void)
   if (ret < 0)
     error (EXIT_FAILURE, 0, "import error: %s", gnutls_strerror (ret));
 
-  privkey_info_int (key);
+  if (info.outcert_format == GNUTLS_X509_FMT_PEM)
+    privkey_info_int (key);
 
   ret = gnutls_x509_privkey_verify_params (key);
   if (ret < 0)
@@ -1758,11 +1806,11 @@ privkey_info (void)
     }
 
   size = buffer_size;
-  ret = gnutls_x509_privkey_export (key, GNUTLS_X509_FMT_PEM, buffer, &size);
+  ret = gnutls_x509_privkey_export (key, info.outcert_format, buffer, &size);
   if (ret < 0)
     error (EXIT_FAILURE, 0, "export error: %s", gnutls_strerror (ret));
 
-  fprintf (outfile, "\n%s\n", buffer);
+  fwrite (buffer, 1, size, outfile);
 
   gnutls_x509_privkey_deinit (key);
 }
@@ -2901,6 +2949,22 @@ pubkey_info (gnutls_x509_crt_t crt, common_info_st * 
cinfo)
       pubkey = load_pubkey (1, cinfo);
     }
 
+  if (info.outcert_format == GNUTLS_X509_FMT_DER)
+    {
+      size = buffer_size;
+      ret = gnutls_pubkey_export (pubkey, info.outcert_format, buffer, &size);
+      if (ret < 0)
+        error (EXIT_FAILURE, 0, "export error: %s", gnutls_strerror (ret));
+
+      fwrite (buffer, 1, size, outfile);
+
+      gnutls_pubkey_deinit (pubkey);
+      
+      return;
+    }
+    
+  /* PEM */
+
   fprintf (outfile, "Public Key Info:\n\n");
   ret = gnutls_pubkey_get_pk_algorithm (pubkey, &bits);
   fprintf (outfile, "Public Key Algorithm: ");
@@ -2943,7 +3007,7 @@ pubkey_info (gnutls_x509_crt_t crt, common_info_st * 
cinfo)
           gnutls_free (g.data);
         }
     }
-  else if (ret == GNUTLS_PK_ECC)
+  else if (ret == GNUTLS_PK_EC)
     {
       gnutls_datum_t x, y;
       gnutls_ecc_curve_t curve;
diff --git a/src/certtool.gaa b/src/certtool.gaa
index 7e79102..89d53ea 100644
--- a/src/certtool.gaa
+++ b/src/certtool.gaa
@@ -105,6 +105,8 @@ option (8, pkcs8) { $pkcs8=1 } "Use PKCS #8 format for 
private keys."
 #int dsa;
 option (dsa) { $dsa=1 } "Use DSA keys."
 
+option (rsa) { } "Use RSA keys."
+
 #int ecc;
 option (ecc) { $ecc=1 } "Use ECC (ECDSA) keys."
 
diff --git a/src/cli.c b/src/cli.c
index 946dc85..9c39a10 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -688,12 +688,17 @@ static int check_net_or_keyboard_input(socket_st* hd)
   do
     {
       FD_ZERO (&rset);
-      FD_SET (fileno (stdin), &rset);
       FD_SET (hd->fd, &rset);
 
+#ifndef _WIN32
+      FD_SET (fileno (stdin), &rset);
       maxfd = MAX (fileno (stdin), hd->fd);
+#else
+      maxfd = hd->fd;
+#endif
+
       tv.tv_sec = 0;
-      tv.tv_usec = 500 * 1000;
+      tv.tv_usec = 50 * 1000;
 
       if (hd->secure == 1)
         if (gnutls_record_check_pending(hd->session))
@@ -706,9 +711,18 @@ static int check_net_or_keyboard_input(socket_st* hd)
       if (FD_ISSET (hd->fd, &rset))
         return IN_NET;
 
-
+#ifdef _WIN32
+      {
+        int state;
+        state = WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 200); 
+        
+        if (state == WAIT_OBJECT_0)
+          return IN_KEYBOARD;
+      }
+#else
       if (FD_ISSET (fileno (stdin), &rset))
         return IN_KEYBOARD;
+#endif
     }
   while(err == 0);
   
@@ -1460,17 +1474,20 @@ socket_open (socket_st * hd, const char *hostname, 
const char *service)
       exit (1);
     }
 
-#ifdef IP_DONTFRAG
   if (hints.ai_socktype == SOCK_DGRAM)
     {
+#if defined(IP_DONTFRAG)
       int yes = 1;
       if (setsockopt (sd, IPPROTO_IP, IP_DONTFRAG,
-                          (const void *) &yes, sizeof (yes)) < 0)
-        {
-          perror ("setsockopt(IP_DF) failed");
-        }
-    }
+                      (const void *) &yes, sizeof (yes)) < 0)
+        perror ("setsockopt(IP_DF) failed");
+#elif defined(IP_MTU_DISCOVER)
+      int yes = IP_PMTUDISC_DO;
+      if (setsockopt(sd, IPPROTO_IP, IP_MTU_DISCOVER, 
+                     (const void*) &yes, sizeof (yes)) < 0)
+        perror ("setsockopt(IP_DF) failed");
 #endif
+    }
 
   hd->secure = 0;
   hd->fd = sd;
diff --git a/src/p11tool-gaa.c b/src/p11tool-gaa.c
index 8938e33..74ffa57 100644
--- a/src/p11tool-gaa.c
+++ b/src/p11tool-gaa.c
@@ -934,7 +934,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo 
*gaaval, char *opt_list)
                GAA_FILL(GAATMP_generate_ecc.arg1, gaa_getstr, 
GAATMP_generate_ecc.size1);
                gaa_index++;
 #line 43 "p11tool.gaa"
-{ gaaval->action = ACTION_PKCS11_GENERATE; gaaval->key_type = GNUTLS_PK_ECC; 
gaaval->pkcs11_url = GAATMP_generate_ecc.arg1; ;};
+{ gaaval->action = ACTION_PKCS11_GENERATE; gaaval->key_type = GNUTLS_PK_EC; 
gaaval->pkcs11_url = GAATMP_generate_ecc.arg1; ;};
 
                return GAA_OK;
                break;
diff --git a/src/p11tool.gaa b/src/p11tool.gaa
index 3c3cdfc..d138db0 100644
--- a/src/p11tool.gaa
+++ b/src/p11tool.gaa
@@ -40,7 +40,7 @@ option (delete) STR "URL" { $action = 
ACTION_PKCS11_DELETE_URL; $pkcs11_url = $1
 #int key_type;
 option (generate-rsa) STR "URL" { $action = ACTION_PKCS11_GENERATE; $key_type 
= GNUTLS_PK_RSA; $pkcs11_url = $1; } "Generates an RSA private key on the 
specified token."
 option (generate-dsa) STR "URL" { $action = ACTION_PKCS11_GENERATE; $key_type 
= GNUTLS_PK_DSA; $pkcs11_url = $1; } "Generates a DSA private key on the 
specified token."
-option (generate-ecc) STR "URL" { $action = ACTION_PKCS11_GENERATE; $key_type 
= GNUTLS_PK_ECC; $pkcs11_url = $1; } "Generates an ECDSA private key on the 
specified token."
+option (generate-ecc) STR "URL" { $action = ACTION_PKCS11_GENERATE; $key_type 
= GNUTLS_PK_EC; $pkcs11_url = $1; } "Generates an ECDSA private key on the 
specified token."
 
 option (label) STR "label" { $pkcs11_label = $1; } "Sets a label for the write 
operation."
 #int pkcs11_trusted;
diff --git a/src/serv.c b/src/serv.c
index 8959d7f..7aa60d0 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -81,7 +81,7 @@ char *dh_params_file;
 char *x509_crlfile = NULL;
 
 gnutls_datum_t session_ticket_key;
-static int tcp_server(const char* name, int port);
+static void tcp_server(const char* name, int port);
 
 /* end of globals */
 
@@ -692,7 +692,11 @@ listen_socket (const char *name, int listen_port, int 
socktype)
   snprintf (portname, sizeof (portname), "%d", listen_port);
   memset (&hints, 0, sizeof (hints));
   hints.ai_socktype = socktype;
-  hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
+  hints.ai_flags = AI_PASSIVE
+#ifdef AI_ADDRCONFIG
+   | AI_ADDRCONFIG
+#endif
+   ;
 
   if ((s = getaddrinfo (NULL, portname, &hints, &res)) != 0)
     {
@@ -733,18 +737,21 @@ listen_socket (const char *name, int listen_port, int 
socktype)
               continue;
             }
         }
-#ifdef IP_DONTFRAG
       else
         {
+#if defined(IP_DONTFRAG)
           yes = 1;
           if (setsockopt (s, IPPROTO_IP, IP_DONTFRAG,
                           (const void *) &yes, sizeof (yes)) < 0)
-            {
               perror ("setsockopt(IP_DF) failed");
-            }
-        }
+#elif defined(IP_MTU_DISCOVER)
+          yes = IP_PMTUDISC_DO;
+          if (setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER, 
+                         (const void*) &yes, sizeof (yes)) < 0)
+              perror ("setsockopt(IP_DF) failed");
 #endif
-      
+        }
+
       if (bind (s, ptr->ai_addr, ptr->ai_addrlen) < 0)
         {
           perror ("bind() failed");
@@ -916,13 +923,17 @@ main (int argc, char **argv)
   if (nodb == 0)
     wrap_db_init ();
 
+  if (info.udp != 0)
+    strcpy(name, "UDP ");
+  else name[0] = 0;
+
   if (http == 1)
     {
-      strcpy (name, "HTTP Server");
+      strcat (name, "HTTP Server");
     }
   else
     {
-      strcpy (name, "Echo Server");
+      strcat (name, "Echo Server");
     }
 
   gnutls_global_set_log_function (tls_log_func);
@@ -1126,12 +1137,12 @@ main (int argc, char **argv)
 #endif
 
   if (info.udp)
-    return udp_server(name, info.port, info.mtu);
+    udp_server(name, info.port, info.mtu);
   else
-    return tcp_server(name, info.port);
+    tcp_server(name, info.port);
 }
 
-static int tcp_server(const char* name, int port)
+static void tcp_server(const char* name, int port)
 {
   int n, s;
   char topbuf[512];
@@ -1517,8 +1528,6 @@ static int tcp_server(const char* name, int port)
     wrap_db_deinit ();
   gnutls_global_deinit ();
 
-  return 0;
-
 }
 
 void
diff --git a/src/udp-serv.c b/src/udp-serv.c
index b41b1ea..af033fa 100644
--- a/src/udp-serv.c
+++ b/src/udp-serv.c
@@ -50,7 +50,7 @@ static ssize_t pull_func(gnutls_transport_ptr_t p, void * 
data, size_t size);
 
 #define MAX_BUFFER 255     /* Longest string to echo */
 
-int udp_server(const char* name, int port, int mtu)
+void udp_server(const char* name, int port, int mtu)
 {
     int sock, ret;
     struct sockaddr_in cli_addr;
@@ -138,6 +138,7 @@ int udp_server(const char* name, int port, int mtu)
         if (ret < 0)
           {
             fprintf(stderr, "Error in handshake(): %s\n", 
gnutls_strerror(ret));
+            gnutls_deinit(session);
             continue;
           }
 
diff --git a/src/udp-serv.h b/src/udp-serv.h
index ce4c54d..b7e2aa7 100644
--- a/src/udp-serv.h
+++ b/src/udp-serv.h
@@ -1,6 +1,6 @@
 #include <gnutls/dtls.h>
 
-int udp_server(const char* name, int port, int mtu);
+void udp_server(const char* name, int port, int mtu);
 gnutls_session_t initialize_session (int dtls);
 const char * human_addr (const struct sockaddr *sa, socklen_t salen,
             char *buf, size_t buflen);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3a1fb0d..428a56c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -57,6 +57,7 @@ endif
 
 noinst_LTLIBRARIES = libutils.la
 libutils_la_SOURCES = utils.h utils.c
+libutils_la_LIBADD = ../gl/libgnu.la
 
 ctests = mini-deflate simple gc set_pkcs12_cred certder certuniqueid   \
         mpi certificate_set_x509_crl dn parse_ca moredn mini           \
@@ -65,7 +66,7 @@ ctests = mini-deflate simple gc set_pkcs12_cred certder 
certuniqueid  \
         crq_apis init_roundtrip pkcs12_s2k_pem dn2 mini-eagain         \
         nul-in-x509-names x509_altname pkcs12_encode mini-x509         \
         mini-x509-rehandshake rng-fork mini-eagain-dtls        \
-        x509cert x509cert-tl infoaccess
+        x509cert x509cert-tl infoaccess rsa-encrypt-decrypt
 
 if ENABLE_OCSP
 ctests += ocsp
@@ -101,6 +102,9 @@ TESTS_ENVIRONMENT =                                         
\
        PKCS12FILE_2=$(srcdir)/pkcs12-decode/pkcs12_2certs.p12  \
        PKCS12PASSWORD_2=""                                     \
        EXEEXT=$(EXEEXT)                                        \
-       srcdir="$(srcdir)"                                      \
-       $(VALGRIND)
+       srcdir="$(srcdir)"
 
+if !WINDOWS
+TESTS_ENVIRONMENT +=                                           \
+       $(VALGRIND)
+endif
diff --git a/tests/mini-deflate.c b/tests/mini-deflate.c
index 4edd4db..6364e1e 100644
--- a/tests/mini-deflate.c
+++ b/tests/mini-deflate.c
@@ -29,9 +29,11 @@
 #include <string.h>
 #include <errno.h>
 #include <gnutls/gnutls.h>
-#include "eagain-common.h"
 
-#include "utils.h"
+#ifdef HAVE_LIBZ
+
+# include "eagain-common.h"
+# include "utils.h"
 
 static void
 tls_log_func (int level, const char *str)
@@ -39,8 +41,8 @@ tls_log_func (int level, const char *str)
   fprintf (stderr, "|<%d>| %s", level, str);
 }
 
-#define MAX_BUF 6*1024
-#define MSG "Hello TLS, and Hello and Hello and Hello"
+# define MAX_BUF 6*1024
+# define MSG "Hello TLS, and Hello and Hello and Hello"
 
 void
 doit (void)
@@ -59,6 +61,7 @@ doit (void)
   char buffer[MAX_BUF + 1];
   ssize_t ns;
   int ret, transferred = 0, msglen;
+  const char * str;
 
   /* General init. */
   gnutls_global_init ();
@@ -72,7 +75,13 @@ doit (void)
   gnutls_dh_params_import_pkcs3 (dh_params, &p3, GNUTLS_X509_FMT_PEM);
   gnutls_anon_set_server_dh_params (s_anoncred, dh_params);
   gnutls_init (&server, GNUTLS_SERVER);
-  gnutls_priority_set_direct (server, 
"NONE:+VERS-TLS-ALL:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-DEFLATE:+ANON-DH", 
NULL);
+  ret = gnutls_priority_set_direct (server, 
"NONE:+VERS-TLS-ALL:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-DEFLATE:+ANON-DH", 
&str);
+  if (ret < 0) 
+    {
+      fprintf(stderr, "error at: %s\n", str);
+      exit(1);
+    }
+  
   gnutls_credentials_set (server, GNUTLS_CRD_ANON, s_anoncred);
   gnutls_dh_set_prime_bits (server, 1024);
   gnutls_transport_set_push_function (server, server_push);
@@ -82,7 +91,12 @@ doit (void)
   /* Init client */
   gnutls_anon_allocate_client_credentials (&c_anoncred);
   gnutls_init (&client, GNUTLS_CLIENT);
-  gnutls_priority_set_direct (client, 
"NONE:+VERS-TLS-ALL:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-DEFLATE:+ANON-DH", 
NULL);
+  ret = gnutls_priority_set_direct (client, 
"NONE:+VERS-TLS-ALL:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-DEFLATE:+ANON-DH", 
&str);
+  if (ret < 0) 
+    {
+      fprintf(stderr, "error at: %s\n", str);
+      exit(1);
+    }
   gnutls_credentials_set (client, GNUTLS_CRD_ANON, c_anoncred);
   gnutls_transport_set_push_function (client, client_push);
   gnutls_transport_set_pull_function (client, client_pull);
@@ -111,3 +125,10 @@ doit (void)
 
   gnutls_global_deinit ();
 }
+#else
+
+int main(int argc, char** argv)
+{
+  return 77;
+}
+#endif
diff --git a/tests/openpgp-auth2.c b/tests/openpgp-auth2.c
index 85820cc..9f3cd38 100644
--- a/tests/openpgp-auth2.c
+++ b/tests/openpgp-auth2.c
@@ -23,6 +23,8 @@
 #include <config.h>
 #endif
 
+#if !defined(_WIN32)
+
 #include <gnutls/gnutls.h>
 #include <gnutls/openpgp.h>
 
@@ -38,6 +40,7 @@
 #include <errno.h>
 #include <stdio.h>
 
+
 /* This is the same test as openpgp-auth but tests
  * openpgp under the latest TLS protocol (TLSv1.2). In
  * addition it tests DSS signatures under that.
@@ -247,3 +250,10 @@ doit ()
         fail ("child failed: %d\n", status);
     }
 }
+#else
+void
+doit ()
+{
+  exit (77);
+}
+#endif
diff --git a/tests/openpgp-certs/testselfsigs b/tests/openpgp-certs/testselfsigs
index 49d7427..7350b89 100755
--- a/tests/openpgp-certs/testselfsigs
+++ b/tests/openpgp-certs/testselfsigs
@@ -34,19 +34,19 @@ fail() {
 
 echo "Checking OpenPGP certificate self verification"
 
-($CERTTOOL --pgp-certificate-info --infile $srcdir/selfsigs/alice.pub \
+($CERTTOOL --inraw --pgp-certificate-info --infile $srcdir/selfsigs/alice.pub \
     | grep "^Self Signature verification: ok" > /dev/null) || \
     fail "Self sig Verification should have succeeded!"
 
-($CERTTOOL --pgp-certificate-info --infile 
$srcdir/selfsigs/alice-mallory-badsig18.pub \
+($CERTTOOL --inraw --pgp-certificate-info --infile 
$srcdir/selfsigs/alice-mallory-badsig18.pub \
     | grep "^Self Signature verification: failed" > /dev/null) || \
     fail "Self sig Verification should have failed!"
 
-($CERTTOOL --pgp-certificate-info --infile 
$srcdir/selfsigs/alice-mallory-irrelevantsig.pub \
+($CERTTOOL --inraw --pgp-certificate-info --infile 
$srcdir/selfsigs/alice-mallory-irrelevantsig.pub \
     | grep "^Self Signature verification: failed" >/dev/null) || \
     fail "Self sig Verification should have failed!"
 
-($CERTTOOL --pgp-certificate-info --infile 
$srcdir/selfsigs/alice-mallory-nosig18.pub \
+($CERTTOOL --inraw --pgp-certificate-info --infile 
$srcdir/selfsigs/alice-mallory-nosig18.pub \
     | grep "^Self Signature verification: failed" >/dev/null) || \
     fail "Self sig Verification should have failed!"
 
diff --git a/tests/pathlen/ca-no-pathlen.pem b/tests/pathlen/ca-no-pathlen.pem
index bbc0494..76ec72b 100644
--- a/tests/pathlen/ca-no-pathlen.pem
+++ b/tests/pathlen/ca-no-pathlen.pem
@@ -28,12 +28,22 @@ X.509 Certificate Information:
                f3:6e:7e:4c:f3:8d:ed:2a:f8:3f:39:04:ef:a4:fd:e3
                fc:cb:ba:1f:2a:1d:ad:f3:f9:68:39:f4:6d:1f:6a:15
 Other Information:
-       MD5 fingerprint:
-               5cce3c6f6ec69c724f33155a06de7322
        SHA-1 fingerprint:
                f3ddd5478b80b142200b50c9eb2ee37061b09ed6
        Public Key Id:
                f268df0e814c0302ed338e146f57421dba44f06c
+       Public key's random art:
+               +--[ RSA  512]----+
+               |.o..+o...        |
+               | ...+o.o         |
+               | .o  E=          |
+               | .+oo+.o         |
+               |.o.o..+ S        |
+               |. .    + .       |
+               |      o o        |
+               |     . . o       |
+               |        ..o      |
+               +-----------------+
 
 -----BEGIN CERTIFICATE-----
 MIIBYDCCAQygAwIBAgIBADALBgkqhkiG9w0BAQUwIjEgMB4GA1UEChMXR251VExT
diff --git a/tests/pathlen/no-ca-or-pathlen.pem 
b/tests/pathlen/no-ca-or-pathlen.pem
index 9581eb2..086feb4 100644
--- a/tests/pathlen/no-ca-or-pathlen.pem
+++ b/tests/pathlen/no-ca-or-pathlen.pem
@@ -46,12 +46,22 @@ warning: signed using a broken signature algorithm that can 
be forged.
                59:0c:44:ca:ce:ad:77:24:52:b4:78:5f:cc:4f:15:a7
                8f:20:81:56:65:08:50:37:75:bc:a2:11:82:72:48:76
 Other Information:
-       MD5 fingerprint:
-               7c0ac198038b55033b4ea8b14cccc540
        SHA-1 fingerprint:
                8f735c5ddefd723f59b6a3bb2ac0522470c0182f
        Public Key Id:
                1e09d707d4e3651b84dcb6c68a828d2affef7ec3
+       Public key's random art:
+               +--[ RSA 1024]----+
+               |         .oo +.  |
+               |         . .= *  |
+               |      . . ...* + |
+               |       o . .. =  |
+               |       +S  . o   |
+               |      o.o.. .    |
+               |     .  .o       |
+               |  . .     E      |
+               |   o...++. .     |
+               +-----------------+
 
 -----BEGIN CERTIFICATE-----
 MIIEhDCCA+2gAwIBAgIQLhA3A99GhZ16VQ2mWWGFODANBgkqhkiG9w0BAQQFADCB
diff --git a/tests/pgps2kgnu.c b/tests/pgps2kgnu.c
index f4ea214..b67e7eb 100644
--- a/tests/pgps2kgnu.c
+++ b/tests/pgps2kgnu.c
@@ -68,14 +68,26 @@ static char dummy_key[] =
         http://lists.gnu.org/archive/html/gnutls-devel/2008-08/msg00023.html
 */
 
+static void
+tls_log_func (int level, const char *str)
+{
+  fprintf (stderr, "|<%d>| %s", level, str);
+}
+
 int
-main (void)
+main (int argc, char** argv)
 {
   int rc;
   gnutls_datum_t keydatum =
     { (unsigned char *) dummy_key, strlen (dummy_key) };
   gnutls_openpgp_privkey_t key;
 
+  if (argc > 1)
+    {
+      gnutls_global_set_log_function (tls_log_func);
+      gnutls_global_set_log_level (9);
+    }
+
   rc = gnutls_global_init ();
   if (rc)
     {
diff --git a/tests/x509sign-verify.c b/tests/rsa-encrypt-decrypt.c
similarity index 57%
copy from tests/x509sign-verify.c
copy to tests/rsa-encrypt-decrypt.c
index cecff55..b17b38e 100644
--- a/tests/x509sign-verify.c
+++ b/tests/rsa-encrypt-decrypt.c
@@ -49,16 +49,9 @@ const gnutls_datum_t hash_data = {
   20
 };
 
-const gnutls_datum_t invalid_hash_data = {
-  (void *)
-    "\xaa\xf4\xc6\x1d\xdc\xca\xe8\xa2\xda\xbe"
-    "\xde\x0f\x3b\x48\x2c\xb9\xae\xa9\x43\x4d",
-  20
-};
-
 const gnutls_datum_t raw_data = {
-  (void *) "hello",
-  5
+  (void *) "hello there",
+  11
 };
 
 static char pem1_cert[] =
@@ -93,51 +86,12 @@ static char pem1_key[] =
   "sWZGfbnU3ryjvkb6YuFjgtzbZDZHWQCo8/cOtOBmPdk=\n"
   "-----END RSA PRIVATE KEY-----\n";
 
-static char pem2_cert[] =
-  "-----BEGIN CERTIFICATE-----\n"
-  "MIIDbzCCAtqgAwIBAgIERiYdRTALBgkqhkiG9w0BAQUwGTEXMBUGA1UEAxMOR251\n"
-  "VExTIHRlc3QgQ0EwHhcNMDcwNDE4MTMyOTQxWhcNMDgwNDE3MTMyOTQxWjA3MRsw\n"
-  "GQYDVQQKExJHbnVUTFMgdGVzdCBzZXJ2ZXIxGDAWBgNVBAMTD3Rlc3QuZ251dGxz\n"
-  "Lm9yZzCCAbQwggEpBgcqhkjOOAQBMIIBHAKBgLmE9VqBvhoNxYpzjwybL5u2DkvD\n"
-  "dBp/ZK2d8yjFoEe8m1dW8ZfVfjcD6fJM9OOLfzCjXS+7oaI3wuo1jx+xX6aiXwHx\n"
-  "IzYr5E8vLd2d1TqmOa96UXzSJY6XdM8exXtLdkOBBx8GFLhuWBLhkOI3b9Ib7GjF\n"
-  "WOLmMOBqXixjeOwHAhSfVoxIZC/+jap6bZbbBF0W7wilcQKBgGIGfuRcdgi3Rhpd\n"
-  "15fUKiH7HzHJ0vT6Odgn0Zv8J12nCqca/FPBL0PCN8iFfz1Mq12BMvsdXh5UERYg\n"
-  "xoBa2YybQ/Dda6D0w/KKnDnSHHsP7/ook4/SoSLr3OCKi60oDs/vCYXpNr2LelDV\n"
-  "e/clDWxgEcTvcJDP1hvru47GPjqXA4GEAAKBgA+Kh1fy0cLcrN9Liw+Luin34QPk\n"
-  "VfqymAfW/RKxgLz1urRQ1H+gDkPnn8l4EV/l5Awsa2qkNdy9VOVgNpox0YpZbmsc\n"
-  "ur0uuut8h+/ayN2h66SD5out+vqOW9c3yDI+lsI+9EPafZECD7e8+O+P90EAXpbf\n"
-  "DwiW3Oqy6QaCr9Ivo4GTMIGQMAwGA1UdEwEB/wQCMAAwGgYDVR0RBBMwEYIPdGVz\n"
-  "dC5nbnV0bHMub3JnMBMGA1UdJQQMMAoGCCsGAQUFBwMBMA8GA1UdDwEB/wQFAwMH\n"
-  "gAAwHQYDVR0OBBYEFL/su87Y6HtwVuzz0SuS1tSZClvzMB8GA1UdIwQYMBaAFOk8\n"
-  "HPutkm7mBqRWLKLhwFMnyPKVMAsGCSqGSIb3DQEBBQOBgQBCsrnfD1xzh8/Eih1f\n"
-  "x+M0lPoX1Re5L2ElHI6DJpHYOBPwf9glwxnet2+avzgUQDUFwUSxOhodpyeaACXD\n"
-  "o0gGVpcH8sOBTQ+aTdM37hGkPxoXjtIkR/LgG5nP2H2JRd5TkW8l13JdM4MJFB4W\n"
-  "QcDzQ8REwidsfh9uKAluk1c/KQ==\n" "-----END CERTIFICATE-----\n";
-
-static char pem2_key[] =
-  "-----BEGIN DSA PRIVATE KEY-----\n"
-  "MIIBugIBAAKBgQC5hPVagb4aDcWKc48Mmy+btg5Lw3Qaf2StnfMoxaBHvJtXVvGX\n"
-  "1X43A+nyTPTji38wo10vu6GiN8LqNY8fsV+mol8B8SM2K+RPLy3dndU6pjmvelF8\n"
-  "0iWOl3TPHsV7S3ZDgQcfBhS4blgS4ZDiN2/SG+xoxVji5jDgal4sY3jsBwIVAJ9W\n"
-  "jEhkL/6NqnptltsEXRbvCKVxAoGAYgZ+5Fx2CLdGGl3Xl9QqIfsfMcnS9Po52CfR\n"
-  "m/wnXacKpxr8U8EvQ8I3yIV/PUyrXYEy+x1eHlQRFiDGgFrZjJtD8N1roPTD8oqc\n"
-  "OdIcew/v+iiTj9KhIuvc4IqLrSgOz+8Jhek2vYt6UNV79yUNbGARxO9wkM/WG+u7\n"
-  "jsY+OpcCgYAPiodX8tHC3KzfS4sPi7op9+ED5FX6spgH1v0SsYC89bq0UNR/oA5D\n"
-  "55/JeBFf5eQMLGtqpDXcvVTlYDaaMdGKWW5rHLq9LrrrfIfv2sjdoeukg+aLrfr6\n"
-  "jlvXN8gyPpbCPvRD2n2RAg+3vPjvj/dBAF6W3w8IltzqsukGgq/SLwIUS5/r/2ya\n"
-  "AoNBXjeBjgCGMei2m8E=\n" "-----END DSA PRIVATE KEY-----\n";
-
 const gnutls_datum_t cert_dat[] = {
   {pem1_cert, sizeof (pem1_cert)}
-  ,
-  {pem2_cert, sizeof (pem2_cert)}
 };
 
 const gnutls_datum_t key_dat[] = {
   {pem1_key, sizeof (pem1_key)}
-  ,
-  {pem2_key, sizeof (pem2_key)}
 };
 
 void
@@ -147,9 +101,7 @@ doit (void)
   gnutls_x509_crt_t crt;
   gnutls_pubkey_t pubkey;
   gnutls_privkey_t privkey;
-  gnutls_digest_algorithm_t hash_algo;
-  gnutls_datum_t signature;
-  gnutls_datum_t signature2;
+  gnutls_datum_t out, out2;
   int ret;
   size_t i;
 
@@ -181,16 +133,6 @@ doit (void)
       if (ret < 0)
         fail ("gnutls_privkey_import_x509\n");
 
-      ret = gnutls_privkey_sign_hash (privkey, GNUTLS_DIG_SHA1, 0,
-                                     &hash_data, &signature2);
-      if (ret < 0)
-        fail ("gnutls_privkey_sign_hash\n");
-
-      ret = gnutls_privkey_sign_data (privkey, GNUTLS_DIG_SHA1, 0,
-                                     &raw_data, &signature);
-      if (ret < 0)
-        fail ("gnutls_x509_privkey_sign_hash\n");
-
       ret = gnutls_x509_crt_init (&crt);
       if (ret < 0)
         fail ("gnutls_x509_crt_init\n");
@@ -204,32 +146,45 @@ doit (void)
       if (ret < 0)
         fail ("gnutls_x509_pubkey_import\n");
 
-      ret =
-        gnutls_pubkey_get_verify_algorithm (pubkey, &signature, &hash_algo);
-      if (ret < 0 || hash_algo != GNUTLS_DIG_SHA1)
-        fail ("gnutls_x509_crt_get_verify_algorithm\n");
 
-      ret = gnutls_pubkey_verify_hash (pubkey, 0, &hash_data, &signature);
+      ret = gnutls_pubkey_encrypt_data(pubkey, 0, &hash_data, &out);
       if (ret < 0)
-        fail ("gnutls_x509_privkey_verify_hash\n");
+        fail ("gnutls_pubkey_encrypt_data\n");
 
-      ret =
-        gnutls_pubkey_get_verify_algorithm (pubkey, &signature2, &hash_algo);
-      if (ret < 0 || hash_algo != GNUTLS_DIG_SHA1)
-        fail ("gnutls_x509_crt_get_verify_algorithm (hashed data)\n");
 
-      ret = gnutls_pubkey_verify_hash (pubkey, 0, &hash_data, &signature2);
+      ret = gnutls_privkey_decrypt_data (privkey, 0,
+                                     &out, &out2);
+      if (ret < 0)
+        fail ("gnutls_privkey_decrypt_data\n");
+
+      if (out2.size != hash_data.size)
+        fail ("Decrypted data don't match original (1)\n");
+
+      if (memcmp(out2.data, hash_data.data, hash_data.size) != 0)
+        fail ("Decrypted data don't match original (2)\n");
+
+      gnutls_free(out.data);
+      gnutls_free(out2.data);
+
+      ret = gnutls_pubkey_encrypt_data(pubkey, 0, &raw_data, &out);
       if (ret < 0)
-        fail ("gnutls_x509_privkey_verify_hash (hashed data)\n");
+        fail ("gnutls_pubkey_encrypt_data\n");
+
+      ret = gnutls_privkey_decrypt_data (privkey, 0,
+                                     &out, &out2);
+      if (ret < 0)
+        fail ("gnutls_privkey_decrypt_data\n");
+
+      if (out2.size != raw_data.size)
+        fail ("Decrypted data don't match original (3)\n");
 
-      /* should fail */
-      ret = gnutls_pubkey_verify_hash (pubkey, 0, &invalid_hash_data, 
&signature2);
-      if (ret != GNUTLS_E_PK_SIG_VERIFY_FAILED)
-        fail ("gnutls_x509_privkey_verify_hash (hashed data)\n");
+      if (memcmp(out2.data, raw_data.data, raw_data.size) != 0)
+        fail ("Decrypted data don't match original (4)\n");
 
+      if (debug) success("ok\n");
 
-      gnutls_free(signature.data);
-      gnutls_free(signature2.data);
+      gnutls_free(out.data);
+      gnutls_free(out2.data);
       gnutls_x509_privkey_deinit (key);
       gnutls_x509_crt_deinit (crt);
       gnutls_privkey_deinit (privkey);
diff --git a/tests/slow/Makefile.am b/tests/slow/Makefile.am
index c8d93dc..8e321ac 100644
--- a/tests/slow/Makefile.am
+++ b/tests/slow/Makefile.am
@@ -18,8 +18,7 @@
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/lib/includes            \
+AM_CPPFLAGS = -I$(top_srcdir)/lib/includes             \
        -I$(top_builddir)/lib/includes \
        -I$(top_srcdir)/tests/
 
diff --git a/tests/slow/gendh.c b/tests/slow/gendh.c
index e3732bb..d29e876 100644
--- a/tests/slow/gendh.c
+++ b/tests/slow/gendh.c
@@ -43,6 +43,10 @@ doit (void)
 
   if (gnutls_dh_params_generate2 (dh_params, 1024) < 0)
     fail ("Error in prime generation\n");
+    
+  gnutls_dh_params_deinit(dh_params);
+  
+  gnutls_global_deinit();
 
-  success ("generated DH params OK\n");
+  if (debug) success ("generated DH params OK\n");
 }
diff --git a/tests/slow/keygen.c b/tests/slow/keygen.c
index 3b95479..c398abc 100644
--- a/tests/slow/keygen.c
+++ b/tests/slow/keygen.c
@@ -59,7 +59,7 @@ doit (void)
 
     for (i = 0; i < MAX_TRIES; i++)
       {
-          for (algorithm = GNUTLS_PK_RSA; algorithm <= GNUTLS_PK_ECC;
+          for (algorithm = GNUTLS_PK_RSA; algorithm <= GNUTLS_PK_EC;
                algorithm++)
             {
                 if (algorithm == GNUTLS_PK_DH)


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]