Detabbed
[AROS.git] / rom / dos / dosgetstring.c
blob9d13c288f6e2379d0061753881f8cd88b35d744e
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: DosGetString() - Support for localized strings.
6 Lang: english
7 */
9 #include "dos_intern.h"
11 /*****i***********************************************************************
13 NAME */
14 #include <proto/dos.h>
16 AROS_LH1(STRPTR, DosGetString,
18 /* SYNOPSIS */
19 AROS_LHA(LONG, stringNum, D1),
21 /* LOCATION */
22 struct DosLibrary *, DOSBase, 163, Dos)
24 /* FUNCTION
25 Internal DOS function, will return the string corresponding to
26 the number stringNum.
28 INPUTS
29 stringNum - The number of the string you want.
31 RESULT
32 A pointer to a string, or NULL if no string could be found with
33 a matching number.
35 NOTES
36 Error strings will ALWAYS be less than 80 characters, and should
37 ideally be less than 60 characters.
39 This is a private function, whose the only purpose is to be patched
40 by locale.library.
42 EXAMPLE
44 BUGS
46 SEE ALSO
48 INTERNALS
49 This is dosPrivate5()
51 ******************************************************************************/
53 AROS_LIBFUNC_INIT
55 LONG *p = DOSBase->dl_Errors->estr_Nums;
56 UBYTE *q = DOSBase->dl_Errors->estr_Strings;
60 LONG n = p[0];
61 LONG m = p[1];
63 while (n <= m)
65 if (n == stringNum)
66 return q + 1;
68 q += q[0] + 1;
69 ++n;
72 p += 2;
74 while (p[0] != 0);
76 return "undefined error";
78 AROS_LIBFUNC_EXIT
80 } /* DosGetString */