Example #1
0
void con_charout(char c)
{
    char tmp = c;
    static int InCmd;

#ifdef CONFIG_BIOS_VT52

    if (InCmd)
	CommandChar(c);
    if (c == 27) {
	InCmd=1;
	return;
    }

#endif

    /* \n\r handling */
    if (c == '\n')
	con_charout('\r');
    rawout(c);
}
Example #2
0
/*  readSKey - handle additional keys for the read file window.
 *
 *  arguments:
 *      hWnd        handle of window receiving message
 *      key         keystroke to handle
 *
 *  return value:
 *      TRUE (-1)   key handled, exit window proc immediately
 *      FALSE (0)   key not handled
 *
 *  IMPORTANT:
 *      this procedure should be used as the keyProc for read windows with
 *      messages ONLY!
 */
FLAG PASCAL INTERNAL readSKey ( HW hWnd, INT key )
{
    FLAG retVal = TRUE;
    struct fileType *pFT;
    HW      hWndT;
    PSTR    pTmpFN;
    CHAR    buf [ MAXLINELEN ];
    INT     ch;
    PSTR    p;
    INT     idoc;
    INT     inote;

    /*
     *  if key == c | m | w then we are going to start a command and pass
     *  subsequent chars to CommandChar.
     *  These chars appear on the command line.
     *  cchCmdLine is the number of chars on the command line.
     *  ENTER and ^C when sent to CommandChar will set cchCmdLine to zero.
     *  When there are char on cmd line, we pass the buck to CommandChar.
     *  When there are no char on cmd line, then we do all processing here.
     *
     *  Don't use BringToTop (hCommand ) because we want this window to
     *  remain the topmost window so it receives all char so we can monitor
     *  when cchCmdLine goes to zero.
     */

    if ( cchCmdLine ) {
        CommandChar ( hCommand, key );  /* will change value of cchCmdLine */
        hWndT = ( cchCmdLine ? hCommand : hWnd );
        SetCursor ( hWndT, hWndT->crsrX, hWndT->crsrY );
        return TRUE;
        }

    if ( (key > 127) || (key < 0) ) key = 0;	/* if extended code, null and drop through*/

    switch ( ( ch = tolower ( key ) ) ) {
    case 'c':
        p = "copy . ";
        goto strtcmd;
    case 'm':
        p = "move . ";
        goto strtcmd;
    case 'w':
        p = "write ";
strtcmd:
        if ( fAllowCM ) {
            while ( *p )
                CommandChar ( hCommand, *p++ );
            SetCursor ( hCommand, hCommand->crsrX, hCommand->crsrY );
        }
        else
            retVal = FALSE;
        break;
    case 'd':
        ChangeHeaderFlag ( idocRead, F_DELETED, 0 );
    case 'e' :
    case 'n' :
    case 'p' :
    case ENTER :
    case CTRLENTER :
        switch ( ch ) {
        case 'e' :
            sprintf ( buf, "%d", idocRead + 1 );
            DoEditMsg ( hCommand, buf, 0 );
            idoc = idocRead;
            break;
        case 'd' :
        case 'n' :
        case ENTER :
        case 'p' :
            idoc = -1;
            inote = Look4Inote (MapIdocInote (idocRead),
                                ch == 'p' ? -1 : 1,
                                !(key == 'N' || key == 'P'));
            if ( inote != ERROR )
                idoc = mpInoteIdoc [ inote ];
            break;
        case CTRLENTER :
            idoc = NextUnread ( MapIdocInote ( idocRead ) );
            break;
        default :
            idoc = -1;
            break;
            }
        pTmpFN = mktmpnam ( );
        if ( ( idoc != -1 ) && ( IdocToFile ( idoc, pTmpFN, 0 ) != ERROR)) {
            ChangeHeaderFlag ( idocRead = idoc, 0, F_UNREAD );
            SendMessage ( hWnd, CLOSE, 0 );
            hReadMessage = hWnd;    /* CLOSE set it to null */
            pFT = ( struct fileType *) ZMalloc ( sizeof ( *pFT ) );
            pFT->fDeleteRead = TRUE;
            pFT->fileRead = ZMMakeStr ( pTmpFN );
            /* redraw window w/o erasing and redrawing everything else */
            SendMessage ( hWnd, CREATE, pFT );
            sprintf ( buf, "Message %d", idoc + 1 );
            SetWindowText ( hWnd, buf );
            if ( ch == 'e' )
                BringToTop ( hWnd, TRUE );
            else
                DrawWindow ( hWnd, FALSE );
            SendMessage ( hHeaders, GOTOIDOCALL, idocRead = idoc );
            }
        else
            SendMessage ( hWnd, KEY, ESC );
        ZMfree ( pTmpFN );
        break;
    case 'f' :
    case 'r' :
        CloseWindow ( hWnd );
        commandLine[0] = (CHAR) key;
        commandLine[1] = '\0';
        if ( ch == 'f' )
            DoForward ( hCommand, strEMPTY, 0 );
        else
            DoReply ( hCommand, strEMPTY, 0 );
        SendMessage ( hCommand, DISPPROMPT, TRUE );
        break;
    default :
        retVal = FALSE;
        break;
        }
    return retVal;
}