skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

envalloc.html (1904B)


      1 <html>
      2   <head>
      3     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      4     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      5     <meta http-equiv="Content-Language" content="en" />
      6     <title>skalibs: the envalloc header</title>
      7     <meta name="Description" content="skalibs: the envalloc header" />
      8     <meta name="Keywords" content="skalibs header envalloc environ environment array stralloc dynamic heap" />
      9     <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
     10   </head>
     11 <body>
     12 
     13 <p>
     14 <a href="index.html">libstddjb</a><br />
     15 <a href="../libskarnet.html">libskarnet</a><br />
     16 <a href="../index.html">skalibs</a><br />
     17 <a href="//skarnet.org/software/">Software</a><br />
     18 <a href="//skarnet.org/">skarnet.org</a>
     19 </p>
     20 
     21 <h1> The <tt>skalibs/envalloc.h</tt> header </h1>
     22 
     23 <p>
     24  The following functions are declared in the <tt>skalibs/env.h</tt> header,
     25 and implemented in the <tt>libskarnet.a</tt> or <tt>libskarnet.so</tt> library.
     26 </p>
     27 
     28 <h2> General information </h2>
     29 
     30 <p>
     31 <tt>envalloc.h</tt> is a supplement of <a href="env.html"><tt>env.h</tt></a>
     32 header that lets one use <a href="stralloc.html">genallocs</a> of
     33 <tt>char const *</tt> instead of fixed-size <tt>char const *[]</tt>.
     34 </p>
     35 
     36 <h2> Functions </h2>
     37 
     38 <p>
     39 <code>int envalloc_uniq (genalloc *v, char delim)</code><br>
     40 Removes strings in the <em>v</em> that share the same prefix up to the first
     41 <em>delim</em> character. For instance, if delim is <tt>=</tt>, duplicate
     42 environment variables are removed. Returns the number of removed entries on
     43 success, -1 (and sets errno) on failure.
     44 </p>
     45 
     46 <p>
     47 <code>int envalloc_0 (genalloc *v)</code><br>
     48 Appends a null pointer to <em>v</em>. Returns 1 on sucess, 0 (and sets errno)
     49 on failure.
     50 </p>
     51 
     52 <p>
     53 <tt>envalloc_make</tt> and <tt>envalloc_merge</tt> work exactly like their
     54 <tt>env.h</tt> counterparts.
     55 </p>
     56 
     57 </body>
     58 </html>