9
0
Fork 0

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 <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2016-04-14 09:35:13 +02:00
parent 01f8f60cf0
commit 473d6f8a7a
7 changed files with 12 additions and 11 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 */

View File

@ -37,6 +37,8 @@
#include "../include/image-metadata.h"
#define eprintf(args...) fprintf(stderr, ## args)
static void debug(const char *fmt, ...)
{
va_list ap;