1/* 2 * $Id: strerror.c,v 1.1.1.1 2008/10/15 03:30:50 james26_jang Exp $ 3 * 4 * Copyright (C) 1996 Lars Fenneberg and Christian Graefe 5 * 6 * This file is provided under the terms and conditions of the GNU general 7 * public license, version 2 or any later version, incorporated herein by 8 * reference. 9 * 10 */ 11 12#include "config.h" 13#include "includes.h" 14 15/* 16 * if we're missing strerror, these are mostly not defined either 17 */ 18extern int sys_nerr; 19extern char *sys_errlist[]; 20 21/* 22 * Function: strerror 23 * 24 * Purpose: implements strerror for systems which lack it. if these 25 * systems even lack sys_errlist, you loose... 26 * 27 */ 28 29 30char *strerror(int err) 31{ 32 static char buf[32]; 33 34 if (err >= 0 && err < sys_nerr) 35 return sys_errlist[err]; 36 else { 37 sprintf(buf, "unknown error: %d", errno); 38 return buf; 39 } 40} 41