From 3258a0f860e1096cbd7a6ac558cb76e66cbb9dd6 Mon Sep 17 00:00:00 2001 From: treectrl Date: Tue, 24 Dec 2002 05:49:55 +0000 Subject: Return error for bad char in rectangle -open option. --- generic/tkTreeElem.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/generic/tkTreeElem.c b/generic/tkTreeElem.c index 7079620..231266f 100644 --- a/generic/tkTreeElem.c +++ b/generic/tkTreeElem.c @@ -2174,16 +2174,32 @@ static int ConfigRect(ElementArgs *args) elemX->open = 0; if (elemX->openString != NULL) { + int badChar = 0; + for (i = 0; elemX->openString[i]; i++) { switch (elemX->openString[i]) { - case 'w': elemX->open |= 0x01; break; - case 'n': elemX->open |= 0x02; break; - case 'e': elemX->open |= 0x04; break; - case 's': elemX->open |= 0x08; break; + case 'w': case 'W': elemX->open |= 0x01; break; + case 'n': case 'N': elemX->open |= 0x02; break; + case 'e': case 'E': elemX->open |= 0x04; break; + case 's': case 'S': elemX->open |= 0x08; break; + default: + { + Tcl_ResetResult(tree->interp); + Tcl_AppendResult(tree->interp, "bad open value \"", + elemX->openString, "\": must be a string ", + "containing zero or more of n, e, s, and w", + (char *) NULL); + badChar = 1; + break; + } } + if (badChar) + break; } + if (badChar) + continue; } } -- cgit v0.12