summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2003-07-23 18:52:18 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2003-07-23 18:52:18 (GMT)
commit77f6e46b81d5f6583242fcbbc87c4b2f44bc9b3e (patch)
treed9d22c0f8f4482e2e4a46b40aa77839c15e26731
parent4b0fa0dbf06a93c7cb7c62a374019543ffa70fe6 (diff)
downloadhdf5-77f6e46b81d5f6583242fcbbc87c4b2f44bc9b3e.zip
hdf5-77f6e46b81d5f6583242fcbbc87c4b2f44bc9b3e.tar.gz
hdf5-77f6e46b81d5f6583242fcbbc87c4b2f44bc9b3e.tar.bz2
[svn-r7257] Purpose:
bug fix Description: if the user incorrectly put the option -n20 (instead of -n 20) as the last argument h5diff tried to parse the 20 as an extra argument, causing a failure if ('-' !=argv[i+1][0] ) Solution: add an extra test for the case that option is the last argument if ( i<argc-1 && '-' !=argv[i+1][0] ) Platforms tested: linux . this is too trivial for all platforms test Misc. update:
-rw-r--r--tools/h5diff/h5diff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c
index 1d2e55d..79b591a 100644
--- a/tools/h5diff/h5diff.c
+++ b/tools/h5diff/h5diff.c
@@ -277,7 +277,7 @@ int main(int argc, const char *argv[])
break;
case 'd':
/* if it is not another option */
- if ( '-' != argv[i+1][0] )
+ if ( i<argc-1 &&'-' != argv[i+1][0] )
{
options.d=1;
if ( check_f_input(argv[i+1])==-1)
@@ -294,7 +294,7 @@ int main(int argc, const char *argv[])
}
break;
case 'p':
- if ( '-' !=argv[i+1][0] )
+ if ( i<argc-1 &&'-' !=argv[i+1][0] )
{
options.p=1;
if ( check_f_input(argv[i+1])==-1)
@@ -306,7 +306,7 @@ int main(int argc, const char *argv[])
}
break;
case 'n':
- if ( '-' !=argv[i+1][0] )
+ if ( i<argc-1 && '-' !=argv[i+1][0] )
{
options.n=1;
if ( check_n_input(argv[i+1])==-1)