#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/param.h>
#include <ctype.h>
#include <sys/stat.h>
#include <unistd.h>
#include <libgen.h>
#include <string.h>
#include "options.h"
Go to the source code of this file.
|
void | display_table (FILE *f, char **table, int rows, int columns, int padding) |
|
int | get_double (double *p, const char *s) |
|
int | get_int (int *p, const char *s) |
|
void | options_banner (const char *message) |
|
void | options_dump (struct option *options, FILE *f, int write_desc) |
|
struct option * | options_find (struct option *ops, const char *name) |
|
int | options_parse_args (struct option *ops, int argc, const char *argv[]) |
|
int | options_parse_file (struct option *ops, const char *pwd, const char *filename) |
|
int | options_parse_stream (struct option *ops, const char *pwd, FILE *file) |
|
void | options_print_help (struct option *options, FILE *f) |
|
int | options_requires_argument (struct option *o) |
|
int | options_set (struct option *o, const char *value) |
|
void | options_set_passed (struct option *o) |
|
int | options_try_pair (struct option *ops, const char *name, const char *value) |
|
int | options_valid (struct option *o) |
|
const char * | options_value_as_string (struct option *o) |
|
char * | strdup_ (const char *s) |
|
#define MAX_LINE_LENGTH 10000 |
void display_table |
( |
FILE * |
f, |
|
|
char ** |
table, |
|
|
int |
rows, |
|
|
int |
columns, |
|
|
int |
padding |
|
) |
| |
int get_double |
( |
double * |
p, |
|
|
const char * |
s |
|
) |
| |
Return 1 if ok.
Definition at line 58 of file options.c.
int get_int |
( |
int * |
p, |
|
|
const char * |
s |
|
) |
| |
Return 1 if ok.
Definition at line 47 of file options.c.
void options_banner |
( |
const char * |
message | ) |
|
User-friendly interface
Definition at line 33 of file options.c.
void options_dump |
( |
struct option * |
options, |
|
|
FILE * |
f, |
|
|
int |
write_desc |
|
) |
| |
struct option* options_find |
( |
struct option * |
ops, |
|
|
const char * |
name |
|
) |
| |
Finds an option in the array. Returns 0 if not found.
Definition at line 219 of file options.c.
int options_parse_args |
( |
struct option * |
ops, |
|
|
int |
argc, |
|
|
const char * |
argv[] |
|
) |
| |
Returns 0 on error
Definition at line 66 of file options.c.
int options_parse_file |
( |
struct option * |
ops, |
|
|
const char * |
pwd, |
|
|
const char * |
file |
|
) |
| |
Returns 0 on error
Definition at line 180 of file options.c.
int options_parse_stream |
( |
struct option * |
ops, |
|
|
const char * |
pwd, |
|
|
FILE * |
file |
|
) |
| |
void options_print_help |
( |
struct option * |
options, |
|
|
FILE * |
f |
|
) |
| |
int options_requires_argument |
( |
struct option * |
o | ) |
|
Returns true if the option needs an argument
Definition at line 126 of file options.c.
int options_set |
( |
struct option * |
op, |
|
|
const char * |
value |
|
) |
| |
Returns 0 on error.
Definition at line 242 of file options.c.
void options_set_passed |
( |
struct option * |
o | ) |
|
Flags the option as passed
Definition at line 120 of file options.c.
int options_try_pair |
( |
struct option * |
ops, |
|
|
const char * |
name, |
|
|
const char * |
value |
|
) |
| |
Returns 0 on error
Definition at line 228 of file options.c.
int options_valid |
( |
struct option * |
o | ) |
|
const char * options_value_as_string |
( |
struct option * |
o | ) |
|
char* strdup_ |
( |
const char * |
s | ) |
|
Our version of strdup.
Definition at line 38 of file options.c.
const char* options_banner_string = "" |
char options_value_as_string_buf[1000] |
|
static |