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 <errno.h> 18 #include <unistd.h> 19 #include <utime.h> 20 #include <dirent.h> 21 #include <signal.h> 22 #include <pwd.h> 23 #include <fnmatch.h> 24 #include <assert.h> 25 26 /* Solaris needs <strings.h> for bzero(), bcopy() and bcmp(). */ 27 #include <strings.h> 28 29 #ifdef __sun 30 #include "compat_sun.h" 31 #endif 32 33 #ifdef __linux 34 #define __printflike(a,b) 35 #define __printf0like(a,b) 36 #define __aligned(x) 37 #define __unused 38 #endif 39 40 void logstd(const char *ctl, ...) __printflike(1, 2); 41 void logerr(const char *ctl, ...) __printflike(1, 2); 42 char *mprintf(const char *ctl, ...) __printflike(1, 2); 43 void fatal(const char *ctl, ...) __dead2 __printf0like(1, 2); 44 char *fextract(FILE *fi, int n, int *pc, int skip); 45 46 int16_t hc_bswap16(int16_t var); 47 int32_t hc_bswap32(int32_t var); 48 int64_t hc_bswap64(int64_t var); 49 50 int fsmid_check(int64_t fsmid, const char *dpath); 51 void fsmid_flush(void); 52 #ifndef NOMD5 53 int md5_check(const char *spath, const char *dpath); 54 void md5_flush(void); 55 #endif 56 57 extern const char *UseCpFile; 58 extern const char *MD5CacheFile; 59 extern const char *FSMIDCacheFile; 60 extern const char *UseHLPath; 61 62 extern int AskConfirmation; 63 extern int SafetyOpt; 64 extern int ForceOpt; 65 extern int DeviceOpt; 66 extern int VerboseOpt; 67 extern int DirShowOpt; 68 extern int QuietOpt; 69 extern int NotForRealOpt; 70 extern int NoRemoveOpt; 71 extern int UseMD5Opt; 72 extern int UseFSMIDOpt; 73 extern int SlaveOpt; 74 extern int SummaryOpt; 75 extern int CompressOpt; 76 extern int ReadOnlyOpt; 77 extern int DstRootPrivs; 78 extern int ValidateOpt; 79 80 extern int ssh_argc; 81 extern const char *ssh_argv[]; 82 83 extern int64_t CountSourceBytes; 84 extern int64_t CountSourceItems; 85 extern int64_t CountCopiedItems; 86 extern int64_t CountSourceReadBytes; 87 extern int64_t CountTargetReadBytes; 88 extern int64_t CountWriteBytes; 89 extern int64_t CountRemovedItems; 90 extern int64_t CountLinkedItems; 91 92 #ifdef DEBUG_MALLOC 93 void *debug_malloc(size_t bytes, const char *file, int line); 94 void debug_free(void *ptr); 95 96 #define malloc(bytes) debug_malloc(bytes, __FILE__, __LINE__) 97 #define free(ptr) debug_free(ptr) 98 #endif 99