mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-29 13:01:14 +03:00
tidy-up: avoid exclamations, prefer single quotes, in outputs
Closes #1079
This commit is contained in:
@ -136,7 +136,7 @@ int main(int argc, char *argv[])
|
||||
*/
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(sock == LIBSSH2_INVALID_SOCKET) {
|
||||
fprintf(stderr, "failed to create socket!\n");
|
||||
fprintf(stderr, "failed to create socket.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
@ -144,14 +144,14 @@ int main(int argc, char *argv[])
|
||||
sin.sin_port = htons(22);
|
||||
sin.sin_addr.s_addr = hostaddr;
|
||||
if(connect(sock, (struct sockaddr*)(&sin), sizeof(struct sockaddr_in))) {
|
||||
fprintf(stderr, "failed to connect!\n");
|
||||
fprintf(stderr, "failed to connect.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* Create a session instance */
|
||||
session = libssh2_session_init();
|
||||
if(!session) {
|
||||
fprintf(stderr, "Could not initialize SSH session!\n");
|
||||
fprintf(stderr, "Could not initialize SSH session.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ int main(int argc, char *argv[])
|
||||
if(auth_pw & 1) {
|
||||
/* We could authenticate via password */
|
||||
if(libssh2_userauth_password(session, username, password)) {
|
||||
fprintf(stderr, "Authentication by password failed!\n");
|
||||
fprintf(stderr, "Authentication by password failed.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
@ -219,7 +219,7 @@ int main(int argc, char *argv[])
|
||||
if(libssh2_userauth_keyboard_interactive(session, username,
|
||||
&kbd_callback) ) {
|
||||
fprintf(stderr,
|
||||
"Authentication by keyboard-interactive failed!\n");
|
||||
"Authentication by keyboard-interactive failed.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
else {
|
||||
@ -232,7 +232,7 @@ int main(int argc, char *argv[])
|
||||
if(libssh2_userauth_publickey_fromfile(session, username,
|
||||
pubkey, privkey,
|
||||
password)) {
|
||||
fprintf(stderr, "Authentication by public key failed!\n");
|
||||
fprintf(stderr, "Authentication by public key failed.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
else {
|
||||
@ -240,12 +240,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "No supported authentication methods found!\n");
|
||||
fprintf(stderr, "No supported authentication methods found.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "libssh2_sftp_init()!\n");
|
||||
fprintf(stderr, "libssh2_sftp_init().\n");
|
||||
sftp_session = libssh2_sftp_init(session);
|
||||
|
||||
if(!sftp_session) {
|
||||
@ -253,7 +253,7 @@ int main(int argc, char *argv[])
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
fprintf(stderr, "libssh2_sftp_open()!\n");
|
||||
fprintf(stderr, "libssh2_sftp_open().\n");
|
||||
/* Request a file via SFTP */
|
||||
sftp_handle = libssh2_sftp_open(sftp_session, sftppath,
|
||||
LIBSSH2_FXF_READ, 0);
|
||||
@ -263,13 +263,13 @@ int main(int argc, char *argv[])
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
fprintf(stderr, "libssh2_sftp_open() is done, now receive data!\n");
|
||||
fprintf(stderr, "libssh2_sftp_open() is done, now receive data.\n");
|
||||
do {
|
||||
char mem[1024];
|
||||
ssize_t nread;
|
||||
|
||||
/* loop until we fail */
|
||||
fprintf(stderr, "libssh2_sftp_read()!\n");
|
||||
fprintf(stderr, "libssh2_sftp_read().\n");
|
||||
nread = libssh2_sftp_read(sftp_handle, mem, sizeof(mem));
|
||||
if(nread > 0) {
|
||||
write(1, mem, nread);
|
||||
|
Reference in New Issue
Block a user