Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!samsung!cs.utexas.edu!hellgate.utah.edu!helios.ee.lbl.gov!epb2.lbl.gov!envbvs From: envbvs@epb2.lbl.gov (Brian V. Smith) Newsgroups: comp.windows.x Subject: Re: bug in XtGetApplicationResources Keywords: incorrect parsing of resources on sun 4 Message-ID: <5062@helios.ee.lbl.gov> Date: 13 Mar 90 00:13:03 GMT References: <5061@helios.ee.lbl.gov> Sender: usenet@helios.ee.lbl.gov Reply-To: envbvs@epb2.lbl.gov (Brian V. Smith) Organization: lbl Lines: 61 X-Local-Date: 12 Mar 90 16:13:03 PST I just posted info about a bug in XtGetApplicationResources, to which I have found a "solution". The problem was that I had initialized my "landscape" variable to 1 before calling XtGetApplicationResources and that was preventing it (somehow) from setting it to 0 when I gave the -portrait option. If the variable starts as 0 then everything is fine, i.e. if the user specifies -portrait then landscape = 0, and if -portrait is NOT specified landscape = 1. Why does it matter if the variable has a non-zero value to start? Again, this is only a problem on a sun4 (running sunos4.0) and not a problem on a Vaxstation (Ultrix 3.0) or DECstation 3100 (Ultrix 3.0) Here is the program again: #include #include #include static int true = True; static int false = False; int landscape = 1; /****** PROBLEM BECAUSE OF THIS *****/ int RHS_PANEL = 0; static XtResource application_resources[] = { {XtNjustify, XtCJustify, XtRBoolean, sizeof(int), (Cardinal)&RHS_PANEL, XtRBoolean, (caddr_t)&false}, {"landscape", XtCOrientation, XtRBoolean, sizeof(int), (Cardinal)&landscape, XtRBoolean, (caddr_t)&true}, }; static XrmOptionDescRec options[] = { {"-right", ".justify", XrmoptionNoArg, "True" }, {"-portrait", ".landscape", XrmoptionNoArg, "False"}, }; main(argc,argv) int argc; char *argv[]; { Widget tool; tool = XtInitialize("fig", "Fig", options, XtNumber(options), &argc, argv); XtGetApplicationResources(tool, 0, application_resources, XtNumber(application_resources), NULL, 0 ); fprintf(stderr,"landscape = %d, justify = %d\n",landscape,RHS_PANEL); } _____________________________________ Brian V. Smith (bvsmith@lbl.gov) Lawrence Berkeley Laboratory I don't speak for LBL, these non-opinions are all mine.