-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.c
34 lines (31 loc) · 1.28 KB
/
client.c
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
/* ************************************************************************** */
/* */
/* :::::::: */
/* client.c :+: :+: */
/* +:+ */
/* By: tbruinem <[email protected]> +#+ */
/* +#+ */
/* Created: 2022/03/05 23:42:39 by tbruinem #+# #+# */
/* Updated: 2022/03/07 21:50:12 by tbruinem ######## odam.nl */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <stdbool.h>
#include <unistd.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
int main() {
while (true) {
char* line = NULL;
size_t bytes = 0;
if (getline(&line, &bytes, stdin) == -1) {
perror("getline");
dprintf(2, "(%d) CLIENT DIED TRYING TO READ INPUT\n", errno);
exit(1);
}
write(STDOUT_FILENO, line, strlen(line));
free(line);
}
}