File: hdup.in.h

package info (click to toggle)
hdup 2.0.14-5.2
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 628 kB
  • sloc: ansic: 3,528; sh: 3,287; perl: 218; makefile: 134
file content (167 lines) | stat: -rw-r--r-- 3,697 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/* hdup header file
 *
 * Author: Miek Gieben
 * Date: Wed, 27 feb, 2002
 */

#include<stdio.h>
#include<stdlib.h>
#include<stdarg.h>
#include<unistd.h>
#include<string.h>
/* included to fix Solaris compile warning */
#include<strings.h>

#include<ctype.h>
#include<pwd.h>
#include<time.h>
#include<glob.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<sys/wait.h>

#define PROGNAME    "hdup"
#define VERSION     "1.6.0"
#define TAR         "##TAR##"
#define MCRYPT      "##MCRYPT##"
#define MDECRYPT    "##MDECRYPT##"
#define FIND        "##FIND##"
#define TOUCH	    "##TOUCH##"
#define ETCFILE     "##HDUPCONF##"
#define DEFAULT_PROTO "##SCP##"
#define FILELIST    "/filelist"
#define EXCLUDELIST "/excludelist"
#define MUTE        " > /dev/null 2>&1"
#define SPARSE	    " --sparse "
#define DATE_DEF    0
#define DATE_ISO    1
#define DATE_US     2
#define DEF_USER    "operator"

#define LOG(arg)	hdup_log arg
#define LOG_(arg)	hdup_log_nn arg
#define LOGL(arg)	hdup_log_long_nn arg
#define FATAL(arg)	hdup_fatal arg

/* fix warning on Cygwin */
#ifndef MAXPATHLEN 
#define MAXPATHLEN 256
#endif /* not MAXPATHLEN*/

#define OVERVIEW   50
#define MAXDIR     20
#define MAXHOST    10
#define DOTEND     13

#define TAR_NONE   "cpf"
#define TAR_GZIP   "cpfz"
#define TAR_BZIP   "cpfj"

#define DAILY   0
#define WEEKLY  1
#define MONTHLY 2
#define REMOTE  3
#define RESTORE 4

#define LOCK    0
#define UNLOCK  1

#define GIGABYTE 1073741824
#define MEGABYTE 1048576
#define KILOBYTE 1024
#define SECDAY   86400

#define PREV       -1
#define NEXT       1
#define MAXRESTORE 100
#define NONE       0
#define NONE_EXT   ".tar"
#define GZIP       1
#define GZIP_EXT   ".tar.gz"
#define BZIP       2
#define BZIP_EXT   ".tar.bz2"
#define CRYPT      4
#define MCRYPT_EXT ".nc"

/* the number of keywords */
#define KEYWORDS    18
/* the keywords are defined in hdupconf.c  */
#define KEY_BACKUP    0
#define KEY_EXCLUDE   1
#define KEY_REMOTE    2
#define KEY_PROTO_OPT 3
#define KEY_USER      4
#define KEY_COMP      5
#define KEY_PRE       6
#define KEY_POST      7
#define KEY_PROTO     8
#define KEY_INCLUDE   9
#define KEY_DATESPEC  10
#define KEY_ALG	      11
#define KEY_KEYFILE   12
#define KEY_REMOVE    13
#define KEY_OVERWRITE 14
#define KEY_SKIP      15
#define KEY_FORCE     16
#define KEY_SPARSE    17

/* holds the %-vars (%h,%a,%s,%e,%u) -1 */
#define SUBS    4

struct option_t {
        char *configpath;
	int specific;
};

struct argument_t {
        int scheme;
        char *host;
        char *date;
        char *extractdir;
        char *extractfile;
};

/* hold all the info about a specific host */
struct host {
        char *name;
        char *path[MAXDIR];
        char *exclude[MAXDIR]; /* holds the exclude globbing! patterns */
	char *include[MAXDIR]; /* holds the include regexp!  patterns */
        char *user;
        char *keypath;
        char *alg;
        char *configpath;
        char *remote_path;
        char *compression;  
        char *date;
	char *datespec;
        char *basename;
        char *dirname_date;
        char *dirname_etc;
        char *filelist;
        char *excludelist;
        char *inclist;
        char *archivename;
        char *prerun;
        char *postrun;
        /* define own options for each proto */
	char *proto;
        char *proto_opt;
        char *remote;
	/* folded in the option from hdup-1.5 */
        int remove;
	int overwrite;
        int skip;
        int force;
	int sparse;
};

extern unsigned int quiet;
extern char *progname;
extern char *scheme[];
extern char *keyword[];
extern char *subvar[];
extern char *dots;
extern char *spaces;
typedef struct host host_t;
typedef struct host * phost_t;