mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-25 23:02:09 -05:00
Very basic hex-dump backend for testing meta handling.
[originally from svn r134]
This commit is contained in:
parent
70b2dd8ed4
commit
89751ed598
1
putty.h
1
putty.h
@ -303,6 +303,7 @@ void safefree(void *);
|
||||
|
||||
extern Backend null_backend;
|
||||
extern Backend loop_backend;
|
||||
extern Backend hexdump_backend;
|
||||
|
||||
/*
|
||||
* Exports from version.c.
|
||||
|
24
testback.c
24
testback.c
@ -1,4 +1,4 @@
|
||||
/* $Id: testback.c,v 1.1.2.3 1999/03/21 23:23:43 ben Exp $ */
|
||||
/* $Id: testback.c,v 1.1.2.4 1999/03/28 15:25:45 ben Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1999 Simon Tatham
|
||||
* Copyright (c) 1999 Ben Harris
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
/* PuTTY test backends */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "putty.h"
|
||||
@ -36,6 +37,7 @@ static char *null_init(char *, int, char **);
|
||||
static int null_msg(void);
|
||||
static void null_send(char *, int);
|
||||
static void loop_send(char *, int);
|
||||
static void hexdump_send(char *, int);
|
||||
static void null_size(void);
|
||||
static void null_special(Telnet_Special);
|
||||
|
||||
@ -47,6 +49,10 @@ Backend loop_backend = {
|
||||
null_init, null_msg, loop_send, null_size, null_special
|
||||
};
|
||||
|
||||
Backend hexdump_backend = {
|
||||
null_init, null_msg, hexdump_send, null_size, null_special
|
||||
};
|
||||
|
||||
static char *null_init(char *host, int port, char **realhost) {
|
||||
|
||||
return NULL;
|
||||
@ -62,6 +68,7 @@ static void null_send(char *buf, int len) {
|
||||
}
|
||||
|
||||
static void loop_send (char *buf, int len) {
|
||||
|
||||
while (len--) {
|
||||
int new_head = (inbuf_head + 1) & INBUF_MASK;
|
||||
int c = (unsigned char) *buf;
|
||||
@ -74,7 +81,15 @@ static void loop_send (char *buf, int len) {
|
||||
term_update();
|
||||
}
|
||||
|
||||
static void hexdump_send(char *buf, int len) {
|
||||
static char mybuf[10];
|
||||
int mylen;
|
||||
|
||||
while (len--) {
|
||||
mylen = sprintf(mybuf, "%02x\015\012", (unsigned char)*buf++);
|
||||
loop_send(mybuf, mylen);
|
||||
}
|
||||
}
|
||||
|
||||
static void null_size(void) {
|
||||
|
||||
@ -83,3 +98,10 @@ static void null_size(void) {
|
||||
static void null_special(Telnet_Special code) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Emacs magic:
|
||||
* Local Variables:
|
||||
* c-file-style: "simon"
|
||||
* End:
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user