Comments on this program please...

Isaac Dimitrovsky dimitrov at csd2.UUCP
Mon Nov 25 03:06:00 AEST 1985


/* csd2:net.lang.c / david at ukma.UUCP (David Herron, NPR Lover) /  5:42 pm  Nov 22, 1985 */
Everybody I've shown this program to has *groaned* and complained
about what a nasssty program it was...  This program was written
to help decode a bitnet routing table that I had been netcopy'd
to me and didn't get translated into ascii.  So after running dd
over it, the line markers had disappeared into never never land.
But from looking real closely at the file I could see that each
line was supposed to start with ROUTE.....  thus this program:

I think it's *cute*!





#include <stdio.h>

main()
{
	register int r, o, u, t, e;

	while ((r = getchar()) != EOF) {
		if (r == 'R')
			if ((o = getchar()) == 'O')
				if ((u = getchar()) == 'U')
					if ((t = getchar()) == 'T')
						if ((e = getchar()) == 'E')
							printf("\nROUTE");
						else
							printf("ROUT%c", e);
					else
						printf("ROU%c", t);
				else
					printf("RO%c", u);
			else
				printf("R%c", o);
		else
			putchar(r);
	}
	putchar('\n');
}
-- 
David Herron,  cbosgd!ukma!david, david at UKMA.BITNET.

Experience is something you don't get until just after you need it.
/* ---------- */



More information about the Comp.lang.c mailing list