mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-01 07:35:38 +03:00
b5ed352aa3
Only confluct resolution, do not compile or works Conflicts: CMakeLists.txt CPackConfig.cmake ConfigureChecks.cmake client/csync_client.c cmake/Modules/DefineCompilerFlags.cmake cmake/Modules/DefineInstallationPaths.cmake cmake/Modules/FindIconv.cmake cmake/Modules/FindIniparser.cmake cmake/Modules/FindNeon.cmake config.h.cmake config/CMakeLists.txt config/ocsync.conf doc/CMakeLists.txt modules/csync_owncloud.c modules/csync_sftp2.c src/CMakeLists.txt src/csync.c src/csync.h src/csync_config.c src/csync_exclude.c src/csync_lock.c src/csync_macros.h src/csync_misc.c src/csync_misc.h src/csync_private.h src/csync_propagate.c src/csync_statedb.c src/csync_statedb.h src/csync_update.c src/csync_util.c src/csync_util.h src/std/c_dir.c src/std/c_file.c src/std/c_private.h src/std/c_string.c src/std/c_string.h src/std/c_time.c src/vio/csync_vio.c src/vio/csync_vio.h src/vio/csync_vio_file_stat.h src/vio/csync_vio_local.c src/vio/csync_vio_method.h tests/CMakeLists.txt tests/csync_tests/check_csync_statedb_load.c tests/csync_tests/check_csync_statedb_query.c tests/csync_tests/check_csync_treewalk.c tests/csync_tests/check_csync_update.c tests/ownCloud/HTTP/DAV.pm tests/ownCloud/ownCloud/Test.pm tests/std_tests/check_std_c_str.c tests/vio_tests/check_vio.c
220 lines
4.4 KiB
C
220 lines
4.4 KiB
C
/*
|
|
* libcsync -- a library to sync a directory with another
|
|
*
|
|
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
|
|
#include "c_lib.h"
|
|
#include "vio/csync_vio_module.h"
|
|
#include "vio/csync_vio_file_stat.h"
|
|
|
|
#ifdef NDEBUG
|
|
#define DEBUG_DUMMY(x)
|
|
#else
|
|
#define DEBUG_DUMMY(x) printf x
|
|
#endif
|
|
|
|
csync_vio_method_handle_t *mh = NULL;
|
|
csync_vio_file_stat_t fs;
|
|
|
|
/*
|
|
* file functions
|
|
*/
|
|
|
|
static csync_vio_method_handle_t *dummy_open(const char *durl, int flags, mode_t mode) {
|
|
(void) durl;
|
|
(void) flags;
|
|
(void) mode;
|
|
|
|
return &mh;
|
|
}
|
|
|
|
static csync_vio_method_handle_t *dummy_creat(const char *durl, mode_t mode) {
|
|
(void) durl;
|
|
(void) mode;
|
|
|
|
return &mh;
|
|
}
|
|
|
|
static int dummy_close(csync_vio_method_handle_t *fhandle) {
|
|
(void) fhandle;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static ssize_t dummy_read(csync_vio_method_handle_t *fhandle, void *buf, size_t count) {
|
|
(void) fhandle;
|
|
(void) buf;
|
|
(void) count;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static ssize_t dummy_write(csync_vio_method_handle_t *fhandle, const void *buf, size_t count) {
|
|
(void) fhandle;
|
|
(void) buf;
|
|
(void) count;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int64_t dummy_lseek(csync_vio_method_handle_t *fhandle, int64_t offset, int whence) {
|
|
(void) fhandle;
|
|
(void) offset;
|
|
(void) whence;
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* directory functions
|
|
*/
|
|
|
|
static csync_vio_method_handle_t *dummy_opendir(const char *name) {
|
|
(void) name;
|
|
|
|
return &mh;
|
|
}
|
|
|
|
static int dummy_closedir(csync_vio_method_handle_t *dhandle) {
|
|
(void) dhandle;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static csync_vio_file_stat_t *dummy_readdir(csync_vio_method_handle_t *dhandle) {
|
|
(void) dhandle;
|
|
|
|
return &fs;
|
|
}
|
|
|
|
static int dummy_mkdir(const char *uri, mode_t mode) {
|
|
(void) uri;
|
|
(void) mode;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dummy_rmdir(const char *uri) {
|
|
(void) uri;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dummy_stat(const char *uri, csync_vio_file_stat_t *buf) {
|
|
time_t now;
|
|
|
|
buf->name = c_basename(uri);
|
|
if (buf->name == NULL) {
|
|
csync_vio_file_stat_destroy(buf);
|
|
return -1;
|
|
}
|
|
buf->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
|
|
|
time(&now);
|
|
buf->mtime = now;
|
|
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dummy_rename(const char *olduri, const char *newuri) {
|
|
(void) olduri;
|
|
(void) newuri;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dummy_unlink(const char *uri) {
|
|
(void) uri;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dummy_chmod(const char *uri, mode_t mode) {
|
|
(void) uri;
|
|
(void) mode;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dummy_chown(const char *uri, uid_t owner, gid_t group) {
|
|
(void) uri;
|
|
(void) owner;
|
|
(void) group;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dummy_utimes(const char *uri, const struct timeval *times) {
|
|
(void) uri;
|
|
(void) times;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dummy_commit() {
|
|
return 0;
|
|
}
|
|
|
|
csync_vio_method_t dummy_method = {
|
|
.method_table_size = sizeof(csync_vio_method_t),
|
|
.open = dummy_open,
|
|
.creat = dummy_creat,
|
|
.close = dummy_close,
|
|
.read = dummy_read,
|
|
.write = dummy_write,
|
|
.lseek = dummy_lseek,
|
|
.opendir = dummy_opendir,
|
|
.closedir = dummy_closedir,
|
|
.readdir = dummy_readdir,
|
|
.mkdir = dummy_mkdir,
|
|
.rmdir = dummy_rmdir,
|
|
.stat = dummy_stat,
|
|
.rename = dummy_rename,
|
|
.unlink = dummy_unlink,
|
|
.chmod = dummy_chmod,
|
|
.chown = dummy_chown,
|
|
.utimes = dummy_utimes,
|
|
.commit = dummy_commit
|
|
};
|
|
|
|
csync_vio_method_t *vio_module_init(const char *method_name, const char *args,
|
|
csync_auth_callback cb, void *userdata) {
|
|
DEBUG_DUMMY(("csync_dummy - method_name: %s\n", method_name));
|
|
DEBUG_DUMMY(("csync_dummy - args: %s\n", args));
|
|
|
|
(void) method_name;
|
|
(void) args;
|
|
(void) cb;
|
|
(void) userdata;
|
|
|
|
mh = (void *) method_name;
|
|
fs.mtime = 42;
|
|
|
|
return &dummy_method;
|
|
}
|
|
|
|
void vio_module_shutdown(csync_vio_method_t *method) {
|
|
(void) method;
|
|
}
|
|
|
|
/* vim: set ts=8 sw=2 et cindent: */
|