blob: 8f4c27675c2e8791036780f77c3574fe96be7320 (
plain) (
blame)
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
|
#ifndef MULTIHOME_MULTIHOME_H
#define MULTIHOME_MULTIHOME_H
#ifdef ENABLE_TESTING
#include <assert.h>
#endif
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <pwd.h>
#include <sys/utsname.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <libgen.h>
#include <wait.h>
#include <argp.h>
#include <time.h>
#include <dirent.h>
#include <regex.h>
#include "config.h"
#define VERSION "0.0.1"
#define MULTIHOME_ROOT "home_local"
#define MULTIHOME_TOPDIR "topdir"
#define MULTIHOME_CFGDIR ".multihome"
#define MULTIHOME_CFG_TRANSFER "transfer"
#define MULTIHOME_CFG_HOST_GROUP "host_group"
#define MULTIHOME_CFG_SKEL "skel/" // NOTE: Trailing slash is required
#define MULTIHOME_MARKER ".multihome_controlled"
#define OS_SKEL_DIR "/etc/skel/" // NOTE: Trailing slash is required
#define RSYNC_ARGS "-aq"
#define COPY_NORMAL 0
#define COPY_UPDATE 1
#define DISABLE_BUFFERING \
setvbuf(stdout, NULL, _IONBF, 0); \
setvbuf(stderr, NULL, _IONBF, 0);
void free_array(void **arr, size_t nelem);
ssize_t count_substrings(const char *s, char *sub);
char **split(const char *sptr, char *delim, size_t *num_alloc);
char *find_program(const char *_name);
int shell(char *args[]);
int mkdirs(char *path);
int copy(char *source, char *dest, int mode);
int touch(char *filename);
char *get_timestamp();
void write_init_script();
void user_transfer(int copy_mode);
char *strip_domainname(char *hostname);
#endif //MULTIHOME_MULTIHOME_H
|