skalibs

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

env_make.c (309B)


      1 /* ISC license. */
      2 
      3 #include <string.h>
      4 #include <errno.h>
      5 #include <skalibs/env.h>
      6 
      7 int env_make (char const **v, size_t argc, char const *s, size_t len)
      8 {
      9   while (argc--)
     10   {
     11     size_t n = strlen(s) + 1 ;
     12     if (n > len) return (errno = EINVAL, 0) ;
     13     *v++ = s ; s += n ; len -= n ;
     14   }
     15   return 1 ;
     16 }