static void clean_flist(struct file_list *flist, int strip_root);
+
+static void list_file_entry(struct file_struct *f)
+{
+ char perms[11] = "----------";
+ char *perm_map = "rwxrwxrwx";
+ int i;
+
+ for (i=0;i<9;i++) {
+ if (f->mode & (1<<i)) perms[9-i] = perm_map[8-i];
+ }
+ if (S_ISLNK(f->mode)) perms[0] = 'l';
+ if (S_ISDIR(f->mode)) perms[0] = 'd';
+ if (S_ISBLK(f->mode)) perms[0] = 'b';
+ if (S_ISCHR(f->mode)) perms[0] = 'c';
+ if (S_ISSOCK(f->mode)) perms[0] = 's';
+ if (S_ISFIFO(f->mode)) perms[0] = 'p';
+
+ if (preserve_links && S_ISLNK(f->mode)) {
+ rprintf(FINFO,"%s %11.0f %s %s -> %s\n",
+ perms,
+ (double)f->length, timestring(f->modtime),
+ f_name(f), f->link);
+ } else {
+ rprintf(FINFO,"%s %11.0f %s %s\n",
+ perms,
+ (double)f->length, timestring(f->modtime), f_name(f));
+ }
+}
+
+
int link_stat(const char *Path, STRUCT_STAT *Buffer)
{
#if SUPPORT_LINKS
struct file_list *flist;
unsigned char flags;
int64 start_read;
+ extern int list_only;
if (verbose && recurse && !am_server) {
rprintf(FINFO,"receiving file list ... ");
io_error |= read_int(f);
}
+ if (list_only) {
+ int i;
+ for (i=0;i<flist->count;i++) {
+ list_file_entry(flist->files[i]);
+ }
+ }
+
+
if (verbose > 2)
rprintf(FINFO,"recv_file_list done\n");
char *fnamecmp;
char fnamecmpbuf[MAXPATHLEN];
extern char *compare_dest;
+ extern int list_only;
+
+ if (list_only) return;
if (verbose > 2)
rprintf(FINFO,"recv_generator(%s,%d)\n",fname,i);
static FILE *logfile;
-/****************************************************************************
- return the date and time as a string
-****************************************************************************/
-static char *timestring(void )
-{
- static char TimeBuf[200];
- time_t t = time(NULL);
- struct tm *tm = localtime(&t);
-
-#ifdef HAVE_STRFTIME
- strftime(TimeBuf,sizeof(TimeBuf)-1,"%Y/%m/%d %T",tm);
-#else
- strlcpy(TimeBuf, asctime(tm), sizeof(TimeBuf)-1);
-#endif
-
- if (TimeBuf[strlen(TimeBuf)-1] == '\n') {
- TimeBuf[strlen(TimeBuf)-1] = 0;
- }
-
- return(TimeBuf);
-}
-
static void logit(int priority, char *buf)
{
if (logfile) {
fprintf(logfile,"%s [%d] %s",
- timestring(), (int)getpid(), buf);
+ timestring(time(NULL)), (int)getpid(), buf);
fflush(logfile);
} else {
syslog(priority, "%s", buf);
int status = 0, status2 = 0;
char *local_name = NULL;
extern int am_sender;
+ extern int list_only;
setup_protocol(f_out,f_in);
report(-1);
exit_cleanup(status);
}
+
+ if (argc == 0) list_only = 1;
send_exclude_list(f_out);
extern int am_sender;
extern char *shell_cmd;
+ if (strncasecmp(URL_PREFIX, argv[0], strlen(URL_PREFIX)) == 0) {
+ char *host, *path;
+
+ host = argv[0] + strlen(URL_PREFIX);
+ p = strchr(host,'/');
+ if (p) {
+ *p = 0;
+ path = p+1;
+ } else {
+ path="";
+ }
+ return start_socket_client(host, path, argc-1, argv+1);
+ }
+
p = find_colon(argv[0]);
if (p) {
return start_socket_client(argv[0], p+2, argc-1, argv+1);
}
- if (argc < 2) {
+ if (argc < 1) {
usage(FERROR);
exit_cleanup(1);
}
shell_path?shell_path:"");
}
- if (!am_sender && argc != 1) {
+ if (!am_sender && argc > 1) {
usage(FERROR);
exit_cleanup(1);
}
int verbose = 0;
int always_checksum = 0;
-
+int list_only = 0;
void usage(int F)
{
#define RSYNC_NAME "rsync"
#define RSYNCD_CONF "/etc/rsyncd.conf"
+#define URL_PREFIX "rsync://"
+
#define BACKUP_SUFFIX "~"
/* a non-zero CHAR_OFFSET makes the rolling sum stronger, but is
it() if you specify no path name on the remote server then the
list of accessible paths on the server will be shown.
+
+ it() if you specify no local destination then a listing of the
+ specified files on the remote server is provided
)
Some paths on the remote server may require authentication. If so then
return(copy);
}
+
+/****************************************************************************
+ return the date and time as a string
+****************************************************************************/
+char *timestring(time_t t)
+{
+ static char TimeBuf[200];
+ struct tm *tm = localtime(&t);
+
+#ifdef HAVE_STRFTIME
+ strftime(TimeBuf,sizeof(TimeBuf)-1,"%Y/%m/%d %T",tm);
+#else
+ strlcpy(TimeBuf, asctime(tm), sizeof(TimeBuf)-1);
+#endif
+
+ if (TimeBuf[strlen(TimeBuf)-1] == '\n') {
+ TimeBuf[strlen(TimeBuf)-1] = 0;
+ }
+
+ return(TimeBuf);
+}
+