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