From bfcc7becba2f88dc0e161e156bb2d07e065d220b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Mon, 27 Oct 2008 23:34:02 +0000 Subject: [PATCH] avoid clipping message when reading comments (Hartley) git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1384 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 3 +++ jtag/src/cmd/parse.c | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index caa4850a..7c24ded0 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,5 +1,8 @@ 2008-10-28 Arnim Laeuger + * src/cmd/parse.c (jtag_parse_stream): avoid clipping message when + reading comments (Hartley) + * renamed data/lattice/lfec2-12e/lfec2_12e to lfec2-12e * data/MANUFACTURERS, data/lattice/lfec2-12e, data/lattice/lfec2-12e/lfec2_12e, diff --git a/jtag/src/cmd/parse.c b/jtag/src/cmd/parse.c index 08e43c60..4d0bc6e2 100644 --- a/jtag/src/cmd/parse.c +++ b/jtag/src/cmd/parse.c @@ -1,5 +1,5 @@ /* - * parse.c + * $Id$ * * Copyright (C) 2002, 2003 ETC s.r.o. * @@ -116,19 +116,22 @@ int jtag_parse_stream( chain_t *chain, FILE *f ) { char inputline[MAXINPUTLINE + 1]; - int go = 1, i, c, lnr, clip; + int go = 1, i, c, lnr, clip, found_comment; /* read the stream line-by-line until EOF or "quit" */ lnr = 0; do { i = 0; clip = 0; + found_comment = 0; /* read stream until '\n' or EOF, copy at most MAXINPUTLINE-1 chars */ while (1) { c = fgetc(f); if (c == EOF || c == '\n') break; + if (c == '#') + found_comment = 1; if (i < sizeof(inputline) - 1) inputline[i++] = c; else @@ -136,7 +139,7 @@ jtag_parse_stream( chain_t *chain, FILE *f ) } inputline[i] = '\0'; lnr++; - if (clip) + if (clip && !found_comment) fprintf(stdout, "Warning: line %d exceeds %d characters, clipped\n", lnr, (int)sizeof(inputline) - 1); go = jtag_parse_line(chain, inputline); }