/*
 *			m c h e c k . c
 */

/*)LIBRARY
*/

#ifdef	DOCUMENTATION

title	_mchec	Check Memory Address
index		check Memory address

synopsis

	int
	_mcheck(adr)
	 char *adr;		/* address to check */

description

	_mcheck() examines a section of memory to be free'd, and if it can't
	be free'd, then an error message is displayed, and the program is
	aborted.

bugs

author

	Machiavelli Systems

#endif



_mcheck(adress)
char	*adress;
{
	char	*s;

	switch	(isalloc(adress))
	{
	case -1: s = "attempt to free chunk already free";  break;
	case  0: s = "bad memory chunk address";	    break;
	case  1: s = "";				    break;
	default: s = "bad return from isalloc";		    break;
	};

	if	(*s)	/* if there's somthing wrong, scream */
		{
		printf("_mcheck:\7 adress=%oo error=\"%s\"\n",adress,s);
		error("_mcheck:\7 adress=%oo error=\"%s\"\n",adress,s);
		};
}
