version 1.39, 2000/09/07 20:53:00 |
version 1.40, 2000/09/21 11:11:42 |
|
|
|
|
#include "ssh.h" |
#include "ssh.h" |
#include "xmalloc.h" |
#include "xmalloc.h" |
#include <utime.h> |
|
|
|
#define _PATH_CP "cp" |
#define _PATH_CP "cp" |
|
|
|
|
off_t size; |
off_t size; |
int setimes, targisdir, wrerrno = 0; |
int setimes, targisdir, wrerrno = 0; |
char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; |
char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; |
struct utimbuf ut; |
|
int dummy_usec; |
int dummy_usec; |
|
struct timeval tv[2]; |
|
|
#define SCREWUP(str) { why = str; goto screwup; } |
#define SCREWUP(str) { why = str; goto screwup; } |
|
|
|
|
if (*cp == 'T') { |
if (*cp == 'T') { |
setimes++; |
setimes++; |
cp++; |
cp++; |
getnum(ut.modtime); |
getnum(tv[1].tv_sec); |
if (*cp++ != ' ') |
if (*cp++ != ' ') |
SCREWUP("mtime.sec not delimited"); |
SCREWUP("mtime.sec not delimited"); |
getnum(dummy_usec); |
getnum(dummy_usec); |
|
tv[1].tv_usec = 0; |
if (*cp++ != ' ') |
if (*cp++ != ' ') |
SCREWUP("mtime.usec not delimited"); |
SCREWUP("mtime.usec not delimited"); |
getnum(ut.actime); |
getnum(tv[0].tv_sec); |
if (*cp++ != ' ') |
if (*cp++ != ' ') |
SCREWUP("atime.sec not delimited"); |
SCREWUP("atime.sec not delimited"); |
getnum(dummy_usec); |
getnum(dummy_usec); |
|
tv[0].tv_usec = 0; |
if (*cp++ != '\0') |
if (*cp++ != '\0') |
SCREWUP("atime.usec not delimited"); |
SCREWUP("atime.usec not delimited"); |
(void) atomicio(write, remout, "", 1); |
(void) atomicio(write, remout, "", 1); |
|
|
sink(1, vect); |
sink(1, vect); |
if (setimes) { |
if (setimes) { |
setimes = 0; |
setimes = 0; |
if (utime(np, &ut) < 0) |
if (utimes(np, tv) < 0) |
run_err("%s: set times: %s", |
run_err("%s: set times: %s", |
np, strerror(errno)); |
np, strerror(errno)); |
} |
} |
|
|
(void) response(); |
(void) response(); |
if (setimes && wrerr == NO) { |
if (setimes && wrerr == NO) { |
setimes = 0; |
setimes = 0; |
if (utime(np, &ut) < 0) { |
if (utimes(np, tv) < 0) { |
run_err("%s: set times: %s", |
run_err("%s: set times: %s", |
np, strerror(errno)); |
np, strerror(errno)); |
wrerr = DISPLAYED; |
wrerr = DISPLAYED; |