13a42736dSMatthew Dillon /* 23a42736dSMatthew Dillon * CPDUP.H 33a42736dSMatthew Dillon */ 43a42736dSMatthew Dillon 53a42736dSMatthew Dillon #include <sys/param.h> 63a42736dSMatthew Dillon #include <sys/time.h> 73a42736dSMatthew Dillon #include <sys/stat.h> 858860d7dSMatthew Dillon #include <sys/file.h> 958860d7dSMatthew Dillon 103a42736dSMatthew Dillon #include <fcntl.h> 113a42736dSMatthew Dillon #include <stdio.h> 123a42736dSMatthew Dillon #include <stdlib.h> 133a42736dSMatthew Dillon #include <stdarg.h> 1471de6efcSMatthew Dillon #include <stddef.h> 158f0e7bc1SMatthew Dillon #include <stdint.h> 163a42736dSMatthew Dillon #include <string.h> 177d2302acSAaron LI #include <strings.h> 183a42736dSMatthew Dillon #include <errno.h> 1958860d7dSMatthew Dillon #include <unistd.h> 203a42736dSMatthew Dillon #include <utime.h> 213a42736dSMatthew Dillon #include <dirent.h> 223a42736dSMatthew Dillon #include <signal.h> 233a42736dSMatthew Dillon #include <pwd.h> 24293141b7SMatthew Dillon #include <fnmatch.h> 253a42736dSMatthew Dillon #include <assert.h> 263a42736dSMatthew Dillon 272b7dbe20SMatthew Dillon /* 282b7dbe20SMatthew Dillon * See ./mklinux script 292b7dbe20SMatthew Dillon * 302b7dbe20SMatthew Dillon * This is a horrible hack. lchmod also seems to be missing 312b7dbe20SMatthew Dillon * on the Debian system I am testing compatibility on (which will 322b7dbe20SMatthew Dillon * break the symlink handling code), so not sure what to do about 332b7dbe20SMatthew Dillon * that. 342b7dbe20SMatthew Dillon * 352b7dbe20SMatthew Dillon * XXX TODO 362b7dbe20SMatthew Dillon */ 372b7dbe20SMatthew Dillon #ifdef __linux 382b7dbe20SMatthew Dillon 392b7dbe20SMatthew Dillon #define __printflike(a, b) 402b7dbe20SMatthew Dillon #define __printf0like(a, b) 412b7dbe20SMatthew Dillon #define __aligned(n) 422b7dbe20SMatthew Dillon #define __dead2 432b7dbe20SMatthew Dillon #define __unused 442b7dbe20SMatthew Dillon 452b7dbe20SMatthew Dillon #define lchmod chmod /* horrible hack */ 462b7dbe20SMatthew Dillon 472b7dbe20SMatthew Dillon size_t strlcpy(char *dst, const char *src, size_t size); 482b7dbe20SMatthew Dillon 492b7dbe20SMatthew Dillon #endif 502b7dbe20SMatthew Dillon 51*49828960SMatthew Dillon #define VERSION "1.22" 5266641ee9SAaron LI #define AUTHORS "Matt Dillon, Dima Ruban, & Oliver Fromme" 5366641ee9SAaron LI 54b58f1e66SSascha Wildner void logstd(const char *ctl, ...) __printflike(1, 2); 55b58f1e66SSascha Wildner void logerr(const char *ctl, ...) __printflike(1, 2); 56b58f1e66SSascha Wildner char *mprintf(const char *ctl, ...) __printflike(1, 2); 57a3127495SSascha Wildner void fatal(const char *ctl, ...) __dead2 __printf0like(1, 2); 58577109eaSMatthew Dillon char *fextract(FILE *fi, int n, int *pc, int skip); 59577109eaSMatthew Dillon 60c0538630SMatthew Dillon int16_t hc_bswap16(int16_t var); 61c0538630SMatthew Dillon int32_t hc_bswap32(int32_t var); 62c0538630SMatthew Dillon int64_t hc_bswap64(int64_t var); 63c0538630SMatthew Dillon 644d858d58SMatthew Dillon #ifndef NOMD5 65577109eaSMatthew Dillon int md5_check(const char *spath, const char *dpath); 66577109eaSMatthew Dillon void md5_flush(void); 674d858d58SMatthew Dillon #endif 68577109eaSMatthew Dillon 69c0538630SMatthew Dillon extern const char *UseCpFile; 70577109eaSMatthew Dillon extern const char *MD5CacheFile; 7175bd842aSMatthew Dillon extern const char *UseHLPath; 72577109eaSMatthew Dillon 7375bd842aSMatthew Dillon extern int AskConfirmation; 7475bd842aSMatthew Dillon extern int SafetyOpt; 7575bd842aSMatthew Dillon extern int ForceOpt; 7675bd842aSMatthew Dillon extern int DeviceOpt; 7775bd842aSMatthew Dillon extern int VerboseOpt; 7875bd842aSMatthew Dillon extern int DirShowOpt; 79293141b7SMatthew Dillon extern int QuietOpt; 80698d0b11SMatthew Dillon extern int NotForRealOpt; 8175bd842aSMatthew Dillon extern int NoRemoveOpt; 8275bd842aSMatthew Dillon extern int UseMD5Opt; 8375bd842aSMatthew Dillon extern int SlaveOpt; 84577109eaSMatthew Dillon extern int SummaryOpt; 8544dd1628SMatthew Dillon extern int CompressOpt; 86c0538630SMatthew Dillon extern int ReadOnlyOpt; 87293141b7SMatthew Dillon extern int DstRootPrivs; 8875bd842aSMatthew Dillon extern int ValidateOpt; 89577109eaSMatthew Dillon 908f0e7bc1SMatthew Dillon extern int ssh_argc; 918f0e7bc1SMatthew Dillon extern const char *ssh_argv[]; 928f0e7bc1SMatthew Dillon 93577109eaSMatthew Dillon extern int64_t CountSourceBytes; 94577109eaSMatthew Dillon extern int64_t CountSourceItems; 95577109eaSMatthew Dillon extern int64_t CountCopiedItems; 96d5fdcd00SMatthew Dillon extern int64_t CountSourceReadBytes; 97d5fdcd00SMatthew Dillon extern int64_t CountTargetReadBytes; 98577109eaSMatthew Dillon extern int64_t CountWriteBytes; 99577109eaSMatthew Dillon extern int64_t CountRemovedItems; 10075bd842aSMatthew Dillon extern int64_t CountLinkedItems; 1013a42736dSMatthew Dillon 102975200d7SMatthew Dillon #ifdef DEBUG_MALLOC 103975200d7SMatthew Dillon void *debug_malloc(size_t bytes, const char *file, int line); 104975200d7SMatthew Dillon void debug_free(void *ptr); 105975200d7SMatthew Dillon 106975200d7SMatthew Dillon #define malloc(bytes) debug_malloc(bytes, __FILE__, __LINE__) 107975200d7SMatthew Dillon #define free(ptr) debug_free(ptr) 108975200d7SMatthew Dillon #endif 109