From 11844154cb30223fdaa977d659b98626e99f00ce Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 18 Oct 2016 20:22:38 -0500 Subject: lets see if this works.. --- slowcat.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 slowcat.c (limited to 'slowcat.c') diff --git a/slowcat.c b/slowcat.c new file mode 100644 index 0000000..2efb92f --- /dev/null +++ b/slowcat.c @@ -0,0 +1,28 @@ +#define _BSD_SOURCE +#include +#include +#include + +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; +} -- cgit v1.2.3