1
by brian
clean slate |
1 |
/*
|
2 |
** Virtual I/O library
|
|
3 |
** Written by Andrei Errapart <andreie@no.spam.ee>
|
|
4 |
*/
|
|
5 |
||
6 |
#include "all.h" |
|
7 |
||
8 |
#include <sys/types.h> |
|
9 |
#include <sys/stat.h> |
|
10 |
#include <stdio.h> |
|
11 |
||
12 |
#include <string.h> |
|
13 |
||
14 |
VIO_NS_USING; |
|
15 |
||
16 |
int
|
|
17 |
main( int argc, |
|
18 |
char** argv) |
|
19 |
{
|
|
20 |
VioFd* fs = 0; |
|
21 |
VioSocket* ss = 0; |
|
22 |
int fd = -1; |
|
23 |
char* hh = "hshshsh\n"; |
|
24 |
||
25 |
DBUG_ENTER("main"); |
|
26 |
DBUG_PROCESS(argv[0]); |
|
27 |
DBUG_PUSH("d:t"); |
|
28 |
||
29 |
fd = open("/dev/tty", O_WRONLY); |
|
30 |
if (fd<0) |
|
31 |
{
|
|
32 |
perror("open"); |
|
33 |
return 1; |
|
34 |
}
|
|
35 |
fs = new VioFd(fd); |
|
36 |
ss = new VioSocket(fd); |
|
37 |
if (fs->write(hh,strlen(hh)) < 0) |
|
38 |
perror("write"); |
|
39 |
ss->write(hh,strlen(hh)); |
|
40 |
printf("peer_name:%s\n", ss->peer_name()); |
|
41 |
printf("cipher_description:%s\n", ss->cipher_description()); |
|
42 |
delete fs; |
|
43 |
delete ss; |
|
44 |
||
45 |
DBUG_RETURN(0); |
|
46 |
}
|
|
47 |