From c1d1c9975328162239d3c7cfc9e12796edcc3e38 Mon Sep 17 00:00:00 2001 From: joerg_wunsch Date: Fri, 5 Mar 2010 08:28:42 +0000 Subject: [PATCH] Replace printf() by fprintf(stderr) git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@939 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 6 ++++++ buspirate.c | 18 ++++++++++-------- safemode.c | 8 ++++---- usbtiny.c | 8 ++++---- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d7f196f..907be896 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-03-05 Joerg Wunsch + + * buspirate.c: Replace printf() by fprintf(stderr) + * safemode.c: (Dito.) + * usbtiny.c: (Dito.) + 2010-01-22 Joerg Wunsch Cleanup Cygwin builds. diff --git a/buspirate.c b/buspirate.c index 32863d0b..af8de155 100644 --- a/buspirate.c +++ b/buspirate.c @@ -418,7 +418,7 @@ static void buspirate_reset_from_binmode(struct programmer_t *pgm) } if (verbose) - printf("BusPirate is back in the text mode\n"); + fprintf(stderr, "BusPirate is back in the text mode\n"); } static int buspirate_start_spi_mode_bin(struct programmer_t *pgm) @@ -437,7 +437,8 @@ static int buspirate_start_spi_mode_bin(struct programmer_t *pgm) return -1; } if (verbose) - printf("BusPirate binmode version: %d\n", PDATA(pgm)->binmode_version); + fprintf(stderr, "BusPirate binmode version: %d\n", + PDATA(pgm)->binmode_version); pgm->flag |= BP_FLAG_IN_BINMODE; @@ -452,7 +453,8 @@ static int buspirate_start_spi_mode_bin(struct programmer_t *pgm) return -1; } if (verbose) - printf("BusPirate SPI version: %d\n", PDATA(pgm)->bin_spi_version); + fprintf(stderr, "BusPirate SPI version: %d\n", + PDATA(pgm)->bin_spi_version); /* 0b0100wxyz - Configure peripherals w=power, x=pull-ups/aux2, y=AUX, z=CS * we want power (0x48) and all reset pins high. */ @@ -517,7 +519,7 @@ static int buspirate_start_spi_mode_ascii(struct programmer_t *pgm) } if (buspirate_is_prompt(rcvd)) { if (strncmp(rcvd, "SPI>", 4) == 0) { - printf("BusPirate is now configured for SPI\n"); + fprintf(stderr, "BusPirate is now configured for SPI\n"); break; } /* Not yet 'SPI>' prompt */ @@ -538,7 +540,7 @@ static void buspirate_enable(struct programmer_t *pgm) int fw_v1 = 0, fw_v2 = 0; int rc, print_banner = 0; - printf("Detecting BusPirate...\n"); + fprintf(stderr, "Detecting BusPirate...\n"); /* Call buspirate_send_bin() instead of buspirate_send() * because we don't know if BP is in text or bin mode */ @@ -568,7 +570,7 @@ static void buspirate_enable(struct programmer_t *pgm) sscanf(rcvd, "Bus Pirate %9s", PDATA(pgm)->hw_version); sscanf(rcvd, "Firmware v%d.%d", &fw_v1, &fw_v2); if (print_banner) - printf("** %s", rcvd); + fprintf(stderr, "** %s", rcvd); } PDATA(pgm)->fw_version = 100 * fw_v1 + fw_v2; @@ -581,12 +583,12 @@ static void buspirate_enable(struct programmer_t *pgm) exit(1); if (PDATA(pgm)->fw_version >= FW_BINMODE_VER && !(pgm->flag & BP_FLAG_XPARM_FORCE_ASCII)) { - printf("BusPirate: using BINARY mode\n"); + fprintf(stderr, "BusPirate: using BINARY mode\n"); if (buspirate_start_spi_mode_bin(pgm) < 0) fprintf(stderr, "%s: Failed to start binary SPI mode\n", progname); } if (!pgm->flag & BP_FLAG_IN_BINMODE) { - printf("BusPirate: using ASCII mode\n"); + fprintf(stderr, "BusPirate: using ASCII mode\n"); if (buspirate_start_spi_mode_ascii(pgm) < 0) { fprintf(stderr, "%s: Failed to start ascii SPI mode\n", progname); exit(1); diff --git a/safemode.c b/safemode.c index 62d02afa..ad1b9cc3 100644 --- a/safemode.c +++ b/safemode.c @@ -150,7 +150,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse, return -1; } else if ((fusegood == 1) && (verbose > 0)) { - printf("%s: safemode: fuse reads as %X\n", progname, safemode_fuse); + fprintf(stderr, "%s: safemode: fuse reads as %X\n", progname, safemode_fuse); } @@ -205,7 +205,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse, return -1; } else if ((fusegood == 1) && (verbose > 0)) { - printf("%s: safemode: lfuse reads as %X\n", progname, safemode_lfuse); + fprintf(stderr, "%s: safemode: lfuse reads as %X\n", progname, safemode_lfuse); } /* Read hfuse three times */ @@ -258,7 +258,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse, return -2; } else if ((fusegood == 1) && (verbose > 0)){ - printf("%s: safemode: hfuse reads as %X\n", progname, safemode_hfuse); + fprintf(stderr, "%s: safemode: hfuse reads as %X\n", progname, safemode_hfuse); } /* Read efuse three times */ @@ -311,7 +311,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse, return -3; } else if ((fusegood == 1) && (verbose > 0)) { - printf("%s: safemode: efuse reads as %X\n", progname, safemode_efuse); + fprintf(stderr, "%s: safemode: efuse reads as %X\n", progname, safemode_efuse); } *lfuse = safemode_lfuse; diff --git a/usbtiny.c b/usbtiny.c index a2e15b0c..9bc821d4 100644 --- a/usbtiny.c +++ b/usbtiny.c @@ -135,7 +135,7 @@ static int usb_in (PROGRAMMER * pgm, static void check_retries (PROGRAMMER * pgm, const char* operation) { if (PDATA(pgm)->retries > 0 && quell_progress < 2) { - printf("%s: %d retries during %s\n", progname, + fprintf(stderr, "%s: %d retries during %s\n", progname, PDATA(pgm)->retries, operation); } PDATA(pgm)->retries = 0; @@ -268,7 +268,7 @@ static int usbtiny_set_sck_period (PROGRAMMER *pgm, double v) PDATA(pgm)->sck_period = SCK_MAX; if (verbose) { - printf( "%s: Setting SCK period to %d usec\n", progname, + fprintf(stderr, "%s: Setting SCK period to %d usec\n", progname, PDATA(pgm)->sck_period ); } @@ -295,7 +295,7 @@ static int usbtiny_initialize (PROGRAMMER *pgm, AVRPART *p ) // -B option not specified: use default PDATA(pgm)->sck_period = SCK_DEFAULT; if (verbose) { - printf( "%s: Using SCK period of %d usec\n", + fprintf(stderr, "%s: Using SCK period of %d usec\n", progname, PDATA(pgm)->sck_period ); } if (usb_control(pgm, USBTINY_POWERUP, @@ -351,7 +351,7 @@ static int usbtiny_cmd(PROGRAMMER * pgm, unsigned char cmd[4], unsigned char res check_retries(pgm, "SPI command"); if (verbose > 1) { // print out the data we sent and received - printf( "CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n", + fprintf(stderr, "CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n", cmd[0], cmd[1], cmd[2], cmd[3], res[0], res[1], res[2], res[3] ); }