[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RAWish terminal settings in shell
- Date: Wed, 9 Mar 2011 03:05:06 -0500
- From: dufault at hda.com (Peter Dufault)
- Subject: RAWish terminal settings in shell
(Giving this topic it's own thread, from "Help in setting up a RAM Disk". I started this diversion)
> 2. The main function is called with echo off and a record separator of newline, and no known way of entering a ^D/EOF to terminate the program. Here's the results of entering 'print("where is my echo")<LF>' at the console to Lua, followed by ^D<LF>:
> SMC91111 : driver has been attached
> Device: /dev/pty0../dev/pty7 (8)pseudo-terminals registered.
> telnetd started with stacksize = 8192 and priority = 100
> RTEMS-RPCIOD $Release$, Till Straumann, Stanford/SLAC/SSRL 2002, See LICENSE file for licensing info.
> RTEMS-NFS $Release$, Till Straumann, Stanford/SLAC/SSRL 2002, See LICENSE file for licensing info.
> RTEMS SHELL (Ver.1.0-FRC):/dev/console. Mar 6 2011. 'help' to list commands.
> [/] # help main
> main - Run the "main program".
> [/] # main
> Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
>> where is my echo
>> stdin:1: unexpected symbol near 'char(4)'
> The same issue exists with telnet, though at least then you can shutdown the shell and Lua gets the EOF.
"Why not capture the terminal settings and then restore them when you
"I am not sure what happens if we change the settings for commands. Some
commands may access stdin and may be written for the current term settings."
The shell already saves the terminal settings before explicitly putting the terminal in a RAWish mode. I could change my function that calls main() to change back to normal TTY settings, but I think that it makes more sense to call functions from the shell in a normal, cooked mode and not one of the RAW modes. I haven't worked with any other script-caller that puts the TTY in a weird mode before calling user-written C code.
I tried disabling setting RAW in the shell and there is at least one odd side effect: Something echoes the command you type a second time prior to calling the user-supplied C function - see the repeated "help" message that follows. I added the "-" and "+", and <^D> is the <^D> I typed. The "+" shows the extra line.
Echo and EOF work properly. The only thing I noticed is the odd extra echo.
- [/] # help
- help: ('r' repeat last cmd - 'e' edit last cmd)
- TOPIC? The topics are
- web, misc, flash, help, mem, files, rtems, network, monitor
- [/] # main
- Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
- > <^D>
- [/] #
I will see if I can get the shell working the way I think it should with all the shell commands that come with RTEMS.
HD Associates, Inc. Software and System Engineering