Functions | Variables
options.c File Reference
#include "options.h"
#include "stats.h"
#include "util.h"
#include "search.h"
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <limits.h>

Functions

void options_usage (void)
 Print options usage. More...
 
int options_read (const char *option, const char *value)
 Read an option. More...
 
static const char * option_parse (const char *line, char *option, char *value, int size)
 parse an option from a string More...
 
void options_parse (const char *file)
 parse options from a file More...
 
void options_bound (void)
 Keep options between realistic values. More...
 
void options_dump (FILE *f)
 Print all global options. More...
 
void options_free (void)
 free allocated resources. More...
 

Variables

Options options
 

Function Documentation

◆ option_parse()

static const char* option_parse ( const char *  line,
char *  option,
char *  value,
int  size 
)
static

parse an option from a string

A line of the form: "[set] option [=] value" is parse into two strings: option and value. The "set" and "=" are optionnal. This function assume all string sizes are sufficient.

Parameters
lineThe string to parse.
optionA string to be filled with the option name.
valueA string to be filled with the option value.
sizeoption & value string capacity.
Returns
remaining of the string.

◆ options_bound()

void options_bound ( void  )

Keep options between realistic values.

◆ options_dump()

void options_dump ( FILE *  f)

Print all global options.

Parameters
foutput stream.

◆ options_free()

void options_free ( void  )

free allocated resources.

◆ options_parse()

void options_parse ( const char *  file)

parse options from a file

Parameters
fileOption file name.

◆ options_read()

int options_read ( const char *  option,
const char *  value 
)

Read an option.

Parameters
optionOption name.
valueOption value.
Returns
The number of arguments read (0, 1 or 2).

◆ options_usage()

void options_usage ( void  )

Print options usage.

Variable Documentation

◆ options

Options options

global options with default value