summaryrefslogtreecommitdiffstats
path: root/storage/connect/rcmsg.c
blob: 4cd443d88bb2b65bac02074e4a673d3ad0f57677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**************** RCMsg C Program Source Code File (.C) ****************/
/* PROGRAM NAME: RCMSG                                                 */
/* -------------                                                       */
/*  Version 1.3                                                        */
/*                                                                     */
/* COPYRIGHT                                                           */
/* ----------                                                          */
/*  (C) Copyright to the author Olivier BERTRAND:  2005 - 2014         */
/*                                                                     */
/* WHAT THIS PROGRAM DOES                                              */
/* -----------------------                                             */
/*  This program simulates LoadString.                                 */
/*                                                                     */
/***********************************************************************/
#if !defined(XMSG)
#include <stdio.h>
#include <string.h>
#include "resource.h"
#include "rcmsg.h"
#if defined(NEWMSG)
#include "msgid.h"
#endif   // NEWMSG

#if !defined(_WIN32)
#define stricmp  strcasecmp
#endif   // !_WIN32

char *msglang(void);

const char *GetMsgid(int id)
  {
  const char *p = NULL;

  // This conditional until a real fix is found for MDEV-7304
#if defined(FRENCH)
  if (!stricmp(msglang(), "french"))
    switch (id) {
#include "frids.h"
#if defined(NEWMSG)
#include "frcas.h"
#endif   // NEWMSG
    } // endswitch(id)

  else    // English
#endif   // FRENCH
    switch (id) {
#include "enids.h"
#if defined(NEWMSG)
#include "encas.h"
#endif   // NEWMSG
    } // endswitch(id)

  return p;
  } // end of GetMsgid

int GetRcString(int id, char *buf, int bufsize)
  {
  const char *p = NULL;
  char msg[32];

  if (!(p = GetMsgid(id))) {
    sprintf(msg, "ID=%d unknown", id);
    p = msg;
    } // endif p

  return sprintf(buf, "%.*s", bufsize-1, p);
  } // end of GetRcString

#endif // !XMSG