From 5a8efc84f7a3c2264926b393aafd5585deaa7195 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 12 Nov 2024 00:59:08 -0500 Subject: Add path_manip function --- include/utils.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/utils.h') diff --git a/include/utils.h b/include/utils.h index 4ade817..2756347 100644 --- a/include/utils.h +++ b/include/utils.h @@ -30,6 +30,10 @@ #define STASIS_XML_PRETTY_PRINT_PROG "xmllint" #define STASIS_XML_PRETTY_PRINT_ARGS "--format" +#define PM_APPEND 1 << 0 +#define PM_PREPEND 1 << 1 +#define PM_ONCE 1 << 2 + /** * Change directory. Push path on directory stack. * @@ -392,4 +396,13 @@ int mkdirs(const char *_path, mode_t mode); */ char *find_version_spec(char *package_name); +/** +* Manipulate the PATH environment variable +* @param path to insert (does not need to exist) +* @param mode PM_APPEND `$path:$PATH` +* @param mode PM_PREPEND `$PATH:path` +* @param mode PM_ONCE do not manipulate if `path` is present in PATH variable +*/ +int path_manip(char *path, int mode); + #endif //STASIS_UTILS_H -- cgit