summaryrefslogtreecommitdiff
path: root/doc/libstddjb/envalloc.html
blob: fcc2534852a4855030ad3429607128e83052bb8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>skalibs: the envalloc header</title>
    <meta name="Description" content="skalibs: the envalloc header" />
    <meta name="Keywords" content="skalibs header envalloc environ environment char** stralloc dynamic heap" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">libstddjb</a><br />
<a href="../libskarnet.html">libskarnet</a><br />
<a href="../index.html">skalibs</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The <tt>skalibs/envalloc.h</tt> header </h1>

<p>
 The following functions are declared in the <tt>skalibs/env.h</tt> header,
and implemented in the <tt>libskarnet.a</tt> or <tt>libskarnet.so</tt> library.
</p>

<h2> General information </h2>

<p>
<tt>envalloc.h</tt> is a supplement of <a href="env.html"><tt>env.h</tt></a>
header that lets one use <a href="stralloc.html">genallocs</a> of
<tt>char const *</tt> instead of fixed-size <tt>char const *[]</tt>.
</p>

<h2> Functions </h2>

<p>
<code>int envalloc_uniq (genalloc *v, char delim)</code><br />
Removes strings in the <em>v</em> that share the same prefix up to the first
<em>delim</em> character. For instance, if delim is <tt>=</tt>, duplicate
environment variables are removed. Returns the number of removed entries on
success, -1 (and sets errno) on failure.
</p>

<p>
<code>int envalloc_0 (genalloc *v)</code><br />
Appends a null pointer to <em>v</em>. Returns 1 on sucess, 0 (and sets errno)
on failure.
</p>

<p>
<tt>envalloc_make</tt> and <tt>envalloc_merge</tt> work exactly like their
<tt>env.h</tt> counterparts.
</p>

</body>
</html>