grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / c / iprefs / patches.c
bloba9a0b67ae96b5e2e9e490d1f9a7ed60804f394f0
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /*********************************************************************************************/
11 #include "global.h"
13 #include <exec/execbase.h>
14 #include <aros/libcall.h>
16 /*********************************************************************************************/
18 #define LIB_EXEC 1
19 #define LIB_UTILITY 2
20 #define LIB_DOS 3
21 #define LIB_LOCALE 4
23 /*********************************************************************************************/
25 static struct patchinfo
27 WORD library;
28 WORD whichfunc;
29 WORD patchlibrary;
30 WORD whichpatchfunc;
32 pi [] =
34 #if DO_LOCALE_PATCHES
35 {LIB_EXEC , 87 , LIB_LOCALE, 31}, /* RawDoFmt */
36 {LIB_UTILITY, 28 , LIB_LOCALE, 32}, /* Strnicmp */
37 {LIB_UTILITY, 27 , LIB_LOCALE, 33}, /* Stricmp */
38 {LIB_UTILITY, 30 , LIB_LOCALE, 34}, /* ToLower */
39 {LIB_UTILITY, 29 , LIB_LOCALE, 35}, /* ToUpper */
40 {LIB_DOS , 124, LIB_LOCALE, 36}, /* DateToStr */
41 {LIB_DOS , 125, LIB_LOCALE, 37}, /* StrToDate */
42 {LIB_DOS , 154, LIB_LOCALE, 38}, /* DosGetLocalizedString */
43 #endif
44 {0 }
47 /*********************************************************************************************/
49 static struct Library *GetLib(WORD which)
51 struct Library *lib = NULL;
53 switch(which)
55 case LIB_EXEC:
56 lib = (struct Library *)SysBase;
57 break;
59 case LIB_DOS:
60 lib = (struct Library *)DOSBase;
61 break;
63 case LIB_UTILITY:
64 lib = (struct Library *)UtilityBase;
65 break;
67 case LIB_LOCALE:
68 lib = (struct Library *)LocaleBase;
69 break;
72 return lib;
75 /*********************************************************************************************/
77 void InstallPatches(void)
79 WORD i;
81 Forbid();
82 for(i = 0; pi[i].library; i++)
84 SetFunction(GetLib(pi[i].library),
85 -pi[i].whichfunc * LIB_VECTSIZE,
86 __AROS_GETVECADDR(GetLib(pi[i].patchlibrary), pi[i].whichpatchfunc));
89 Permit();
91 patches_installed = TRUE;
94 /*********************************************************************************************/