diff options
Diffstat (limited to 'generic/tclIOSock.c')
-rw-r--r-- | generic/tclIOSock.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 4fa451e..6887b0c 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -1,32 +1,30 @@ -/* +/* * tclIOSock.c -- * * Common routines used by all socket based channel types. * * 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. + * 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.7 2002/07/29 16:54:41 rmax Exp $ + * RCS: @(#) $Id: tclIOSock.c,v 1.11 2007/02/20 23:24:04 nijtmans Exp $ */ #include "tclInt.h" -#include "tclPort.h" /* *--------------------------------------------------------------------------- * * TclSockGetPort -- * - * Maps from a string, which could be a service name, to a port. - * Used by socket creation code to get port numbers and resolve - * registered service names to port numbers. + * Maps from a string, which could be a service name, to a port. Used by + * socket creation code to get port numbers and resolve 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 the interp's - * 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. @@ -35,21 +33,21 @@ */ int -TclSockGetPort(interp, string, proto, portPtr) - Tcl_Interp *interp; - char *string; /* Integer or service name */ - char *proto; /* "tcp" or "udp", typically */ - int *portPtr; /* Return port number */ +TclSockGetPort( + Tcl_Interp *interp, + const char *string, /* Integer or service name */ + const char *proto, /* "tcp" or "udp", typically */ + int *portPtr) /* Return port number */ { struct servent *sp; /* Protocol info for named services */ Tcl_DString ds; - CONST char *native; + const 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); @@ -62,8 +60,8 @@ TclSockGetPort(interp, string, proto, portPtr) return TCL_ERROR; } if (*portPtr > 0xFFFF) { - Tcl_AppendResult(interp, "couldn't open socket: port number too high", - (char *) NULL); + Tcl_AppendResult(interp, "couldn't open socket: port number too high", + NULL); return TCL_ERROR; } return TCL_OK; @@ -86,9 +84,9 @@ TclSockGetPort(interp, string, proto, portPtr) */ int -TclSockMinimumBuffers(sock, size) - int sock; /* Socket file descriptor */ - int size; /* Minimum buffer size */ +TclSockMinimumBuffers( + int sock, /* Socket file descriptor */ + int size) /* Minimum buffer size */ { int current; socklen_t len; @@ -107,3 +105,11 @@ TclSockMinimumBuffers(sock, size) } return TCL_OK; } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ |