summary refs log tree commit diff
path: root/src/libstddjb/env_string.c
blob: 7f97859191166834af730eaa78e48e995d93ec0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* ISC license. */

#include <skalibs/stralloc.h>
#include <skalibs/env.h>

int env_string (stralloc *sa, char const *const *envp, unsigned int envlen)
{
  unsigned int salen = sa->len ;
  register unsigned int i = 0 ;
  for (; i < envlen ; i++)
  {
    if (!stralloc_cats(sa, envp[i]) || !stralloc_0(sa))
    {
      sa->len = salen ;
      return 0 ;
    }
  }
  return 1 ;
}