summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2001-03-06 14:45:03 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2001-03-06 14:45:03 (GMT)
commita4956f2cdf0944125654ad232ec0324068487306 (patch)
treededb3eaa49c7bac372525a7a2a096a20372917a8 /generic
parent4b28cf6cdde6e232060c86973947cd9d1246abef (diff)
downloadtcl-a4956f2cdf0944125654ad232ec0324068487306.zip
tcl-a4956f2cdf0944125654ad232ec0324068487306.tar.gz
tcl-a4956f2cdf0944125654ad232ec0324068487306.tar.bz2
Fixed two faults with [unset -nocomplain]; one with a possible overrun
of the argument array, and another with the documentation.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclVar.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index c160c84..608185e 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclVar.c,v 1.27 2000/11/17 11:06:53 dkf Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.28 2001/03/06 14:45:03 dkf Exp $
*/
#include "tclInt.h"
@@ -2611,23 +2611,29 @@ Tcl_UnsetObjCmd(dummy, interp, objc, objv)
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv,
- "?--? ?-nocomplain? ?varName varName ...?");
+ "?-nocomplain? ?--? ?varName varName ...?");
return TCL_ERROR;
}
/*
- * Very simple, restrictive argument parsing. The only options are
- * -- and -nocomplain (which must come first to be an option).
+ * Simple, restrictive argument parsing. The only options are --
+ * and -nocomplain (which must come first and be given exactly to
+ * be an option).
*/
i = 1;
name = TclGetString(objv[i]);
- if ((name[0] == '-') && (strcmp("-nocomplain", name) == 0)) {
- flags = 0;
- i++;
- name = TclGetString(objv[i]);
- }
- if ((name[0] == '-') && (strcmp("--", name) == 0)) {
- i++;
+ if (name[0] == '-') {
+ if (strcmp("-nocomplain", name) == 0) {
+ i++;
+ if (i == objc) {
+ return TCL_OK;
+ }
+ flags = 0;
+ name = TclGetString(objv[i]);
+ }
+ if (strcmp("--", name) == 0) {
+ i++;
+ }
}
for (; i < objc; i++) {