- Tabs to spaces.
[AROS.git] / workbench / libs / locale / locdosgetlocalizedstring.c
blobf3e0bc7bfc4c2b871c11d0e1feeb4f72c6e5dd6d
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: LocStrToDateGetCharFunc - locale.library's private replacement
6 of dos.library/DosGetLocalizedString function. IPrefs will install
7 the patch.
9 Lang: english
12 #include <exec/types.h>
13 #include <proto/exec.h>
14 #include <proto/dos.h>
15 #include <proto/locale.h>
16 #include "locale_intern.h"
18 /*****************************************************************************
20 NAME */
21 #include <proto/locale.h>
23 AROS_PLH1(CONST_STRPTR, LocDosGetLocalizedString,
25 /* SYNOPSIS */
26 AROS_LHA(LONG, stringNum, D1),
28 /* LOCATION */
29 struct DosLibrary *, DOSBase, 38, Locale)
31 /* FUNCTION
32 See dos.library/DosGetString
34 INPUTS
35 See dos.library/DosGetString
37 RESULT
39 NOTES
40 This function is not called by apps directly. Instead
41 dos.library/DosGetLocalizedString is patched to use this function.
42 This means that the LocaleBase parameter above actually points to
43 DOSBase, so we make use of the global LocaleBase variable. This
44 function is marked as private, therefore the headers generator won't
45 mind the different basename in the header.
47 EXAMPLE
49 BUGS
51 SEE ALSO
52 dos.library/DosGetString()
54 INTERNALS
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 LONG *p = DOSBase->dl_Errors->estr_Nums;
61 UBYTE *q = DOSBase->dl_Errors->estr_Strings;
62 STRPTR defstr = NULL;
64 /* We should really call the original DosGetString(), but ah well... */
67 LONG n = p[0];
68 LONG m = p[1];
70 while (n <= m)
72 if (n == stringNum)
74 defstr = q + 1;
75 break;
78 q += q[0] + 1;
79 ++n;
82 p += 2;
84 while (p[0] != 0);
86 return GetCatalogStr(IntLB(LocaleBase)->lb_CurrentLocale->il_DosCatalog,
87 stringNum, defstr);
89 AROS_LIBFUNC_EXIT
93 #undef LocaleBase