skalibs

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

env_string.c (351B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/stralloc.h>
      4 #include <skalibs/env.h>
      5 
      6 int env_string (stralloc *sa, char const *const *envp, size_t envlen)
      7 {
      8   size_t salen = sa->len ;
      9   size_t i = 0 ;
     10   for (; i < envlen ; i++)
     11   {
     12     if (!stralloc_cats(sa, envp[i]) || !stralloc_0(sa))
     13     {
     14       sa->len = salen ;
     15       return 0 ;
     16     }
     17   }
     18   return 1 ;
     19 }