repo.or.cz
/
rofl0r-jobflow.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
README.md: remove memleak line
[rofl0r-jobflow.git]
/
tests
/
stdin_printer.c
blob
d6813ef94044d07e58d0068a90d060f3499af78e
1
/* like cat, but processing one line at a time. stdin only. */
2
#include <unistd.h>
3
#include <stdio.h>
4
#include <string.h>
5
6
int
main
() {
7
char
buf
[
1024
];
8
while
(
fgets
(
buf
,
sizeof
buf
,
stdin
)) {
9
ssize_t l
=
strlen
(
buf
);
10
ssize_t n
=
write
(
1
,
buf
,
l
);
11
if
(
n
!=
l
) {
12
perror
(
"write"
);
13
return
1
;
14
}
15
}
16
return
0
;
17
}