X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/5555d393c727cca12fce612a469bacb9b627eb3b..95b1a3e43c8289c920cab11cc27a48a3aa848d3c:/plink.c diff --git a/plink.c b/plink.c index 7ada2d48..3848214c 100644 --- a/plink.c +++ b/plink.c @@ -69,6 +69,7 @@ WSAEVENT netevent; static Backend *back; static void *backhandle; +static Config cfg; int term_ldisc(Terminal *term, int mode) { @@ -165,7 +166,8 @@ void try_output(int is_stderr) } } -int from_backend(void *frontend_handle, int is_stderr, char *data, int len) +int from_backend(void *frontend_handle, int is_stderr, + const char *data, int len) { int osize, esize; @@ -408,13 +410,13 @@ int main(int argc, char **argv) while (*p) { if (cmdlen >= cmdsize) { cmdsize = cmdlen + 512; - command = srealloc(command, cmdsize); + command = sresize(command, cmdsize, char); } command[cmdlen++]=*p++; } if (cmdlen >= cmdsize) { cmdsize = cmdlen + 512; - command = srealloc(command, cmdsize); + command = sresize(command, cmdsize, char); } command[cmdlen++]=' '; /* always add trailing space */ if (--argc) p = *++argv; @@ -539,14 +541,15 @@ int main(int argc, char **argv) int nodelay = cfg.tcp_nodelay && (GetFileType(GetStdHandle(STD_INPUT_HANDLE)) == FILE_TYPE_CHAR); - error = back->init(NULL, &backhandle, cfg.host, cfg.port, + error = back->init(NULL, &backhandle, &cfg, cfg.host, cfg.port, &realhost, nodelay); if (error) { fprintf(stderr, "Unable to open connection:\n%s", error); return 1; } - logctx = log_init(NULL); + logctx = log_init(NULL, &cfg); back->provide_logctx(backhandle, logctx); + console_provide_logctx(logctx); sfree(realhost); } connopen = 1; @@ -648,7 +651,7 @@ int main(int argc, char **argv) /* Expand the buffer if necessary. */ if (i > sksize) { sksize = i + 16; - sklist = srealloc(sklist, sksize * sizeof(*sklist)); + sklist = sresize(sklist, sksize, SOCKET); } /* Retrieve the sockets into sklist. */