3 /// Simple test program for pppob's -t pty option.
7 Copyright (C) 2012-2013, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
23 #include <sys/types.h>
39 void* readwrite(void *arg
)
41 struct ioconfig
*io
= (struct ioconfig
*) arg
;
44 ssize_t count
= read(io
->read
, buffer
, sizeof(buffer
));
45 write(1, "Got data: ", 10);
46 write(1, buffer
, count
);
47 write(io
->write
, buffer
, count
);
52 int main(int argc
, char *argv
[])
57 int slave
= open(argv
[1], O_RDWR
);
63 tcgetattr(slave
, &tp
);
65 tcsetattr(slave
, TCSANOW
, &tp
);
67 struct ioconfig io1
, io2
;
74 pthread_create(&iot1
, NULL
, &readwrite
, &io1
);
75 pthread_create(&iot2
, NULL
, &readwrite
, &io2
);
77 pthread_join(iot1
, NULL
);
78 pthread_join(iot2
, NULL
);