diff options
author | hobbs <hobbs> | 2002-04-23 03:48:33 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-04-23 03:48:33 (GMT) |
commit | 8142c17a36e5e8959ca0577e6ac377269c6eea7e (patch) | |
tree | 19005e89d42a179d223a043fed862be1c7dd0cab /generic/tclTest.c | |
parent | 040db1e7b18a9cd02768a9c65da1a305bf09b4ab (diff) | |
download | tcl-8142c17a36e5e8959ca0577e6ac377269c6eea7e.zip tcl-8142c17a36e5e8959ca0577e6ac377269c6eea7e.tar.gz tcl-8142c17a36e5e8959ca0577e6ac377269c6eea7e.tar.bz2 |
cleanup of testfilesystem command
Diffstat (limited to 'generic/tclTest.c')
-rw-r--r-- | generic/tclTest.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c index 128b390..7958bf4 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTest.c,v 1.48 2002/03/24 11:41:50 vincentdarley Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.49 2002/04/23 03:48:33 hobbs Exp $ */ #define TCL_TEST @@ -5566,38 +5566,30 @@ TestFilesystemObjCmd(dummy, interp, objc, objv) int objc; Tcl_Obj *CONST objv[]; { - int res; - int onOff; + int res, boolVal; + char *msg; if (objc != 2) { - char *cmd = Tcl_GetString(objv[0]); - Tcl_AppendResult(interp, "wrong # args: should be \"", cmd, - " (1 or 0)\"", (char *) NULL); + Tcl_WrongNumArgs(interp, 1, objv, "boolean"); return TCL_ERROR; } - if (Tcl_GetBooleanFromObj(interp, objv[1], &onOff) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, objv[1], &boolVal) != TCL_OK) { return TCL_ERROR; } - if (onOff) { + if (boolVal) { res = Tcl_FSRegister((ClientData)interp, &testReportingFilesystem); - if (res == TCL_OK) { - Tcl_SetResult(interp, "registered", TCL_STATIC); - } else { - Tcl_SetResult(interp, "failed", TCL_STATIC); - } + msg = (res == TCL_OK) ? "registered" : "failed"; } else { res = Tcl_FSUnregister(&testReportingFilesystem); - if (res == TCL_OK) { - Tcl_SetResult(interp, "unregistered", TCL_STATIC); - } else { - Tcl_SetResult(interp, "failed", TCL_STATIC); - } + msg = (res == TCL_OK) ? "unregistered" : "failed"; } + Tcl_SetResult(interp, msg, TCL_VOLATILE); return res; } static int -TestReportInFilesystem(Tcl_Obj *pathPtr, ClientData *clientDataPtr) { +TestReportInFilesystem(Tcl_Obj *pathPtr, ClientData *clientDataPtr) +{ static Tcl_Obj* lastPathPtr = NULL; if (pathPtr == lastPathPtr) { |