plan9port/src/cmd/zerotrunc.c
Dan Cross fa325e9b42 Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines.
Remove blank lines from the ends of files.
Change modes on source files so that they
are not executable.

Signed-off-by: Dan Cross <cross@gajendra.net>
2020-01-10 14:54:30 +00:00

25 lines
317 B
C

/*
* cat standard input until you get a zero byte
*/
#include <u.h>
#include <libc.h>
void
main(void)
{
char buf[4096];
char *p;
int n;
while((n = read(0, buf, sizeof(buf))) > 0){
p = memchr(buf, 0, n);
if(p != nil)
n = p-buf;
if(n > 0)
write(1, buf, n);
if(p != nil)
break;
}
exits(0);
}