Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!rutgers!mephisto!utkcs2!alphard!battle From: battle@alphard.cs.utk.edu (David Battle) Newsgroups: comp.windows.x Subject: ch3/rmtest2.c in contrib/young.examples.tar.Z from expo Message-ID: <1530@utkcs2.cs.utk.edu> Date: 3 Jan 90 18:03:04 GMT Sender: news@utkcs2.cs.utk.edu Reply-To: battle@alphard.cs.utk.edu (David Battle) Organization: CS Dept -- University of TN, Knoxville Lines: 65 I just compiled the examples from Doug Young's Xt book on my DecStation 3100. Of the ones I have tried, most seem to work. I am having trouble, however, with the one that uses command-line specified resources. It is ch3/rmtest2.c. Here is the relevant part of the code: #include #include typedef struct { Pixel fg, bg; int delay; Boolean verbose; } ApplicationData, *ApplicationDataPtr; static XtResource resources[] = { { "delay", "Delay", XtRInt, sizeof (int), XtOffset(ApplicationDataPtr, delay), XtRString, "2" }, { "verbose", "Verbose", XtRBoolean, sizeof (Boolean), XtOffset(ApplicationDataPtr, verbose), XtRString, "False"}, }; XrmOptionDescRec options[] = { {"-verbose", "*verbose", XrmoptionNoArg, "True"}, {"-delay", "*delay", XrmoptionStickyArg, NULL} }; main(argc, argv) int argc; char *argv[]; { Widget toplevel; ApplicationData data; toplevel = XtInitialize(argv[0], "Rmtest", options, XtNumber(options), &argc, argv); /* Retrieve the application resources. */ XtGetApplicationResources(toplevel, &data, resources, XtNumber(resources), NULL, 0); /* Print the results. */ printf("fg = %d, bg = %d, delay = %d, verbose = %d\n", data.fg, data.bg, data.delay, data.verbose); } This complies and loads fine, but when I try to run it and use the "-delay" option, I get errors from Xt. I have tried every way I can think of (using -delay rather than -xrm "delay: 5"). Here is what happens: % rmtest2 -delay5 X Toolkit Warning: Cannot convert string "-delay5" to type Integer fg = 0, bg = 2, delay = 2, verbose = 0 % rmtest2 -delay 5 X Toolkit Warning: Cannot convert string "-delay" to type Integer fg = 0, bg = 2, delay = 2, verbose = 0 % rmtest2 -xrm "*delay: 5" fg = 0, bg = 2, delay = 5, verbose = 0 The last one works OK, but I want to know why the first one doesn't. Isn't that the way it should look with a XrmoptionStickyArg? -David L. Battle battle@battle.esd.ornl.gov battle@utkux1.utk.edu