File: environ.c

package info (click to toggle)
clif 0.93-9.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 4,228 kB
  • sloc: ansic: 31,464; yacc: 5,067; lex: 819; makefile: 383; sh: 48
file content (56 lines) | stat: -rw-r--r-- 808 bytes parent folder | download | duplicates (7)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "environ.h"

static char *clif_env[256];
static int count = 0;

void
init_env ()
{
  char *env, *endp;
  int i = 0;
  
  env = getenv ("CLIF_INCLUDE");
  while (NULL != (endp = strchr (env, PATH_SEPARATOR)))
    {
      *endp = STRING_TERMINATOR;
      clif_env[i++] = env;
      env = endp + 1;
    }
  clif_env[i] = env;
  clif_env[i + 1] = NULL;
}


char *
get_next_path ()
{
  if (NULL == clif_env[count])
    {
      count = 0;
      return ((char *) NULL);
    }
  else
    {
      return (clif_env[count++]);
    }
}

int
check_valid_name (name)
     char *name;
{
  int n = strlen (name);
  
  if ('l' == name[n - 1] && 'c' == name[n - 2] && '.' == name[n - 3])
    {
      return (1);
    }
  else
    {
      return (0);
    }
}