Merge branch 'vendor/GDB'
[dragonfly.git] / bin / cpdup / cpdup.h
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
59 extern int QuietOpt;
60 extern int SummaryOpt;
61 extern int CompressOpt;
62 extern int ReadOnlyOpt;
63 extern int DstRootPrivs;
64
65 extern int ssh_argc;
66 extern const char *ssh_argv[];
67
68 extern int64_t CountSourceBytes;
69 extern int64_t CountSourceItems;
70 extern int64_t CountCopiedItems;
71 extern int64_t CountSourceReadBytes;
72 extern int64_t CountTargetReadBytes;
73 extern int64_t CountWriteBytes;
74 extern int64_t CountRemovedItems;
75
76 #ifdef DEBUG_MALLOC
77 void *debug_malloc(size_t bytes, const char *file, int line);
78 void debug_free(void *ptr);
79
80 #define malloc(bytes)   debug_malloc(bytes, __FILE__, __LINE__)
81 #define free(ptr)       debug_free(ptr)
82 #endif