Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Mini `cp' and `mv' implementation for BusyBox. |
| 4 | * |
| 5 | * |
Eric Andersen | 8ec10a9 | 2001-01-27 09:33:39 +0000 | [diff] [blame] | 6 | * Copyright (C) 1999,2000,2001 by Lineo, inc. |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 7 | * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> |
| 8 | * |
| 9 | * Copyright (C) 2000 by BitterSweet Enterprises, LLC. (GPL) |
| 10 | * Extensively modified and rewritten by Karl M. Hegbloom <karlheg@debian.org> |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 20 | * General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | * |
| 26 | */ |
| 27 | |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 28 | #include <stdio.h> |
| 29 | #include <time.h> |
| 30 | #include <utime.h> |
| 31 | #include <dirent.h> |
| 32 | #include <sys/param.h> |
Erik Andersen | 61677fe | 2000-04-13 01:18:56 +0000 | [diff] [blame] | 33 | #include <setjmp.h> |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 34 | #include <string.h> |
| 35 | #include <unistd.h> |
| 36 | #include <errno.h> |
Eric Andersen | f4c0226 | 2000-07-13 18:42:58 +0000 | [diff] [blame] | 37 | #include <getopt.h> |
Eric Andersen | ed3ef50 | 2001-01-27 08:24:39 +0000 | [diff] [blame] | 38 | #include <stdlib.h> |
Eric Andersen | cbe31da | 2001-02-20 06:14:08 +0000 | [diff] [blame] | 39 | #include "busybox.h" |
| 40 | #define BB_DECLARE_EXTERN |
| 41 | #define bb_need_name_too_long |
| 42 | #define bb_need_omitting_directory |
| 43 | #define bb_need_not_a_directory |
| 44 | #include "messages.c" |
| 45 | |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 46 | |
Mark Whitley | 59ab025 | 2001-01-23 22:30:04 +0000 | [diff] [blame] | 47 | static const int is_cp = 0; |
| 48 | static const int is_mv = 1; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 49 | static int dz_i; /* index into cp_mv_usage */ |
Matt Kraai | 3bd8bd8 | 2000-07-14 23:28:47 +0000 | [diff] [blame] | 50 | |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 51 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 52 | static int recursiveFlag; |
| 53 | static int followLinks; |
| 54 | static int preserveFlag; |
Erik Andersen | 59b9e87 | 2000-05-10 05:05:45 +0000 | [diff] [blame] | 55 | static int forceFlag; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 56 | |
| 57 | static const char *baseSrcName; |
| 58 | static int srcDirFlag; |
| 59 | static struct stat srcStatBuf; |
| 60 | |
Mark Whitley | 59ab025 | 2001-01-23 22:30:04 +0000 | [diff] [blame] | 61 | static char *pBaseDestName; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 62 | static size_t baseDestLen; |
| 63 | static int destDirFlag; |
| 64 | static struct stat destStatBuf; |
| 65 | |
| 66 | static jmp_buf catch; |
| 67 | static volatile int mv_Action_first_time; |
| 68 | |
| 69 | static void name_too_long__exit (void) __attribute__((noreturn)); |
| 70 | |
| 71 | static |
| 72 | void name_too_long__exit (void) |
| 73 | { |
Mark Whitley | f57c944 | 2000-12-07 19:56:48 +0000 | [diff] [blame] | 74 | error_msg_and_die(name_too_long); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | static void |
| 78 | fill_baseDest_buf(char *_buf, size_t * _buflen) { |
| 79 | const char *srcBasename; |
| 80 | if ((srcBasename = strrchr(baseSrcName, '/')) == NULL) { |
| 81 | srcBasename = baseSrcName; |
| 82 | if (_buf[*_buflen - 1] != '/') { |
Erik Andersen | 4f3f757 | 2000-04-28 00:18:56 +0000 | [diff] [blame] | 83 | if (++(*_buflen) > BUFSIZ) |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 84 | name_too_long__exit(); |
| 85 | strcat(_buf, "/"); |
| 86 | } |
| 87 | } |
Erik Andersen | 4f3f757 | 2000-04-28 00:18:56 +0000 | [diff] [blame] | 88 | if (*_buflen + strlen(srcBasename) > BUFSIZ) |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 89 | name_too_long__exit(); |
| 90 | strcat(_buf, srcBasename); |
| 91 | return; |
| 92 | |
| 93 | } |
| 94 | |
| 95 | static int |
Erik Andersen | 3364d78 | 2000-03-28 00:58:14 +0000 | [diff] [blame] | 96 | cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 97 | { |
Erik Andersen | 4f3f757 | 2000-04-28 00:18:56 +0000 | [diff] [blame] | 98 | char destName[BUFSIZ + 1]; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 99 | size_t destLen; |
| 100 | const char *srcBasename; |
| 101 | char *name; |
| 102 | |
Mark Whitley | 59ab025 | 2001-01-23 22:30:04 +0000 | [diff] [blame] | 103 | strcpy(destName, pBaseDestName); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 104 | destLen = strlen(destName); |
| 105 | |
| 106 | if (srcDirFlag == TRUE) { |
| 107 | if (recursiveFlag == FALSE) { |
Mark Whitley | f57c944 | 2000-12-07 19:56:48 +0000 | [diff] [blame] | 108 | error_msg(omitting_directory, baseSrcName); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 109 | return TRUE; |
| 110 | } |
| 111 | srcBasename = (strstr(fileName, baseSrcName) |
| 112 | + strlen(baseSrcName)); |
| 113 | |
Erik Andersen | 4f3f757 | 2000-04-28 00:18:56 +0000 | [diff] [blame] | 114 | if (destLen + strlen(srcBasename) > BUFSIZ) { |
Mark Whitley | f57c944 | 2000-12-07 19:56:48 +0000 | [diff] [blame] | 115 | error_msg(name_too_long); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 116 | return FALSE; |
| 117 | } |
| 118 | strcat(destName, srcBasename); |
| 119 | } |
| 120 | else if (destDirFlag == TRUE) { |
| 121 | fill_baseDest_buf(&destName[0], &destLen); |
| 122 | } |
| 123 | else { |
| 124 | srcBasename = baseSrcName; |
| 125 | } |
| 126 | if (mv_Action_first_time && (dz_i == is_mv)) { |
| 127 | mv_Action_first_time = errno = 0; |
| 128 | if (rename(fileName, destName) < 0 && errno != EXDEV) { |
Matt Kraai | 1fa1ade | 2000-12-18 03:57:16 +0000 | [diff] [blame] | 129 | perror_msg("rename(%s, %s)", fileName, destName); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 130 | goto do_copyFile; /* Try anyway... */ |
| 131 | } |
| 132 | else if (errno == EXDEV) |
| 133 | goto do_copyFile; |
| 134 | else |
| 135 | longjmp(catch, 1); /* succeeded with rename() */ |
| 136 | } |
| 137 | do_copyFile: |
| 138 | if (preserveFlag == TRUE && statbuf->st_nlink > 1) { |
| 139 | if (is_in_ino_dev_hashtable(statbuf, &name)) { |
| 140 | if (link(name, destName) < 0) { |
Matt Kraai | 1fa1ade | 2000-12-18 03:57:16 +0000 | [diff] [blame] | 141 | perror_msg("link(%s, %s)", name, destName); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 142 | return FALSE; |
| 143 | } |
| 144 | return TRUE; |
| 145 | } |
| 146 | else { |
| 147 | add_to_ino_dev_hashtable(statbuf, destName); |
| 148 | } |
| 149 | } |
Glenn L McGrath | 4949faf | 2001-04-11 16:23:35 +0000 | [diff] [blame] | 150 | return copy_file(fileName, destName, preserveFlag, followLinks, forceFlag, FALSE); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | static int |
Erik Andersen | 3364d78 | 2000-03-28 00:58:14 +0000 | [diff] [blame] | 154 | rm_Action(const char *fileName, struct stat *statbuf, void* junk) |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 155 | { |
| 156 | int status = TRUE; |
| 157 | |
| 158 | if (S_ISDIR(statbuf->st_mode)) { |
| 159 | if (rmdir(fileName) < 0) { |
Matt Kraai | 1fa1ade | 2000-12-18 03:57:16 +0000 | [diff] [blame] | 160 | perror_msg("rmdir(%s)", fileName); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 161 | status = FALSE; |
| 162 | } |
| 163 | } else if (unlink(fileName) < 0) { |
Matt Kraai | 1fa1ade | 2000-12-18 03:57:16 +0000 | [diff] [blame] | 164 | perror_msg("unlink(%s)", fileName); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 165 | status = FALSE; |
| 166 | } |
| 167 | return status; |
| 168 | } |
| 169 | |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 170 | extern int cp_mv_main(int argc, char **argv) |
| 171 | { |
Eric Andersen | e7413a9 | 2000-07-14 06:19:41 +0000 | [diff] [blame] | 172 | volatile int i; |
Pavel Roskin | 93c0d9f | 2000-07-14 15:18:57 +0000 | [diff] [blame] | 173 | int c; |
Eric Andersen | d35c215 | 2001-01-25 23:49:09 +0000 | [diff] [blame] | 174 | RESERVE_BB_BUFFER(baseDestName,BUFSIZ + 1); |
| 175 | pBaseDestName = baseDestName; /* available globally */ |
Eric Andersen | f4c0226 | 2000-07-13 18:42:58 +0000 | [diff] [blame] | 176 | |
Matt Kraai | e714bce | 2000-07-12 00:53:06 +0000 | [diff] [blame] | 177 | if (*applet_name == 'c' && *(applet_name + 1) == 'p') |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 178 | dz_i = is_cp; |
| 179 | else |
| 180 | dz_i = is_mv; |
| 181 | if (argc < 3) |
Eric Andersen | 67991cf | 2001-02-14 21:23:06 +0000 | [diff] [blame] | 182 | show_usage(); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 183 | |
| 184 | if (dz_i == is_cp) { |
Erik Andersen | 59b9e87 | 2000-05-10 05:05:45 +0000 | [diff] [blame] | 185 | recursiveFlag = preserveFlag = forceFlag = FALSE; |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 186 | followLinks = TRUE; |
Eric Andersen | f4c0226 | 2000-07-13 18:42:58 +0000 | [diff] [blame] | 187 | while ((c = getopt(argc, argv, "adpRf")) != EOF) { |
| 188 | switch (c) { |
Pavel Roskin | b3d235f | 2000-06-08 18:06:37 +0000 | [diff] [blame] | 189 | case 'a': |
| 190 | followLinks = FALSE; |
| 191 | preserveFlag = TRUE; |
| 192 | recursiveFlag = TRUE; |
| 193 | break; |
| 194 | case 'd': |
| 195 | followLinks = FALSE; |
| 196 | break; |
| 197 | case 'p': |
| 198 | preserveFlag = TRUE; |
| 199 | break; |
| 200 | case 'R': |
| 201 | recursiveFlag = TRUE; |
| 202 | break; |
| 203 | case 'f': |
| 204 | forceFlag = TRUE; |
| 205 | break; |
| 206 | default: |
Eric Andersen | 67991cf | 2001-02-14 21:23:06 +0000 | [diff] [blame] | 207 | show_usage(); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 208 | } |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 209 | } |
Eric Andersen | f4c0226 | 2000-07-13 18:42:58 +0000 | [diff] [blame] | 210 | if ((argc - optind) < 2) { |
Eric Andersen | 67991cf | 2001-02-14 21:23:06 +0000 | [diff] [blame] | 211 | show_usage(); |
Eric Andersen | 815e904 | 2000-06-06 16:15:23 +0000 | [diff] [blame] | 212 | } |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 213 | } else { /* (dz_i == is_mv) */ |
Eric Andersen | 2da90d3 | 2000-09-23 20:55:59 +0000 | [diff] [blame] | 214 | /* Initialize optind to 1, since in libc5 optind |
| 215 | * is not initialized until getopt() is called |
| 216 | * (or until sneaky programmers force it...). */ |
| 217 | optind = 1; |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 218 | recursiveFlag = preserveFlag = TRUE; |
| 219 | followLinks = FALSE; |
| 220 | } |
Eric Andersen | 815e904 | 2000-06-06 16:15:23 +0000 | [diff] [blame] | 221 | |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 222 | |
Erik Andersen | 4f3f757 | 2000-04-28 00:18:56 +0000 | [diff] [blame] | 223 | if (strlen(argv[argc - 1]) > BUFSIZ) { |
Mark Whitley | f57c944 | 2000-12-07 19:56:48 +0000 | [diff] [blame] | 224 | error_msg(name_too_long); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 225 | goto exit_false; |
| 226 | } |
| 227 | strcpy(baseDestName, argv[argc - 1]); |
| 228 | baseDestLen = strlen(baseDestName); |
| 229 | if (baseDestLen == 0) |
| 230 | goto exit_false; |
| 231 | |
Mark Whitley | f57c944 | 2000-12-07 19:56:48 +0000 | [diff] [blame] | 232 | destDirFlag = is_directory(baseDestName, TRUE, &destStatBuf); |
Matt Kraai | adbf018 | 2000-08-06 15:36:50 +0000 | [diff] [blame] | 233 | if (argc - optind > 2 && destDirFlag == FALSE) { |
Mark Whitley | f57c944 | 2000-12-07 19:56:48 +0000 | [diff] [blame] | 234 | error_msg(not_a_directory, baseDestName); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 235 | goto exit_false; |
| 236 | } |
| 237 | |
Eric Andersen | f4c0226 | 2000-07-13 18:42:58 +0000 | [diff] [blame] | 238 | for (i = optind; i < (argc-1); i++) { |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 239 | size_t srcLen; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 240 | volatile int flags_memo; |
| 241 | int status; |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 242 | |
Eric Andersen | f4c0226 | 2000-07-13 18:42:58 +0000 | [diff] [blame] | 243 | baseSrcName=argv[i]; |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 244 | |
Erik Andersen | 4f3f757 | 2000-04-28 00:18:56 +0000 | [diff] [blame] | 245 | if ((srcLen = strlen(baseSrcName)) > BUFSIZ) |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 246 | name_too_long__exit(); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 247 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 248 | if (srcLen == 0) continue; /* "" */ |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 249 | |
Mark Whitley | f57c944 | 2000-12-07 19:56:48 +0000 | [diff] [blame] | 250 | srcDirFlag = is_directory(baseSrcName, followLinks, &srcStatBuf); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 251 | |
| 252 | if ((flags_memo = (recursiveFlag == TRUE && |
| 253 | srcDirFlag == TRUE && destDirFlag == TRUE))) { |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 254 | |
| 255 | struct stat sb; |
| 256 | int state = 0; |
| 257 | char *pushd, *d, *p; |
| 258 | |
Eric Andersen | e5dfced | 2001-04-09 22:48:12 +0000 | [diff] [blame] | 259 | if ((pushd = xgetcwd(0)) == NULL) |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 260 | continue; |
Eric Andersen | e5dfced | 2001-04-09 22:48:12 +0000 | [diff] [blame] | 261 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 262 | if (chdir(baseDestName) < 0) { |
Matt Kraai | 1fa1ade | 2000-12-18 03:57:16 +0000 | [diff] [blame] | 263 | perror_msg("chdir(%s)", baseSrcName); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 264 | continue; |
| 265 | } |
Eric Andersen | e5dfced | 2001-04-09 22:48:12 +0000 | [diff] [blame] | 266 | if ((d = xgetcwd(0)) == NULL) |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 267 | continue; |
Eric Andersen | e5dfced | 2001-04-09 22:48:12 +0000 | [diff] [blame] | 268 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 269 | while (!state && *d != '\0') { |
| 270 | if (stat(d, &sb) < 0) { /* stat not lstat - always dereference targets */ |
Matt Kraai | 1fa1ade | 2000-12-18 03:57:16 +0000 | [diff] [blame] | 271 | perror_msg("stat(%s)", d); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 272 | state = -1; |
| 273 | continue; |
Erik Andersen | 9ffdaa6 | 2000-02-11 21:55:04 +0000 | [diff] [blame] | 274 | } |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 275 | if ((sb.st_ino == srcStatBuf.st_ino) && |
| 276 | (sb.st_dev == srcStatBuf.st_dev)) { |
Mark Whitley | f57c944 | 2000-12-07 19:56:48 +0000 | [diff] [blame] | 277 | error_msg("Cannot %s `%s' into a subdirectory of itself, " |
Matt Kraai | dd19c69 | 2001-01-31 19:00:21 +0000 | [diff] [blame] | 278 | "`%s/%s'", applet_name, baseSrcName, |
Matt Kraai | d537a95 | 2000-07-14 01:51:25 +0000 | [diff] [blame] | 279 | baseDestName, baseSrcName); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 280 | state = -1; |
| 281 | continue; |
| 282 | } |
| 283 | if ((p = strrchr(d, '/')) != NULL) { |
| 284 | *p = '\0'; |
| 285 | } |
| 286 | } |
| 287 | if (chdir(pushd) < 0) { |
Matt Kraai | 1fa1ade | 2000-12-18 03:57:16 +0000 | [diff] [blame] | 288 | perror_msg("chdir(%s)", pushd); |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 289 | free(pushd); |
| 290 | free(d); |
| 291 | continue; |
| 292 | } |
| 293 | free(pushd); |
| 294 | free(d); |
| 295 | if (state < 0) |
| 296 | continue; |
| 297 | else |
Erik Andersen | 9ffdaa6 | 2000-02-11 21:55:04 +0000 | [diff] [blame] | 298 | fill_baseDest_buf(baseDestName, &baseDestLen); |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 299 | } |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 300 | status = setjmp(catch); |
| 301 | if (status == 0) { |
| 302 | mv_Action_first_time = 1; |
Mark Whitley | f57c944 | 2000-12-07 19:56:48 +0000 | [diff] [blame] | 303 | if (recursive_action(baseSrcName, |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 304 | recursiveFlag, followLinks, FALSE, |
Erik Andersen | 3364d78 | 2000-03-28 00:58:14 +0000 | [diff] [blame] | 305 | cp_mv_Action, cp_mv_Action, NULL) == FALSE) goto exit_false; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 306 | if (dz_i == is_mv && |
Mark Whitley | f57c944 | 2000-12-07 19:56:48 +0000 | [diff] [blame] | 307 | recursive_action(baseSrcName, |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 308 | recursiveFlag, followLinks, TRUE, |
Erik Andersen | 3364d78 | 2000-03-28 00:58:14 +0000 | [diff] [blame] | 309 | rm_Action, rm_Action, NULL) == FALSE) goto exit_false; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 310 | } |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 311 | if (flags_memo) |
| 312 | *(baseDestName + baseDestLen) = '\0'; |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 313 | } |
Matt Kraai | 3e856ce | 2000-12-01 02:55:13 +0000 | [diff] [blame] | 314 | return EXIT_SUCCESS; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 315 | exit_false: |
Matt Kraai | 3e856ce | 2000-12-01 02:55:13 +0000 | [diff] [blame] | 316 | return EXIT_FAILURE; |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 317 | } |
| 318 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 319 | /* |
| 320 | Local Variables: |
| 321 | c-file-style: "linux" |
| 322 | c-basic-offset: 4 |
| 323 | tab-width: 4 |
| 324 | End: |
| 325 | */ |