]> git.ipfire.org Git - thirdparty/git.git/blob - builtin/help.c
Merge branch 'tz/lib-gpg-prereq-fix'
[thirdparty/git.git] / builtin / help.c
1 /*
2 * Builtin help command
3 */
4 #include "cache.h"
5 #include "config.h"
6 #include "builtin.h"
7 #include "exec-cmd.h"
8 #include "gettext.h"
9 #include "pager.h"
10 #include "parse-options.h"
11 #include "path.h"
12 #include "run-command.h"
13 #include "config-list.h"
14 #include "help.h"
15 #include "alias.h"
16 #include "setup.h"
17
18 #ifndef DEFAULT_HELP_FORMAT
19 #define DEFAULT_HELP_FORMAT "man"
20 #endif
21
22 static struct man_viewer_list {
23 struct man_viewer_list *next;
24 char name[FLEX_ARRAY];
25 } *man_viewer_list;
26
27 static struct man_viewer_info_list {
28 struct man_viewer_info_list *next;
29 const char *info;
30 char name[FLEX_ARRAY];
31 } *man_viewer_info_list;
32
33 enum help_format {
34 HELP_FORMAT_NONE,
35 HELP_FORMAT_MAN,
36 HELP_FORMAT_INFO,
37 HELP_FORMAT_WEB
38 };
39
40 enum show_config_type {
41 SHOW_CONFIG_HUMAN,
42 SHOW_CONFIG_VARS,
43 SHOW_CONFIG_SECTIONS,
44 };
45
46 static enum help_action {
47 HELP_ACTION_ALL = 1,
48 HELP_ACTION_GUIDES,
49 HELP_ACTION_CONFIG,
50 HELP_ACTION_USER_INTERFACES,
51 HELP_ACTION_DEVELOPER_INTERFACES,
52 HELP_ACTION_CONFIG_FOR_COMPLETION,
53 HELP_ACTION_CONFIG_SECTIONS_FOR_COMPLETION,
54 } cmd_mode;
55
56 static const char *html_path;
57 static int verbose = 1;
58 static enum help_format help_format = HELP_FORMAT_NONE;
59 static int exclude_guides;
60 static int show_external_commands = -1;
61 static int show_aliases = -1;
62 static struct option builtin_help_options[] = {
63 OPT_CMDMODE('a', "all", &cmd_mode, N_("print all available commands"),
64 HELP_ACTION_ALL),
65 OPT_BOOL(0, "external-commands", &show_external_commands,
66 N_("show external commands in --all")),
67 OPT_BOOL(0, "aliases", &show_aliases, N_("show aliases in --all")),
68 OPT_HIDDEN_BOOL(0, "exclude-guides", &exclude_guides, N_("exclude guides")),
69 OPT_SET_INT('m', "man", &help_format, N_("show man page"), HELP_FORMAT_MAN),
70 OPT_SET_INT('w', "web", &help_format, N_("show manual in web browser"),
71 HELP_FORMAT_WEB),
72 OPT_SET_INT('i', "info", &help_format, N_("show info page"),
73 HELP_FORMAT_INFO),
74 OPT__VERBOSE(&verbose, N_("print command description")),
75
76 OPT_CMDMODE('g', "guides", &cmd_mode, N_("print list of useful guides"),
77 HELP_ACTION_GUIDES),
78 OPT_CMDMODE(0, "user-interfaces", &cmd_mode,
79 N_("print list of user-facing repository, command and file interfaces"),
80 HELP_ACTION_USER_INTERFACES),
81 OPT_CMDMODE(0, "developer-interfaces", &cmd_mode,
82 N_("print list of file formats, protocols and other developer interfaces"),
83 HELP_ACTION_DEVELOPER_INTERFACES),
84 OPT_CMDMODE('c', "config", &cmd_mode, N_("print all configuration variable names"),
85 HELP_ACTION_CONFIG),
86 OPT_CMDMODE_F(0, "config-for-completion", &cmd_mode, "",
87 HELP_ACTION_CONFIG_FOR_COMPLETION, PARSE_OPT_HIDDEN),
88 OPT_CMDMODE_F(0, "config-sections-for-completion", &cmd_mode, "",
89 HELP_ACTION_CONFIG_SECTIONS_FOR_COMPLETION, PARSE_OPT_HIDDEN),
90
91 OPT_END(),
92 };
93
94 static const char * const builtin_help_usage[] = {
95 "git help [-a|--all] [--[no-]verbose] [--[no-]external-commands] [--[no-]aliases]",
96 N_("git help [[-i|--info] [-m|--man] [-w|--web]] [<command>|<doc>]"),
97 "git help [-g|--guides]",
98 "git help [-c|--config]",
99 "git help [--user-interfaces]",
100 "git help [--developer-interfaces]",
101 NULL
102 };
103
104 struct slot_expansion {
105 const char *prefix;
106 const char *placeholder;
107 void (*fn)(struct string_list *list, const char *prefix);
108 int found;
109 };
110
111 static void list_config_help(enum show_config_type type)
112 {
113 struct slot_expansion slot_expansions[] = {
114 { "advice", "*", list_config_advices },
115 { "color.branch", "<slot>", list_config_color_branch_slots },
116 { "color.decorate", "<slot>", list_config_color_decorate_slots },
117 { "color.diff", "<slot>", list_config_color_diff_slots },
118 { "color.grep", "<slot>", list_config_color_grep_slots },
119 { "color.interactive", "<slot>", list_config_color_interactive_slots },
120 { "color.remote", "<slot>", list_config_color_sideband_slots },
121 { "color.status", "<slot>", list_config_color_status_slots },
122 { "fsck", "<msg-id>", list_config_fsck_msg_ids },
123 { "receive.fsck", "<msg-id>", list_config_fsck_msg_ids },
124 { NULL, NULL, NULL }
125 };
126 const char **p;
127 struct slot_expansion *e;
128 struct string_list keys = STRING_LIST_INIT_DUP;
129 struct string_list keys_uniq = STRING_LIST_INIT_DUP;
130 struct string_list_item *item;
131 int i;
132
133 for (p = config_name_list; *p; p++) {
134 const char *var = *p;
135 struct strbuf sb = STRBUF_INIT;
136
137 for (e = slot_expansions; e->prefix; e++) {
138
139 strbuf_reset(&sb);
140 strbuf_addf(&sb, "%s.%s", e->prefix, e->placeholder);
141 if (!strcasecmp(var, sb.buf)) {
142 e->fn(&keys, e->prefix);
143 e->found++;
144 break;
145 }
146 }
147 strbuf_release(&sb);
148 if (!e->prefix)
149 string_list_append(&keys, var);
150 }
151
152 for (e = slot_expansions; e->prefix; e++)
153 if (!e->found)
154 BUG("slot_expansion %s.%s is not used",
155 e->prefix, e->placeholder);
156
157 string_list_sort(&keys);
158 for (i = 0; i < keys.nr; i++) {
159 const char *var = keys.items[i].string;
160 const char *wildcard, *tag, *cut;
161 const char *dot = NULL;
162 struct strbuf sb = STRBUF_INIT;
163
164 switch (type) {
165 case SHOW_CONFIG_HUMAN:
166 puts(var);
167 continue;
168 case SHOW_CONFIG_SECTIONS:
169 dot = strchr(var, '.');
170 break;
171 case SHOW_CONFIG_VARS:
172 break;
173 }
174 wildcard = strchr(var, '*');
175 tag = strchr(var, '<');
176
177 if (!dot && !wildcard && !tag) {
178 string_list_append(&keys_uniq, var);
179 continue;
180 }
181
182 if (dot)
183 cut = dot;
184 else if (wildcard && !tag)
185 cut = wildcard;
186 else if (!wildcard && tag)
187 cut = tag;
188 else
189 cut = wildcard < tag ? wildcard : tag;
190
191 strbuf_add(&sb, var, cut - var);
192 string_list_append(&keys_uniq, sb.buf);
193 strbuf_release(&sb);
194
195 }
196 string_list_clear(&keys, 0);
197 string_list_remove_duplicates(&keys_uniq, 0);
198 for_each_string_list_item(item, &keys_uniq)
199 puts(item->string);
200 string_list_clear(&keys_uniq, 0);
201 }
202
203 static enum help_format parse_help_format(const char *format)
204 {
205 if (!strcmp(format, "man"))
206 return HELP_FORMAT_MAN;
207 if (!strcmp(format, "info"))
208 return HELP_FORMAT_INFO;
209 if (!strcmp(format, "web") || !strcmp(format, "html"))
210 return HELP_FORMAT_WEB;
211 /*
212 * Please update _git_config() in git-completion.bash when you
213 * add new help formats.
214 */
215 die(_("unrecognized help format '%s'"), format);
216 }
217
218 static const char *get_man_viewer_info(const char *name)
219 {
220 struct man_viewer_info_list *viewer;
221
222 for (viewer = man_viewer_info_list; viewer; viewer = viewer->next)
223 {
224 if (!strcasecmp(name, viewer->name))
225 return viewer->info;
226 }
227 return NULL;
228 }
229
230 static int check_emacsclient_version(void)
231 {
232 struct strbuf buffer = STRBUF_INIT;
233 struct child_process ec_process = CHILD_PROCESS_INIT;
234 int version;
235
236 /* emacsclient prints its version number on stderr */
237 strvec_pushl(&ec_process.args, "emacsclient", "--version", NULL);
238 ec_process.err = -1;
239 ec_process.stdout_to_stderr = 1;
240 if (start_command(&ec_process))
241 return error(_("Failed to start emacsclient."));
242
243 strbuf_read(&buffer, ec_process.err, 20);
244 close(ec_process.err);
245
246 /*
247 * Don't bother checking return value, because "emacsclient --version"
248 * seems to always exits with code 1.
249 */
250 finish_command(&ec_process);
251
252 if (!starts_with(buffer.buf, "emacsclient")) {
253 strbuf_release(&buffer);
254 return error(_("Failed to parse emacsclient version."));
255 }
256
257 strbuf_remove(&buffer, 0, strlen("emacsclient"));
258 version = atoi(buffer.buf);
259
260 if (version < 22) {
261 strbuf_release(&buffer);
262 return error(_("emacsclient version '%d' too old (< 22)."),
263 version);
264 }
265
266 strbuf_release(&buffer);
267 return 0;
268 }
269
270 static void exec_woman_emacs(const char *path, const char *page)
271 {
272 if (!check_emacsclient_version()) {
273 /* This works only with emacsclient version >= 22. */
274 struct strbuf man_page = STRBUF_INIT;
275
276 if (!path)
277 path = "emacsclient";
278 strbuf_addf(&man_page, "(woman \"%s\")", page);
279 execlp(path, "emacsclient", "-e", man_page.buf, (char *)NULL);
280 warning_errno(_("failed to exec '%s'"), path);
281 strbuf_release(&man_page);
282 }
283 }
284
285 static void exec_man_konqueror(const char *path, const char *page)
286 {
287 const char *display = getenv("DISPLAY");
288 if (display && *display) {
289 struct strbuf man_page = STRBUF_INIT;
290 const char *filename = "kfmclient";
291
292 /* It's simpler to launch konqueror using kfmclient. */
293 if (path) {
294 size_t len;
295 if (strip_suffix(path, "/konqueror", &len))
296 path = xstrfmt("%.*s/kfmclient", (int)len, path);
297 filename = basename((char *)path);
298 } else
299 path = "kfmclient";
300 strbuf_addf(&man_page, "man:%s(1)", page);
301 execlp(path, filename, "newTab", man_page.buf, (char *)NULL);
302 warning_errno(_("failed to exec '%s'"), path);
303 strbuf_release(&man_page);
304 }
305 }
306
307 static void exec_man_man(const char *path, const char *page)
308 {
309 if (!path)
310 path = "man";
311 execlp(path, "man", page, (char *)NULL);
312 warning_errno(_("failed to exec '%s'"), path);
313 }
314
315 static void exec_man_cmd(const char *cmd, const char *page)
316 {
317 struct strbuf shell_cmd = STRBUF_INIT;
318 strbuf_addf(&shell_cmd, "%s %s", cmd, page);
319 execl(SHELL_PATH, SHELL_PATH, "-c", shell_cmd.buf, (char *)NULL);
320 warning(_("failed to exec '%s'"), cmd);
321 strbuf_release(&shell_cmd);
322 }
323
324 static void add_man_viewer(const char *name)
325 {
326 struct man_viewer_list **p = &man_viewer_list;
327
328 while (*p)
329 p = &((*p)->next);
330 FLEX_ALLOC_STR(*p, name, name);
331 }
332
333 static int supported_man_viewer(const char *name, size_t len)
334 {
335 return (!strncasecmp("man", name, len) ||
336 !strncasecmp("woman", name, len) ||
337 !strncasecmp("konqueror", name, len));
338 }
339
340 static void do_add_man_viewer_info(const char *name,
341 size_t len,
342 const char *value)
343 {
344 struct man_viewer_info_list *new_man_viewer;
345 FLEX_ALLOC_MEM(new_man_viewer, name, name, len);
346 new_man_viewer->info = xstrdup(value);
347 new_man_viewer->next = man_viewer_info_list;
348 man_viewer_info_list = new_man_viewer;
349 }
350
351 static int add_man_viewer_path(const char *name,
352 size_t len,
353 const char *value)
354 {
355 if (supported_man_viewer(name, len))
356 do_add_man_viewer_info(name, len, value);
357 else
358 warning(_("'%s': path for unsupported man viewer.\n"
359 "Please consider using 'man.<tool>.cmd' instead."),
360 name);
361
362 return 0;
363 }
364
365 static int add_man_viewer_cmd(const char *name,
366 size_t len,
367 const char *value)
368 {
369 if (supported_man_viewer(name, len))
370 warning(_("'%s': cmd for supported man viewer.\n"
371 "Please consider using 'man.<tool>.path' instead."),
372 name);
373 else
374 do_add_man_viewer_info(name, len, value);
375
376 return 0;
377 }
378
379 static int add_man_viewer_info(const char *var, const char *value)
380 {
381 const char *name, *subkey;
382 size_t namelen;
383
384 if (parse_config_key(var, "man", &name, &namelen, &subkey) < 0 || !name)
385 return 0;
386
387 if (!strcmp(subkey, "path")) {
388 if (!value)
389 return config_error_nonbool(var);
390 return add_man_viewer_path(name, namelen, value);
391 }
392 if (!strcmp(subkey, "cmd")) {
393 if (!value)
394 return config_error_nonbool(var);
395 return add_man_viewer_cmd(name, namelen, value);
396 }
397
398 return 0;
399 }
400
401 static int git_help_config(const char *var, const char *value, void *cb)
402 {
403 if (!strcmp(var, "help.format")) {
404 if (!value)
405 return config_error_nonbool(var);
406 help_format = parse_help_format(value);
407 return 0;
408 }
409 if (!strcmp(var, "help.htmlpath")) {
410 if (!value)
411 return config_error_nonbool(var);
412 html_path = xstrdup(value);
413 return 0;
414 }
415 if (!strcmp(var, "man.viewer")) {
416 if (!value)
417 return config_error_nonbool(var);
418 add_man_viewer(value);
419 return 0;
420 }
421 if (starts_with(var, "man."))
422 return add_man_viewer_info(var, value);
423
424 return git_default_config(var, value, cb);
425 }
426
427 static struct cmdnames main_cmds, other_cmds;
428
429 static int is_git_command(const char *s)
430 {
431 if (is_builtin(s))
432 return 1;
433
434 load_command_list("git-", &main_cmds, &other_cmds);
435 return is_in_cmdlist(&main_cmds, s) ||
436 is_in_cmdlist(&other_cmds, s);
437 }
438
439 static const char *cmd_to_page(const char *git_cmd)
440 {
441 if (!git_cmd)
442 return "git";
443 else if (starts_with(git_cmd, "git"))
444 return git_cmd;
445 else if (is_git_command(git_cmd))
446 return xstrfmt("git-%s", git_cmd);
447 else if (!strcmp("scalar", git_cmd))
448 return xstrdup(git_cmd);
449 else
450 return xstrfmt("git%s", git_cmd);
451 }
452
453 static void setup_man_path(void)
454 {
455 struct strbuf new_path = STRBUF_INIT;
456 const char *old_path = getenv("MANPATH");
457 char *git_man_path = system_path(GIT_MAN_PATH);
458
459 /* We should always put ':' after our path. If there is no
460 * old_path, the ':' at the end will let 'man' to try
461 * system-wide paths after ours to find the manual page. If
462 * there is old_path, we need ':' as delimiter. */
463 strbuf_addstr(&new_path, git_man_path);
464 strbuf_addch(&new_path, ':');
465 if (old_path)
466 strbuf_addstr(&new_path, old_path);
467
468 free(git_man_path);
469 setenv("MANPATH", new_path.buf, 1);
470
471 strbuf_release(&new_path);
472 }
473
474 static void exec_viewer(const char *name, const char *page)
475 {
476 const char *info = get_man_viewer_info(name);
477
478 if (!strcasecmp(name, "man"))
479 exec_man_man(info, page);
480 else if (!strcasecmp(name, "woman"))
481 exec_woman_emacs(info, page);
482 else if (!strcasecmp(name, "konqueror"))
483 exec_man_konqueror(info, page);
484 else if (info)
485 exec_man_cmd(info, page);
486 else
487 warning(_("'%s': unknown man viewer."), name);
488 }
489
490 static void show_man_page(const char *page)
491 {
492 struct man_viewer_list *viewer;
493 const char *fallback = getenv("GIT_MAN_VIEWER");
494
495 setup_man_path();
496 for (viewer = man_viewer_list; viewer; viewer = viewer->next)
497 {
498 exec_viewer(viewer->name, page); /* will return when unable */
499 }
500 if (fallback)
501 exec_viewer(fallback, page);
502 exec_viewer("man", page);
503 die(_("no man viewer handled the request"));
504 }
505
506 static void show_info_page(const char *page)
507 {
508 setenv("INFOPATH", system_path(GIT_INFO_PATH), 1);
509 execlp("info", "info", "gitman", page, (char *)NULL);
510 die(_("no info viewer handled the request"));
511 }
512
513 static void get_html_page_path(struct strbuf *page_path, const char *page)
514 {
515 struct stat st;
516 char *to_free = NULL;
517
518 if (!html_path)
519 html_path = to_free = system_path(GIT_HTML_PATH);
520
521 /*
522 * Check that the page we're looking for exists.
523 */
524 if (!strstr(html_path, "://")) {
525 if (stat(mkpath("%s/%s.html", html_path, page), &st)
526 || !S_ISREG(st.st_mode))
527 die("'%s/%s.html': documentation file not found.",
528 html_path, page);
529 }
530
531 strbuf_init(page_path, 0);
532 strbuf_addf(page_path, "%s/%s.html", html_path, page);
533 free(to_free);
534 }
535
536 static void open_html(const char *path)
537 {
538 execl_git_cmd("web--browse", "-c", "help.browser", path, (char *)NULL);
539 }
540
541 static void show_html_page(const char *page)
542 {
543 struct strbuf page_path; /* it leaks but we exec bellow */
544
545 get_html_page_path(&page_path, page);
546
547 open_html(page_path.buf);
548 }
549
550 static const char *check_git_cmd(const char* cmd)
551 {
552 char *alias;
553
554 if (is_git_command(cmd))
555 return cmd;
556
557 alias = alias_lookup(cmd);
558 if (alias) {
559 const char **argv;
560 int count;
561
562 /*
563 * handle_builtin() in git.c rewrites "git cmd --help"
564 * to "git help --exclude-guides cmd", so we can use
565 * exclude_guides to distinguish "git cmd --help" from
566 * "git help cmd". In the latter case, or if cmd is an
567 * alias for a shell command, just print the alias
568 * definition.
569 */
570 if (!exclude_guides || alias[0] == '!') {
571 printf_ln(_("'%s' is aliased to '%s'"), cmd, alias);
572 free(alias);
573 exit(0);
574 }
575 /*
576 * Otherwise, we pretend that the command was "git
577 * word0 --help". We use split_cmdline() to get the
578 * first word of the alias, to ensure that we use the
579 * same rules as when the alias is actually
580 * used. split_cmdline() modifies alias in-place.
581 */
582 fprintf_ln(stderr, _("'%s' is aliased to '%s'"), cmd, alias);
583 count = split_cmdline(alias, &argv);
584 if (count < 0)
585 die(_("bad alias.%s string: %s"), cmd,
586 split_cmdline_strerror(count));
587 free(argv);
588 UNLEAK(alias);
589 return alias;
590 }
591
592 if (exclude_guides)
593 return help_unknown_cmd(cmd);
594
595 return cmd;
596 }
597
598 static void no_help_format(const char *opt_mode, enum help_format fmt)
599 {
600 const char *opt_fmt;
601
602 switch (fmt) {
603 case HELP_FORMAT_NONE:
604 return;
605 case HELP_FORMAT_MAN:
606 opt_fmt = "--man";
607 break;
608 case HELP_FORMAT_INFO:
609 opt_fmt = "--info";
610 break;
611 case HELP_FORMAT_WEB:
612 opt_fmt = "--web";
613 break;
614 default:
615 BUG("unreachable");
616 }
617
618 usage_msg_optf(_("options '%s' and '%s' cannot be used together"),
619 builtin_help_usage, builtin_help_options, opt_mode,
620 opt_fmt);
621 }
622
623 static void opt_mode_usage(int argc, const char *opt_mode,
624 enum help_format fmt)
625 {
626 if (argc)
627 usage_msg_optf(_("the '%s' option doesn't take any non-option arguments"),
628 builtin_help_usage, builtin_help_options,
629 opt_mode);
630
631 no_help_format(opt_mode, fmt);
632 }
633
634 int cmd_help(int argc, const char **argv, const char *prefix)
635 {
636 int nongit;
637 enum help_format parsed_help_format;
638 const char *page;
639
640 argc = parse_options(argc, argv, prefix, builtin_help_options,
641 builtin_help_usage, 0);
642 parsed_help_format = help_format;
643
644 if (cmd_mode != HELP_ACTION_ALL &&
645 (show_external_commands >= 0 ||
646 show_aliases >= 0))
647 usage_msg_opt(_("the '--no-[external-commands|aliases]' options can only be used with '--all'"),
648 builtin_help_usage, builtin_help_options);
649
650 switch (cmd_mode) {
651 case HELP_ACTION_ALL:
652 opt_mode_usage(argc, "--all", help_format);
653 if (verbose) {
654 setup_pager();
655 list_all_cmds_help(show_external_commands,
656 show_aliases);
657 return 0;
658 }
659 printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
660 load_command_list("git-", &main_cmds, &other_cmds);
661 list_commands(&main_cmds, &other_cmds);
662 printf("%s\n", _(git_more_info_string));
663 break;
664 case HELP_ACTION_GUIDES:
665 opt_mode_usage(argc, "--guides", help_format);
666 list_guides_help();
667 printf("%s\n", _(git_more_info_string));
668 return 0;
669 case HELP_ACTION_CONFIG_FOR_COMPLETION:
670 opt_mode_usage(argc, "--config-for-completion", help_format);
671 list_config_help(SHOW_CONFIG_VARS);
672 return 0;
673 case HELP_ACTION_USER_INTERFACES:
674 opt_mode_usage(argc, "--user-interfaces", help_format);
675 list_user_interfaces_help();
676 return 0;
677 case HELP_ACTION_DEVELOPER_INTERFACES:
678 opt_mode_usage(argc, "--developer-interfaces", help_format);
679 list_developer_interfaces_help();
680 return 0;
681 case HELP_ACTION_CONFIG_SECTIONS_FOR_COMPLETION:
682 opt_mode_usage(argc, "--config-sections-for-completion",
683 help_format);
684 list_config_help(SHOW_CONFIG_SECTIONS);
685 return 0;
686 case HELP_ACTION_CONFIG:
687 opt_mode_usage(argc, "--config", help_format);
688 setup_pager();
689 list_config_help(SHOW_CONFIG_HUMAN);
690 printf("\n%s\n", _("'git help config' for more information"));
691 return 0;
692 }
693
694 if (!argv[0]) {
695 printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
696 list_common_cmds_help();
697 printf("\n%s\n", _(git_more_info_string));
698 return 0;
699 }
700
701 setup_git_directory_gently(&nongit);
702 git_config(git_help_config, NULL);
703
704 if (parsed_help_format != HELP_FORMAT_NONE)
705 help_format = parsed_help_format;
706 if (help_format == HELP_FORMAT_NONE)
707 help_format = parse_help_format(DEFAULT_HELP_FORMAT);
708
709 argv[0] = check_git_cmd(argv[0]);
710
711 page = cmd_to_page(argv[0]);
712 switch (help_format) {
713 case HELP_FORMAT_NONE:
714 case HELP_FORMAT_MAN:
715 show_man_page(page);
716 break;
717 case HELP_FORMAT_INFO:
718 show_info_page(page);
719 break;
720 case HELP_FORMAT_WEB:
721 show_html_page(page);
722 break;
723 }
724
725 return 0;
726 }