add message.h and message.c, mscp_set|get_error()

Instead of pr_err(), libmscp uses mscp_set_error() and
applications use mscp_get_errror() to get error message.
This commit is contained in:
Ryo Nakamura
2023-03-03 21:29:43 +09:00
parent c5aa70d9c9
commit 1b9ae51974
11 changed files with 191 additions and 120 deletions

View File

@@ -63,6 +63,12 @@ struct mscp;
struct mscp *mscp_init(const char *remote_host,
struct mscp_opts *o, struct mscp_ssh_opts *s);
/* return a fd for read message from mscp */
int mscp_msg_fd(struct mscp *m);
/* get message for the most recent error (not thread safe) */
const char *mscp_get_error();
/* establish the first SFTP session. mscp_prepare() and mscp_start()
* requires mscp_connect() beforehand */
int mscp_connect(struct mscp *m);