/*	mcread: text.c
	Copyright (C) 1991, Mike Gleason Jr & NCEMRSoft.
	All Rights Reserved. */

#include <stdio.h>
#include "mcread.h"

/*ARGSUSED*/
int thrash_text(in, name, dataforklen, isTeachText)
	register FILE *in;
	char *name;
	long dataforklen;
	register short isTeachText;
{
	int c;
	register long bytesIn;
	
	bytesIn = 0L;
	wwInit(); c = 0;
	while (bytesIn < dataforklen && c != EOF) {
		wwInit();
		while (bytesIn < dataforklen && (c = getc(in)) != EOF) {
			bytesIn++;
			if (isTeachText && c == HARDSPACE) { 	/* TeachText inserts PICTs starting at id=1000,*/
				(void) puts("### picture omitted!");/* when it encounters a hard space. */
				while ((c = getc(in)) == '\r') bytesIn++;	/* Now, eat a bunch of blank lines. */
				(void) ungetc (c, in); bytesIn--;
			}
			else {
				if (wwPutchar(c & 0x00ff))
					return (0);
				if (c == '\r') break;
			}
		}
		if (wwFlush())
			return (0);
	}
	return (0);
}	/* thrash_text */

/* eof */
