51 #define PROGRAM "zipmerge"
53 #define USAGE "usage: %s [-DhIiSsV] target-zip zip...\n"
58 -h display this help message\n\
59 -V display version number\n\
60 -D ignore directory component in file names\n\
61 -I ignore case in file names\n\
62 -i ask before overwriting files\n\
63 -S don't overwrite identical files\n\
64 -s overwrite identical files without asking\n\
66 Report bugs to <libzip@nih.at>.\n";
69 Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner\n\
70 " PACKAGE " comes with ABSOLUTELY NO WARRANTY, to the extent permitted by law.\n";
72 #define OPTIONS "hVDiIsS"
74 #define CONFIRM_ALL_YES 0x001
75 #define CONFIRM_ALL_NO 0x002
76 #define CONFIRM_SAME_YES 0x010
77 #define CONFIRM_SAME_NO 0x020
144 fprintf(stderr,
"%s: out of memory\n",
progname);
156 for (
i = 0;
i <
n;
i++) {
166 for (
i = 0;
i <
n;
i++)
200 " with '%s' (%" PRIu64 " / %08x) from `%s'? ",
205 fprintf(stderr,
"%s: read error from stdin: %s\n",
progname, strerror(errno));
261 "%s: internal error: "
262 "unexpected return code from confirm (%d)\n",
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
ZIP_EXTERN void zip_error_init_with_code(zip_error_t *_Nonnull, int)
ZIP_EXTERN zip_int64_t zip_name_locate(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t)
ZIP_EXTERN zip_int64_t zip_add(zip_t *_Nonnull, const char *_Nonnull, zip_source_t *_Nonnull)
ZIP_EXTERN const char *_Nullable zip_get_name(zip_t *_Nonnull, zip_uint64_t, zip_flags_t)
ZIP_EXTERN int zip_close(zip_t *_Nonnull)
ZIP_EXTERN void zip_error_fini(zip_error_t *_Nonnull)
ZIP_EXTERN zip_source_t *_Nullable zip_source_zip(zip_t *_Nonnull, zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t)
ZIP_EXTERN void zip_source_free(zip_source_t *_Nullable)
ZIP_EXTERN zip_t *_Nullable zip_open(const char *_Nonnull, int, int *_Nullable)
ZIP_EXTERN int zip_replace(zip_t *_Nonnull, zip_uint64_t, zip_source_t *_Nonnull)
ZIP_EXTERN int zip_stat_index(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_stat_t *_Nonnull)
ZIP_EXTERN const char *_Nonnull zip_error_strerror(zip_error_t *_Nonnull)
ZIP_EXTERN zip_int64_t zip_get_num_entries(zip_t *_Nonnull, zip_flags_t)
ZIP_EXTERN const char *_Nonnull zip_strerror(zip_t *_Nonnull)
void * malloc(size_t size)
static static fork const void static count static fd const char const char static newpath char char argv
const char *_Nullable name
void error(const char *msg)
int main(int argc, char *argv[])
static zip_t * merge_zip(zip_t *, const char *, const char *)
static int confirm_replace(zip_t *, const char *, zip_uint64_t, zip_t *, const char *, zip_uint64_t)