File indexing completed on 2024-05-05 05:54:12

0001 /*
0002   Ripple test.
0003   Usage: ripple [ w [ l ] ]
0004    w = screen line width, default 80, must be > 0, max 132.
0005    l = how many lines to display, default 1000, must be > 0.
0006   Author: Frank da Cruz, Columbia University, 1995.
0007   This is in the public domain as far as can be determined.
0008 */
0009 char *crlf = "\015\012";
0010 char *p =
0011     " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]\
0012 ^_`abcdefghijklmnopqrstuvwxyz{|}~ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH\
0013 IJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !\"#$%&'()*+,-./012\
0014 3456789:;<=>?@ABCD";
0015 
0016 main(argc, argv) int argc;
0017 char *argv[];
0018 {
0019     int i, j, w = 80, l = 1000;
0020 
0021     if (argc > 1) /* User-specified width */
0022         w = atoi(argv[1]);
0023     if (argc > 2) /* User-specified number of lines */
0024         l = atoi(argv[2]);
0025     if (w < 1 || l < 1 || w > 132) /* Quit upon conversion error */
0026         exit(1);
0027 
0028     for (j = i = 0; i < l; i++) { /* Ripple loop */
0029         write(1, p + j, w);
0030         write(1, crlf, 2);
0031         if (++j > 94)
0032             j = 0;
0033     }
0034 }