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