From c66099c0b3f7b00145a45ae35ca0cda9bb327150 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Tue, 13 May 2003 07:51:32 +0000 Subject: [PATCH] 2003-05-13 Marcel Telka * src/jtag.c (jtag_parse_file): Added support for command scripts from stdin. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@424 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 4 ++++ jtag/NEWS | 1 + jtag/src/jtag.c | 8 ++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 6a7258e2..58223530 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,7 @@ +2003-05-13 Marcel Telka + + * src/jtag.c (jtag_parse_file): Added support for command scripts from stdin. + 2003-04-29 Marcel Telka * data/MANUFACTURERS: Added new manufacturer: DEC. diff --git a/jtag/NEWS b/jtag/NEWS index 885074d3..e13be482 100644 --- a/jtag/NEWS +++ b/jtag/NEWS @@ -1,6 +1,7 @@ $Id$ * Added new manufacturer: DEC. + * Added support for executing scripts directly from stdin (parameter '-'). jtag-0.3.2 (2003-04-04): diff --git a/jtag/src/jtag.c b/jtag/src/jtag.c index 278f782d..e72bcb4b 100644 --- a/jtag/src/jtag.c +++ b/jtag/src/jtag.c @@ -747,7 +747,10 @@ jtag_parse_file( const char *filename ) char *line = NULL; int n = 0; - f = fopen( filename, "r" ); + if (strcmp( filename, "-" ) != 0) + f = fopen( filename, "r" ); + else + f = stdin; if (!f) return -1; @@ -756,7 +759,8 @@ jtag_parse_file( const char *filename ) go = jtag_parse_line(line); free(line); - fclose(f); + if (strcmp( filename, "-" ) != 0) + fclose(f); return go; }