1 /* 2 * CPDUP.H 3 */ 4 5 #include <sys/param.h> 6 #include <sys/time.h> 7 #include <sys/stat.h> 8 #include <sys/file.h> 9 10 #include <fcntl.h> 11 #include <stdio.h> 12 #include <stdlib.h> 13 #include <stdarg.h> 14 #include <stddef.h> 15 #include <stdint.h> 16 #include <string.h> 17 #include <strings.h> 18 #include <errno.h> 19 #include <unistd.h> 20 #include <utime.h> 21 #include <dirent.h> 22 #include <signal.h> 23 #include <pwd.h> 24 #include <fnmatch.h> 25 #include <assert.h> 26 27 /* 28 * See ./mklinux script 29 * 30 * This is a horrible hack. lchmod also seems to be missing 31 * on the Debian system I am testing compatibility on (which will 32 * break the symlink handling code), so not sure what to do about 33 * that. 34 * 35 * XXX TODO 36 */ 37 #ifdef __linux 38 39 #define __printflike(a, b) 40 #define __printf0like(a, b) 41 #define __aligned(n) 42 #define __dead2 43 #define __unused 44 45 #define lchmod chmod /* horrible hack */ 46 47 size_t strlcpy(char *dst, const char *src, size_t size); 48 49 #endif 50 51 #define VERSION "1.22" 52 #define AUTHORS "Matt Dillon, Dima Ruban, & Oliver Fromme" 53 54 void logstd(const char *ctl, ...) __printflike(1, 2); 55 void logerr(const char *ctl, ...) __printflike(1, 2); 56 char *mprintf(const char *ctl, ...) __printflike(1, 2); 57 void fatal(const char *ctl, ...) __dead2 __printf0like(1, 2); 58 char *fextract(FILE *fi, int n, int *pc, int skip); 59 60 int16_t hc_bswap16(int16_t var); 61 int32_t hc_bswap32(int32_t var); 62 int64_t hc_bswap64(int64_t var); 63 64 #ifndef NOMD5 65 int md5_check(const char *spath, const char *dpath); 66 void md5_flush(void); 67 #endif 68 69 extern const char *UseCpFile; 70 extern const char *MD5CacheFile; 71 extern const char *UseHLPath; 72 73 extern int AskConfirmation; 74 extern int SafetyOpt; 75 extern int ForceOpt; 76 extern int DeviceOpt; 77 extern int VerboseOpt; 78 extern int DirShowOpt; 79 extern int QuietOpt; 80 extern int NotForRealOpt; 81 extern int NoRemoveOpt; 82 extern int UseMD5Opt; 83 extern int SlaveOpt; 84 extern int SummaryOpt; 85 extern int CompressOpt; 86 extern int ReadOnlyOpt; 87 extern int DstRootPrivs; 88 extern int ValidateOpt; 89 90 extern int ssh_argc; 91 extern const char *ssh_argv[]; 92 93 extern int64_t CountSourceBytes; 94 extern int64_t CountSourceItems; 95 extern int64_t CountCopiedItems; 96 extern int64_t CountSourceReadBytes; 97 extern int64_t CountTargetReadBytes; 98 extern int64_t CountWriteBytes; 99 extern int64_t CountRemovedItems; 100 extern int64_t CountLinkedItems; 101 102 #ifdef DEBUG_MALLOC 103 void *debug_malloc(size_t bytes, const char *file, int line); 104 void debug_free(void *ptr); 105 106 #define malloc(bytes) debug_malloc(bytes, __FILE__, __LINE__) 107 #define free(ptr) debug_free(ptr) 108 #endif 109