Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!mcnc!duke!romeo!ndd From: ndd@romeo.cs.duke.edu (Ned D. Danieley) Newsgroups: comp.windows.x Subject: Re: XrmParseCommand and command flags Keywords: XrmParseCommand Message-ID: <14161@duke.cs.duke.edu> Date: 10 Apr 89 13:30:37 GMT References: <760@stan.stan.UUCP> Sender: news@duke.cs.duke.edu Reply-To: ndd@romeo.UUCP (Ned D. Danieley) Organization: Duke University CS Dept.; Durham, NC Lines: 91 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