diff options
author | dgp <dgp@noemail.net> | 2007-10-15 21:27:47 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2007-10-15 21:27:47 (GMT) |
commit | fa76a32e48857c488fafb6207259d2fc5a0b55ee (patch) | |
tree | 660da6ea51654bcc0e6047863d9213d28f2694a4 /generic/tclIOCmd.c | |
parent | 15f0949b9d5235a15680088cedc25e367cb09ab8 (diff) | |
download | tcl-fa76a32e48857c488fafb6207259d2fc5a0b55ee.zip tcl-fa76a32e48857c488fafb6207259d2fc5a0b55ee.tar.gz tcl-fa76a32e48857c488fafb6207259d2fc5a0b55ee.tar.bz2 |
* generic/tclIOCmd.c: Revise [open] so that it interprets leading
zero strings passed as the "permissions" argument as octal numbers,
even if Tcl itself no longer parses integers in that way.
* unix/tclUnixFCmd.c: Revise the "-permissions" [file attribute] so
that it interprets leading zero strings as octal numbers, even if Tcl
itself no longer parses integers in that way.
* generic/tclCompExpr.c: Corrections to code that produces
* generic/tclUtil.c: extended "bad octal" error messages.
* tests/cmdAH.test: Test revisions so that tests pass whether or
* tests/cmdIL.test: not Tcl parses leading zero strings as octal.
* tests/compExpr-old.test:
* tests/compExpr.test:
* tests/compile.test:
* tests/expr-old.test:
* tests/expr.test:
* tests/incr.test:
* tests/io.test:
* tests/lindex.test:
* tests/link.test:
* tests/mathop.test:
* tests/parseExpr.test:
* tests/set.test:
* tests/string.test:
* tests/stringComp.test:
FossilOrigin-Name: 985f1d240af3c5f24259b36641dc385183af8a14
Diffstat (limited to 'generic/tclIOCmd.c')
-rw-r--r-- | generic/tclIOCmd.c | 22 |
1 files changed, 20 insertions, 2 deletions
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; } } |