From 36d980ee58614a60369da10ff8c5a474efae01dc Mon Sep 17 00:00:00 2001 From: arcanum Date: Thu, 20 Feb 2003 19:59:11 +0000 Subject: [PATCH] Make verbose global. Make debug code in par_cmd() based on verbose=2. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@211 81a1dc3b-b13d-400b-aceb-764788c761c2 --- main.c | 2 +- par.c | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/main.c b/main.c index 610b6bc8..fb132e7b 100644 --- a/main.c +++ b/main.c @@ -91,6 +91,7 @@ char * version = "3.1.0"; +int verbose; /* verbose output */ char * progname; char progbuf[PATH_MAX]; /* temporary buffer of spaces the same length as progname; used for lining up @@ -294,7 +295,6 @@ int main(int argc, char * argv []) int ppisetbits; /* bits to set in ppi data register at exit */ int ppiclrbits; /* bits to clear in ppi data register at exit */ char * exitspecs; /* exit specs string from command line */ - int verbose; /* verbose output */ char * pinconfig; /* programmer id */ char * partdesc; /* part id */ char configfile[PATH_MAX]; /* pin configuration file */ diff --git a/par.c b/par.c index 3dae6196..d02d80b2 100644 --- a/par.c +++ b/par.c @@ -74,6 +74,7 @@ static struct ppipins_t pins[] = { extern char * progname; extern int do_cycles; +extern int verbose; static int par_setpin (int fd, int pin, int value); @@ -294,15 +295,18 @@ static int par_cmd(PROGRAMMER * pgm, unsigned char cmd[4], res[i] = par_txrx(pgm, cmd[i]); } -#if 0 - fprintf(stderr, "avr_cmd(): [ "); - for (i=0; i<4; i++) - fprintf(stderr, "%02x ", cmd[i]); - fprintf(stderr, "] [ "); - for (i=0; i<4; i++) - fprintf(stderr, "%02x ", res[i]); - fprintf(stderr, "]\n"); -#endif + if(verbose >= 2) + { + fprintf(stderr, "par_cmd(): [ "); + for(i = 0; i < 4; i++) + fprintf(stderr, "%02X ", cmd[i]); + fprintf(stderr, "] [ "); + for(i = 0; i < 4; i++) + { + fprintf(stderr, "%02X ", res[i]); + } + fprintf(stderr, "]\n"); + } return 0; }