diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 125a2110..385b8186 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,7 @@ +2005-09-13 Werner Koch + + * ath.c: Changes to make it work under W32. + 2005-09-12 Marcus Brinkmann * Makefile.am (libgpgme_la_SOURCES): Set to ath.h and ath.c. @@ -16,6 +20,10 @@ * keylist.c (release_op_data): Do not free opd->tmp_uid. +2005-09-07 Werner Koch + + * w32-io.c (build_commandline): Quote argv[0]. + 2005-08-26 Marcus Brinkmann * rungpg.c (command_handler): Use _gpgme_io_write instead of write. diff --git a/gpgme/ath.c b/gpgme/ath.c index 71382b3c..dda7c318 100644 --- a/gpgme/ath.c +++ b/gpgme/ath.c @@ -30,7 +30,9 @@ # include #endif #include +#ifndef HAVE_W32_SYSTEM #include +#endif #include "ath.h" @@ -104,40 +106,64 @@ ssize_t ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, struct timeval *timeout) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return select (nfd, rset, wset, eset, timeout); +#endif } ssize_t ath_waitpid (pid_t pid, int *status, int options) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return waitpid (pid, status, options); +#endif } int ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return accept (s, addr, length_ptr); +#endif } int ath_connect (int s, const struct sockaddr *addr, socklen_t length) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return connect (s, addr, length); +#endif } int ath_sendmsg (int s, const struct msghdr *msg, int flags) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return sendmsg (s, msg, flags); +#endif } int ath_recvmsg (int s, struct msghdr *msg, int flags) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return recvmsg (s, msg, flags); +#endif } diff --git a/gpgme/w32-io.c b/gpgme/w32-io.c index 94f0a06a..ae09d9ce 100644 --- a/gpgme/w32-io.c +++ b/gpgme/w32-io.c @@ -762,27 +762,36 @@ _gpgme_io_set_nonblocking ( int fd ) static char * build_commandline ( char **argv ) { - int i, n = 0; - char *buf, *p; - - /* FIXME: we have to quote some things because under Windows the - * program parses the commandline and does some unquoting */ - for (i=0; argv[i]; i++) - n += strlen (argv[i]) + 2 + 1; /* 2 extra bytes for possible quoting */ - buf = p = malloc (n); - if ( !buf ) - return NULL; - *buf = 0; - if ( argv[0] ) + int i, n = 0; + char *buf, *p; + + /* FIXME: we have to quote some things because under Windows the + * program parses the commandline and does some unquoting. For now + * we only do very basic quoting to the first argument because this + * one often contains a space (e.g. C:\\Program Files\GNU\GnuPG\gpg.exe) + * and we would produce an invalid line in that case. */ + for (i=0; argv[i]; i++) + n += strlen (argv[i]) + 2 + 1; /* 2 extra bytes for possible quoting */ + buf = p = malloc (n); + if ( !buf ) + return NULL; + *buf = 0; + if ( argv[0] ) + { + if (strpbrk (argv[0], " \t")) + p = stpcpy (stpcpy (stpcpy (p, "\""), argv[0]), "\""); + else p = stpcpy (p, argv[0]); - for (i = 1; argv[i]; i++) { - if (!*argv[i]) + for (i = 1; argv[i]; i++) + { + if (!*argv[i]) p = stpcpy (p, " \"\""); - else + else p = stpcpy (stpcpy (p, " "), argv[i]); + } } - - return buf; + + return buf; }