1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Consequences of Simon's recent deglobalisation changes.

[originally from svn r2573]
This commit is contained in:
Ben Harris 2003-01-12 16:11:27 +00:00
parent 6fbf5d8540
commit b4d37df579
7 changed files with 39 additions and 37 deletions

View File

@ -1,4 +1,4 @@
/* $Id: mac.c,v 1.26 2003/01/12 14:45:33 ben Exp $ */
/* $Id: mac.c,v 1.27 2003/01/12 16:11:27 ben Exp $ */
/*
* Copyright (c) 1999 Ben Harris
* All rights reserved.
@ -204,14 +204,6 @@ static void mac_startup(void) {
default_port = DEFAULT_PORT;
flags = FLAG_INTERACTIVE;
/*
* Really grotty hack to ensure that anything that looks at the
* global "cfg" variable gets something vaguely sensible.
* Obviously, nothing should actually be using it, but that will
* take a while to arrange.
*/
do_defaults(NULL, &cfg);
{
short vol;
long dirid;

View File

@ -97,8 +97,8 @@ extern void init_ucs(void);
extern OSErr mactcp_init(void);
extern void mactcp_cleanup(void);
extern void mactcp_poll(void);
extern SockAddr mactcp_namelookup(char *, char **);
extern SockAddr mactcp_nonamelookup(char *);
extern SockAddr mactcp_namelookup(char const *, char **);
extern SockAddr mactcp_nonamelookup(char const *);
extern void mactcp_getaddr(SockAddr, char *, int);
extern int mactcp_hostname_is_local(char *);
extern int mactcp_address_is_local(SockAddr);
@ -113,8 +113,8 @@ extern char *mactcp_addr_error(SockAddr);
extern OSErr ot_init(void);
extern void ot_cleanup(void);
extern void ot_poll(void);
extern SockAddr ot_namelookup(char *, char **);
extern SockAddr ot_nonamelookup(char *);
extern SockAddr ot_namelookup(char const *, char **);
extern SockAddr ot_nonamelookup(char const *);
extern void ot_getaddr(SockAddr, char *, int);
extern int ot_hostname_is_local(char *);
extern int ot_address_is_local(SockAddr);

View File

@ -6,7 +6,7 @@
* Network functions exported to the world. These choose whether to call
* MacTCP or OpenTransport and behave accordingly.
*/
SockAddr sk_namelookup(char *host, char **canonicalname)
SockAddr sk_namelookup(char const *host, char **canonicalname)
{
if (mac_gestalts.otptattr != 0)
@ -17,7 +17,7 @@ SockAddr sk_namelookup(char *host, char **canonicalname)
return NULL;
}
SockAddr sk_nonamelookup(char *host)
SockAddr sk_nonamelookup(char const *host)
{
if (mac_gestalts.otptattr != 0)

View File

@ -1,4 +1,4 @@
/* $Id: macterm.c,v 1.43 2003/01/12 14:44:12 ben Exp $ */
/* $Id: macterm.c,v 1.44 2003/01/12 16:11:27 ben Exp $ */
/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris
@ -169,11 +169,11 @@ void mac_startsession(Session *s)
ActivatePalette(s->window);
}
s->logctx = log_init(s);
s->logctx = log_init(s, &s->cfg);
term_provide_logctx(s->term, s->logctx);
errmsg = s->back->init(s->term, &s->backhandle, s->cfg.host, s->cfg.port,
&s->realhost, s->cfg.tcp_nodelay);
errmsg = s->back->init(s->term, &s->backhandle, &s->cfg, s->cfg.host,
s->cfg.port, &s->realhost, s->cfg.tcp_nodelay);
if (errmsg != NULL)
fatalbox("%s", errmsg);
s->back->provide_logctx(s->backhandle, s->logctx);

View File

@ -270,7 +270,7 @@ void mactcp_cleanup(void)
static ResultUPP mactcp_lookupdone_upp;
SockAddr mactcp_namelookup(char *host, char **canonicalname)
SockAddr mactcp_namelookup(char const *host, char **canonicalname)
{
SockAddr ret = smalloc(sizeof(struct SockAddr_tag));
OSErr err;
@ -281,7 +281,8 @@ SockAddr mactcp_namelookup(char *host, char **canonicalname)
memset(ret, 0, sizeof(struct SockAddr_tag));
if (mactcp_lookupdone_upp == NULL)
mactcp_lookupdone_upp = NewResultUPP(&mactcp_lookupdone);
err = StrToAddr(host, &ret->hostinfo, mactcp_lookupdone_upp,
/* Casting away const -- hope StrToAddr is sensible */
err = StrToAddr((char *)host, &ret->hostinfo, mactcp_lookupdone_upp,
(char *)&done);
/*
* PuTTY expects DNS lookups to be synchronous (see bug
@ -308,7 +309,7 @@ static pascal void mactcp_lookupdone(struct hostInfo *hi, char *cookie)
*donep = TRUE;
}
SockAddr mactcp_nonamelookup(char *host)
SockAddr mactcp_nonamelookup(char const *host)
{
SockAddr ret = smalloc(sizeof(struct SockAddr_tag));

View File

@ -74,12 +74,14 @@ void ot_cleanup(void)
CloseOpenTransport();
}
SockAddr ot_namelookup(char *host, char **canonicalname)
SockAddr ot_namelookup(char const *host, char **canonicalname)
{
SockAddr ret = smalloc(sizeof(struct SockAddr_tag));
char *realhost;
ret->error = OTInetStringToAddress(ot.inetsvc, host, &ret->hostinfo);
/* Casting away const -- hope OTInetStringToAddress is sensible */
ret->error = OTInetStringToAddress(ot.inetsvc, (char *)host,
&ret->hostinfo);
ret->resolved = TRUE;
if (ret->error == kOTNoError)
@ -91,7 +93,7 @@ SockAddr ot_namelookup(char *host, char **canonicalname)
return ret;
}
SockAddr ot_nonamelookup(char *host)
SockAddr ot_nonamelookup(char const *host)
{
SockAddr ret = smalloc(sizeof(struct SockAddr_tag));

View File

@ -1,4 +1,4 @@
/* $Id: testback.c,v 1.4 2002/11/23 20:40:22 ben Exp $ */
/* $Id: testback.c,v 1.5 2003/01/12 16:11:27 ben Exp $ */
/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999 Ben Harris
@ -33,8 +33,9 @@
#include "putty.h"
static char *null_init(void *, void **, char *, int, char **, int);
static char *loop_init(void *, void **, char *, int, char **, int);
static char *null_init(void *, void **, Config *, char *, int, char **, int);
static char *loop_init(void *, void **, Config *, char *, int, char **, int);
static void null_reconfig(void *, Config *);
static int null_send(void *, char *, int);
static int loop_send(void *, char *, int);
static int null_sendbuffer(void *);
@ -49,15 +50,15 @@ static void null_provide_logctx(void *, void *);
static void null_unthrottle(void *, int);
Backend null_backend = {
null_init, null_send, null_sendbuffer, null_size, null_special,
null_socket, null_exitcode, null_sendok, null_ldisc, null_provide_ldisc,
null_provide_logctx, null_unthrottle, 0
null_init, null_reconfig, null_send, null_sendbuffer, null_size,
null_special, null_socket, null_exitcode, null_sendok, null_ldisc,
null_provide_ldisc, null_provide_logctx, null_unthrottle, 0
};
Backend loop_backend = {
loop_init, loop_send, null_sendbuffer, null_size, null_special,
null_socket, null_exitcode, null_sendok, null_ldisc, null_provide_ldisc,
null_provide_logctx, null_unthrottle, 0
loop_init, null_reconfig, loop_send, null_sendbuffer, null_size,
null_special, null_socket, null_exitcode, null_sendok, null_ldisc,
null_provide_ldisc, null_provide_logctx, null_unthrottle, 0
};
struct loop_state {
@ -65,13 +66,15 @@ struct loop_state {
};
static char *null_init(void *frontend_handle, void **backend_handle,
char *host, int port, char **realhost, int nodelay) {
Config *cfg, char *host, int port, char **realhost,
int nodelay) {
return NULL;
}
static char *loop_init(void *frontend_handle, void **backend_handle,
char *host, int port, char **realhost, int nodelay) {
Config *cfg, char *host, int port, char **realhost,
int nodelay) {
struct loop_state *st = smalloc(sizeof(*st));
st->term = frontend_handle;
@ -79,6 +82,10 @@ static char *loop_init(void *frontend_handle, void **backend_handle,
return NULL;
}
static void null_reconfig(void *handle, Config *cfg) {
}
static int null_send(void *handle, char *buf, int len) {
return 0;