libssh2_knownhost_writeline(3)
β¨ libssh2_knownhost_writeline(3) β¨
okay so bestie, welcome to the libssh2 manual, and today's main character is libssh2_knownhost_writeline π
πΈ NAME πΈ
libssh2_knownhost_writeline β convert a known host to a line for storage π¦
π SYNOPSIS π
#include <libssh2.h>
int
libssh2_knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts,
struct libssh2_knownhost *known,
char *buffer, size_t buflen,
size_t *outlen,
int type);
π DESCRIPTION π
so this function takes one single known host and turns it into one single line of output that you can store, using the output format you picked with type. it's giving "glow up from struct to text" β¨
knownβ this identifies which particular known host we're talking about, iykyk πbufferβ this points to an allocated buffer π«Άbuflenβ this is the size of the buffer. and bestie, check the RETURN VALUE section for the tea on sizing πoutlenβ this must be a pointer to asize_tvariable, and it's gonna get the output length of the stored data chunk. important: that number does NOT include the trailing zero! periodt πtypeβ this specifies what file type it is, andLIBSSH2_KNOWNHOST_FILE_OPENSSHis the only currently supported format. no other options, that's the whole menu fr fr π
π₯ RETURN VALUE π₯
returns a regular libssh2 error code, where negative values are error codes and 0 indicates success π
now, if the buffer you handed over is deemed too small to fit the data libssh2 wants to store in it, you'll get LIBSSH2_ERROR_BUFFER_TOO_SMALL back π. the application is then advised to call the function again with a larger buffer. and when that happens, the outlen size will then hold the requested size, so you know exactly how much room to give it next time. not me getting rejected by a buffer π
β AVAILABILITY β
added in libssh2 1.2 β vintage, but make it iconic π
π¦ SEE ALSO π¦
okay that's the whole page bestie, go forth and write those known host lines πΈπ«Ά
libssh2 β 28 May 2009 π this manual page is brought to you by the libssh2 girlies, slay responsibly β¨
π¦ where this page comes from
- alpine 3.22: libssh2-doc 1.11.1-r3 Β· BSD-3-Clause
- alpine 3.23: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- alpine 3.24: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- arch rolling: libssh2 1.11.1-7 Β· BSD-3-Clause
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u1 Β· BSD3
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u2 Β· BSD3
- epel 10: libssh2-docs 1.11.1-9.el10_3 Β· BSD-3-Clause
- epel 9: libssh2-docs 1.11.1-9.el9 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-4.fc43 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-9.fc43 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-5.fc44 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-9.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- ubuntu questing: libssh2-1-dev 1.11.1-1build1
- ubuntu questing: libssh2-1-dev 1.11.1-1ubuntu0.25.10.2
- ubuntu resolute: libssh2-1-dev 1.11.1-1build2 Β· BSD3
- ubuntu resolute: libssh2-1-dev 1.11.1-1ubuntu0.26.04.4 Β· BSD3
- ubuntu stonking: libssh2-1-dev 1.11.1-6 Β· BSD3
- π the page's license: BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms