src/c/cmd.c File Reference
Command line parsing tools.
More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "logger.h"
Functions |
int | parse_basic_args (int argc, char **argv, const char *progname, BASIC_ARGS *args, void(*print_help)(void)) |
| Parse basic command line arguments for programs.
|
int | parse_tessmass_args (int argc, char **argv, const char *progname, TESSMASS_ARGS *args, void(*print_help)(void)) |
| Parse command line arguments for tessmass program.
|
int | parse_tessmodgen_args (int argc, char **argv, const char *progname, TESSMODGEN_ARGS *args, void(*print_help)(void)) |
| Parse command line arguments for tessmodgen program.
|
int | parse_tessg_args (int argc, char **argv, const char *progname, TESSG_ARGS *args) |
| Parse command line arguments for tessg* programs.
|
int | parse_tessgrd_args (int argc, char **argv, TESSGRD_ARGS *args) |
| Parse command line arguments for tessgrd program.
|
void | print_tessg_help (const char *progname) |
| Print the help message for tessg* programs.
|
void | print_tessgrd_help () |
| Print the help message for tessmkgrd program.
|
Detailed Description
Command line parsing tools.
- Author:
- Leonardo Uieda
- Date:
- 02 Feb 2011
Function Documentation
int parse_basic_args |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
const char * |
progname, |
|
|
BASIC_ARGS * |
args, |
|
|
void(*)(void) |
print_help | |
|
) |
| | |
Parse basic command line arguments for programs.
Basic arguments are: -h (for help msg), -v (for verbose), -l (for log file), --version and an input file.
- Parameters:
-
| argc | number of command line arguments |
| argv | command line arguments |
| progname | name of the specific program |
| args | to return the parsed arguments |
| print_help | pointer to a function that prints the help message for the program |
- Returns:
- Return code:
- 0: if all went well
- 1: if there were bad arguments and program should exit
- 2: if printed help or version info and program should exit
- 3: if input file was missing (doesn't log an error)
int parse_tessg_args |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
const char * |
progname, |
|
|
TESSG_ARGS * |
args | |
|
) |
| | |
Parse command line arguments for tessg* programs.
logs the bad argument warnings using logger.h
- Parameters:
-
| argc | number of command line arguments |
| argv | command line arguments |
| progname | name of the specific program |
| args | to return the parsed arguments |
- Returns:
- Return code:
- 0: if all went well
- 1: if there were bad arguments and program should exit
- 2: if printed help or version info and program should exit
int parse_tessgrd_args |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
TESSGRD_ARGS * |
args | |
|
) |
| | |
Parse command line arguments for tessgrd program.
logs the bad argument warnings using logger.h
- Parameters:
-
| argc | number of command line arguments |
| argv | command line arguments |
| args | to return the parsed arguments |
- Returns:
- Return code:
- 0: if all went well
- 1: if there were bad arguments and program should exit
- 2: if printed help or version info and program should exit
int parse_tessmass_args |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
const char * |
progname, |
|
|
TESSMASS_ARGS * |
args, |
|
|
void(*)(void) |
print_help | |
|
) |
| | |
Parse command line arguments for tessmass program.
- Parameters:
-
| argc | number of command line arguments |
| argv | command line arguments |
| progname | name of the program |
| args | to return the parsed arguments |
| print_help | pointer to a function that prints the help message for the program |
- Returns:
- Return code:
- 0: if all went well
- 1: if there were bad arguments and program should exit
- 2: if printed help or version info and program should exit
- 3: if input file was missing (doesn't log an error)
int parse_tessmodgen_args |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
const char * |
progname, |
|
|
TESSMODGEN_ARGS * |
args, |
|
|
void(*)(void) |
print_help | |
|
) |
| | |
Parse command line arguments for tessmodgen program.
- Parameters:
-
| argc | number of command line arguments |
| argv | command line arguments |
| progname | name of the program |
| args | to return the parsed arguments |
| print_help | pointer to a function that prints the help message for the program |
- Returns:
- Return code:
- 0: if all went well
- 1: if there were bad arguments and program should exit
- 2: if printed help or version info and program should exit
void print_tessg_help |
( |
const char * |
progname |
) |
|
Print the help message for tessg* programs.
- Parameters:
-
| progname | name of the specific tessg* program |
void print_tessgrd_help |
( |
|
) |
|
Print the help message for tessmkgrd program.
Prints to stdout.