diff options
-rw-r--r-- | lib/ChangeLog | 39 | ||||
-rw-r--r-- | lib/acl.c | 10 | ||||
-rw-r--r-- | lib/basename.c | 4 | ||||
-rw-r--r-- | lib/canonicalize.c | 78 | ||||
-rw-r--r-- | lib/canonicalize.h | 6 | ||||
-rw-r--r-- | lib/dirname.c | 42 | ||||
-rw-r--r-- | lib/dirname.h | 14 | ||||
-rw-r--r-- | lib/euidaccess.c | 18 | ||||
-rw-r--r-- | lib/fnmatch_.h | 6 | ||||
-rw-r--r-- | lib/fnmatch_loop.c | 4 | ||||
-rw-r--r-- | lib/fsusage.c | 26 | ||||
-rw-r--r-- | lib/fsusage.h | 4 | ||||
-rw-r--r-- | lib/fts.c | 64 | ||||
-rw-r--r-- | lib/fts_.h | 6 | ||||
-rw-r--r-- | lib/getcwd.c | 60 | ||||
-rw-r--r-- | lib/getloadavg.c | 2 | ||||
-rw-r--r-- | lib/mkstemp.c | 4 | ||||
-rw-r--r-- | lib/mountlist.c | 10 | ||||
-rw-r--r-- | lib/mountlist.h | 4 | ||||
-rw-r--r-- | lib/openat.c | 18 | ||||
-rw-r--r-- | lib/openat.h | 4 | ||||
-rw-r--r-- | lib/readlink-stub.c | 2 | ||||
-rw-r--r-- | lib/readutmp.c | 10 | ||||
-rw-r--r-- | lib/readutmp.h | 2 | ||||
-rw-r--r-- | lib/rename.c | 22 | ||||
-rw-r--r-- | lib/rmdir.c | 11 | ||||
-rw-r--r-- | lib/same.c | 4 | ||||
-rw-r--r-- | lib/savedir.c | 4 | ||||
-rw-r--r-- | lib/stripslash.c | 13 | ||||
-rw-r--r-- | lib/tempname.c | 6 | ||||
-rw-r--r-- | lib/xreadlink.c | 8 |
31 files changed, 275 insertions, 230 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 5ccb69724..945c2b7c3 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,42 @@ +2005-06-01 Paul Eggert <eggert@cs.ucla.edu> + + Use "file name" when talking about file names, instead of "filename" + or "path", as per the GNU coding standards. + * mkdir-p.c: Renamed from makepath.c. + (make_dir_parents): Renamed from make_path. All callers changed. + * mkdir-p.h: Likewise. All includers changed. + * filenamecat.c: Renamed from path-concat.c. + (file_name_concat): Renamed from path_concat. All callers changed. + [TEST_FILE_NAME_CONCAT]: Renamed from TEST_PATH_CONCAT. + * filenamecat.h: Likewise. All includers changed. + * acl.c: Don't use "path" or "filename" to mean "file name" + in comments or local variable names. + * basename.c: Likewise. + * canonicalize.c, canonicalize.h: Likewise. + * dirname.c, dirname.h: Likewise. + * euidaccess.c: Likewise. + * exclude.c: Likewise + * fnmatch_.h, fnmatch_loop.c: Likewise. + * fsusage.c, fsuage.h: Likewise. + * fts.c, fts_.h: Likewise. + * getcwd.c: Likewise. + * getloadavg.c: Likewise. + * mkstemp.c: Likewise. + * mountlist.c, mountlist.h: Likewise. + * openat.c, openat.h: Likewise. + * readlink-stub.c: Likewise. + * readutmp.c, readutmp.h: Likewise. + * rename.c: Likewise. + * rmdir.c: Likewise. + * same.c: Likewise. + * savedir.c: Likewise. + * stripslash.c: Likewise. + * tempname.c: Likewise. + * xreadlink.c: Likewise. + * exclude.c (excluded_file_name): Renamed from excluded_filename. + All uses changed. + * exclude.h: Likewise. + 2005-05-30 Paul Eggert <eggert@cs.ucla.edu> * euidaccess.c (getuid, getgid, getuid, getegid) @@ -1,6 +1,6 @@ /* acl.c - access control lists - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,11 +39,11 @@ # define MIN_ACL_ENTRIES 4 #endif -/* Return 1 if PATH has a nontrivial access control list, 0 if not, +/* Return 1 if FILE has a nontrivial access control list, 0 if not, and -1 (setting errno) if an error is encountered. */ int -file_has_acl (char const *path, struct stat const *pathstat) +file_has_acl (char const *file, struct stat const *filestat) { /* FIXME: This implementation should work on recent-enough versions of HP-UX, Solaris, and Unixware, but it simply returns 0 with @@ -52,9 +52,9 @@ file_has_acl (char const *path, struct stat const *pathstat) fix-related ideas. */ #if HAVE_ACL && defined GETACLCNT - if (! S_ISLNK (pathstat->st_mode)) + if (! S_ISLNK (filestat->st_mode)) { - int n = acl (path, GETACLCNT, 0, NULL); + int n = acl (file, GETACLCNT, 0, NULL); return n < 0 ? (errno == ENOSYS ? 0 : -1) : (MIN_ACL_ENTRIES < n); } #endif diff --git a/lib/basename.c b/lib/basename.c index b6de3d610..00adc0015 100644 --- a/lib/basename.c +++ b/lib/basename.c @@ -1,6 +1,6 @@ -/* basename.c -- return the last element in a path +/* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003, 2004 Free + Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/lib/canonicalize.c b/lib/canonicalize.c index 822fe6f75..571fa19e2 100644 --- a/lib/canonicalize.c +++ b/lib/canonicalize.c @@ -48,7 +48,7 @@ void free (); #include <stddef.h> #include "cycle-check.h" -#include "path-concat.h" +#include "filenamecat.h" #include "stat-macros.h" #include "xalloc.h" #include "xgetcwd.h" @@ -62,8 +62,8 @@ void free (); #if !HAVE_CANONICALIZE_FILE_NAME /* Return the canonical absolute name of file NAME. A canonical name - does not contain any `.', `..' components nor any repeated path - separators ('/') or symlinks. All path components must exist. + does not contain any `.', `..' components nor any repeated file name + separators ('/') or symlinks. All components must exist. The result is malloc'd. */ char * @@ -89,7 +89,7 @@ canonicalize_file_name (const char *name) /* All known hosts with resolvepath (e.g. Solaris 7) don't turn relative names into absolute ones, so prepend the working - directory if the path is not absolute. */ + directory if the file name is not absolute. */ if (name[0] != '/') { char *wd; @@ -97,7 +97,7 @@ canonicalize_file_name (const char *name) if (!(wd = xgetcwd ())) return NULL; - extra_buf = path_concat (wd, name, NULL); + extra_buf = file_name_concat (wd, name, NULL); name = extra_buf; free (wd); } @@ -135,15 +135,17 @@ canonicalize_file_name (const char *name) #endif /* !HAVE_CANONICALIZE_FILE_NAME */ /* Return the canonical absolute name of file NAME. A canonical name - does not contain any `.', `..' components nor any repeated path - separators ('/') or symlinks. Whether path components must exist + does not contain any `.', `..' components nor any repeated file name + separators ('/') or symlinks. Whether components must exist or not depends on canonicalize mode. The result is malloc'd. */ char * canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode) { - char *rpath, *dest, *extra_buf = NULL; - const char *start, *end, *rpath_limit; + char *rname, *dest, *extra_buf = NULL; + char const *start; + char const *end; + char const *rname_limit; size_t extra_len = 0; struct cycle_check_state cycle_state; @@ -161,38 +163,38 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode) if (name[0] != '/') { - rpath = xgetcwd (); - if (!rpath) + rname = xgetcwd (); + if (!rname) return NULL; - dest = strchr (rpath, '\0'); - if (dest - rpath < PATH_MAX) + dest = strchr (rname, '\0'); + if (dest - rname < PATH_MAX) { - char *p = xrealloc (rpath, PATH_MAX); - dest = p + (dest - rpath); - rpath = p; - rpath_limit = rpath + PATH_MAX; + char *p = xrealloc (rname, PATH_MAX); + dest = p + (dest - rname); + rname = p; + rname_limit = rname + PATH_MAX; } else { - rpath_limit = dest; + rname_limit = dest; } } else { - rpath = xmalloc (PATH_MAX); - rpath_limit = rpath + PATH_MAX; - rpath[0] = '/'; - dest = rpath + 1; + rname = xmalloc (PATH_MAX); + rname_limit = rname + PATH_MAX; + rname[0] = '/'; + dest = rname + 1; } cycle_check_init (&cycle_state); for (start = end = name; *start; start = end) { - /* Skip sequence of multiple path-separators. */ + /* Skip sequence of multiple file name separators. */ while (*start == '/') ++start; - /* Find end of path component. */ + /* Find end of component. */ for (end = start; *end && *end != '/'; ++end) /* Nothing. */; @@ -203,7 +205,7 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode) else if (end - start == 2 && start[0] == '.' && start[1] == '.') { /* Back up to previous component, ignore if at root already. */ - if (dest > rpath + 1) + if (dest > rname + 1) while ((--dest)[-1] != '/'); } else @@ -213,26 +215,26 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode) if (dest[-1] != '/') *dest++ = '/'; - if (dest + (end - start) >= rpath_limit) + if (dest + (end - start) >= rname_limit) { - ptrdiff_t dest_offset = dest - rpath; - size_t new_size = rpath_limit - rpath; + ptrdiff_t dest_offset = dest - rname; + size_t new_size = rname_limit - rname; if (end - start + 1 > PATH_MAX) new_size += end - start + 1; else new_size += PATH_MAX; - rpath = xrealloc (rpath, new_size); - rpath_limit = rpath + new_size; + rname = xrealloc (rname, new_size); + rname_limit = rname + new_size; - dest = rpath + dest_offset; + dest = rname + dest_offset; } dest = memcpy (dest, start, end - start); dest += end - start; *dest = '\0'; - if (lstat (rpath, &st) < 0) + if (lstat (rname, &st) != 0) { if (can_mode == CAN_EXISTING) goto error; @@ -255,7 +257,7 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode) goto error; } - buf = xreadlink (rpath, st.st_size); + buf = xreadlink (rname, st.st_size); if (!buf) { if (can_mode == CAN_MISSING) @@ -284,10 +286,10 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode) name = end = memcpy (extra_buf, buf, n); if (buf[0] == '/') - dest = rpath + 1; /* It's an absolute symlink */ + dest = rname + 1; /* It's an absolute symlink */ else /* Back up to previous component, ignore if at root already: */ - if (dest > rpath + 1) + if (dest > rname + 1) while ((--dest)[-1] != '/'); free (buf); @@ -302,15 +304,15 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode) } } } - if (dest > rpath + 1 && dest[-1] == '/') + if (dest > rname + 1 && dest[-1] == '/') --dest; *dest = '\0'; free (extra_buf); - return rpath; + return rname; error: free (extra_buf); - free (rpath); + free (rname); return NULL; } diff --git a/lib/canonicalize.h b/lib/canonicalize.h index 4c9596f98..4cae3c551 100644 --- a/lib/canonicalize.h +++ b/lib/canonicalize.h @@ -1,5 +1,5 @@ /* Return the canonical absolute name of a given file. - Copyright (C) 1996-2004 Free Software Foundation, Inc. + Copyright (C) 1996-2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,10 +21,10 @@ enum canonicalize_mode_t { - /* All path components must exist. */ + /* All components must exist. */ CAN_EXISTING = 0, - /* All path components excluding last one must exist. */ + /* All components excluding last one must exist. */ CAN_ALL_BUT_LAST = 1, /* No requirements on components existence. */ diff --git a/lib/dirname.c b/lib/dirname.c index 9b6007656..f1930c8d2 100644 --- a/lib/dirname.c +++ b/lib/dirname.c @@ -1,6 +1,6 @@ -/* dirname.c -- return all but the last element in a path +/* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000, 2001, 2003, 2004 Free Software + Copyright (C) 1990, 1998, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -26,40 +26,40 @@ #include <string.h> #include "xalloc.h" -/* Return the length of `dirname (PATH)', or zero if PATH is +/* Return the length of `dirname (FILE)', or zero if FILE is in the working directory. Works properly even if there are trailing slashes (by effectively ignoring them). */ size_t -dir_len (char const *path) +dir_len (char const *file) { - size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (path); + size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); size_t length; /* Strip the basename and any redundant slashes before it. */ - for (length = base_name (path) - path; prefix_length < length; length--) - if (! ISSLASH (path[length - 1])) + for (length = base_name (file) - file; prefix_length < length; length--) + if (! ISSLASH (file[length - 1])) return length; /* But don't strip the only slash from "/". */ - return prefix_length + ISSLASH (path[prefix_length]); + return prefix_length + ISSLASH (file[prefix_length]); } -/* Return the leading directories part of PATH, +/* Return the leading directories part of FILE, allocated with xmalloc. Works properly even if there are trailing slashes (by effectively ignoring them). */ char * -dir_name (char const *path) +dir_name (char const *file) { - size_t length = dir_len (path); - bool append_dot = (length == FILE_SYSTEM_PREFIX_LEN (path)); - char *newpath = xmalloc (length + append_dot + 1); - memcpy (newpath, path, length); + size_t length = dir_len (file); + bool append_dot = (length == FILE_SYSTEM_PREFIX_LEN (file)); + char *dir = xmalloc (length + append_dot + 1); + memcpy (dir, file, length); if (append_dot) - newpath[length++] = '.'; - newpath[length] = 0; - return newpath; + dir[length++] = '.'; + dir[length] = 0; + return dir; } #ifdef TEST_DIRNAME @@ -108,13 +108,13 @@ main (int argc, char *argv[]) buff[MAX_BUFF_LEN] = 0; while (fgets (buff, MAX_BUFF_LEN, stdin) && buff[0]) { - char path[MAX_BUFF_LEN]; + char file[MAX_BUFF_LEN]; char expected_result[MAX_BUFF_LEN]; char const *result; - sscanf (buff, "%s %s", path, expected_result); - result = dir_name (path); + sscanf (buff, "%s %s", file, expected_result); + result = dir_name (file); if (strcmp (result, expected_result)) - printf ("%s: got %s, expected %s\n", path, result, expected_result); + printf ("%s: got %s, expected %s\n", file, result, expected_result); } return 0; } diff --git a/lib/dirname.h b/lib/dirname.h index 5c3c93050..1688ae810 100644 --- a/lib/dirname.h +++ b/lib/dirname.h @@ -1,6 +1,6 @@ /* Take file names apart into directory and base names. - Copyright (C) 1998, 2001, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,17 +31,17 @@ # endif # ifndef FILE_SYSTEM_PREFIX_LEN -# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 +# define FILE_SYSTEM_PREFIX_LEN(File_name) 0 # endif # define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) # define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) -char *base_name (char const *path); -char *dir_name (char const *path); -size_t base_len (char const *path); -size_t dir_len (char const *path); +char *base_name (char const *file); +char *dir_name (char const *file); +size_t base_len (char const *file); +size_t dir_len (char const *file); -bool strip_trailing_slashes (char *path); +bool strip_trailing_slashes (char *file); #endif /* not DIRNAME_H_ */ diff --git a/lib/euidaccess.c b/lib/euidaccess.c index 2b36fc64a..4bb93aa0b 100644 --- a/lib/euidaccess.c +++ b/lib/euidaccess.c @@ -77,21 +77,21 @@ #endif -/* Return 0 if the user has permission of type MODE on file PATH; +/* Return 0 if the user has permission of type MODE on FILE; otherwise, return -1 and set `errno'. Like access, except that it uses the effective user and group id's instead of the real ones, and it does not always check for read-only file system, text busy, etc. */ int -euidaccess (const char *path, int mode) +euidaccess (const char *file, int mode) { #if defined EFF_ONLY_OK - return access (path, mode | EFF_ONLY_OK); + return access (file, mode | EFF_ONLY_OK); #elif defined ACC_SELF - return accessx (path, mode, ACC_SELF); + return accessx (file, mode, ACC_SELF); #elif HAVE_EACCESS - return eaccess (path, mode); + return eaccess (file, mode); #else uid_t uid = getuid (); @@ -110,7 +110,7 @@ euidaccess (const char *path, int mode) safe. */ if (mode == F_OK) - return stat (path, &stats); + return stat (file, &stats); else { int result; @@ -121,7 +121,7 @@ euidaccess (const char *path, int mode) if (gid != egid) setregid (egid, gid); - result = access (path, mode); + result = access (file, mode); saved_errno = errno; /* Restore them. */ @@ -143,9 +143,9 @@ euidaccess (const char *path, int mode) unsigned int granted; if (uid == euid && gid == egid) /* If we are not set-uid or set-gid, access does the same. */ - return access (path, mode); + return access (file, mode); - if (stat (path, &stats)) + if (stat (file, &stats) != 0) return -1; /* The super-user can read and write any file, and execute any file diff --git a/lib/fnmatch_.h b/lib/fnmatch_.h index a88d323a3..fecada57f 100644 --- a/lib/fnmatch_.h +++ b/lib/fnmatch_.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003 - Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003, + 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,7 +51,7 @@ extern "C" { # define FNM_NOSYS (-1) # endif -/* Match NAME against the filename pattern PATTERN, +/* Match NAME against the file name pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ extern int fnmatch (const char *__pattern, const char *__name, int __flags); diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c index feb73c1b1..35d598061 100644 --- a/lib/fnmatch_loop.c +++ b/lib/fnmatch_loop.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004 +/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Match STRING against the filename pattern PATTERN, returning zero if +/* Match STRING against the file name pattern PATTERN, returning zero if it matches, nonzero if not. */ static int EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, bool no_leading_period, int flags) diff --git a/lib/fsusage.c b/lib/fsusage.c index d2a6cc21f..972d88f12 100644 --- a/lib/fsusage.c +++ b/lib/fsusage.c @@ -1,7 +1,7 @@ /* fsusage.c -- return space usage of mounted file systems - Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003, 2004 Free - Software Foundation, Inc. + Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -103,20 +103,20 @@ #define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1)) /* Fill in the fields of FSP with information about space usage for - the file system on which PATH resides. - DISK is the device on which PATH is mounted, for space-getting + the file system on which FILE resides. + DISK is the device on which FILE is mounted, for space-getting methods that need to know it. Return 0 if successful, -1 if not. When returning -1, ensure that ERRNO is either a system error value, or zero if DISK is NULL on a system that requires a non-NULL value. */ int -get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) +get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) { #ifdef STAT_STATFS3_OSF1 struct statfs fsd; - if (statfs (path, &fsd, sizeof (struct statfs)) != 0) + if (statfs (file, &fsd, sizeof (struct statfs)) != 0) return -1; fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); @@ -127,7 +127,7 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) struct fs_data fsd; - if (statfs (path, &fsd) != 1) + if (statfs (file, &fsd) != 1) return -1; fsp->fsu_blocksize = 1024; @@ -181,7 +181,7 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) struct statfs fsd; - if (statfs (path, &fsd) < 0) + if (statfs (file, &fsd) < 0) return -1; fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize); @@ -207,7 +207,7 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) struct statfs fsd; - if (statfs (path, &fsd) < 0) + if (statfs (file, &fsd) < 0) return -1; fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); @@ -222,7 +222,7 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) struct statfs fsd; - if (statfs (path, &fsd, sizeof fsd, 0) < 0) + if (statfs (file, &fsd, sizeof fsd, 0) < 0) return -1; /* Empirically, the block counts on most SVR3 and SVR3-derived @@ -240,7 +240,7 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) struct statvfs fsd; - if (statvfs (path, &fsd) < 0) + if (statvfs (file, &fsd) < 0) return -1; /* f_frsize isn't guaranteed to be supported. */ @@ -269,12 +269,12 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) /* AIX PS/2 does not supply statfs. */ int -statfs (char *path, struct statfs *fsb) +statfs (char *file, struct statfs *fsb) { struct stat stats; struct dustat fsd; - if (stat (path, &stats)) + if (stat (file, &stats) != 0) return -1; if (dustat (stats.st_dev, 0, &fsd, sizeof (fsd))) return -1; diff --git a/lib/fsusage.h b/lib/fsusage.h index 2d4172a39..f3eda2d09 100644 --- a/lib/fsusage.h +++ b/lib/fsusage.h @@ -1,6 +1,6 @@ /* fsusage.h -- declarations for file system space usage info - Copyright (C) 1991, 1992, 1997, 2003, 2004 Free Software + Copyright (C) 1991, 1992, 1997, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -35,6 +35,6 @@ struct fs_usage uintmax_t fsu_ffree; /* Free file nodes. */ }; -int get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp); +int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp); #endif @@ -244,8 +244,8 @@ fts_open (char * const *argv, SET(FTS_NOCHDIR); /* - * Start out with 1K of path space, and enough, in any case, - * to hold the user's paths. + * Start out with 1K of file name space, and enough, in any case, + * to hold the user's file names. */ #ifndef MAXPATHLEN # define MAXPATHLEN 1024 @@ -260,7 +260,7 @@ fts_open (char * const *argv, /* Allocate/initialize root(s). */ for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) { - /* Don't allow zero-length paths. */ + /* Don't allow zero-length file names. */ if ((len = strlen(*argv)) == 0) { __set_errno (ENOENT); goto mem3; @@ -311,7 +311,7 @@ fts_open (char * const *argv, /* * If using chdir(2), grab a file descriptor pointing to dot to ensure - * that we can get back here; this could be avoided for some paths, + * that we can get back here; this could be avoided for some file names, * but almost certainly not worth the effort. Slashes, symbolic links, * and ".." are all fairly nasty problems. Note, if we can't get the * descriptor we run anyway, just more slowly. @@ -341,7 +341,7 @@ fts_load (FTS *sp, register FTSENT *p) * actually enter the directory until after the preorder visit, set * the fts_accpath field specially so the chdir gets done to the right * place and the user can access the first node. From fts_open it's - * known that the path will fit. + * known that the file name will fit. */ len = p->fts_pathlen = p->fts_namelen; memmove(sp->fts_path, p->fts_name, len + 1); @@ -374,7 +374,7 @@ fts_close (FTS *sp) free(p); } - /* Free up child linked list, sort array, path buffer. */ + /* Free up child linked list, sort array, file name buffer. */ if (sp->fts_child) fts_lfree(sp->fts_child); if (sp->fts_array) @@ -403,8 +403,8 @@ fts_close (FTS *sp) } /* - * Special case of "/" at the end of the path so that slashes aren't - * appended which would cause paths to be written as "....//foo". + * Special case of "/" at the end of the file name so that slashes aren't + * appended which would cause file names to be written as "....//foo". */ #define NAPPEND(p) \ (p->fts_path[p->fts_pathlen - 1] == '/' \ @@ -524,7 +524,8 @@ next: tmp = p; /* * If reached the top, return to the original directory (or - * the root of the tree), and load the paths for the next root. + * the root of the tree), and load the file names for the next + * root. */ if (p->fts_level == FTS_ROOTLEVEL) { if (FCHDIR(sp, sp->fts_rfd)) { @@ -585,7 +586,7 @@ check_for_dir: return (sp->fts_cur = NULL); } - /* NUL terminate the pathname. */ + /* NUL terminate the file name. */ sp->fts_path[p->fts_pathlen] = '\0'; /* @@ -685,8 +686,8 @@ fts_children (register FTS *sp, int instr) instr = BCHILD; /* - * If using chdir on a relative path and called BEFORE fts_read does - * its chdir to the root of a traversal, we can lose -- we need to + * If using chdir on a relative file name and called BEFORE fts_read + * does its chdir to the root of a traversal, we can lose -- we need to * chdir into the subdirectory, and we don't know where the current * directory is, so we can't get back so that the upcoming chdir by * fts_read will work. @@ -753,7 +754,7 @@ fts_build (register FTS *sp, int type) else oflag = DTF_HIDEW|DTF_NODUP|DTF_REWIND; #else -# define __opendir2(path, flag) opendir(path) +# define __opendir2(file, flag) opendir(file) #endif if ((dirp = __opendir2(cur->fts_accpath, oflag)) == NULL) { if (type == BREAD) { @@ -787,7 +788,7 @@ fts_build (register FTS *sp, int type) * but set a flag so we don't chdir after the post-order visit. * We won't be able to stat anything, but we can still return the * names themselves. Note, that since fts_read won't be able to - * chdir into the directory, it will have to return different path + * chdir into the directory, it will have to return different file * names than before, i.e. "a/b" instead of "b". Since the node * has already been visited in pre-order, have to wait until the * post-order visit to return the error. There is a special case @@ -813,13 +814,13 @@ fts_build (register FTS *sp, int type) /* * Figure out the max file name length that can be stored in the - * current path -- the inner loop allocates more path as necessary. + * current buffer -- the inner loop allocates more space as necessary. * We really wouldn't have to do the maxlen calculations here, we - * could do them in fts_read before returning the path, but it's a + * could do them in fts_read before returning the name, but it's a * lot easier here since the length is part of the dirent structure. * * If not changing directories set a pointer so that can just append - * each new name into the path. + * each new component into the file name. */ len = NAPPEND(cur); if (ISSET(FTS_NOCHDIR)) { @@ -846,7 +847,7 @@ fts_build (register FTS *sp, int type) oldaddr = sp->fts_path; if (! fts_palloc(sp, NAMLEN (dp) + len + 1)) { /* - * No more memory for path or structures. Save + * No more memory. Save * errno, free up the current structure and the * structures already allocated. */ @@ -873,7 +874,7 @@ mem1: saved_errno = errno; if (new_len < len) { /* * In the unlikely even that we would end up - * with a path longer than SIZE_MAX, free up + * with a file name longer than SIZE_MAX, free up * the current structure and the structures already * allocated, then error out with ENAMETOOLONG. */ @@ -940,14 +941,14 @@ mem1: saved_errno = errno; closedir(dirp); /* - * If realloc() changed the address of the path, adjust the + * If realloc() changed the address of the file name, adjust the * addresses for the rest of the tree and the dir list. */ if (doadjust) fts_padjust(sp, head); /* - * If not changing directories, reset the path back to original + * If not changing directories, reset the file name back to original * state. */ if (ISSET(FTS_NOCHDIR)) { @@ -959,7 +960,7 @@ mem1: saved_errno = errno; /* * If descended after called from fts_children or after called from * fts_read and nothing found, get back. At the root level we use - * the saved fd; if one of fts_open()'s arguments is a relative path + * the saved fd; if one of fts_open()'s arguments is a relative name * to an empty directory, we wind up here with no other way back. If * can't get back, we're done. */ @@ -1226,10 +1227,11 @@ fts_lfree (register FTSENT *head) } /* - * Allow essentially unlimited paths; find, rm, ls should all work on any tree. - * Most systems will allow creation of paths much longer than MAXPATHLEN, even - * though the kernel won't resolve them. Add the size (not just what's needed) - * plus 256 bytes so don't realloc the path 2 bytes at a time. + * Allow essentially unlimited file name lengths; find, rm, ls should + * all work on any tree. Most systems will allow creation of file + * names much longer than MAXPATHLEN, even though the kernel won't + * resolve them. Add the size (not just what's needed) plus 256 bytes + * so don't realloc the file name 2 bytes at a time. */ static bool internal_function @@ -1262,8 +1264,8 @@ fts_palloc (FTS *sp, size_t more) } /* - * When the path is realloc'd, have to fix all of the pointers in structures - * already returned. + * When the file name is realloc'd, have to fix all of the pointers in + * structures already returned. */ static void internal_function @@ -1303,13 +1305,13 @@ fts_maxarglen (char * const *argv) } /* - * Change to dir specified by fd or path without getting + * Change to dir specified by fd or file name without getting * tricked by someone changing the world out from underneath us. * Assumes p->fts_statp->st_dev and p->fts_statp->st_ino are filled in. */ static int internal_function -fts_safe_changedir (FTS *sp, FTSENT *p, int fd, char const *path) +fts_safe_changedir (FTS *sp, FTSENT *p, int fd, char const *dir) { int ret, oerrno, newfd; struct stat sb; @@ -1317,7 +1319,7 @@ fts_safe_changedir (FTS *sp, FTSENT *p, int fd, char const *path) newfd = fd; if (ISSET(FTS_NOCHDIR)) return (0); - if (fd < 0 && (newfd = fd_safer (diropen (path))) < 0) + if (fd < 0 && (newfd = fd_safer (diropen (dir))) < 0) return (-1); if (fstat(newfd, &sb)) { ret = -1; diff --git a/lib/fts_.h b/lib/fts_.h index 954ba569b..4bf903bd3 100644 --- a/lib/fts_.h +++ b/lib/fts_.h @@ -71,7 +71,7 @@ typedef struct { struct _ftsent *fts_child; /* linked list of children */ struct _ftsent **fts_array; /* sort array */ dev_t fts_dev; /* starting device # */ - char *fts_path; /* path for this descent */ + char *fts_path; /* file name for this descent */ int fts_rfd; /* fd for root */ size_t fts_pathlen; /* sizeof(path) */ size_t fts_nitems; /* elements in the sort array */ @@ -135,8 +135,8 @@ typedef struct _ftsent { struct _ftsent *fts_link; /* next file in directory */ long fts_number; /* local numeric value */ void *fts_pointer; /* local address value */ - char *fts_accpath; /* access path */ - char *fts_path; /* root path; == fts_fts->fts_path */ + char *fts_accpath; /* access file name */ + char *fts_path; /* root name; == fts_fts->fts_path */ int fts_errno; /* errno for this node */ int fts_symfd; /* fd for symlink */ size_t fts_pathlen; /* strlen(fts_path) */ diff --git a/lib/getcwd.c b/lib/getcwd.c index d12b6c907..94e5ba3b5 100644 --- a/lib/getcwd.c +++ b/lib/getcwd.c @@ -1,5 +1,5 @@ -/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2004 Free Software Foundation, - Inc. +/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2004,2005 Free Software + Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -114,7 +114,7 @@ # define __readdir readdir #endif -/* Get the pathname of the current working directory, and put it in SIZE +/* Get the name of the current working directory, and put it in SIZE bytes of BUF. Returns NULL if the directory couldn't be determined or SIZE was too small. If successful, returns BUF. In GNU, if BUF is NULL, an array is allocated with `malloc'; the array is SIZE bytes long, @@ -147,8 +147,8 @@ __getcwd (char *buf, size_t size) DIR *dirstream = NULL; dev_t rootdev, thisdev; ino_t rootino, thisino; - char *path; - register char *pathp; + char *dir; + register char *dirp; struct stat st; size_t allocated = size; size_t used; @@ -161,9 +161,9 @@ __getcwd (char *buf, size_t size) So trust the system getcwd's results unless they look suspicious. */ # undef getcwd - path = getcwd (buf, size); - if (path || (errno != ERANGE && !is_ENAMETOOLONG (errno) && errno != ENOENT)) - return path; + dir = getcwd (buf, size); + if (dir || (errno != ERANGE && !is_ENAMETOOLONG (errno) && errno != ENOENT)) + return dir; #endif if (size == 0) @@ -179,15 +179,15 @@ __getcwd (char *buf, size_t size) if (buf == NULL) { - path = malloc (allocated); - if (path == NULL) + dir = malloc (allocated); + if (dir == NULL) return NULL; } else - path = buf; + dir = buf; - pathp = path + allocated; - *--pathp = '\0'; + dirp = dir + allocated; + *--dirp = '\0'; if (__lstat (".", &st) < 0) goto lose; @@ -318,10 +318,10 @@ __getcwd (char *buf, size_t size) } else { - size_t pathroom = pathp - path; + size_t dirroom = dirp - dir; size_t namlen = _D_EXACT_NAMLEN (d); - if (pathroom <= namlen) + if (dirroom <= namlen) { if (size != 0) { @@ -335,20 +335,20 @@ __getcwd (char *buf, size_t size) allocated += MAX (allocated, namlen); if (allocated < oldsize - || ! (tmp = realloc (path, allocated))) + || ! (tmp = realloc (dir, allocated))) goto memory_exhausted; /* Move current contents up to the end of the buffer. This is guaranteed to be non-overlapping. */ - pathp = memcpy (tmp + allocated - (oldsize - pathroom), - tmp + pathroom, - oldsize - pathroom); - path = tmp; + dirp = memcpy (tmp + allocated - (oldsize - dirroom), + tmp + dirroom, + oldsize - dirroom); + dir = tmp; } } - pathp -= namlen; - memcpy (pathp, d->d_name, namlen); - *--pathp = '/'; + dirp -= namlen; + memcpy (dirp, d->d_name, namlen); + *--dirp = '/'; } thisdev = dotdev; @@ -361,25 +361,25 @@ __getcwd (char *buf, size_t size) goto lose; } - if (pathp == &path[allocated - 1]) - *--pathp = '/'; + if (dirp == &dir[allocated - 1]) + *--dirp = '/'; #ifndef AT_FDCWD if (dotlist != dots) free (dotlist); #endif - used = path + allocated - pathp; - memmove (path, pathp, used); + used = dir + allocated - dirp; + memmove (dir, dirp, used); if (buf == NULL && size == 0) /* Ensure that the buffer is only as large as necessary. */ - buf = realloc (path, used); + buf = realloc (dir, used); if (buf == NULL) /* Either buf was NULL all along, or `realloc' failed but we still have the original string. */ - buf = path; + buf = dir; return buf; @@ -398,7 +398,7 @@ __getcwd (char *buf, size_t size) free (dotlist); #endif if (buf == NULL) - free (path); + free (dir); __set_errno (save); } return NULL; diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 6be6e3716..8fe542fbb 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -32,7 +32,7 @@ AC_CHECK_FUNCS(pstat_getdynamic) in your configure.in file. FIXUP_KERNEL_SYMBOL_ADDR() Adjust address in returned struct nlist. - KERNEL_FILE Pathname of the kernel to nlist. + KERNEL_FILE Name of the kernel file to nlist. LDAV_CVT() Scale the load average from the kernel. Returns a double. LDAV_SYMBOL Name of kernel symbol giving load average. diff --git a/lib/mkstemp.c b/lib/mkstemp.c index ab635e6b4..2683e4b8f 100644 --- a/lib/mkstemp.c +++ b/lib/mkstemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc. This file is derived from the one in the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -33,7 +33,7 @@ int __gen_tempname (); /* Generate a unique temporary file name from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; - they are replaced with a string that makes the filename unique. + they are replaced with a string that makes the file name unique. Then open the file and return a fd. */ int rpl_mkstemp (char *template) diff --git a/lib/mountlist.c b/lib/mountlist.c index 49dcf4247..129e0a438 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -755,16 +755,16 @@ read_file_system_list (bool need_fs_type) me = xmalloc (sizeof *me); if (vmp->vmt_flags & MNT_REMOTE) { - char *host, *path; + char *host, *dir; me->me_remote = 1; - /* Prepend the remote pathname. */ + /* Prepend the remote dirname. */ host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off; - path = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off; - me->me_devname = xmalloc (strlen (host) + strlen (path) + 2); + dir = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off; + me->me_devname = xmalloc (strlen (host) + strlen (dir) + 2); strcpy (me->me_devname, host); strcat (me->me_devname, ":"); - strcat (me->me_devname, path); + strcat (me->me_devname, dir); } else { diff --git a/lib/mountlist.h b/lib/mountlist.h index cacfe45cd..7f5a6f77a 100644 --- a/lib/mountlist.h +++ b/lib/mountlist.h @@ -26,8 +26,8 @@ /* A mount table entry. */ struct mount_entry { - char *me_devname; /* Device node pathname, including "/dev/". */ - char *me_mountdir; /* Mount point directory pathname. */ + char *me_devname; /* Device node name, including "/dev/". */ + char *me_mountdir; /* Mount point directory name. */ char *me_type; /* "nfs", "4.2", etc. */ dev_t me_dev; /* Device number of me_mountdir. */ unsigned int me_dummy : 1; /* Nonzero for dummy file systems. */ diff --git a/lib/openat.c b/lib/openat.c index fe539de16..ec51b2d13 100644 --- a/lib/openat.c +++ b/lib/openat.c @@ -43,7 +43,7 @@ Otherwise, upon failure, set errno and return -1, as openat does. Upon successful completion, return a file descriptor. */ int -rpl_openat (int fd, char const *filename, int flags, ...) +rpl_openat (int fd, char const *file, int flags, ...) { struct saved_cwd saved_cwd; int saved_errno; @@ -62,8 +62,8 @@ rpl_openat (int fd, char const *filename, int flags, ...) va_end (arg); } - if (fd == AT_FDCWD || *filename == '/') - return open (filename, flags, mode); + if (fd == AT_FDCWD || *file == '/') + return open (file, flags, mode); if (save_cwd (&saved_cwd) != 0) error (exit_failure, errno, @@ -77,7 +77,7 @@ rpl_openat (int fd, char const *filename, int flags, ...) return -1; } - new_fd = open (filename, flags, mode); + new_fd = open (file, flags, mode); saved_errno = errno; if (restore_cwd (&saved_cwd) != 0) @@ -140,7 +140,7 @@ fdopendir (int fd) then give a diagnostic and exit nonzero. Otherwise, this function works just like Solaris' fstatat. */ int -fstatat (int fd, char const *filename, struct stat *st, int flag) +fstatat (int fd, char const *file, struct stat *st, int flag) { struct saved_cwd saved_cwd; int saved_errno; @@ -148,8 +148,8 @@ fstatat (int fd, char const *filename, struct stat *st, int flag) if (fd == AT_FDCWD) return (flag == AT_SYMLINK_NOFOLLOW - ? lstat (filename, st) - : stat (filename, st)); + ? lstat (file, st) + : stat (file, st)); if (save_cwd (&saved_cwd) != 0) error (exit_failure, errno, @@ -164,8 +164,8 @@ fstatat (int fd, char const *filename, struct stat *st, int flag) } err = (flag == AT_SYMLINK_NOFOLLOW - ? lstat (filename, st) - : stat (filename, st)); + ? lstat (file, st) + : stat (file, st)); saved_errno = errno; if (restore_cwd (&saved_cwd) != 0) diff --git a/lib/openat.h b/lib/openat.h index d8db9cea5..6639f732a 100644 --- a/lib/openat.h +++ b/lib/openat.h @@ -36,11 +36,11 @@ # define __OPENAT_XCONCAT(x, y) __OPENAT_CONCAT (x, y) # define __OPENAT_ID(y) __OPENAT_XCONCAT (__OPENAT_PREFIX, y) # define openat __OPENAT_ID (openat) -int openat (int fd, char const *filename, int flags, /* mode_t mode */ ...); +int openat (int fd, char const *file, int flags, /* mode_t mode */ ...); # define fdopendir __OPENAT_ID (fdopendir) DIR *fdopendir (int fd); # define fstatat __OPENAT_ID (fstatat) -int fstatat (int fd, char const *filename, struct stat *st, int flag); +int fstatat (int fd, char const *file, struct stat *st, int flag); # endif #endif diff --git a/lib/readlink-stub.c b/lib/readlink-stub.c index cb2926ca6..67a776993 100644 --- a/lib/readlink-stub.c +++ b/lib/readlink-stub.c @@ -8,7 +8,7 @@ symlinks. */ int -readlink (const char *filename, char *buffer, size_t size) +readlink (const char *file, char *buffer, size_t size) { errno = EINVAL; return -1; diff --git a/lib/readutmp.c b/lib/readutmp.c index a6d91bd42..ca4472c65 100644 --- a/lib/readutmp.c +++ b/lib/readutmp.c @@ -72,7 +72,7 @@ desirable_utmp_entry (STRUCT_UTMP const *u, int options) || (kill (UT_PID (u), 0) < 0 && errno == ESRCH))); } -/* Read the utmp entries corresponding to file FILENAME into freshly- +/* Read the utmp entries corresponding to file FILE into freshly- malloc'd storage, set *UTMP_BUF to that pointer, set *N_ENTRIES to the number of entries, and return zero. If there is any error, return -1, setting errno, and don't modify the parameters. @@ -82,7 +82,7 @@ desirable_utmp_entry (STRUCT_UTMP const *u, int options) #ifdef UTMP_NAME_FUNCTION int -read_utmp (const char *filename, size_t *n_entries, STRUCT_UTMP **utmp_buf, +read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf, int options) { size_t n_read = 0; @@ -94,7 +94,7 @@ read_utmp (const char *filename, size_t *n_entries, STRUCT_UTMP **utmp_buf, Solaris' utmpname returns 1 upon success -- which is contrary to what the GNU libc version does. In addition, older GNU libc versions are actually void. */ - UTMP_NAME_FUNCTION (filename); + UTMP_NAME_FUNCTION (file); SET_UTMP_ENT (); @@ -118,14 +118,14 @@ read_utmp (const char *filename, size_t *n_entries, STRUCT_UTMP **utmp_buf, #else int -read_utmp (const char *filename, size_t *n_entries, STRUCT_UTMP **utmp_buf, +read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf, int options) { size_t n_read = 0; size_t n_alloc = 0; STRUCT_UTMP *utmp = NULL; int saved_errno; - FILE *f = fopen (filename, "r"); + FILE *f = fopen (file, "r"); if (! f) return -1; diff --git a/lib/readutmp.h b/lib/readutmp.h index 6cacc400e..f5797ebe9 100644 --- a/lib/readutmp.h +++ b/lib/readutmp.h @@ -205,7 +205,7 @@ enum }; char *extract_trimmed_name (const STRUCT_UTMP *ut); -int read_utmp (const char *filename, size_t *n_entries, STRUCT_UTMP **utmp_buf, +int read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf, int options); #endif /* __READUTMP_H__ */ diff --git a/lib/rename.c b/lib/rename.c index 44cc1d292..6f77fd09c 100644 --- a/lib/rename.c +++ b/lib/rename.c @@ -1,7 +1,7 @@ /* Work around the bug in some systems whereby rename fails when the source - path has a trailing slash. The rename functions of SunOS 4.1.1_U1 and + file has a trailing slash. The rename functions of SunOS 4.1.1_U1 and mips-dec-ultrix4.4 have this bug. - Copyright (C) 2001-2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,27 +31,27 @@ #include "dirname.h" #include "xalloc.h" -/* Rename the file SRC_PATH to DST_PATH, removing any trailing - slashes from SRC_PATH. Needed for SunOS 4.1.1_U1. */ +/* Rename the file SRC to DST, removing any trailing + slashes from SRC. Needed for SunOS 4.1.1_U1. */ int -rpl_rename (const char *src_path, const char *dst_path) +rpl_rename (char const *src, char const *dst) { char *src_temp; int ret_val; - size_t s_len = strlen (src_path); + size_t s_len = strlen (src); - if (s_len && src_path[s_len - 1] == '/') + if (s_len && src[s_len - 1] == '/') { - src_temp = xstrdup (src_path); + src_temp = xstrdup (src); strip_trailing_slashes (src_temp); } else - src_temp = (char *) src_path; + src_temp = (char *) src; - ret_val = rename (src_temp, dst_path); + ret_val = rename (src_temp, dst); - if (src_temp != src_path) + if (src_temp != src) free (src_temp); return ret_val; diff --git a/lib/rmdir.c b/lib/rmdir.c index 73d8e4339..ad026a641 100644 --- a/lib/rmdir.c +++ b/lib/rmdir.c @@ -1,6 +1,7 @@ /* BSD compatible remove directory function for System V - Copyright (C) 1988, 1990, 1999, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1988, 1990, 1999, 2003, 2004, 2005 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,17 +29,17 @@ /* rmdir adapted from GNU tar. */ -/* Remove directory DPATH. +/* Remove directory DIR. Return 0 if successful, -1 if not. */ int -rmdir (char const *dpath) +rmdir (char const *dir) { pid_t cpid; int status; struct stat statbuf; - if (stat (dpath, &statbuf) != 0) + if (stat (dir, &statbuf) != 0) return -1; /* errno already set */ if (!S_ISDIR (statbuf.st_mode)) @@ -54,7 +55,7 @@ rmdir (char const *dpath) return -1; /* errno already set */ case 0: /* child process */ - execl ("/bin/rmdir", "rmdir", dpath, (char *) 0); + execl ("/bin/rmdir", "rmdir", dir, (char *) 0); _exit (1); default: /* parent process */ diff --git a/lib/same.c b/lib/same.c index ecbc58fdb..89ee47dd0 100644 --- a/lib/same.c +++ b/lib/same.c @@ -1,6 +1,6 @@ /* Determine whether two file names refer to the same file. - Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free + Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -72,7 +72,7 @@ same_name (const char *source, const char *dest) bool same = false; #if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX - /* This implementation silently truncates pathname components. If + /* This implementation silently truncates components of file names. If the base names might be truncated, check whether the truncated base names are the same, while checking the directories. */ size_t slen_max = HAVE_LONG_FILE_NAMES ? 255 : _POSIX_NAME_MAX; diff --git a/lib/savedir.c b/lib/savedir.c index 73cc374f4..4eeda0193 100644 --- a/lib/savedir.c +++ b/lib/savedir.c @@ -1,6 +1,6 @@ /* savedir.c -- save the list of files in a directory in a string - Copyright 1990, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free + Copyright 1990, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -57,7 +57,7 @@ #include "xalloc.h" -/* Return a freshly allocated string containing the filenames +/* Return a freshly allocated string containing the file names in directory DIR, separated by '\0' characters; the end is marked by two '\0' characters in a row. Return NULL (setting errno) if DIR cannot be opened, read, or closed. */ diff --git a/lib/stripslash.c b/lib/stripslash.c index 1a472f50a..870a66f38 100644 --- a/lib/stripslash.c +++ b/lib/stripslash.c @@ -1,5 +1,6 @@ /* stripslash.c -- remove redundant trailing slashes from a file name - Copyright (C) 1990, 2001, 2003, 2004 Free Software Foundation, Inc. + + Copyright (C) 1990, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,17 +22,17 @@ #include "dirname.h" -/* Remove trailing slashes from PATH. +/* Remove trailing slashes from FILE. Return true if a trailing slash was removed. - This is useful when using filename completion from a shell that + This is useful when using file name completion from a shell that adds a "/" after directory names (such as tcsh and bash), because the Unix rename and rmdir system calls return an "Invalid argument" error - when given a path that ends in "/" (except for the root directory). */ + when given a file that ends in "/" (except for the root directory). */ bool -strip_trailing_slashes (char *path) +strip_trailing_slashes (char *file) { - char *base = base_name (path); + char *base = base_name (file); char *base_lim = base + base_len (base); bool had_slash = (*base_lim != '\0'); *base_lim = '\0'; diff --git a/lib/tempname.c b/lib/tempname.c index 3de699b42..eda6235ae 100644 --- a/lib/tempname.c +++ b/lib/tempname.c @@ -78,8 +78,8 @@ # define __mkdir mkdir # define __open open # define __open64 open -# define __lxstat64(version, path, buf) lstat (path, buf) -# define __xstat64(version, path, buf) stat (path, buf) +# define __lxstat64(version, file, buf) lstat (file, buf) +# define __xstat64(version, file, buf) stat (file, buf) #endif #if ! (HAVE___SECURE_GETENV || _LIBC) @@ -185,7 +185,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, return 0; } -/* These are the characters used in temporary filenames. */ +/* These are the characters used in temporary file names. */ static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; diff --git a/lib/xreadlink.c b/lib/xreadlink.c index 0e260757c..d56d2a6af 100644 --- a/lib/xreadlink.c +++ b/lib/xreadlink.c @@ -1,6 +1,6 @@ /* xreadlink.c -- readlink wrapper to return the link name in malloc'd storage - Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ #include "xalloc.h" -/* Call readlink to get the symbolic link value of FILENAME. +/* Call readlink to get the symbolic link value of FILE. SIZE is a hint as to how long the link is expected to be; typically it is taken from st_size. It need not be correct. Return a pointer to that NUL-terminated string in malloc'd storage. @@ -54,7 +54,7 @@ give a diagnostic and exit. */ char * -xreadlink (char const *filename, size_t size) +xreadlink (char const *file, size_t size) { /* The initial buffer size for the link value. A power of 2 detects arithmetic overflow earlier, but is not required. */ @@ -63,7 +63,7 @@ xreadlink (char const *filename, size_t size) while (1) { char *buffer = xmalloc (buf_size); - ssize_t r = readlink (filename, buffer, buf_size); + ssize_t r = readlink (file, buffer, buf_size); size_t link_length = r; /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1 |