diff options
| author | 2014-10-22 20:48:00 +0200 | |
|---|---|---|
| committer | 2014-10-22 22:21:06 +0200 | |
| commit | 067c7c682614fbf0b7aeb13fd8b8ba7dc4fd8bf2 (patch) | |
| tree | 0330ac9d1dee43f6fbefd85c684d1dab3ad4220f /tools/idevicebackup.c | |
| parent | 744ffa6da4839f4118b585f942985b3330ad3a32 (diff) | |
| download | libimobiledevice-067c7c682614fbf0b7aeb13fd8b8ba7dc4fd8bf2.tar.gz libimobiledevice-067c7c682614fbf0b7aeb13fd8b8ba7dc4fd8bf2.tar.bz2 | |
common: Share idevicebackup helper string_build_path() from utils
Diffstat (limited to 'tools/idevicebackup.c')
| -rw-r--r-- | tools/idevicebackup.c | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index c5315d2..67d82fd 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c | |||
| @@ -234,33 +234,6 @@ static char *str_toupper(char* str) | |||
| 234 | return res; | 234 | return res; |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | static char* build_path(const char* elem, ...) | ||
| 238 | { | ||
| 239 | if (!elem) return NULL; | ||
| 240 | va_list args; | ||
| 241 | int len = strlen(elem)+1; | ||
| 242 | va_start(args, elem); | ||
| 243 | char *arg = va_arg(args, char*); | ||
| 244 | while (arg) { | ||
| 245 | len += strlen(arg)+1; | ||
| 246 | arg = va_arg(args, char*); | ||
| 247 | } | ||
| 248 | va_end(args); | ||
| 249 | |||
| 250 | char* out = (char*)malloc(len); | ||
| 251 | strcpy(out, elem); | ||
| 252 | |||
| 253 | va_start(args, elem); | ||
| 254 | arg = va_arg(args, char*); | ||
| 255 | while (arg) { | ||
| 256 | strcat(out, "/"); | ||
| 257 | strcat(out, arg); | ||
| 258 | arg = va_arg(args, char*); | ||
| 259 | } | ||
| 260 | va_end(args); | ||
| 261 | return out; | ||
| 262 | } | ||
| 263 | |||
| 264 | static char* format_size_for_display(uint64_t size) | 237 | static char* format_size_for_display(uint64_t size) |
| 265 | { | 238 | { |
| 266 | char buf[32]; | 239 | char buf[32]; |
| @@ -370,7 +343,7 @@ static char *mobilebackup_build_path(const char *backup_directory, const char *n | |||
| 370 | strcpy(filename, name); | 343 | strcpy(filename, name); |
| 371 | if (extension != NULL) | 344 | if (extension != NULL) |
| 372 | strcat(filename, extension); | 345 | strcat(filename, extension); |
| 373 | char *path = build_path(backup_directory, filename, NULL); | 346 | char *path = string_build_path(backup_directory, filename, NULL); |
| 374 | free(filename); | 347 | free(filename); |
| 375 | return path; | 348 | return path; |
| 376 | } | 349 | } |
