Freeciv-3.3
Loading...
Searching...
No Matches
manual_commands.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* utility */
19#include "fcintl.h"
20
21/* server */
22#include "commands.h"
23
24/* tools/manual */
25#include "fc_manual.h"
26
27/**********************************************************************/
34{
35 FILE *doc;
36 int i;
37
39
40 if (doc == NULL) {
41 return FALSE;
42 }
43
44 /* TRANS: markup ... Freeciv version ... markup */
45 fprintf(doc, _("%sFreeciv %s server commands%s\n\n"), tag_info->title_begin,
46 VERSION_STRING, tag_info->title_end);
47 for (i = 0; i < CMD_NUM; i++) {
48 const struct command *cmd = command_by_number(i);
49
50 fprintf(doc, tag_info->item_begin, "cmd", i);
51 fprintf(doc, "%s%s - %s%s\n\n", tag_info->sect_title_begin,
53 tag_info->sect_title_end);
54 if (command_synopsis(cmd)) {
55 char *cmdstr = fc_strdup(command_synopsis(cmd));
56 size_t cmdstr_len = strlen(cmdstr) + 1;
57
59 fprintf(doc, _("<table>\n<tr>\n<td valign=\"top\">"
60 "<pre>Synopsis:</pre></td>\n<td>"));
61 fprintf(doc, "<pre>%s</pre></td></tr></table>", cmdstr);
62 free(cmdstr);
63 }
64 fprintf(doc, _("<p class=\"level\">Level: %s</p>\n"),
66 {
67 char *help = command_extra_help(cmd);
68
69 if (help) {
70 size_t help_len = strlen(help) + 1;
71
73 help = html_special_chars(help, &help_len);
74 fprintf(doc, "\n");
75 fprintf(doc, _("<p>Description:</p>\n\n"));
76 fprintf(doc, "<pre>%s</pre>\n", help);
77 free(help);
78 }
79 }
80
81 fprintf(doc, "%s", tag_info->item_end);
82 }
83
85
86 return TRUE;
87}
const char * command_name(const struct command *pcommand)
Definition commands.c:746
const struct command * command_by_number(int i)
Definition commands.c:737
const char * command_short_help(const struct command *pcommand)
Definition commands.c:770
char * command_extra_help(const struct command *pcommand)
Definition commands.c:779
enum cmdlevel command_level(const struct command *pcommand)
Definition commands.c:794
const char * command_synopsis(const struct command *pcommand)
Definition commands.c:762
@ CMD_NUM
Definition commands.h:109
char * incite_cost
Definition comments.c:76
void manual_finalize(struct tag_types *tag_info, FILE *doc, enum manuals manual)
Definition fc_manual.c:320
char * html_special_chars(char *str, size_t *len)
Definition fc_manual.c:168
FILE * manual_start(struct tag_types *tag_info, int manual_number)
Definition fc_manual.c:291
#define LINE_BREAK
Definition fc_types.h:77
#define _(String)
Definition fcintl.h:67
bool manual_commands(struct tag_types *tag_info)
#define fc_strdup(str)
Definition mem.h:43
int fc_break_lines(char *str, size_t desired_len)
Definition support.c:1135
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47