/* Program: STRIP.C Author : Kim Moser Date : 9/7/1991 System : IBM PC / Borland Turbo-C 2.0 Descrip: Copies stdin to stdout, stripping characters specified. Usage : STRIP {} */ #include #include #include #include #include static void usage(void); static void usage(void) { fputs("\ usage: strip [ ...]\n\ copies stdin to stdout, stripping specified ASCII values.\n\ Specified values must be in the range 0-255.\n\ ", stderr); exit(-1); } void main(int argc, char **argv) { int *array; int ch, i; setmode(fileno(stdin), O_BINARY); setmode(fileno(stdout), O_BINARY); if ((array = (int*) malloc(argc * sizeof(*array))) == NULL) { fprintf(stderr, "malloc(%d) failed.\n", argc*sizeof(*array)); exit(-1); } for (i=1; i 255) usage(); } while ((ch = getchar()) != EOF) { for (i=0; i= argc-1) { /* Character not found */ putchar(ch); } } free(array); }