File: rdup.h.in

package info (click to toggle)
rdup 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 784 kB
  • ctags: 108
  • sloc: sh: 3,225; ansic: 1,624; perl: 565; makefile: 65
file content (116 lines) | stat: -rw-r--r-- 3,063 bytes parent folder | download
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
#ifndef _RDUP_H
#define _RDUP_H

#include <glib.h>

#include "config.h"

#ifndef HAVE_DIRFD
#define rdup_dirfd(d) ((d)->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 <regex.h>
#include <utime.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 */

#define VERSION     "@PACKAGE_VERSION@"
#define PROGNAME    "@PACKAGE_NAME@"

#define BUFSIZE         4096
#define NOBACKUP        ".nobackup"
#define NULL_DUMP       0
#define DIR_SEP         '/'
#define DIR_SEP_STR    "/"
#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 SHA1_LEN       20 /* bytes of digest */
#define NO_SHA         "0000000000000000000000000000000000000000"

#define LIST_MINSIZE   6
#define LIST_SPACEPOS  5

/* extended attributes */
#define ATTR_SIZE       10
#define R_MAX_ID        2147483646  /* 2 ^ 31 - 2 */

#define F_PERM          07777

struct entry {
        char *f_name;		/* filename, or hardlink target */
        size_t f_name_size;	/* size of filename */
	guint f_lnk;		/* 0, 1 if hardlink */
        uid_t f_uid;		/* uid */
        gid_t f_gid;		/* gid */
        mode_t f_mode;		/* mode bits */
        time_t f_ctime;		/* change time of the inode */
        off_t f_size;		/* file size */
	dev_t f_dev;		/* device id */
	ino_t f_ino;		/* inode number */
};

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

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

/* gfunc.c */
gint gfunc_equal(gconstpointer a, gconstpointer b);
gboolean gfunc_free(gpointer data, gpointer value, gpointer usr);
gboolean gfunc_write(gpointer data, gpointer value, gpointer fp);
gboolean gfunc_backup(gpointer data, gpointer value, gpointer usr);
gboolean gfunc_remove(gpointer data, gpointer value, gpointer usr);
gboolean gfunc_new(gpointer data, gpointer value, gpointer usr);
gboolean gfunc_substract(gpointer data, gpointer value, gpointer diff);
gboolean gfunc_remove_path(gpointer data, gpointer value, gpointer path);
gboolean gfunc_regexp(GSList *l, char *n);
/* rdup.c */
void msg(const char *fmt, ...);
/* getdelim.c */
ssize_t rdup_getdelim(char **lineptr, size_t *n, int delim, FILE *stream);
/* abspath.c */
char * abspath(char *path);
/* signal.c */
void signal_abort(int signal);
/* link.c */
gchar * hardlink(GHashTable *t, struct entry *e);
#endif  /* _RDUP_H */