Public feed #723562

Mine

public text v1 · immutable
Raw Edit
·published 2007-10-02 21:30 UTC
rendered paste body
[jcs@jcs-sun ~]$ cat typer.c
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

int main(int argc , char **argv ) {

        struct timeval tv ;       /* struct to hold time data */
        struct timezone tz ;      /* struct to hold time zone data */
        int c ;

        if ( argc != 2 ) return(1) ;

        gettimeofday(&tv, &tz) ;
        srand(tv.tv_usec) ;

        for (c = 0 ; argv[1][c] != 0 ; c++ ) {
                usleep(100000*(rand()/(((unsigned)RAND_MAX+1)/5))) ;
                putc(argv[1][c], stdout) ;
                fflush(stdout) ;
        }

        usleep(2000000) ;
        printf("\n") ;
        return(0) ;
}