示例#1
0
/*
 * handleMenuCommand - this routine takes a menu and an id and executes the
 *                     command associated with the menu item if there is an
 *                     item with that id.
 */
static vi_rc handleMenuCommand( menu *m, int menuid )
{
    item        *citem;
    vi_rc       rc;

    for( citem = m->item_head; citem != NULL; citem = citem->next ) {
        if( citem->menuid == menuid ) {
            /* run this command */
            IMEsc();
            rc = RunCommandLine( citem->cmd );
#ifdef __WIN__
            SetWindowCursorForReal();
#endif
            return( rc );
        }
    }
    return( MENU_COMMAND_NOT_HANDLED );

} /* handleMenuCommand */
示例#2
0
/*
 * handleMenuCommand - this routine takes a menu and an id and executes the
 *                     command associated with the menu item if there is an
 *                     item with that id.
 */
static vi_rc handleMenuCommand( menu *m, UINT id )
{
    item        *citem;
    char        *str;
    int         len;
    vi_rc       rc;

    for( citem = m->item_head; citem != NULL; citem = citem->next ) {
        if( citem->id == id ) {
            /* run this command */
            len = strlen( citem->cmd ) + 1;
            str = alloca( len );
            memcpy( str, citem->cmd, len );
            IMEsc();
            rc = RunCommandLine( str );
#ifdef __WIN__
            SetWindowCursorForReal();
#endif
            return( rc );
        }
    }
    return( MENU_COMMAND_NOT_HANDLED );

} /* handleMenuCommand */