[go: up one dir, main page]

File: rdup.h.in

package info (click to toggle)
rdup 1.1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,324 kB
  • sloc: ansic: 3,840; sh: 3,361; exp: 271; makefile: 78; ruby: 36; perl: 4
file content (136 lines) | stat: -rw-r--r-- 3,231 bytes parent folder | download | duplicates (2)
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
#ifndef _RDUP_H
#define _RDUP_H

#include <glib.h>

#include "config.h"

/* copied from: http://www.boxbackup.org/trac/changeset/2054 */
#ifndef HAVE_DIRFD 
#define rdup_dirfd(x) (x)->dd_fd 
#endif /* HAVE_DIRFD */

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <glob.h>
#include <fcntl.h>
#include <signal.h>
#include <dirent.h>
#include <libgen.h>
#include <syslog.h>
#include <errno.h>
#include <utime.h>
#ifdef HAVE_SYS_SYSMACROS_H
#include <sys/sysmacros.h>
#endif /* HAVE_SYS_SYSMACROS_H */
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>

#ifdef HAVE_GETTEXT
#include <libintl.h>
#include <locale.h>
#define _(String) gettext (String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
#else
#define _(String) String
#endif /* HAVE_GETTEXT */

#ifdef HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
#endif /* HAVE_ATTR_XATTR_H */

#include "entry.h"
#include "common.h"

#define VERSION     "@PACKAGE_VERSION@"

#define REG_VECTOR	30
#define NOBACKUP        ".nobackup"
#define NULL_DUMP       0
#define VALUE          (void*)1 /* g_tree_lookup returns this in rdup */
#define NO_PRINT       (void*)2 /* don't print values with this flag */
#define D_STACKSIZE    100
#define MAX_CHILD_OPT  7

#define NO_SHA         "0000000000000000000000000000000000000000"

#ifdef DEBUG
    #define _DEBUG "%s():%d", __func__, __LINE__,
#else
    #define _DEBUG
#endif

struct subtract {
        GTree *d; /* diff */
        GTree *b;
};

struct remove_path {
        GTree *tree;
        size_t len;
        char *path;
};

/* child.c */
void close_pipes(GSList *, int, int);
int wait_pids(GSList *, int);
GSList *create_childeren(GSList *, GSList **, int);

/* gfunc.c */
gint gfunc_equal(gconstpointer, gconstpointer);
gboolean gfunc_free(gpointer, gpointer, gpointer);
gboolean gfunc_write(gpointer, gpointer, gpointer);
gboolean gfunc_backup(gpointer, gpointer, gpointer);
gboolean gfunc_remove(gpointer, gpointer, gpointer);
gboolean gfunc_new(gpointer, gpointer, gpointer);
gboolean gfunc_subtract(gpointer, gpointer, gpointer);
gboolean gfunc_remove_path(gpointer, gpointer, gpointer);
gboolean gfunc_regexp(GSList *, char *, size_t);
gboolean gfunc_tree2list(gpointer, gpointer, gpointer);

/* rdup.c */
void msg(const char *, ...);
void msgd(const char *, int, const char *, ...);

/* getdelim.c */
ssize_t rdup_getdelim(char **, size_t *, int, FILE *);

/* abspath.c */
char * abspath(char *);

/* signal.c */
void signal_abort(int);

/* link.c */
gchar * hlink(GHashTable *, struct rdup *);
gchar * slink(struct rdup *);

/* reverse.c */
GList * reverse(GTree *);
void  gfunc_new_list(gpointer, gpointer);
void  gfunc_remove_list(gpointer, gpointer);
void  gfunc_backup_list(gpointer, gpointer);

/* crawler.c */
void dir_crawl(GTree *, GHashTable *, GHashTable *, GHashTable *, char *);
gboolean dir_prepend(GTree *, char *, GHashTable *, GHashTable *);

/* names.c */
gchar * lookup_user(GHashTable *, uid_t);
gchar * lookup_group(GHashTable *, gid_t);

/* usage.c */
void usage(FILE *);

/* regexp.c */
int regexp_init(char *);
#endif  /* _RDUP_H */