Menu

#1 Suppport for control characters

closed
nobody
None
5
2023-01-01
2010-01-06
No

adding support for control characters (Ctrl-C, Ctrl-Alt-Del, Esc, etc) would make empty a perfect lightweight replacement to expect/pexpect ( with benefits over expect due to the simple fifo system! ).

In expect control characters can be sent by simpy prefixing the asci code with "\"

for example to send Ctrl-C:

send \003

Discussion

  • zemleroi

    zemleroi - 2013-10-24

    it would be great

     
  • zemleroi

    zemleroi - 2013-10-24

    If you want to use the opportunity to send "ctrl + d" or other
    you need to edit the source code a bit empty. It is very easy.

    To archive their empty edit empty.s, and then again to rebuild empty
    And so looking at empty.s unit

                        switch (src[i + 1]) {
                                case '\\':
                                        dst[bi] = '\\';
                                        i++;
                                        break;
                                case 'n':
                                       dst[bi] = '\n';
                                        i++;
                                        break;
                                case 'r':
                                        dst[bi] = '\r';
                                        i++;
                                        break;
                                default:
                                        dst[bi] = src[i];
                        }
    

    and inserted between the "break;" and "case 'n':"

                                case 'd':
                                        dst[bi] = '\x04';
                                        i++;
                                        break;
    
     
  • mezantrop

    mezantrop - 2023-01-01

    Accepted. Thank you.

     
  • mezantrop

    mezantrop - 2023-01-01
    • status: open --> accepted
    • Group: --> Next Release (example)
     
  • mezantrop

    mezantrop - 2023-01-01
    • status: accepted --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB