diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2002-01-24 17:58:42 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2002-01-24 17:58:42 +0000 |
commit | c48987263d3f55042a1e5d0c5e8411ed21161f2d (patch) | |
tree | 77ba8c0759d802c8505f8c156c2ba17717d80db5 /contrib/top/utils.c | |
parent | 37a39754f41e50ca628e970dc78475098d1c10c5 (diff) | |
download | FreeBSD-src-c48987263d3f55042a1e5d0c5e8411ed21161f2d.zip FreeBSD-src-c48987263d3f55042a1e5d0c5e8411ed21161f2d.tar.gz |
Resolve conflicts.
Diffstat (limited to 'contrib/top/utils.c')
-rw-r--r-- | contrib/top/utils.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/contrib/top/utils.c b/contrib/top/utils.c index 94233de..906170a 100644 --- a/contrib/top/utils.c +++ b/contrib/top/utils.c @@ -7,6 +7,8 @@ * * Copyright (c) 1984, 1989, William LeFebvre, Rice University * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University + * + * $FreeBSD$ */ /* @@ -324,24 +326,42 @@ long *diffs; /* * errmsg(errnum) - return an error message string appropriate to the * error number "errnum". This is a substitute for the System V - * function "strerror" with one important difference: the string - * returned by this function does NOT end in a newline! - * N.B.: there appears to be no reliable way to determine if - * "strerror" exists at compile time, so I make do by providing - * something of similar functionality. + * function "strerror". There appears to be no reliable way to + * determine if "strerror" exists at compile time, so I make do + * by providing something of similar functionality. For those + * systems that have strerror and NOT errlist, define + * -DHAVE_STRERROR in the module file and this function will + * use strerror. */ /* externs referenced by errmsg */ +#ifndef HAVE_STRERROR +#ifndef SYS_ERRLIST_DECLARED +#define SYS_ERRLIST_DECLARED +extern char *sys_errlist[]; +#endif + +extern int sys_nerr; +#endif + char *errmsg(errnum) int errnum; { +#ifdef HAVE_STRERROR + char *msg = strerror(errnum); + if (msg != NULL) + { + return msg; + } +#else if (errnum > 0 && errnum < sys_nerr) { return((char *)sys_errlist[errnum]); } +#endif return("No error"); } |