massager.c

smug/massager.c · 473 B

From the archive smug.tar.gz

Download the archive   « Back to the archive contents

/* Copyright 1989, 1990 by James Aspnes, David Applegate, and Bennet Yee */
/* See the file COPYING for distribution information */
#include <stdio.h>

/* Sends stdin to stdout, replacing blank lines with '\n' */
/* and all other newlines with tabs */
main()
{
    int c;

    while((c = getchar()) != EOF) {
	if(c == '\n') {
	    putchar('\t');
	    if((c = getchar()) == EOF) break;
	    putchar(c);
	} else {
	    putchar(c);
	}
    }

    putchar('\n');
    exit(0);
}

Site Stats

Snippets: 1791
Codebases: 571