From 473d6f8a7a16d1440f360b8562b746fbadee2d82 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 14 Apr 2016 09:35:13 +0200 Subject: stdio: replace fprintf(stderr,...) with eprintf We have a shortcut for fprintf(stderr, so use it. This is done to be able to remove fprintf in the next step. Signed-off-by: Sascha Hauer --- commands/clk.c | 2 +- commands/loadb.c | 7 +++---- commands/menu.c | 4 ++-- commands/miitool.c | 2 +- common/imd.c | 4 ++-- include/mtd/utils.h | 2 +- scripts/bareboximd.c | 2 ++ 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/commands/clk.c b/commands/clk.c index 65832d4985..f862c45b2a 100644 --- a/commands/clk.c +++ b/commands/clk.c @@ -97,7 +97,7 @@ static int do_clk_get_rate(int argc, char *argv[]) } if (optind == argc) { - fprintf(stderr, "No clock name given\n"); + eprintf("No clock name given\n"); return COMMAND_ERROR_USAGE; } diff --git a/commands/loadb.c b/commands/loadb.c index 6223512477..6180ce371a 100644 --- a/commands/loadb.c +++ b/commands/loadb.c @@ -183,8 +183,7 @@ static int os_data_save(void) ret = write(ofd, write_buffer, MAX_WRITE_BUFFER); if (ret < 0) { - fprintf(stderr, - "write to device failed\n"); + eprintf("write to device failed\n"); return ret; } write_idx = 0; @@ -563,7 +562,7 @@ static ulong load_serial_bin(void) /* Try to allocate the buffer we shall write to files */ write_buffer = malloc(MAX_WRITE_BUFFER); if (write_buffer == NULL) { - fprintf(stderr, "could not allocate file i/o buffer\n"); + eprintf("could not allocate file i/o buffer\n"); return -ENOMEM; } @@ -585,7 +584,7 @@ static ulong load_serial_bin(void) if (write_idx > 0) { i = write(ofd, write_buffer, write_idx); if (i < 0) { - fprintf(stderr, "write to device failed\n"); + eprintf("write to device failed\n"); size = i; goto err_quit; } diff --git a/commands/menu.c b/commands/menu.c index 2008aa5e9d..9ec2d579b7 100644 --- a/commands/menu.c +++ b/commands/menu.c @@ -160,8 +160,8 @@ static int do_menu_add(struct cmd_menu *cm) free: eprintf("Menu '%s' add fail", cm->menu); if (ret == -EEXIST) - eputs(" already exist"); - eputs("\n"); + eprintf(" already exist"); + eprintf("\n"); menu_free(m); diff --git a/commands/miitool.c b/commands/miitool.c index ba6e604633..07bce18651 100644 --- a/commands/miitool.c +++ b/commands/miitool.c @@ -120,7 +120,7 @@ static int show_basic_mii(struct mii_bus *mii, struct phy_device *phydev, if (mii_val[MII_BMCR] == 0xffff || mii_val[MII_BMSR] == 0x0000) { - fprintf(stderr, " No MII transceiver present!.\n"); + eprintf(" No MII transceiver present!.\n"); return -1; } diff --git a/common/imd.c b/common/imd.c index 241ebbdaed..159b73a828 100644 --- a/common/imd.c +++ b/common/imd.c @@ -306,7 +306,7 @@ int imd_command(int argc, char *argv[]) case 't': type = imd_name_to_type(optarg); if (type == IMD_TYPE_INVALID) { - fprintf(stderr, "no such type: %s\n", optarg); + eprintf("no such type: %s\n", optarg); return -ENOSYS; } break; @@ -325,7 +325,7 @@ int imd_command(int argc, char *argv[]) } if (optind == argc) { - fprintf(stderr, "No image given\n"); + eprintf("No image given\n"); return -ENOSYS; } diff --git a/include/mtd/utils.h b/include/mtd/utils.h index fca64abd9d..58f89df90c 100644 --- a/include/mtd/utils.h +++ b/include/mtd/utils.h @@ -41,7 +41,7 @@ #define sys_errmsg errmsg #define warnmsg(fmt, ...) do { \ - fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ + eprintf("%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ } while(0) #endif /* INCLUDE_MTD_UTILS_H */ diff --git a/scripts/bareboximd.c b/scripts/bareboximd.c index d4da681eca..7d4cbeb9a8 100644 --- a/scripts/bareboximd.c +++ b/scripts/bareboximd.c @@ -37,6 +37,8 @@ #include "../include/image-metadata.h" +#define eprintf(args...) fprintf(stderr, ## args) + static void debug(const char *fmt, ...) { va_list ap; -- cgit v1.2.3