blob: 103e84621518bf3f818542c9a7848d162df05832 [file] [log] [blame]
Wayne Davison0f78b812006-04-25 20:23:34 +00001/*
Martin Poolcd8e38b2002-04-08 04:12:31 +00002 * This file contains really simple implementations for rsync global
3 * functions, so that module test harnesses can run standalone.
Wayne Davison0f78b812006-04-25 20:23:34 +00004 *
5 * Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
Wayne Davison445640e2009-01-03 10:57:14 -08006 * Copyright (C) 2003-2009 Wayne Davison
Wayne Davison0f78b812006-04-25 20:23:34 +00007 *
8 * This program is free software; you can redistribute it and/or modify
Wayne Davison8e41b682007-07-10 13:55:49 +00009 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
Wayne Davison0f78b812006-04-25 20:23:34 +000012 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
Wayne Davisone7c67062006-04-25 23:51:12 +000018 * You should have received a copy of the GNU General Public License along
Wayne Davison4fd842f2007-07-07 05:33:14 +000019 * with this program; if not, visit the http://fsf.org website.
Wayne Davison0f78b812006-04-25 20:23:34 +000020 */
21
22#include "rsync.h"
Martin Poolcd8e38b2002-04-08 04:12:31 +000023
24int modify_window = 0;
Wayne Davison9b9114e2003-09-11 04:48:13 +000025int module_id = -1;
Wayne Davisond649b782005-10-15 19:11:36 +000026int relative_paths = 0;
Wayne Davison4a70af62005-11-12 19:53:20 +000027int human_readable = 0;
Wayne Davison93977bc2006-05-03 00:49:31 +000028int module_dirlen = 0;
Wayne Davisone9489cd2008-05-17 09:30:46 -070029int preserve_xattrs = 0;
Wayne Davisonbaed67e2006-02-24 01:56:29 +000030mode_t orig_umask = 002;
Wayne Davisona7260c42004-07-29 16:06:38 +000031char *partial_dir;
Wayne Davison7c735362007-07-02 22:06:48 +000032char *module_dir;
Wayne Davison819bfe42008-03-20 10:42:43 -070033struct filter_list_struct daemon_filter_list;
Martin Poolcd8e38b2002-04-08 04:12:31 +000034
Wayne Davison24c906d2003-08-22 00:31:46 +000035 void rprintf(UNUSED(enum logcode code), const char *format, ...)
Martin Poolcd8e38b2002-04-08 04:12:31 +000036{
37 va_list ap;
38 va_start(ap, format);
39 vfprintf(stderr, format, ap);
40 va_end(ap);
41}
42
Wayne Davisona3c8b362004-05-15 19:31:05 +000043 void rsyserr(UNUSED(enum logcode code), int errcode, const char *format, ...)
44{
45 va_list ap;
46 fputs(RSYNC_NAME ": ", stderr);
47 va_start(ap, format);
48 vfprintf(stderr, format, ap);
49 va_end(ap);
50 fprintf(stderr, ": %s (%d)\n", strerror(errcode), errcode);
51}
52
Martin Poolcd8e38b2002-04-08 04:12:31 +000053 void _exit_cleanup(int code, const char *file, int line)
54{
55 fprintf(stderr, "exit(%d): %s(%d)\n",
56 code, file, line);
57 exit(code);
58}
Wayne Davisond542c202003-07-01 21:45:29 +000059
Wayne Davison1df02d12008-03-24 10:09:00 -070060 int check_filter(UNUSED(struct filter_list_struct *listp), UNUSED(enum logcode code),
61 UNUSED(const char *name), UNUSED(int name_is_dir))
Wayne Davisond542c202003-07-01 21:45:29 +000062{
Wayne Davison24c906d2003-08-22 00:31:46 +000063 /* This function doesn't really get called in this test context, so
64 * just return 0. */
65 return 0;
Wayne Davisond542c202003-07-01 21:45:29 +000066}
Wayne Davison9b9114e2003-09-11 04:48:13 +000067
Wayne Davison5a473542007-09-23 21:05:15 +000068 int make_bak_dir(UNUSED(const char *fullpath))
69{
70 return -1;
71}
72
Wayne Davisone9489cd2008-05-17 09:30:46 -070073 int copy_xattrs(UNUSED(const char *source), UNUSED(const char *dest))
74{
75 return -1;
76}
77
Wayne Davison9b9114e2003-09-11 04:48:13 +000078 char *lp_name(UNUSED(int mod))
79{
Wayne Davison70c81b02006-07-03 22:30:13 +000080 return NULL;
Wayne Davison9b9114e2003-09-11 04:48:13 +000081}
82
83 BOOL lp_use_chroot(UNUSED(int mod))
84{
Wayne Davison70c81b02006-07-03 22:30:13 +000085 return 0;
Wayne Davison9b9114e2003-09-11 04:48:13 +000086}
87
Wayne Davisonea0ea352006-09-24 03:11:41 +000088 const char *who_am_i(void)
89{
90 return "tester";
91}