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 }