Index: source/tools/toolutil/uoptions.c |
diff --git a/source/tools/toolutil/uoptions.c b/source/tools/toolutil/uoptions.c |
index 05efc170cbdf7513dd57ebf7779b982e97a21d94..291e2fce4e7fb88cebfb0375901bc691c8742a76 100644 |
--- a/source/tools/toolutil/uoptions.c |
+++ b/source/tools/toolutil/uoptions.c |
@@ -1,7 +1,7 @@ |
/* |
******************************************************************************* |
* |
-* Copyright (C) 2000, International Business Machines |
+* Copyright (C) 2000-2015, International Business Machines |
* Corporation and others. All Rights Reserved. |
* |
******************************************************************************* |
@@ -60,9 +60,16 @@ u_parseArgs(int argc, char* argv[], |
option->value=argv[++i]; |
} else if(option->hasArg==UOPT_REQUIRES_ARG) { |
/* there is no argument, but one is required: return with error */ |
+ option->doesOccur=0; |
return -i; |
} |
} |
+ |
+ if(option->optionFn!=NULL && option->optionFn(option->context, option)<0) { |
+ /* the option function was called and returned an error */ |
+ option->doesOccur=0; |
+ return -i; |
+ } |
} |
} else { |
/* process one or more short options */ |
@@ -95,21 +102,23 @@ u_parseArgs(int argc, char* argv[], |
break; |
} else if(option->hasArg==UOPT_REQUIRES_ARG) { |
/* there is no argument, but one is required: return with error */ |
+ option->doesOccur=0; |
return -i; |
} |
} |
+ if(option->optionFn!=NULL && option->optionFn(option->context, option)<0) { |
+ /* the option function was called and returned an error */ |
+ option->doesOccur=0; |
+ return -i; |
+ } |
+ |
/* get the next option letter */ |
option=NULL; |
c=*arg++; |
} while(c!=0); |
} |
- if(option!=0 && option->optionFn!=0 && option->optionFn(option->context, option)<0) { |
- /* the option function was called and returned an error */ |
- return -i; |
- } |
- |
/* go to next argv[] */ |
++i; |
} else { |