blob: 2efb92f57f11fb306af7df9844a673b3981858b7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#define _BSD_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc,char *argv[]) {
short in;
FILE *fp=stdin;
if(argc < 2) {
printf("usage: slowcat delay [file1] [file2] [...]\n");
return -1;
}
if(argc > 2) {
fp=fopen(argv[2],"r");
}
do {
while((in=fgetc(fp)) != -1) {
printf("%c",in);
if(in == '\n') {
fflush(stdout);
usleep(atoi(argv[1]));
}
}
fclose(fp);
argv++;
} while((fp=fopen(argv[1],"r")));
return 0;
}
|