1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/testback.c
Simon Tatham 4d8782e74f Rework versioning system to not depend on Subversion.
I've shifted away from using the SVN revision number as a monotonic
version identifier (replacing it in the Windows version resource with
a count of days since an arbitrary epoch), and I've removed all uses
of SVN keyword expansion (replacing them with version information
written out by Buildscr).

While I'm at it, I've done a major rewrite of the affected code which
centralises all the computation of the assorted version numbers and
strings into Buildscr, so that they're all more or less alongside each
other rather than scattered across multiple source files.

I've also retired the MD5-based manifest file system. A long time ago,
it seemed like a good idea to arrange that binaries of PuTTY would
automatically cease to identify themselves as a particular upstream
version number if any changes were made to the source code, so that if
someone made a local tweak and distributed the result then I wouldn't
get blamed for the results. Since then I've decided the whole idea is
more trouble than it's worth, so now distribution tarballs will have
version information baked in and people can just cope with that.

[originally from svn r10262]
2014-09-24 10:33:13 +00:00

180 lines
4.4 KiB
C

/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999 Ben Harris
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* PuTTY test backends */
#include <stdio.h>
#include <stdlib.h>
#include "putty.h"
static const char *null_init(void *, void **, Conf *, char *, int, char **,
int, int);
static const char *loop_init(void *, void **, Conf *, char *, int, char **,
int, int);
static void null_free(void *);
static void loop_free(void *);
static void null_reconfig(void *, Conf *);
static int null_send(void *, char *, int);
static int loop_send(void *, char *, int);
static int null_sendbuffer(void *);
static void null_size(void *, int, int);
static void null_special(void *, Telnet_Special);
static const struct telnet_special *null_get_specials(void *handle);
static int null_connected(void *);
static int null_exitcode(void *);
static int null_sendok(void *);
static int null_ldisc(void *, int);
static void null_provide_ldisc(void *, void *);
static void null_provide_logctx(void *, void *);
static void null_unthrottle(void *, int);
static int null_cfg_info(void *);
Backend null_backend = {
null_init, null_free, null_reconfig, null_send, null_sendbuffer, null_size,
null_special, null_get_specials, null_connected, null_exitcode, null_sendok,
null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle,
null_cfg_info, "null", -1, 0
};
Backend loop_backend = {
loop_init, loop_free, null_reconfig, loop_send, null_sendbuffer, null_size,
null_special, null_get_specials, null_connected, null_exitcode, null_sendok,
null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle,
null_cfg_info, "loop", -1, 0
};
struct loop_state {
Terminal *term;
};
static const char *null_init(void *frontend_handle, void **backend_handle,
Conf *conf, char *host, int port,
char **realhost, int nodelay, int keepalive) {
return NULL;
}
static const char *loop_init(void *frontend_handle, void **backend_handle,
Conf *conf, char *host, int port,
char **realhost, int nodelay, int keepalive) {
struct loop_state *st = snew(struct loop_state);
st->term = frontend_handle;
*backend_handle = st;
return NULL;
}
static void null_free(void *handle)
{
}
static void loop_free(void *handle)
{
sfree(handle);
}
static void null_reconfig(void *handle, Conf *conf) {
}
static int null_send(void *handle, char *buf, int len) {
return 0;
}
static int loop_send(void *handle, char *buf, int len) {
struct loop_state *st = handle;
return from_backend(st->term, 0, buf, len);
}
static int null_sendbuffer(void *handle) {
return 0;
}
static void null_size(void *handle, int width, int height) {
}
static void null_special(void *handle, Telnet_Special code) {
}
static const struct telnet_special *null_get_specials (void *handle) {
return NULL;
}
static int null_connected(void *handle) {
return 0;
}
static int null_exitcode(void *handle) {
return 0;
}
static int null_sendok(void *handle) {
return 1;
}
static void null_unthrottle(void *handle, int backlog) {
}
static int null_ldisc(void *handle, int option) {
return 0;
}
static void null_provide_ldisc (void *handle, void *ldisc) {
}
static void null_provide_logctx(void *handle, void *logctx) {
}
static int null_cfg_info(void *handle)
{
return 0;
}
/*
* Emacs magic:
* Local Variables:
* c-file-style: "simon"
* End:
*/