Annotation of embedaddon/libiconv/libcharset/tools/locale_x11encoding.c, revision 1.1
1.1 ! misho 1: /* Prints the locale's encoding via libX11. */
! 2:
! 3: #include <stdlib.h>
! 4: #include <stdio.h>
! 5: #include <assert.h>
! 6: #include <locale.h>
! 7: #include <X11/Xlib.h>
! 8: #include <X11/Xutil.h>
! 9:
! 10: int main (int argc, char* argv[])
! 11: {
! 12: Display* display;
! 13: XTextProperty textprop;
! 14: char* input;
! 15:
! 16: if (argc != 1)
! 17: exit(1);
! 18:
! 19: setlocale(LC_CTYPE,"");
! 20:
! 21: display = XOpenDisplay(NULL);
! 22: if (display == NULL) {
! 23: fprintf(stderr,"cannot open display\n");
! 24: exit(1);
! 25: }
! 26:
! 27: input = "";
! 28: if (XmbTextListToTextProperty(display, &input, 1, XTextStyle, &textprop) != Success) {
! 29: fprintf(stderr,"XmbTextListToTextProperty failed\n");
! 30: exit(1);
! 31: }
! 32: assert(textprop.format == 8);
! 33: assert(textprop.nitems == 0);
! 34:
! 35: printf("%s\n", XGetAtomName(display, textprop.encoding));
! 36:
! 37: XCloseDisplay(display);
! 38:
! 39: exit(0);
! 40: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>