bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Very interesting thing happend while creating a menu item...


From: jon wackley
Subject: RE: Very interesting thing happend while creating a menu item...
Date: Wed, 26 Feb 2003 12:48:12 -0500

Hi All,

Just a curiousity, is this a bug, or a case of improper api use?

Thanks,
jonw

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden 
> Behalf Of
> jon wackley
> Sent: February 18, 2003 9:08 PM
> To: address@hidden
> Cc: address@hidden
> Subject: Very interesting thing happend while creating a menu item...
> 
> 
> 
> Here is the usage scenario;
> 
> 1.  Prompt for a numeric string from the user.
> 2.  If there is a non-digit in the string, create a 
> corresponding menu item
> and display it to the user.  This is a very primitive though useful
> implementation of a dialog box, I'm working in a minimal 
> system.  Works
> extremely well.  For feedback purposes the first found 
> non-digit is also
> displayed.
> 
> if the user type in "a123"
> 
> Example output centred on screen;  Non digit found: 'a'...
> 
> A new user, not used to the new system pressed ESC then enter 
> to the get
> string prompt.  The string checking determined that the escape is a
> non-digit and the dialog box attempted to display.  Creating 
> a menu item
> that contains an ESCAPE causes the menu item to not be created;
> 
>         menu_items_array[counter] =
>             new_item(current_specifier -> menu_item_name, "");
>             assert(menu_items_array[counter] != NULL);
> 
> The assert fails when there is an ESC char contained in the 
> string passed as
> the first argument (name) to new_item.  The very quick and 
> painless way
> around this was not to include the non-digit character in the 
> dialog prompt
> screen.  Just thought you may be interested in hearing about 
> this.  asserts
> are our friend :-).
> 
> Thanks,
> jonw
> 
> 
> 
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-ncurses
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]