summary refs log tree commit diff
path: root/src/env.c
blob: 1b3ef620b89007e8d4481ba87987bdb3a72f112f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* Public domain. */

#include "str.h"
#include "env.h"

extern /*@null@*/char *env_get(const char *s)
{
  int i;
  unsigned int len;

  if (!s) return 0;
  len = str_len(s);
  for (i = 0;environ[i];++i)
    if (str_start(environ[i],s) && (environ[i][len] == '='))
      return environ[i] + len + 1;
  return 0;
}