GETNETPATH(3)
π GETNETPATH(3) β the getnetpath, setnetpath, endnetpath era π
Library Functions Manual β¨ okay bestie, today we're reading the manual page that gets you a /etc/netconfig entry matching your NETPATH component. it's giving network-configuration-girlboss, fr fr. π
β¨ NAME β¨
getnetpath, setnetpath, endnetpath β get /etc/netconfig entry corresponding to NETPATH component π¦
πΈ SYNOPSIS πΈ
#include <netconfig.h>
struct netconfig *
getnetpath(void *handlep);
void *
setnetpath(void);
int
endnetpath(void *handlep);
π DESCRIPTION π
okay so the routines on this page hand your application the keys to the system network configuration database, /etc/netconfig, as it's βfilteredβ by the NETPATH environment variable (peep environ(7) for that one). and if you want other routines that access the network configuration database directly, no filtering, no middleman, go look at getnetconfig(3). π
NETPATH itself is a list of colon-separated network identifiers. that's the whole vibe. π«Ά
The getnetpath() function returns a pointer to the netconfig database entry corresponding to the first valid NETPATH component. that netconfig entry is formatted as a struct netconfig. then β plot twist β on each subsequent call, getnetpath() returns a pointer to the netconfig entry that corresponds to the next valid NETPATH component. so basically getnetpath() can be used to search the netconfig database for all networks included in the NETPATH variable. iconic behaviour. π
and when NETPATH has been exhausted? getnetpath() returns NULL. that's the end of the line bestie, no more crumbs. π
A call to setnetpath() βbindsβ to or βrewindsβ NETPATH. the setnetpath() function must be called before the first call to getnetpath() and may be called at any other time too. it returns a handle, and that handle is what getnetpath() uses. no handle, no entry, no cap. β¨
The getnetpath() function silently ignores invalid NETPATH components. a NETPATH component is invalid if there is no corresponding entry in the netconfig database. silently. ignored. it will not tell you. it's not gonna text you back about it. π
If the NETPATH variable is unset</>, getnetpath() behaves as if NETPATH were set to the sequence of βdefaultβ or βvisibleβ networks in the netconfig database, in the order in which they are listed. so it's got a backup plan, a default fit, a little fallback slay. π
The endnetpath() function may be called to βunbindβ from NETPATH when processing is complete, releasing resources for reuse. π§
β οΈ but bestie, listen to me: programmers should be aware thatendnetpath()frees all memory allocated bygetnetpath()for thestruct netconfigdata structure. all of it. so if you were still holding onto that pointer, it's gone, it's deleted, it's not coming back. π
π₯ RETURN VALUES π₯
- The
setnetpath()function returns a handle that is used bygetnetpath(). in case of an error,setnetpath()returnsNULL. π - The
endnetpath()function returns0on success and-1on failure (for example, ifsetnetpath()was not called previously). thenc_perror()ornc_sperror()function can be used to print out the reason for failure β seegetnetconfig(3). π - When first called,
getnetpath()returns a pointer to the netconfig database entry corresponding to the first validNETPATHcomponent. whenNETPATHhas been exhausted,getnetpath()returnsNULL. β
π AVAILABILITY π
These functions are part of libtirpc. π
π SEE ALSO π
and that's the page, bestie! this one came from Debian, dated April 22, 2000 β vintage, retro, still valid. go forth and filter your netconfig entries responsibly. mwah ππ β¨
π¦ where this page comes from
- alpine 3.22: libtirpc-doc 1.3.5-r0 Β· BSD-3-Clause
- alpine 3.23: libtirpc-doc 1.3.5-r1 Β· BSD-3-Clause
- alpine 3.24: libtirpc-doc 1.3.5-r1 Β· BSD-3-Clause
- arch rolling: libtirpc 1.3.8-1 Β· SISSL AND BSD-3-Clause
- centos-stream 10: libtirpc-devel 1.3.5-1.el10 Β· SISSL AND BSD-3-Clause
- centos-stream 9: libtirpc-devel 1.3.3-9.el9 Β· SISSL and BSD
- centos-stream 9: libtirpc-devel 1.3.3-9.el9 Β· SISSL and BSD
- debian bookworm: libtirpc-dev 1.3.3+ds-1 Β· BSD-3-Clause
- debian trixie: libtirpc-dev 1.3.6+ds-1 Β· BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-0.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-0.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-1.rc1.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-1.rc1.fc43 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.7-2.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.7-2.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.8-0.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.8-0.fc44 Β· SISSL AND BSD-3-Clause
- nixos 26.05: libtirpc 1.3.7
- nixpkgs unstable: libtirpc 1.3.7
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- ubuntu jammy: libtirpc-dev 1.3.2-2build1 Β· BSD-3-Clause
- ubuntu jammy: libtirpc-dev 1.3.2-2ubuntu0.1 Β· BSD-3-Clause
- ubuntu noble: libtirpc-dev 1.3.4+ds-1.1build1 Β· BSD-3-Clause
- ubuntu questing: libtirpc-dev 1.3.6+ds-1
- ubuntu resolute: libtirpc-dev 1.3.7-0.1 Β· BSD-3-Clause
- ubuntu stonking: libtirpc-dev 1.3.7+ds-1 Β· BSD-3-Clause
- Copyright 1989 AT&T
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms