Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!ATHENA.MIT.EDU!swick From: swick@ATHENA.MIT.EDU (Ralph R. Swick) Newsgroups: comp.windows.x Subject: Re: display name from within Xaw Message-ID: <8804281342.AA01954@LYRE.MIT.EDU> Date: 28 Apr 88 13:42:47 GMT References: <8804272312.AA07144@velveeta> Sender: usenet@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 31 Bob's recommendation (XDisplayString) is, of course, the correct way to solve your problem, (see last line below), but the real bug in your test case was incorrectly typing the resource variable. String resources are always passed as pointers. The following mods make your example work: #include #include char *display, *dspname; static XtResource resources[] = { { "display", "Display", XtRString, sizeof(char *), (Cardinal)&display, XtRString, NULL }, }; main(argc, argv) int argc; char **argv; { Widget top_shell = XtInitialize("top", "test", NULL, 0, &argc, argv ); if (argc != 1) printf("extra args\n"); XtGetApplicationResources(top_shell, (caddr_t) NULL, resources, XtNumber(resources), NULL, 0); if (display != NULL) printf("display=%s\n", display); if ((dspname = XDisplayName(NULL)) != NULL) printf("dspname=%s\n", dspname); printf("Display=%s\n", XDisplayString(XtDisplay(top_shell))); }