Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
If an error occurs, print an explanatory string rather
[rsync/rsync.git]
/
main.c
diff --git
a/main.c
b/main.c
index
648c237
..
ca2b456
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-1,5
+1,6
@@
-/*
- Copyright (C) Andrew Tridgell 1996
+/* -*- c-file-style: "linux" -*-
+
+ Copyright (C) 1996-2000 by Andrew Tridgell
Copyright (C) Paul Mackerras 1996
This program is free software; you can redistribute it and/or modify
Copyright (C) Paul Mackerras 1996
This program is free software; you can redistribute it and/or modify
@@
-458,6
+459,11
@@
void start_server(int f_in, int f_out, int argc, char *argv[])
exit_cleanup(0);
}
exit_cleanup(0);
}
+
+/*
+ * This is called once the connection has been negotiated. It is used
+ * for rsyncd, remote-shell, and local connections.
+ */
int client_run(int f_in, int f_out, int pid, int argc, char *argv[])
{
struct file_list *flist;
int client_run(int f_in, int f_out, int pid, int argc, char *argv[])
{
struct file_list *flist;
@@
-545,6
+551,12
@@
static char *find_colon(char *s)
return p;
}
return p;
}
+
+/*
+ * Start a client for either type of remote connection. Work out
+ * whether the arguments request a remote shell or rsyncd connection,
+ * and call the appropriate connection function, then run_client.
+ */
static int start_client(int argc, char *argv[])
{
char *p;
static int start_client(int argc, char *argv[])
{
char *p;
@@
-557,11
+569,12
@@
static int start_client(int argc, char *argv[])
extern int am_sender;
extern char *shell_cmd;
extern int rsync_port;
extern int am_sender;
extern char *shell_cmd;
extern int rsync_port;
+ char *argv0 = strdup(argv[0]);
- if (strncasecmp(URL_PREFIX, argv
[0]
, strlen(URL_PREFIX)) == 0) {
+ if (strncasecmp(URL_PREFIX, argv
0
, strlen(URL_PREFIX)) == 0) {
char *host, *path;
char *host, *path;
- host = argv
[0]
+ strlen(URL_PREFIX);
+ host = argv
0
+ strlen(URL_PREFIX);
p = strchr(host,'/');
if (p) {
*p = 0;
p = strchr(host,'/');
if (p) {
*p = 0;
@@
-577,12
+590,12
@@
static int start_client(int argc, char *argv[])
return start_socket_client(host, path, argc-1, argv+1);
}
return start_socket_client(host, path, argc-1, argv+1);
}
- p = find_colon(argv
[0]
);
+ p = find_colon(argv
0
);
if (p) {
if (p[1] == ':') {
*p = 0;
if (p) {
if (p[1] == ':') {
*p = 0;
- return start_socket_client(argv
[0]
, p+2, argc-1, argv+1);
+ return start_socket_client(argv
0
, p+2, argc-1, argv+1);
}
if (argc < 1) {
}
if (argc < 1) {
@@
-592,7
+605,7
@@
static int start_client(int argc, char *argv[])
am_sender = 0;
*p = 0;
am_sender = 0;
*p = 0;
- shell_machine = argv
[0]
;
+ shell_machine = argv
0
;
shell_path = p+1;
argc--;
argv++;
shell_path = p+1;
argc--;
argv++;