Centralize catgets() calls through MsgCat
CDE has relied upon catgets() implementations following a relaxed interpretation of the XPG internationalization standard that ignored -1, the standard error value returned by catopen, as the catalog argument. However, this same behavior causes segmentation faults with the musl C library. This patch: - Centralizes (with the exception of ToolTalk) all calls to catopen(), catgets(), and catclose() through MsgCat within the DtSvc library. - Prevents calls to catgets() and catclose() that rely upon undefined behavior. - Eliminates a number of bespoke catgets() wrappers, including multiple redundant caching implementations designed to work around a design peculiarity in HP/UX. - Eases building CDE without XPG internationalization support by providing the appropriate macros.
This commit is contained in:
committed by
Jon Trulson
parent
3379999106
commit
a6ea2a2d52
@@ -33,7 +33,7 @@
|
||||
#define __TOOLTALK
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <nl_types.h>
|
||||
#include <Dt/MsgCatP.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
/***************************************************************************/
|
||||
@@ -190,7 +190,7 @@ typedef struct {
|
||||
/* Macro Declarations */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
#define GETMESSAGE(set, number, defstr) catgets(nlmsg_fd, set, number, defstr)
|
||||
#define GETMESSAGE(set, number, defstr) CATGETS(nlmsg_fd, set, number, defstr)
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
|
||||
@@ -1386,7 +1386,7 @@ main(int argc, char *argv[])
|
||||
for (i=1; i<argc; i++) {
|
||||
if ((argv[i][0] == '-') && (argv[i][1] == '?')) {
|
||||
setlocale(LC_ALL, "");
|
||||
nlmsg_fd = catopen("dtcreate", NL_CAT_LOCALE);
|
||||
nlmsg_fd = CATOPEN("dtcreate", NL_CAT_LOCALE);
|
||||
printf("%s\n",
|
||||
GETMESSAGE(5, 110, "Usage: dtcreate [<filename>] [-?]"));
|
||||
exit(0);
|
||||
@@ -1412,7 +1412,7 @@ main(int argc, char *argv[])
|
||||
UxTopLevel = XtAppInitialize(&UxAppContext, CLASS_NAME,
|
||||
NULL, 0, &argc, argv, NULL, NULL, 0);
|
||||
|
||||
nlmsg_fd = catopen("dtcreate", NL_CAT_LOCALE);
|
||||
nlmsg_fd = CATOPEN("dtcreate", NL_CAT_LOCALE);
|
||||
|
||||
UxDisplay = XtDisplay(UxTopLevel);
|
||||
UxScreen = XDefaultScreen(UxDisplay);
|
||||
|
||||
Reference in New Issue
Block a user