Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame^] | 1 | /* Return note type name. |
| 2 | Copyright (C) 2002 Red Hat, Inc. |
| 3 | Written by Ulrich Drepper <drepper@redhat.com>, 2002. |
| 4 | |
| 5 | This program is Open Source software; you can redistribute it and/or |
| 6 | modify it under the terms of the Open Software License version 1.0 as |
| 7 | published by the Open Source Initiative. |
| 8 | |
| 9 | You should have received a copy of the Open Software License along |
| 10 | with this program; if not, you may obtain a copy of the Open Software |
| 11 | License version 1.0 from http://www.opensource.org/licenses/osl.php or |
| 12 | by writing the Open Source Initiative c/o Lawrence Rosen, Esq., |
| 13 | 3001 King Ranch Road, Ukiah, CA 95482. */ |
| 14 | |
| 15 | #ifdef HAVE_CONFIG_H |
| 16 | # include <config.h> |
| 17 | #endif |
| 18 | |
| 19 | #include <inttypes.h> |
| 20 | #include <stdio.h> |
| 21 | #include <libeblP.h> |
| 22 | |
| 23 | |
| 24 | const char * |
| 25 | ebl_core_note_type_name (ebl, type, buf, len) |
| 26 | Ebl *ebl; |
| 27 | uint32_t type; |
| 28 | char *buf; |
| 29 | size_t len; |
| 30 | { |
| 31 | const char *res = ebl->core_note_type_name (type, buf, len); |
| 32 | |
| 33 | if (res == NULL) |
| 34 | { |
| 35 | static const char *knowntypes[] = |
| 36 | { |
| 37 | #define KNOWNSTYPE(name) [NT_##name] = #name |
| 38 | KNOWNSTYPE (PRSTATUS), |
| 39 | KNOWNSTYPE (FPREGSET), |
| 40 | KNOWNSTYPE (PRPSINFO), |
| 41 | KNOWNSTYPE (TASKSTRUCT), |
| 42 | KNOWNSTYPE (PLATFORM), |
| 43 | KNOWNSTYPE (AUXV), |
| 44 | KNOWNSTYPE (GWINDOWS), |
| 45 | KNOWNSTYPE (ASRS), |
| 46 | KNOWNSTYPE (PSTATUS), |
| 47 | KNOWNSTYPE (PSINFO), |
| 48 | KNOWNSTYPE (PRCRED), |
| 49 | KNOWNSTYPE (UTSNAME), |
| 50 | KNOWNSTYPE (LWPSTATUS), |
| 51 | KNOWNSTYPE (LWPSINFO), |
| 52 | KNOWNSTYPE (PRFPXREG) |
| 53 | }; |
| 54 | |
| 55 | /* Handle standard names. */ |
| 56 | if (type < sizeof (knowntypes) / sizeof (knowntypes[0]) |
| 57 | && knowntypes[type] != NULL) |
| 58 | res = knowntypes[type]; |
| 59 | else |
| 60 | { |
| 61 | snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type); |
| 62 | |
| 63 | res = buf; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return res; |
| 68 | } |