xref: /dragonfly/bin/cpdup/cpdup.h (revision 75bd842a)
1 /*
2  * CPDUP.H
3  *
4  * $DragonFly: src/bin/cpdup/cpdup.h,v 1.9 2008/04/14 05:40:51 dillon Exp $
5  */
6 
7 #include <sys/param.h>
8 #include <sys/time.h>
9 #include <sys/stat.h>
10 #include <sys/file.h>
11 
12 #include <fcntl.h>
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <stdarg.h>
16 #include <stddef.h>
17 #include <stdint.h>
18 #include <string.h>
19 #include <errno.h>
20 #include <unistd.h>
21 #include <utime.h>
22 #include <dirent.h>
23 #include <signal.h>
24 #include <pwd.h>
25 #include <fnmatch.h>
26 #include <assert.h>
27 #ifndef NOMD5
28 #include <md5.h>
29 #endif
30 
31 /* Solaris needs <strings.h> for bzero(), bcopy() and bcmp(). */
32 #include <strings.h>
33 
34 #ifdef __sun
35 #include "compat_sun.h"
36 #endif
37 
38 void logstd(const char *ctl, ...) __printflike(1, 2);
39 void logerr(const char *ctl, ...) __printflike(1, 2);
40 char *mprintf(const char *ctl, ...) __printflike(1, 2);
41 void fatal(const char *ctl, ...) __printf0like(1, 2);
42 char *fextract(FILE *fi, int n, int *pc, int skip);
43 
44 int16_t hc_bswap16(int16_t var);
45 int32_t hc_bswap32(int32_t var);
46 int64_t hc_bswap64(int64_t var);
47 
48 int fsmid_check(int64_t fsmid, const char *dpath);
49 void fsmid_flush(void);
50 #ifndef NOMD5
51 int md5_check(const char *spath, const char *dpath);
52 void md5_flush(void);
53 #endif
54 
55 extern const char *UseCpFile;
56 extern const char *MD5CacheFile;
57 extern const char *FSMIDCacheFile;
58 extern const char *UseHLPath;
59 
60 extern int AskConfirmation;
61 extern int SafetyOpt;
62 extern int ForceOpt;
63 extern int DeviceOpt;
64 extern int VerboseOpt;
65 extern int DirShowOpt;
66 extern int QuietOpt;
67 extern int NotForRealOpt;
68 extern int NoRemoveOpt;
69 extern int UseMD5Opt;
70 extern int UseFSMIDOpt;
71 extern int SlaveOpt;
72 extern int SummaryOpt;
73 extern int CompressOpt;
74 extern int ReadOnlyOpt;
75 extern int DstRootPrivs;
76 extern int ValidateOpt;
77 
78 extern int ssh_argc;
79 extern const char *ssh_argv[];
80 
81 extern int64_t CountSourceBytes;
82 extern int64_t CountSourceItems;
83 extern int64_t CountCopiedItems;
84 extern int64_t CountSourceReadBytes;
85 extern int64_t CountTargetReadBytes;
86 extern int64_t CountWriteBytes;
87 extern int64_t CountRemovedItems;
88 extern int64_t CountLinkedItems;
89 
90 #ifdef DEBUG_MALLOC
91 void *debug_malloc(size_t bytes, const char *file, int line);
92 void debug_free(void *ptr);
93 
94 #define malloc(bytes)	debug_malloc(bytes, __FILE__, __LINE__)
95 #define free(ptr)	debug_free(ptr)
96 #endif
97