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