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