File: envread.c

package info (click to toggle)
qmail 1.01-5
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 2,188 kB
  • ctags: 1,711
  • sloc: ansic: 13,993; makefile: 1,914; perl: 448; sh: 377
file content (30 lines) | stat: -rw-r--r-- 439 bytes parent folder | download | duplicates (28)
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;
}