22#include "parser_local_proto.h"
25static void show_options(
FILE *fp,
int maxlen,
const char *str);
26static int show(
FILE *fp,
const char *item,
int len);
78 if (
st->module_info.label ||
st->module_info.description) {
82 fprintf(fp,
"{{{DESCRIPTION}}}\n");
84 fprintf(fp,
"%s\n",
_(
"Description:"));
85 if (
st->module_info.label)
86 fprintf(fp,
" %s\n",
st->module_info.label);
87 if (
st->module_info.description)
88 fprintf(fp,
" %s\n",
st->module_info.description);
93 if (
st->module_info.label)
94 fprintf(fp,
"%s\n",
st->module_info.label);
95 else if (
st->module_info.description)
96 fprintf(fp,
"%s\n",
st->module_info.description);
102 fprintf(fp,
"{{{KEYWORDS}}}\n");
103 fprintf(fp,
"%s\n ",
_(
"Keywords:"));
113 len = show(fp,
st->pgm_name, 1);
126 len = show(fp, item, len);
131 opt = &
st->first_option;
134 key_desc =
opt->key_desc;
162 len = show(fp, item, len);
168 G_strlcpy(item,
" [--overwrite]",
sizeof(item));
169 len = show(fp, item, len);
172 G_strlcpy(item,
" [--help]",
sizeof(item));
173 len = show(fp, item, len);
175 G_strlcpy(item,
" [--verbose]",
sizeof(item));
176 len = show(fp, item, len);
178 G_strlcpy(item,
" [--quiet]",
sizeof(item));
179 len = show(fp, item, len);
181 G_strlcpy(item,
" [--ui]",
sizeof(item));
182 len = show(fp, item, len);
211 else if (
flag->description) {
222 _(
"Allow output files to overwrite existing files"));
224 fprintf(fp,
" --h %s\n",
_(
"Print usage summary"));
225 fprintf(fp,
" --v %s\n",
_(
"Verbose module output"));
226 fprintf(fp,
" --q %s\n",
_(
"Quiet module output"));
227 fprintf(fp,
" --qq %s\n",
_(
"Super quiet module output"));
228 fprintf(fp,
" --ui %s\n",
_(
"Force launching GUI dialog"));
236 fprintf(fp,
"{{{PARAMETERS}}}\n");
237 fprintf(fp,
"%s\n",
_(
"Parameters:"));
238 opt = &
st->first_option;
245 fprintf(fp,
" %*s %s\n", maxlen,
" ",
opt->description);
248 else if (
opt->description) {
253 show_options(fp, maxlen,
opt->options);
259 fprintf(fp,
_(
" %*s default: %s\n"), maxlen,
" ",
opt->def);
264 while (
opt->opts[i]) {
266 fprintf(fp,
" %*s %s: %s\n", maxlen,
" ",
267 opt->opts[i],
opt->descs[i]);
278static void show_options(
FILE *fp,
int maxlen,
const char *str)
284 fprintf(fp,
_(
" %*s options: "), maxlen,
" ");
290 if ((len +
totlen) > 76) {
292 fprintf(fp,
"\n %*s", maxlen + 13,
" ");
300 fprintf(fp,
"\n %*s", maxlen + 13,
" ");
306static int show(
FILE *fp,
const char *item,
int len)
310 n =
strlen(item) + (len > 0);
const char * G_program_name(void)
Return module name.
void G_free(void *)
Free allocated memory.
size_t G_strlcat(char *, const char *, size_t)
Size-bounded string concatenation.
char * G_store(const char *)
Copy string to allocated memory.
size_t G_strlcpy(char *, const char *, size_t)
Safe string copy function.
void G__print_keywords(FILE *fd, void(*format)(FILE *, const char *), int newline)
Print list of keywords (internal use only)
int G__uses_new_gisprompt(void)
void G_usage(void)
Command line help/usage message.
Structure that stores flag info.
Structure that stores option information.