/*
 *				f x s e t . c
 */

/*)LIBRARY
*/

#ifdef	DOCUMENTATION

title	fxset	Set the Value of an Item In a Flex
index		Set the value of an item in a flex

synopsis

	 #ifdef vms
	 #include "c:flex.h"
	 #else
	 #include <flex.h>
	 #endif

	 FLEX *
	 fxset(fx,itm,n)
	 FLEX *fx;
	 char *itm;
	 unsigned n;

description

	fxset(fx,itm,n) changes the value of item n in fx to itm.  It is
	mainly useful for "information-hiding"; if you always use fxset() to
	set elements, rather than using the address returned by fxitem()
	directly, you'll find it much easier to use a different set of flex
	handlers - e.g. flex handlers that page data to disk and need to know
	when in-core data has been changed.  Also, it could easily produce
	some sort of immediate "index out of range" error, instead of just
	returning NULL (for easier debugging).

	fxset() returns fx itself if all went well, and NULL if fx was damaged
	or had no item n.

bugs

author

	Jerry Leichter

#endif

/*
 * )EDITLEVEL=06
 * Edit history
 * 0.0  7-May-81 JSL	Invention
 * 0.1 23-Jun-81 JSL	Conversion to the new documentation convention
 */

#ifdef	vms
#include "c:flex.h"
#else
#include <flex.h>
#endif
#define NULL 0

FLEX *
fxset(fx,itm,n)
register FLEX *fx;
char *itm;
unsigned n;
{	register char *p;

	if ((p = fxitem(fx,n)) == NULL)
		return(NULL);
	copy(p,itm,fx->fxisz);
	return(fx);
}
