20#include "parser_local_proto.h"
23static void show_options(
FILE *fp,
int maxlen,
const char *str);
24static int show(
FILE *fp,
const char *item,
int len);
76 if (
st->module_info.label ||
st->module_info.description) {
80 fprintf(fp,
"{{{DESCRIPTION}}}\n");
82 fprintf(fp,
"%s\n",
_(
"Description:"));
83 if (
st->module_info.label)
84 fprintf(fp,
" %s\n",
st->module_info.label);
85 if (
st->module_info.description)
86 fprintf(fp,
" %s\n",
st->module_info.description);
91 if (
st->module_info.label)
92 fprintf(fp,
"%s\n",
st->module_info.label);
93 else if (
st->module_info.description)
94 fprintf(fp,
"%s\n",
st->module_info.description);
100 fprintf(fp,
"{{{KEYWORDS}}}\n");
101 fprintf(fp,
"%s\n ",
_(
"Keywords:"));
111 len = show(fp,
st->pgm_name, 1);
124 len = show(fp, item, len);
129 opt = &
st->first_option;
132 key_desc =
opt->key_desc;
160 len = show(fp, item, len);
166 G_strlcpy(item,
" [--overwrite]",
sizeof(item));
167 len = show(fp, item, len);
170 G_strlcpy(item,
" [--help]",
sizeof(item));
171 len = show(fp, item, len);
173 G_strlcpy(item,
" [--verbose]",
sizeof(item));
174 len = show(fp, item, len);
176 G_strlcpy(item,
" [--quiet]",
sizeof(item));
177 len = show(fp, item, len);
179 G_strlcpy(item,
" [--ui]",
sizeof(item));
180 len = show(fp, item, len);
209 else if (
flag->description) {
220 _(
"Allow output files to overwrite existing files"));
222 fprintf(fp,
" --h %s\n",
_(
"Print usage summary"));
223 fprintf(fp,
" --v %s\n",
_(
"Verbose module output"));
224 fprintf(fp,
" --q %s\n",
_(
"Quiet module output"));
225 fprintf(fp,
" --qq %s\n",
_(
"Super quiet module output"));
226 fprintf(fp,
" --ui %s\n",
_(
"Force launching GUI dialog"));
234 fprintf(fp,
"{{{PARAMETERS}}}\n");
235 fprintf(fp,
"%s\n",
_(
"Parameters:"));
236 opt = &
st->first_option;
243 fprintf(fp,
" %*s %s\n", maxlen,
" ",
opt->description);
246 else if (
opt->description) {
251 show_options(fp, maxlen,
opt->options);
257 fprintf(fp,
_(
" %*s default: %s\n"), maxlen,
" ",
opt->def);
262 while (
opt->opts[i]) {
264 fprintf(fp,
" %*s %s: %s\n", maxlen,
" ",
265 opt->opts[i],
opt->descs[i]);
276static void show_options(
FILE *fp,
int maxlen,
const char *str)
282 fprintf(fp,
_(
" %*s options: "), maxlen,
" ");
288 if ((len +
totlen) > 76) {
290 fprintf(fp,
"\n %*s", maxlen + 13,
" ");
298 fprintf(fp,
"\n %*s", maxlen + 13,
" ");
304static int show(
FILE *fp,
const char *item,
int len)
308 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.