libssh2_scp_recv(3)

πŸ“¦
version 1.11.1 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– libssh2_scp_recv β€” like, the SCP file grabber (from the libssh2 manual, bestie) πŸ’–

✨ NAME ✨

libssh2_scp_recv β€” bestie, this is how you request a remote file via SCP πŸ¦‹


🌸 SYNOPSIS 🌸

#include <libssh2.h>

LIBSSH2_CHANNEL *
libssh2_scp_recv(LIBSSH2_SESSION *session, const char *path, struct stat *sb);

πŸ’… DESCRIPTION πŸ’…

ok so first things first, no cap: this function is DEPRECATED in 1.7.0. Use the libssh2_scp_recv2(3) function instead! 🚨 like, fr fr, go use the other one, this one is giving legacy energy πŸ’€

Now the deets on the arguments, because you deserve to know:

  • session β€” the Session instance, aka the thing you got back from libssh2_session_init_ex(3) 🫢
  • path β€” the full path and filename of the file you wanna transfer. That's the remote file name, bestie, not your local one ✨
  • sb β€” gets populated with the remote file's size, mode, mtime, and atime πŸ“‹

And what does it actually do? It requests a file from the remote host via SCP. That's it, that's the whole vibe. 🌈


πŸ‘‘ RETURN VALUE πŸ‘‘

You get a pointer to a newly allocated LIBSSH2_CHANNEL instance. Iconic. But if things go sideways you get NULL on errors 😭


πŸ’€ ERRORS πŸ’€

  • LIBSSH2_ERROR_ALLOC β€” an internal memory allocation call failed. Not the moment, bestie πŸ™ˆ
  • LIBSSH2_ERROR_SCP_PROTOCOL β€” (the original page just lists it here with nothing else, so we're keeping it mysterious like that πŸŽ€)
  • LIBSSH2_ERROR_EAGAIN β€” this one's marked for non-blocking I/O but the call would block. So like, try again later, periodt ⭐

πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie!! this was libssh2 version 0.15, dated 1 Jun 2007 β€” yes, an elder, but still serving 🌸 go forth and libssh2_scp_recv2(3) instead, mwah πŸ’œπŸ’