1libssh2_sftp_symlink_ex(3)      libssh2 manual      libssh2_sftp_symlink_ex(3)
2
3
4

NAME

6       libssh2_sftp_symlink_ex - read or set a symbolic link
7

SYNOPSIS

9       #include <libssh2.h>
10       #include <libssh2_sftp.h>
11
12       int
13       libssh2_sftp_symlink_ex(LIBSSH2_SFTP *sftp, const char *path,
14                               unsigned int path_len, char *target,
15                               unsigned int target_len, int link_type);
16

DESCRIPTION

18       Create a symlink or read out symlink information from the remote side.
19
20       sftp - SFTP instance as returned by libssh2_sftp_init(3)
21
22       path - Remote filesystem object to create a symlink from or resolve.
23
24       path_len - Length of the name of the remote filesystem object to create
25       a symlink from or resolve.
26
27       target - a pointer to a buffer. The buffer has different uses depending
28       what the link_type argument is set to.
29       LIBSSH2_SFTP_SYMLINK: Remote filesystem object to link to.
30       LIBSSH2_SFTP_READLINK:  Pre-allocated  buffer to resolve symlink target
31       into.
32       LIBSSH2_SFTP_REALPATH: Pre-allocated buffer to resolve realpath  target
33       into.
34
35       target_len - Length of the name of the remote filesystem target object.
36
37       link_type  -  One  of  the  three  previously mentioned constants which
38       determines the resulting behavior of this function.
39
40       These are convenience macros:
41
42       libssh2_sftp_symlink(3) : Create a symbolic link between two filesystem
43       objects.
44       libssh2_sftp_readlink(3) : Resolve a symbolic link filesystem object to
45       its next target.
46       libssh2_sftp_realpath(3) : Resolve a complex,  relative,  or  symlinked
47       filepath to its effective target.
48

RETURN VALUE

50       When  using  LIBSSH2_SFTP_SYMLINK, this funtion returns 0 on success or
51       negative on failure.
52
53       When using LIBSSH2_SFTP_READLINK or LIBSSH2_SFTP_REALPATH,  it  returns
54       the  number  of bytes it copied to the target buffer (not including the
55       terminating zero) or negative on failure.
56
57       It returns LIBSSH2_ERROR_EAGAIN when it would  otherwise  block.  While
58       LIBSSH2_ERROR_EAGAIN  is  a  negative number, it isn't really a failure
59       per se.
60
61       From 1.2.8, LIBSSH2_ERROR_BUFFER_TOO_SMALL is  returned  if  the  given
62       'target' buffer is too small to fit the requested object name.
63

BUG

65       Passing  in a too small buffer when receiving data only results in lib‐
66       ssh2 1.2.7 or earlier to not copy the entire data amount, and it is not
67       possible for the application to tell when it happens!
68

ERRORS

70       LIBSSH2_ERROR_ALLOC -  An internal memory allocation call failed.
71
72       LIBSSH2_ERROR_SOCKET_SEND - Unable to send data on socket.
73
74       LIBSSH2_ERROR_SOCKET_TIMEOUT -
75
76       LIBSSH2_ERROR_SFTP_PROTOCOL  -  An  invalid  SFTP protocol response was
77       received on the socket, or an SFTP operation caused an errorcode to  be
78       returned by the server.
79
80

SEE ALSO

82       libssh2_sftp_init(3)
83
84
85
86libssh2 0.15                      1 Jun 2007        libssh2_sftp_symlink_ex(3)
Impressum