summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixFCmd.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-07-31 13:57:15 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-07-31 13:57:15 (GMT)
commit6a2b204a3f4a820947624b6716fe2072302df40e (patch)
tree724f9b4a658671cb5f599f71011491e34385d4ad /unix/tclUnixFCmd.c
parentf74362142bff3aa1a186dc8d58be33ab64ba4c8d (diff)
downloadtcl-6a2b204a3f4a820947624b6716fe2072302df40e.zip
tcl-6a2b204a3f4a820947624b6716fe2072302df40e.tar.gz
tcl-6a2b204a3f4a820947624b6716fe2072302df40e.tar.bz2
Whitespace/format cleanup
Diffstat (limited to 'unix/tclUnixFCmd.c')
-rw-r--r--unix/tclUnixFCmd.c117
1 files changed, 57 insertions, 60 deletions
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index aef6b5b..076a957 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -2,7 +2,7 @@
* tclUnixFCmd.c
*
* This file implements the unix specific portion of file manipulation
- * subcommands of the "file" command. All filename arguments should
+ * subcommands of the "file" command. All filename arguments should
* already be translated to native format.
*
* Copyright (c) 1996-1998 Sun Microsystems, Inc.
@@ -10,13 +10,13 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixFCmd.c,v 1.61 2007/04/23 20:35:55 das Exp $
+ * RCS: @(#) $Id: tclUnixFCmd.c,v 1.62 2007/07/31 13:57:15 dkf Exp $
*
* Portions of this code were derived from NetBSD source code which has the
* following copyright notice:
*
* Copyright (c) 1988, 1993, 1994
- * The Regents of the University of California. All rights reserved.
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -63,7 +63,7 @@
* TraverseUnixTree() calls the traverseProc()
*/
-#define DOTREE_PRED 1 /* pre-order directory */
+#define DOTREE_PRED 1 /* pre-order directory */
#define DOTREE_POSTD 2 /* post-order directory */
#define DOTREE_F 3 /* regular file */
@@ -164,11 +164,11 @@ CONST TclFileAttrProcs tclpFileAttrProcs[] = {
* This is the maximum number of consecutive readdir/unlink calls that can be
* made (with no intervening rewinddir or closedir/opendir) before triggering
* a bug that makes readdir return NULL even though some directory entries
- * have not been processed. The bug afflicts SunOS's readdir when applied to
- * ufs file systems and Darwin 6.5's (and OSX v.10.3.8's) HFS+. JH found the
- * Darwin readdir to reset at 147, so 130 is chosen to be conservative. We
+ * have not been processed. The bug afflicts SunOS's readdir when applied to
+ * ufs file systems and Darwin 6.5's (and OSX v.10.3.8's) HFS+. JH found the
+ * Darwin readdir to reset at 147, so 130 is chosen to be conservative. We
* can't do a general rewind on failure as NFS can create special files that
- * recreate themselves when you try and delete them. 8.4.8 added a solution
+ * recreate themselves when you try and delete them. 8.4.8 added a solution
* that was affected by a single such NFS file, this solution should not be
* affected by less than THRESHOLD such files. [Bug 1034337]
*/
@@ -224,10 +224,11 @@ Realpath(
defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
MAC_OS_X_VERSION_MIN_REQUIRED < 1030
/*
- * prior to Darwin 7, realpath is not threadsafe, c.f. bug 711232;
- * if we might potentially be running on pre-10.3 OSX,
- * check Darwin release at runtime before using realpath.
+ * Prior to Darwin 7, realpath is not thread-safe, c.f. Bug 711232; if we
+ * might potentially be running on pre-10.3 OSX, check Darwin release at
+ * runtime before using realpath.
*/
+
MODULE_SCOPE long tclMacOSXDarwinRelease;
#define haveRealpath (tclMacOSXDarwinRelease >= 7)
#else
@@ -243,25 +244,25 @@ MODULE_SCOPE long tclMacOSXDarwinRelease;
defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
MAC_OS_X_VERSION_MIN_REQUIRED < 1050
/*
- * prior to Darwin 9, 64bit fts_open() without FTS_NOSTAT may crash (due to a
+ * Prior to Darwin 9, 64bit fts_open() without FTS_NOSTAT may crash (due to a
* 64bit-unsafe ALIGN macro); if we could be running on pre-10.5 OSX, check
* Darwin release at runtime and do a separate stat() if necessary.
*/
+
MODULE_SCOPE long tclMacOSXDarwinRelease;
#define noFtsStat (tclMacOSXDarwinRelease < 9)
#else
#define noFtsStat 0
#endif
#endif /* HAVE_FTS */
-
/*
*---------------------------------------------------------------------------
*
* TclpObjRenameFile, DoRenameFile --
*
- * Changes the name of an existing file or directory, from src to dst.
- * If src and dst refer to the same file or directory, does nothing and
+ * Changes the name of an existing file or directory, from src to dst. If
+ * src and dst refer to the same file or directory, does nothing and
* returns success. Otherwise if dst already exists, it will be deleted
* and replaced by src subject to the following conditions:
* If src is a directory, dst may be an empty directory.
@@ -269,7 +270,7 @@ MODULE_SCOPE long tclMacOSXDarwinRelease;
* In any other situation where dst already exists, the rename will fail.
*
* Results:
- * If the directory was successfully created, returns TCL_OK. Otherwise
+ * If the directory was successfully created, returns TCL_OK. Otherwise
* the return value is TCL_ERROR and errno is set to indicate the error.
* Some possible values for errno are:
*
@@ -388,12 +389,12 @@ DoRenameFile(
*
* Results:
* If the file was successfully copied, returns TCL_OK. Otherwise the
- * return value is TCL_ERROR and errno is set to indicate the error.
- * Some possible values for errno are:
+ * return value is TCL_ERROR and errno is set to indicate the error. Some
+ * possible values for errno are:
*
* EACCES: src or dst parent directory can't be read and/or written.
* EISDIR: src or dst is a directory.
- * ENOENT: src doesn't exist. src or dst is "".
+ * ENOENT: src doesn't exist. src or dst is "".
*
* Side effects:
* This procedure will also copy symbolic links, block, and character
@@ -435,7 +436,7 @@ DoCopyFile(
}
/*
- * symlink, and some of the other calls will fail if the target exists, so
+ * Symlink, and some of the other calls will fail if the target exists, so
* we remove it first.
*/
@@ -501,7 +502,7 @@ DoCopyFile(
* A standard Tcl result.
*
* Side effects:
- * A file is copied. Dst will be overwritten if it exists.
+ * A file is copied. Dst will be overwritten if it exists.
*
*----------------------------------------------------------------------
*/
@@ -545,8 +546,7 @@ TclUnixCopyFile(
#ifdef HAVE_ST_BLKSIZE
blockSize = statBufPtr->st_blksize;
-#else
-#ifndef NO_FSTATFS
+#elif !defined(NO_FSTATFS)
{
struct statfs fs;
@@ -558,18 +558,17 @@ TclUnixCopyFile(
}
#else
blockSize = 4096;
-#endif
-#endif
+#endif /* HAVE_ST_BLKSIZE */
- /* [SF Tcl Bug 1586470] Even if we HAVE_ST_BLKSIZE, there are
- * filesystems which report a bogus value for the blocksize. An
- * example is the Andrew Filesystem (afs), reporting a blocksize
- * of 0. When detecting such a situation we now simply fall back
- * to a hardwired default size.
+ /*
+ * [SF Tcl Bug 1586470] Even if we HAVE_ST_BLKSIZE, there are filesystems
+ * which report a bogus value for the blocksize. An example is the Andrew
+ * Filesystem (afs), reporting a blocksize of 0. When detecting such a
+ * situation we now simply fall back to a hardwired default size.
*/
if (blockSize <= 0) {
- blockSize = 4096;
+ blockSize = 4096;
}
buffer = ckalloc(blockSize);
while (1) {
@@ -610,8 +609,8 @@ TclUnixCopyFile(
*
* Results:
* If the file was successfully deleted, returns TCL_OK. Otherwise the
- * return value is TCL_ERROR and errno is set to indicate the error.
- * Some possible values for errno are:
+ * return value is TCL_ERROR and errno is set to indicate the error. Some
+ * possible values for errno are:
*
* EACCES: a parent directory can't be read and/or written.
* EISDIR: path is a directory.
@@ -756,7 +755,6 @@ TclpObjCopyDirectory(
}
return ret;
}
-
/*
*---------------------------------------------------------------------------
@@ -1010,8 +1008,8 @@ TraverseUnixTree(
if (doRewind && (numProcessed > MAX_READDIR_UNLINK_THRESHOLD)) {
/*
* Call rewinddir if we've called unlink or rmdir so many times
- * (since the opendir or the previous rewinddir), to avoid
- * a NULL-return that may a symptom of a buggy readdir.
+ * (since the opendir or the previous rewinddir), to avoid a
+ * NULL-return that may a symptom of a buggy readdir.
*/
rewinddir(dirPtr);
@@ -1041,7 +1039,7 @@ TraverseUnixTree(
#else /* HAVE_FTS */
paths[0] = source;
fts = fts_open((char**)paths, FTS_PHYSICAL | FTS_NOCHDIR |
- (noFtsStat || doRewind ? FTS_NOSTAT : 0), NULL);
+ (noFtsStat || doRewind ? FTS_NOSTAT : 0), NULL);
if (fts == NULL) {
errfile = source;
goto end;
@@ -1068,15 +1066,15 @@ TraverseUnixTree(
Tcl_DStringAppend(targetPtr, path, pathlen);
}
switch (info) {
- case FTS_D:
- type = DOTREE_PRED;
- break;
- case FTS_DP:
- type = DOTREE_POSTD;
- break;
- default:
- type = DOTREE_F;
- break;
+ case FTS_D:
+ type = DOTREE_PRED;
+ break;
+ case FTS_DP:
+ type = DOTREE_POSTD;
+ break;
+ default:
+ type = DOTREE_F;
+ break;
}
if (!doRewind) { /* no need to stat for delete */
if (noFtsStat) {
@@ -1288,7 +1286,6 @@ CopyFileAtts(
#endif
return TCL_OK;
}
-
/*
*----------------------------------------------------------------------
@@ -1311,7 +1308,7 @@ static int
GetGroupAttribute(
Tcl_Interp *interp, /* The interp we are using for errors. */
int objIndex, /* The index of the attribute. */
- Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */
{
Tcl_StatBuf statBuf;
@@ -1366,7 +1363,7 @@ static int
GetOwnerAttribute(
Tcl_Interp *interp, /* The interp we are using for errors. */
int objIndex, /* The index of the attribute. */
- Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */
{
Tcl_StatBuf statBuf;
@@ -1421,7 +1418,7 @@ static int
GetPermissionsAttribute(
Tcl_Interp *interp, /* The interp we are using for errors. */
int objIndex, /* The index of the attribute. */
- Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */
{
Tcl_StatBuf statBuf;
@@ -1560,7 +1557,7 @@ SetOwnerAttribute(
}
native = Tcl_FSGetNativePath(fileName);
- result = chown(native, (uid_t) uid, (gid_t) -1); /* INTL: Native. */
+ result = chown(native, (uid_t) uid, (gid_t) -1); /* INTL: Native. */
if (result != 0) {
if (interp != NULL) {
@@ -1852,13 +1849,13 @@ GetModeFromPermString(
}
}
switch (op) {
- case 1 :
+ case 1:
*modePtr = oldMode | (who & what);
continue;
- case 2 :
+ case 2:
*modePtr = oldMode & ~(who & what);
continue;
- case 3 :
+ case 3:
*modePtr = (oldMode & ~who) | (who & what);
continue;
}
@@ -2018,12 +2015,12 @@ TclpObjNormalizePath(
Tcl_DStringFree(&ds);
/*
- * Enable this to have the native FS claim normalization of the
- * whole path for existing files. That would permit the caller
- * to declare normalization complete without calls to additional
- * filesystems. Saving lots of calls is probably worth the extra
- * access() time here. When no other FS's are registered though,
- * things are less clear.
+ * Enable this to have the native FS claim normalization of
+ * the whole path for existing files. That would permit the
+ * caller to declare normalization complete without calls to
+ * additional filesystems. Saving lots of calls is probably
+ * worth the extra access() time here. When no other FS's are
+ * registered though, things are less clear.
*
if (0 == access(normPath, F_OK)) {
return pathLen;