]> asedeno.scripts.mit.edu Git - PuTTY.git/blob - testback.c
Remove stray debugging printfs.
[PuTTY.git] / testback.c
1 /* $Id: testback.c,v 1.4 2002/11/23 20:40:22 ben Exp $ */
2 /*
3  * Copyright (c) 1999 Simon Tatham
4  * Copyright (c) 1999 Ben Harris
5  * All rights reserved.
6  *
7  * Permission is hereby granted, free of charge, to any person
8  * obtaining a copy of this software and associated documentation
9  * files (the "Software"), to deal in the Software without
10  * restriction, including without limitation the rights to use,
11  * copy, modify, merge, publish, distribute, sublicense, and/or
12  * sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following
14  * conditions:
15  * 
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  * 
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
23  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26  * SOFTWARE.
27  */
28
29 /* PuTTY test backends */
30
31 #include <stdio.h>
32 #include <stdlib.h>
33
34 #include "putty.h"
35
36 static char *null_init(void *, void **, char *, int, char **, int);
37 static char *loop_init(void *, void **, char *, int, char **, int);
38 static int null_send(void *, char *, int);
39 static int loop_send(void *, char *, int);
40 static int null_sendbuffer(void *);
41 static void null_size(void *, int, int);
42 static void null_special(void *, Telnet_Special);
43 static Socket null_socket(void *);
44 static int null_exitcode(void *);
45 static int null_sendok(void *);
46 static int null_ldisc(void *, int);
47 static void null_provide_ldisc(void *, void *);
48 static void null_provide_logctx(void *, void *);
49 static void null_unthrottle(void *, int);
50
51 Backend null_backend = {
52     null_init, null_send, null_sendbuffer, null_size, null_special,
53     null_socket, null_exitcode, null_sendok, null_ldisc, null_provide_ldisc,
54     null_provide_logctx, null_unthrottle, 0
55 };
56
57 Backend loop_backend = {
58     loop_init, loop_send, null_sendbuffer, null_size, null_special,
59     null_socket, null_exitcode, null_sendok, null_ldisc, null_provide_ldisc,
60     null_provide_logctx, null_unthrottle, 0
61 };
62
63 struct loop_state {
64     Terminal *term;
65 };
66
67 static char *null_init(void *frontend_handle, void **backend_handle,
68                        char *host, int port, char **realhost, int nodelay) {
69
70     return NULL;
71 }
72
73 static char *loop_init(void *frontend_handle, void **backend_handle,
74                        char *host, int port, char **realhost, int nodelay) {
75     struct loop_state *st = smalloc(sizeof(*st));
76
77     st->term = frontend_handle;
78     *backend_handle = st;
79     return NULL;
80 }
81
82 static int null_send(void *handle, char *buf, int len) {
83
84     return 0;
85 }
86
87 static int loop_send(void *handle, char *buf, int len) {
88     struct loop_state *st = handle;
89
90     return from_backend(st->term, 0, buf, len);
91 }
92
93 static int null_sendbuffer(void *handle) {
94
95     return 0;
96 }
97
98 static void null_size(void *handle, int width, int height) {
99
100 }
101
102 static void null_special(void *handle, Telnet_Special code) {
103
104 }
105
106 static Socket null_socket(void *handle) {
107
108     return NULL;
109 }
110
111 static int null_exitcode(void *handle) {
112
113     return 0;
114 }
115
116 static int null_sendok(void *handle) {
117
118     return 1;
119 }
120
121 static void null_unthrottle(void *handle, int backlog) {
122
123 }
124
125 static int null_ldisc(void *handle, int option) {
126
127     return 0;
128 }
129
130 static void null_provide_ldisc (void *handle, void *ldisc) {
131
132 }
133
134 static void null_provide_logctx(void *handle, void *logctx) {
135
136 }
137
138 /*
139  * Emacs magic:
140  * Local Variables:
141  * c-file-style: "simon"
142  * End:
143  */