lkml.org 
[lkml]   [2015]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 4/4] tools: iio: iio_utils: Move general error messages to stderr
This patch replaces stdout general error messages to a more appropriate
standard stream to ensure consistency.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
tools/iio/iio_utils.c | 17 ++++++++++-------
tools/iio/lsiio.c | 2 +-
2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index 46dfa3f..8b218bd 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -158,7 +158,8 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used,
goto error_close_sysfsfp;
} else if (ret != 5) {
ret = -EIO;
- printf("scan type description didn't match\n");
+ fprintf(stderr,
+ "scan type description didn't match\n");
goto error_close_sysfsfp;
}

@@ -572,7 +573,7 @@ int find_type_by_name(const char *name, const char *type)

dp = opendir(iio_dir);
if (dp == NULL) {
- printf("No industrialio devices available\n");
+ fprintf(stderr, "No industrialio devices available\n");
return -ENODEV;
}

@@ -709,8 +710,9 @@ static int _write_sysfs_int(const char *filename, const char *basedir, int val,
}

if (test != val) {
- printf("Possible failure in int write %d to %s/%s\n",
- val, basedir, filename);
+ fprintf(stderr,
+ "Possible failure in int write %d to %s/%s\n",
+ val, basedir, filename);
ret = -1;
}
}
@@ -806,9 +808,10 @@ static int _write_sysfs_string(const char *filename, const char *basedir,
}

if (strcmp(temp, val) != 0) {
- printf("Possible failure in string write of %s "
- "Should be %s written to %s/%s\n", temp, val,
- basedir, filename);
+ fprintf(stderr,
+ "Possible failure in string write of %s "
+ "Should be %s written to %s/%s\n", temp, val,
+ basedir, filename);
ret = -1;
}
}
diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c
index 7f432a5..31996de 100644
--- a/tools/iio/lsiio.c
+++ b/tools/iio/lsiio.c
@@ -108,7 +108,7 @@ static int dump_devices(void)

dp = opendir(iio_dir);
if (dp == NULL) {
- printf("No industrial I/O devices available\n");
+ fprintf(stderr, "No industrial I/O devices available\n");
return -ENODEV;
}

--
1.9.1


\
 
 \ /
  Last update: 2015-07-07 01:21    [W:0.053 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site