summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-06-02 05:13:29 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-06-02 05:13:29 +0000
commit55b579a133e6ee511c2f9ad68bf585b134d6a914 (patch)
treedbb3bee03e708bb4d73c27a2a0e292c4e5f975c7 /src
parent83ed78d646e2a33ce970c6841783e750f8fe475e (diff)
downloadcoreutils-55b579a133e6ee511c2f9ad68bf585b134d6a914.tar.xz
Don't use "path" or "filename".
(install_file_in_file_parents): Renamed from install_file_to_path. All uses changed.
Diffstat (limited to 'src')
-rw-r--r--src/install.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/install.c b/src/install.c
index 6b5a66a5b..027d201d9 100644
--- a/src/install.c
+++ b/src/install.c
@@ -31,9 +31,9 @@
#include "cp-hash.h"
#include "copy.h"
#include "dirname.h"
-#include "makepath.h"
+#include "filenamecat.h"
+#include "mkdir-p.h"
#include "modechange.h"
-#include "path-concat.h"
#include "quote.h"
#include "utimens.h"
#include "xstrtol.h"
@@ -65,17 +65,17 @@
#define READ_SIZE (32 * 1024)
static bool change_timestamps (const char *from, const char *to);
-static bool change_attributes (const char *path);
+static bool change_attributes (char const *name);
static bool copy_file (const char *from, const char *to,
const struct cp_options *x);
-static bool install_file_to_path (const char *from, const char *to,
- const struct cp_options *x);
+static bool install_file_in_file_parents (char const *from, char const *to,
+ struct cp_options const *x);
static bool install_file_in_dir (const char *from, const char *to_dir,
const struct cp_options *x);
static bool install_file_in_file (const char *from, const char *to,
const struct cp_options *x);
static void get_ids (void);
-static void strip (const char *path);
+static void strip (char const *name);
void usage (int status);
/* The name this program was run with, for error messages. */
@@ -360,8 +360,8 @@ main (int argc, char **argv)
for (i = 0; i < n_files; i++)
{
ok &=
- make_path (file[i], mode, mode, owner_id, group_id, false,
- (x.verbose ? _("creating directory %s") : NULL));
+ make_dir_parents (file[i], mode, mode, owner_id, group_id, false,
+ (x.verbose ? _("creating directory %s") : NULL));
}
}
else
@@ -373,7 +373,7 @@ main (int argc, char **argv)
if (!target_directory)
{
if (mkdir_and_install)
- ok = install_file_to_path (file[0], file[1], &x);
+ ok = install_file_in_file_parents (file[0], file[1], &x);
else
ok = install_file_in_file (file[0], file[1], &x);
}
@@ -395,8 +395,8 @@ main (int argc, char **argv)
Return true if successful. */
static bool
-install_file_to_path (const char *from, const char *to,
- const struct cp_options *x)
+install_file_in_file_parents (char const *from, char const *to,
+ struct cp_options const *x)
{
char *dest_dir = dir_name (to);
bool ok = true;
@@ -408,9 +408,10 @@ install_file_to_path (const char *from, const char *to,
owner, group, and permissions for parent directories. Remember
that this option is intended mainly to help installers when the
distribution doesn't provide proper install rules. */
-#define DIR_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
- ok = make_path (dest_dir, DIR_MODE, DIR_MODE, owner_id, group_id, true,
- (x->verbose ? _("creating directory %s") : NULL));
+ mode_t dir_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
+ ok = make_dir_parents (dest_dir, dir_mode, dir_mode,
+ owner_id, group_id, true,
+ (x->verbose ? _("creating directory %s") : NULL));
}
free (dest_dir);
@@ -449,7 +450,7 @@ install_file_in_dir (const char *from, const char *to_dir,
const struct cp_options *x)
{
const char *from_base = base_name (from);
- char *to = path_concat (to_dir, from_base, NULL);
+ char *to = file_name_concat (to_dir, from_base, NULL);
bool ret = install_file_in_file (from, to, x);
free (to);
return ret;
@@ -472,11 +473,11 @@ copy_file (const char *from, const char *to, const struct cp_options *x)
return copy (from, to, false, x, &copy_into_self, NULL);
}
-/* Set the attributes of file or directory PATH.
+/* Set the attributes of file or directory NAME.
Return true if successful. */
static bool
-change_attributes (const char *path)
+change_attributes (char const *name)
{
bool ok = true;
@@ -493,19 +494,19 @@ change_attributes (const char *path)
want to know. But AFS returns EPERM when you try to change a
file's group; thus the kludge. */
- if (chown (path, owner_id, group_id)
+ if (chown (name, owner_id, group_id) != 0
#ifdef AFS
&& errno != EPERM
#endif
)
{
- error (0, errno, _("cannot change ownership of %s"), quote (path));
+ error (0, errno, _("cannot change ownership of %s"), quote (name));
ok = false;
}
- if (ok && chmod (path, mode))
+ if (ok && chmod (name, mode) != 0)
{
- error (0, errno, _("cannot change permissions of %s"), quote (path));
+ error (0, errno, _("cannot change permissions of %s"), quote (name));
ok = false;
}
@@ -539,14 +540,14 @@ change_timestamps (const char *from, const char *to)
return true;
}
-/* Strip the symbol table from the file PATH.
+/* Strip the symbol table from the file NAME.
We could dig the magic number out of the file first to
determine whether to strip it, but the header files and
magic numbers vary so much from system to system that making
it portable would be very difficult. Not worth the effort. */
static void
-strip (const char *path)
+strip (char const *name)
{
int status;
pid_t pid = fork ();
@@ -557,7 +558,7 @@ strip (const char *path)
error (EXIT_FAILURE, errno, _("fork system call failed"));
break;
case 0: /* Child. */
- execlp ("strip", "strip", path, NULL);
+ execlp ("strip", "strip", name, NULL);
error (EXIT_FAILURE, errno, _("cannot run strip"));
break;
default: /* Parent. */