/*** * Small program to output stdin or a file one character a time, like it would be typed * Author: madmaurice * License: GPL */ #include #include #include #include int main(int argc, char** argv) { //Options float speed = 0.3; char* file = NULL; FILE* fh = stdin; char c; int v; argv++; // Cut first element for(int i = 1; i < argc; i++, argv++) { if(strcmp(*argv,"-s") == 0) { argv++; i++; v = atoi(*argv); if(v == 0) v = 1000; speed = 1.0/v; } else { fh = fopen(*argv,"r"); } } while((c = fgetc(fh)) != EOF) { fputc(c,stdout); fflush(stdout); usleep(speed * 1000000); } return 0; }