mirror of
https://github.com/upa/mscp.git
synced 2026-05-18 01:57:29 +08:00
add -P, equivalent to -p for just compatibility
and add a test case for -p and -P
This commit is contained in:
@@ -47,7 +47,7 @@ void usage(bool print_help) {
|
|||||||
" -r no effect\n"
|
" -r no effect\n"
|
||||||
"\n"
|
"\n"
|
||||||
" -l LOGIN_NAME login name\n"
|
" -l LOGIN_NAME login name\n"
|
||||||
" -p PORT port number\n"
|
" -p/-P PORT port number\n"
|
||||||
" -F CONFIG path to user ssh config (default ~/.ssh/config)\n"
|
" -F CONFIG path to user ssh config (default ~/.ssh/config)\n"
|
||||||
" -i IDENTITY identity file for public key authentication\n"
|
" -i IDENTITY identity file for public key authentication\n"
|
||||||
" -c CIPHER cipher spec\n"
|
" -c CIPHER cipher spec\n"
|
||||||
@@ -255,7 +255,7 @@ int main(int argc, char **argv)
|
|||||||
o.severity = MSCP_SEVERITY_WARN;
|
o.severity = MSCP_SEVERITY_WARN;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv,
|
while ((ch = getopt(argc, argv,
|
||||||
"n:m:u:I:s:S:a:b:vqDrl:p:i:F:c:M:C:g:HdNh")) != -1) {
|
"n:m:u:I:s:S:a:b:vqDrl:P:p:i:F:c:M:C:g:HdNh")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'n':
|
case 'n':
|
||||||
o.nr_threads = atoi(optarg);
|
o.nr_threads = atoi(optarg);
|
||||||
@@ -305,6 +305,8 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
strncpy(s.login_name, optarg, MSCP_SSH_MAX_LOGIN_NAME - 1);
|
strncpy(s.login_name, optarg, MSCP_SSH_MAX_LOGIN_NAME - 1);
|
||||||
break;
|
break;
|
||||||
|
case 'P':
|
||||||
|
/* fallthough for compatibility with scp */
|
||||||
case 'p':
|
case 'p':
|
||||||
if (strlen(optarg) > MSCP_SSH_MAX_PORT_STR - 1) {
|
if (strlen(optarg) > MSCP_SSH_MAX_PORT_STR - 1) {
|
||||||
fprintf(stderr, "long port string: %s\n", optarg);
|
fprintf(stderr, "long port string: %s\n", optarg);
|
||||||
|
|||||||
@@ -300,6 +300,14 @@ def test_dont_truncate_dst(mscp, src_prefix, dst_prefix):
|
|||||||
assert md5_before == md5_after
|
assert md5_before == md5_after
|
||||||
f.cleanup()
|
f.cleanup()
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix)
|
||||||
|
@pytest.mark.parametrize("src, dst", param_single_copy)
|
||||||
|
def test_set_port(mscp, src_prefix, dst_prefix, src, dst):
|
||||||
|
src.make()
|
||||||
|
run2ng([mscp, "-H", "-vvv", "-p", 21, src_prefix + src.path, dst_prefix + dst.path])
|
||||||
|
run2ng([mscp, "-H", "-vvv", "-P", 21, src_prefix + src.path, dst_prefix + dst.path])
|
||||||
|
src.cleanup()
|
||||||
|
|
||||||
@pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix)
|
@pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix)
|
||||||
def test_set_conn_interval(mscp, src_prefix, dst_prefix):
|
def test_set_conn_interval(mscp, src_prefix, dst_prefix):
|
||||||
srcs = []
|
srcs = []
|
||||||
|
|||||||
Reference in New Issue
Block a user