File: test-001-post.c

package info (click to toggle)
bar 1.11.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 928 kB
  • sloc: ansic: 4,381; sh: 3,334; makefile: 264
file content (29 lines) | stat: -rw-r--r-- 609 bytes parent folder | download | duplicates (3)
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
#include "config.h"

#include "headers.h"

int main(int argc, char *argv[])
{
	int in = 0;
	char buffer[1024] = { 0 };
	char *expected = "Hello World\n";
	int c = 0;

	in = STDIN_FILENO;
	for (c = 0; c < 1024; c++) buffer[c] = 0;
	read(in, buffer, strlen(expected));
	if (strcmp(buffer, expected) != 0) {
		fprintf(stderr, "*** ERROR: Unexpected string read\n");
		return(1);
	}
	sleep(5);
	for (c = 0; c < 1024; c++) buffer[c] = 0;
	read(in, buffer, strlen(expected));
	if (strcmp(buffer, expected) != 0) {
		fprintf(stderr, "*** ERROR: Unexpected string read\n");
		return(1);
	}
	close(in);
	return(0);
}