add result

This commit is contained in:
Bob Halley
1998-10-14 22:35:04 +00:00
parent 18cc70d001
commit fda0ab6a96
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
#ifndef ISC_RESULT_H
#define ISC_RESULT_H 1
typedef unsigned int isc_result;
#define ISC_R_SUCCESS 0
#define ISC_R_NOMEMORY 1
#define ISC_R_UNEXPECTED 0xFFFFFFFFL
#define isc_result_to_text __isc_result_to_text
char * isc_result_to_text(isc_result);
#endif /* ISC_RESULT_H */

18
lib/isc/result.c Normal file
View File

@@ -0,0 +1,18 @@
#include <isc/result.h>
#define LAST_ENTRY ISC_R_NOMEMORY
static char *text_table[LAST_ENTRY+1] = {
"success",
"out of memory"
};
char *
isc_result_to_text(isc_result result) {
if (result == ISC_R_UNEXPECTED)
return ("unexpected error");
if (result > LAST_ENTRY)
return ("unknown result code");
return (text_table[result]);
}