From 52dedbfebbb911c39feeb052e4bcd26b2a99a2c9 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 7 Dec 1998 06:20:50 +0000 Subject: [PATCH] Use dir_name, not dirname. Include dirname.h. --- src/copy.c | 4 ++-- src/cp.c | 8 ++++---- src/df.c | 4 ++-- src/install.c | 4 ++-- src/ln.c | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/copy.c b/src/copy.c index 3b1acdfe16..401ea79ed8 100644 --- a/src/copy.c +++ b/src/copy.c @@ -33,6 +33,7 @@ #include "copy.h" #include "cp-hash.h" #include "path-concat.h" +#include "dirname.h" #define DO_CHOWN(Chown, File, New_uid, New_gid) \ (Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (New_gid)) \ @@ -51,7 +52,6 @@ struct dir_list int full_write (); int euidaccess (); int yesno (); -char *dirname (); static int copy_internal PARAMS ((const char *src_path, const char *dst_path, int new_dst, dev_t device, @@ -700,7 +700,7 @@ copy_internal (const char *src_path, const char *dst_path, char *dst_parent; int in_current_dir; - dst_parent = dirname (dst_path); + dst_parent = dir_name (dst_path); if (dst_parent == NULL) error (1, 0, _("virtual memory exhausted")); diff --git a/src/cp.c b/src/cp.c index d6afbb5b92..59541f3402 100644 --- a/src/cp.c +++ b/src/cp.c @@ -35,6 +35,7 @@ #include "cp-hash.h" #include "copy.h" #include "error.h" +#include "dirname.h" #ifndef _POSIX_VERSION uid_t geteuid (); @@ -54,7 +55,6 @@ int stat (); int lstat (); char *base_name (); -char *dirname (); enum backup_type get_version (); void strip_trailing_slashes (); char *xstrdup (); @@ -308,7 +308,7 @@ make_path_private (const char *const_dirpath, int src_offset, int mode, src = dirpath + src_offset; - tmp_dst_dirname = dirname (dirpath); + tmp_dst_dirname = dir_name (dirpath); dst_dirname = (char *) alloca (strlen (tmp_dst_dirname) + 1); strcpy (dst_dirname, tmp_dst_dirname); free (tmp_dst_dirname); @@ -444,7 +444,7 @@ do_copy (int argc, char **argv, const struct cp_options *x) char *arg; char *ap; char *dst_path; - int parent_exists = 1; /* True if dirname (dst_path) exists. */ + int parent_exists = 1; /* True if dir_name (dst_path) exists. */ struct dir_attr *attr_list; char *arg_in_concat = NULL; @@ -460,7 +460,7 @@ do_copy (int argc, char **argv, const struct cp_options *x) error (1, 0, _("virtual memory exhausted")); /* For --parents, we have to make sure that the directory - dirname (dst_path) exists. We may have to create a few + dir_name (dst_path) exists. We may have to create a few leading directories. */ parent_exists = !make_path_private (dst_path, arg_in_concat - dst_path, diff --git a/src/df.c b/src/df.c index f6b62f145d..a036d510b2 100644 --- a/src/df.c +++ b/src/df.c @@ -35,8 +35,8 @@ #include "closeout.h" #include "error.h" #include "human.h" +#include "dirname.h" -char *dirname (); void strip_trailing_slashes (); char *xstrdup (); char *xgetcwd (); @@ -411,7 +411,7 @@ find_mount_point (const char *file, const struct stat *file_stat) char *dir; strip_trailing_slashes (tmp); - dir = dirname (tmp); + dir = dir_name (tmp); free (tmp); rv = chdir (dir); free (dir); diff --git a/src/install.c b/src/install.c index 98c196a437..888204d107 100644 --- a/src/install.c +++ b/src/install.c @@ -81,6 +81,7 @@ #include "path-concat.h" #include "cp-hash.h" #include "copy.h" +#include "dirname.h" #if HAVE_SYS_WAIT_H # include @@ -127,7 +128,6 @@ gid_t getgid (); #endif char *base_name (); -char *dirname (); int full_write (); int isdir (); enum backup_type get_version (); @@ -411,7 +411,7 @@ install_file_to_path (const char *from, const char *to, char *dest_dir; int fail; - dest_dir = dirname (to); + dest_dir = dir_name (to); /* check to make sure this is a path (not install a b ) */ if (!STREQ (dest_dir, ".") diff --git a/src/ln.c b/src/ln.c index a935796fa3..d15060e856 100644 --- a/src/ln.c +++ b/src/ln.c @@ -30,6 +30,7 @@ #include "backupfile.h" #include "closeout.h" #include "error.h" +#include "dirname.h" int link (); /* Some systems don't declare this anywhere. */ @@ -58,7 +59,6 @@ int symlink (); while (0) char *base_name (); -char *dirname (); enum backup_type get_version (); int isdir (); int yesno (); @@ -131,8 +131,8 @@ same_name (const char *source, const char *dest) struct stat dest_dir_stats; char *source_dirname, *dest_dirname; - source_dirname = dirname (source); - dest_dirname = dirname (dest); + source_dirname = dir_name (source); + dest_dirname = dir_name (dest); if (source_dirname == NULL || dest_dirname == NULL) error (1, 0, _("virtual memory exhausted")); -- 2.47.3