summaryrefslogtreecommitdiffstats
path: root/generic/tclIOSock.c
diff options
context:
space:
mode:
authorstanton <stanton>1999-04-16 00:46:29 (GMT)
committerstanton <stanton>1999-04-16 00:46:29 (GMT)
commit97464e6cba8eb0008cf2727c15718671992b913f (patch)
treece9959f2747257d98d52ec8d18bf3b0de99b9535 /generic/tclIOSock.c
parenta8c96ddb94d1483a9de5e340b740cb74ef6cafa7 (diff)
downloadtcl-97464e6cba8eb0008cf2727c15718671992b913f.zip
tcl-97464e6cba8eb0008cf2727c15718671992b913f.tar.gz
tcl-97464e6cba8eb0008cf2727c15718671992b913f.tar.bz2
merged tcl 8.1 branch back into the main trunk
Diffstat (limited to 'generic/tclIOSock.c')
-rw-r--r--generic/tclIOSock.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c
index 1f0be9e..3fb9e8d 100644
--- a/generic/tclIOSock.c
+++ b/generic/tclIOSock.c
@@ -3,19 +3,19 @@
*
* Common routines used by all socket based channel types.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOSock.c,v 1.2 1998/09/14 18:39:59 stanton Exp $
+ * RCS: @(#) $Id: tclIOSock.c,v 1.3 1999/04/16 00:46:47 stanton Exp $
*/
#include "tclInt.h"
#include "tclPort.h"
/*
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*
* TclSockGetPort --
*
@@ -24,14 +24,14 @@
* registered service names to port numbers.
*
* Results:
- * A standard Tcl result. On success, the port number is
- * returned in portPtr. On failure, an error message is left in
- * interp->result.
+ * A standard Tcl result. On success, the port number is returned
+ * in portPtr. On failure, an error message is left in the interp's
+ * result.
*
* Side effects:
* None.
*
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*/
int
@@ -42,14 +42,21 @@ TclSockGetPort(interp, string, proto, portPtr)
int *portPtr; /* Return port number */
{
struct servent *sp; /* Protocol info for named services */
- if (Tcl_GetInt(interp, string, portPtr) != TCL_OK) {
- sp = getservbyname(string, proto);
+ Tcl_DString ds;
+ char *native;
+
+ if (Tcl_GetInt(NULL, string, portPtr) != TCL_OK) {
+ /*
+ * Don't bother translating 'proto' to native.
+ */
+
+ native = Tcl_UtfToExternalDString(NULL, string, -1, &ds);
+ sp = getservbyname(native, proto); /* INTL: Native. */
+ Tcl_DStringFree(&ds);
if (sp != NULL) {
*portPtr = ntohs((unsigned short) sp->s_port);
- Tcl_ResetResult(interp); /* clear error message */
return TCL_OK;
}
- return TCL_ERROR;
}
if (Tcl_GetInt(interp, string, portPtr) != TCL_OK) {
return TCL_ERROR;