/* $Id: misc.c,v 1.1 1997/06/10 16:08:25 archer Exp $
 *	MISC.C - Commonly used subroutines
 */
#include "lorenai.h"
#include <ctype.h>
#include <memory.h>
#include <string.h>


/**
 ** FILE_GETS
 **	fgets, but without the annoying \n at the end
 **/
int file_gets(FILE *parsed_file)
{
char	*buf;
int	l;
/*
 * Quite straightforward
 */
	work[sizeof(work)-1] = 0;
	work[0] = 0;
	if (fgets(work, sizeof(work)-1, parsed_file) == 0)
		return 0;
	l = strlen(work) - 1;
	for (buf = work+l; l >= 0; l--)
		if (isspace(*buf))
			*buf-- = 0;
		else
			break;
	return 1;
}
