[comp.windows.x] XMenuFindSelection

bala@PURDUE.EDU (04/28/87)

In XMenuFindSel.c, when you are trying to find the index of a selection
the given label is strNcmp'd against the existing selections in the
pane. Unfortunately the assumption is that the labels are a single word.

Suppose there is a selection called "finger" and you want to add a new 
selection called "finger foo". XMenuFindSelection will *NOT* return
XM_FAILURE as it takes "finger foo" and strncmp's it as follows:
	    if (strncmp (label, s_ptr->label, s_ptr->label_length) == 0) {
		_XMErrorCode = XME_NO_ERROR;
		return (i);
	    }

<label is "finger foo" and s_ptr->label are existing selections like "finger">
Thus if any existing label is a substring of the new label this would
(incorrectly) succeed.

I am generating a dynamic menu history (adding cmds to a pane eliminating
duplicates and stacking up the panes depending on history size) and i would
like to treat "finger foo" and "finger" as different commands.

Changing the strncmp to strcmp should fix this. Could this be done in X11?

Cheers,
bala

Balachander Krishnamurthy	bala@cs.purdue.edu        (ever reliable ARPA)
Dept. of Computer Sciences	bala.purdue@relay.cs.net  (reliable CSNET)
Purdue University    {ucbvax,decvax,hplabs}!purdue!bala	(semi reliable usenet)
W. Lafayette IN 47907		317-494-7805		(um, well, er... GTE)