From bbdcdb5b3bd8e0042347afa0c0575b928fceb9d4 Mon Sep 17 00:00:00 2001 From: Stefan Eßer Date: Wed, 18 Nov 2020 19:44:30 +0000 Subject: Add function getlocalbase() to libutil. This function returns the path to the local software base directory, by default "/usr/local" (or the value of _PATH_LOCALBASE in include/paths.h when building the world). The value returned can be overridden by 2 methods: - the LOCALBASE environment variable (ignored by SUID programs) - else a non-default user.localbase sysctl value Reviewed by: hps (earlier version) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D27236 --- libutil/libutil.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libutil/libutil.h b/libutil/libutil.h index 2ac5e97..bb96b2c 100644 --- a/libutil/libutil.h +++ b/libutil/libutil.h @@ -98,6 +98,8 @@ int flopen(const char *_path, int _flags, ...); int flopenat(int _dirfd, const char *_path, int _flags, ...); int forkpty(int *_amaster, char *_name, struct termios *_termp, struct winsize *_winp); +const char * + getlocalbase(void); void hexdump(const void *_ptr, int _length, const char *_hdr, int _flags); int humanize_number(char *_buf, size_t _len, int64_t _number, const char *_suffix, int _scale, int _flags); -- cgit v1.2.3-56-ge451