/* prototype filter program - line (actually record) oriented */
/* this flavour sorts out kinky RSX records into line-by-line UNIX records */
#include <stdio.h>
#include <algol68.h>
#define BUFSIZ 4096
char buffer[BUFSIZ];
main()
BEGIN
	WHILE	(!feof(stdin))
	DO	IF	(fgetss(buffer,BUFSIZ,stdin)!=NULL)
		THEN	fputss(buffer,stdout);
			IF	(ferror(stdout))
			THEN	error("Can't write\n");
			FI
		ELSE	IF	(ferror(stdin))
			THEN	error("Can't read\n");
			FI
		FI
	OD
	fflush(stdout);
	IF	(ferror(stdout))
	THEN	error("Can't flush\n");
	FI
	IF	(fclose(stdout))
	THEN	error("Can't close\n");
	FI
END

/* end: filter.c */
