83 #include <grass/gis.h>
84 #include <grass/spawn.h>
85 #include <grass/glocale.h>
87 #include "parser_local_proto.h"
99 #define MAX_MATCHES 50
106 static void set_flag(
int);
107 static int contains(
const char *,
int);
108 static int valid_option_name(
const char *);
109 static int is_option(
const char *);
110 static int match_option_1(
const char *,
const char *);
111 static int match_option(
const char *,
const char *);
112 static void set_option(
const char *);
113 static void check_opts(
void);
114 static void check_an_opt(
const char *,
int,
const char *,
const char **,
char **);
115 static int check_int(
const char *,
const char **);
116 static int check_double(
const char *,
const char **);
117 static int check_string(
const char *,
const char **,
int *);
118 static void check_required(
void);
119 static void split_opts(
void);
120 static void check_multiple_opts(
void);
121 static int check_overwrite(
void);
122 static void define_keywords(
void);
123 static int module_gui_wx(
void);
124 static void append_error(
const char *);
125 static const char *get_renamed_option(
const char *);
140 st->no_interactive = 1;
163 flag = G_malloc(
sizeof(
struct Flag));
164 st->current_flag->next_flag = flag;
167 flag = &
st->first_flag;
171 G_zero(flag,
sizeof(
struct Flag));
173 st->current_flag = flag;
177 item = G_malloc(
sizeof(
struct Item));
178 st->current_item->next_item = item;
181 item = &
st->first_item;
183 G_zero(item,
sizeof(
struct Item));
188 st->current_item = item;
217 opt = G_malloc(
sizeof(
struct Option));
218 st->current_option->next_opt = opt;
221 opt = &
st->first_option;
224 G_zero(opt,
sizeof(
struct Option));
229 st->current_option = opt;
233 item = G_malloc(
sizeof(
struct Item));
234 st->current_item->next_item = item;
237 item = &
st->first_item;
239 G_zero(item,
sizeof(
struct Item));
243 st->current_item = item;
256 struct GModule *module;
259 module = &
st->module_info;
262 G_zero(module,
sizeof(
struct GModule));
323 const char *gui_envvar;
324 char *ptr, *tmp_name, *
err;
327 char force_gui =
FALSE;
333 st->pgm_path = tmp_name;
337 i = strlen(tmp_name);
345 st->pgm_name = tmp_name;
347 if (!
st->module_info.label && !
st->module_info.description)
348 G_warning(_(
"Bug in UI description. Missing module description"));
352 opt = &
st->first_option;
353 while (
st->n_opts && opt) {
355 st->has_required = 1;
358 G_warning(_(
"Bug in UI description. Missing option key"));
359 if (!valid_option_name(opt->key))
360 G_warning(_(
"Bug in UI description. Option key <%s> is not valid"), opt->key);
361 if (!opt->label && !opt->description)
362 G_warning(_(
"Bug in UI description. Description for option <%s> missing"), opt->key ? opt->key :
"?");
367 char **tokens, delm[2];
380 opt->opts = G_calloc(cnt + 1,
sizeof(
const char *));
384 opt->opts[i] =
G_store(tokens[i]);
389 if (opt->descriptions) {
392 opt->descs = G_calloc(cnt + 1,
sizeof(
const char *));
406 while (opt->opts[j]) {
407 if (strcmp(opt->opts[j], tokens[i]) == 0) {
414 G_warning(_(
"Bug in UI description. Option '%s' in <%s> does not exist"),
415 tokens[i], opt->key);
418 opt->descs[j] =
G_store(tokens[i + 1]);
428 if (opt->multiple && opt->answers && opt->answers[0]) {
429 opt->answer = G_malloc(strlen(opt->answers[0]) + 1);
430 strcpy(opt->answer, opt->answers[0]);
431 for (i = 1; opt->answers[i]; i++) {
432 opt->answer = G_realloc(opt->answer,
433 strlen(opt->answer) +
434 strlen(opt->answers[i]) + 2);
435 strcat(opt->answer,
",");
436 strcat(opt->answer, opt->answers[i]);
439 opt->def = opt->answer;
446 && !
st->no_interactive && isatty(0) &&
447 (gui_envvar &&
G_strcasecmp(gui_envvar,
"text") != 0)) {
448 if (module_gui_wx() == 0)
452 if (argc < 2 && st->has_required && isatty(0)) {
456 else if (argc >= 2) {
459 if (strcmp(argv[1],
"help") == 0 ||
460 strcmp(argv[1],
"-help") == 0 || strcmp(argv[1],
"--help") == 0) {
467 if (strcmp(argv[1],
"--help-text") == 0) {
474 if (strcmp(argv[1],
"--interface-description") == 0) {
481 if (strcmp(argv[1],
"--html-description") == 0) {
488 if (strcmp(argv[1],
"--rst-description") == 0) {
495 if (strcmp(argv[1],
"--wps-process-description") == 0) {
502 if (strcmp(argv[1],
"--script") == 0) {
512 if (strcmp(ptr,
"help") == 0 || strcmp(ptr,
"--h") == 0 ||
513 strcmp(ptr,
"-help") == 0 || strcmp(ptr,
"--help") == 0) {
519 if (strcmp(ptr,
"--json") == 0) {
525 if (strcmp(ptr,
"--o") == 0 || strcmp(ptr,
"--overwrite") == 0) {
530 else if (strcmp(ptr,
"--v") == 0 || strcmp(ptr,
"--verbose") == 0) {
537 if (
st->quiet == 1) {
538 G_warning(_(
"Use either --quiet or --verbose flag, not both. Assuming --verbose."));
544 else if (strcmp(ptr,
"--q") == 0 || strcmp(ptr,
"--quiet") == 0) {
551 if (
st->quiet == -1) {
552 G_warning(_(
"Use either --quiet or --verbose flag, not both. Assuming --quiet."));
558 else if (strcmp(ptr,
"--qq") == 0 ) {
566 if (
st->quiet == -1) {
567 G_warning(_(
"Use either --qq or --verbose flag, not both. Assuming --qq."));
573 else if (strcmp(ptr,
"--ui") == 0) {
578 else if (*ptr ==
'-') {
584 else if (is_option(ptr)) {
590 else if (need_first_opt &&
st->n_opts) {
592 st->first_option.count++;
598 G_asprintf(&
err, _(
"Sorry <%s> is not a valid option"), ptr);
610 if (module_gui_wx() != 0)
611 G_fatal_error(_(
"Your installation doesn't include GUI, exiting."));
616 check_multiple_opts();
623 if (!
st->suppress_required)
628 if (
st->n_errors > 0) {
632 fprintf(stderr,
"\n");
633 for (i = 0; i <
st->n_errors; i++) {
634 fprintf(stderr,
"%s: %s\n", _(
"ERROR"),
st->error[i]);
641 if(print_json == 1) {
646 if (!
st->suppress_overwrite) {
647 if (check_overwrite())
675 G_debug(3,
"G_recreate_command()");
679 buff = G_calloc(1024,
sizeof(
char));
686 if (len >= nalloced) {
687 nalloced += (1024 > len) ? 1024 : len + 1;
688 buff = G_realloc(buff, nalloced);
695 slen = strlen(
" --overwrite");
696 if (len + slen >= nalloced) {
697 nalloced += (1024 > len) ? 1024 : len + 1;
698 buff = G_realloc(buff, nalloced);
700 strcpy(cur,
" --overwrite");
713 if (len + slen >= nalloced) {
714 nalloced += (1024 > len) ? 1024 : len + 1;
715 buff = G_realloc(buff, nalloced);
723 flag = &
st->first_flag;
725 if (flag->answer == 1) {
731 if (len + slen >= nalloced) {
733 (nalloced + 1024 > len + slen) ? 1024 : slen + 1;
734 buff = G_realloc(buff, nalloced);
741 flag = flag->next_flag;
745 opt = &
st->first_option;
746 while (
st->n_opts && opt) {
747 if (opt->answer && opt->answer[0] ==
'\0') {
748 slen = strlen(opt->key) + 4;
749 if (len + slen >= nalloced) {
750 nalloced += (nalloced + 1024 > len + slen) ? 1024 : slen + 1;
751 buff = G_realloc(buff, nalloced);
756 strcpy(cur, opt->key);
757 cur = strchr(cur,
'\0');
760 if (opt->type == TYPE_STRING) {
765 }
else if (opt->answer && opt->answers && opt->answers[0]) {
766 slen = strlen(opt->key) + strlen(opt->answers[0]) + 4;
767 if (len + slen >= nalloced) {
768 nalloced += (nalloced + 1024 > len + slen) ? 1024 : slen + 1;
769 buff = G_realloc(buff, nalloced);
774 strcpy(cur, opt->key);
775 cur = strchr(cur,
'\0');
778 if (opt->type == TYPE_STRING) {
782 strcpy(cur, opt->answers[0]);
783 cur = strchr(cur,
'\0');
785 for (n = 1; opt->answers[n]; n++) {
786 if (!opt->answers[n])
788 slen = strlen(opt->answers[n]) + 2;
789 if (len + slen >= nalloced) {
791 (nalloced + 1024 > len + slen) ? 1024 : slen + 1;
792 buff = G_realloc(buff, nalloced);
797 strcpy(cur, opt->answers[n]);
798 cur = strchr(cur,
'\0');
801 if (opt->type == TYPE_STRING) {
851 if (
st->n_keys >=
st->n_keys_alloc) {
852 st->n_keys_alloc += 10;
853 st->module_info.keywords = G_realloc(
st->module_info.keywords,
854 st->n_keys_alloc *
sizeof(
char *));
857 st->module_info.keywords[
st->n_keys++] =
G_store(keyword);
868 st->module_info.keywords = (
const char **)tokens;
878 char desc[KEYLENGTH];
880 if (
st->module_info.overwrite)
886 opt = &
st->first_option;
888 if (opt->gisprompt) {
890 if (strcmp(age,
"new") == 0)
913 for(i = 0; i <
st->n_keys; i++) {
915 fprintf(fd,
"%s",
st->module_info.keywords[i]);
918 format(fd,
st->module_info.keywords[i]);
920 if (i < st->n_keys - 1)
935 return st->module_info.overwrite;
938 void define_keywords(
void)
941 st->n_keys_alloc = 0;
954 int module_gui_wx(
void)
956 char script[GPATH_MAX];
964 sprintf(script,
"%s/gui/wxpython/gui_core/forms.py",
966 if (access(script, F_OK) != -1)
967 G_spawn(getenv(
"GRASS_PYTHON"), getenv(
"GRASS_PYTHON"),
990 flag = &
st->first_flag;
992 if (flag->key == f) {
994 if (flag->suppress_required)
995 st->suppress_required = 1;
996 if (flag->suppress_overwrite)
997 st->suppress_overwrite = 1;
1000 flag = flag->next_flag;
1010 int contains(
const char *s,
int c)
1020 int valid_option_name(
const char *
string)
1022 int m = strlen(
string);
1023 int n = strspn(
string,
"abcdefghijklmnopqrstuvwxyz0123456789_");
1031 if (
string[m-1] ==
'_')
1037 int is_option(
const char *
string)
1039 int n = strspn(
string,
"abcdefghijklmnopqrstuvwxyz0123456789_");
1041 return n > 0 &&
string[n] ==
'=' &&
string[0] !=
'_' &&
string[n-1] !=
'_';
1044 int match_option_1(
const char *
string,
const char *option)
1048 if (*
string ==
'\0')
1051 if (*option ==
'\0')
1054 if (*
string == *option && match_option_1(
string + 1, option + 1))
1057 if (*option ==
'_' && match_option_1(
string, option + 1))
1060 next = strchr(option,
'_');
1065 return match_option_1(
string + 1, next + 1);
1067 return match_option_1(
string, next + 1);
1070 int match_option(
const char *
string,
const char *option)
1072 return (*
string == *option)
1073 && match_option_1(
string + 1, option + 1);
1076 void set_option(
const char *
string)
1078 struct Option *at_opt =
NULL;
1079 struct Option *opt =
NULL;
1081 char the_key[KEYLENGTH];
1088 for (ptr = the_key; *
string !=
'='; ptr++,
string++)
1098 key_len = strlen(the_key);
1099 for (at_opt = &
st->first_option; at_opt; at_opt = at_opt->next_opt) {
1103 if (strcmp(the_key, at_opt->key) == 0) {
1104 matches[0] = at_opt;
1109 if (strncmp(the_key, at_opt->key, key_len) == 0 ||
1110 match_option(the_key, at_opt->key)) {
1113 matches[found++] = at_opt;
1119 int length = strlen(matches[0]->key);
1122 for (i = 1; i < found; i++) {
1123 int len = strlen(matches[i]->key);
1129 for (i = 0; prefix && i < found; i++)
1130 if (strncmp(matches[i]->key, matches[shortest]->key, length) != 0)
1133 matches[0] = matches[shortest];
1139 for (i = 0; i < found; i++) {
1140 G_asprintf(&
err, _(
"Option <%s=> matches"), matches[i]->key);
1152 const char *renamed_key =
NULL;
1154 renamed_key = get_renamed_option(the_key);
1156 for (at_opt = &
st->first_option; at_opt; at_opt = at_opt->next_opt) {
1157 if (strcmp(renamed_key, at_opt->key) == 0) {
1158 G_warning(_(
"Please update the usage of <%s>: "
1159 "option <%s> has been renamed to <%s>"),
1176 if (getenv(
"GRASS_FULL_OPTION_NAMES") && strcmp(the_key, opt->key) != 0)
1177 G_warning(_(
"<%s> is an abbreviation for <%s>"), the_key, opt->key);
1181 if (!opt->multiple) {
1182 G_asprintf(&
err, _(
"Option <%s> does not accept multiple answers"), opt->key);
1185 opt->answer = G_realloc(opt->answer,
1186 strlen(opt->answer) + strlen(
string) + 2);
1187 strcat(opt->answer,
",");
1188 strcat(opt->answer,
string);
1191 opt->answer =
G_store(
string);
1194 void check_opts(
void)
1202 opt = &
st->first_option;
1207 if (opt->multiple == 0)
1208 check_an_opt(opt->key, opt->type,
1209 opt->options, opt->opts, &opt->answer);
1211 for (ans = 0; opt->answers[ans] !=
'\0'; ans++)
1212 check_an_opt(opt->key, opt->type,
1213 opt->options, opt->opts, &opt->answers[ans]);
1220 opt->checker(opt->answer);
1222 opt = opt->next_opt;
1226 void check_an_opt(
const char *key,
int type,
const char *options,
1227 const char **opts,
char **answerp)
1229 const char *answer = *answerp;
1240 error = check_int(answer, opts);
1243 error = check_double(answer, opts);
1246 error = check_string(answer, opts, &found);
1254 _(
"Illegal range syntax for parameter <%s>\n"
1255 "\tPresented as: %s"), key, options);
1260 _(
"Value <%s> out of range for parameter <%s>\n"
1261 "\tLegal range: %s"), answer, key, options);
1266 _(
"Missing value for parameter <%s>"),
1272 _(
"Invalid value <%s> for parameter <%s>"),
1278 _(
"Value <%s> ambiguous for parameter <%s>\n"
1279 "\tValid options: %s"), answer, key, options);
1283 *answerp =
G_store(opts[found]);
1289 int check_int(
const char *ans,
const char **opts)
1294 if (strcmp(ans,
"-") == 0)
1300 if (sscanf(ans,
"%d", &d) != 1)
1306 for (i = 0; opts[i]; i++) {
1307 const char *opt = opts[i];
1310 if (contains(opt,
'-')) {
1311 if (sscanf(opt,
"%d-%d", &lo, &hi) == 2) {
1312 if (d >= lo && d <= hi)
1315 else if (sscanf(opt,
"-%d", &hi) == 1) {
1319 else if (sscanf(opt,
"%d-", &lo) == 1) {
1327 if (sscanf(opt,
"%d", &lo) == 1) {
1339 int check_double(
const char *ans,
const char **opts)
1345 if (strcmp(ans,
"-") == 0)
1351 if (sscanf(ans,
"%lf", &d) != 1)
1357 for (i = 0; opts[i]; i++) {
1358 const char *opt = opts[i];
1361 if (contains(opt,
'-')) {
1362 if (sscanf(opt,
"%lf-%lf", &lo, &hi) == 2) {
1363 if (d >= lo && d <= hi)
1366 else if (sscanf(opt,
"-%lf", &hi) == 1) {
1370 else if (sscanf(opt,
"%lf-", &lo) == 1) {
1378 if (sscanf(opt,
"%lf", &lo) == 1) {
1390 int check_string(
const char *ans,
const char **opts,
int *result)
1392 int len = strlen(ans);
1400 for (i = 0; opts[i]; i++) {
1401 if (strcmp(ans, opts[i]) == 0)
1403 if (strncmp(ans, opts[i], len) == 0 || match_option(ans, opts[i])) {
1406 matches[found++] = i;
1412 int length = strlen(opts[matches[0]]);
1415 for (i = 1; i < found; i++) {
1416 int lengthi = strlen(opts[matches[i]]);
1418 if (lengthi < length) {
1423 for (i = 0; prefix && i < found; i++)
1424 if (strncmp(opts[matches[i]], opts[matches[shortest]], length) != 0)
1427 matches[0] = matches[shortest];
1433 *result = matches[0];
1435 if (found > 0 && getenv(
"GRASS_FULL_OPTION_NAMES") && strcmp(ans, opts[matches[0]]) != 0)
1436 G_warning(_(
"<%s> is an abbreviation for <%s>"), ans, opts[matches[0]]);
1445 void check_required(
void)
1455 opt = &
st->first_option;
1457 if (opt->required && !opt->answer) {
1460 opt->key, (opt->label ? opt->label : opt->description));
1463 opt = opt->next_opt;
1467 void split_opts(
void)
1480 opt = &
st->first_option;
1485 opt->answers = G_malloc(allocated *
sizeof(
char *));
1489 opt->answers[ans_num] =
NULL;
1492 for (len = 0, ptr2 = ptr1; *ptr2 !=
'\0' && *ptr2 !=
',';
1496 opt->answers[ans_num] = G_malloc(len + 1);
1497 memcpy(opt->answers[ans_num], ptr1, len);
1498 opt->answers[ans_num][len] = 0;
1502 if (ans_num >= allocated) {
1504 opt->answers = G_realloc(opt->answers,
1505 allocated *
sizeof(
char *));
1508 opt->answers[ans_num] =
NULL;
1520 opt = opt->next_opt;
1524 void check_multiple_opts(
void)
1536 opt = &
st->first_option;
1539 if (opt->answer && strcmp(opt->answer,
"-") && opt->key_desc) {
1542 for (ptr = opt->key_desc; *ptr !=
'\0'; ptr++)
1546 for (n = 0; opt->answers[n] !=
'\0'; n++) ;
1550 _(
"Option <%s> must be provided in multiples of %d\n"
1551 "\tYou provided %d item(s): %s"),
1552 opt->key, n_commas, n, opt->answer);
1557 opt = opt->next_opt;
1562 int check_overwrite(
void)
1565 char age[KEYLENGTH];
1567 char desc[KEYLENGTH];
1569 const char *overstr;
1572 st->module_info.overwrite = 0;
1580 over = atoi(overstr);
1584 if ((overstr = getenv(
"GRASS_OVERWRITE"))) {
1589 if (
st->overwrite || over) {
1590 st->module_info.overwrite = 1;
1592 putenv(
"GRASS_OVERWRITE=1");
1597 opt = &
st->first_option;
1599 if (opt->answer && opt->gisprompt) {
1602 if (strcmp(age,
"new") == 0) {
1606 for (i = 0; opt->answers[i]; i++) {
1608 if (strcmp(
element,
"file") == 0) {
1609 if (access(opt->answers[i], F_OK) == 0)
1612 else if (strcmp(
element,
"mapset") != 0) {
1621 if (!
st->overwrite && !over) {
1624 fprintf(stderr, _(
"ERROR: "));
1626 _(
"option <%s>: <%s> exists. To overwrite, use the --overwrite flag"),
1627 opt->key, opt->answers[i]);
1628 fprintf(stderr,
"\n");
1631 fprintf(stderr,
"GRASS_INFO_ERROR(%d,1): ", getpid());
1633 _(
"option <%s>: <%s> exists. To overwrite, use the --overwrite flag"),
1634 opt->key, opt->answers[i]);
1635 fprintf(stderr,
"\n");
1636 fprintf(stderr,
"GRASS_INFO_END(%d,1)\n",
1646 opt = opt->next_opt;
1658 for (ptr1 = gisprompt, ptr2 = age; *ptr1 !=
'\0'; ptr1++, ptr2++) {
1665 for (ptr1++, ptr2 =
element; *ptr1 !=
'\0'; ptr1++, ptr2++) {
1672 for (ptr1++, ptr2 = desc; *ptr1 !=
'\0'; ptr1++, ptr2++) {
1680 void append_error(
const char *msg)
1682 st->error = G_realloc(
st->error,
sizeof(
char *) * (
st->n_errors + 1));
1686 const char *get_renamed_option(
const char *key)
1688 const char *pgm, *key_new;
1691 if (!
st->renamed_options) {
1693 char path[GPATH_MAX];
1706 pgm_key = (
char *) G_malloc (strlen(pgm) + strlen(key) + 2);
1741 if (option->gisprompt ==
NULL ||
1742 strcmp(option->gisprompt,
"old,separator,separator") != 0)
1743 G_fatal_error(_(
"%s= is not a separator option"), option->key);
1745 if (option->answer ==
NULL)
1746 G_fatal_error(_(
"No separator given for %s="), option->key);
1748 if (strcmp(option->answer,
"pipe") == 0)
1750 else if (strcmp(option->answer,
"comma") == 0)
1752 else if (strcmp(option->answer,
"space") == 0)
1754 else if (strcmp(option->answer,
"tab") == 0 ||
1755 strcmp(option->answer,
"\\t") == 0)
1757 else if (strcmp(option->answer,
"newline") == 0 ||
1758 strcmp(option->answer,
"\\n") == 0)
1761 sep =
G_store(option->answer);
1763 G_debug(3,
"G_option_to_separator(): key = %s -> sep = '%s'",
1804 stdinout = !option->answer || !*(option->answer) ||
1805 strcmp(option->answer,
"-") == 0;
1807 if (option->gisprompt ==
NULL)
1809 else if (option->multiple)
1810 G_fatal_error(_(
"Opening multiple files not supported for %s="),
1812 else if (strcmp(option->gisprompt,
"old,file,file") == 0) {
1815 else if ((fp = fopen(option->answer,
"r")) ==
NULL)
1817 option->key, option->answer);
1818 }
else if (strcmp(option->gisprompt,
"new,file,file") == 0) {
1821 else if ((fp = fopen(option->answer,
"w")) ==
NULL)
1823 option->key, option->answer);
1838 if (fp != stdin && fp != stdout && fp != stderr)
void G_free(void *buf)
Free allocated memory.
int G_asprintf(char **out, const char *fmt,...)
char * G_basename(char *filename, const char *desired_ext)
Truncates filename to the base part (before the last '.') if it matches the extension,...
int G_debug(int level, const char *msg,...)
Print debugging message.
const char * G_getenv_nofatal(const char *name)
Get environment variable.
const char * G_find_file(const char *element, char *name, const char *mapset)
Searches for a file from the mapset search list or in a specified mapset.
void G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
int G_suppress_warnings(int flag)
Suppress printing a warning message to stderr.
void G_warning(const char *msg,...)
Print a warning message to stderr.
int G_info_format(void)
Get current message format.
const char * G_gisbase(void)
Get full path name of the top level module directory.
const char * G_find_key_value(const char *key, const struct Key_Value *kv)
Find given key (case sensitive)
struct Key_Value * G_read_key_value_file(const char *file)
Read key/values pairs from file.
const char * G_mapset(void)
Get current mapset name.
struct GModule * G_define_module(void)
Initializes a new module.
FILE * G_open_option_file(const struct Option *option)
Get an input/output file pointer from the option. If the file name is omitted or '-',...
char * G_recreate_command_original_path(void)
Creates command to run non-interactive.
int G_parser(int argc, char **argv)
Parse command line.
void G_set_keywords(const char *keywords)
Set keywords from the string.
int G__uses_new_gisprompt(void)
char * recreate_command(int original_path)
Creates command to run non-interactive.
int G_get_overwrite()
Get overwrite value.
struct Option * G_define_option(void)
Initializes an Option struct.
void G_add_keyword(const char *keyword)
Add keyword to the list.
void G_close_option_file(FILE *fp)
Close an input/output file returned by G_open_option_file(). If the file pointer is stdin,...
char * G_recreate_command(void)
Creates command to run non-interactive.
void G_disable_interactive(void)
Disables the ability of the parser to operate interactively.
struct Flag * G_define_flag(void)
Initializes a Flag struct.
char * G_option_to_separator(const struct Option *option)
Get separator string from the option.
void G__print_keywords(FILE *fd, void(*format)(FILE *, const char *))
Print list of keywords (internal use only)
void G__split_gisprompt(const char *gisprompt, char *age, char *element, char *desc)
void G__check_option_rules(void)
Check for option rules (internal use only)
int G__has_required_rule(void)
Checks if there is any rule RULE_REQUIRED (internal use only).
void G_usage(void)
Command line help/usage message.
void G__usage_html(void)
Print module usage description in HTML format.
void G__usage_xml(void)
Print module usage description in XML format.
char * G__json(void)
This function generates actinia JSON process chain building blocks from the command line arguments th...
void G__usage_rest(void)
Print module usage description in reStructuredText format.
void G__script(void)
Generate Python script-like output.
void G__wps_print_process_description(void)
Print the WPS 1.0.0 process description XML document to stdout.
int G_is_dirsep(char c)
Checks if a specified character is a valid directory separator character on the host system.
const char * G_original_program_name(void)
Return original path of the executed program.
const char * G_program_name(void)
Return module name.
int G_snprintf(char *str, size_t size, const char *fmt,...)
snprintf() clone.
int G_spawn(const char *command,...)
Spawn new process based on command.
char * G_store(const char *s)
Copy string to allocated memory.
int G_strcasecmp(const char *x, const char *y)
String compare ignoring case (upper or lower)
char * G_chop(char *line)
Chop leading and trailing white spaces.
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)
void G_free_tokens(char **tokens)
Free memory allocated to tokens.
int G_number_of_tokens(char **tokens)
Return number of tokens.
char ** G_tokenize(const char *buf, const char *delim)
Tokenize string.
int G_verbose_max(void)
Get max verbosity level.
int G_verbose(void)
Get current verbosity level.
int G_verbose_min(void)
Get min verbosity level.
int G_verbose_std(void)
Get standard verbosity level.
void G_zero(void *buf, int i)
Zero out a buffer, buf, of length i.