field.c File Reference

Go to the source code of this file.

Functions

int field_set (field_t *f, const char *name, const char *value)
int field_set_from_line (field_t *f, const char *ln)
const char * field_get_name (field_t *f)
const char * field_get_value (field_t *f)
int field_create (const char *name, const char *value, field_t **pf)
int field_free (field_t *f)

Function Documentation

int field_create ( const char *  name,
const char *  value,
field_t **  pf 
)

Create a field.

Create a field from name and value into *pf.

Parameters:
name field name
value field value
pf address of field pointer
Returns:
0 if successful, non-zero on error

Definition at line 148 of file field.c.

int field_free ( field_t f  ) 

Free a field.

Free field f.

Parameters:
f field object
Returns:
0, always

Definition at line 183 of file field.c.

const char * field_get_name ( field_t f  ) 

Get the name of a field.

Return the string value of field f.

Parameters:
f field object
Returns:
the (null-terminated) string corresponding to the field name

Definition at line 112 of file field.c.

const char * field_get_value ( field_t f  ) 

Get the value of a field.

Return the string value of field f.

Parameters:
f field object
Returns:
the (null-terminated) string corresponding to the field value

Definition at line 129 of file field.c.

int field_set ( field_t f,
const char *  name,
const char *  value 
)

Set a field.

Set field f to have name and value.

Parameters:
f field object
name field name
value field value
Returns:
0 if successful, non-zero on error

Definition at line 34 of file field.c.

int field_set_from_line ( field_t f,
const char *  ln 
)

Set a field from a line.

Set the name and value of field f. Name and value must be separated by ":".

Parameters:
f field object
ln line
Returns:
0 if successful, non-zero on error

Definition at line 74 of file field.c.