version 1.16, 1999/11/17 09:20:17 |
version 1.17, 1999/11/22 21:02:38 |
|
|
char *curfile; |
char *curfile; |
|
|
/* This is set to non-zero to enable verbose mode. */ |
/* This is set to non-zero to enable verbose mode. */ |
int verbose = 0; |
int verbose_mode = 0; |
|
|
/* This is set to non-zero if compression is desired. */ |
/* This is set to non-zero if compression is desired. */ |
int compress = 0; |
int compress = 0; |
|
|
{ |
{ |
int pin[2], pout[2], reserved[2]; |
int pin[2], pout[2], reserved[2]; |
|
|
if (verbose) |
if (verbose_mode) |
fprintf(stderr, "Executing: host %s, user %s, command %s\n", |
fprintf(stderr, "Executing: host %s, user %s, command %s\n", |
host, remuser ? remuser : "(unspecified)", cmd); |
host, remuser ? remuser : "(unspecified)", cmd); |
|
|
|
|
args[i++] = SSH_PROGRAM; |
args[i++] = SSH_PROGRAM; |
args[i++] = "-x"; |
args[i++] = "-x"; |
args[i++] = "-oFallBackToRsh no"; |
args[i++] = "-oFallBackToRsh no"; |
if (verbose) |
if (verbose_mode) |
args[i++] = "-v"; |
args[i++] = "-v"; |
if (compress) |
if (compress) |
args[i++] = "-C"; |
args[i++] = "-C"; |
|
|
identity = optarg; |
identity = optarg; |
break; |
break; |
case 'v': |
case 'v': |
verbose = 1; |
verbose_mode = 1; |
break; |
break; |
case 'B': |
case 'B': |
batchmode = 1; |
batchmode = 1; |
|
|
|
|
remin = remout = -1; |
remin = remout = -1; |
/* Command to be executed on remote system using "ssh". */ |
/* Command to be executed on remote system using "ssh". */ |
(void)sprintf(cmd, "scp%s%s%s%s", verbose ? " -v" : "", |
(void)sprintf(cmd, "scp%s%s%s%s", verbose_mode ? " -v" : "", |
iamrecursive ? " -r" : "", pflag ? " -p" : "", |
iamrecursive ? " -r" : "", pflag ? " -p" : "", |
targetshouldbedirectory ? " -d" : ""); |
targetshouldbedirectory ? " -d" : ""); |
|
|
|
|
continue; |
continue; |
(void)sprintf(bp, |
(void)sprintf(bp, |
"%s%s -x -o'FallBackToRsh no' -n -l %s %s %s %s '%s%s%s:%s'", |
"%s%s -x -o'FallBackToRsh no' -n -l %s %s %s %s '%s%s%s:%s'", |
SSH_PROGRAM, verbose ? " -v" : "", |
SSH_PROGRAM, verbose_mode ? " -v" : "", |
suser, host, cmd, src, |
suser, host, cmd, src, |
tuser ? tuser : "", tuser ? "@" : "", |
tuser ? tuser : "", tuser ? "@" : "", |
thost, targ); |
thost, targ); |
} else |
} else |
(void)sprintf(bp, |
(void)sprintf(bp, |
"exec %s%s -x -o'FallBackToRsh no' -n %s %s %s '%s%s%s:%s'", |
"exec %s%s -x -o'FallBackToRsh no' -n %s %s %s '%s%s%s:%s'", |
SSH_PROGRAM, verbose ? " -v" : "", |
SSH_PROGRAM, verbose_mode ? " -v" : "", |
argv[i], cmd, src, |
argv[i], cmd, src, |
tuser ? tuser : "", tuser ? "@" : "", |
tuser ? tuser : "", tuser ? "@" : "", |
thost, targ); |
thost, targ); |
if (verbose) |
if (verbose_mode) |
fprintf(stderr, "Executing: %s\n", bp); |
fprintf(stderr, "Executing: %s\n", bp); |
(void)system(bp); |
(void)system(bp); |
(void)xfree(bp); |
(void)xfree(bp); |
|
|
(void)sprintf(bp, "exec %s%s%s %s %s", _PATH_CP, |
(void)sprintf(bp, "exec %s%s%s %s %s", _PATH_CP, |
iamrecursive ? " -r" : "", pflag ? " -p" : "", |
iamrecursive ? " -r" : "", pflag ? " -p" : "", |
argv[i], argv[argc - 1]); |
argv[i], argv[argc - 1]); |
if (verbose) |
if (verbose_mode) |
fprintf(stderr, "Executing: %s\n", bp); |
fprintf(stderr, "Executing: %s\n", bp); |
if (system(bp)) |
if (system(bp)) |
++errs; |
++errs; |
|
|
(unsigned int)(stb.st_mode & FILEMODEMASK), |
(unsigned int)(stb.st_mode & FILEMODEMASK), |
(unsigned long)stb.st_size, |
(unsigned long)stb.st_size, |
last); |
last); |
if (verbose) |
if (verbose_mode) |
{ |
{ |
fprintf(stderr, "Sending file modes: %s", buf); |
fprintf(stderr, "Sending file modes: %s", buf); |
fflush(stderr); |
fflush(stderr); |
|
|
(void)sprintf(path, |
(void)sprintf(path, |
"D%04o %d %.1024s\n", (unsigned int)(statp->st_mode & FILEMODEMASK), |
"D%04o %d %.1024s\n", (unsigned int)(statp->st_mode & FILEMODEMASK), |
0, last); |
0, last); |
if (verbose) |
if (verbose_mode) |
fprintf(stderr, "Entering directory: %s", path); |
fprintf(stderr, "Entering directory: %s", path); |
(void)write(remout, path, strlen(path)); |
(void)write(remout, path, strlen(path)); |
if (response() < 0) { |
if (response() < 0) { |