From 4dcf9fa0521a1c4243c28fb2f657d8029317e55e Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 17 May 2024 22:19:26 +0000 Subject: Fix some bits and pieces of the new doc Signed-off-by: Laurent Bercot --- doc/libstddjb/env.html | 43 ++++++++++++++++++++++--------------------- doc/libstddjb/envalloc.html | 6 +++--- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/doc/libstddjb/env.html b/doc/libstddjb/env.html index 05917c4..aff9257 100644 --- a/doc/libstddjb/env.html +++ b/doc/libstddjb/env.html @@ -39,7 +39,7 @@ and implemented in the libskarnet.a or libskarnet.so library.

-

Modif bytestrings

+

Bytestrings for environment modifications

A few functions in env.h (and many in exec.h) @@ -53,13 +53,13 @@ environment variables, or to remove them from the environment.

Fetching variables

-char const *env_get (char const *s)
+char const *env_get (char const *s)
Deprecated alias of getenv().

-char const *ucspi_get (char const *s)
+char const *ucspi_get (char const *s)
Prepends the current UCSPI protocol to s and returns that environment variable. For instance, uscpi_get("REMOTEEUID") would return the contents of the environment @@ -69,7 +69,7 @@ if the variable that was specifically requested is not found.

-char const *env_get2 (char const *const *envp, char const *s)
+char const *env_get2 (char const *const *envp, char const *s)
Similar to getenv(), but searches in envp instead of the current process's environment.

@@ -79,31 +79,31 @@ process's environment.

Despite the name, these functions also work for argvs.

-size_t env_len (char const *const* envp)
-Returns the number of elements in the array of strings envp up (but -not including) the first null pointer. +size_t env_len (char const *const* envp)
+Returns the number of elements in the array of strings envp up to, but +not including, the first null pointer.

-int env_string (stralloc *sa, char const *const *envp, size_t envlen)
+int env_string (stralloc *sa, char const *const *envp, size_t envlen)
Serializes the array of NUL-terminated strings envp with envlen elements into a series of contiguous NUL-terminated strings in the stralloc *sa.

-int env_make (char const **v, size_t argc, char const *s, size_t len)
+int env_make (char const **v, size_t n, char const *s, size_t len)
Deserializes the result of env_string: pointers to the first -argc contiguous NUL-terminated strings contained in the byte-string +n contiguous NUL-terminated strings contained in the byte-string s of length len are written to v. Returns 1 on -success, or 0 EINVAL if s does not end in a NUL.
+success, or 0 EINVAL if s does not end in a NUL.
Note that this function does not write NULL to the final value of v.

Environment modification

-int env_addmodif (stralloc *sa, char const *s, char const *t)
+int env_addmodif (stralloc *sa, char const *s, char const *t)
Adds an instruction to the modif contained in *sa. If t is null, add an instruction to remove the variable s from the environment. If t is not null, add an instruction to always set the @@ -111,16 +111,17 @@ variable s to t.

-size_t env_merge (char const **v, size_t vmax, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen)
+size_t env_merge (char const **v, size_t vmax, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen)
Takes the environment with envlen variables contained in envp, applies the modifications encoded in the modif modifs of length -modiflen, and stores the result in v. It only tries to store -up to vmax variables. Returns the number of elements now in +modiflen, and stores the result in v with a terminating NULL. +It only tries to store up to vmax-1 variables, which makes vmax +entries after the terminating NULL. Returns the number of elements now in v, or 0 if the resulting v would be larger than vmax.

-size_t env_merg (char const **v, size_t vmax, char const *const *envp, char const *modifs, size_t modiflen)
+size_t env_merg (char const **v, size_t vmax, char const *const *envp, char const *modifs, size_t modiflen)
Similar to the above function, but envp is assumed to be NULL terminated.

@@ -128,7 +129,7 @@ terminated.

Envdir functions

-int envdir_internal (char const *path, stralloc *modifs, unsigned int options, char nullis)
+int envdir_internal (char const *path, stralloc *modifs, unsigned int options, char nullis)
Essentially s6-envdir as library. options is a bitwise OR of SKALIBS_ENVDIR_VERBATIM, SKALIBS_ENVDIR_NOCHOMP and SKALIBS_ENVDIR_NOCLAMP, which @@ -140,21 +141,21 @@ the program it executes.

-int envdir_chomp (char const *path, stralloc *modifs)
+int envdir_chomp (char const *path, stralloc *modifs)
A macro that calls envdir_internal(path, modifs, SKALIBS_ENVDIR_NOCHOMP, '\n').

int envdir (char const *path, stralloc *modifs)
-int envdir_verbatim (char const *path, stralloc *modifs)
-int envdir_verbatim_chomp (char const *path, stralloc *modifs)
+int envdir_verbatim (char const *path, stralloc *modifs)
+int envdir_verbatim_chomp (char const *path, stralloc *modifs)
Macros that call envdir_internal(path, modifs, options, '\n'), with options set to self-explanatory values.

-int env_dump (char const *dir, mode_t mode, char const *const *envp)
+int env_dump (char const *dir, mode_t mode, char const *const *envp)
Turns the contents of the NULL terminated environment in envp into an envdir located at dir. Files are created with mode mode.

diff --git a/doc/libstddjb/envalloc.html b/doc/libstddjb/envalloc.html index fcc2534..79cb214 100644 --- a/doc/libstddjb/envalloc.html +++ b/doc/libstddjb/envalloc.html @@ -5,7 +5,7 @@ skalibs: the envalloc header - + @@ -36,7 +36,7 @@ header that lets one use genallocs of

Functions

-int envalloc_uniq (genalloc *v, char delim)
+int envalloc_uniq (genalloc *v, char delim)
Removes strings in the v that share the same prefix up to the first delim character. For instance, if delim is =, duplicate environment variables are removed. Returns the number of removed entries on @@ -44,7 +44,7 @@ success, -1 (and sets errno) on failure.

-int envalloc_0 (genalloc *v)
+int envalloc_0 (genalloc *v)
Appends a null pointer to v. Returns 1 on sucess, 0 (and sets errno) on failure.

-- cgit v1.2.3