summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompExpr.c25
-rw-r--r--generic/tclIOCmd.c22
-rw-r--r--generic/tclUtil.c9
3 files changed, 50 insertions, 6 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 18ac99d..36be6eb 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompExpr.c,v 1.86 2007/08/28 17:43:07 dgp Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.87 2007/10/15 21:27:48 dgp Exp $
*/
#include "tclInt.h"
@@ -744,6 +744,29 @@ ParseExpr(
" or \"%.*s%s(...)\" or ...",
(scanned < limit) ? scanned : limit - 3,
start, (scanned < limit) ? "" : "...");
+ if (NotOperator(lastParsed)) {
+ if ((lastStart[0] == '0')
+ && ((lastStart[1] == 'o')
+ || (lastStart[1] == 'O'))
+ && (lastStart[2] >= '0')
+ && (lastStart[2] <= '9')) {
+ const char *end = lastStart + 2;
+ while (isdigit(*end)) {
+ end++;
+ }
+ Tcl_Obj *copy = Tcl_NewStringObj(lastStart,
+ end - lastStart);
+ if (TclCheckBadOctal(NULL,
+ Tcl_GetString(copy))) {
+ TclNewLiteralStringObj(post,
+ "(invalid octal number?)");
+ }
+ Tcl_DecrRefCount(copy);
+ }
+ scanned = 0;
+ insertMark = 1;
+ parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
+ }
goto error;
}
}
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 9156b6d..1c25295 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOCmd.c,v 1.43 2007/09/06 18:13:20 dgp Exp $
+ * RCS: @(#) $Id: tclIOCmd.c,v 1.44 2007/10/15 21:27:48 dgp Exp $
*/
#include "tclInt.h"
@@ -1025,7 +1025,25 @@ Tcl_OpenObjCmd(
} else {
modeString = Tcl_GetString(objv[2]);
if (objc == 4) {
- if (Tcl_GetIntFromObj(interp, objv[3], &prot) != TCL_OK) {
+ char *permString = TclGetString(objv[3]);
+ int code = TCL_ERROR;
+ int scanned = TclParseAllWhiteSpace(permString, -1);
+
+ /* Support legacy octal numbers */
+ if ((permString[scanned] == '0')
+ && (permString[scanned+1] >= '0')
+ && (permString[scanned+1] <= '7')) {
+
+ Tcl_Obj *permObj;
+
+ TclNewLiteralStringObj(permObj, "0o");
+ Tcl_AppendToObj(permObj, permString+scanned+1, -1);
+ code = Tcl_GetIntFromObj(NULL, permObj, &prot);
+ Tcl_DecrRefCount(permObj);
+ }
+
+ if ((code == TCL_ERROR)
+ && Tcl_GetIntFromObj(interp, objv[3], &prot) != TCL_OK) {
return TCL_ERROR;
}
}
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index fe7f18a..6a25141 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUtil.c,v 1.82 2007/05/07 19:45:33 dgp Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.83 2007/10/15 21:27:48 dgp Exp $
*/
#include "tclInt.h"
@@ -2372,8 +2372,8 @@ TclGetIntForIndex(
Tcl_AppendResult(interp, "bad index \"", bytes,
"\": must be integer?[+-]integer? or end?[+-]integer?",
(char *) NULL);
- if (!strncmp(bytes, "end-", 3)) {
- bytes += 3;
+ if (!strncmp(bytes, "end-", 4)) {
+ bytes += 4;
}
TclCheckBadOctal(interp, bytes);
}
@@ -2556,6 +2556,9 @@ TclCheckBadOctal(
p++;
}
if (*p == '0') {
+ if ((p[1] == 'o') || p[1] == 'O') {
+ p+=2;
+ }
while (isdigit(UCHAR(*p))) { /* INTL: digit. */
p++;
}