www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/07/28/20:37:49

From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Sat, 28 Jul 2001 20:38:02 -0400
MIME-Version: 1.0
Subject: termios flag to control ecma-48
Message-ID: <3B6322AA.16701.9BFF6D@localhost>
X-mailer: Pegasus Mail for Win32 (v3.12c)
Reply-To: djgpp-workers AT delorie DOT com

When I'm testing reading from the keyboard, the ecma-48 parser in the write 
portion of termios eats the strings generated by the extended keys. Switching 
to binary works, but brings with it a different set of problems (pressing 
enter causes the cursor to go to the next line at the same column instead of 
setting the column to 0 because CRs aren't translated to CRNL). Any 
objections to a switch to turn on and off ecma-48 parsing implemented below?

Index: include/termios.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/termios.h,v
retrieving revision 1.3
diff -c -p -r1.3 termios.h
*** include/termios.h	1996/09/15 16:55:54	1.3
--- include/termios.h	2001/07/29 00:30:40
*************** int	tcsetattr(int _fildes, int _optional
*** 127,132 ****
--- 127,133 ----
  #define ONLCR	0x00000200	/* map NL to CRNL */
  #define OCRNL	0x00000400	/* map CR to NL */
  #define ONOEOT	0x00000800	/* discard EOT's (^D) on output */
+ #define OECMA	0x00001000	/* don't parse ECMA-48 commands */
  
  /* for compatibility */
  void	cfmakeraw(struct termios *_termios_p);
Index: include/libc/ttyprvt.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/libc/ttyprvt.h,v
retrieving revision 1.4
diff -c -p -r1.4 ttyprvt.h
*** include/libc/ttyprvt.h	2001/07/27 19:13:19	1.4
--- include/libc/ttyprvt.h	2001/07/29 00:30:40
*************** struct tty_editline
*** 73,79 ****
      (tcflag_t) (CS8|CREAD|CLOCAL), /* c_cflag */			\
      (tcflag_t) (BRKINT|ICRNL|IMAXBEL), /* c_iflag */			\
      (tcflag_t) (ISIG|ICANON|ECHO|IEXTEN|ECHOE|ECHOKE|ECHOCTL), /* c_lflag 
*/ \
!     (tcflag_t) (OPOST|ONLCR|ONOEOT), /* c_oflag */			\
      (speed_t) (B9600), /* c_ispeed */					\
      (speed_t) (B9600), /* c_ospeed */					\
    },									\
--- 73,79 ----
      (tcflag_t) (CS8|CREAD|CLOCAL), /* c_cflag */			\
      (tcflag_t) (BRKINT|ICRNL|IMAXBEL), /* c_iflag */			\
      (tcflag_t) (ISIG|ICANON|ECHO|IEXTEN|ECHOE|ECHOKE|ECHOCTL), /* c_lflag 
*/ \
!     (tcflag_t) (OPOST|ONLCR|ONOEOT|OECMA), /* c_oflag */			\
      (speed_t) (B9600), /* c_ispeed */					\
      (speed_t) (B9600), /* c_ospeed */					\
    },									\
Index: src/libc/posix/termios/tmwrite.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/termios/tmwrite.c,v
retrieving revision 1.3
diff -c -p -r1.3 tmwrite.c
*** src/libc/posix/termios/tmwrite.c	2001/07/27 22:17:34	1.3
--- src/libc/posix/termios/tmwrite.c	2001/07/29 00:30:42
*************** __libc_termios_write_cooked_tty (int han
*** 125,131 ****
            ch = *rp;
  
            /* Handle console commands */
! 	  if (ch == '\e' || cmd_state != need_esc)
            {
              size_t delta;
              delta = parse_console_command(rp, n);
--- 125,132 ----
            ch = *rp;
  
            /* Handle console commands */
! 	  if ((ch == '\e' && (__libc_tty_p->t_oflag & OECMA))
! 	      || cmd_state != need_esc)
            {
              size_t delta;
              delta = parse_console_command(rp, n);

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019