1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-29 13:01:14 +03:00

example: fix indentation

Tested via #1257
This commit is contained in:
Viktor Szakats
2023-12-01 09:41:39 +00:00
parent 6c53815aa7
commit 9e896e1b80
3 changed files with 23 additions and 23 deletions

View File

@ -220,7 +220,7 @@ int main(int argc, char *argv[])
}
fprintf(stderr, "Waiting for TCP connection on %s:%d...\n",
inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
forwardsock = accept(listensock, (struct sockaddr *)&sin, &sinlen);
if(forwardsock == LIBSSH2_INVALID_SOCKET) {
@ -232,7 +232,7 @@ int main(int argc, char *argv[])
sport = ntohs(sin.sin_port);
fprintf(stderr, "Forwarding connection from %s:%d here to remote %s:%d\n",
shost, sport, remote_desthost, remote_destport);
shost, sport, remote_desthost, remote_destport);
channel = libssh2_channel_direct_tcpip_ex(session, remote_desthost,
remote_destport, shost, sport);
@ -264,7 +264,7 @@ int main(int argc, char *argv[])
}
else if(len == 0) {
fprintf(stderr, "The client at %s:%d disconnected.\n", shost,
sport);
sport);
goto shutdown;
}
wr = 0;
@ -301,7 +301,7 @@ int main(int argc, char *argv[])
}
if(libssh2_channel_eof(channel)) {
fprintf(stderr, "The server at %s:%d disconnected.\n",
remote_desthost, remote_destport);
remote_desthost, remote_destport);
goto shutdown;
}
}

View File

@ -243,13 +243,13 @@ int main(int argc, char *argv[])
fprintf(stderr, "Sending NETCONF client <hello>\n");
len = snprintf(buf, sizeof(buf),
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<hello>"
"<capabilities>"
"<capability>urn:ietf:params:xml:ns:netconf:base:1.0</capability>"
"</capabilities>"
"</hello>\n"
"]]>]]>\n");
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<hello>"
"<capabilities>"
"<capability>urn:ietf:params:xml:ns:netconf:base:1.0</capability>"
"</capabilities>"
"</hello>\n"
"]]>]]>\n");
if(-1 == netconf_write(channel, buf, len))
goto shutdown;
@ -263,11 +263,11 @@ int main(int argc, char *argv[])
fprintf(stderr, "Sending NETCONF <rpc>\n");
len = snprintf(buf, sizeof(buf),
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
"<get-interface-information><terse/></get-interface-information>"
"</rpc>\n"
"]]>]]>\n");
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
"<get-interface-information><terse/></get-interface-information>"
"</rpc>\n"
"]]>]]>\n");
if(-1 == netconf_write(channel, buf, len))
goto shutdown;

View File

@ -192,7 +192,7 @@ int main(int argc, char *argv[])
}
fprintf(stderr, "Asking server to listen on remote %s:%d\n",
remote_listenhost, remote_wantport);
remote_listenhost, remote_wantport);
listener = libssh2_channel_forward_listen_ex(session, remote_listenhost,
remote_wantport, &remote_listenport, 1);
@ -204,7 +204,7 @@ int main(int argc, char *argv[])
}
fprintf(stderr, "Server is listening on %s:%d\n", remote_listenhost,
remote_listenport);
remote_listenport);
fprintf(stderr, "Waiting for remote connection\n");
channel = libssh2_channel_forward_accept(listener);
@ -216,8 +216,8 @@ int main(int argc, char *argv[])
}
fprintf(stderr,
"Accepted remote connection. Connecting to local server %s:%d\n",
local_destip, local_destport);
"Accepted remote connection. Connecting to local server %s:%d\n",
local_destip, local_destport);
forwardsock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if(forwardsock == LIBSSH2_INVALID_SOCKET) {
fprintf(stderr, "failed to open forward socket.\n");
@ -237,7 +237,7 @@ int main(int argc, char *argv[])
}
fprintf(stderr, "Forwarding connection from remote %s:%d to local %s:%d\n",
remote_listenhost, remote_listenport, local_destip, local_destport);
remote_listenhost, remote_listenport, local_destip, local_destport);
/* Must use non-blocking IO hereafter due to the current libssh2 API */
libssh2_session_set_blocking(session, 0);
@ -261,7 +261,7 @@ int main(int argc, char *argv[])
}
else if(len == 0) {
fprintf(stderr, "The local server at %s:%d disconnected.\n",
local_destip, local_destport);
local_destip, local_destport);
goto shutdown;
}
wr = 0;
@ -296,7 +296,7 @@ int main(int argc, char *argv[])
}
if(libssh2_channel_eof(channel)) {
fprintf(stderr, "The remote client at %s:%d disconnected.\n",
remote_listenhost, remote_listenport);
remote_listenhost, remote_listenport);
goto shutdown;
}
}