rem: } opt;
add: } _nsmayalias opt;
context: NsTclChanObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){    NsInterp *itPtr = arg;    NsServer *servPtr = itPtr->servPtr;    Tcl_Channel chan = NULL;    char *name, *chanName;    NsRegChan *regChan = NULL;    int new, shared;    Tcl_HashTable *tabPtr;    Tcl_HashEntry *hPtr;    Tcl_HashSearch search;    static CONST char *opts[] = {	"cleanup", "list", "create", "put", "get", NULL    };    enum {	CCleanupIdx, CListIdx, CCreateIdx, CPutIdx, CGetIdx    } opt;    if (objc < 2) {	Tcl_WrongNumArgs(interp, 1, objv, "command ?args?");	return TCL_ERROR;    }    if (Tcl_GetIndexFromObj(interp, objv[1], opts, "option", 0,		(int *) &opt) != TCL_OK) {	return TCL_ERROR;    }    switch (opt) {    case CCreateIdx:	if (objc != 4) {	    Tcl_WrongNumArgs(interp, 1, objv, "create channel name");	    return TCL_ERROR;	}	chanName = Tcl_GetString(objv[2]);	chan = Tcl_GetChannel(interp, chanName, NULL);	if (chan == (Tcl_Channel)NULL) {	    return TCL_ERROR;	}	if (Tcl_IsChannelShared(chan)) {	    Tcl_SetResult(interp, "channel is shared", TCL_STATIC);	    return TCL_ERROR;	}	name = Tcl_GetString(objv[3]);	Ns_MutexLock(&servPtr->chans.lock);	hPtr = Tcl_CreateHashEntry(&servPtr->chans.table, name, &new);	if (new) {	    regChan = ns_malloc(sizeof(NsRegChan));	    regChan->name = ns_malloc(strlen(chanName)+1);	    regChan->chan = chan;	    strcpy(regChan->name, chanName);	    Tcl_SetHashValue(hPtr, regChan);	}	Ns_MutexUnlock(&servPtr->chans.lock);	if (!new) {	    Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),		    "channel with name \"", Tcl_GetString(objv[3]),		    "\" already exists", NULL);	    return TCL_ERROR;	}	UnspliceChannel(interp, chan);	break;    case CGetIdx:	if (objc != 3) {	    Tcl_WrongNumArgs(interp, 1, objv, "get name");	    return TCL_ERROR;	}	name = Tcl_GetString(objv[2]);	Ns_MutexLock(&servPtr->chans.lock);	hPtr = Tcl_FindHashEntry(&servPtr->chans.table, name);	if (hPtr != NULL) {	    regChan = (NsRegChan*)Tcl_GetHashValue(hPtr);	    Tcl_DeleteHashEntry(hPtr);	}	Ns_MutexUnlock(&servPtr->chans.lock);	if (hPtr == NULL) {	    Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),		    "no such shared channel: ", name, NULL);	    return TCL_ERROR;	}	SpliceChannel(interp, regChan->chan);	Tcl_SetResult(interp, regChan->name, TCL_VOLATILE);	hPtr = Tcl_CreateHashEntry(&itPtr->chans, name, &new);	Tcl_SetHashValue(hPtr, regChan);	break;    case CPutIdx:	if (objc != 3) {	    Tcl_WrongNumArgs(interp, 1, objv, "put name");	    return TCL_ERROR;	}	name = Tcl_GetString(objv[2]);	hPtr = Tcl_FindHashEntry(&itPtr->chans, name);	if (hPtr == NULL) {	    Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),		   "no such shared channel: ", name, NULL);	    return TCL_ERROR;	}	regChan = (NsRegChan*)Tcl_GetHashValue(hPtr);    chan = Tcl_GetChannel(interp, regChan->name, NULL);	if (chan == (Tcl_Channel)NULL || chan != regChan->chan) {	    Tcl_DeleteHashEntry(hPtr);        if (chan != regChan->chan) {            Tcl_SetResult(interp, "channel mismatch", TCL_STATIC);        }	    return TCL_ERROR;	}	UnspliceChannel(interp, regChan->chan);	Tcl_DeleteHashEntry(hPtr);	Ns_MutexLock(&servPtr->chans.lock);	hPtr = Tcl_CreateHashEntry(&servPtr->chans.table, name, &new);	Tcl_SetHashValue(hPtr, regChan);	Ns_MutexUnlock(&servPtr->chans.lock);	break;    case CListIdx:	if (objc != 2 && objc != 3) {	    Tcl_WrongNumArgs(interp, 1, objv, "list ?-shared?");	    return TCL_ERROR;	}	shared = (objc == 3);	if (shared) {	    Ns_MutexLock(&servPtr->chans.lock);	    tabPtr = &servPtr->chans.table; 	} else {	    tabPtr = &itPtr->chans;	}	hPtr = Tcl_FirstHashEntry(tabPtr, &search);	while (hPtr != NULL) {	    Tcl_AppendElement(interp, Tcl_GetHashKey(tabPtr, hPtr));	    hPtr = Tcl_NextHashEntry(&search);	}	if (shared) {	    Ns_MutexUnlock(&servPtr->chans.lock);	}	break;    case CCleanupIdx:	if (objc != 2 && objc != 3) {	    Tcl_WrongNumArgs(interp, 1, objv, "cleanup ?-shared?");	    return TCL_ERROR;	}	shared = (objc == 3);	if (shared) {	    Ns_MutexLock(&servPtr->chans.lock);	    tabPtr = &servPtr->chans.table;	} else {	    tabPtr = &itPtr->chans;	}	hPtr = Tcl_FirstHashEntry(tabPtr, &search);	while (hPtr != NULL) {	    regChan = (NsRegChan*)Tcl_GetHashValue(hPtr);	    if (shared) {		Tcl_SpliceChannel(regChan->chan);		Tcl_UnregisterChannel((Tcl_Interp*)NULL, regChan->chan);	    } else {		Tcl_UnregisterChannel(interp, regChan->chan);	    }	    ns_free(regChan->name);	    ns_free(regChan);	    Tcl_DeleteHashEntry(hPtr);	    hPtr = Tcl_NextHashEntry(&search);	}	if (shared) {	    Ns_MutexUnlock(&servPtr->chans.lock);	}	break;    }    return TCL_OK;}