summaryrefslogtreecommitdiffstats
path: root/tools/h5ls/h5ls.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2009-10-21 00:04:39 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2009-10-21 00:04:39 (GMT)
commitbb5633b566d3fbef9d1d59a7fac0251a560865cb (patch)
treef2200a7994b349cc95e49f0c15525a70f98a8f37 /tools/h5ls/h5ls.c
parentbb281b23e958ba0a14ae3d562c46e6511e1c9106 (diff)
downloadhdf5-bb5633b566d3fbef9d1d59a7fac0251a560865cb.zip
hdf5-bb5633b566d3fbef9d1d59a7fac0251a560865cb.tar.gz
hdf5-bb5633b566d3fbef9d1d59a7fac0251a560865cb.tar.bz2
[svn-r17700] Bug fix: (1192)
Comment says Error exit code is -1 but actual code use 1. Changed it to EXIT_FAILURE (1) and exit(0) to exit(EXIT_SUCCESS) for better coding. Tested: jam.
Diffstat (limited to 'tools/h5ls/h5ls.c')
-rw-r--r--tools/h5ls/h5ls.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index a2dc128..9bc0448 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1991,9 +1991,9 @@ done:
*
* Purpose: Begins iteration on an object
*
- * Return: Success: 0
+ * Return: Success: EXIT_SUCCESS(0)
*
- * Failure: -1
+ * Failure: EXIT_FAILURE(1)
*
* Programmer: Neil Fortner
* Wednesday, August 21, 2008
@@ -2200,7 +2200,7 @@ main(int argc, const char *argv[])
break;
} else if(!HDstrcmp(argv[argno], "--help")) {
usage();
- leave(0);
+ leave(EXIT_SUCCESS);
} else if(!HDstrcmp(argv[argno], "--address")) {
address_g = TRUE;
} else if(!HDstrcmp(argv[argno], "--data")) {
@@ -2231,25 +2231,25 @@ main(int argc, const char *argv[])
no_line_wrap_g = TRUE;
else if(width_g < 0 || *rest) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
}
} else if(!HDstrcmp(argv[argno], "--width")) {
if((argno + 1) >= argc) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
} else {
s = argv[++argno];
}
width_g = (int)HDstrtol(s, &rest, 0);
if(width_g <= 0 || *rest) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
}
} else if(!HDstrcmp(argv[argno], "--verbose")) {
verbose_g++;
} else if(!HDstrcmp(argv[argno], "--version")) {
print_version(progname);
- leave(0);
+ leave(EXIT_SUCCESS);
} else if(!HDstrcmp(argv[argno], "--hexdump")) {
hexdump_g = TRUE;
} else if(!HDstrncmp(argv[argno], "-w", 2)) {
@@ -2257,7 +2257,7 @@ main(int argc, const char *argv[])
s = argv[argno] + 2;
} else if((argno + 1) >= argc) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
} else {
s = argv[++argno];
}
@@ -2267,7 +2267,7 @@ main(int argc, const char *argv[])
no_line_wrap_g = TRUE;
else if(width_g < 0 || *rest) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
}
} else if('-'!=argv[argno][1]) {
/* Single-letter switches */
@@ -2276,7 +2276,7 @@ main(int argc, const char *argv[])
case '?':
case 'h': /* --help */
usage();
- leave(0);
+ leave(EXIT_SUCCESS);
case 'a': /* --address */
address_g = TRUE;
@@ -2325,7 +2325,7 @@ main(int argc, const char *argv[])
case 'V': /* --version */
print_version(progname);
- leave(0);
+ leave(EXIT_SUCCESS);
case 'x': /* --hexdump */
hexdump_g = TRUE;
@@ -2333,12 +2333,12 @@ main(int argc, const char *argv[])
default:
usage();
- leave(1);
+ leave(EXIT_FAILURE);
} /* end switch */
} /* end for */
} else {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
}
} /* end for */
@@ -2346,14 +2346,14 @@ main(int argc, const char *argv[])
* absolutely nothing ;-) */
if(argno >= argc) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
} /* end if */
/* Check for conflicting arguments */
if(recursive_g && grp_literal_g) {
fprintf(stderr, "Error: 'recursive' option not compatible with 'group info' option!\n\n");
usage();
- leave(1);
+ leave(EXIT_FAILURE);
} /* end if */
/* Turn off HDF5's automatic error printing unless you're debugging h5ls */
@@ -2416,7 +2416,7 @@ main(int argc, const char *argv[])
x = oname;
if(NULL == (oname = HDstrdup(oname))) {
fprintf(stderr, "memory allocation failed\n");
- leave(1);
+ leave(EXIT_FAILURE);
}
*x = '\0';
/* Delay specifying the name start point so the original object name
@@ -2449,7 +2449,7 @@ main(int argc, const char *argv[])
/* Check the type of link given */
if(H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) {
display_obj_name(stdout, &iter, oname, "**NOT FOUND**");
- leave(1);
+ leave(EXIT_FAILURE);
} /* end if */
} /* end if */
else
@@ -2458,7 +2458,7 @@ main(int argc, const char *argv[])
/* Open the object and display it's information */
if(li.type == H5L_TYPE_HARD) {
if(visit_obj(file, oname, &iter) < 0)
- leave(1);
+ leave(EXIT_FAILURE);
} /* end if(li.type == H5L_TYPE_HARD) */
else {
/* Specified name is not for object -- list that link */
@@ -2478,6 +2478,6 @@ main(int argc, const char *argv[])
HDfree(elink_list.objs);
} /* end while */
- leave(0);
+ leave(EXIT_SUCCESS);
} /* end main() */