/* 7bits.c - lose top bit of each byte */
/* ufilter3.c - prototype filter program - line (actually record) oriented */

#include <stdio.h>
#include <algol68.h>
#define BUFSIZ 32768
char buffer[BUFSIZ];

main(argc,argv)
int	argc;
char	**argv;
BEGIN
register int	howlong;	/* char length of this record */
register char*	p;
register char*	pend;

	stdin  -> _flag |= IO_NOS | _IONBF;
	stdout -> _flag |= IO_NOS | _IONBF;

	WHILE	(!feof(stdin))
	DO	howlong = fget(buffer,BUFSIZ,stdin);
		IF	(ferror(stdin))
		THEN	error("read failure $$ferr=%oo\7\n",$$ferr);
		FI
		IF	(feof(stdin))
		THEN	exit(IO_SUCCESS);
		FI
		FOR	(p=buffer,pend=buffer+howlong; p<pend; p++)
		DO	*p &= 0x7F;
		OD
		fput(buffer,howlong,stdout);
		IF	(ferror(stdout))
		THEN	error("write failed $$ferr=%oo\7\n",$$ferr);
		FI
	OD
END

/* end: ufilter3.c */
