summaryrefslogtreecommitdiffstats
path: root/generic/tclIOCmd.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-12-09 15:09:07 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-12-09 15:09:07 (GMT)
commitee6985ab9eed245164bf1078496d5b7efbabdd9c (patch)
treece38d69f9ab51ef0a83d6e83b49177e042a74a31 /generic/tclIOCmd.c
parent04d3371ea6033290def691a38224ba78356f0a9a (diff)
downloadtcl-ee6985ab9eed245164bf1078496d5b7efbabdd9c.zip
tcl-ee6985ab9eed245164bf1078496d5b7efbabdd9c.tar.gz
tcl-ee6985ab9eed245164bf1078496d5b7efbabdd9c.tar.bz2
* generic/tclCmdAH.c (TclInitFileCmd, TclMakeFileCommandSafe, ...):
Break up [file] into an ensemble. Note that the ensemble is safe in itself, but the majority of its subcommands are not. * generic/tclFCmd.c (FileCopyRename,TclFileDeleteCmd,TclFileAttrsCmd) (TclFileMakeDirsCmd): Adjust these subcommand implementations to work inside an ensemble. (TclFileLinkCmd, TclFileReadLinkCmd, TclFileTemporaryCmd): Move these subcommand implementations from tclCmdAH.c, where they didn't really belong. * generic/tclIOCmd.c (TclChannelNamesCmd): Move to more appropriate source file. * generic/tclEnsemble.c (TclMakeEnsemble): Start of code to make partially-safe ensembles. Currently does not function as expected due to various shortcomings in how safe interpreters are constructed. * tests/cmdAH.test, tests/fCmd.test, tests/interp.test: Test updates to take into account systematization of error messages.
Diffstat (limited to 'generic/tclIOCmd.c')
-rw-r--r--generic/tclIOCmd.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 696b3ac..59d7b3b 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.69 2010/08/22 18:53:26 nijtmans Exp $
+ * RCS: @(#) $Id: tclIOCmd.c,v 1.70 2010/12/09 15:09:07 dkf Exp $
*/
#include "tclInt.h"
@@ -1898,6 +1898,39 @@ ChanPipeObjCmd(
/*
*----------------------------------------------------------------------
*
+ * TclChannelNamesCmd --
+ *
+ * This function is invoked to process the "chan names" and "file
+ * channels" Tcl commands. See the user documentation for details on
+ * what they do.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclChannelNamesCmd(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ if (objc < 1 || objc > 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "?pattern?");
+ return TCL_ERROR;
+ }
+ return Tcl_GetChannelNamesEx(interp,
+ ((objc == 1) ? NULL : TclGetString(objv[1])));
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TclInitChanCmd --
*
* This function is invoked to create the "chan" Tcl command. See the
@@ -1932,6 +1965,7 @@ TclInitChanCmd(
{"event", Tcl_FileEventObjCmd, NULL, NULL, NULL},
{"flush", Tcl_FlushObjCmd, NULL, NULL, NULL},
{"gets", Tcl_GetsObjCmd, NULL, NULL, NULL},
+ {"names", TclChannelNamesCmd},
{"pending", ChanPendingObjCmd, NULL, NULL, NULL}, /* TIP #287 */
{"pop", TclChanPopObjCmd, NULL, NULL, NULL}, /* TIP #230 */
{"postevent", TclChanPostEventObjCmd, NULL, NULL, NULL}, /* TIP #219 */
@@ -1946,7 +1980,6 @@ TclInitChanCmd(
};
static const char *const extras[] = {
"configure", "::fconfigure",
- "names", "::file channels",
NULL
};
Tcl_Command ensemble;