Newer
Older
/*
** var.h for 42sh
**
** Made by seblu
** Login <seblu@epita.fr>
**
** Started on Tue Nov 14 13:54:14 2006 seblu
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
*/
#ifndef VAR_H_
# define VAR_H_
# include <stddef.h>
enum { VAR_DEFAULT_SIZE = 25 };
typedef struct var_item
{
char *value;
char *name;
} s_var_item;
/*!
** The variable structure
** - table: The table of variables
** - count: The number of variables
** - size: The size of the table (mem alloced)
*/
typedef struct var
{
s_var_item *table;
size_t count;
size_t size;
} s_var;
/*!
** Create a malloced variable structure
**
** @return new variable structure
*/
s_var *var_init(void);
/*!
** Get a variable in a var struct
**
** @param var variable struct
** @param name variable name
**
** @return value of the variable, NULL if not exist
*/
const char *var_get(const s_var *var, const char *name);