1 | /**************** RCMsg C Program Source Code File (.C) ****************/ |
2 | /* PROGRAM NAME: RCMSG */ |
3 | /* ------------- */ |
4 | /* Version 1.3 */ |
5 | /* */ |
6 | /* COPYRIGHT */ |
7 | /* ---------- */ |
8 | /* (C) Copyright to the author Olivier BERTRAND: 2005 - 2014 */ |
9 | /* */ |
10 | /* WHAT THIS PROGRAM DOES */ |
11 | /* ----------------------- */ |
12 | /* This program simulates LoadString. */ |
13 | /* */ |
14 | /***********************************************************************/ |
15 | #if !defined(XMSG) |
16 | #include <stdio.h> |
17 | #include <string.h> |
18 | #include "resource.h" |
19 | #include "rcmsg.h" |
20 | #if defined(NEWMSG) |
21 | #include "msgid.h" |
22 | #endif // NEWMSG |
23 | |
24 | #if !defined(__WIN__) |
25 | #define stricmp strcasecmp |
26 | #endif // !__WIN__ |
27 | |
28 | char *msglang(void); |
29 | |
30 | const char *GetMsgid(int id) |
31 | { |
32 | const char *p = NULL; |
33 | |
34 | // This conditional until a real fix is found for MDEV-7304 |
35 | #if defined(FRENCH) |
36 | if (!stricmp(msglang(), "french" )) |
37 | switch (id) { |
38 | #include "frids.h" |
39 | #if defined(NEWMSG) |
40 | #include "frcas.h" |
41 | #endif // NEWMSG |
42 | } // endswitch(id) |
43 | |
44 | else // English |
45 | #endif // FRENCH |
46 | switch (id) { |
47 | #include "enids.h" |
48 | #if defined(NEWMSG) |
49 | #include "encas.h" |
50 | #endif // NEWMSG |
51 | } // endswitch(id) |
52 | |
53 | return p; |
54 | } // end of GetMsgid |
55 | |
56 | int GetRcString(int id, char *buf, int bufsize) |
57 | { |
58 | const char *p = NULL; |
59 | char msg[32]; |
60 | |
61 | if (!(p = GetMsgid(id))) { |
62 | sprintf(msg, "ID=%d unknown" , id); |
63 | p = msg; |
64 | } // endif p |
65 | |
66 | return sprintf(buf, "%.*s" , bufsize-1, p); |
67 | } // end of GetRcString |
68 | |
69 | #endif // !XMSG |
70 | |