summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-11-11 23:46:34 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-11-11 23:46:34 (GMT)
commit1a2498d774a65abfc4aa734a107ea67438c8b625 (patch)
treeb3ab0395489143eb6c7a5337a521d3e8cb505875
parent2dc0d2ce91e0ef65ce9cbc9c886b63f8e9c26a0c (diff)
downloadtcl-1a2498d774a65abfc4aa734a107ea67438c8b625.zip
tcl-1a2498d774a65abfc4aa734a107ea67438c8b625.tar.gz
tcl-1a2498d774a65abfc4aa734a107ea67438c8b625.tar.bz2
More bits of ANSIfying
-rw-r--r--generic/tclListObj.c238
-rw-r--r--generic/tclLoadNone.c105
-rw-r--r--unix/tclLoadAix.c34
-rw-r--r--unix/tclLoadDl.c44
-rw-r--r--unix/tclLoadDyld.c73
-rw-r--r--unix/tclLoadNext.c50
-rw-r--r--unix/tclLoadOSF.c47
-rw-r--r--unix/tclLoadShl.c39
-rw-r--r--unix/tclUnixChan.c14
-rw-r--r--unix/tclUnixFile.c115
-rw-r--r--unix/tclUnixSock.c66
11 files changed, 433 insertions, 392 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 2c5c4d4..6ff5940 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclListObj.c,v 1.28 2005/10/20 12:21:44 msofer Exp $
+ * RCS: @(#) $Id: tclListObj.c,v 1.29 2005/11/11 23:46:34 dkf Exp $
*/
#include "tclInt.h"
@@ -45,7 +45,6 @@ Tcl_ObjType tclListType = {
UpdateStringOfList, /* updateStringProc */
NULL /* setFromAnyProc */
};
-
/*
*----------------------------------------------------------------------
@@ -71,10 +70,10 @@ Tcl_ObjType tclListType = {
*----------------------------------------------------------------------
*/
-static List*
-NewListIntRep(objc, objv)
- int objc;
- Tcl_Obj *CONST objv[];
+static List *
+NewListIntRep(
+ int objc,
+ Tcl_Obj *CONST objv[])
{
Tcl_Obj **elemPtrs;
List *listRepPtr;
@@ -148,9 +147,9 @@ NewListIntRep(objc, objv)
#undef Tcl_NewListObj
Tcl_Obj *
-Tcl_NewListObj(objc, objv)
- int objc; /* Count of objects referenced by objv. */
- Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
+Tcl_NewListObj(
+ int objc, /* Count of objects referenced by objv. */
+ Tcl_Obj *CONST objv[]) /* An array of pointers to Tcl objects. */
{
return Tcl_DbNewListObj(objc, objv, "unknown", 0);
}
@@ -158,9 +157,9 @@ Tcl_NewListObj(objc, objv)
#else /* if not TCL_MEM_DEBUG */
Tcl_Obj *
-Tcl_NewListObj(objc, objv)
- int objc; /* Count of objects referenced by objv. */
- Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
+Tcl_NewListObj(
+ int objc, /* Count of objects referenced by objv. */
+ Tcl_Obj *CONST objv[]) /* An array of pointers to Tcl objects. */
{
List *listRepPtr;
Tcl_Obj *listPtr;
@@ -185,7 +184,7 @@ Tcl_NewListObj(objc, objv)
*/
Tcl_InvalidateStringRep(listPtr);
- listPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
+ listPtr->internalRep.twoPtrValue.ptr1 = (void *) listRepPtr;
listPtr->internalRep.twoPtrValue.ptr2 = NULL;
listPtr->typePtr = &tclListType;
listRepPtr->refCount++;
@@ -226,12 +225,12 @@ Tcl_NewListObj(objc, objv)
#ifdef TCL_MEM_DEBUG
Tcl_Obj *
-Tcl_DbNewListObj(objc, objv, file, line)
- int objc; /* Count of objects referenced by objv. */
- Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
- CONST char *file; /* The name of the source file calling this
+Tcl_DbNewListObj(
+ int objc, /* Count of objects referenced by objv. */
+ Tcl_Obj *CONST objv[], /* An array of pointers to Tcl objects. */
+ CONST char *file, /* The name of the source file calling this
* function; used for debugging. */
- int line; /* Line number in the source file; used for
+ int line) /* Line number in the source file; used for
* debugging. */
{
Tcl_Obj *listPtr;
@@ -268,12 +267,12 @@ Tcl_DbNewListObj(objc, objv, file, line)
#else /* if not TCL_MEM_DEBUG */
Tcl_Obj *
-Tcl_DbNewListObj(objc, objv, file, line)
- int objc; /* Count of objects referenced by objv. */
- Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
- CONST char *file; /* The name of the source file calling this
+Tcl_DbNewListObj(
+ int objc, /* Count of objects referenced by objv. */
+ Tcl_Obj *CONST objv[], /* An array of pointers to Tcl objects. */
+ CONST char *file, /* The name of the source file calling this
* function; used for debugging. */
- int line; /* Line number in the source file; used for
+ int line) /* Line number in the source file; used for
* debugging. */
{
return Tcl_NewListObj(objc, objv);
@@ -303,10 +302,10 @@ Tcl_DbNewListObj(objc, objv, file, line)
*/
void
-Tcl_SetListObj(objPtr, objc, objv)
- Tcl_Obj *objPtr; /* Object whose internal rep to init. */
- int objc; /* Count of objects referenced by objv. */
- Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */
+Tcl_SetListObj(
+ Tcl_Obj *objPtr, /* Object whose internal rep to init. */
+ int objc, /* Count of objects referenced by objv. */
+ Tcl_Obj *CONST objv[]) /* An array of pointers to Tcl objects. */
{
List *listRepPtr;
@@ -333,7 +332,7 @@ Tcl_SetListObj(objPtr, objc, objv)
if (!listRepPtr) {
Tcl_Panic("Cannot allocate enough memory for Tcl_SetListObj");
}
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) listRepPtr;
objPtr->internalRep.twoPtrValue.ptr2 = NULL;
objPtr->typePtr = &tclListType;
listRepPtr->refCount++;
@@ -374,13 +373,13 @@ Tcl_SetListObj(objPtr, objc, objv)
*/
int
-Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr)
- Tcl_Interp *interp; /* Used to report errors if not NULL. */
- register Tcl_Obj *listPtr; /* List object for which an element array is
+Tcl_ListObjGetElements(
+ Tcl_Interp *interp, /* Used to report errors if not NULL. */
+ register Tcl_Obj *listPtr, /* List object for which an element array is
* to be returned. */
- int *objcPtr; /* Where to store the count of objects
+ int *objcPtr, /* Where to store the count of objects
* referenced by objv. */
- Tcl_Obj ***objvPtr; /* Where to store the pointer to an array of
+ Tcl_Obj ***objvPtr) /* Where to store the pointer to an array of
* pointers to the list's objects. */
{
register List *listRepPtr;
@@ -433,10 +432,10 @@ Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr)
*/
int
-Tcl_ListObjAppendList(interp, listPtr, elemListPtr)
- Tcl_Interp *interp; /* Used to report errors if not NULL. */
- register Tcl_Obj *listPtr; /* List object to append elements to. */
- Tcl_Obj *elemListPtr; /* List obj with elements to append. */
+Tcl_ListObjAppendList(
+ Tcl_Interp *interp, /* Used to report errors if not NULL. */
+ register Tcl_Obj *listPtr, /* List object to append elements to. */
+ Tcl_Obj *elemListPtr) /* List obj with elements to append. */
{
int listLen, objc, result;
Tcl_Obj **objv;
@@ -491,10 +490,10 @@ Tcl_ListObjAppendList(interp, listPtr, elemListPtr)
*/
int
-Tcl_ListObjAppendElement(interp, listPtr, objPtr)
- Tcl_Interp *interp; /* Used to report errors if not NULL. */
- Tcl_Obj *listPtr; /* List object to append objPtr to. */
- Tcl_Obj *objPtr; /* Object to append to listPtr's list. */
+Tcl_ListObjAppendElement(
+ Tcl_Interp *interp, /* Used to report errors if not NULL. */
+ Tcl_Obj *listPtr, /* List object to append objPtr to. */
+ Tcl_Obj *objPtr) /* Object to append to listPtr's list. */
{
register List *listRepPtr;
register Tcl_Obj **elemPtrs;
@@ -606,11 +605,11 @@ Tcl_ListObjAppendElement(interp, listPtr, objPtr)
*/
int
-Tcl_ListObjIndex(interp, listPtr, index, objPtrPtr)
- Tcl_Interp *interp; /* Used to report errors if not NULL. */
- register Tcl_Obj *listPtr; /* List object to index into. */
- register int index; /* Index of element to return. */
- Tcl_Obj **objPtrPtr; /* The resulting Tcl_Obj* is stored here. */
+Tcl_ListObjIndex(
+ Tcl_Interp *interp, /* Used to report errors if not NULL. */
+ register Tcl_Obj *listPtr, /* List object to index into. */
+ register int index, /* Index of element to return. */
+ Tcl_Obj **objPtrPtr) /* The resulting Tcl_Obj* is stored here. */
{
register List *listRepPtr;
@@ -662,10 +661,10 @@ Tcl_ListObjIndex(interp, listPtr, index, objPtrPtr)
*/
int
-Tcl_ListObjLength(interp, listPtr, intPtr)
- Tcl_Interp *interp; /* Used to report errors if not NULL. */
- register Tcl_Obj *listPtr; /* List object whose #elements to return. */
- register int *intPtr; /* The resulting int is stored here. */
+Tcl_ListObjLength(
+ Tcl_Interp *interp, /* Used to report errors if not NULL. */
+ register Tcl_Obj *listPtr, /* List object whose #elements to return. */
+ register int *intPtr) /* The resulting int is stored here. */
{
register List *listRepPtr;
@@ -728,13 +727,13 @@ Tcl_ListObjLength(interp, listPtr, intPtr)
*/
int
-Tcl_ListObjReplace(interp, listPtr, first, count, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tcl_Obj *listPtr; /* List object whose elements to replace. */
- int first; /* Index of first element to replace. */
- int count; /* Number of elements to replace. */
- int objc; /* Number of objects to insert. */
- Tcl_Obj *CONST objv[]; /* An array of objc pointers to Tcl objects to
+Tcl_ListObjReplace(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *listPtr, /* List object whose elements to replace. */
+ int first, /* Index of first element to replace. */
+ int count, /* Number of elements to replace. */
+ int objc, /* Number of objects to insert. */
+ Tcl_Obj *CONST objv[]) /* An array of objc pointers to Tcl objects to
* insert. */
{
List *listRepPtr;
@@ -959,16 +958,16 @@ Tcl_ListObjReplace(interp, listPtr, first, count, objc, objv)
*----------------------------------------------------------------------
*/
-Tcl_Obj*
-TclLsetList(interp, listPtr, indexArgPtr, valuePtr)
- Tcl_Interp* interp; /* Tcl interpreter */
- Tcl_Obj* listPtr; /* Pointer to the list being modified */
- Tcl_Obj* indexArgPtr; /* Index or index-list arg to 'lset' */
- Tcl_Obj* valuePtr; /* Value arg to 'lset' */
+Tcl_Obj *
+TclLsetList(
+ Tcl_Interp *interp, /* Tcl interpreter */
+ Tcl_Obj *listPtr, /* Pointer to the list being modified */
+ Tcl_Obj *indexArgPtr, /* Index or index-list arg to 'lset' */
+ Tcl_Obj *valuePtr) /* Value arg to 'lset' */
{
int indexCount; /* Number of indices in the index list */
- Tcl_Obj** indices; /* Vector of indices in the index list*/
- Tcl_Obj* retValuePtr; /* Pointer to the list to be returned */
+ Tcl_Obj **indices; /* Vector of indices in the index list*/
+ Tcl_Obj *retValuePtr; /* Pointer to the list to be returned */
int index; /* Current index in the list - discarded */
int i;
List *indexListRepPtr;
@@ -1065,10 +1064,9 @@ TclLsetList(interp, listPtr, indexArgPtr, valuePtr)
* to a reference count of the duplicate. Now the reference count of an
* unduplicated object is 2 (the returned pointer, plus the one stored in
* the variable). The reference count of a duplicate object is 1,
- * reflecting that the returned pointer is the only active reference.
- * The caller is expected to store the returned value back in the
- * variable and decrement its reference count. (INST_STORE_* does exactly
- * this.)
+ * reflecting that the returned pointer is the only active reference. The
+ * caller is expected to store the returned value back in the variable
+ * and decrement its reference count. (INST_STORE_* does exactly this.)
*
* Tcl_LsetList and related functions maintain a linked list of Tcl_Obj's
* whose string representations must be spoilt by threading via 'ptr2' of
@@ -1079,24 +1077,24 @@ TclLsetList(interp, listPtr, indexArgPtr, valuePtr)
*----------------------------------------------------------------------
*/
-Tcl_Obj*
-TclLsetFlat(interp, listPtr, indexCount, indexArray, valuePtr)
- Tcl_Interp* interp; /* Tcl interpreter */
- Tcl_Obj* listPtr; /* Pointer to the list being modified */
- int indexCount; /* Number of index args */
- Tcl_Obj *CONST indexArray[];
+Tcl_Obj *
+TclLsetFlat(
+ Tcl_Interp *interp, /* Tcl interpreter */
+ Tcl_Obj *listPtr, /* Pointer to the list being modified */
+ int indexCount, /* Number of index args */
+ Tcl_Obj *CONST indexArray[],
/* Index args */
- Tcl_Obj* valuePtr; /* Value arg to 'lset' */
+ Tcl_Obj *valuePtr) /* Value arg to 'lset' */
{
int duplicated; /* Flag == 1 if the obj has been duplicated, 0
* otherwise */
- Tcl_Obj* retValuePtr; /* Pointer to the list to be returned */
+ Tcl_Obj *retValuePtr; /* Pointer to the list to be returned */
int elemCount; /* Length of one sublist being changed */
- Tcl_Obj** elemPtrs; /* Pointers to the elements of a sublist */
- Tcl_Obj* subListPtr; /* Pointer to the current sublist */
+ Tcl_Obj **elemPtrs; /* Pointers to the elements of a sublist */
+ Tcl_Obj *subListPtr; /* Pointer to the current sublist */
int index; /* Index of the element to replace in the
* current sublist */
- Tcl_Obj* chainPtr; /* Pointer to the enclosing list of the
+ Tcl_Obj *chainPtr; /* Pointer to the enclosing list of the
* current sublist. */
int result; /* Status return from library calls */
int i;
@@ -1116,13 +1114,14 @@ TclLsetFlat(interp, listPtr, indexCount, indexArray, valuePtr)
* insure that it is modifyable [Bug 1333036]. A plain Tcl_DuplicateObj
* will just increase the intrep's refCount without upping the sublists'
* refCount, so that their true shared status cannot be determined from
- * their refCount.
+ * their refCount.
*/
if (Tcl_IsShared(listPtr)) {
duplicated = 1;
- if (listPtr->typePtr == &tclListType) {
- result = Tcl_ListObjGetElements(interp, listPtr, &elemCount, &elemPtrs);
+ if (listPtr->typePtr == &tclListType) {
+ result = Tcl_ListObjGetElements(interp, listPtr, &elemCount,
+ &elemPtrs);
listPtr = Tcl_NewListObj(elemCount, elemPtrs);
} else {
listPtr = Tcl_DuplicateObj(listPtr);
@@ -1149,7 +1148,8 @@ TclLsetFlat(interp, listPtr, indexCount, indexArray, valuePtr)
* Take the sublist apart.
*/
- result = Tcl_ListObjGetElements(interp, listPtr, &elemCount, &elemPtrs);
+ result = Tcl_ListObjGetElements(interp, listPtr, &elemCount,
+ &elemPtrs);
if (result != TCL_OK) {
break;
}
@@ -1191,9 +1191,9 @@ TclLsetFlat(interp, listPtr, indexCount, indexArray, valuePtr)
}
/*
- * Extract the appropriate sublist, and make sure that it is unshared.
+ * Extract the appropriate sublist, and make sure that it is unshared.
* If it is a list, duplicate the intrep to avoid [Bug 1333036], as
- * per the previous comment.
+ * per the previous comment.
*/
subListPtr = elemPtrs[index];
@@ -1227,16 +1227,20 @@ TclLsetFlat(interp, listPtr, indexCount, indexArray, valuePtr)
listPtr = subListPtr;
}
- /* Store the result in the list element */
+ /*
+ * Store the result in the list element.
+ */
if (result == TCL_OK) {
result = TclListObjSetElement(interp, listPtr, index, valuePtr);
}
if (result == TCL_OK) {
- listPtr->internalRep.twoPtrValue.ptr2 = (VOID *) chainPtr;
+ listPtr->internalRep.twoPtrValue.ptr2 = (void *) chainPtr;
- /* Spoil all the string reps */
+ /*
+ * Spoil all the string reps.
+ */
while (listPtr != NULL) {
subListPtr = (Tcl_Obj *) listPtr->internalRep.twoPtrValue.ptr2;
@@ -1245,7 +1249,9 @@ TclLsetFlat(interp, listPtr, indexCount, indexArray, valuePtr)
listPtr = subListPtr;
}
- /* Return the new list if everything worked. */
+ /*
+ * Return the new list if everything worked.
+ */
if (!duplicated) {
Tcl_IncrRefCount(retValuePtr);
@@ -1253,7 +1259,9 @@ TclLsetFlat(interp, listPtr, indexCount, indexArray, valuePtr)
return retValuePtr;
}
- /* Clean up the one dangling reference otherwise */
+ /*
+ * Clean up the one dangling reference otherwise.
+ */
if (duplicated) {
Tcl_DecrRefCount(retValuePtr);
@@ -1291,20 +1299,20 @@ TclLsetFlat(interp, listPtr, indexCount, indexArray, valuePtr)
*/
int
-TclListObjSetElement(interp, listPtr, index, valuePtr)
- Tcl_Interp* interp; /* Tcl interpreter; used for error reporting
+TclListObjSetElement(
+ Tcl_Interp *interp, /* Tcl interpreter; used for error reporting
* if not NULL */
- Tcl_Obj* listPtr; /* List object in which element should be
+ Tcl_Obj *listPtr, /* List object in which element should be
* stored */
- int index; /* Index of element to store */
- Tcl_Obj* valuePtr; /* Tcl object to store in the designated list
+ int index, /* Index of element to store */
+ Tcl_Obj *valuePtr) /* Tcl object to store in the designated list
* element */
{
- int result; /* Return value from this function */
- List* listRepPtr; /* Internal representation of the list being
- * modified */
- Tcl_Obj** elemPtrs; /* Pointers to elements of the list */
- int elemCount; /* Number of elements in the list */
+ int result; /* Return value from this function. */
+ List *listRepPtr; /* Internal representation of the list being
+ * modified. */
+ Tcl_Obj **elemPtrs; /* Pointers to elements of the list. */
+ int elemCount; /* Number of elements in the list. */
int i;
/*
@@ -1407,8 +1415,8 @@ TclListObjSetElement(interp, listPtr, index, valuePtr)
*/
static void
-FreeListInternalRep(listPtr)
- Tcl_Obj *listPtr; /* List object with internal rep to free. */
+FreeListInternalRep(
+ Tcl_Obj *listPtr) /* List object with internal rep to free. */
{
register List *listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
register Tcl_Obj **elemPtrs = &listRepPtr->elements;
@@ -1446,14 +1454,14 @@ FreeListInternalRep(listPtr)
*/
static void
-DupListInternalRep(srcPtr, copyPtr)
- Tcl_Obj *srcPtr; /* Object with internal rep to copy. */
- Tcl_Obj *copyPtr; /* Object with internal rep to set. */
+DupListInternalRep(
+ Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
+ Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
List *listRepPtr = (List *) srcPtr->internalRep.twoPtrValue.ptr1;
listRepPtr->refCount++;
- copyPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
+ copyPtr->internalRep.twoPtrValue.ptr1 = (void *) listRepPtr;
copyPtr->internalRep.twoPtrValue.ptr2 = NULL;
copyPtr->typePtr = &tclListType;
}
@@ -1478,9 +1486,9 @@ DupListInternalRep(srcPtr, copyPtr)
*/
static int
-SetListFromAny(interp, objPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr; /* The object to convert. */
+SetListFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr) /* The object to convert. */
{
char *string, *s;
CONST char *elemStart, *nextElem;
@@ -1528,7 +1536,7 @@ SetListFromAny(interp, objPtr)
}
elemPtrs = &listRepPtr->elements;
- for (p = string, lenRemain = length, i = 0;
+ for (p=string, lenRemain=length, i=0;
lenRemain > 0;
p = nextElem, lenRemain = (limit - nextElem), i++) {
result = TclFindElement(interp, p, lenRemain, &elemStart, &nextElem,
@@ -1555,7 +1563,7 @@ SetListFromAny(interp, objPtr)
s = ckalloc((unsigned) elemSize + 1);
if (hasBrace) {
- memcpy((VOID *) s, (VOID *) elemStart, (size_t) elemSize);
+ memcpy((void *) s, (void *) elemStart, (size_t) elemSize);
s[elemSize] = 0;
} else {
elemSize = TclCopyAndCollapse(elemSize, elemStart, s);
@@ -1578,7 +1586,7 @@ SetListFromAny(interp, objPtr)
listRepPtr->refCount++;
TclFreeIntRep(objPtr);
- objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (void *) listRepPtr;
objPtr->internalRep.twoPtrValue.ptr2 = NULL;
objPtr->typePtr = &tclListType;
return TCL_OK;
@@ -1606,8 +1614,8 @@ SetListFromAny(interp, objPtr)
*/
static void
-UpdateStringOfList(listPtr)
- Tcl_Obj *listPtr; /* List object with string rep to update. */
+UpdateStringOfList(
+ Tcl_Obj *listPtr) /* List object with string rep to update. */
{
# define LOCAL_SIZE 20
int localFlags[LOCAL_SIZE], *flagPtr;
diff --git a/generic/tclLoadNone.c b/generic/tclLoadNone.c
index 4507b06..364b031 100644
--- a/generic/tclLoadNone.c
+++ b/generic/tclLoadNone.c
@@ -1,16 +1,15 @@
-/*
+/*
* tclLoadNone.c --
*
- * This procedure provides a version of the TclLoadFile for use
- * in systems that don't support dynamic loading; it just returns
- * an error.
+ * This procedure provides a version of the TclLoadFile for use in
+ * systems that don't support dynamic loading; it just returns an error.
*
* 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: tclLoadNone.c,v 1.11 2002/07/18 16:26:03 vincentdarley Exp $
+ * RCS: @(#) $Id: tclLoadNone.c,v 1.12 2005/11/11 23:46:34 dkf Exp $
*/
#include "tclInt.h"
@@ -20,13 +19,13 @@
*
* TclpDlopen --
*
- * This procedure is called to carry out dynamic loading of binary
- * code; it is intended for use only on systems that don't support
- * dynamic loading (it returns an error).
+ * This procedure is called to carry out dynamic loading of binary code;
+ * it is intended for use only on systems that don't support dynamic
+ * loading (it returns an error).
*
* Results:
- * The result is TCL_ERROR, and an error message is left in
- * the interp's result.
+ * The result is TCL_ERROR, and an error message is left in the interp's
+ * result.
*
* Side effects:
* None.
@@ -35,17 +34,17 @@
*/
int
-TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Obj *pathPtr; /* Name of the file containing the desired
+TclpDlopen(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Obj *pathPtr, /* Name of the file containing the desired
* code (UTF-8). */
- Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
- * file which will be passed back to
+ Tcl_LoadHandle *loadHandle, /* Filled with token for dynamically loaded
+ * file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
- Tcl_FSUnloadFileProc **unloadProcPtr;
+ Tcl_FSUnloadFileProc **unloadProcPtr)
/* Filled with address of Tcl_FSUnloadFileProc
- * function which should be used for
- * this file. */
+ * function which should be used for this
+ * file. */
{
Tcl_SetResult(interp,
"dynamic loading is not currently available on this system",
@@ -58,21 +57,24 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
*
* TclpFindSymbol --
*
- * Looks up a symbol, by name, through a handle associated with
- * a previously loaded piece of code (shared library).
+ * Looks up a symbol, by name, through a handle associated with a
+ * previously loaded piece of code (shared library). This version of this
+ * routine should never be called because the associated TclpDlopen()
+ * function always returns an error.
*
* Results:
- * Returns a pointer to the function associated with 'symbol' if
- * it is found. Otherwise returns NULL and may leave an error
- * message in the interp's result.
+ * Returns a pointer to the function associated with 'symbol' if it is
+ * found. Otherwise returns NULL and may leave an error message in the
+ * interp's result.
*
*----------------------------------------------------------------------
*/
-Tcl_PackageInitProc*
-TclpFindSymbol(interp, loadHandle, symbol)
- Tcl_Interp *interp;
- Tcl_LoadHandle loadHandle;
- CONST char *symbol;
+
+Tcl_PackageInitProc *
+TclpFindSymbol(
+ Tcl_Interp *interp,
+ Tcl_LoadHandle loadHandle,
+ CONST char *symbol)
{
return NULL;
}
@@ -82,14 +84,14 @@ TclpFindSymbol(interp, loadHandle, symbol)
*
* TclGuessPackageName --
*
- * If the "load" command is invoked without providing a package
- * name, this procedure is invoked to try to figure it out.
+ * If the "load" command is invoked without providing a package name,
+ * this procedure is invoked to try to figure it out.
*
* Results:
- * Always returns 0 to indicate that we couldn't figure out a
- * package name; generic code will then try to guess the package
- * from the file name. A return value of 1 would have meant that
- * we figured out the package name and put it in bufPtr.
+ * Always returns 0 to indicate that we couldn't figure out a package
+ * name; generic code will then try to guess the package from the file
+ * name. A return value of 1 would have meant that we figured out the
+ * package name and put it in bufPtr.
*
* Side effects:
* None.
@@ -98,11 +100,11 @@ TclpFindSymbol(interp, loadHandle, symbol)
*/
int
-TclGuessPackageName(fileName, bufPtr)
- CONST char *fileName; /* Name of file containing package (already
+TclGuessPackageName(
+ CONST char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
- Tcl_DString *bufPtr; /* Initialized empty dstring. Append
- * package name to this if possible. */
+ Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
+ * name to this if possible. */
{
return 0;
}
@@ -112,9 +114,9 @@ TclGuessPackageName(fileName, bufPtr)
*
* TclpUnloadFile --
*
- * This procedure is called to carry out dynamic unloading of binary
- * code; it is intended for use only on systems that don't support
- * dynamic loading (it does nothing).
+ * This procedure is called to carry out dynamic unloading of binary code;
+ * it is intended for use only on systems that don't support dynamic
+ * loading (it does nothing).
*
* Results:
* None.
@@ -126,10 +128,17 @@ TclGuessPackageName(fileName, bufPtr)
*/
void
-TclpUnloadFile(loadHandle)
- Tcl_LoadHandle loadHandle; /* loadHandle returned by a previous call
- * to TclpDlopen(). The loadHandle is
- * a token that represents the loaded
- * file. */
+TclpUnloadFile(
+ Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to
+ * TclpDlopen(). The loadHandle is a token
+ * that represents the loaded file. */
{
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tclLoadAix.c b/unix/tclLoadAix.c
index 4336663..f093896 100644
--- a/unix/tclLoadAix.c
+++ b/unix/tclLoadAix.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclLoadAix.c --
*
* This file implements the dlopen and dlsym APIs under the AIX operating
@@ -17,7 +17,7 @@
* for any results of using the software, alterations are clearly marked
* as such, and this notice is not modified.
*
- * RCS: @(#) $Id: tclLoadAix.c,v 1.4 2005/07/19 13:37:18 dkf Exp $
+ * RCS: @(#) $Id: tclLoadAix.c,v 1.5 2005/11/11 23:46:34 dkf Exp $
*
* Note: this file has been altered from the original in a few ways in order
* to work properly with Tcl.
@@ -95,8 +95,10 @@ static int readExports(ModulePtr);
static void terminate(void);
static void *findMain(void);
-VOID *
-dlopen(const char *path, int mode)
+void *
+dlopen(
+ const char *path,
+ int mode)
{
register ModulePtr mp;
static void *mainModule;
@@ -122,7 +124,7 @@ dlopen(const char *path, int mode)
for (mp = modList; mp; mp = mp->next) {
if (strcmp(mp->name, path) == 0) {
mp->refCnt++;
- return (VOID *) mp;
+ return (void *) mp;
}
}
@@ -131,7 +133,7 @@ dlopen(const char *path, int mode)
errvalid++;
strcpy(errbuf, "calloc: ");
strcat(errbuf, strerror(errno));
- return (VOID *) NULL;
+ return NULL;
}
mp->name = malloc((unsigned) (strlen(path) + 1));
@@ -169,7 +171,7 @@ dlopen(const char *path, int mode)
} else {
strcat(errbuf, strerror(errno));
}
- return (VOID *) NULL;
+ return NULL;
}
mp->refCnt = 1;
@@ -182,7 +184,7 @@ dlopen(const char *path, int mode)
errvalid++;
strcpy(errbuf, "loadbind: ");
strcat(errbuf, strerror(errno));
- return (VOID *) NULL;
+ return NULL;
}
/*
@@ -202,7 +204,7 @@ dlopen(const char *path, int mode)
if (readExports(mp) == -1) {
dlclose(mp);
- return (VOID *) NULL;
+ return NULL;
}
/*
@@ -231,7 +233,7 @@ dlopen(const char *path, int mode)
errvalid = 0;
}
- return (VOID *) mp;
+ return (void *) mp;
}
/*
@@ -240,7 +242,8 @@ dlopen(const char *path, int mode)
*/
static void
-caterr(char *s)
+caterr(
+ char *s)
{
register char *p = s;
@@ -276,8 +279,10 @@ caterr(char *s)
}
}
-VOID *
-dlsym(void *handle, const char *symbol)
+void *
+dlsym(
+ void *handle,
+ const char *symbol)
{
register ModulePtr mp = (ModulePtr)handle;
register ExportPtr ep;
@@ -378,7 +383,8 @@ terminate(void)
*/
static int
-readExports(ModulePtr mp)
+readExports(
+ ModulePtr mp)
{
LDFILE *ldp = NULL;
SCNHDR sh, shdata;
diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c
index a78b989..fa1371f 100644
--- a/unix/tclLoadDl.c
+++ b/unix/tclLoadDl.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoadDl.c,v 1.14 2005/07/19 13:37:18 dkf Exp $
+ * RCS: @(#) $Id: tclLoadDl.c,v 1.15 2005/11/11 23:46:34 dkf Exp $
*/
#include "tclInt.h"
@@ -53,19 +53,19 @@
*/
int
-TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Obj *pathPtr; /* Name of the file containing the desired
+TclpDlopen(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Obj *pathPtr, /* Name of the file containing the desired
* code (UTF-8). */
- Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
+ Tcl_LoadHandle *loadHandle, /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
- Tcl_FSUnloadFileProc **unloadProcPtr;
+ Tcl_FSUnloadFileProc **unloadProcPtr)
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for this
* file. */
{
- VOID *handle;
+ void *handle;
CONST char *native;
/*
@@ -93,12 +93,12 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
if (handle == NULL) {
Tcl_AppendResult(interp, "couldn't load file \"",
- Tcl_GetString(pathPtr), "\": ", dlerror(), (char *) NULL);
+ Tcl_GetString(pathPtr), "\": ", dlerror(), NULL);
return TCL_ERROR;
}
*unloadProcPtr = &TclpUnloadFile;
- *loadHandle = (Tcl_LoadHandle)handle;
+ *loadHandle = (Tcl_LoadHandle) handle;
return TCL_OK;
}
@@ -118,11 +118,11 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
*----------------------------------------------------------------------
*/
-Tcl_PackageInitProc*
-TclpFindSymbol(interp, loadHandle, symbol)
- Tcl_Interp *interp; /* Place to put error messages. */
- Tcl_LoadHandle loadHandle; /* Value from TcpDlopen(). */
- CONST char *symbol; /* Symbol to look up. */
+Tcl_PackageInitProc *
+TclpFindSymbol(
+ Tcl_Interp *interp, /* Place to put error messages. */
+ Tcl_LoadHandle loadHandle, /* Value from TcpDlopen(). */
+ CONST char *symbol) /* Symbol to look up. */
{
CONST char *native;
Tcl_DString newName, ds;
@@ -142,7 +142,7 @@ TclpFindSymbol(interp, loadHandle, symbol)
Tcl_DStringInit(&newName);
Tcl_DStringAppend(&newName, "_", 1);
native = Tcl_DStringAppend(&newName, native, -1);
- proc = (Tcl_PackageInitProc *) dlsym(handle, /* INTL: Native. */
+ proc = (Tcl_PackageInitProc *) dlsym(handle, /* INTL: Native. */
native);
Tcl_DStringFree(&newName);
}
@@ -170,14 +170,14 @@ TclpFindSymbol(interp, loadHandle, symbol)
*/
void
-TclpUnloadFile(loadHandle)
- Tcl_LoadHandle loadHandle; /* loadHandle returned by a previous call to
+TclpUnloadFile(
+ Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to
* TclpDlopen(). The loadHandle is a token
* that represents the loaded file. */
{
- VOID *handle;
+ void *handle;
- handle = (VOID *) loadHandle;
+ handle = (void *) loadHandle;
dlclose(handle);
}
@@ -202,10 +202,10 @@ TclpUnloadFile(loadHandle)
*/
int
-TclGuessPackageName(fileName, bufPtr)
- CONST char *fileName; /* Name of file containing package (already
+TclGuessPackageName(
+ CONST char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
- Tcl_DString *bufPtr; /* Initialized empty dstring. Append package
+ Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
return 0;
diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c
index 3c1fc82..b963e43 100644
--- a/unix/tclLoadDyld.c
+++ b/unix/tclLoadDyld.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoadDyld.c,v 1.19 2005/07/30 07:57:48 das Exp $
+ * RCS: @(#) $Id: tclLoadDyld.c,v 1.20 2005/11/11 23:46:34 dkf Exp $
*/
#include "tclInt.h"
@@ -93,14 +93,14 @@ DyldOFIErrorMsg(int err) {
*/
MODULE_SCOPE int
-TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Obj *pathPtr; /* Name of the file containing the desired
+TclpDlopen(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Obj *pathPtr, /* Name of the file containing the desired
* code (UTF-8). */
- Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
+ Tcl_LoadHandle *loadHandle, /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
- Tcl_FSUnloadFileProc **unloadProcPtr;
+ Tcl_FSUnloadFileProc **unloadProcPtr)
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for this
* file. */
@@ -146,7 +146,8 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
if (!dyldLibHeader) {
NSLinkEditError(&editError, &errorNumber, &name, &msg);
}
- } else if ((editError==NSLinkEditFileFormatError && errorNumber==EBADMACHO)
+ } else if ((editError==NSLinkEditFileFormatError
+ && errorNumber==EBADMACHO)
|| editError == NSLinkEditOtherError){
/*
* The requested file was found but was not of type MH_DYLIB,
@@ -159,14 +160,14 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
}
if (!dyldLibHeader && !dyldObjFileImage) {
- Tcl_AppendResult(interp, msg, (char *) NULL);
+ Tcl_AppendResult(interp, msg, NULL);
if (msg && *msg) {
- Tcl_AppendResult(interp, "\n", (char *) NULL);
+ Tcl_AppendResult(interp, "\n", NULL);
}
if (objFileImageErrMsg) {
Tcl_AppendResult(interp,
"NSCreateObjectFileImageFromFile() error: ",
- objFileImageErrMsg, (char *) NULL);
+ objFileImageErrMsg, NULL);
}
return TCL_ERROR;
}
@@ -186,7 +187,7 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
CONST char *name, *msg;
NSLinkEditError(&editError, &errorNumber, &name, &msg);
- Tcl_AppendResult(interp, msg, (char *) NULL);
+ Tcl_AppendResult(interp, msg, NULL);
return TCL_ERROR;
}
@@ -221,16 +222,16 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
*----------------------------------------------------------------------
*/
-MODULE_SCOPE Tcl_PackageInitProc*
-TclpFindSymbol(interp, loadHandle, symbol)
- Tcl_Interp *interp; /* For error reporting. */
- Tcl_LoadHandle loadHandle; /* Handle from TclpDlopen. */
- CONST char *symbol; /* Symbol name to look up. */
+MODULE_SCOPE Tcl_PackageInitProc *
+TclpFindSymbol(
+ Tcl_Interp *interp, /* For error reporting. */
+ Tcl_LoadHandle loadHandle, /* Handle from TclpDlopen. */
+ CONST char *symbol) /* Symbol name to look up. */
{
NSSymbol nsSymbol;
CONST char *native;
Tcl_DString newName, ds;
- Tcl_PackageInitProc* proc = NULL;
+ Tcl_PackageInitProc *proc = NULL;
Tcl_DyldLoadHandle *dyldLoadHandle = (Tcl_DyldLoadHandle *) loadHandle;
/*
@@ -277,7 +278,7 @@ TclpFindSymbol(interp, loadHandle, symbol)
CONST char *name, *msg;
NSLinkEditError(&editError, &errorNumber, &name, &msg);
- Tcl_AppendResult(interp, msg, (char *) NULL);
+ Tcl_AppendResult(interp, msg, NULL);
}
} else {
nsSymbol = NSLookupSymbolInModule(dyldLoadHandle->modulePtr->module,
@@ -313,8 +314,8 @@ TclpFindSymbol(interp, loadHandle, symbol)
*/
MODULE_SCOPE void
-TclpUnloadFile(loadHandle)
- Tcl_LoadHandle loadHandle; /* loadHandle returned by a previous call to
+TclpUnloadFile(
+ Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to
* TclpDlopen(). The loadHandle is a token
* that represents the loaded file. */
{
@@ -354,10 +355,10 @@ TclpUnloadFile(loadHandle)
*/
MODULE_SCOPE int
-TclGuessPackageName(fileName, bufPtr)
- CONST char *fileName; /* Name of file containing package (already
+TclGuessPackageName(
+ CONST char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
- Tcl_DString *bufPtr; /* Initialized empty dstring. Append package
+ Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
return 0;
@@ -380,10 +381,10 @@ TclGuessPackageName(fileName, bufPtr)
*----------------------------------------------------------------------
*/
-MODULE_SCOPE void*
-TclpLoadMemoryGetBuffer(interp, size)
- Tcl_Interp *interp; /* Used for error reporting. */
- int size; /* Size of desired buffer. */
+MODULE_SCOPE void *
+TclpLoadMemoryGetBuffer(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ int size) /* Size of desired buffer. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
void *buffer = NULL;
@@ -434,18 +435,18 @@ TclpLoadMemoryGetBuffer(interp, size)
*/
MODULE_SCOPE int
-TclpLoadMemory(interp, buffer, size, codeSize, loadHandle, unloadProcPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- void *buffer; /* Buffer containing the desired code
+TclpLoadMemory(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ void *buffer, /* Buffer containing the desired code
* (allocated with TclpLoadMemoryGetBuffer). */
- int size; /* Allocation size of buffer. */
- int codeSize; /* Size of code data read into buffer or -1 if
+ int size, /* Allocation size of buffer. */
+ int codeSize, /* Size of code data read into buffer or -1 if
* an error occurred and the buffer should
* just be freed. */
- Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
+ Tcl_LoadHandle *loadHandle, /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
- Tcl_FSUnloadFileProc **unloadProcPtr;
+ Tcl_FSUnloadFileProc **unloadProcPtr)
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for this
* file. */
@@ -490,7 +491,7 @@ TclpLoadMemory(interp, buffer, size, codeSize, loadHandle, unloadProcPtr)
if (objFileImageErrMsg != NULL) {
Tcl_AppendResult(interp,
"NSCreateObjectFileImageFromFile() error: ",
- objFileImageErrMsg, (char *) NULL);
+ objFileImageErrMsg, NULL);
}
return TCL_ERROR;
}
@@ -509,7 +510,7 @@ TclpLoadMemory(interp, buffer, size, codeSize, loadHandle, unloadProcPtr)
CONST char *name, *msg;
NSLinkEditError(&editError, &errorNumber, &name, &msg);
- Tcl_AppendResult(interp, msg, (char *) NULL);
+ Tcl_AppendResult(interp, msg, NULL);
return TCL_ERROR;
}
diff --git a/unix/tclLoadNext.c b/unix/tclLoadNext.c
index 6a9ae7e..48c7c98 100644
--- a/unix/tclLoadNext.c
+++ b/unix/tclLoadNext.c
@@ -2,14 +2,14 @@
* tclLoadNext.c --
*
* This procedure provides a version of the TclLoadFile that works with
- * NeXTs rld_* dynamic loading. This file provided by Pedja Bogdanovich.
+ * NeXTs rld_* dynamic loading. This file provided by Pedja Bogdanovich.
*
* 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: tclLoadNext.c,v 1.12 2005/07/19 13:37:19 dkf Exp $
+ * RCS: @(#) $Id: tclLoadNext.c,v 1.13 2005/11/11 23:46:34 dkf Exp $
*/
#include "tclInt.h"
@@ -35,14 +35,14 @@
*/
int
-TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Obj *pathPtr; /* Name of the file containing the desired
+TclpDlopen(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Obj *pathPtr, /* Name of the file containing the desired
* code (UTF-8). */
- Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
+ Tcl_LoadHandle *loadHandle, /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
- Tcl_FSUnloadFileProc **unloadProcPtr;
+ Tcl_FSUnloadFileProc **unloadProcPtr)
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for this
* file. */
@@ -58,7 +58,7 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
fileName = Tcl_GetString(pathPtr);
/*
- * First try the full path the user gave us. This is particularly
+ * First try the full path the user gave us. This is particularly
* important if the cwd is inside a vfs, and we are trying to load using a
* relative path.
*/
@@ -111,25 +111,25 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
*
* Results:
* Returns a pointer to the function associated with 'symbol' if it is
- * found. Otherwise returns NULL and may leave an error message in the
+ * found. Otherwise returns NULL and may leave an error message in the
* interp's result.
*
*----------------------------------------------------------------------
*/
-Tcl_PackageInitProc*
-TclpFindSymbol(interp, loadHandle, symbol)
- Tcl_Interp *interp;
- Tcl_LoadHandle loadHandle;
- CONST char *symbol;
+Tcl_PackageInitProc *
+TclpFindSymbol(
+ Tcl_Interp *interp,
+ Tcl_LoadHandle loadHandle,
+ CONST char *symbol)
{
- Tcl_PackageInitProc *proc=NULL;
+ Tcl_PackageInitProc *proc = NULL;
if (symbol) {
- char sym[strlen(symbol)+2];
+ char sym[strlen(symbol) + 2];
sym[0] = '_';
sym[1] = 0;
- strcat(sym,symbol);
+ strcat(sym, symbol);
rld_lookup(NULL, sym, (unsigned long *)&proc);
}
return proc;
@@ -140,7 +140,7 @@ TclpFindSymbol(interp, loadHandle, symbol)
*
* TclpUnloadFile --
*
- * Unloads a dynamically loaded binary code file from memory. Code
+ * Unloads a dynamically loaded binary code file from memory. Code
* pointers in the formerly loaded file are no longer valid after calling
* this function.
*
@@ -154,9 +154,9 @@ TclpFindSymbol(interp, loadHandle, symbol)
*/
void
-TclpUnloadFile(loadHandle)
- Tcl_LoadHandle loadHandle; /* loadHandle returned by a previous call to
- * TclpDlopen(). The loadHandle is a token
+TclpUnloadFile(
+ Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to
+ * TclpDlopen(). The loadHandle is a token
* that represents the loaded file. */
{
}
@@ -172,7 +172,7 @@ TclpUnloadFile(loadHandle)
* Results:
* Always returns 0 to indicate that we couldn't figure out a package
* name; generic code will then try to guess the package from the file
- * name. A return value of 1 would have meant that we figured out the
+ * name. A return value of 1 would have meant that we figured out the
* package name and put it in bufPtr.
*
* Side effects:
@@ -182,10 +182,10 @@ TclpUnloadFile(loadHandle)
*/
int
-TclGuessPackageName(fileName, bufPtr)
- CONST char *fileName; /* Name of file containing package (already
+TclGuessPackageName(
+ CONST char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
- Tcl_DString *bufPtr; /* Initialized empty dstring. Append package
+ Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
return 0;
diff --git a/unix/tclLoadOSF.c b/unix/tclLoadOSF.c
index c27a4e2..c0f67eb 100644
--- a/unix/tclLoadOSF.c
+++ b/unix/tclLoadOSF.c
@@ -1,10 +1,10 @@
/*
* tclLoadOSF.c --
*
- * This procedure provides a version of the TclLoadFile that works under
+ * This function provides a version of the TclLoadFile that works under
* OSF/1 1.0/1.1/1.2 and related systems, utilizing the old OSF/1
- * /sbin/loader and /usr/include/loader.h. OSF/1 versions from 1.3 and
- * on use ELF, rtld, and dlopen()[/usr/include/ldfcn.h].
+ * /sbin/loader and /usr/include/loader.h. OSF/1 versions from 1.3 and on
+ * use ELF, rtld, and dlopen()[/usr/include/ldfcn.h].
*
* This is useful for:
* OSF/1 1.0, 1.1, 1.2 (from OSF)
@@ -31,7 +31,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoadOSF.c,v 1.12 2005/07/19 13:37:19 dkf Exp $
+ * RCS: @(#) $Id: tclLoadOSF.c,v 1.13 2005/11/11 23:46:34 dkf Exp $
*/
#include "tclInt.h"
@@ -57,14 +57,14 @@
*/
int
-TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Obj *pathPtr; /* Name of the file containing the desired
+TclpDlopen(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Obj *pathPtr, /* Name of the file containing the desired
* code (UTF-8). */
- Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
+ Tcl_LoadHandle *loadHandle, /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
- Tcl_FSUnloadFileProc **unloadProcPtr;
+ Tcl_FSUnloadFileProc **unloadProcPtr)
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for this
* file. */
@@ -99,7 +99,7 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
if (lm == LDR_NULL_MODULE) {
Tcl_AppendResult(interp, "couldn't load file \"", fileName, "\": ",
- Tcl_PosixError (interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
@@ -139,11 +139,12 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
*
*----------------------------------------------------------------------
*/
-Tcl_PackageInitProc*
-TclpFindSymbol(interp, loadHandle, symbol)
- Tcl_Interp *interp;
- Tcl_LoadHandle loadHandle;
- CONST char *symbol;
+
+Tcl_PackageInitProc *
+TclpFindSymbol(
+ Tcl_Interp *interp,
+ Tcl_LoadHandle loadHandle,
+ CONST char *symbol)
{
return ldr_lookup_package((char *)loadHandle, symbol);
}
@@ -153,7 +154,7 @@ TclpFindSymbol(interp, loadHandle, symbol)
*
* TclpUnloadFile --
*
- * Unloads a dynamically loaded binary code file from memory. Code
+ * Unloads a dynamically loaded binary code file from memory. Code
* pointers in the formerly loaded file are no longer valid after calling
* this function.
*
@@ -167,9 +168,9 @@ TclpFindSymbol(interp, loadHandle, symbol)
*/
void
-TclpUnloadFile(loadHandle)
- Tcl_LoadHandle loadHandle; /* loadHandle returned by a previous call to
- * TclpDlopen(). The loadHandle is a token
+TclpUnloadFile(
+ Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to
+ * TclpDlopen(). The loadHandle is a token
* that represents the loaded file. */
{
}
@@ -180,7 +181,7 @@ TclpUnloadFile(loadHandle)
* TclGuessPackageName --
*
* If the "load" command is invoked without providing a package name,
- * this procedure is invoked to try to figure it out.
+ * this function is invoked to try to figure it out.
*
* Results:
* Always returns 0 to indicate that we couldn't figure out a package
@@ -195,10 +196,10 @@ TclpUnloadFile(loadHandle)
*/
int
-TclGuessPackageName(fileName, bufPtr)
- CONST char *fileName; /* Name of file containing package (already
+TclGuessPackageName(
+ CONST char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
- Tcl_DString *bufPtr; /* Initialized empty dstring. Append package
+ Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
return 0;
diff --git a/unix/tclLoadShl.c b/unix/tclLoadShl.c
index e8c4d32..80ef7b5 100644
--- a/unix/tclLoadShl.c
+++ b/unix/tclLoadShl.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoadShl.c,v 1.15 2005/10/05 04:23:28 hobbs Exp $
+ * RCS: @(#) $Id: tclLoadShl.c,v 1.16 2005/11/11 23:46:34 dkf Exp $
*/
#include <dl.h>
@@ -44,14 +44,14 @@
*/
int
-TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Obj *pathPtr; /* Name of the file containing the desired
+TclpDlopen(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Obj *pathPtr, /* Name of the file containing the desired
* code (UTF-8). */
- Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
+ Tcl_LoadHandle *loadHandle, /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
- Tcl_FSUnloadFileProc **unloadProcPtr;
+ Tcl_FSUnloadFileProc **unloadProcPtr)
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for this
* file. */
@@ -117,14 +117,15 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
*
*----------------------------------------------------------------------
*/
-Tcl_PackageInitProc*
-TclpFindSymbol(interp, loadHandle, symbol)
- Tcl_Interp *interp;
- Tcl_LoadHandle loadHandle;
- CONST char *symbol;
+
+Tcl_PackageInitProc *
+TclpFindSymbol(
+ Tcl_Interp *interp,
+ Tcl_LoadHandle loadHandle,
+ CONST char *symbol)
{
Tcl_DString newName;
- Tcl_PackageInitProc *proc=NULL;
+ Tcl_PackageInitProc *proc = NULL;
shl_t handle = (shl_t)loadHandle;
/*
@@ -165,9 +166,9 @@ TclpFindSymbol(interp, loadHandle, symbol)
*/
void
-TclpUnloadFile(loadHandle)
- Tcl_LoadHandle loadHandle; /* loadHandle returned by a previous call to
- * TclpDlopen(). The loadHandle is a token
+TclpUnloadFile(
+ Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to
+ * TclpDlopen(). The loadHandle is a token
* that represents the loaded file. */
{
shl_t handle;
@@ -187,7 +188,7 @@ TclpUnloadFile(loadHandle)
* Results:
* Always returns 0 to indicate that we couldn't figure out a package
* name; generic code will then try to guess the package from the file
- * name. A return value of 1 would have meant that we figured out the
+ * name. A return value of 1 would have meant that we figured out the
* package name and put it in bufPtr.
*
* Side effects:
@@ -197,10 +198,10 @@ TclpUnloadFile(loadHandle)
*/
int
-TclGuessPackageName(fileName, bufPtr)
- CONST char *fileName; /* Name of file containing package (already
+TclGuessPackageName(
+ CONST char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
- Tcl_DString *bufPtr; /* Initialized empty dstring. Append package
+ Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
return 0;
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 111d9f3..364bd54 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixChan.c,v 1.62 2005/10/21 17:05:43 dgp Exp $
+ * RCS: @(#) $Id: tclUnixChan.c,v 1.63 2005/11/11 23:46:34 dkf Exp $
*/
#include "tclInt.h" /* Internal definitions for Tcl. */
@@ -1801,11 +1801,11 @@ TclpOpenFileChannel(
fd = TclOSopen(native, mode, permissions);
#ifdef SUPPORTS_TTY
- ctl_tty = (strcmp (native, "/dev/tty") == 0);
+ ctl_tty = (strcmp(native, "/dev/tty") == 0);
#endif /* SUPPORTS_TTY */
if (fd < 0) {
- if (interp != (Tcl_Interp *) NULL) {
+ if (interp != NULL) {
Tcl_AppendResult(interp, "couldn't open \"",
TclGetString(pathPtr), "\": ", Tcl_PosixError(interp),
NULL);
@@ -2636,7 +2636,7 @@ CreateSocketAddress(
struct hostent *hostent; /* Host database entry */
struct in_addr addr; /* For 64/32 bit madness */
- (void) memset((VOID *) sockaddrPtr, '\0', sizeof(struct sockaddr_in));
+ (void) memset((void *) sockaddrPtr, '\0', sizeof(struct sockaddr_in));
sockaddrPtr->sin_family = AF_INET;
sockaddrPtr->sin_port = htons((unsigned short) (port & 0xFFFF));
if (host == NULL) {
@@ -2658,8 +2658,8 @@ CreateSocketAddress(
if (addr.s_addr == 0xFFFFFFFF) {
hostent = gethostbyname(native); /* INTL: Native. */
if (hostent != NULL) {
- memcpy((VOID *) &addr,
- (VOID *) hostent->h_addr_list[0],
+ memcpy((void *) &addr,
+ (void *) hostent->h_addr_list[0],
(size_t) hostent->h_length);
} else {
#ifdef EHOSTUNREACH
@@ -3188,7 +3188,7 @@ TclUnixWaitForFile(
if (fd >= FD_SETSIZE) {
Tcl_Panic("TclWaitForFile can't handle file id %d", fd);
}
- memset((VOID *) readyMasks, 0, 3*MASK_SIZE*sizeof(fd_mask));
+ memset((void *) readyMasks, 0, 3*MASK_SIZE*sizeof(fd_mask));
index = fd/(NBBY*sizeof(fd_mask));
bit = 1 << (fd%(NBBY*sizeof(fd_mask)));
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 39ab6bf..9dbe08c 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixFile.c,v 1.46 2005/08/31 15:12:18 vincentdarley Exp $
+ * RCS: @(#) $Id: tclUnixFile.c,v 1.47 2005/11/11 23:46:36 dkf Exp $
*/
#include "tclInt.h"
@@ -35,8 +35,8 @@ static int NativeMatchType(CONST char* nativeName, Tcl_GlobTypeData *types);
*/
void
-TclpFindExecutable(argv0)
- CONST char *argv0; /* The value of the application's argv[0]
+TclpFindExecutable(
+ CONST char *argv0) /* The value of the application's argv[0]
* (native). */
{
CONST char *name, *p;
@@ -197,12 +197,12 @@ TclpFindExecutable(argv0)
*/
int
-TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types)
- Tcl_Interp *interp; /* Interpreter to receive errors. */
- Tcl_Obj *resultPtr; /* List object to lappend results. */
- Tcl_Obj *pathPtr; /* Contains path to directory to search. */
- CONST char *pattern; /* Pattern to match against. */
- Tcl_GlobTypeData *types; /* Object containing list of acceptable types.
+TclpMatchInDirectory(
+ Tcl_Interp *interp, /* Interpreter to receive errors. */
+ Tcl_Obj *resultPtr, /* List object to lappend results. */
+ Tcl_Obj *pathPtr, /* Contains path to directory to search. */
+ CONST char *pattern, /* Pattern to match against. */
+ Tcl_GlobTypeData *types) /* Object containing list of acceptable types.
* May be NULL. In particular the directory
* flag is very important. */
{
@@ -358,7 +358,7 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types)
static int
NativeMatchType(
- CONST char* nativeEntry, /* Native path to check. */
+ CONST char *nativeEntry, /* Native path to check. */
Tcl_GlobTypeData *types) /* Type description to match against. */
{
Tcl_StatBuf buf;
@@ -488,9 +488,9 @@ NativeMatchType(
*/
char *
-TclpGetUserHome(name, bufferPtr)
- CONST char *name; /* User name for desired home directory. */
- Tcl_DString *bufferPtr; /* Uninitialized or free DString filled with
+TclpGetUserHome(
+ CONST char *name, /* User name for desired home directory. */
+ Tcl_DString *bufferPtr) /* Uninitialized or free DString filled with
* name of user's home directory. */
{
struct passwd *pwPtr;
@@ -527,9 +527,9 @@ TclpGetUserHome(name, bufferPtr)
*/
int
-TclpObjAccess(pathPtr, mode)
- Tcl_Obj *pathPtr; /* Path of file to access */
- int mode; /* Permission setting. */
+TclpObjAccess(
+ Tcl_Obj *pathPtr, /* Path of file to access */
+ int mode) /* Permission setting. */
{
CONST char *path = Tcl_FSGetNativePath(pathPtr);
if (path == NULL) {
@@ -556,8 +556,8 @@ TclpObjAccess(pathPtr, mode)
*/
int
-TclpObjChdir(pathPtr)
- Tcl_Obj *pathPtr; /* Path to new working directory */
+TclpObjChdir(
+ Tcl_Obj *pathPtr) /* Path to new working directory */
{
CONST char *path = Tcl_FSGetNativePath(pathPtr);
if (path == NULL) {
@@ -584,9 +584,9 @@ TclpObjChdir(pathPtr)
*/
int
-TclpObjLstat(pathPtr, bufPtr)
- Tcl_Obj *pathPtr; /* Path of file to stat */
- Tcl_StatBuf *bufPtr; /* Filled with results of stat call. */
+TclpObjLstat(
+ Tcl_Obj *pathPtr, /* Path of file to stat */
+ Tcl_StatBuf *bufPtr) /* Filled with results of stat call. */
{
return TclOSlstat(Tcl_FSGetNativePath(pathPtr), bufPtr);
}
@@ -613,8 +613,8 @@ TclpObjLstat(pathPtr, bufPtr)
*/
ClientData
-TclpGetNativeCwd(clientData)
- ClientData clientData;
+TclpGetNativeCwd(
+ ClientData clientData)
{
char buffer[MAXPATHLEN+1];
@@ -662,9 +662,9 @@ TclpGetNativeCwd(clientData)
*/
CONST char *
-TclpGetCwd(interp, bufferPtr)
- Tcl_Interp *interp; /* If non-NULL, used for error reporting. */
- Tcl_DString *bufferPtr; /* Uninitialized or free DString filled with
+TclpGetCwd(
+ Tcl_Interp *interp, /* If non-NULL, used for error reporting. */
+ Tcl_DString *bufferPtr) /* Uninitialized or free DString filled with
* name of current directory. */
{
char buffer[MAXPATHLEN+1];
@@ -678,7 +678,7 @@ TclpGetCwd(interp, bufferPtr)
if (interp != NULL) {
Tcl_AppendResult(interp,
"error getting working directory name: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
}
return NULL;
}
@@ -706,9 +706,9 @@ TclpGetCwd(interp, bufferPtr)
*/
char *
-TclpReadlink(path, linkPtr)
- CONST char *path; /* Path of file to readlink (UTF-8). */
- Tcl_DString *linkPtr; /* Uninitialized or free DString filled with
+TclpReadlink(
+ CONST char *path, /* Path of file to readlink (UTF-8). */
+ Tcl_DString *linkPtr) /* Uninitialized or free DString filled with
* contents of link (UTF-8). */
{
#ifndef DJGPP
@@ -749,9 +749,9 @@ TclpReadlink(path, linkPtr)
*/
int
-TclpObjStat(pathPtr, bufPtr)
- Tcl_Obj *pathPtr; /* Path of file to stat */
- Tcl_StatBuf *bufPtr; /* Filled with results of stat call. */
+TclpObjStat(
+ Tcl_Obj *pathPtr, /* Path of file to stat */
+ Tcl_StatBuf *bufPtr) /* Filled with results of stat call. */
{
CONST char *path = Tcl_FSGetNativePath(pathPtr);
if (path == NULL) {
@@ -764,15 +764,18 @@ TclpObjStat(pathPtr, bufPtr)
#ifdef S_IFLNK
Tcl_Obj*
-TclpObjLink(pathPtr, toPtr, linkAction)
- Tcl_Obj *pathPtr;
- Tcl_Obj *toPtr;
- int linkAction;
+TclpObjLink(
+ Tcl_Obj *pathPtr,
+ Tcl_Obj *toPtr,
+ int linkAction)
{
if (toPtr != NULL) {
CONST char *src = Tcl_FSGetNativePath(pathPtr);
CONST char *target = NULL;
- if (src == NULL) return NULL;
+
+ if (src == NULL) {
+ return NULL;
+ }
/*
* If we're making a symbolic link and the path is relative, then we
@@ -873,7 +876,7 @@ TclpObjLink(pathPtr, toPtr, linkAction)
}
return toPtr;
} else {
- Tcl_Obj* linkPtr = NULL;
+ Tcl_Obj *linkPtr = NULL;
char link[MAXPATHLEN];
int length;
@@ -922,9 +925,9 @@ TclpObjLink(pathPtr, toPtr, linkAction)
*---------------------------------------------------------------------------
*/
-Tcl_Obj*
-TclpFilesystemPathType(pathPtr)
- Tcl_Obj* pathPtr;
+Tcl_Obj *
+TclpFilesystemPathType(
+ Tcl_Obj *pathPtr)
{
/*
* All native paths are of the same type.
@@ -954,9 +957,9 @@ TclpFilesystemPathType(pathPtr)
*---------------------------------------------------------------------------
*/
-Tcl_Obj*
-TclpNativeToNormalized(clientData)
- ClientData clientData;
+Tcl_Obj *
+TclpNativeToNormalized(
+ ClientData clientData)
{
Tcl_DString ds;
Tcl_Obj *objPtr;
@@ -985,18 +988,18 @@ TclpNativeToNormalized(clientData)
* The nativePath representation.
*
* Side effects:
- * Memory will be allocated. The path may need to be normalized.
+ * Memory will be allocated. The path may need to be normalized.
*
*---------------------------------------------------------------------------
*/
ClientData
-TclNativeCreateNativeRep(pathPtr)
- Tcl_Obj* pathPtr;
+TclNativeCreateNativeRep(
+ Tcl_Obj *pathPtr)
{
char *nativePathPtr;
Tcl_DString ds;
- Tcl_Obj* validPathPtr;
+ Tcl_Obj *validPathPtr;
int len;
char *str;
@@ -1022,7 +1025,7 @@ TclNativeCreateNativeRep(pathPtr)
len = Tcl_DStringLength(&ds) + sizeof(char);
Tcl_DecrRefCount(validPathPtr);
nativePathPtr = ckalloc((unsigned) len);
- memcpy((VOID*)nativePathPtr, (VOID*)Tcl_DStringValue(&ds), (size_t) len);
+ memcpy((void*)nativePathPtr, (void*)Tcl_DStringValue(&ds), (size_t) len);
Tcl_DStringFree(&ds);
return (ClientData)nativePathPtr;
@@ -1046,8 +1049,8 @@ TclNativeCreateNativeRep(pathPtr)
*/
ClientData
-TclNativeDupInternalRep(clientData)
- ClientData clientData;
+TclNativeDupInternalRep(
+ ClientData clientData)
{
char *copy;
size_t len;
@@ -1063,7 +1066,7 @@ TclNativeDupInternalRep(clientData)
len = sizeof(char) + (strlen((CONST char*) clientData) * sizeof(char));
copy = (char *) ckalloc(len);
- memcpy((VOID *) copy, (VOID *) clientData, len);
+ memcpy((void *) copy, (void *) clientData, len);
return (ClientData)copy;
}
@@ -1084,9 +1087,9 @@ TclNativeDupInternalRep(clientData)
*/
int
-TclpUtime(pathPtr, tval)
- Tcl_Obj *pathPtr; /* File to modify */
- struct utimbuf *tval; /* New modification date structure */
+TclpUtime(
+ Tcl_Obj *pathPtr, /* File to modify */
+ struct utimbuf *tval) /* New modification date structure */
{
return utime(Tcl_FSGetNativePath(pathPtr), tval);
}
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index 3afbf55..235ab92 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -1,14 +1,14 @@
-/*
+/*
* tclUnixSock.c --
*
* This file contains Unix-specific socket related code.
*
* Copyright (c) 1995 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: tclUnixSock.c,v 1.13 2005/09/02 19:23:46 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclUnixSock.c,v 1.14 2005/11/11 23:46:36 dkf Exp $
*/
#include "tclInt.h"
@@ -17,7 +17,7 @@
* The following variable holds the network name of this host.
*/
-static TclInitProcessGlobalValueProc InitializeHostName;
+static TclInitProcessGlobalValueProc InitializeHostName;
static ProcessGlobalValue hostName =
{0, 0, NULL, NULL, InitializeHostName, NULL, NULL};
@@ -27,8 +27,8 @@ static ProcessGlobalValue hostName =
*
* InitializeHostName --
*
- * This routine sets the process global value of the name of
- * the local host on which the process is running.
+ * This routine sets the process global value of the name of the local
+ * host on which the process is running.
*
* Results:
* None.
@@ -37,28 +37,32 @@ static ProcessGlobalValue hostName =
*/
static void
-InitializeHostName(valuePtr, lengthPtr, encodingPtr)
- char **valuePtr;
- int *lengthPtr;
- Tcl_Encoding *encodingPtr;
+InitializeHostName(
+ char **valuePtr,
+ int *lengthPtr,
+ Tcl_Encoding *encodingPtr)
{
CONST char *native = NULL;
#ifndef NO_UNAME
struct utsname u;
struct hostent *hp;
- (VOID *) memset((VOID *) &u, (int) 0, sizeof(struct utsname));
+
+ (void *) memset((void *) &u, (int) 0, sizeof(struct utsname));
if (uname(&u) > -1) { /* INTL: Native. */
hp = gethostbyname(u.nodename); /* INTL: Native. */
if (hp == NULL) {
/*
* Sometimes the nodename is fully qualified, but gets truncated
- * as it exceeds SYS_NMLN. See if we can just get the immediate
+ * as it exceeds SYS_NMLN. See if we can just get the immediate
* nodename and get a proper answer that way.
*/
+
char *dot = strchr(u.nodename, '.');
+
if (dot != NULL) {
char *node = ckalloc((unsigned) (dot - u.nodename + 1));
+
memcpy(node, u.nodename, (size_t) (dot - u.nodename));
node[dot - u.nodename] = '\0';
hp = gethostbyname(node);
@@ -78,18 +82,18 @@ InitializeHostName(valuePtr, lengthPtr, encodingPtr)
/*
* Uname doesn't exist; try gethostname instead.
*
- * There is no portable macro for the maximum length
- * of host names returned by gethostbyname(). We should only
- * trust SYS_NMLN if it is at least 255 + 1 bytes to comply with DNS
- * host name limits.
+ * There is no portable macro for the maximum length of host names
+ * returned by gethostbyname(). We should only trust SYS_NMLN if it is at
+ * least 255 + 1 bytes to comply with DNS host name limits.
*
- * Note: SYS_NMLN is a restriction on "uname" not on gethostbyname!
+ * Note: SYS_NMLN is a restriction on "uname" not on gethostbyname!
*
- * For example HP-UX 10.20 has SYS_NMLN == 9, while gethostbyname()
- * can return a fully qualified name from DNS of up to 255 bytes.
+ * For example HP-UX 10.20 has SYS_NMLN == 9, while gethostbyname() can
+ * return a fully qualified name from DNS of up to 255 bytes.
*
* Fix suggested by Viktor Dukhovni (viktor@esm.com)
*/
+
# if defined(SYS_NMLN) && SYS_NMLEN >= 256
char buffer[SYS_NMLEN];
# else
@@ -104,7 +108,7 @@ InitializeHostName(valuePtr, lengthPtr, encodingPtr)
*encodingPtr = Tcl_GetEncoding(NULL, NULL);
*lengthPtr = strlen(native);
*valuePtr = ckalloc((unsigned int) (*lengthPtr)+1);
- memcpy((VOID *) *valuePtr, (VOID *) native, (size_t)(*lengthPtr)+1);
+ memcpy((void *) *valuePtr, (void *) native, (size_t)(*lengthPtr)+1);
}
/*
@@ -115,9 +119,9 @@ InitializeHostName(valuePtr, lengthPtr, encodingPtr)
* Returns the name of the local host.
*
* Results:
- * A string containing the network name for this machine, or
- * an empty string if we can't figure out the name. The caller
- * must not modify or free this string.
+ * A string containing the network name for this machine, or an empty
+ * string if we can't figure out the name. The caller must not modify or
+ * free this string.
*
* Side effects:
* Caches the name to return for future calls.
@@ -126,7 +130,7 @@ InitializeHostName(valuePtr, lengthPtr, encodingPtr)
*/
CONST char *
-Tcl_GetHostName()
+Tcl_GetHostName(void)
{
return Tcl_GetString(TclGetProcessGlobalValue(&hostName));
}
@@ -148,8 +152,16 @@ Tcl_GetHostName()
*/
int
-TclpHasSockets(interp)
- Tcl_Interp *interp; /* Not used. */
+TclpHasSockets(
+ Tcl_Interp *interp) /* Not used. */
{
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */