/* New, improved, efficient, flexible ripple program. Usage: ripple [ w [ l ] ] w = screen line width, default 80, must be > 0. l = how many lines to display, default 1000, must be > 0. */ char *p = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]\ ^_`abcdefghijklmnopqrstuvwxyz{|}~ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH\ IJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; char *crlf = "\015\012"; main(argc,argv) int argc; char *argv[]; { int i, j, k, x; int w = 80; int l = 1000; if (argc > 1) /* User-specified width */ w = atoi(argv[1]); if (argc > 2) /* User-specified number of lines */ l = atoi(argv[2]); if (w < 1 || l < 1) /* Quit upon conversion error */ exit(1); for (j = i = 0; i < l; i++) { /* Ripple loop */ /* write(1, p+j, w); write(1, crlf, 2); */ for (k = 0; k < w; k++) { x = *(p+j+k); printf("%c[3%c;4%cm%c",27, (char)((8 - (x % 8)) + '0'), (char)((x % 8) + '0'), x); } printf("\n"); if (++j > 94) j = 0; } printf("%c[0m",27); }