X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-utils.git;a=blobdiff_plain;f=cprogs%2Frcopy-repeatedly.c;h=6468e80cfadfa7c273333b391ce2981a3c2481ab;hp=8a760e7efafb930057991087aff44d78c8ea2091;hb=d8d60f17dad9d2e9a01729d9f21b0a99f1aeb4ce;hpb=ad24e88eee844743e6834b4347720d08607b4d81 diff --git a/cprogs/rcopy-repeatedly.c b/cprogs/rcopy-repeatedly.c index 8a760e7..6468e80 100644 --- a/cprogs/rcopy-repeatedly.c +++ b/cprogs/rcopy-repeatedly.c @@ -1,7 +1,50 @@ /* * rcopy-repeatedly + * + * You say rcopy-repeatedly local-file user@host:remote-file + * and it polls for changes to local-file and copies them to + * remote-file. rcopy-repeatedly must be installed at the far end. + * You can copy in either direction but not between two remote + * locations. + * + * Limitations: + * * Cannot cope with files which are modified between us opening + * and statting them for the first time; if the file shrinks + * we may bomb out. Workaround: use rename-in-place. + * * When transferring large files, bandwidth limiter will + * be `lumpy' as the whole file is transferred and then we + * sleep. + * * Cannot copy between two local files. Workaround: a symlink + * (but presumably there was some reason you weren't doing that) + * * No ability to synchronise more than just exactly one file + * * Polls. It would be nice to use inotify or something. + * + * Inherent limitations: + * * Can only copy plain files. + * + * See the --help for options. */ - +/* + * rcopy-repeatedly is + * Copyright (C) 2008 Ian Jackson + * and the option parser we use is + * Copyright (C) 1994,1995 Ian Jackson + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 3, + * or (at your option) any later version. + * + * This 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this file; if not, consult the Free Software + * Foundation's website at www.fsf.org, or the GNU Project website at + * www.gnu.org. + */ /* * protocol is: * server sends banner @@ -219,12 +262,9 @@ static void bandlimit_sendend(uint64_t bytes, int *interval_usec_update) { static void copyfile(FILE *sf, copyfile_die_fn *sdie, const char *sxi, FILE *df, copyfile_die_fn *ddie, const char *dxi, uint64_t lstart, int amsender) { - struct timespec ts_last; int now, r; uint64_t l=lstart, done=0; - ts_last= ts_sendstart; - while (l>0) { now= l < sizeof(mainbuf) ? l : sizeof(mainbuf); if (now > txblocksz) now= txblocksz;