summaryrefslogtreecommitdiffstats
path: root/generic/tclIOCmd.c
diff options
context:
space:
mode:
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;