/***********************/ /* slow.c 1.00 */ /* by Adam M. Costello */ /* */ /* *************/ /* slow [ n ] */ /* Copies its stdin to its stdout, */ /* inserting n NULs before each */ /* character. If n is not given, */ /* it defaults to 1. */ /***********************************/ /* This is ANSI C code. */ #include #include main(int argc, char **argv) { int n, c, i; if (argc > 2) { fputs("Usage:\nslow [ n ]\n", stderr); exit(EXIT_FAILURE); } n = argc > 1 ? atoi(argv[1]) : 1; for (;;) { c = getchar(); if (c == EOF) break; for (i = 0; i < n; ++i) putchar('\0'); putchar(c); } exit(EXIT_SUCCESS); }