- if (dp->d_name[0] == '.' &&
- (dp->d_name[1] == '\0' || (dp->d_name[1] == '.' &&
- dp->d_name[2] == '\0')))
- continue;
- if (!strcmp (dp->d_name, "RCS"))
- continue;
- if (!strcmp (dp->d_name, "SCCS"))
- continue;
- if (!strcmp (dp->d_name, "CVS"))
- continue;
- if (!strcmp (dp->d_name, ".svn"))
- continue;
- if (!strcmp (dp->d_name, "_darcs"))
- continue;
- if (!strcmp (dp->d_name, "CVS.adm"))
- continue;
- ocurdir = rcurdir;
- rcurdir = buf;
- curdir = silent ? buf : (char *)0;
- if (!silent)
- printf ("%s:\n", buf);
- if ((stat (dp->d_name, &sc) < 0) && (errno == ENOENT)) {
- if (mkdir (dp->d_name, 0777) < 0 ||
- stat (dp->d_name, &sc) < 0) {
- mperror (dp->d_name);
- curdir = rcurdir = ocurdir;
- continue;
- }
- }
- if (readlink (dp->d_name, symbuf, sizeof(symbuf) - 1) >= 0) {
- msg ("%s: is a link instead of a directory", dp->d_name);
- curdir = rcurdir = ocurdir;
- continue;
- }
- if (chdir (dp->d_name) < 0) {
- mperror (dp->d_name);
- curdir = rcurdir = ocurdir;
- continue;
- }
- dodir (buf, &sb, &sc, (buf[0] != '/'));
- if (chdir ("..") < 0)
- quiterr (1, "..");
- curdir = rcurdir = ocurdir;
- continue;
- }
- }
-
- /* non-directory */
- symlen = readlink (dp->d_name, symbuf, sizeof(symbuf) - 1);
- if (symlen >= 0)
- symbuf[symlen] = '\0';
-
- /* The option to ignore links exists mostly because
- checking for them slows us down by 10-20%.
- But it is off by default because this really is a useful check. */
- if (!ignore_links) {
- /* see if the file in the base tree was a symlink */
- basesymlen = readlink(buf, basesym, sizeof(basesym) - 1);
- if (basesymlen >= 0)
- basesym[basesymlen] = '\0';
- }
-
- if (symlen >= 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);
- }
+ if (dp->d_name[0] == '.' &&
+ (dp->d_name[1] == '\0' || (dp->d_name[1] == '.' &&
+ dp->d_name[2] == '\0')))
+ continue;
+ if (!strcmp (dp->d_name, "RCS"))
+ continue;
+ if (!strcmp (dp->d_name, "SCCS"))
+ continue;
+ if (!strcmp (dp->d_name, "CVS"))
+ continue;
+ if (!strcmp (dp->d_name, ".svn"))
+ continue;
+ if (!strcmp (dp->d_name, "_darcs"))
+ continue;
+ if (!strcmp (dp->d_name, "CVS.adm"))
+ continue;
+ ocurdir = rcurdir;
+ rcurdir = buf;
+ curdir = silent ? buf : (char *)0;
+ if (!silent)
+ printf ("%s:\n", buf);
+ if ((stat (dp->d_name, &sc) < 0) && (errno == ENOENT)) {
+ if (mymkdir (dp->d_name, 0777) < 0 ||
+ stat (dp->d_name, &sc) < 0) {
+ mperror (dp->d_name);
+ curdir = rcurdir = ocurdir;
+ continue;
+ }
+ }
+#ifdef SYMLINKS
+ if (readlink (dp->d_name, symbuf, sizeof(symbuf) - 1) >= 0) {
+ msg ("%s: is a link instead of a directory", dp->d_name);
+ curdir = rcurdir = ocurdir;
+ continue;
+ }
+#endif
+ if (chdir (dp->d_name) < 0) {
+ mperror (dp->d_name);
+ curdir = rcurdir = ocurdir;
+ continue;
+ }
+ rel = (fn[0] != '/') && ((fn[0] == '\0') || (fn[1] != ':'));
+ dodir (buf, &sb, &sc, rel);
+ if (chdir ("..") < 0)
+ quiterr (1, "..");
+ curdir = rcurdir = ocurdir;
+ continue;
+ }
+ }
+
+ /* non-directory */
+#ifdef SYMLINKS
+ symlen = readlink (dp->d_name, symbuf, sizeof(symbuf) - 1);
+ if (symlen >= 0)
+ symbuf[symlen] = '\0';
+
+ /* The option to ignore links exists mostly because
+ checking for them slows us down by 10-20%.
+ But it is off by default because this really is a useful check. */
+ if (!ignore_links) {
+ /* see if the file in the base tree was a symlink */
+ basesymlen = readlink(buf, basesym, sizeof(basesym) - 1);
+ if (basesymlen >= 0)
+ basesym[basesymlen] = '\0';
+ }
+#endif
+
+ if (symlen >= 0) {
+ if (!equivalent (basesymlen>=0 ? basesym : buf, symbuf)) {
+ if (force) {
+ unlink(dp->d_name);
+ if (copyfile (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 (copyfile (basesymlen>=0 ? basesym : buf, dp->d_name) < 0)
+ mperror (dp->d_name);
+ }