Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
19
cde/programs/dtdocbook/xlate_locale/Imakefile
Normal file
19
cde/programs/dtdocbook/xlate_locale/Imakefile
Normal file
@@ -0,0 +1,19 @@
|
||||
XCOMM $XConsortium: Imakefile /main/4 1996/10/26 13:55:35 rws $
|
||||
/* xlate_locale Imakefile */
|
||||
|
||||
XLATESRC = $(DTSVCSRC)/DtUtil2
|
||||
|
||||
INCLUDES = -I$(XLATESRC)
|
||||
|
||||
SRCS = xlate_locale.c
|
||||
|
||||
OBJS = xlate_locale.o
|
||||
|
||||
#ifdef UXPArchitecture
|
||||
SYS_LIBRARIES = -lgen
|
||||
#endif
|
||||
|
||||
DEPLIBS = $(DEPDTSVCLIB)
|
||||
LOCAL_LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
|
||||
|
||||
ComplexProgramTarget(xlate_locale)
|
||||
45
cde/programs/dtdocbook/xlate_locale/xlate_locale.c
Normal file
45
cde/programs/dtdocbook/xlate_locale/xlate_locale.c
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "LocaleXlate.h"
|
||||
#include "XlationSvc.h"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
_DtXlateDb myDb = NULL;
|
||||
char myPlatform[_DtPLATFORM_MAX_LEN+1];
|
||||
char *locale;
|
||||
char *newLocale;
|
||||
int execVer;
|
||||
int compVer;
|
||||
|
||||
locale = getenv("LANG");
|
||||
if (!locale || (strcmp(locale, "C") == 0) || (strcmp(locale, "POSIX") == 0)) {
|
||||
puts("C.ISO-8859-1");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ((_DtLcxOpenAllDbs(&myDb) != 0) ||
|
||||
(_DtXlateGetXlateEnv(myDb,myPlatform,&execVer,&compVer) != 0)) {
|
||||
fprintf(stderr,
|
||||
"Warning: could not open locale translation database.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (_DtLcxXlateOpToStd(myDb,
|
||||
myPlatform,
|
||||
execVer,
|
||||
DtLCX_OPER_SETLOCALE,
|
||||
locale,
|
||||
&newLocale,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL)) {
|
||||
fprintf(stderr,
|
||||
"Warning: could not translate local to CDE locale\n");
|
||||
}
|
||||
|
||||
puts(newLocale);
|
||||
|
||||
_DtLcxCloseDb(&myDb);
|
||||
}
|
||||
Reference in New Issue
Block a user