/* * text.c -- McdeSys: the sentences of its errors, from a catalog * * License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. * * A sentence the user reads belongs in a catalog (ext/src/mcde/AGENTS.md, * language): common.c's tool errors are set 1 of mcdesys.cat * (lib/McdeSys/mcdesys.msg, the locale's copy in * programs/localized//msg). The catalog sits where the other CDE * catalogs are, /lib/nls/msg//; when the session has no * NLSPATH (a program started outside dtsession), this sets it the way CDE's * DtSvc does. */ #define _POSIX_C_SOURCE 200809L #include #include #include #include #include #include "private.h" static nl_catd cat = (nl_catd) -1; const char * mcde_sys_msg(int n, const char *text) { if (cat == (nl_catd) -1) { if (getenv("NLSPATH") == NULL) (void) setenv("NLSPATH", MCDE_DT_TOP "/lib/nls/msg/%L/%N.cat:" MCDE_DT_TOP "/lib/nls/msg/C/%N.cat", 0); cat = catopen("mcdesys", NL_CAT_LOCALE); } if (cat == (nl_catd) -1) return text; return catgets(cat, 1, n, text); }