[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:
This commit is contained in:
Pedro Vicente Nunes 2003-07-23 13:52:18 -05:00
parent 4b0fa0dbf0
commit 77f6e46b81

View File

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