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