summaryrefslogtreecommitdiff
path: root/slowcat.c
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2016-10-18 20:22:38 -0500
committerepoch <epoch@hacking.allowed.org>2016-10-18 20:22:38 -0500
commit11844154cb30223fdaa977d659b98626e99f00ce (patch)
tree4ebc9b0c0267365cb1f96da0ee1c917f2eec0696 /slowcat.c
parentbd213282ff7ed8f2854ab7d628a7aabb7efc85d9 (diff)
downloadhackvr-11844154cb30223fdaa977d659b98626e99f00ce.tar.gz
hackvr-11844154cb30223fdaa977d659b98626e99f00ce.zip
lets see if this works..
Diffstat (limited to 'slowcat.c')
-rw-r--r--slowcat.c28
1 files changed, 28 insertions, 0 deletions
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 <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;
+}