char *GetMsgid(int id) { 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
char *PlugReadMessage(PGLOBAL g, int mid, char *m) { char msgfile[_MAX_PATH], msgid[32], buff[256]; char *msg; FILE *mfile = NULL; //GetPrivateProfileString("Message", msglang, "Message\\english.msg", // msgfile, _MAX_PATH, plgini); //strcat(strcat(strcpy(msgfile, msg_path), msglang()), ".msg"); strcat(strcpy(buff, msglang()), ".msg"); PlugSetPath(msgfile, NULL, buff, msg_path); if (!(mfile = fopen(msgfile, "rt"))) { sprintf(stmsg, "Fail to open message file %s", msgfile); goto err; } // endif mfile for (;;) if (!fgets(buff, 256, mfile)) { sprintf(stmsg, "Cannot get message %d %s", mid, SVP(m)); goto fin; } else if (atoi(buff) == mid) break; if (sscanf(buff, " %*d %s \"%[^\"]", msgid, stmsg) < 2) { // Old message file if (!sscanf(buff, " %*d \"%[^\"]", stmsg)) { sprintf(stmsg, "Bad message file for %d %s", mid, SVP(m)); goto fin; } else m = NULL; } // endif sscanf if (m && strcmp(m, msgid)) { // Message file is out of date strcpy(stmsg, m); goto fin; } // endif m fin: fclose(mfile); err: if (g) { // Called by STEP msg = (char *)PlugSubAlloc(g, NULL, strlen(stmsg) + 1); strcpy(msg, stmsg); } else // Called by MSG or PlgGetErrorMsg msg = stmsg; return msg; } // end of PlugReadMessage