On Tue, Feb 15, 2011 at 2:48 AM, David Lutterkort <[email protected]> wrote: > On Thu, 2011-02-10 at 12:20 +0100, Raphael Pinson wrote: >> From: Raphaël Pinson <[email protected]> >> >> --- >> src/augtool.c | 18 +++++++++++++++++- >> 1 files changed, 17 insertions(+), 1 deletions(-) > > ACK. That's a very useful option. I committed a slight variation of your > patch: > >> diff --git a/src/augtool.c b/src/augtool.c >> index 7de8e9d..4042618 100644 >> --- a/src/augtool.c >> +++ b/src/augtool.c >> @@ -1193,6 +1200,15 @@ static int main_loop(void) { >> } >> >> if (line == NULL) { >> + if (!isatty(fileno(stdin)) && interactive && !in_interactive) { >> + in_interactive = true; >> + echo = true; >> + // reopen in and out streams >> + rl_instream = fopen("/dev/tty", "r"); >> + rl_outstream = fopen("/dev/stdout", "w"); >> + continue; >> + } >> + > > There's two problems with the above: (1) we might end up leaking > rl_outstream (not that big a deal here, but still) and (2) there's zero > error checking for the fopen. I addressed both in the patch I committed. >
Great! I'm actually going to propose another very small patch to improve rl_outstream management. Currently, we tie rl_outstream to /dev/null by default, then set it to NULL (default value) if echo is true. Instead of doing this double assignation, we could simply not set a default, and assign rl_oustream to /dev/null only if echo is false. I'll send a patch for that. Raphaël _______________________________________________ augeas-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/augeas-devel
