Indentation & alignment.
Tabs for indentation, spaces for alignment.
This commit is contained in:
parent
68e58f2a9d
commit
26e7ffbbfc
2 changed files with 10 additions and 9 deletions
|
|
@ -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
8
slow.c
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue