aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-11-13 11:30:34 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-11-13 11:30:34 -0500
commit35471289b619994c4f04fd2b6cb6d04a16cb1b33 (patch)
tree5631311b89b2b8e82be59aa8565f08301f5360ae /include
parent8af575409e01bf4e539c73bd3490a7885d9f79a9 (diff)
downloadstasis-35471289b619994c4f04fd2b6cb6d04a16cb1b33.tar.gz
Rename path_manip() to env_manipulate_pathstr()
* Add key argument to generalize the function
Diffstat (limited to 'include')
-rw-r--r--include/utils.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/utils.h b/include/utils.h
index 2756347..e26b3c5 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -30,10 +30,6 @@
#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.
*
@@ -396,13 +392,20 @@ int mkdirs(const char *_path, mode_t mode);
*/
char *find_version_spec(char *package_name);
+// mode flags for env_manipulate_pathstr
+#define PM_APPEND 1 << 0
+#define PM_PREPEND 1 << 1
+#define PM_ONCE 1 << 2
+
/**
-* Manipulate the PATH environment variable
+* Add paths to the head or tail of an environment variable.
+*
+* @param key environment variable to manipulate
* @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);
+int env_manipulate_pathstr(const char *key, char *path, int mode);
#endif //STASIS_UTILS_H