/* * Filename: removespace.c * * Programmer: Br. David Carlson * * Date: January 5, 2002 * * Description: This program copies standard input to standard * output, replacing each # symbol that is followed by a space * character by a # symbol without the space character following. * This utility was created for use by the getmeta script. * * Compile as follows: * gcc removespace.c -o removespace -s */ #include int main(void) { int ch; ch = getchar(); while (ch != EOF) { putchar(ch); if (ch == '#') { ch = getchar(); if (ch != ' ') putchar(ch); /* but if ch == ' ' do not output it */ } ch = getchar(); } return 0; }