/**********************************************************************
 * helpez2ascii.c -- utility to help ez2ascii handle non-atk ez-saved files.
 *
 * $Author$
 * $Source$
 * $Header$
 *
 * Copyright 1991 by the Massachusetts Institute of Technology.
 *
 * For copying and distribution information, please see the file
 * <mit-copyright.h>.
 **********************************************************************/
#include <mit-copyright.h>

#ifndef lint
static char rcsid_helpez2ascii_c[] = "$Header$";
#endif /* lint */

#include <stdio.h>

main(argc, argv)
     int argc;
     char *argv[];
{
  register int ch;
  register int previous_char_was_newline=0;

  while((ch=getc(stdin)) != EOF) {
    if ((char)ch == '\n') {
      if ( ! previous_char_was_newline) {
	if (putc((char) ch, stdout) == EOF) { /* write extra newline */
	  perror(argv[0]);
	  exit(1);
	}
	previous_char_was_newline = 1;
      }
    } else {
      previous_char_was_newline = 0;
    }
    if (putc((char) ch, stdout) == EOF) {
      perror(argv[0]);
      exit(1);
    }
  }
  exit(0);
}
