/*
 *  Copyright (C) 2007. QLogic Corporation. All Rights Reserved.
 */

/*

  Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.

   Path64 is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation version 2.1

   Path64 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 General Public
   License for more details.

   You should have received a copy of the GNU General Public License
   along with Path64; see the file COPYING.  If not, write to the Free
   Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
   02110-1301, USA.

   Special thanks goes to SGI for their continued support to open source

*/


#pragma ident "@(#) libu/errmsg/lwarn.c	92.1	06/25/99 17:24:37"
#include <liberrno.h>
#include <errno.h>
#include <stdarg.h>
#include <cray/portdefs.h>

#ifdef KEY /* Bug 7479 */
/*
 * Issue informational "comment" message (imitating the front end) using
 * standard the error-message machinery
 *
 * errn		Error number (see liberrno.h)
 * ...		Optional arguments to be inserted into error message
 */
void
_lcomment(int errn, ...)
{
	va_list		args;		/* Variable argument list	*/
	va_start(args, errn);
	_lmessage(errn, "COMMENT", args);
	va_end(args);
}
#endif /* KEY Bug 7479 */

/*
 *	_lwarn - library run-time warning processor
 *
 *		Returns:
 *			 0  Warning printed
 *			-1  _lwarn() called with no arguments
 *			-2  _lwarn() called with a warning number outside
 *			    the range of library message numbers.
 */

int
_lwarn(int errn, ...)
{
	va_list		args;		/* Variable argument list	*/

#ifdef	_CRAY
	if (_numargs() < 1)
		return(-1);
#endif

	if (((errn < BASE) || (errn > (BASE+999))) &&
	    ((errn < FDC_ERRB) || (errn > (FDC_ERRB+999))))
		return(-2);

	va_start(args, errn);

	_lmessage(errn, "WARNING", args);

	va_end(args);

	return(0);
}

/* Provide duplicate entry point. Used by SCC */
#ifdef	_UNICOS
#pragma _CRI duplicate _lwarn as $lwarn
#endif
