summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPeter Cao <xcao@hdfgroup.org>2007-02-21 21:58:00 (GMT)
committerPeter Cao <xcao@hdfgroup.org>2007-02-21 21:58:00 (GMT)
commitc831f673c4722c463099d7222671bdcc06072fbe (patch)
treed630e95490bbb0ef890c321daadcb13c8a14a288 /tools
parentbbc62be800c5af883a5acc59b21b5f8d76b41ea5 (diff)
downloadhdf5-c831f673c4722c463099d7222671bdcc06072fbe.zip
hdf5-c831f673c4722c463099d7222671bdcc06072fbe.tar.gz
hdf5-c831f673c4722c463099d7222671bdcc06072fbe.tar.bz2
[svn-r13372] Add "-w0" or "--width=0" for no line wrap for h5ls
Diffstat (limited to 'tools')
-rw-r--r--tools/h5ls/h5ls.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 567238e..63b5115 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -42,6 +42,7 @@ static hbool_t hexdump_g = FALSE; /* show data as raw hexadecimal */
static hbool_t show_errors_g = FALSE; /* print HDF5 error messages */
static hbool_t simple_output_g = FALSE; /* make output more machine-readable */
static hbool_t show_file_name_g = FALSE; /* show file name for full names */
+static hbool_t no_line_wrap_g = FALSE; /* show data content without line wrap */
/* Info to pass to the iteration functions */
typedef struct iter_t {
@@ -1257,7 +1258,12 @@ dump_dataset_values(hid_t dset)
} else {
info.idx_fmt = "(%s)";
- info.line_ncols = width_g;
+ if (no_line_wrap_g) {
+ info.line_ncols = 65535;
+ info.line_per_line = 1;
+ }
+ else
+ info.line_ncols = width_g;
info.line_multi_new = 1;
if (label_g) info.cmpd_name = "%s=";
info.line_pre = " %s ";
@@ -2161,7 +2167,10 @@ main (int argc, const char *argv[])
preferred_driver = argv[argno]+6;
} else if (!strncmp(argv[argno], "--width=", 8)) {
width_g = (int)strtol(argv[argno]+8, &rest, 0);
- if (width_g<=0 || *rest) {
+
+ if (0 == width_g)
+ no_line_wrap_g = TRUE;
+ else if (width_g<0 || *rest) {
usage();
leave(1);
}
@@ -2194,7 +2203,10 @@ main (int argc, const char *argv[])
s = argv[++argno];
}
width_g = (int)strtol(s, &rest, 0);
- if (width_g<=0 || *rest) {
+
+ if (0 == width_g)
+ no_line_wrap_g = TRUE;
+ else if (width_g<0 || *rest) {
usage();
leave(1);
}