For the read-only shell that I'm working on, I'm running into a slight snag. I'm trying to build a paging command (emulating the function of more). It seems get_key() is probably the best function to use for obtaining just a single key sequence. On my first run, I tried to call console_ansi_raw(), then get_key() then console_ansi_std() to change it back to a more normal mode. When I then attempt to use fgets() (in Linux, not syslinux/com32), it segfaults. I then decided to try just tweaking the two local flag bits, ICANON and ECHO and it works fine for Linux but now I'm going to have to write alternate code for the COM32 build, probably by writing a pair of functions to change modes. The question is what should I be doing in order to be more compatible with both Linux and COM32? Are my initial thoughts completely in the wrong direction? -- "No one ever says, 'I can't read that ASCII E-mail you sent me.'"
H. Peter Anvin
2008-Dec-09 04:19 UTC
[syslinux] COM32: console_ansi_raw() and later segfaults
Gene Cumm wrote:> For the read-only shell that I'm working on, I'm running into a slight > snag. I'm trying to build a paging command (emulating the function of > more). It seems get_key() is probably the best function to use for > obtaining just a single key sequence. On my first run, I tried to > call console_ansi_raw(), then get_key() then console_ansi_std() to > change it back to a more normal mode. When I then attempt to use > fgets() (in Linux, not syslinux/com32), it segfaults. > > I then decided to try just tweaking the two local flag bits, ICANON > and ECHO and it works fine for Linux but now I'm going to have to > write alternate code for the COM32 build, probably by writing a pair > of functions to change modes. > > The question is what should I be doing in order to be more compatible > with both Linux and COM32? Are my initial thoughts completely in the > wrong direction? >There are some functions in the libutil directory, but I'm not sure if there is anything there that switches mode like you want. Let me check tomorrow. -hpa