slow/slow.c

22 lines
347 B
C
Raw Normal View History

2013-08-02 23:23:04 +02:00
#define _XOPEN_SOURCE 500
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
char line[1024];
int linesize = sizeof(line);
int useconds = 1000000;
if (argc == 2) {
useconds = atoi(argv[1]);
}
while(fgets(line, linesize, stdin)) {
usleep(useconds);
fputs(line, stdout);
}
return 0;
}