From 300397b61e4e0a6bc9a33018463d2127b11dcf29 Mon Sep 17 00:00:00 2001 From: dcp1990 Date: Sun, 26 Jun 2005 16:22:54 +0000 Subject: [PATCH] Register that shiat --- lib/sockstuff.c | 13 ++++++++----- lib/tcl/sockstuff.c | 13 ++++++++----- xfone/sockstuff.c | 13 ++++++++----- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/lib/sockstuff.c b/lib/sockstuff.c index 060928c..a5e68dd 100644 --- a/lib/sockstuff.c +++ b/lib/sockstuff.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Amigan: phoned/lib/sockstuff.c,v 1.4 2005/06/26 16:06:49 dcp1990 Exp $ */ +/* $Amigan: phoned/lib/sockstuff.c,v 1.5 2005/06/26 16:22:54 dcp1990 Exp $ */ #include #include #include @@ -148,7 +148,8 @@ Tcl_ChannelType Udom_ChanType = { -Tcl_Channel Udom_CreateChannel(sockfile, mask) +Tcl_Channel Udom_CreateChannel(interp, sockfile, mask) + Tcl_Interp *interp; CONST char *sockfile; int mask; { @@ -162,6 +163,7 @@ Tcl_Channel Udom_CreateChannel(sockfile, mask) them.sun_family = AF_LOCAL; if(connect(s, (struct sockaddr *)&them, 1 + strlen(them.sun_path) + sizeof(them.sun_family)) == -1) { ckfree((char*)cdt); + Tcl_SetResult(interp, strerror(errno), TCL_STATIC); return NULL; } cdt->fd = s; @@ -189,19 +191,20 @@ int Udom_Cmd (cdata, interp, argc, argv) arg = Tcl_GetString(argv[a]); if(*arg != '-') break; if(Tcl_GetIndexFromObj(interp, argv[a], udomopt, "option", TCL_EXACT, &optind) - != TCL_OK) return TCL_ERROR; + != TCL_OK) return mseterr("Getindex"); switch((enum udomopt)optind) { case UDOM_FILE: if(a >= argc) return mseterr("needs file!"); - sfl = Tcl_GetString(argv[a]); + sfl = Tcl_GetString(argv[a + 1]); break; default: Tcl_Panic("udom: bad optind to opts"); } } if(sfl == NULL) return mseterr("file argument REQUIRED."); - res = Udom_CreateChannel(sfl, TCL_READABLE | TCL_WRITABLE); + res = Udom_CreateChannel(interp, sfl, TCL_READABLE | TCL_WRITABLE); if(res == NULL) return TCL_ERROR; + Tcl_RegisterChannel(interp, res); Tcl_ResetResult(interp); Tcl_AppendResult(interp, Tcl_GetChannelName(res), (char*)NULL); return TCL_OK; diff --git a/lib/tcl/sockstuff.c b/lib/tcl/sockstuff.c index 976b051..4f38f8e 100644 --- a/lib/tcl/sockstuff.c +++ b/lib/tcl/sockstuff.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Amigan: phoned/lib/tcl/sockstuff.c,v 1.4 2005/06/26 16:06:49 dcp1990 Exp $ */ +/* $Amigan: phoned/lib/tcl/sockstuff.c,v 1.5 2005/06/26 16:22:54 dcp1990 Exp $ */ #include #include #include @@ -148,7 +148,8 @@ Tcl_ChannelType Udom_ChanType = { -Tcl_Channel Udom_CreateChannel(sockfile, mask) +Tcl_Channel Udom_CreateChannel(interp, sockfile, mask) + Tcl_Interp *interp; CONST char *sockfile; int mask; { @@ -162,6 +163,7 @@ Tcl_Channel Udom_CreateChannel(sockfile, mask) them.sun_family = AF_LOCAL; if(connect(s, (struct sockaddr *)&them, 1 + strlen(them.sun_path) + sizeof(them.sun_family)) == -1) { ckfree((char*)cdt); + Tcl_SetResult(interp, strerror(errno), TCL_STATIC); return NULL; } cdt->fd = s; @@ -189,19 +191,20 @@ int Udom_Cmd (cdata, interp, argc, argv) arg = Tcl_GetString(argv[a]); if(*arg != '-') break; if(Tcl_GetIndexFromObj(interp, argv[a], udomopt, "option", TCL_EXACT, &optind) - != TCL_OK) return TCL_ERROR; + != TCL_OK) return mseterr("Getindex"); switch((enum udomopt)optind) { case UDOM_FILE: if(a >= argc) return mseterr("needs file!"); - sfl = Tcl_GetString(argv[a]); + sfl = Tcl_GetString(argv[a + 1]); break; default: Tcl_Panic("udom: bad optind to opts"); } } if(sfl == NULL) return mseterr("file argument REQUIRED."); - res = Udom_CreateChannel(sfl, TCL_READABLE | TCL_WRITABLE); + res = Udom_CreateChannel(interp, sfl, TCL_READABLE | TCL_WRITABLE); if(res == NULL) return TCL_ERROR; + Tcl_RegisterChannel(interp, res); Tcl_ResetResult(interp); Tcl_AppendResult(interp, Tcl_GetChannelName(res), (char*)NULL); return TCL_OK; diff --git a/xfone/sockstuff.c b/xfone/sockstuff.c index 8d0fc2a..13dc91c 100644 --- a/xfone/sockstuff.c +++ b/xfone/sockstuff.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Amigan: phoned/xfone/sockstuff.c,v 1.4 2005/06/26 16:06:49 dcp1990 Exp $ */ +/* $Amigan: phoned/xfone/sockstuff.c,v 1.5 2005/06/26 16:22:54 dcp1990 Exp $ */ #include #include #include @@ -148,7 +148,8 @@ Tcl_ChannelType Udom_ChanType = { -Tcl_Channel Udom_CreateChannel(sockfile, mask) +Tcl_Channel Udom_CreateChannel(interp, sockfile, mask) + Tcl_Interp *interp; CONST char *sockfile; int mask; { @@ -162,6 +163,7 @@ Tcl_Channel Udom_CreateChannel(sockfile, mask) them.sun_family = AF_LOCAL; if(connect(s, (struct sockaddr *)&them, 1 + strlen(them.sun_path) + sizeof(them.sun_family)) == -1) { ckfree((char*)cdt); + Tcl_SetResult(interp, strerror(errno), TCL_STATIC); return NULL; } cdt->fd = s; @@ -189,19 +191,20 @@ int Udom_Cmd (cdata, interp, argc, argv) arg = Tcl_GetString(argv[a]); if(*arg != '-') break; if(Tcl_GetIndexFromObj(interp, argv[a], udomopt, "option", TCL_EXACT, &optind) - != TCL_OK) return TCL_ERROR; + != TCL_OK) return mseterr("Getindex"); switch((enum udomopt)optind) { case UDOM_FILE: if(a >= argc) return mseterr("needs file!"); - sfl = Tcl_GetString(argv[a]); + sfl = Tcl_GetString(argv[a + 1]); break; default: Tcl_Panic("udom: bad optind to opts"); } } if(sfl == NULL) return mseterr("file argument REQUIRED."); - res = Udom_CreateChannel(sfl, TCL_READABLE | TCL_WRITABLE); + res = Udom_CreateChannel(interp, sfl, TCL_READABLE | TCL_WRITABLE); if(res == NULL) return TCL_ERROR; + Tcl_RegisterChannel(interp, res); Tcl_ResetResult(interp); Tcl_AppendResult(interp, Tcl_GetChannelName(res), (char*)NULL); return TCL_OK;