From 0f4eefb09464828ce07ad5b8763423e0d1d68e61 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 15 Mar 2010 13:08:51 +0000 Subject: [PATCH] Builds again for W32. --- autogen.sh | 3 ++- common/ChangeLog | 9 +++++++++ common/localename.c | 3 ++- common/logging.c | 18 +++++++++++++++--- common/util.h | 5 ----- common/w32-afunix.c | 11 +++++------ tools/ChangeLog | 5 +++++ tools/gpgconf-comp.c | 2 +- 8 files changed, 39 insertions(+), 17 deletions(-) diff --git a/autogen.sh b/autogen.sh index 2edbababb..f7bab4a25 100755 --- a/autogen.sh +++ b/autogen.sh @@ -123,7 +123,8 @@ if [ "$myhost" = "w32" ]; then --with-zlib=${w32root} \ --with-regex=${w32root} \ --with-pth-prefix=${w32root} \ - --with-adns=${w32root} "$@" + --with-adns=${w32root} \ + --disable-g13 "$@" rc=$? exit $rc fi diff --git a/common/ChangeLog b/common/ChangeLog index d9ff6a729..c42c1f563 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,12 @@ +2010-03-15 Werner Koch + + * logging.c (S_IRGRP, S_IROTH, S_IWGRP, S_IWOTH) [W32]: New. + (fun_writer, set_file_fd) [W32]: Disable socket code. + + * localename.c: Include gpg-error.h. + + * util.h (GPG_ERR_NOT_ENABLED): Remove this temporary definition. + 2010-03-12 Werner Koch * status.h (STATUS_ENTER): New. diff --git a/common/localename.c b/common/localename.c index 5c46ddd34..8f7774880 100644 --- a/common/localename.c +++ b/common/localename.c @@ -29,6 +29,7 @@ #ifdef HAVE_LOCALE_H #include #endif +#include /* We need gettext_localename for W32. */ #include "../common/w32help.h" @@ -101,7 +102,7 @@ gnupg_messages_locale_name (void) const char *s; #ifdef HAVE_W32_SYSTEM - /* We use the localname function from ../common/w32-gettext.c. */ + /* We use the localename function libgpg-error. */ s = gettext_localename (); #else s = do_nl_locale_name (LC_MESSAGES, "LC_MESSAGES"); diff --git a/common/logging.c b/common/logging.c index 6bc35eee5..bf47015e7 100644 --- a/common/logging.c +++ b/common/logging.c @@ -30,19 +30,27 @@ #include #include #ifndef HAVE_W32_SYSTEM -#include -#include -#endif /*!HAVE_W32_SYSTEM*/ +# include +# include +#endif /*HAVE_W32_SYSTEM*/ #include #include #include + #define JNLIB_NEED_LOG_LOGV 1 #define JNLIB_NEED_AFLOCAL 1 #include "libjnlib-config.h" #include "logging.h" +#ifdef HAVE_W32_SYSTEM +# define S_IRGRP S_IRUSR +# define S_IROTH S_IRUSR +# define S_IWGRP S_IWUSR +# define S_IWOTH S_IWUSR +#endif + static estream_t logstream; static int log_socket = -1; @@ -121,6 +129,7 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size) processes often close stderr and by writing to file descriptor 2 we might send the log message to a file not intended for logging (e.g. a pipe or network connection). */ +#ifndef HAVE_W32_SYSTEM if (cookie->want_socket && cookie->fd == -1) { /* Not yet open or meanwhile closed due to an error. */ @@ -177,6 +186,7 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size) cookie->is_socket = 1; } } +#endif /*HAVE_W32_SYSTEM*/ log_socket = cookie->fd; if (cookie->fd != -1 && !writen (cookie->fd, buffer, size)) @@ -239,6 +249,7 @@ set_file_fd (const char *name, int fd) fd = fileno (stderr); } +#ifndef HAVE_W32_SYSTEM if (name) { want_socket = (!strncmp (name, "socket://", 9) && name[9]); @@ -246,6 +257,7 @@ set_file_fd (const char *name, int fd) name += 9; } else +#endif /*HAVE_W32_SYSTEM*/ { want_socket = 0; } diff --git a/common/util.h b/common/util.h index 6deee38e1..4c566bcae 100644 --- a/common/util.h +++ b/common/util.h @@ -25,11 +25,6 @@ #include /* We need errno. */ #include /* We need gpg_error_t. */ -/* Add error codes available only in newer versions of libgpg-error. */ -#ifndef GPG_ERR_NOT_ENABLED -#define GPG_ERR_NOT_ENABLED 179 -#endif - /* Hash function used with libksba. */ #define HASH_FNC ((void (*)(void *, const void*,size_t))gcry_md_write) diff --git a/common/w32-afunix.c b/common/w32-afunix.c index 579621491..920561b92 100644 --- a/common/w32-afunix.c +++ b/common/w32-afunix.c @@ -17,7 +17,7 @@ * License along with this program; if not, see . */ -/* Use of this code is preprecated - you better use the sockt wrappers +/* Use of this code is deprecated - you better use the socket wrappers from libassuan. */ #ifdef _WIN32 @@ -51,15 +51,14 @@ read_port_and_nonce (const char *fname, unsigned short *port, char *nonce) fclose (fp); if (!nread) { -#warning remove this file - jnlib_set_errno (EIO); + gpg_err_set_errno (EIO); return -1; } buffer[nread] = 0; aval = atoi (buffer); if (aval < 1 || aval > 65535) { - jnlib_set_errno (EINVAL); + gpg_err_set_errno (EINVAL); return -1; } *port = (unsigned int)aval; @@ -67,7 +66,7 @@ read_port_and_nonce (const char *fname, unsigned short *port, char *nonce) ; if (*p != '\n' || nread != 17) { - jnlib_set_errno (EINVAL); + gpg_err_set_errno (EINVAL); return -1; } p++; nread--; @@ -127,7 +126,7 @@ _w32_sock_connect (int sockfd, struct sockaddr *addr, int addrlen) ret = send (sockfd, nonce, 16, 0); if (ret >= 0 && ret != 16) { - jnlib_set_errno (EIO); + gpg_err_set_errno (EIO); ret = -1; } } diff --git a/tools/ChangeLog b/tools/ChangeLog index 048c1685a..b9e486b2b 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,8 @@ +2010-03-15 Werner Koch + + * gpgconf-comp.c (my_dgettext): + s/gettext_select_utf8/gettext_use_utf8/. + 2010-03-10 Werner Koch * Makefile.am (common_libs): Remove libjnlib.a. diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index f8de9d650..866646d0d 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -1144,7 +1144,7 @@ my_dgettext (const char *domain, const char *msgid) if (!switched_codeset) { switched_codeset = 1; - gettext_select_utf8 (1); + gettext_use_utf8 (1); } if (!strcmp (domain, "gnupg"))