22 #include "parser_local_proto.h" 24 static void usage(FILE *fp,
int markers);
25 static void show_options(FILE *fp,
int maxlen,
const char *str);
26 static int show(FILE *fp,
const char *item,
int len);
58 static void usage(FILE *fp,
int markers)
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);
99 if (extensive &&
st->module_info.keywords) {
102 fprintf(fp,
"{{{KEYWORDS}}}\n");
103 fprintf(fp,
"%s\n ",
_(
"Keywords:"));
110 fprintf(fp,
"{{{USAGE}}}\n");
111 fprintf(fp,
"%s\n ",
_(
"Usage:"));
113 len = show(fp,
st->pgm_name, 1);
121 flag = &
st->first_flag;
126 len = show(fp, item, len);
131 opt = &
st->first_option;
132 while (opt !=
NULL) {
141 fprintf(stderr,
"\n%s\n",
_(
"ERROR: Option key not defined"));
144 n = strlen(opt->
key);
151 strcat(item, opt->
key);
153 strcat(item, key_desc);
156 strcat(item, key_desc);
157 strcat(item,
",...]");
162 len = show(fp, item, len);
168 strcpy(item,
" [--overwrite]");
169 len = show(fp, item, len);
172 strcpy(item,
" [--help]");
173 len = show(fp, item, len);
175 strcpy(item,
" [--verbose]");
176 len = show(fp, item, len);
178 strcpy(item,
" [--quiet]");
179 len = show(fp, item, len);
181 strcpy(item,
" [--ui]");
182 len = show(fp, item, len);
194 if (
st->n_flags || standard) {
197 fprintf(fp,
"{{{FLAGS}}}\n");
198 fprintf(fp,
"%s\n",
_(
"Flags:"));
202 flag = &
st->first_flag;
203 while (flag !=
NULL) {
204 fprintf(fp,
" -%c ", flag->
key);
207 fprintf(fp,
"%s\n", flag->
label);
222 fprintf(fp,
" --o %s\n",
223 _(
"Allow output files to overwrite existing files"));
225 fprintf(fp,
" --h %s\n",
_(
"Print usage summary"));
226 fprintf(fp,
" --v %s\n",
_(
"Verbose module output"));
227 fprintf(fp,
" --q %s\n",
_(
"Quiet module output"));
228 fprintf(fp,
" --qq %s\n",
_(
"Super quiet module output"));
229 fprintf(fp,
" --ui %s\n",
_(
"Force launching GUI dialog"));
237 fprintf(fp,
"{{{PARAMETERS}}}\n");
238 fprintf(fp,
"%s\n",
_(
"Parameters:"));
239 opt = &
st->first_option;
240 while (opt !=
NULL) {
241 fprintf(fp,
" %*s ", maxlen, opt->
key);
244 fprintf(fp,
"%s\n", opt->
label);
246 fprintf(fp,
" %*s %s\n",
255 show_options(fp, maxlen, opt->
options);
261 fprintf(fp,
_(
" %*s default: %s\n"), maxlen,
" ",
264 if (detailed && opt->
descs) {
267 while (opt->
opts[i]) {
269 fprintf(fp,
" %*s %s: %s\n",
270 maxlen,
" ", opt->
opts[i], opt->
descs[i]);
281 static void show_options(FILE *fp,
int maxlen,
const char *str)
287 fprintf(fp,
_(
" %*s options: "), maxlen,
" ");
288 totlen = maxlen + 13;
290 while ((p2 = strchr(p1,
','))) {
292 len = strlen(p1) + 1;
293 if ((len + totlen) > 76) {
294 totlen = maxlen + 13;
295 fprintf(fp,
"\n %*s", maxlen + 13,
" ");
297 fprintf(fp,
"%s,", p1);
302 if ((len + totlen) > 76)
303 fprintf(fp,
"\n %*s", maxlen + 13,
" ");
304 fprintf(fp,
"%s\n", p1);
309 static int show(FILE *fp,
const char *item,
int len)
313 n = strlen(item) + (len > 0);
319 fprintf(fp,
"%s", item);
int G__uses_new_gisprompt(void)
const char * G_program_name(void)
Return module name.
void G_free(void *)
Free allocated memory.
Structure that stores flag info.
void G_usage(void)
Command line help/usage message.
Structure that stores option information.
char * G_store(const char *)
Copy string to allocated memory.
void G__print_keywords(FILE *fd, void(*format)(FILE *, const char *))
Print list of keywords (internal use only)