File: test15.client.c

package info (click to toggle)
daemon 0.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,072 kB
  • sloc: ansic: 30,432; sh: 4,310; perl: 592; makefile: 307
file content (23 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <unistd.h>
#include <termios.h>

/* Set EOF to be Control-F then do cat */

int main()
{
	struct termios attr[1];
	char c;

	if (tcgetattr(STDIN_FILENO, attr) == -1)
		return 1;

	attr->c_cc[VEOF] = CTRL('f');

	if (tcsetattr(STDIN_FILENO, TCSANOW, attr) == -1)
		return 1;

	while (read(STDIN_FILENO, &c, 1) == 1)
		write(STDOUT_FILENO, &c, 1);

	return 0;
}