#line 2 "osdep/winextra"

/*
 * This function scans the key menu and calls mswin.c functions
 * to build a corresponding windows menu.
 */
void
configure_menu_items (struct key_menu *km, bitmap_t bitmap)
{
    int 		i;
    struct key		*k;
    int			key;
    char		cleanLabel[64];
    char		*rb;

    mswin_menuitemclear ();

    for (i = 0, k = km->keys ; i < km->how_many * 12; i++, k++) {
	if (k->name != NULL && k->label != NULL && bitnset (i, bitmap) &&
	    k->menuitem != KS_NONE) {

	    if (k->name[0] == '^')
		key = ctrl(k->name[1]);
	    else if (strcmp(k->name, "Ret") == 0) 
		key = '\r';
	    else if (strcmp(k->name, "Spc") == 0) 
		key = ' ';
	    else
		key = k->name[0];

	    if (k->label[0] == '[' && strchr (k->label, ']') != NULL) {
	        strcpy (cleanLabel, &k->label[1]);
		rb = strchr (cleanLabel, ']');
		*rb = '\0';
		mswin_menuitemadd (key, cleanLabel, k->menuitem, 0);
	    }
	    else
	    	mswin_menuitemadd (key, k->label, k->menuitem, 0);
	}
    }
}
