garya@stan.UUCP (Gary Aitken) (04/08/89)
I have vague recollections of this being discussed already, but I can't remember the results, so here goes again. XrmParseCommand accepts a prefix as a valid match. I.e. if an XrmOptionDescRec specifies "-synchronous", then "-s" is considered to be a match. This causes confusion and difficulty when one considers an application which has a flag such as "-s". This behavior is particularly questionable when one considers that adding subsequent "standard" options can potentially prevent existing applications from working correctly, since the name space for potential conflicts is the universe. For example, since no "standard" options currently exist beginning with "-p", an application will work correctly with flags of -p; but if at some later time a standard option such as "-popcorn" is added, the application will no longer work. One way around the problem is for the application to superimpose an options table onto the option tables already in use. However, this implies that the application will have be modified to use the resource manager mechanism to get/check for arguments, since they will be stripped out of argv. Is there some easy way to disable the prefix matching in the resource manager?
rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (04/10/89)
One way around the problem is for the application to superimpose an options table onto the option tables already in use. However, this implies that the application will have be modified to use the resource manager mechanism to get/check for arguments, since they will be stripped out of argv. For options carrying an argument, you can use XrmoptionSkipArg to avoid having them stripped out of argv. There really ought to be some way of keeping a singleton option from being stripped (XrmoptionSkipNoArg?), as well as some way of keeping an option with more than one argument (XrmoptionSkipNArgs?). Perhaps you'd like to develop a proposal... Is there some easy way to disable the prefix matching in the resource manager? Nope.
ndd@romeo.cs.duke.edu (Ned D. Danieley) (04/10/89)
In article <760@stan.stan.UUCP> garya@stan.UUCP (Gary Aitken) writes: >I have vague recollections of this being discussed already, but I can't >remember the results, so here goes again. > >XrmParseCommand accepts a prefix as a valid match.... I broached this topic a while back, but no one seemed to think that it is a bad idea. >Is there some easy way to disable the prefix matching in the resource manager? I just got rid of it in the code; so far it hasn't broken anything. I suspect it will give me problems with future patches, but I decided to accept that. Defining BAL (or whatever you like) will get rid of the substring matching. >>>> in TOP/lib/X/ParseCmd.c: *** ParseCmd.c.orig Mon Apr 10 09:16:33 1989 --- ParseCmd.c Fri Mar 3 15:27:09 1989 *************** *** 114,124 **** --- 114,126 ---- break; } } + #ifndef BAL else if (argchar == NULL) { /* may be an abbreviation for this option */ matches++; foundOption = i; } + #endif else if (table_is_sorted == Sorted && optchar > argchar) { break; } >>>> in TOP/lib/Xt/Display.c: *** Display.c.orig Mon Apr 10 09:14:50 1989 --- Display.c Thu Mar 16 13:55:14 1989 *************** *** 126,135 **** --- 126,137 ---- displayCopy[0] = 0; + #ifndef BAL for (i = 0; i < num_urs; i++) { ComputeAbbrevLen(urlist[i].option, "-display", &min_display_len); ComputeAbbrevLen(urlist[i].option, "-name", &min_name_len); } + #endif for(i = 1; i < *argc; i++) { int len = strlen(argv[i]); *************** *** 140,146 **** --- 142,152 ---- continue; } #endif + #ifndef BAL if(len > min_display_len && !strncmp("-display", argv[i], len)) { + #else + if (!strcmp("-display", argv[i])) { + #endif i++; if (i == *argc) break; (void) strncpy(displayCopy, argv[i], sizeof(displayCopy)); *************** *** 149,155 **** --- 155,165 ---- #endif continue; } + #ifndef BAL if(len > min_name_len && !strncmp("-name", argv[i], len)) { + #else + if (!strcmp("-name", argv[i])) { + #endif i++; if (i == *argc) break; applName = argv[i]; Ned Danieley (ndd@sunbar.mc.duke.edu) Basic Arrhythmia Laboratory Box 3140, Duke University Medical Center Durham, NC 27710 (919) 684-6807 or 684-6942