From cf5c40b0755c105edec10a77117a5ac0173b2bf1 Mon Sep 17 00:00:00 2001 From: Kolja Waschk Date: Tue, 26 Feb 2008 09:39:46 +0000 Subject: [PATCH] [ 1901880 ] quit upon EOF git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1099 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 3 ++- jtag/src/jtag.c | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 291d6f8d..457f5105 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,6 +1,7 @@ 2008-02-24 Mike Frysinger - * src/jtag.c: allow people to disable startup message (1901877) + * src/jtag.c: allow people to disable startup message (1901877), + quit upon EOF (1901880) 2008-02-25 Arnim Laeuger diff --git a/jtag/src/jtag.c b/jtag/src/jtag.c index 05d002b0..92f6bb9f 100644 --- a/jtag/src/jtag.c +++ b/jtag/src/jtag.c @@ -238,9 +238,17 @@ jtag_readline_loop( const char *prompt ) /* Read a line from the terminal */ line = readline( prompt ); + /* We got EOF, bail */ + if (!line) { + line = strdup( "quit\n" ); + puts( "quit" ); + if (!line) + return; + } + #ifdef HAVE_READLINE_HISTORY /* Check if we actually got something */ - if (line && (strlen( line ) > 0)) + if (strlen( line )) add_history( line ); #endif }