rem: Tcl_AppendResult(interp, "could not dup \"", argv[1], "\": ", SockError(interp), NULL);
add: Tcl_AppendResult(interp, "dup failed: ", SockError(interp), NULL);
context: NsTclSockCallbackCmd(ClientData dummy, Tcl_Interp *interp, int argc,		      char **argv){    SOCKET  sock;    int     when;    char   *s;    Callback *cbPtr;    if (argc != 4) {        Tcl_AppendResult(interp, "wrong # args: should be \"",            argv[0], " sockId script when\"", NULL);        return TCL_ERROR;    }    s = argv[3];    when = 0;    while (*s != '\0') {        if (*s == 'r') {            when |= NS_SOCK_READ;        } else if (*s == 'w') {            when |= NS_SOCK_WRITE;        } else if (*s == 'e') {            when |= NS_SOCK_EXCEPTION;        } else if (*s == 'x') {            when |= NS_SOCK_EXIT;        } else {            Tcl_AppendResult(interp, "invalid when specification \"",                argv[3], "\": should be one or more of r, w, e, or x", NULL);            return TCL_ERROR;        }        ++s;    }    if (when == 0) {	Tcl_AppendResult(interp, "invalid when specification \"", argv[3],			 "\": should be one or more of r, w, e, or x", NULL);	return TCL_ERROR;    }    if (Ns_TclGetOpenFd(interp, argv[1], (when & NS_SOCK_WRITE),			(int *) &sock) != TCL_OK) {        return TCL_ERROR;    }    sock = ns_sockdup(sock);    if (sock == INVALID_SOCKET) {    	Tcl_AppendResult(interp, "could not dup \"", argv[1],	    "\": ", SockError(interp), NULL);	return TCL_ERROR;    }    cbPtr = ns_malloc(sizeof(Callback) + strlen(argv[2]));    cbPtr->when = when;    strcpy(cbPtr->script, argv[2]);    if (Ns_SockCallback(sock, NsTclSockProc, cbPtr,    	    	    	when | NS_SOCK_EXIT) != NS_OK) {        interp->result = "could not register callback";	ns_sockclose(sock);        ns_free(cbPtr);        return TCL_ERROR;    }    return TCL_OK;}