summaryrefslogtreecommitdiff
path: root/envread.c
blob: 80185de249d76afe17e1ee546e7277d4a8ac5106 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "env.h"
#include "str.h"

extern /*@null@*/char *env_get(s)
char *s;
{
  int i;
  unsigned int slen;
  char *envi;
 
  slen = str_len(s);
  for (i = 0;envi = environ[i];++i)
    if ((!str_diffn(s,envi,slen)) && (envi[slen] == '='))
      return envi + slen + 1;
  return 0;
}

extern char *env_pick()
{
  return environ[0];
}

extern char *env_findeq(s)
char *s;
{
  for (;*s;++s)
    if (*s == '=')
      return s;
  return 0;
}