blob: 71fd14ba56087e5e72a3d373dd22708b8e3cd3c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/* ISC license. */
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <skalibs/env.h>
char const *ucspi_get (char const *s)
{
char const *x = getenv("PROTO") ;
if (x)
{
size_t len = strlen(s) ;
size_t xlen = strlen(x) ;
char tmp[len + xlen + 1] ;
memcpy(tmp, x, xlen) ;
memcpy(tmp + xlen, s, len + 1) ;
x = getenv(tmp) ;
if (!x) errno = ENOENT ;
}
else errno = EINVAL ;
return x ;
}
|