File: envread.c

package info (click to toggle)
dot-forward 1:0.71-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 544 kB
  • sloc: ansic: 2,859; makefile: 321; sh: 131
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;
}