| 56 |
|
|
| 57 |
#include <sys/types.h> |
#include <sys/types.h> |
| 58 |
#include <sys/stat.h> |
#include <sys/stat.h> |
| 59 |
|
#include <sys/utime.h> |
| 60 |
#include <assert.h> |
#include <assert.h> |
| 61 |
|
|
| 62 |
#include <direct.h> |
#include <direct.h> |
| 160 |
c->scp.progress_window = NULL; |
c->scp.progress_window = NULL; |
| 161 |
c->scp.thread = (HANDLE)-1; |
c->scp.thread = (HANDLE)-1; |
| 162 |
c->scp.localfp = NULL; |
c->scp.localfp = NULL; |
| 163 |
|
c->scp.filemtime = 0; |
| 164 |
|
c->scp.fileatime = 0; |
| 165 |
} |
} |
| 166 |
if (type == TYPE_AGENT) { |
if (type == TYPE_AGENT) { |
| 167 |
c->agent_msg = buffer_init(); |
c->agent_msg = buffer_init(); |
| 244 |
|
|
| 245 |
if (c->type == TYPE_SCP) { |
if (c->type == TYPE_SCP) { |
| 246 |
c->scp.state = SCP_CLOSING; |
c->scp.state = SCP_CLOSING; |
| 247 |
if (c->scp.localfp != NULL) |
if (c->scp.localfp != NULL) { |
| 248 |
fclose(c->scp.localfp); |
fclose(c->scp.localfp); |
| 249 |
|
if (c->scp.dir == FROMREMOTE) { |
| 250 |
|
if (c->scp.fileatime > 0 && c->scp.filemtime > 0) { |
| 251 |
|
struct _utimbuf filetime; |
| 252 |
|
filetime.actime = c->scp.fileatime; |
| 253 |
|
filetime.modtime = c->scp.filemtime; |
| 254 |
|
_utime(c->scp.localfilefull, &filetime); |
| 255 |
|
} |
| 256 |
|
} |
| 257 |
|
} |
| 258 |
if (c->scp.progress_window != NULL) { |
if (c->scp.progress_window != NULL) { |
| 259 |
DestroyWindow(c->scp.progress_window); |
DestroyWindow(c->scp.progress_window); |
| 260 |
c->scp.progress_window = NULL; |
c->scp.progress_window = NULL; |
| 7310 |
_snprintf_s(sbuf, sizeof(sbuf), _TRUNCATE, "scp -t %s", c->scp.remotefile); |
_snprintf_s(sbuf, sizeof(sbuf), _TRUNCATE, "scp -t %s", c->scp.remotefile); |
| 7311 |
|
|
| 7312 |
} else { |
} else { |
| 7313 |
_snprintf_s(sbuf, sizeof(sbuf), _TRUNCATE, "scp -f %s", c->scp.remotefile); |
_snprintf_s(sbuf, sizeof(sbuf), _TRUNCATE, "scp -p -f %s", c->scp.remotefile); |
| 7314 |
|
|
| 7315 |
} |
} |
| 7316 |
buffer_put_string(msg, sbuf, strlen(sbuf)); |
buffer_put_string(msg, sbuf, strlen(sbuf)); |
| 8020 |
} |
} |
| 8021 |
|
|
| 8022 |
if (data[0] == 'T') { // Tmtime.sec mtime.usec atime.sec atime.usec |
if (data[0] == 'T') { // Tmtime.sec mtime.usec atime.sec atime.usec |
| 8023 |
// TODO: |
DWORD mtime, atime; |
| 8024 |
|
|
| 8025 |
|
sscanf_s(data, "T%ld 0 %ld 0", &mtime, &atime); |
| 8026 |
|
|
| 8027 |
|
// タイムスタンプを記録 |
| 8028 |
|
c->scp.filemtime = mtime; |
| 8029 |
|
c->scp.fileatime = atime; |
| 8030 |
|
|
| 8031 |
// リプライを返す |
// リプライを返す |
| 8032 |
goto reply; |
goto reply; |