Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / identify / idalert.c
blob9872afae27de58a5948c18ca34d0171df8c92833
1 /*
2 * Copyright (c) 2010-2011 Matthias Rustler
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
22 * $Id$
25 #include <exec/alerts.h>
27 #include <proto/utility.h>
29 #include <string.h>
31 #include "identify_intern.h"
32 #include "identify.h"
33 #include "locale.h"
35 const struct
37 ULONG id;
38 CONST_STRPTR entry;
39 } subsystem[] =
41 {0x00000000, "CPU" },
42 {0x01000000, "exec.library" },
43 {0x02000000, "graphics.library" },
44 {0x03000000, "layers.library" },
45 {0x04000000, "intuition.library" },
46 {0x05000000, "math#?.library" },
47 {0x07000000, "dos.library" },
48 {0x08000000, "ramlib" },
49 {0x09000000, "icon.library" },
50 {0x0A000000, "expansion.library" },
51 {0x0B000000, "diskfont.library" },
52 {0x10000000, "audio.device" },
53 {0x11000000, "console.device" },
54 {0x12000000, "gameport.device" },
55 {0x13000000, "keyboard.device" },
56 {0x14000000, "trackdisk.device" },
57 {0x15000000, "timer.device" },
58 {0x20000000, "cia?.resource" },
59 {0x21000000, "disk.resource" },
60 {0x22000000, "misc.resource" },
61 {0x30000000, "bootstrap" },
62 {0x31000000, "Workbench" },
63 {0x32000000, "DiskCopy" },
64 {0x33000000, "gadtools.library" },
65 {0x34000000, "utility.library" },
66 {-1, NULL }
69 const struct
71 ULONG id;
72 ULONG entry;
73 } general[] =
75 {0x00000000, MSG_AG_GENERAL }, // $00000000
76 {AG_NoMemory, MSG_AG_NOMEMORY }, // $00010000
77 {AG_MakeLib, MSG_AG_MAKELIB }, // $00020000
78 {AG_OpenLib, MSG_AG_OPENLIB }, // $00030000
79 {AG_OpenDev, MSG_AG_OPENDEV }, // $00040000
80 {AG_OpenRes, MSG_AG_OPENRES }, // $00050000
81 {AG_IOError, MSG_AG_IOERROR }, // $00060000
82 {AG_NoSignal, MSG_AG_NOSIGNAL }, // $00070000
83 {AG_BadParm, MSG_AG_BADPARM }, // $00080000
84 {AG_CloseLib, MSG_AG_CLOSELIB }, // $00090000 Usually too many closes
85 {AG_CloseDev, MSG_AG_CLOSEDEV }, // $000A0000 or a mismatched close
86 {AG_ProcCreate, MSG_AG_PROCCREATE }, // $000B0000 Process creation failed
87 {-1, 0 }
90 const struct
92 ULONG id;
93 ULONG entry;
94 } alerts[] =
96 {0x00000000, MSG_AN_NOALERT }, // $00000000 kein Alert
97 {ACPU_BusErr, MSG_ACPU_BUSERR }, // $80000002 Hardware bus fault/access error
98 {ACPU_AddressErr, MSG_ACPU_ADDRESSERR }, // $80000003 Illegal address access (ie: odd)
99 {ACPU_InstErr, MSG_ACPU_INSTERR }, // $80000004 Illegal instruction
100 {ACPU_DivZero, MSG_ACPU_DIVZERO }, // $80000005 Divide by zero
101 {ACPU_CHK, MSG_ACPU_CHK }, // $80000006 Check instruction error
102 {ACPU_TRAPV, MSG_ACPU_TRAPV }, // $80000007 TrapV instruction error
103 {ACPU_PrivErr, MSG_ACPU_PRIVERR }, // $80000008 Privilege violation error
104 {ACPU_Trace, MSG_ACPU_TRACE }, // $80000009 Trace error
105 {ACPU_LineA, MSG_ACPU_LINEA }, // $8000000A Line 1010 Emulator error
106 {ACPU_LineF, MSG_ACPU_LINEF }, // $8000000B Line 1111 Emulator error
107 {0x8000000C, MSG_ACPU_EMUINTR }, // $8000000C Emulator interrupt
108 {0x8000000D, MSG_ACPU_COPRVIOL }, // $8000000D Coprocessor protocol violation
109 {ACPU_Format, MSG_ACPU_FORMAT }, // $8000000E Stack frame format error
110 {ACPU_Spurious, MSG_ACPU_SPURIOUS }, // $80000018 Spurious interrupt error
111 {ACPU_AutoVec1, MSG_ACPU_AUTOVEC1 }, // $80000019 AutoVector Level 1 interrupt error
112 {ACPU_AutoVec2, MSG_ACPU_AUTOVEC2 }, // $8000001A AutoVector Level 2 interrupt error
113 {ACPU_AutoVec3, MSG_ACPU_AUTOVEC3 }, // $8000001B AutoVector Level 3 interrupt error
114 {ACPU_AutoVec4, MSG_ACPU_AUTOVEC4 }, // $8000001C AutoVector Level 4 interrupt error
115 {ACPU_AutoVec5, MSG_ACPU_AUTOVEC5 }, // $8000001D AutoVector Level 5 interrupt error
116 {ACPU_AutoVec6, MSG_ACPU_AUTOVEC6 }, // $8000001E AutoVector Level 6 interrupt error
117 {ACPU_AutoVec7, MSG_ACPU_AUTOVEC7 }, // $8000001F AutoVector Level 7 interrupt error
118 {0x80000030, MSG_ACPU_FPCPBRANCH }, // $80000030 FPCP branch or set on unordered condition
119 {0x80000031, MSG_ACPU_FPCPINEXACT }, // $80000031 FPCP inexact result
120 {0x80000032, MSG_ACPU_FPCPDIVZERO }, // $80000032 FPCP divide by zero
121 {0x80000033, MSG_ACPU_FPCPUNDER }, // $80000033 FPCP underflow
122 {0x80000034, MSG_ACPU_FPCPOPERROR }, // $80000034 FPCP operand error
123 {0x80000035, MSG_ACPU_FPCPOVER }, // $80000035 FPCP overflow
124 {0x80000036, MSG_ACPU_NAN }, // $80000036 FPCP signaling NAN
125 {0x80000037, MSG_ACPU_UNIMPLDTYPE }, // $80000037 FPCP unimplemented data type
126 {0x80000038, MSG_ACPU_MMUCONFIG }, // $80000038 PMMU configuration
127 {0x80000039, MSG_ACPU_MMUILLEGAL }, // $80000039 PMMU illegal configuration
128 {0x8000003A, MSG_ACPU_MMUACCVIOL }, // $8000003A PMMU access level violation
129 {0x8000003C, MSG_ACPU_UNIMPLEA }, // $8000003C FPCP unimplemented effective address
130 {0x8000003D, MSG_ACPU_UNIMPLII }, // $8000003D FPCP unimplemented integer instruction
131 {AN_ExecLib, MSG_AN_EXECLIB }, // $01000000
132 {AN_ExcptVect, MSG_AN_EXCPTVECT }, // $01000001 68000 exception vector checksum (obs.)
133 {AN_BaseChkSum, MSG_AN_BASECHKSUM }, // $01000002 Execbase checksum bad (obs.)
134 {AN_LibChkSum, MSG_AN_LIBCHKSUM }, // $01000003 Library checksum failure
135 {AN_MemCorrupt, MSG_AN_MEMCORRUPT }, // $81000005 Corrupt memory list detected in FreeMem
136 {AN_IntrMem, MSG_AN_INTRMEM }, // $81000006 No memory for interrupt servers
137 {AN_InitAPtr, MSG_AN_INITAPTR }, // $01000007 InitStruct() of an APTR source (obs.)
138 {AN_SemCorrupt, MSG_AN_SEMCORRUPT }, // $01000008 A semaphore is in an illegal state at ReleaseSemaphore()
139 {AN_FreeTwice, MSG_AN_FREETWICE }, // $01000009 Freeing memory that is already free
140 {AN_BogusExcpt, MSG_AN_BOGUSEXCPT }, // $8100000A Illegal 68k exception taken (obs.)
141 {AN_IOUsedTwice, MSG_AN_IOUSEDTWICE }, // $0100000B Attempt to reuse active IORequest
142 {AN_MemoryInsane, MSG_AN_MEMORYINSANE }, // $0100000C Sanity check on memory list failed during AvailMem(MEMF_LARGEST)
143 {AN_IOAfterClose, MSG_AN_IOAFTERCLOSE }, // $0100000D IO attempted on closed IORequest
144 {AN_StackProbe, MSG_AN_STACKPROBE }, // $0100000E Stack appears to extend out of range
145 {AN_BadFreeAddr, MSG_AN_BADFREEADDR }, // $0100000F Memory header not located. [ Usually an invalid address passed to FreeMem() ]
146 {AN_BadSemaphore, MSG_AN_BADSEMAPHORE }, // $01000010 An attempt was made to use the old message semaphores.
147 {0x810000FF, MSG_AN_BADQUICKINT }, // $810000FF A quick interrupt has happened to an uninitialized vector.
148 {AN_GraphicsLib, MSG_AN_GRAPHICSLIB }, // $02000000
149 {AN_GfxNewError, MSG_AN_GFXNEWERROR }, // $0200000C
150 {AN_GfxFreeError, MSG_AN_GFXFREEERROR }, // $0200000D
151 {AN_ObsoleteFont, MSG_AN_OBSOLETEFONT }, // $02000401 unsupported font description used
152 {AN_GfxNoMem, MSG_AN_GFXNOMEM }, // $82010000 graphics out of memory
153 {AN_GfxNoMemMspc, MSG_AN_GFXNOMEMMSPC }, // $82010001 MonitorSpec alloc, no memory
154 {AN_LongFrame, MSG_AN_LONGFRAME }, // $82010006 long frame, no memory
155 {AN_ShortFrame, MSG_AN_SHORTFRAME }, // $82010007 short frame, no memory
156 {AN_TextTmpRas, MSG_AN_TEXTTMPRAS }, // $02010009 text, no memory for TmpRas
157 {AN_BltBitMap, MSG_AN_BLTBITMAP }, // $8201000A BltBitMap, no memory
158 {AN_RegionMemory, MSG_AN_REGIONMEMORY }, // $8201000B regions, memory not available
159 {AN_MakeVPort, MSG_AN_MAKEVPORT }, // $82010030 MakeVPort, no memory
160 {AN_GfxNoLCM, MSG_AN_GFXNOLCM }, // $82011234 emergency memory not available
161 {AN_LayersLib, MSG_AN_LAYERSLIB }, // $03000000
162 {AN_LayersNoMem, MSG_AN_LAYERSNOMEM }, // $83010000 layers out of memory
163 {AN_Intuition, MSG_AN_INTUITION }, // $04000000
164 {AN_GadgetType, MSG_AN_GADGETTYPE }, // $84000001 unknown gadget type
165 {AN_BadGadget, MSG_AN_BADGADGET }, // $04000001 Recovery form of AN_GadgetType
166 {AN_ItemBoxTop, MSG_AN_ITEMBOXTOP }, // $84000006 item box top < RelZero
167 {AN_SysScrnType, MSG_AN_SYSSCRNTYPE }, // $84000009 open sys screen, unknown type
168 {AN_BadState, MSG_AN_BADSTATE }, // $8400000C Bad State Return entering Intuition
169 {AN_BadMessage, MSG_AN_BADMESSAGE }, // $8400000D Bad Message received by IDCMP
170 {AN_WeirdEcho, MSG_AN_WEIRDECHO }, // $8400000E Weird echo causing incomprehension
171 {AN_NoConsole, MSG_AN_NOCONSOLE }, // $8400000F couldn't open the Console Device
172 {AN_NoISem, MSG_AN_NOISEM }, // $04000010 Intuition skipped obtaining a sem
173 {AN_ISemOrder, MSG_AN_ISEMORDER }, // $04000011 Intuition obtained a sem in bad order
174 {AN_CreatePort, MSG_AN_CREATEPORT }, // $84010002 create port, no memory
175 {AN_ItemAlloc, MSG_AN_ITEMALLOC }, // $04010003 item plane alloc, no memory
176 {AN_SubAlloc, MSG_AN_SUBALLOC }, // $04010004 sub alloc, no memory
177 {AN_PlaneAlloc, MSG_AN_PLANEALLOC }, // $84010005 plane alloc, no memory
178 {AN_OpenScreen, MSG_AN_OPENSCREEN }, // $84010007 open screen, no memory
179 {AN_OpenScrnRast, MSG_AN_OPENSCRNRAST }, // $84010008 open screen, raster alloc, no memory
180 {AN_AddSWGadget, MSG_AN_ADDSWGADGET }, // $8401000A add SW gadgets, no memory
181 {AN_OpenWindow, MSG_AN_OPENWINDOW }, // $8401000B open window, no memory
182 {AN_MathLib, MSG_AN_MATHLIB }, // $05000000
183 {AN_DOSLib, MSG_AN_DOSLIB }, // $07000000
184 {AN_EndTask, MSG_AN_ENDTASK }, // $07000002 EndTask didn't
185 {AN_QPktFail, MSG_AN_QPKTFAIL }, // $07000003 Qpkt failure
186 {AN_AsyncPkt, MSG_AN_ASYNCPKT }, // $07000004 Unexpected packet received
187 {AN_FreeVec, MSG_AN_FREEVEC }, // $07000005 Freevec failed
188 {AN_DiskBlkSeq, MSG_AN_DISKBLKSEQ }, // $07000006 Disk block sequence error
189 {AN_BitMap, MSG_AN_BITMAP }, // $07000007 Bitmap corrupt
190 {AN_KeyFree, MSG_AN_KEYFREE }, // $07000008 Key already free
191 {AN_BadChkSum, MSG_AN_BADCHKSUM }, // $07000009 Invalid checksum
192 {AN_DiskError, MSG_AN_DISKERROR }, // $0700000A Disk Error
193 {AN_KeyRange, MSG_AN_KEYRANGE }, // $0700000B Key out of range
194 {AN_BadOverlay, MSG_AN_BADOVERLAY }, // $0700000C Bad overlay
195 {AN_BadInitFunc, MSG_AN_BADINITFUNC }, // $0700000D Invalid init packet for cli/shell
196 {AN_FileReclosed, MSG_AN_FILERECLOSED }, // $0700000E A filehandle was closed more than once
197 {AN_StartMem, MSG_AN_STARTMEM }, // $07010001 no memory at startup
198 {AN_RAMLib, MSG_AN_RAMLIB }, // $08000000
199 {AN_BadSegList, MSG_AN_BADSEGLIST }, // $08000001 overlays are illegal for library segments
200 {AN_IconLib, MSG_AN_ICONLIB }, // $09000000
201 {AN_ExpansionLib, MSG_AN_EXPANSIONLIB }, // $0A000000
202 {AN_BadExpansionFree, MSG_AN_BADEXPANSIONFREE }, // $0A000001 Freeed free region
203 {AN_DiskfontLib, MSG_AN_DISKFONTLIB }, // $0B000000
204 {AN_AudioDev, MSG_AN_AUDIODEV }, // $10000000
205 {AN_ConsoleDev, MSG_AN_CONSOLEDEV }, // $11000000
206 {AN_NoWindow, MSG_AN_NOWINDOW }, // $11000001 Console can't open initial window
207 {AN_GamePortDev, MSG_AN_GAMEPORTDEV }, // $12000000
208 {AN_KeyboardDev, MSG_AN_KEYBOARDDEV }, // $13000000
209 {AN_TrackDiskDev, MSG_AN_TRACKDISKDEV }, // $14000000
210 {AN_TDCalibSeek, MSG_AN_TDCALIBSEEK }, // $14000001 calibrate: seek error
211 {AN_TDDelay, MSG_AN_TDDELAY }, // $14000002 delay: error on timer wait
212 {AN_TimerDev, MSG_AN_TIMERDEV }, // $15000000
213 {AN_TMBadReq, MSG_AN_TMBADREQ }, // $15000001 bad request
214 {AN_TMBadSupply, MSG_AN_TMBADSUPPLY }, // $15000002 power supply -- no 50/60hz ticks
215 {AN_CIARsrc, MSG_AN_CIARSRC }, // $20000000
216 {AN_DiskRsrc, MSG_AN_DISKRSRC }, // $21000000
217 {AN_DRHasDisk, MSG_AN_DRHASDISK }, // $21000001 get unit: already has disk
218 {AN_DRIntNoAct, MSG_AN_DRINTNOACT }, // $21000002 interrupt: no active unit
219 {AN_MiscRsrc, MSG_AN_MISCRSRC }, // $22000000
220 {AN_BootStrap, MSG_AN_BOOTSTRAP }, // $30000000
221 {AN_BootError, MSG_AN_BOOTERROR }, // $30000001 boot code returned an error
222 {AN_Workbench, MSG_AN_WORKBENCH }, // $31000000
223 {AN_NoFonts, MSG_AN_NOFONTS }, // $B1000001
224 {AN_WBBadStartupMsg2,MSG_AN_WBBADSTARTUPMSG2 }, // $31000002
225 {AN_WBBadIOMsg, MSG_AN_WBBADIOMSG }, // $31000003 Hacker code?
226 {AN_WBReLayoutToolMenu,MSG_AN_WBRELAYOUTTOOLMENU }, // $B1010009 GadTools broke?
227 {AN_DiskCopy, MSG_AN_DISKCOPY }, // $32000000
228 {AN_GadTools, MSG_AN_GADTOOLS }, // $33000000
229 {AN_UtilityLib, MSG_AN_UTILITYLIB }, // $34000000
230 {AN_Unknown, MSG_AN_LAWBREAKER }, // $35000000
231 {AN_Aros, MSG_AN_AROS }, // $40000000
232 {AN_OOP, MSG_AN_OOP }, // $41000000
233 {AN_Hidd, MSG_AN_HIDD }, // $42000000
234 {AN_HiddNoRoot, MSG_AN_HIDDNOROOT }, // $C2000001 /* Could not create root device */
235 {-1, 0 }
238 const struct
240 ULONG id;
241 CONST_STRPTR entry;
242 } objects[] =
244 {0x00008000, "" }, // $00008000
245 {AO_ExecLib, "exec.library" }, // $00008001
246 {AO_GraphicsLib, "graphics.library" }, // $00008002
247 {AO_LayersLib, "layers.library" }, // $00008003
248 {AO_Intuition, "intuition.library" }, // $00008004
249 {AO_MathLib, "math#?.library" }, // $00008005
250 {AO_DOSLib, "dos.library" }, // $00008007
251 {AO_RAMLib, "ramlib" }, // $00008008
252 {AO_IconLib, "icon.library" }, // $00008009
253 {AO_ExpansionLib,"expansion.library" }, // $0000800A
254 {AO_DiskfontLib, "diskfont.library" }, // $0000800B
255 {AO_UtilityLib, "utility.library" }, // $0000800C
256 {AO_KeyMapLib, "keymap.library" }, // $0000800D
257 {AO_AudioDev, "audio.device" }, // $00008010
258 {AO_ConsoleDev, "console.device" }, // $00008011
259 {AO_GamePortDev, "gameport.device" }, // $00008012
260 {AO_KeyboardDev, "keyboard.device" }, // $00008013
261 {AO_TrackDiskDev,"trackdisk.device" }, // $00008014
262 {AO_TimerDev, "timer.device" }, // $00008015
263 {AO_CIARsrc, "cia?.resource" }, // $00008020
264 {AO_DiskRsrc, "disk.resource" }, // $00008021
265 {AO_MiscRsrc, "misc.resource" }, // $00008022
266 {AO_BootStrap, "bootstrap" }, // $00008030
267 {AO_Workbench, "Workbench" }, // $00008031
268 {AO_DiskCopy, "DiskCopy" }, // $00008032
269 {AO_GadTools, "gadtools" }, // $00008033
270 {AO_ArosLib, "aros.library" }, // $00008040
271 {AO_OOPLib, "oop.library" }, // $00008041
272 {AO_HiddLib, "hidd.library" }, // $00008042
273 {-1, NULL }
276 /*****************************************************************************
278 NAME */
279 #include <proto/identify.h>
281 AROS_LH2(LONG, IdAlert,
283 /* SYNOPSIS */
284 AROS_LHA(ULONG , id , D0),
285 AROS_LHA(struct TagItem *, taglist, A0),
287 /* LOCATION */
288 struct IdentifyBaseIntern *, IdentifyBase, 7, Identify)
290 /* FUNCTION
291 Get a human readable description of the alert ('Guru') code.
293 INPUTS
294 Code -- (ULONG) alert code, as defined in exec/alerts.h
296 TagList -- (struct TagItem *) tags that describe further
297 options.
299 RESULT
300 Error -- (LONG) error code, or 0 if everything went fine.
302 TAGS
303 IDTAG_DeadStr -- (STRPTR) Alert type string (deadend or
304 recoverable). You may skip this tag if you do not
305 want to get the string.
307 IDTAG_SubsysStr -- (STRPTR) String of the subsystem that caused
308 the alert (CPU, exec.library, ...). You may skip this tag
309 if you do not want to get the string.
311 IDTAG_GeneralStr-- (STRPTR) General alert cause. You may skip
312 this tag if you do not want to get the string.
314 IDTAG_SpecStr -- (STRPTR) Specified alert cause. You may skip
315 this tag if you do not want to get the string.
317 IDTAG_StrLength -- (UWORD) Maximum length of the string buffer,
318 including termination. Defaults to 50.
320 IDTAG_Localize -- [V8] (BOOL) FALSE to get English strings
321 only, TRUE for localized strings. This is useful for
322 applications with English as only language. Defaults to TRUE.
324 NOTES
326 EXAMPLE
328 BUGS
330 SEE ALSO
332 INTERNALS
334 HISTORY
337 *****************************************************************************/
339 AROS_LIBFUNC_INIT
341 STRPTR deadstr = NULL;
342 STRPTR subsysstr = NULL;
343 STRPTR generalstr = NULL;
344 STRPTR specstr = NULL;
345 BOOL localize = TRUE;
346 ULONG strlength = 50;
347 ULONG searchFor;
348 ULONG i;
349 BOOL found;
351 struct TagItem *tag;
352 struct TagItem *tags;
354 for (tags = taglist; (tag = NextTagItem(&tags)); )
356 switch (tag->ti_Tag)
358 case IDTAG_DeadStr:
359 deadstr = (STRPTR)tag->ti_Data;
360 break;
362 case IDTAG_SubsysStr:
363 subsysstr = (STRPTR)tag->ti_Data;
364 break;
366 case IDTAG_GeneralStr:
367 generalstr = (STRPTR)tag->ti_Data;
368 break;
370 case IDTAG_SpecStr:
371 specstr = (STRPTR)tag->ti_Data;
372 break;
374 case IDTAG_StrLength:
375 strlength = tag->ti_Data;
376 break;
378 case IDTAG_Localize:
379 localize = tag->ti_Data ? TRUE : FALSE;
380 break;
384 if (strlength == 0)
386 return IDERR_NOLENGTH;
389 if (localize) {
390 /* FIXME: How should we handle this? */
393 if (deadstr)
395 if (id & (1L << 31)) // Bit 31 set? If yes: deadend
397 strlcpy(deadstr, _(MSG_ALERT_DEADEND), strlength);
399 else
401 strlcpy(deadstr, _(MSG_ALERT_RECOVERY), strlength);
405 if (subsysstr)
407 found = FALSE;
408 searchFor = id & 0x7f000000;
409 for (i = 0; subsystem[i].id != -1; i++)
411 if (searchFor == subsystem[i].id)
413 strlcpy(subsysstr, subsystem[i].entry, strlength);
414 found = TRUE;
415 break;
419 if (!found)
421 strlcpy(subsysstr, _(MSG_ALERT_UNKNOWN), strlength);
425 if (generalstr)
427 found = FALSE;
428 searchFor = id & 0xf0000;
429 for (i = 0; general[i].id != -1; i++)
431 if (searchFor == general[i].id)
433 strlcpy(generalstr, _(general[i].entry), strlength);
434 found = TRUE;
435 break;
439 if (!found)
441 strlcpy(generalstr, _(MSG_ALERT_UNKNOWN), strlength);
445 if (specstr)
447 *specstr = '\0'; // because of strlcat()
449 found = FALSE;
451 // search for object
452 if (id & (1L << 15))
454 searchFor = id & 0x7fff;
455 for (i = 0; objects[i].id != -1; i++)
457 if (searchFor == objects[i].id)
459 strlcpy(specstr, objects[i].entry, strlength);
460 found = TRUE;
461 break;
466 // search for alert
467 searchFor = id & 0x7fffffff;
468 for (i = 0; alerts[i].id != -1; i++)
470 if (searchFor == alerts[i].id)
472 strlcat(specstr, _(alerts[i].entry), strlength);
473 found = TRUE;
474 break;
478 if (!found)
480 strlcpy(specstr, _(MSG_ALERT_UNKNOWN), strlength);
484 return IDERR_OKAY;
486 AROS_LIBFUNC_EXIT
487 } /* IdAlert */