TT_HOST_FILE_NETFILE(3)

πŸ“¦
version 2.5.3 Β· 2 versions
, in nixos 26.05

πŸ’… tt_host_file_netfile β€” bestie's guide to remote pathname glow-ups ✨

okay so picture this: this is a <cyan>library call</cyan> from <purple>Tt/tt_c.h</purple> that maps between local and canonical pathnames on a remote host. honestly iconic behavior. 🫢


✨ NAME ✨

tt_host_file_netfile β€” it maps between local and canonical pathnames on a remote host, and it does it slayfully. 🌈


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <Tt/tt_c.h>
char *tt_host_file_netfile(
const char *host,
const char *filename);

like, that's the whole vibe check. two args, one pointer, no drama. πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

so tt_host_file_netfile does a conversion that's equivalent to what tt_file_netfile(3) does β€” but it performs it on a remote host. same energy, different machine. 🌸

the filename argument is a pathname (absolute or relative, either one is fine bestie) that is valid on the remote host. and here's the rule: every component of filename must exist, except for the last component. so the parent directories all have to be real and present, but the actual file at the end can be a little mystery. keeping us on our toes fr. πŸ”₯

the host argument is a name of a remote host. that's it. that's the whole thing.


πŸ‘‘ RETURN VALUE πŸ‘‘

upon successful completion (and we love a success story), the tt_host_file_netfile function returns a freshly allocated null-terminated string of unspecified format β€” so don't go assuming anything about how it looks, it's giving mystery β€” which can be passed to tt_netfile_file(3) or tt_host_netfile_file(3). 🎁

otherwise? it returns an error pointer. 😭 but don't panic β€” your app can use tt_ptr_error(3) to extract one of the following Tt_status values from the returned pointer:

  • TT_ERR_PATH β€” the filename argument is a path that is not valid on the remote host. 🚫
  • TT_ERR_DBAVAIL β€” the ToolTalk database server could not be reached on host, perhaps because the host is unavailable or cannot be reached through the network. like, it ghosted us. πŸ‘»
  • TT_ERR_DBEXIST β€” the ToolTalk database server is not properly installed on host. πŸ™ˆ
  • TT_ERR_UNIMP β€” the ToolTalk database server contacted is of a version that does not support tt_host_file_netfile. πŸ’€ old server, no cap.

🌟 APPLICATION USAGE 🌟

the tt_file_netfile(3), tt_netfile_file(3), tt_host_file_netfile(3) and tt_host_netfile_file(3) functions allow an application to determine a path valid on remote hosts β€” perhaps for purposes of constructing a command string valid for remote execution on that host. iykyk. 🧚

and here's the part that actually ate: by composing the two calls, paths for files not accessible from the current host can be constructed. combo move. ✨ for example, if path /sample/file is valid on host A, a program running on host B can use

tt_host_netfile_file("C", tt_host_file_netfile("A", "/sample/file"))

to determine a path to the same file valid on host C, if such a path is possible. (note the "if such a path is possible" β€” no promises, bestie. πŸ™ˆ)

also important: allocated strings should be freed using either tt_free(3) or tt_release(3). clean up after yourself, we're not messy here. πŸŽ€

and the fun part β€” the tt_open(3) function need not be called before tt_host_file_netfile. no warm-up required, it just goes. ⭐


🌈 SEE ALSO 🌈

go read them, they're all part of the friend group. πŸ’œ


πŸ’– and that's the page!! it's a <hotpink>library call</hotpink> situation, and this whole thing lives in the same tt_host_file_netfile(library call) header/footer sandwich it always has β€” same title at the top, same title at the bottom. periodt. πŸ«Άβœ¨πŸŽ€
πŸ“¦ where this page comes from