home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / vt100.zip / ripple.c < prev    next >
C/C++ Source or Header  |  2000-08-24  |  1KB  |  33 lines

  1. /*
  2.   Ripple test.
  3.   Usage: ripple [ w [ l ] ]
  4.    w = screen line width, default 80, must be > 0, max 132.
  5.    l = how many lines to display, default 1000; < 1 means go forever.
  6.   Author: Frank da Cruz, Columbia University, 1995.
  7. */
  8. char *crlf = "\015\012";
  9. char *p = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]\
  10. ^_`abcdefghijklmnopqrstuvwxyz{|}~ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH\
  11. IJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !\"#$%&'()*+,-./012\
  12. 3456789:;<=>?@ABCD";
  13.  
  14. main(argc,argv) int argc; char *argv[]; {
  15.     int i, j, w = 80, l = 1000;
  16.     char beep = '\07';
  17.  
  18.     if (argc > 1)            /* User-specified width */
  19.       w = atoi(argv[1]);
  20.     if (argc > 2)            /* User-specified number of lines */
  21.       l = atoi(argv[2]);
  22.     if (w < 1 || w > 132)        /* Quit upon conversion error */
  23.       exit(1);
  24.  
  25.     for (j = i = 0; l < 1 || i < l; i++) { /* Ripple loop */
  26.     write(1, p+j, w);
  27.     write(1, crlf, 2);
  28.     if (++j > 94) j = 0;
  29.     }
  30.     write(1, &beep, 1);
  31.     exit(0);
  32. }
  33.