| 1 | /* $Id: kLdrErr.c 2955 2007-02-07 07:07:16Z bird $ */ | 
|---|
| 2 | /** @file | 
|---|
| 3 | * | 
|---|
| 4 | * kLdr - The Dynamic Loader, Error Code Methods. | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> | 
|---|
| 7 | * | 
|---|
| 8 | * | 
|---|
| 9 | * This file is part of kLdr. | 
|---|
| 10 | * | 
|---|
| 11 | * kLdr is free software; you can redistribute it and/or modify | 
|---|
| 12 | * it under the terms of the GNU General Public License as published by | 
|---|
| 13 | * the Free Software Foundation; either version 2 of the License, or | 
|---|
| 14 | * (at your option) any later version. | 
|---|
| 15 | * | 
|---|
| 16 | * kLdr is distributed in the hope that it will be useful, | 
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 19 | * GNU General Public License for more details. | 
|---|
| 20 | * | 
|---|
| 21 | * You should have received a copy of the GNU General Public License | 
|---|
| 22 | * along with kLdr; if not, write to the Free Software | 
|---|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | 
|---|
| 24 | * | 
|---|
| 25 | */ | 
|---|
| 26 |  | 
|---|
| 27 |  | 
|---|
| 28 | /******************************************************************************* | 
|---|
| 29 | *   Header Files                                                               * | 
|---|
| 30 | *******************************************************************************/ | 
|---|
| 31 | #include <kLdr.h> | 
|---|
| 32 |  | 
|---|
| 33 |  | 
|---|
| 34 | /** | 
|---|
| 35 | * Translate the error code into a string containing | 
|---|
| 36 | * the error constant. | 
|---|
| 37 | * | 
|---|
| 38 | * @returns Read only string with the constant name. | 
|---|
| 39 | * @param   rc      The error code. | 
|---|
| 40 | */ | 
|---|
| 41 | const char *kLdrErrStr(int rc) | 
|---|
| 42 | { | 
|---|
| 43 | switch (rc) | 
|---|
| 44 | { | 
|---|
| 45 | case 0: return "SUCCESS"; | 
|---|
| 46 | #define ERR_CONST(c) case c: return #c; | 
|---|
| 47 | #include "kldrErrConsts.h" | 
|---|
| 48 | #undef ERR_CONST | 
|---|
| 49 | default: | 
|---|
| 50 | break; | 
|---|
| 51 | } | 
|---|
| 52 | return "KLDR_ERR_UNKNOWN_ERROR"; | 
|---|
| 53 | } | 
|---|
| 54 |  | 
|---|
| 55 |  | 
|---|