I have seen how to configure xrm resource names via XrmOptionDescRec struct array. An example of this can be found in this question.
I am wondering if I can also pass non-X11 related arguments via this way.
In particular, if I want to pass the name of a named pipe to the application so the X11 application opens that particular named pipe,
- would it be using XrmOptionDescRec struct array an option?
- Can I set up and retrieve arbitrary resource names?
- If so, how do I retrieve the argument value?
#include <stdlib.h>
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/PushB.h>
static XrmOptionDescRec options[] = {
{ "-namedpipe", "namedpipe", XrmoptionSepArg, NULL },
};
int main(int argc, char *argv[]) {
Widget toplevel; /* Top Level Button */
XtAppContext app; /* Application Context */
char *window_title = NULL; /* Top Level Window Title */
/* INITIALIZE TOP LEVEL WINDOW */
XtSetLanguageProc(NULL, NULL, NULL);
toplevel = XtVaOpenApplication( &app, argv[0], options, XtNumber(options), &argc, argv, NULL, sessionShellWidgetClass, NULL);
/* HOW WOULD I GET HERE named_pipe ASSIGNED ????? */
char named_pipe[256];
...
/* REALIZE TOPLEVEL WINDOW AND LAUNCH APPLICATION LOOP */
XtRealizeWidget(toplevel);
XtAppMainLoop(app);
return 0;
}
Just for anyone interested. In Xt/Motif applications this seems to be the way to handle application command line parameters as resources (they have the advantage of being handled smoothly by the Xt wrappers around Xlib resource manager functions). So basically you will be able to define the argument in user, application and system-wide resource files, and also via command line.