ftp.nice.ch/pub/next/unix/developer/docgen.0.3.2.s.tar.gz#/docgen-0.3.2/dynstr/dstrio.c

This is dstrio.c in view mode; [Download] [Up]

/* dstring v1.0.0	Dynamic string library
 * Copyright (c) 1994 Bill Bereza
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *
 * To reach the author
 *
 * email:
 *	berezaw@river.it.gvsu.edu	ac368@leo.nmc.edu
 *
 *	$Log:	dstrio.c,v $
 * Revision 1.5  94/12/08  10:42:39  berezaw
 * fgetds: c had to be at least int or larger
 * 
 * Revision 1.4  94/12/03  00:09:54  berezaw
 * changed all uses of (char) to (DCHAR)
 * 
 * Revision 1.3  94/12/02  11:50:55  berezaw
 * using DCHAR definition
 * 
 * Revision 1.2  94/11/28  12:04:07  berezaw
 * *** empty log message ***
 * 
 *
 *	@(#)dstrio.c	1.0 (Bill Bereza) 11/15/94
 *	$Header: /Users/berezaw/src/dynstr/RCS/dstrio.c,v 1.5 94/12/08 10:42:39 berezaw Exp $
 */

#include "dstrio.h"

DSTRING *fgetds(DSTRING *addstring, FILE *stream)
{
	register signed long c;
	
	for(;(c=getc(stream))!=EOF && c!='\n';daddchar(addstring, (DCHAR)c));
	return addstring;
}

DCHAR *fgetdline(FILE *stream)
{
	DSTRING *tstring;
	DCHAR *charline;
	
	if((tstring=initdstr())==NULL)
	  return NULL;
	else {
		fgetds(tstring, stream);
		charline=arrdstr(tstring);
		freedstr(tstring);
		return charline;
	}
}

DCHAR *fgetdstr(DSTRING *tstring, FILE *stream)
{
	DCHAR *charline;
	
	if(tstring==NULL)
	  return NULL;
	else {
		fgetds(tstring, stream);
		charline=arrdstr(tstring);
		
		return charline;
	}
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.