From 97603a5d2adc889186f2934624a95c92dbfa2fdd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 2 Jun 2005 05:17:24 +0000 Subject: Don't use "path" or "filename". --- src/basename.c | 4 +- src/copy.c | 366 ++++++++++++++++++++++++++++----------------------------- src/copy.h | 10 +- src/cp-hash.c | 20 ++-- src/cp-hash.h | 2 +- src/dirname.c | 2 +- src/du.c | 2 +- src/mkdir.c | 6 +- src/mv.c | 4 +- src/nohup.c | 4 +- src/pinky.c | 4 +- src/pr.c | 2 +- src/remove.c | 4 +- src/sort.c | 2 +- src/system.h | 4 +- src/tty.c | 4 +- src/who.c | 4 +- 17 files changed, 222 insertions(+), 222 deletions(-) diff --git a/src/basename.c b/src/basename.c index 31bdcecf9..4450abe39 100644 --- a/src/basename.c +++ b/src/basename.c @@ -1,4 +1,4 @@ -/* basename -- strip directory and suffix from filenames +/* basename -- strip directory and suffix from file names Copyright (C) 1990-1997, 1999-2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -16,7 +16,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Usage: basename name [suffix] - NAME is a pathname; SUFFIX is a suffix to strip from it. + NAME is a file name; SUFFIX is a suffix to strip from it. basename /usr/foo/lossage/functions.l => functions.l diff --git a/src/copy.c b/src/copy.c index ada111e3a..6a0ec7520 100644 --- a/src/copy.c +++ b/src/copy.c @@ -36,11 +36,11 @@ #include "dirname.h" #include "euidaccess.h" #include "error.h" +#include "filenamecat.h" #include "full-write.h" #include "getpagesize.h" #include "hash.h" #include "hash-pjw.h" -#include "path-concat.h" #include "quote.h" #include "same.h" #include "savedir.h" @@ -77,7 +77,7 @@ struct F_triple /* Initial size of the above hash table. */ #define DEST_INFO_INITIAL_CAPACITY 61 -static bool copy_internal (const char *src_path, const char *dst_path, +static bool copy_internal (char const *src_name, char const *dst_name, bool new_dst, dev_t device, struct dir_list *ancestors, const struct cp_options *x, @@ -87,8 +87,8 @@ static bool copy_internal (const char *src_path, const char *dst_path, /* Pointers to the file names: they're used in the diagnostic that is issued when we detect the user is trying to copy a directory into itself. */ -static char const *top_level_src_path; -static char const *top_level_dst_path; +static char const *top_level_src_name; +static char const *top_level_dst_name; /* The invocation name of this program. */ extern char *program_name; @@ -130,16 +130,16 @@ is_ancestor (const struct stat *sb, const struct dir_list *ancestors) return false; } -/* Read the contents of the directory SRC_PATH_IN, and recursively - copy the contents to DST_PATH_IN. NEW_DST is true if - DST_PATH_IN is a directory that was created previously in the - recursion. SRC_SB and ANCESTORS describe SRC_PATH_IN. - Set *COPY_INTO_SELF if SRC_PATH_IN is a parent of - (or the same as) DST_PATH_IN; otherwise, clear it. +/* Read the contents of the directory SRC_NAME_IN, and recursively + copy the contents to DST_NAME_IN. NEW_DST is true if + DST_NAME_IN is a directory that was created previously in the + recursion. SRC_SB and ANCESTORS describe SRC_NAME_IN. + Set *COPY_INTO_SELF if SRC_NAME_IN is a parent of + (or the same as) DST_NAME_IN; otherwise, clear it. Return true if successful. */ static bool -copy_dir (const char *src_path_in, const char *dst_path_in, bool new_dst, +copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst, const struct stat *src_sb, struct dir_list *ancestors, const struct cp_options *x, bool *copy_into_self) { @@ -148,12 +148,12 @@ copy_dir (const char *src_path_in, const char *dst_path_in, bool new_dst, struct cp_options non_command_line_options = *x; bool ok = true; - name_space = savedir (src_path_in); + name_space = savedir (src_name_in); if (name_space == NULL) { /* This diagnostic is a bit vague because savedir can fail in several different ways. */ - error (0, errno, _("cannot access %s"), quote (src_path_in)); + error (0, errno, _("cannot access %s"), quote (src_name_in)); return false; } @@ -166,16 +166,16 @@ copy_dir (const char *src_path_in, const char *dst_path_in, bool new_dst, while (*namep != '\0') { bool local_copy_into_self; - char *src_path = path_concat (src_path_in, namep, NULL); - char *dst_path = path_concat (dst_path_in, namep, NULL); + char *src_name = file_name_concat (src_name_in, namep, NULL); + char *dst_name = file_name_concat (dst_name_in, namep, NULL); - ok &= copy_internal (src_path, dst_path, new_dst, src_sb->st_dev, + ok &= copy_internal (src_name, dst_name, new_dst, src_sb->st_dev, ancestors, &non_command_line_options, false, &local_copy_into_self, NULL); *copy_into_self |= local_copy_into_self; - free (dst_path); - free (src_path); + free (dst_name); + free (src_name); namep += strlen (namep) + 1; } @@ -183,7 +183,7 @@ copy_dir (const char *src_path_in, const char *dst_path_in, bool new_dst, return ok; } -/* Copy a regular file from SRC_PATH to DST_PATH. +/* Copy a regular file from SRC_NAME to DST_NAME. If the source file contains holes, copies holes and blocks of zeros in the source file as holes in the destination file. (Holes are read as zeroes by the `read' system call.) @@ -191,10 +191,10 @@ copy_dir (const char *src_path_in, const char *dst_path_in, bool new_dst, X provides many option settings. Return true if successful. *NEW_DST is as in copy_internal. SRC_SB is the result - of calling xstat (aka stat in this case) on SRC_PATH. */ + of calling xstat (aka stat in this case) on SRC_NAME. */ static bool -copy_reg (const char *src_path, const char *dst_path, +copy_reg (char const *src_name, char const *dst_name, const struct cp_options *x, mode_t dst_mode, bool *new_dst, struct stat const *src_sb) { @@ -212,17 +212,17 @@ copy_reg (const char *src_path, const char *dst_path, bool last_write_made_hole = false; bool make_holes = false; - source_desc = open (src_path, O_RDONLY); + source_desc = open (src_name, O_RDONLY); source_desc = fd_safer (source_desc); if (source_desc < 0) { - error (0, errno, _("cannot open %s for reading"), quote (src_path)); + error (0, errno, _("cannot open %s for reading"), quote (src_name)); return false; } if (fstat (source_desc, &src_open_sb)) { - error (0, errno, _("cannot fstat %s"), quote (src_path)); + error (0, errno, _("cannot fstat %s"), quote (src_name)); return_val = false; goto close_src_desc; } @@ -233,7 +233,7 @@ copy_reg (const char *src_path, const char *dst_path, { error (0, 0, _("skipping file %s, as it was replaced while being copied"), - quote (src_path)); + quote (src_name)); return_val = false; goto close_src_desc; } @@ -242,17 +242,17 @@ copy_reg (const char *src_path, const char *dst_path, The if-block will be taken in move_mode. */ if (*new_dst) { - dest_desc = open (dst_path, O_WRONLY | O_CREAT, dst_mode); + dest_desc = open (dst_name, O_WRONLY | O_CREAT, dst_mode); } else { - dest_desc = open (dst_path, O_WRONLY | O_TRUNC, dst_mode); + dest_desc = open (dst_name, O_WRONLY | O_TRUNC, dst_mode); if (dest_desc < 0 && x->unlink_dest_after_failed_open) { - if (unlink (dst_path)) + if (unlink (dst_name) != 0) { - error (0, errno, _("cannot remove %s"), quote (dst_path)); + error (0, errno, _("cannot remove %s"), quote (dst_name)); return_val = false; goto close_src_desc; } @@ -261,14 +261,14 @@ copy_reg (const char *src_path, const char *dst_path, *new_dst = true; /* Try the open again, but this time with different flags. */ - dest_desc = open (dst_path, O_WRONLY | O_CREAT, dst_mode); + dest_desc = open (dst_name, O_WRONLY | O_CREAT, dst_mode); } } dest_desc = fd_safer (dest_desc); if (dest_desc < 0) { - error (0, errno, _("cannot create regular file %s"), quote (dst_path)); + error (0, errno, _("cannot create regular file %s"), quote (dst_name)); return_val = false; goto close_src_desc; } @@ -278,7 +278,7 @@ copy_reg (const char *src_path, const char *dst_path, if (fstat (dest_desc, &sb)) { - error (0, errno, _("cannot fstat %s"), quote (dst_path)); + error (0, errno, _("cannot fstat %s"), quote (dst_name)); return_val = false; goto close_src_and_dst_desc; } @@ -293,12 +293,12 @@ copy_reg (const char *src_path, const char *dst_path, #if HAVE_STRUCT_STAT_ST_BLOCKS if (x->sparse_mode == SPARSE_AUTO && S_ISREG (sb.st_mode)) { - /* Use a heuristic to determine whether SRC_PATH contains any + /* Use a heuristic to determine whether SRC_NAME contains any sparse blocks. */ if (fstat (source_desc, &sb)) { - error (0, errno, _("cannot fstat %s"), quote (src_path)); + error (0, errno, _("cannot fstat %s"), quote (src_name)); return_val = false; goto close_src_and_dst_desc; } @@ -327,7 +327,7 @@ copy_reg (const char *src_path, const char *dst_path, if (errno == EINTR) continue; #endif - error (0, errno, _("reading %s"), quote (src_path)); + error (0, errno, _("reading %s"), quote (src_name)); return_val = false; goto close_src_and_dst_desc; } @@ -361,7 +361,7 @@ copy_reg (const char *src_path, const char *dst_path, /* Make a hole. */ if (lseek (dest_desc, (off_t) n_read, SEEK_CUR) < 0L) { - error (0, errno, _("cannot lseek %s"), quote (dst_path)); + error (0, errno, _("cannot lseek %s"), quote (dst_name)); return_val = false; goto close_src_and_dst_desc; } @@ -376,7 +376,7 @@ copy_reg (const char *src_path, const char *dst_path, size_t n = n_read; if (full_write (dest_desc, buf, n) != n) { - error (0, errno, _("writing %s"), quote (dst_path)); + error (0, errno, _("writing %s"), quote (dst_name)); return_val = false; goto close_src_and_dst_desc; } @@ -400,7 +400,7 @@ copy_reg (const char *src_path, const char *dst_path, || full_write (dest_desc, "", 1) != 1) #endif { - error (0, errno, _("writing %s"), quote (dst_path)); + error (0, errno, _("writing %s"), quote (dst_name)); return_val = false; } } @@ -408,13 +408,13 @@ copy_reg (const char *src_path, const char *dst_path, close_src_and_dst_desc: if (close (dest_desc) < 0) { - error (0, errno, _("closing %s"), quote (dst_path)); + error (0, errno, _("closing %s"), quote (dst_name)); return_val = false; } close_src_desc: if (close (source_desc) < 0) { - error (0, errno, _("closing %s"), quote (src_path)); + error (0, errno, _("closing %s"), quote (src_name)); return_val = false; } @@ -439,8 +439,8 @@ close_src_desc: successfully. */ static bool -same_file_ok (const char *src_path, const struct stat *src_sb, - const char *dst_path, const struct stat *dst_sb, +same_file_ok (char const *src_name, struct stat const *src_sb, + char const *dst_name, struct stat const *dst_sb, const struct cp_options *x, bool *return_now, bool *unlink_src) { const struct stat *src_sb_link; @@ -473,7 +473,7 @@ same_file_ok (const char *src_path, const struct stat *src_sb, know this here IFF preserving symlinks (aka xstat == lstat), then it's ok -- as long as they are distinct. */ if (S_ISLNK (src_sb->st_mode) && S_ISLNK (dst_sb->st_mode)) - return ! same_name (src_path, dst_path); + return ! same_name (src_name, dst_name); src_sb_link = src_sb; dst_sb_link = dst_sb; @@ -483,8 +483,8 @@ same_file_ok (const char *src_path, const struct stat *src_sb, if (!same) return true; - if (lstat (dst_path, &tmp_dst_sb) - || lstat (src_path, &tmp_src_sb)) + if (lstat (dst_name, &tmp_dst_sb) != 0 + || lstat (src_name, &tmp_src_sb) != 0) return true; src_sb_link = &tmp_src_sb; @@ -536,17 +536,17 @@ same_file_ok (const char *src_path, const struct stat *src_sb, return true; } - return ! same_name (src_path, dst_path); + return ! same_name (src_name, dst_name); } #if 0 /* FIXME: use or remove */ /* If we're making a backup, we'll detect the problem case in - copy_reg because SRC_PATH will no longer exist. Allowing + copy_reg because SRC_NAME will no longer exist. Allowing the test to be deferred lets cp do some useful things. - But when creating hardlinks and SRC_PATH is a symlink - but DST_PATH is not we must test anyway. */ + But when creating hardlinks and SRC_NAME is a symlink + but DST_NAME is not we must test anyway. */ if (x->hard_link || !S_ISLNK (src_sb_link->st_mode) || S_ISLNK (dst_sb_link->st_mode)) @@ -559,7 +559,7 @@ same_file_ok (const char *src_path, const struct stat *src_sb, /* They may refer to the same file if we're in move mode and the target is a symlink. That is ok, since we remove any existing destination file before opening it -- via `rename' if they're on - the same file system, via `unlink (DST_PATH)' otherwise. + the same file system, via `unlink (DST_NAME)' otherwise. It's also ok if they're distinct hard links to the same file. */ if (x->move_mode || x->unlink_dest_before_opening) { @@ -568,7 +568,7 @@ same_file_ok (const char *src_path, const struct stat *src_sb, if (same_link && 1 < dst_sb_link->st_nlink - && ! same_name (src_path, dst_path)) + && ! same_name (src_name, dst_name)) { if (x->move_mode) { @@ -605,12 +605,12 @@ same_file_ok (const char *src_path, const struct stat *src_sb, { if ( ! S_ISLNK (src_sb_link->st_mode)) tmp_src_sb = *src_sb_link; - else if (stat (src_path, &tmp_src_sb)) + else if (stat (src_name, &tmp_src_sb) != 0) return true; if ( ! S_ISLNK (dst_sb_link->st_mode)) tmp_dst_sb = *dst_sb_link; - else if (stat (dst_path, &tmp_dst_sb)) + else if (stat (dst_name, &tmp_dst_sb) != 0) return true; if ( ! SAME_INODE (tmp_src_sb, tmp_dst_sb)) @@ -628,19 +628,19 @@ same_file_ok (const char *src_path, const struct stat *src_sb, } static void -overwrite_prompt (char const *dst_path, struct stat const *dst_sb) +overwrite_prompt (char const *dst_name, struct stat const *dst_sb) { - if (euidaccess (dst_path, W_OK) != 0) + if (euidaccess (dst_name, W_OK) != 0) { fprintf (stderr, _("%s: overwrite %s, overriding mode %04lo? "), - program_name, quote (dst_path), + program_name, quote (dst_name), (unsigned long int) (dst_sb->st_mode & CHMOD_MODE_BITS)); } else { fprintf (stderr, _("%s: overwrite %s? "), - program_name, quote (dst_path)); + program_name, quote (dst_name)); } } @@ -728,9 +728,9 @@ src_info_init (struct cp_options *x) } /* Return true if there is an entry in hash table, HT, - for the file described by FILENAME and STATS. */ + for the file described by FILE and STATS. */ static bool -seen_file (Hash_table const *ht, char const *filename, +seen_file (Hash_table const *ht, char const *file, struct stat const *stats) { struct F_triple new_ent; @@ -738,20 +738,20 @@ seen_file (Hash_table const *ht, char const *filename, if (ht == NULL) return false; - new_ent.name = (char *) filename; + new_ent.name = (char *) file; new_ent.st_ino = stats->st_ino; new_ent.st_dev = stats->st_dev; return !!hash_lookup (ht, &new_ent); } -/* Record destination filename, FILENAME, and dev/ino from *STATS, +/* Record destination file, FILE, and dev/ino from *STATS, in the hash table, HT. If HT is NULL, return immediately. - If STATS is NULL, call lstat on FILENAME to get the device + If STATS is NULL, call lstat on FILE to get the device and inode numbers. If that lstat fails, simply return. If memory allocation fails, exit immediately. */ static void -record_file (Hash_table *ht, char const *filename, +record_file (Hash_table *ht, char const *file, struct stat const *stats) { struct F_triple *ent; @@ -760,7 +760,7 @@ record_file (Hash_table *ht, char const *filename, return; ent = xmalloc (sizeof *ent); - ent->name = xstrdup (filename); + ent->name = xstrdup (file); if (stats) { ent->st_ino = stats->st_ino; @@ -769,7 +769,7 @@ record_file (Hash_table *ht, char const *filename, else { struct stat sb; - if (lstat (filename, &sb)) + if (lstat (file, &sb) != 0) return; ent->st_ino = sb.st_ino; ent->st_dev = sb.st_dev; @@ -792,15 +792,15 @@ record_file (Hash_table *ht, char const *filename, } } -/* When effecting a move (e.g., for mv(1)), and given the name DST_PATH +/* When effecting a move (e.g., for mv(1)), and given the name DST_NAME of the destination and a corresponding stat buffer, DST_SB, return true if the logical `move' operation should _not_ proceed. Otherwise, return false. Depending on options specified in X, this code may issue an - interactive prompt asking whether it's ok to overwrite DST_PATH. */ + interactive prompt asking whether it's ok to overwrite DST_NAME. */ static bool abandon_move (const struct cp_options *x, - char const *dst_path, + char const *dst_name, struct stat const *dst_sb) { assert (x->move_mode); @@ -808,25 +808,25 @@ abandon_move (const struct cp_options *x, || ((x->interactive == I_ASK_USER || (x->interactive == I_UNSPECIFIED && x->stdin_tty - && UNWRITABLE (dst_path, dst_sb->st_mode))) - && (overwrite_prompt (dst_path, dst_sb), 1) + && UNWRITABLE (dst_name, dst_sb->st_mode))) + && (overwrite_prompt (dst_name, dst_sb), 1) && ! yesno ())); } -/* Copy the file SRC_PATH to the file DST_PATH. The files may be of - any type. NEW_DST should be true if the file DST_PATH cannot +/* Copy the file SRC_NAME to the file DST_NAME. The files may be of + any type. NEW_DST should be true if the file DST_NAME cannot exist because its parent directory was just created; NEW_DST should - be false if DST_PATH might already exist. DEVICE is the device + be false if DST_NAME might already exist. DEVICE is the device number of the parent directory, or 0 if the parent of this file is not known. ANCESTORS points to a linked, null terminated list of - devices and inodes of parent directories of SRC_PATH. COMMAND_LINE_ARG - is true iff SRC_PATH was specified on the command line. - Set *COPY_INTO_SELF if SRC_PATH is a parent of (or the - same as) DST_PATH; otherwise, clear it. + devices and inodes of parent directories of SRC_NAME. COMMAND_LINE_ARG + is true iff SRC_NAME was specified on the command line. + Set *COPY_INTO_SELF if SRC_NAME is a parent of (or the + same as) DST_NAME; otherwise, clear it. Return true if successful. */ static bool -copy_internal (const char *src_path, const char *dst_path, +copy_internal (char const *src_name, char const *dst_name, bool new_dst, dev_t device, struct dir_list *ancestors, @@ -852,9 +852,9 @@ copy_internal (const char *src_path, const char *dst_path, *copy_into_self = false; - if (XSTAT (x, src_path, &src_sb)) + if (XSTAT (x, src_name, &src_sb) != 0) { - error (0, errno, _("cannot stat %s"), quote (src_path)); + error (0, errno, _("cannot stat %s"), quote (src_name)); return false; } @@ -864,7 +864,7 @@ copy_internal (const char *src_path, const char *dst_path, if (S_ISDIR (src_type) && !x->recursive) { - error (0, 0, _("omitting directory %s"), quote (src_path)); + error (0, 0, _("omitting directory %s"), quote (src_name)); return false; } @@ -876,23 +876,23 @@ copy_internal (const char *src_path, const char *dst_path, { if ( ! S_ISDIR (src_sb.st_mode) && x->backup_type == no_backups - && seen_file (x->src_info, src_path, &src_sb)) + && seen_file (x->src_info, src_name, &src_sb)) { error (0, 0, _("warning: source file %s specified more than once"), - quote (src_path)); + quote (src_name)); return true; } - record_file (x->src_info, src_path, &src_sb); + record_file (x->src_info, src_name, &src_sb); } if (!new_dst) { - if (XSTAT (x, dst_path, &dst_sb)) + if (XSTAT (x, dst_name, &dst_sb) != 0) { if (errno != ENOENT) { - error (0, errno, _("cannot stat %s"), quote (dst_path)); + error (0, errno, _("cannot stat %s"), quote (dst_name)); return false; } else @@ -904,17 +904,17 @@ copy_internal (const char *src_path, const char *dst_path, { bool return_now; bool unlink_src; - bool ok = same_file_ok (src_path, &src_sb, dst_path, &dst_sb, + bool ok = same_file_ok (src_name, &src_sb, dst_name, &dst_sb, x, &return_now, &unlink_src); if (unlink_src) { - if (!abandon_move (x, dst_path, &dst_sb) - && unlink (src_path)) + if (!abandon_move (x, dst_name, &dst_sb) + && unlink (src_name) != 0) { - error (0, errno, _("cannot remove %s"), quote (src_path)); + error (0, errno, _("cannot remove %s"), quote (src_name)); return false; } - /* Tell the caller that there's no need to remove src_path. */ + /* Tell the caller that there's no need to remove src_name. */ if (rename_succeeded) *rename_succeeded = true; } @@ -925,7 +925,7 @@ copy_internal (const char *src_path, const char *dst_path, if (! ok) { error (0, 0, _("%s and %s are the same file"), - quote_n (0, src_path), quote_n (1, dst_path)); + quote_n (0, src_name), quote_n (1, dst_name)); return false; } @@ -935,7 +935,7 @@ copy_internal (const char *src_path, const char *dst_path, { error (0, 0, _("cannot overwrite non-directory %s with directory %s"), - quote_n (0, dst_path), quote_n (1, src_path)); + quote_n (0, dst_name), quote_n (1, src_name)); return false; } @@ -948,11 +948,11 @@ copy_internal (const char *src_path, const char *dst_path, Note that it works fine if you use --backup=numbered. */ if (command_line_arg && x->backup_type != numbered_backups - && seen_file (x->dest_info, dst_path, &dst_sb)) + && seen_file (x->dest_info, dst_name, &dst_sb)) { error (0, 0, _("will not overwrite just-created %s with %s"), - quote_n (0, dst_path), quote_n (1, src_path)); + quote_n (0, dst_name), quote_n (1, src_name)); return false; } } @@ -963,7 +963,7 @@ copy_internal (const char *src_path, const char *dst_path, { error (0, 0, _("cannot overwrite directory %s with non-directory"), - quote (dst_path)); + quote (dst_name)); return false; } @@ -979,7 +979,7 @@ copy_internal (const char *src_path, const char *dst_path, ? UTIMECMP_TRUNCATE_SOURCE : 0); - if (0 <= utimecmp (dst_path, &dst_sb, &src_sb, options)) + if (0 <= utimecmp (dst_name, &dst_sb, &src_sb, options)) { /* We're using --update and the destination is not older than the source, so do not copy or move. Pretend the @@ -1002,7 +1002,7 @@ copy_internal (const char *src_path, const char *dst_path, /* cp and mv treat -i and -f differently. */ if (x->move_mode) { - if (abandon_move (x, dst_path, &dst_sb)) + if (abandon_move (x, dst_name, &dst_sb)) { /* Pretend the rename succeeded, so the caller (mv) doesn't end up removing the source file. */ @@ -1015,7 +1015,7 @@ copy_internal (const char *src_path, const char *dst_path, { if (x->interactive == I_ALWAYS_NO || (x->interactive == I_ASK_USER - && (overwrite_prompt (dst_path, &dst_sb), 1) + && (overwrite_prompt (dst_name, &dst_sb), 1) && ! yesno ())) { return true; @@ -1029,7 +1029,7 @@ copy_internal (const char *src_path, const char *dst_path, if (S_ISDIR (dst_sb.st_mode)) { error (0, 0, _("cannot overwrite directory %s"), - quote (dst_path)); + quote (dst_name)); return false; } @@ -1038,14 +1038,14 @@ copy_internal (const char *src_path, const char *dst_path, { error (0, 0, _("cannot move directory onto non-directory: %s -> %s"), - quote_n (0, src_path), quote_n (0, dst_path)); + quote_n (0, src_name), quote_n (0, dst_name)); return false; } } if (x->backup_type != no_backups && !S_ISDIR (dst_sb.st_mode)) { - char *tmp_backup = find_backup_file_name (dst_path, + char *tmp_backup = find_backup_file_name (dst_name, x->backup_type); /* Detect (and fail) when creating the backup file would @@ -1054,31 +1054,31 @@ copy_internal (const char *src_path, const char *dst_path, would leave two zero-length files: a and a~. */ /* FIXME: but simply change e.g., the final a~ to `./a~' and the source will still be destroyed. */ - if (STREQ (tmp_backup, src_path)) + if (STREQ (tmp_backup, src_name)) { const char *fmt; fmt = (x->move_mode ? _("backing up %s would destroy source; %s not moved") : _("backing up %s would destroy source; %s not copied")); error (0, 0, fmt, - quote_n (0, dst_path), - quote_n (1, src_path)); + quote_n (0, dst_name), + quote_n (1, src_name)); free (tmp_backup); return false; } /* FIXME: use fts: - Using alloca for a pathname that may be (in theory) arbitrarily + Using alloca for a file name that may be arbitrarily long is not recommended. In fact, even forming such a name should be discouraged. Eventually, this code will be rewritten to use fts, so using alloca here will be less of a problem. */ ASSIGN_STRDUPA (dst_backup, tmp_backup); free (tmp_backup); - if (rename (dst_path, dst_backup)) + if (rename (dst_name, dst_backup) != 0) { if (errno != ENOENT) { - error (0, errno, _("cannot backup %s"), quote (dst_path)); + error (0, errno, _("cannot backup %s"), quote (dst_name)); return false; } else @@ -1098,9 +1098,9 @@ copy_internal (const char *src_path, const char *dst_path, || (x->dereference == DEREF_NEVER && S_ISLNK (src_sb.st_mode)))) { - if (unlink (dst_path) && errno != ENOENT) + if (unlink (dst_name) != 0 && errno != ENOENT) { - error (0, errno, _("cannot remove %s"), quote (dst_path)); + error (0, errno, _("cannot remove %s"), quote (dst_name)); return false; } new_dst = true; @@ -1113,13 +1113,13 @@ copy_internal (const char *src_path, const char *dst_path, sure we'll create a directory. */ if (x->verbose && !S_ISDIR (src_type)) { - printf ("%s -> %s", quote_n (0, src_path), quote_n (1, dst_path)); + printf ("%s -> %s", quote_n (0, src_name), quote_n (1, dst_name)); if (backup_succeeded) printf (_(" (backup: %s)"), quote (dst_backup)); putchar ('\n'); } - /* Associate the destination path with the source device and inode + /* Associate the destination file name with the source device and inode so that if we encounter a matching dev/ino pair in the source tree we can arrange to create a hard link between the corresponding names in the destination tree. @@ -1161,7 +1161,7 @@ copy_internal (const char *src_path, const char *dst_path, || x->dereference == DEREF_ALWAYS)) || (x->recursive && S_ISDIR (src_type))) { - earlier_file = remember_copied (dst_path, src_sb.st_ino, src_sb.st_dev); + earlier_file = remember_copied (dst_name, src_sb.st_ino, src_sb.st_dev); } /* Did we copy this inode somewhere else (in this command line argument) @@ -1174,43 +1174,43 @@ copy_internal (const char *src_path, const char *dst_path, directories). */ if (S_ISDIR (src_type)) { - /* If src_path and earlier_file refer to the same directory entry, + /* If src_name and earlier_file refer to the same directory entry, then warn about copying a directory into itself. */ - if (same_name (src_path, earlier_file)) + if (same_name (src_name, earlier_file)) { error (0, 0, _("cannot copy a directory, %s, into itself, %s"), - quote_n (0, top_level_src_path), - quote_n (1, top_level_dst_path)); + quote_n (0, top_level_src_name), + quote_n (1, top_level_dst_name)); *copy_into_self = true; } else { error (0, 0, _("will not create hard link %s to directory %s"), - quote_n (0, dst_path), quote_n (1, earlier_file)); + quote_n (0, dst_name), quote_n (1, earlier_file)); } goto un_backup; } { - bool link_failed = (link (earlier_file, dst_path) != 0); + bool link_failed = (link (earlier_file, dst_name) != 0); /* If the link failed because of an existing destination, remove that file and then call link again. */ if (link_failed && errno == EEXIST) { - if (unlink (dst_path)) + if (unlink (dst_name) != 0) { - error (0, errno, _("cannot remove %s"), quote (dst_path)); + error (0, errno, _("cannot remove %s"), quote (dst_name)); goto un_backup; } - link_failed = (link (earlier_file, dst_path) != 0); + link_failed = (link (earlier_file, dst_name) != 0); } if (link_failed) { error (0, errno, _("cannot create hard link %s to %s"), - quote_n (0, dst_path), quote_n (1, earlier_file)); + quote_n (0, dst_name), quote_n (1, earlier_file)); goto un_backup; } @@ -1220,23 +1220,23 @@ copy_internal (const char *src_path, const char *dst_path, if (x->move_mode) { - if (rename (src_path, dst_path) == 0) + if (rename (src_name, dst_name) == 0) { if (x->verbose && S_ISDIR (src_type)) - printf ("%s -> %s\n", quote_n (0, src_path), quote_n (1, dst_path)); + printf ("%s -> %s\n", quote_n (0, src_name), quote_n (1, dst_name)); if (rename_succeeded) *rename_succeeded = true; if (command_line_arg) { - /* Record destination dev/ino/filename, so that if we are asked + /* Record destination dev/ino/name, so that if we are asked to overwrite that file again, we can detect it and fail. */ /* It's fine to use the _source_ stat buffer (src_sb) to get the _destination_ dev/ino, since the rename above can't have changed those, and `mv' always uses lstat. We could limit it further by operating only on non-directories. */ - record_file (x->dest_info, dst_path, &src_sb); + record_file (x->dest_info, dst_name, &src_sb); } return true; @@ -1249,7 +1249,7 @@ copy_internal (const char *src_path, const char *dst_path, subdirectory of itself. */ if (errno == EINVAL - /* When src_path is on an NFS file system, some types of + /* When src_name is on an NFS file system, some types of clients, e.g., SunOS4.1.4 and IRIX-5.3, set errno to EIO instead. Testing for this here risks misinterpreting a real I/O error as an attempt to move a directory into itself, so @@ -1264,8 +1264,8 @@ copy_internal (const char *src_path, const char *dst_path, failing with a specific errno value. Expect problems on non-POSIX systems. */ error (0, 0, _("cannot move %s to a subdirectory of itself, %s"), - quote_n (0, top_level_src_path), - quote_n (1, top_level_dst_path)); + quote_n (0, top_level_src_name), + quote_n (1, top_level_dst_name)); /* Note that there is no need to call forget_created here, (compare with the other calls in this file) since the @@ -1307,7 +1307,7 @@ copy_internal (const char *src_path, const char *dst_path, fail. Etc. */ error (0, errno, _("cannot move %s to %s"), - quote_n (0, src_path), quote_n (1, dst_path)); + quote_n (0, src_name), quote_n (1, dst_name)); forget_created (src_sb.st_ino, src_sb.st_dev); return false; } @@ -1315,11 +1315,11 @@ copy_internal (const char *src_path, const char *dst_path, /* The rename attempt has failed. Remove any existing destination file so that a cross-device `mv' acts as if it were really using the rename syscall. */ - if (unlink (dst_path) && errno != ENOENT) + if (unlink (dst_name) != 0 && errno != ENOENT) { error (0, errno, _("inter-device move failed: %s to %s; unable to remove target"), - quote_n (0, src_path), quote_n (1, dst_path)); + quote_n (0, src_name), quote_n (1, dst_name)); forget_created (src_sb.st_ino, src_sb.st_dev); return false; } @@ -1347,7 +1347,7 @@ copy_internal (const char *src_path, const char *dst_path, if (is_ancestor (&src_sb, ancestors)) { error (0, 0, _("cannot copy cyclic symbolic link %s"), - quote (src_path)); + quote (src_name)); goto un_backup; } @@ -1363,10 +1363,10 @@ copy_internal (const char *src_path, const char *dst_path, /* Create the new directory writable and searchable, so we can create new entries in it. */ - if (mkdir (dst_path, (src_mode & x->umask_kill) | S_IRWXU)) + if (mkdir (dst_name, (src_mode & x->umask_kill) | S_IRWXU) != 0) { error (0, errno, _("cannot create directory %s"), - quote (dst_path)); + quote (dst_name)); goto un_backup; } @@ -1374,11 +1374,11 @@ copy_internal (const char *src_path, const char *dst_path, numbers into the search structure, so that we can avoid copying it again. */ - if (! remember_created (dst_path)) + if (! remember_created (dst_name)) goto un_backup; if (x->verbose) - printf ("%s -> %s\n", quote_n (0, src_path), quote_n (1, dst_path)); + printf ("%s -> %s\n", quote_n (0, src_name), quote_n (1, dst_name)); } /* Are we crossing a file system boundary? */ @@ -1387,7 +1387,7 @@ copy_internal (const char *src_path, const char *dst_path, /* Copy the contents of the directory. */ - if (! copy_dir (src_path, dst_path, new_dst, &src_sb, dir, x, + if (! copy_dir (src_name, dst_name, new_dst, &src_sb, dir, x, copy_into_self)) { /* Don't just return here -- otherwise, the failure to read a @@ -1401,19 +1401,19 @@ copy_internal (const char *src_path, const char *dst_path, { preserve_metadata = false; - if (*src_path != '/') + if (*src_name != '/') { - /* Check that DST_PATH denotes a file in the current directory. */ + /* Check that DST_NAME denotes a file in the current directory. */ struct stat dot_sb; struct stat dst_parent_sb; char *dst_parent; bool in_current_dir; - dst_parent = dir_name (dst_path); + dst_parent = dir_name (dst_name); in_current_dir = (STREQ (".", dst_parent) /* If either stat call fails, it's ok not to report - the failure and say dst_path is in the current + the failure and say dst_name is in the current directory. Other things will fail later. */ || stat (".", &dot_sb) || stat (dst_parent, &dst_parent_sb) @@ -1424,14 +1424,14 @@ copy_internal (const char *src_path, const char *dst_path, { error (0, 0, _("%s: can make relative symbolic links only in current directory"), - quote (dst_path)); + quote (dst_name)); goto un_backup; } } - if (symlink (src_path, dst_path)) + if (symlink (src_name, dst_name) != 0) { error (0, errno, _("cannot create symbolic link %s to %s"), - quote_n (0, dst_path), quote_n (1, src_path)); + quote_n (0, dst_name), quote_n (1, src_name)); goto un_backup; } } @@ -1439,9 +1439,9 @@ copy_internal (const char *src_path, const char *dst_path, else if (x->hard_link) { preserve_metadata = false; - if (link (src_path, dst_path)) + if (link (src_name, dst_name)) { - error (0, errno, _("cannot create link %s"), quote (dst_path)); + error (0, errno, _("cannot create link %s"), quote (dst_name)); goto un_backup; } } @@ -1453,7 +1453,7 @@ copy_internal (const char *src_path, const char *dst_path, /* POSIX says the permission bits of the source file must be used as the 3rd argument in the open call, but that's not consistent with historical practice. */ - if (! copy_reg (src_path, dst_path, x, + if (! copy_reg (src_name, dst_name, x, get_dest_mode (x, src_mode), &new_dst, &src_sb)) goto un_backup; } @@ -1461,9 +1461,9 @@ copy_internal (const char *src_path, const char *dst_path, #ifdef S_ISFIFO if (S_ISFIFO (src_type)) { - if (mkfifo (dst_path, get_dest_mode (x, src_mode))) + if (mkfifo (dst_name, get_dest_mode (x, src_mode))) { - error (0, errno, _("cannot create fifo %s"), quote (dst_path)); + error (0, errno, _("cannot create fifo %s"), quote (dst_name)); goto un_backup; } } @@ -1472,10 +1472,10 @@ copy_internal (const char *src_path, const char *dst_path, if (S_ISBLK (src_type) || S_ISCHR (src_type) || S_ISSOCK (src_type)) { - if (mknod (dst_path, get_dest_mode (x, src_mode), src_sb.st_rdev)) + if (mknod (dst_name, get_dest_mode (x, src_mode), src_sb.st_rdev)) { error (0, errno, _("cannot create special file %s"), - quote (dst_path)); + quote (dst_name)); goto un_backup; } } @@ -1483,14 +1483,14 @@ copy_internal (const char *src_path, const char *dst_path, #ifdef S_ISLNK if (S_ISLNK (src_type)) { - char *src_link_val = xreadlink (src_path, src_sb.st_size); + char *src_link_val = xreadlink (src_name, src_sb.st_size); if (src_link_val == NULL) { - error (0, errno, _("cannot read symbolic link %s"), quote (src_path)); + error (0, errno, _("cannot read symbolic link %s"), quote (src_name)); goto un_backup; } - if (!symlink (src_link_val, dst_path)) + if (symlink (src_link_val, dst_name) == 0) free (src_link_val); else { @@ -1503,7 +1503,7 @@ copy_internal (const char *src_path, const char *dst_path, FIXME: This behavior isn't documented, and seems wrong in some cases, e.g., if the destination symlink has the wrong ownership, permissions, or time stamps. */ - char *dest_link_val = xreadlink (dst_path, dst_sb.st_size); + char *dest_link_val = xreadlink (dst_name, dst_sb.st_size); if (STREQ (dest_link_val, src_link_val)) same_link = true; free (dest_link_val); @@ -1513,7 +1513,7 @@ copy_internal (const char *src_path, const char *dst_path, if (! same_link) { error (0, saved_errno, _("cannot create symbolic link %s"), - quote (dst_path)); + quote (dst_name)); goto un_backup; } } @@ -1526,11 +1526,11 @@ copy_internal (const char *src_path, const char *dst_path, /* Preserve the owner and group of the just-`copied' symbolic link, if possible. */ # if HAVE_LCHOWN - if (lchown (dst_path, src_sb.st_uid, src_sb.st_gid) != 0 + if (lchown (dst_name, src_sb.st_uid, src_sb.st_gid) != 0 && ! chown_failure_ok (x)) { error (0, errno, _("failed to preserve ownership for %s"), - dst_path); + dst_name); goto un_backup; } # else @@ -1544,12 +1544,12 @@ copy_internal (const char *src_path, const char *dst_path, else #endif { - error (0, 0, _("%s has unknown file type"), quote (src_path)); + error (0, 0, _("%s has unknown file type"), quote (src_name)); goto un_backup; } if (command_line_arg) - record_file (x->dest_info, dst_path, NULL); + record_file (x->dest_info, dst_name, NULL); if ( ! preserve_metadata) return true; @@ -1575,9 +1575,9 @@ copy_internal (const char *src_path, const char *dst_path, timespec[1].tv_sec = src_sb.st_mtime; timespec[1].tv_nsec = TIMESPEC_NS (src_sb.st_mtim); - if (utimens (dst_path, timespec)) + if (utimens (dst_name, timespec) != 0) { - error (0, errno, _("preserving times for %s"), quote (dst_path)); + error (0, errno, _("preserving times for %s"), quote (dst_name)); if (x->require_preserve) return false; } @@ -1587,12 +1587,12 @@ copy_internal (const char *src_path, const char *dst_path, if (x->preserve_ownership && (new_dst || !SAME_OWNER_AND_GROUP (src_sb, dst_sb))) { - if (chown (dst_path, src_sb.st_uid, src_sb.st_gid) == 0) + if (chown (dst_name, src_sb.st_uid, src_sb.st_gid) == 0) chown_succeeded = true; else if (! chown_failure_ok (x)) { error (0, errno, _("failed to preserve ownership for %s"), - quote (dst_path)); + quote (dst_name)); if (x->require_preserve) return false; } @@ -1601,15 +1601,15 @@ copy_internal (const char *src_path, const char *dst_path, #if HAVE_STRUCT_STAT_ST_AUTHOR /* Preserve the st_author field. */ { - file_t file = file_name_lookup (dst_path, 0, 0); + file_t file = file_name_lookup (dst_name, 0, 0); if (file == MACH_PORT_NULL) - error (0, errno, _("failed to lookup file %s"), quote (dst_path)); + error (0, errno, _("failed to lookup file %s"), quote (dst_name)); else { error_t err = file_chauthor (file, src_sb.st_author); if (err) error (0, err, _("failed to preserve authorship for %s"), - quote (dst_path)); + quote (dst_name)); mach_port_deallocate (mach_task_self (), file); } } @@ -1625,9 +1625,9 @@ copy_internal (const char *src_path, const char *dst_path, if ((x->preserve_mode || new_dst) && (x->copy_as_regular || S_ISREG (src_type) || S_ISDIR (src_type))) { - if (chmod (dst_path, get_dest_mode (x, src_mode))) + if (chmod (dst_name, get_dest_mode (x, src_mode)) != 0) { - error (0, errno, _("setting permissions for %s"), quote (dst_path)); + error (0, errno, _("setting permissions for %s"), quote (dst_name)); if (x->set_mode || x->require_preserve) return false; } @@ -1648,13 +1648,13 @@ un_backup: if (dst_backup) { - if (rename (dst_backup, dst_path)) - error (0, errno, _("cannot un-backup %s"), quote (dst_path)); + if (rename (dst_backup, dst_name) != 0) + error (0, errno, _("cannot un-backup %s"), quote (dst_name)); else { if (x->verbose) printf (_("%s -> %s (unbackup)\n"), - quote_n (0, dst_backup), quote_n (1, dst_path)); + quote_n (0, dst_backup), quote_n (1, dst_name)); } } return false; @@ -1670,17 +1670,17 @@ valid_options (const struct cp_options *co) return true; } -/* Copy the file SRC_PATH to the file DST_PATH. The files may be of - any type. NONEXISTENT_DST should be true if the file DST_PATH +/* Copy the file SRC_NAME to the file DST_NAME. The files may be of + any type. NONEXISTENT_DST should be true if the file DST_NAME is known not to exist (e.g., because its parent directory was just - created); NONEXISTENT_DST should be false if DST_PATH might already + created); NONEXISTENT_DST should be false if DST_NAME might already exist. OPTIONS is ... FIXME-describe - Set *COPY_INTO_SELF if SRC_PATH is a parent of (or the - same as) DST_PATH; otherwise, set clear it. + Set *COPY_INTO_SELF if SRC_NAME is a parent of (or the + same as) DST_NAME; otherwise, set clear it. Return true if successful. */ extern bool -copy (const char *src_path, const char *dst_path, +copy (char const *src_name, char const *dst_name, bool nonexistent_dst, const struct cp_options *options, bool *copy_into_self, bool *rename_succeeded) { @@ -1693,10 +1693,10 @@ copy (const char *src_path, const char *dst_path, top level source and destination directory names where they're used. An alternative is to use COPY_INTO_SELF and print the diagnostic from every caller -- but I don't want to do that. */ - top_level_src_path = src_path; - top_level_dst_path = dst_path; + top_level_src_name = src_name; + top_level_dst_name = dst_name; - return copy_internal (src_path, dst_path, nonexistent_dst, 0, NULL, + return copy_internal (src_name, dst_name, nonexistent_dst, 0, NULL, options, true, copy_into_self, rename_succeeded); } diff --git a/src/copy.h b/src/copy.h index 90a47f73e..f90bb96d1 100644 --- a/src/copy.h +++ b/src/copy.h @@ -192,10 +192,10 @@ struct cp_options Hash_table *src_info; }; -# define XSTAT(X, Src_path, Src_sb) \ +# define XSTAT(X, Src_name, Src_sb) \ ((X)->dereference == DEREF_NEVER \ - ? lstat (Src_path, Src_sb) \ - : stat (Src_path, Src_sb)) + ? lstat (Src_name, Src_sb) \ + : stat (Src_name, Src_sb)) /* Arrange to make lstat calls go through the wrapper function on systems with an lstat function that does not dereference symlinks @@ -207,7 +207,7 @@ int rpl_lstat (const char *, struct stat *); # endif /* Arrange to make rename calls go through the wrapper function - on systems with a rename function that fails for a source path + on systems with a rename function that fails for a source file name specified with a trailing slash. */ # if RENAME_TRAILING_SLASH_BUG int rpl_rename (const char *, const char *); @@ -215,7 +215,7 @@ int rpl_rename (const char *, const char *); # define rename rpl_rename # endif -bool copy (const char *src_path, const char *dst_path, +bool copy (char const *src_name, char const *dst_name, bool nonexistent_dst, const struct cp_options *options, bool *copy_into_self, bool *rename_succeeded); diff --git a/src/cp-hash.c b/src/cp-hash.c index 0202cb3b3..a4b51573f 100644 --- a/src/cp-hash.c +++ b/src/cp-hash.c @@ -1,5 +1,5 @@ /* cp-hash.c -- file copying (hash search routines) - Copyright (C) 89, 90, 91, 1995-2004 Free Software Foundation. + Copyright (C) 89, 90, 91, 1995-2005 Free Software Foundation. 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,7 +31,7 @@ #include "cp-hash.h" /* Use ST_DEV and ST_INO as the key, FILENAME as the value. - These are used e.g., in copy.c to associate the destination path with + These are used e.g., in copy.c to associate the destination name with the source device/inode pair so that if we encounter a matching dev/ino pair in the source tree we can arrange to create a hard link between the corresponding names in the destination tree. */ @@ -39,8 +39,8 @@ struct Src_to_dest { ino_t st_ino; dev_t st_dev; - /* Destination path name (of non-directory or pre-existing directory) - corresponding to the dev/ino of a copied file, or the destination path + /* Destination file name (of non-directory or pre-existing directory) + corresponding to the dev/ino of a copied file, or the destination file name corresponding to a dev/ino pair for a newly-created directory. */ char *name; }; @@ -98,21 +98,21 @@ forget_created (ino_t ino, dev_t dev) src_to_dest_free (ent); } -/* Add PATH to the list of files that we have created. +/* Add FILE to the list of files that we have created. Return true if successful. */ extern bool -remember_created (const char *path) +remember_created (char const *file) { struct stat sb; - if (stat (path, &sb) < 0) + if (stat (file, &sb) < 0) { - error (0, errno, "%s", quote (path)); + error (0, errno, "%s", quote (file)); return false; } - remember_copied (path, sb.st_ino, sb.st_dev); + remember_copied (file, sb.st_ino, sb.st_dev); return true; } @@ -130,7 +130,7 @@ src_to_dest_lookup (ino_t ino, dev_t dev) return e ? e->name : NULL; } -/* Add path NAME, copied from inode number INO and device number DEV, +/* Add file NAME, copied from inode number INO and device number DEV, to the list of files we have copied. Return NULL if inserted, otherwise non-NULL. */ diff --git a/src/cp-hash.h b/src/cp-hash.h index ba6e24c83..d142925a4 100644 --- a/src/cp-hash.h +++ b/src/cp-hash.h @@ -2,5 +2,5 @@ void hash_init (void); void forget_all (void); void forget_created (ino_t ino, dev_t dev); char *remember_copied (const char *node, ino_t ino, dev_t dev); -bool remember_created (const char *path); +bool remember_created (char const *file); char *src_to_dest_lookup (ino_t ino, dev_t dev); diff --git a/src/dirname.c b/src/dirname.c index 2c8cfa9f3..31a3726b2 100644 --- a/src/dirname.c +++ b/src/dirname.c @@ -1,4 +1,4 @@ -/* dirname -- strip filename suffix from pathname +/* dirname -- strip suffix from file name Copyright (C) 1990-1997, 1999-2002, 2004, 2005 Free Software Foundation, Inc. diff --git a/src/du.c b/src/du.c index d257a9a95..67018bacf 100644 --- a/src/du.c +++ b/src/du.c @@ -336,7 +336,7 @@ process_file (FTS *fts, FTSENT *ent) bool skip; /* If necessary, set FTS_SKIP before returning. */ - skip = excluded_filename (exclude, ent->fts_path); + skip = excluded_file_name (exclude, ent->fts_path); if (skip) fts_set (fts, ent, FTS_SKIP); diff --git a/src/mkdir.c b/src/mkdir.c index ee7813028..a2307bcd2 100644 --- a/src/mkdir.c +++ b/src/mkdir.c @@ -25,7 +25,7 @@ #include "system.h" #include "dirname.h" #include "error.h" -#include "makepath.h" +#include "mkdir-p.h" #include "modechange.h" #include "quote.h" @@ -152,8 +152,8 @@ main (int argc, char **argv) if (create_parents) { char *dir = argv[optind]; - ok = make_path (dir, newmode, parent_mode, - -1, -1, true, verbose_fmt_string); + ok = make_dir_parents (dir, newmode, parent_mode, + -1, -1, true, verbose_fmt_string); } else { diff --git a/src/mv.c b/src/mv.c index 075acc839..e9d3444df 100644 --- a/src/mv.c +++ b/src/mv.c @@ -30,7 +30,7 @@ #include "cp-hash.h" #include "dirname.h" #include "error.h" -#include "path-concat.h" +#include "filenamecat.h" #include "quote.h" #include "remove.h" @@ -274,7 +274,7 @@ movefile (char *source, char *dest, bool dest_is_dir, { /* Treat DEST as a directory; build the full filename. */ char const *src_basename = base_name (source); - char *new_dest = path_concat (dest, src_basename, NULL); + char *new_dest = file_name_concat (dest, src_basename, NULL); strip_trailing_slashes (new_dest); ok = do_move (source, new_dest, x); free (new_dest); diff --git a/src/nohup.c b/src/nohup.c index 864196d17..b0617190f 100644 --- a/src/nohup.c +++ b/src/nohup.c @@ -27,8 +27,8 @@ #include "cloexec.h" #include "error.h" +#include "filenamecat.h" #include "long-options.h" -#include "path-concat.h" #include "quote.h" #include "unistd-safer.h" @@ -114,7 +114,7 @@ main (int argc, char **argv) char const *home = getenv ("HOME"); if (home) { - in_home = path_concat (home, file, NULL); + in_home = file_name_concat (home, file, NULL); fd = open (in_home, flags, mode); } if (fd < 0) diff --git a/src/pinky.c b/src/pinky.c index 90d8f190b..dc8e0f98b 100644 --- a/src/pinky.c +++ b/src/pinky.c @@ -219,8 +219,8 @@ print_entry (const STRUCT_UTMP *utmp_ent) char line[sizeof (utmp_ent->ut_line) + DEV_DIR_LEN + 1]; /* Copy ut_line into LINE, prepending `/dev/' if ut_line is not - already an absolute pathname. Some system may put the full, - absolute pathname in ut_line. */ + already an absolute file name. Some system may put the full, + absolute file name in ut_line. */ if (utmp_ent->ut_line[0] == '/') { strncpy (line, utmp_ent->ut_line, sizeof (utmp_ent->ut_line)); diff --git a/src/pr.c b/src/pr.c index 7ac449ace..96db9d032 100644 --- a/src/pr.c +++ b/src/pr.c @@ -29,7 +29,7 @@ Improve the printing of control prefixes. - Expand the filename in the centered header line to a full pathname. + Expand the file name in the centered header line to a full file name. Concept: diff --git a/src/remove.c b/src/remove.c index 298e43752..7c5578704 100644 --- a/src/remove.c +++ b/src/remove.c @@ -231,7 +231,7 @@ pop_dir (Dirstack_state *ds) top_len = length[n_lengths - 1]; assert (top_len >= 2); - /* Pop off the specified length of pathname. */ + /* Pop the specified length of file name. */ assert (obstack_object_size (&ds->dir_stack) >= top_len); obstack_blank (&ds->dir_stack, -top_len); @@ -271,7 +271,7 @@ right_justify (char *dst, size_t dst_len, const char *src, size_t src_len, return dst_len - src_len; } -/* Using the global directory name obstack, create the full path to FILENAME. +/* Using the global directory name obstack, create the full name FILENAME. Return it in sometimes-realloc'd space that should not be freed by the caller. Realloc as necessary. If realloc fails, use a static buffer and put as long a suffix in that buffer as possible. */ diff --git a/src/sort.c b/src/sort.c index 63cbd555a..9059d263d 100644 --- a/src/sort.c +++ b/src/sort.c @@ -700,7 +700,7 @@ default_sort_size (void) } /* Return the sort buffer size to use with the input files identified - by FPS and FILES, which are alternate paths to the same files. + by FPS and FILES, which are alternate names of the same files. NFILES gives the number of input files; NFPS may be less. Assume that each input line requires LINE_BYTES extra bytes' worth of line information. Do not exceed a bound on the size: if the bound is diff --git a/src/system.h b/src/system.h index 307f5ab5b..51d5361e9 100644 --- a/src/system.h +++ b/src/system.h @@ -1,4 +1,4 @@ -/* system-dependent definitions for fileutils, textutils, and sh-utils packages. +/* system-dependent definitions for coreutils Copyright (C) 1989, 1991-2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ you must include before including this file #include #if !defined HAVE_MKFIFO -# define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0)) +# define mkfifo(name, mode) mknod (name, (mode) | S_IFIFO, 0) #endif #if HAVE_SYS_PARAM_H diff --git a/src/tty.c b/src/tty.c index c7212e407..5228e7aae 100644 --- a/src/tty.c +++ b/src/tty.c @@ -1,5 +1,5 @@ -/* tty -- print the path of the terminal connected to standard input - Copyright (C) 1990-2004 Free Software Foundation, Inc. +/* tty -- print the name of the terminal connected to standard input + Copyright (C) 1990-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 diff --git a/src/who.c b/src/who.c index 46e057139..bf70891b0 100644 --- a/src/who.c +++ b/src/who.c @@ -333,8 +333,8 @@ print_user (const STRUCT_UTMP *utmp_ent, time_t boottime) PIDSTR_DECL_AND_INIT (pidstr, utmp_ent); /* Copy ut_line into LINE, prepending `/dev/' if ut_line is not - already an absolute pathname. Some system may put the full, - absolute pathname in ut_line. */ + already an absolute file name. Some systems may put the full, + absolute file name in ut_line. */ if (utmp_ent->ut_line[0] == '/') { strncpy (line, utmp_ent->ut_line, sizeof (utmp_ent->ut_line)); -- cgit v1.2.3-54-g00ecf