summaryrefslogtreecommitdiff
path: root/vio/viotest.cc
blob: 490a9ca669483e17f07863d819102ce59e6ce025 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* 
**  Virtual I/O library
**  Written by Andrei Errapart <andreie@no.spam.ee>
*/

#include	"all.h"

#include	<sys/types.h>
#include	<sys/stat.h>
#include	<stdio.h>

#include	<string.h>

VIO_NS_USING;

int
main(	int	argc,
	char**	argv)
{
	VioFd*	fs = 0;
	VioSocket*	ss = 0;
	int		fd = -1;
	char*		hh = "hshshsh\n";

	DBUG_ENTER("main");
	DBUG_PROCESS(argv[0]);
	DBUG_PUSH("d:t");

	fd = open("/dev/tty", O_WRONLY);
	if (fd<0)
	{
		perror("open");
		return 1;
	}
	fs = new VioFd(fd);
	ss = new VioSocket(fd);
	if (fs->write(hh,strlen(hh)) < 0)
		perror("write");
	ss->write(hh,strlen(hh));
	printf("peer_name:%s\n", ss->peer_name());
	printf("cipher_description:%s\n", ss->cipher_description());
	delete fs;
	delete ss;

	DBUG_RETURN(0);
}