bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calling readline() a second or subsequent time and retaining state from


From: Sam Habiel
Subject: Calling readline() a second or subsequent time and retaining state from previous calls
Date: Thu, 21 Sep 2023 12:34:36 -0400
User-agent: Zoho Mail

Hello there,

Quick Intro: We have an interactive CLI for a language called M used in banking 
and healthcare... I am working on adding readline integration as a nice to have 
feature. We are an open source project located over here: 
https://gitlab.com/YottaDB/DB/YDB.

I sent an earlier message, and I thank Chet for the reply.

I am dealing with the unpleasant for anybody to handle signals. One of our 
signals suspends execution, completely unwinds the C stack (yes, we have lots 
of assembly code for that), and then reissues the prompt. An example will help:

YDB>write "f<cursor>o  <<< Receive SIGUSR1

Once a SIGUSR1 is received, in the background, execution is suspended, a custom 
function is executed, and the entire prompt code is actually processed, but the 
user sees absolutely nothing of that. In the example above, the cursor will 
stay between f and o. Our current code just sets up all the prompt data 
structures from a saved structure when the signal is received.

Is this possible with readline()? I naively tried rl_save_state() and 
rl_restore_state(), but that doesn't seem to work.

--Sam 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]