Indentation & alignment.

Tabs for indentation, spaces for alignment.
This commit is contained in:
Simon Lieb 2015-03-11 18:47:28 +01:00
parent 68e58f2a9d
commit 26e7ffbbfc
2 changed files with 10 additions and 9 deletions

View file

@ -14,4 +14,5 @@ Usage
$ slow [-t usec] [-f] $ slow [-t usec] [-f]
-t usec : Define sleep between each bytes in micro-second. Default to 1 second. -t usec : Define sleep between each bytes in micro-second. Default to 1 second.
-f : Force flushing after each byte. Useful with buffered stdout like ttys. -f : Force flushing after each byte. Useful with buffered stdout like ttys.

8
slow.c
View file

@ -29,17 +29,17 @@ int main(int argc, char *argv[]) {
usage(); usage();
} ARGEND; } ARGEND;
while((nread = fread(&buffer, 1, sizeof buffer, stdin)) > 0) { while ((nread = fread(&buffer, 1, sizeof buffer, stdin)) > 0) {
usleep(useconds); usleep(useconds);
if(fwrite(&buffer, 1, nread, stdout) != nread) { if (fwrite(&buffer, 1, nread, stdout) != nread) {
fprintf(stderr, "stdout: write error"); fprintf(stderr, "stdout: write error");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if(flush) { if (flush) {
fflush(stdout); fflush(stdout);
} }
} }
if(ferror(stdin)) { if (ferror(stdin)) {
fprintf(stderr, "stdin: read error"); fprintf(stderr, "stdin: read error");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }