mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-21 19:48:05 +01:00
* dotlock.c, http.c, iobuf.c, simple-gettext.c, srv.c, srv.h, strgutil.c,
ttyio.c, w32reg.c: s/__MINGW32__/_WIN32/ to help building on native Windows compilers. Requested by Brian Gladman. From Werner on stable branch. * http.c (connect_server): Oops - forgot to freeaddrinfo().
This commit is contained in:
parent
2d682ddc00
commit
cd06705184
@ -1,3 +1,12 @@
|
||||
2003-08-28 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* dotlock.c, http.c, iobuf.c, simple-gettext.c, srv.c, srv.h,
|
||||
strgutil.c, ttyio.c, w32reg.c: s/__MINGW32__/_WIN32/ to help
|
||||
building on native Windows compilers. Requested by Brian Gladman.
|
||||
From Werner on stable branch.
|
||||
|
||||
* http.c (connect_server): Oops - forgot to freeaddrinfo().
|
||||
|
||||
2003-08-24 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* http.c (connect_server): Try and use getaddrinfo if it is
|
||||
|
@ -29,7 +29,9 @@
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
|
17
util/http.c
17
util/http.c
@ -26,7 +26,7 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
@ -53,7 +53,7 @@
|
||||
#define HTTP_PROXY_ENV_PRINTABLE "$http_proxy"
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
#define sock_close(a) closesocket(a)
|
||||
#else
|
||||
#define sock_close(a) close(a)
|
||||
@ -83,7 +83,7 @@ static int parse_response( HTTP_HD hd );
|
||||
static int connect_server(const char *server, ushort port, unsigned int flags);
|
||||
static int write_server( int sock, const char *data, size_t length );
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
static void
|
||||
deinit_sockets (void)
|
||||
{
|
||||
@ -113,7 +113,7 @@ init_sockets (void)
|
||||
atexit ( deinit_sockets );
|
||||
initialized = 1;
|
||||
}
|
||||
#endif /*__MINGW32__*/
|
||||
#endif /*_WIN32*/
|
||||
|
||||
|
||||
int
|
||||
@ -713,7 +713,7 @@ connect_server( const char *server, ushort port, unsigned int flags )
|
||||
int sock=-1,srv,srvcount=0,connected=0;
|
||||
struct srventry *srvlist=NULL;
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
in_addr_t inaddr;
|
||||
#warning check the windoze type
|
||||
|
||||
@ -787,6 +787,7 @@ connect_server( const char *server, ushort port, unsigned int flags )
|
||||
if((sock=socket(ai->ai_family,ai->ai_socktype,ai->ai_protocol))==-1)
|
||||
{
|
||||
log_error("error creating socket: %s\n",strerror(errno));
|
||||
freeaddrinfo(res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -797,6 +798,8 @@ connect_server( const char *server, ushort port, unsigned int flags )
|
||||
}
|
||||
}
|
||||
|
||||
freeaddrinfo(res);
|
||||
|
||||
if(ai)
|
||||
break;
|
||||
}
|
||||
@ -846,7 +849,7 @@ connect_server( const char *server, ushort port, unsigned int flags )
|
||||
|
||||
if(!connected)
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
log_error("%s: host not found: ec=%d\n",server,(int)WSAGetLastError());
|
||||
#else
|
||||
log_error("%s: host not found\n",server);
|
||||
@ -867,7 +870,7 @@ write_server( int sock, const char *data, size_t length )
|
||||
|
||||
nleft = length;
|
||||
while( nleft > 0 ) {
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
int nwritten;
|
||||
|
||||
nwritten = send (sock, data, nleft, 0);
|
||||
|
20
util/iobuf.c
20
util/iobuf.c
@ -1,5 +1,5 @@
|
||||
/* iobuf.c - file handling
|
||||
* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
@ -96,7 +96,7 @@ typedef struct {
|
||||
static CLOSE_CACHE close_cache;
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
typedef struct {
|
||||
int sock;
|
||||
int keep_open;
|
||||
@ -105,7 +105,7 @@ typedef struct {
|
||||
int print_only_name; /* flags indicating that fname is not a real file*/
|
||||
char fname[1]; /* name of the file */
|
||||
} sock_filter_ctx_t ;
|
||||
#endif /*__MINGW32__*/
|
||||
#endif /*_WIN32*/
|
||||
|
||||
/* The first partial length header block must be of size 512
|
||||
* to make it easier (and efficienter) we use a min. block size of 512
|
||||
@ -515,7 +515,7 @@ file_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
/* Becuase sockets are an special object under Lose32 we have to
|
||||
* use a special filter */
|
||||
static int
|
||||
@ -587,7 +587,7 @@ sock_filter (void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif /*__MINGW32__*/
|
||||
#endif /*_WIN32*/
|
||||
|
||||
/****************
|
||||
* This is used to implement the block write mode.
|
||||
@ -1122,7 +1122,7 @@ IOBUF
|
||||
iobuf_sockopen ( int fd, const char *mode )
|
||||
{
|
||||
IOBUF a;
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
sock_filter_ctx_t *scx;
|
||||
size_t len;
|
||||
|
||||
@ -1261,7 +1261,7 @@ iobuf_ioctl ( IOBUF a, int cmd, int intval, void *ptrval )
|
||||
b->keep_open = intval;
|
||||
return 0;
|
||||
}
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
else if( !a->chain && a->filter == sock_filter ) {
|
||||
sock_filter_ctx_t *b = a->filter_ov;
|
||||
b->keep_open = intval;
|
||||
@ -1290,7 +1290,7 @@ iobuf_ioctl ( IOBUF a, int cmd, int intval, void *ptrval )
|
||||
b->no_cache = intval;
|
||||
return 0;
|
||||
}
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
else if( !a->chain && a->filter == sock_filter ) {
|
||||
sock_filter_ctx_t *b = a->filter_ov;
|
||||
b->no_cache = intval;
|
||||
@ -2141,7 +2141,7 @@ iobuf_read_line( IOBUF a, byte **addr_of_buffer,
|
||||
int
|
||||
iobuf_translate_file_handle ( int fd, int for_write )
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
{
|
||||
int x;
|
||||
|
||||
@ -2164,7 +2164,7 @@ iobuf_translate_file_handle ( int fd, int for_write )
|
||||
static int
|
||||
translate_file_handle ( int fd, int for_write )
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
#ifdef FILE_FILTER_USES_STDIO
|
||||
fd = iobuf_translate_file_handle (fd, for_write);
|
||||
#else
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#include <config.h>
|
||||
#ifdef USE_SIMPLE_GETTEXT
|
||||
#if !defined (__MINGW32__) && !defined (__CYGWIN32__)
|
||||
#error This file can only be used with MingW32 or Cygwin32
|
||||
#if !defined (_WIN32) && !defined (__CYGWIN32__)
|
||||
#error This file can only be used udner Windows or Cygwin32
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#ifdef USE_DNS_SRV
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef _SRV_H_
|
||||
#define _SRV_H_
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
|
@ -860,7 +860,7 @@ strncasecmp( const char *a, const char *b, size_t n )
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Like vsprintf but provides a pointer to malloc'd storage, which
|
||||
* must be freed by the caller (m_free). Taken from libiberty as
|
||||
@ -954,5 +954,4 @@ vasprintf ( char **result, const char *format, va_list args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /*__MINGW32__*/
|
||||
|
||||
#endif /*_WIN32*/
|
||||
|
20
util/ttyio.c
20
util/ttyio.c
@ -37,10 +37,10 @@
|
||||
#define HAVE_TCGETATTR
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __MINGW32__ /* use the odd Win32 functions */
|
||||
#ifdef _WIN32 /* use the odd Win32 functions */
|
||||
#include <windows.h>
|
||||
#ifdef HAVE_TCGETATTR
|
||||
#error mingw32 and termios
|
||||
#error windows and termios
|
||||
#endif
|
||||
#endif
|
||||
#include <errno.h>
|
||||
@ -51,7 +51,7 @@
|
||||
|
||||
#define CONTROL_D ('D' - 'A' + 1)
|
||||
|
||||
#ifdef __MINGW32__ /* use the odd Win32 functions */
|
||||
#ifdef _WIN32 /* use the odd Win32 functions */
|
||||
static struct {
|
||||
HANDLE in, out;
|
||||
} con;
|
||||
@ -99,8 +99,8 @@ tty_get_ttyname (void)
|
||||
got_name = 1;
|
||||
}
|
||||
#endif
|
||||
/* Assume the staandrd tty on memory error or when tehre is no
|
||||
certmid. */
|
||||
/* Assume the standard tty on memory error or when there is no
|
||||
ctermid. */
|
||||
return name? name : "/dev/tty";
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ init_ttyfp(void)
|
||||
if( initialized )
|
||||
return;
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#if defined(_WIN32)
|
||||
{
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
|
||||
@ -192,7 +192,7 @@ tty_printf( const char *fmt, ... )
|
||||
init_ttyfp();
|
||||
|
||||
va_start( arg_ptr, fmt ) ;
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
{
|
||||
char *buf = NULL;
|
||||
int n;
|
||||
@ -229,7 +229,7 @@ tty_print_string( byte *p, size_t n )
|
||||
if( !initialized )
|
||||
init_ttyfp();
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
/* not so effective, change it if you want */
|
||||
for( ; n; n--, p++ )
|
||||
if( iscntrl( *p ) ) {
|
||||
@ -323,7 +323,7 @@ do_get( const char *prompt, int hidden )
|
||||
buf = m_alloc(n=50);
|
||||
i = 0;
|
||||
|
||||
#ifdef __MINGW32__ /* windoze version */
|
||||
#ifdef _WIN32 /* windoze version */
|
||||
if( hidden )
|
||||
SetConsoleMode(con.in, HID_INPMODE );
|
||||
|
||||
@ -478,7 +478,7 @@ tty_kill_prompt()
|
||||
last_prompt_len = 0;
|
||||
if( !last_prompt_len )
|
||||
return;
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
tty_printf("\r%*s\r", last_prompt_len, "");
|
||||
#else
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#if defined (__MINGW32__) || defined (__CYGWIN32__)
|
||||
#if defined (_WIN32) || defined (__CYGWIN32__)
|
||||
/* This module is only used in this environment */
|
||||
|
||||
#include <stdio.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user