#include <grass/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <stdarg.h>
#include <grass/gis.h>
#include <grass/glocale.h>
Go to the source code of this file.
Data Structures | |
struct | Item |
Defines | |
#define | BAD_SYNTAX 1 |
#define | OUT_OF_RANGE 2 |
#define | MISSING_VALUE 3 |
#define | KEYLENGTH 64 |
Functions | |
int | G_disable_interactive (void) |
turns off interactive capability | |
struct Flag * | G_define_flag (void) |
return Flag structure | |
struct Option * | G_define_option (void) |
returns Option structure | |
struct Option * | G_define_standard_option (int opt) |
Create standardised Option structure. | |
struct GModule * | G_define_module (void) |
int | G_parser (int argc, char **argv) |
parse command line | |
int | G_usage (void) |
command line help/usage message | |
void | print_escaped_for_xml (FILE *fp, char *str) |
char * | G_recreate_command (void) |
struct Flag* G_define_flag | ( | void | ) | [read] |
return Flag structure
Allocates memory for the Flag structure and returns a pointer to this memory (of type struct Flag *).
Definition at line 219 of file parser.c.
References G_malloc(), G_zero(), Item::next_item, and NULL.
struct GModule* G_define_module | ( | void | ) | [read] |
struct Option* G_define_option | ( | void | ) | [read] |
returns Option structure
Allocates memory for the Option structure and returns a pointer to this memory (of type struct Option *).
Definition at line 270 of file parser.c.
References G_malloc(), G_zero(), Item::next_item, and NULL.
Referenced by G_define_standard_option().
struct Option* G_define_standard_option | ( | int | opt | ) | [read] |
Create standardised Option structure.
This function will create a standardised Option structure defined by parameter opt. A list of valid parameters can be found in gis.h. It allocates memory for the Option structure and returns a pointer to this memory (of type struct Option *).
If an invalid parameter was specified a empty Option structure will be returned (not NULL).
opt |
Definition at line 343 of file parser.c.
References G_define_option().
int G_disable_interactive | ( | void | ) |
turns off interactive capability
When a user calls a command with no arguments on the command line, the parser will enter its own standardized interactive session in which all flags and options are presented to the user for input. A call to G_disable_interactive() disables the parser's interactive prompting.
int G_parser | ( | int | argc, | |
char ** | argv | |||
) |
parse command line
The command line parameters argv and the number of parameters argc from the main() routine are passed directly to G_parser(). G_parser() accepts the command line input entered by the user, and parses this input according to the input options and/or flags that were defined by the programmer. G_parser() returns 0 if successful. If not successful, a usage statement is displayed that describes the expected and/or required options and flags and a non-zero value is returned.
argc | ||
argv |
Definition at line 585 of file parser.c.
References G_calloc(), G_debug(), G_free_tokens(), G_malloc(), G_realloc(), G_store(), G_tokenize(), G_usage(), G_warning(), getenv(), and NULL.
char* G_recreate_command | ( | void | ) |
Definition at line 2396 of file parser.c.
References G_calloc(), G_debug(), G_program_name(), G_realloc(), and NULL.
Referenced by G_command_history().
int G_usage | ( | void | ) |
command line help/usage message
Calls to G_usage() allow the programmer to print the usage message at any time. This will explain the allowed and required command line input to the user. This description is given according to the programmer's definitions for options and flags. This function becomes useful when the user enters options and/or flags on the command line that are syntactically valid to the parser, but functionally invalid for the command (e.g. an invalid file name.) For example, the parser logic doesn't directly support grouping options. If two options be specified together or not at all, the parser must be told that these options are not required and the programmer must check that if one is specified the other must be as well. If this additional check fails, then G_parser() will succeed, but the programmer can then call G_usage() to print the standard usage message and print additional information about how the two options work together.
Definition at line 878 of file parser.c.
References G_program_name(), and NULL.
Referenced by G_parser().