diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-11-11 23:46:34 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-11-11 23:46:34 (GMT) |
commit | 1a2498d774a65abfc4aa734a107ea67438c8b625 (patch) | |
tree | b3ab0395489143eb6c7a5337a521d3e8cb505875 /unix | |
parent | 2dc0d2ce91e0ef65ce9cbc9c886b63f8e9c26a0c (diff) | |
download | tcl-1a2498d774a65abfc4aa734a107ea67438c8b625.zip tcl-1a2498d774a65abfc4aa734a107ea67438c8b625.tar.gz tcl-1a2498d774a65abfc4aa734a107ea67438c8b625.tar.bz2 |
More bits of ANSIfying
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclLoadAix.c | 34 | ||||
-rw-r--r-- | unix/tclLoadDl.c | 44 | ||||
-rw-r--r-- | unix/tclLoadDyld.c | 73 | ||||
-rw-r--r-- | unix/tclLoadNext.c | 50 | ||||
-rw-r--r-- | unix/tclLoadOSF.c | 47 | ||||
-rw-r--r-- | unix/tclLoadShl.c | 39 | ||||
-rw-r--r-- | unix/tclUnixChan.c | 14 | ||||
-rw-r--r-- | unix/tclUnixFile.c | 115 | ||||
-rw-r--r-- | unix/tclUnixSock.c | 66 |
9 files changed, 253 insertions, 229 deletions
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: + */ |