massager.c

smug/massager.c · 501 B

From the archive smug-r8.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 */
int main ()
{
  int c;

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

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

Site Stats

Snippets: 1791
Codebases: 571