tools/removenl

23 lines
335 B
Text
Raw Normal View History

2016-10-04 23:52:17 +02:00
#!/usr/bin/tcc -run
/* vim: set syn=c: */
#include <stdlib.h>
#include <stdio.h>
/*
* 0x0a - linefeed
* 0x0d - carriage return
**/
int
main() {
char buffer;
size_t nread;
while ((nread = fread(&buffer, 1, sizeof buffer, stdin)) > 0)
if (buffer != 0x0a && buffer != 0x0d)
fwrite(&buffer, 1, nread, stdout);
return 0;
}