~ubuntu-branches/ubuntu/oneiric/clif/oneiric

« back to all changes in this revision

Viewing changes to environ.c

  • Committer: Bazaar Package Importer
  • Author(s): Adrian Bunk
  • Date: 2002-01-25 14:05:49 UTC
  • Revision ID: james.westby@ubuntu.com-20020125140549-v5mmddxqlcrgzhd2
Tags: upstream-0.93
ImportĀ upstreamĀ versionĀ 0.93

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <stdlib.h>
 
3
#include <string.h>
 
4
#include "environ.h"
 
5
 
 
6
static char *clif_env[256];
 
7
static int count = 0;
 
8
 
 
9
void
 
10
init_env ()
 
11
{
 
12
  char *env, *endp;
 
13
  int i = 0;
 
14
  
 
15
  env = getenv ("CLIF_INCLUDE");
 
16
  while (NULL != (endp = strchr (env, PATH_SEPARATOR)))
 
17
    {
 
18
      *endp = STRING_TERMINATOR;
 
19
      clif_env[i++] = env;
 
20
      env = endp + 1;
 
21
    }
 
22
  clif_env[i] = env;
 
23
  clif_env[i + 1] = NULL;
 
24
}
 
25
 
 
26
 
 
27
char *
 
28
get_next_path ()
 
29
{
 
30
  if (NULL == clif_env[count])
 
31
    {
 
32
      count = 0;
 
33
      return ((char *) NULL);
 
34
    }
 
35
  else
 
36
    {
 
37
      return (clif_env[count++]);
 
38
    }
 
39
}
 
40
 
 
41
int
 
42
check_valid_name (name)
 
43
     char *name;
 
44
{
 
45
  int n = strlen (name);
 
46
  
 
47
  if ('l' == name[n - 1] && 'c' == name[n - 2] && '.' == name[n - 3])
 
48
    {
 
49
      return (1);
 
50
    }
 
51
  else
 
52
    {
 
53
      return (0);
 
54
    }
 
55
}
 
56