From: John Hodge Date: Sun, 9 Feb 2014 14:34:36 +0000 (+0800) Subject: Kernel/PTYs - NL->CR translation (disabled) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=9382d3191512d5194a6d31f220a508f242449439;p=tpg%2Facess2.git Kernel/PTYs - NL->CR translation (disabled) --- diff --git a/KernelLand/Kernel/drv/pty.c b/KernelLand/Kernel/drv/pty.c index 69b1ce6e..862997a9 100644 --- a/KernelLand/Kernel/drv/pty.c +++ b/KernelLand/Kernel/drv/pty.c @@ -377,10 +377,10 @@ size_t PTY_int_SendInput(tPTY *PTY, const char *Input, size_t Length) size_t ret = 1, print = 1; // Input mode stuff only counts for text output mode - // - Any other is Uint32 keypresses + // - Any other mode sends Uint32 keypresses if( (PTY->Mode.OutputMode & PTYOMODE_BUFFMT) != PTYBUFFMT_TEXT ) return PTY_int_WriteInput(PTY, Input, Length); - // If in raw mode, flush directlr + // If in raw mode, flush directly if( (PTY->Mode.InputMode & PTYIMODE_RAW) ) return PTY_int_WriteInput(PTY, Input, Length); @@ -444,7 +444,24 @@ size_t PTY_int_SendInput(tPTY *PTY, const char *Input, size_t Length) } else { - ret = PTY_int_WriteInput(PTY, Input, Length); + #if 0 + if( PTY->Mode.InputMode & PTYIMODE_NLCR ) + { + if( Input[0] == '\n' ) { + char ch = '\r'; + ret = PTY_int_WriteInput(PTY, &ch, 1); + } + else { + int i; + for( i = 0; i < Length && Input[i] != '\n'; i ++ ) + ; + ret = PTY_int_WriteInput(PTY, Input, i); + } + } + // TODO: CRNL mode? + else + #endif + ret = PTY_int_WriteInput(PTY, Input, Length); } // Echo if requested diff --git a/Usermode/Libraries/ld-acess.so_src/include_exp/acess/devices/pty.h b/Usermode/Libraries/ld-acess.so_src/include_exp/acess/devices/pty.h index 34c30b8d..6a18942e 100644 --- a/Usermode/Libraries/ld-acess.so_src/include_exp/acess/devices/pty.h +++ b/Usermode/Libraries/ld-acess.so_src/include_exp/acess/devices/pty.h @@ -17,6 +17,7 @@ #define PTYIMODE_CANON 0x001 //!< Line-buffered input #define PTYIMODE_ECHO 0x002 //!< Echo input characters #define PTYIMODE_RAW 0x004 //!< Disable all input processing +#define PTYIMODE_NLCR 0x008 //!< Translate '\n' to '\r' (for old apps) #define PTYOMODE_BUFFMT 0x003 #define PTYBUFFMT_TEXT 0x000