summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixFCmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tclUnixFCmd.c')
-rw-r--r--unix/tclUnixFCmd.c93
1 files changed, 46 insertions, 47 deletions
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index 41b1003..1f1cf89 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.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: tclUnixFCmd.c,v 1.65 2007/12/13 15:28:42 dgp Exp $
+ * RCS: @(#) $Id: tclUnixFCmd.c,v 1.66 2008/04/27 22:21:34 dkf Exp $
*
* Portions of this code were derived from NetBSD source code which has the
* following copyright notice:
@@ -99,7 +99,7 @@ static int SetReadOnlyAttribute(Tcl_Interp *interp, int objIndex,
*/
typedef int (TraversalProc)(Tcl_DString *srcPtr, Tcl_DString *dstPtr,
- CONST Tcl_StatBuf *statBufPtr, int type, Tcl_DString *errorPtr);
+ const Tcl_StatBuf *statBufPtr, int type, Tcl_DString *errorPtr);
/*
* Constants and variables necessary for file attributes subcommand.
@@ -131,8 +131,8 @@ enum {
UNIX_INVALID_ATTRIBUTE /* lint - last enum value needs no trailing , */
};
-MODULE_SCOPE CONST char *tclpFileAttrStrings[];
-CONST char *tclpFileAttrStrings[] = {
+MODULE_SCOPE const char *tclpFileAttrStrings[];
+const char *tclpFileAttrStrings[] = {
"-group", "-owner", "-permissions",
#if defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE)
"-readonly",
@@ -143,8 +143,8 @@ CONST char *tclpFileAttrStrings[] = {
NULL
};
-MODULE_SCOPE CONST TclFileAttrProcs tclpFileAttrProcs[];
-CONST TclFileAttrProcs tclpFileAttrProcs[] = {
+MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[];
+const TclFileAttrProcs tclpFileAttrProcs[] = {
{GetGroupAttribute, SetGroupAttribute},
{GetOwnerAttribute, SetOwnerAttribute},
{GetPermissionsAttribute, SetPermissionsAttribute},
@@ -179,19 +179,19 @@ CONST TclFileAttrProcs tclpFileAttrProcs[] = {
* Declarations for local procedures defined in this file:
*/
-static int CopyFileAtts(CONST char *src,
- CONST char *dst, CONST Tcl_StatBuf *statBufPtr);
-static int DoCopyFile(CONST char *srcPtr, CONST char *dstPtr,
- CONST Tcl_StatBuf *statBufPtr);
-static int DoCreateDirectory(CONST char *pathPtr);
+static int CopyFileAtts(const char *src,
+ const char *dst, const Tcl_StatBuf *statBufPtr);
+static int DoCopyFile(const char *srcPtr, const char *dstPtr,
+ const Tcl_StatBuf *statBufPtr);
+static int DoCreateDirectory(const char *pathPtr);
static int DoRemoveDirectory(Tcl_DString *pathPtr,
int recursive, Tcl_DString *errorPtr);
-static int DoRenameFile(CONST char *src, CONST char *dst);
+static int DoRenameFile(const char *src, const char *dst);
static int TraversalCopy(Tcl_DString *srcPtr,
- Tcl_DString *dstPtr, CONST Tcl_StatBuf *statBufPtr,
+ Tcl_DString *dstPtr, const Tcl_StatBuf *statBufPtr,
int type, Tcl_DString *errorPtr);
static int TraversalDelete(Tcl_DString *srcPtr,
- Tcl_DString *dstPtr, CONST Tcl_StatBuf *statBufPtr,
+ Tcl_DString *dstPtr, const Tcl_StatBuf *statBufPtr,
int type, Tcl_DString *errorPtr);
static int TraverseUnixTree(TraversalProc *traversalProc,
Tcl_DString *sourcePtr, Tcl_DString *destPtr,
@@ -205,11 +205,11 @@ static int TraverseUnixTree(TraversalProc *traversalProc,
* passing the standard MAXPATHLEN size resolved arg.
*/
-static char * Realpath(CONST char *path, char *resolved);
+static char * Realpath(const char *path, char *resolved);
char *
Realpath(
- CONST char *path,
+ const char *path,
char *resolved)
{
memset(resolved, 0, MAXPATHLEN);
@@ -301,9 +301,9 @@ TclpObjRenameFile(
static int
DoRenameFile(
- CONST char *src, /* Pathname of file or dir to be renamed
+ const char *src, /* Pathname of file or dir to be renamed
* (native). */
- CONST char *dst) /* New pathname of file or directory
+ const char *dst) /* New pathname of file or directory
* (native). */
{
if (rename(src, dst) == 0) { /* INTL: Native. */
@@ -411,7 +411,7 @@ TclpObjCopyFile(
Tcl_Obj *srcPathPtr,
Tcl_Obj *destPathPtr)
{
- CONST char *src = Tcl_FSGetNativePath(srcPathPtr);
+ const char *src = Tcl_FSGetNativePath(srcPathPtr);
Tcl_StatBuf srcStatBuf;
if (TclOSlstat(src, &srcStatBuf) != 0) { /* INTL: Native. */
@@ -423,9 +423,9 @@ TclpObjCopyFile(
static int
DoCopyFile(
- CONST char *src, /* Pathname of file to be copied (native). */
- CONST char *dst, /* Pathname of file to copy to (native). */
- CONST Tcl_StatBuf *statBufPtr)
+ const char *src, /* Pathname of file to be copied (native). */
+ const char *dst, /* Pathname of file to copy to (native). */
+ const Tcl_StatBuf *statBufPtr)
/* Used to determine filetype. */
{
Tcl_StatBuf dstStatBuf;
@@ -509,10 +509,10 @@ DoCopyFile(
int
TclUnixCopyFile(
- CONST char *src, /* Pathname of file to copy (native). */
- CONST char *dst, /* Pathname of file to create/overwrite
+ const char *src, /* Pathname of file to copy (native). */
+ const char *dst, /* Pathname of file to create/overwrite
* (native). */
- CONST Tcl_StatBuf *statBufPtr,
+ const Tcl_StatBuf *statBufPtr,
/* Used to determine mode and blocksize. */
int dontCopyAtts) /* If flag set, don't copy attributes. */
{
@@ -631,7 +631,7 @@ TclpObjDeleteFile(
int
TclpDeleteFile(
- CONST char *path) /* Pathname of file to be removed (native). */
+ const char *path) /* Pathname of file to be removed (native). */
{
if (unlink(path) != 0) { /* INTL: Native. */
return TCL_ERROR;
@@ -674,7 +674,7 @@ TclpObjCreateDirectory(
static int
DoCreateDirectory(
- CONST char *path) /* Pathname of directory to create (native). */
+ const char *path) /* Pathname of directory to create (native). */
{
mode_t mode;
@@ -821,7 +821,7 @@ DoRemoveDirectory(
* filled with UTF-8 name of file causing
* error. */
{
- CONST char *path;
+ const char *path;
mode_t oldPerm = 0;
int result;
@@ -919,7 +919,7 @@ TraverseUnixTree(
* files. */
{
Tcl_StatBuf statBuf;
- CONST char *source, *errfile;
+ const char *source, *errfile;
int result, sourceLen;
int targetLen;
#ifndef HAVE_FTS
@@ -927,7 +927,7 @@ TraverseUnixTree(
Tcl_DirEntry *dirEntPtr;
DIR *dirPtr;
#else
- CONST char *paths[2] = {NULL, NULL};
+ const char *paths[2] = {NULL, NULL};
FTS *fts = NULL;
FTSENT *ent;
#endif
@@ -1137,7 +1137,7 @@ static int
TraversalCopy(
Tcl_DString *srcPtr, /* Source pathname to copy (native). */
Tcl_DString *dstPtr, /* Destination pathname of copy (native). */
- CONST Tcl_StatBuf *statBufPtr,
+ const Tcl_StatBuf *statBufPtr,
/* Stat info for file specified by srcPtr. */
int type, /* Reason for call - see TraverseUnixTree(). */
Tcl_DString *errorPtr) /* If non-NULL, uninitialized or free DString
@@ -1201,7 +1201,7 @@ static int
TraversalDelete(
Tcl_DString *srcPtr, /* Source pathname (native). */
Tcl_DString *ignore, /* Destination pathname (not used). */
- CONST Tcl_StatBuf *statBufPtr,
+ const Tcl_StatBuf *statBufPtr,
/* Stat info for file specified by srcPtr. */
int type, /* Reason for call - see TraverseUnixTree(). */
Tcl_DString *errorPtr) /* If non-NULL, uninitialized or free DString
@@ -1249,9 +1249,9 @@ TraversalDelete(
static int
CopyFileAtts(
- CONST char *src, /* Path name of source file (native). */
- CONST char *dst, /* Path name of target file (native). */
- CONST Tcl_StatBuf *statBufPtr)
+ const char *src, /* Path name of source file (native). */
+ const char *dst, /* Path name of target file (native). */
+ const Tcl_StatBuf *statBufPtr)
/* Stat info for source file */
{
struct utimbuf tval;
@@ -1332,7 +1332,7 @@ GetGroupAttribute(
*attributePtrPtr = Tcl_NewIntObj((int) statBuf.st_gid);
} else {
Tcl_DString ds;
- CONST char *utf;
+ const char *utf;
utf = Tcl_ExternalToUtfDString(NULL, groupPtr->gr_name, -1, &ds);
*attributePtrPtr = Tcl_NewStringObj(utf, -1);
@@ -1387,7 +1387,7 @@ GetOwnerAttribute(
*attributePtrPtr = Tcl_NewIntObj((int) statBuf.st_uid);
} else {
Tcl_DString ds;
- CONST char *utf;
+ const char *utf;
utf = Tcl_ExternalToUtfDString(NULL, pwPtr->pw_name, -1, &ds);
*attributePtrPtr = Tcl_NewStringObj(utf, Tcl_DStringLength(&ds));
@@ -1465,12 +1465,12 @@ SetGroupAttribute(
{
long gid;
int result;
- CONST char *native;
+ const char *native;
if (Tcl_GetLongFromObj(NULL, attributePtr, &gid) != TCL_OK) {
Tcl_DString ds;
struct group *groupPtr = NULL;
- CONST char *string;
+ const char *string;
int length;
string = Tcl_GetStringFromObj(attributePtr, &length);
@@ -1531,12 +1531,12 @@ SetOwnerAttribute(
{
long uid;
int result;
- CONST char *native;
+ const char *native;
if (Tcl_GetLongFromObj(NULL, attributePtr, &uid) != TCL_OK) {
Tcl_DString ds;
struct passwd *pwPtr = NULL;
- CONST char *string;
+ const char *string;
int length;
string = Tcl_GetStringFromObj(attributePtr, &length);
@@ -1596,7 +1596,7 @@ SetPermissionsAttribute(
long mode;
mode_t newMode;
int result = TCL_ERROR;
- CONST char *native;
+ const char *native;
char *modeStringPtr = TclGetString(attributePtr);
int scanned = TclParseAllWhiteSpace(modeStringPtr, -1);
@@ -1909,7 +1909,7 @@ TclpObjNormalizePath(
#ifndef NO_REALPATH
char normPath[MAXPATHLEN];
Tcl_DString ds;
- CONST char *nativePath;
+ const char *nativePath;
#endif
/*
@@ -1962,7 +1962,7 @@ TclpObjNormalizePath(
*/
Tcl_DString ds;
- CONST char *nativePath;
+ const char *nativePath;
int accessOk;
nativePath = Tcl_UtfToExternalDString(NULL, path,
@@ -2156,9 +2156,8 @@ SetReadOnlyAttribute(
Tcl_Obj *attributePtr) /* The attribute to set. */
{
Tcl_StatBuf statBuf;
- int result;
- int readonly;
- CONST char *native;
+ int result, readonly;
+ const char *native;
if (Tcl_GetBooleanFromObj(interp, attributePtr, &readonly) != TCL_OK) {
return TCL_ERROR;