/*
 *				f x e j e c . c
 */

/*)LIBRARY
*/

#ifdef	DOCUMENTATION

title	fxeject	Eject (Delete) an Item From a Flex
index		Eject (delete) an item from a flex

synopsis

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

	 FLEX *
	 fxeject(fx,n)
	 FLEX *fx;
	 unsigned n;

description

	fxeject(fx,n) removes item n from the flex fx, moving all later items
	in to fill in the gap.  The space allocated for the flex is not
	changed, however.

	fxeject() returns fx if all went well, NULL if n was not a legal item
	number or fx was damaged.

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 *
fxeject(fx,n)
FLEX *fx;
unsigned n;
{	register unsigned isz;
	register char *p, *end;

	if ((p = fxitem(fx,n)) == NULL)
		return(NULL);
	isz = fx->fxisz;
	end = fx->fxdata + isz*fx->fxused;
	while (p < end)
	{	p[0] = p[isz];
		p++;
	}
	--fx->fxused;
	return(fx);
}
