[rfa/cli] Accept ambiguious enum when an exact match

Andrew Cagney ac131313@cygnus.com
Tue Jun 6 04:22:00 GMT 2000


Hello,

Was trying out enums with the d10v architecture but found that:

  (gdb) set architecture d10v
 
failed. Turned out that an ambiguous enum that exactly matched was
ignored.

The attatched fixes this by checking for an exact match.

Ok?

	Andrew
Tue Jun  6 21:14:47 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* command.c (do_setshow_command): Accept an enum option immediatly
 	when it is an exact match.

Index: command.c
===================================================================
RCS file: /cvs/src/src/gdb/command.c,v
retrieving revision 1.11
diff -p -r1.11 command.c
*** command.c	2000/06/04 00:41:09	1.11
--- command.c	2000/06/06 11:16:47
*************** do_setshow_command (arg, from_tty, c)
*** 1696,1703 ****
  	    for (i = 0; c->enums[i]; i++)
  	      if (strncmp (arg, c->enums[i], len) == 0)
  		{
! 		  match = c->enums[i];
! 		  nmatches++;
  		}
  
  	    if (nmatches <= 0)
--- 1696,1712 ----
  	    for (i = 0; c->enums[i]; i++)
  	      if (strncmp (arg, c->enums[i], len) == 0)
  		{
! 		  if (c->enums[i][len] == '\0')
! 		    {
! 		      match = c->enums[i];
! 		      nmatches = 1;
! 		      break; /* exact match. */
! 		    }
! 		  else
! 		    {
! 		      match = c->enums[i];
! 		      nmatches++;
! 		    }
  		}
  
  	    if (nmatches <= 0)


More information about the Gdb-patches mailing list