1N/A/*
1N/A * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
1N/A * All rights reserved.
1N/A * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
1N/A * Copyright (c) 1988, 1993
1N/A * The Regents of the University of California. All rights reserved.
1N/A *
1N/A * By using this file, you agree to the terms and conditions set
1N/A * forth in the LICENSE file which can be found at the top level of
1N/A * the sendmail distribution.
1N/A *
1N/A */
1N/A
1N/A#pragma ident "%Z%%M% %I% %E% SMI"
1N/A
1N/A#include <sm/gen.h>
1N/ASM_RCSID("@(#)$Id: strerror.c,v 1.21 2001/06/17 21:31:41 ca Exp $")
1N/A
1N/A/*
1N/A** define strerror for platforms that lack it.
1N/A*/
1N/A
1N/A#include <errno.h>
1N/A#include <stdio.h> /* sys_errlist, on some platforms */
1N/A
1N/A#include <sm/io.h> /* sm_snprintf */
1N/A#include <sm/string.h>
1N/A#include <sm/conf.h>
1N/A#include <sm/errstring.h>
1N/A
1N/A#if !defined(ERRLIST_PREDEFINED)
1N/Aextern char *sys_errlist[];
1N/Aextern int sys_nerr;
1N/A#endif /* !defined(ERRLIST_PREDEFINED) */
1N/A
1N/A#if !HASSTRERROR
1N/A
1N/A/*
1N/A** STRERROR -- return error message string corresponding to an error number.
1N/A**
1N/A** Parameters:
1N/A** err -- error number.
1N/A**
1N/A** Returns:
1N/A** Error string (might be pointer to static buffer).
1N/A*/
1N/A
1N/Achar *
1N/Astrerror(err)
1N/A int err;
1N/A{
1N/A static char buf[64];
1N/A
1N/A if (err >= 0 && err < sys_nerr)
1N/A return (char *) sys_errlist[err];
1N/A else
1N/A {
1N/A (void) sm_snprintf(buf, sizeof(buf), "Error %d", err);
1N/A return buf;
1N/A }
1N/A}
1N/A#endif /* !HASSTRERROR */