Skip to content
Snippets Groups Projects
Commit 822520d3 authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 1999-02-18 16:33:09 by simonm]

Allow -f flag to override existing symlink tree.
parent 5b50d652
No related merge requests found
......@@ -82,6 +82,8 @@ int ignore_links = 0; /* -ignorelinks */
char *rcurdir;
char *curdir;
int force=0;
void
quit (
#if NeedVarargsPrototypes
......@@ -284,15 +286,22 @@ int rel; /* if true, prepend "../" to fn before using */
}
if (symlen >= 0) {
/* Link exists in new tree. Print message if it doesn't match. */
if (!equivalent (basesymlen>=0 ? basesym : buf, symbuf))
msg ("%s: %s", dp->d_name, symbuf);
} else {
if (symlink (basesymlen>=0 ? basesym : buf, dp->d_name) < 0)
if (!equivalent (basesymlen>=0 ? basesym : buf, symbuf)) {
if (force) {
unlink(dp->d_name);
if (symlink (basesymlen>=0 ? basesym : buf, dp->d_name) < 0)
mperror (dp->d_name);
} else {
/* Link exists in new tree. Print message if it doesn't match. */
msg ("%s: %s", dp->d_name, symbuf);
}
}
} else {
if (symlink (basesymlen>=0 ? basesym : buf, dp->d_name) < 0)
mperror (dp->d_name);
}
}
closedir (df);
return 0;
}
......@@ -305,7 +314,6 @@ char **av;
char *prog_name = av[0];
char *fn, *tn;
struct stat fs, ts;
int force=0;
while (++av, --ac) {
if (strcmp(*av, "-silent") == 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment