1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

More man pages. Added include files for 2 common paragraphs.

This commit is contained in:
Werner Koch 2006-08-18 13:05:39 +00:00
parent e5be94ce45
commit 368170215f
11 changed files with 217 additions and 68 deletions

View file

@ -85,6 +85,7 @@ static int debug;
static const char *opt_source;
static const char *opt_release;
static const char *opt_select;
static const char *opt_include;
static int opt_store;
@ -335,7 +336,6 @@ add_content (const char *sectname, char *line, int verbatim)
section_buffer_t sect;
line_buffer_t lb;
sect = get_section_buffer (sectname);
if (sect->last_line && !sect->last_line->verbatim == !verbatim)
{
@ -447,6 +447,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
{ "end", 4 },
{ "quotation",1, ".RS\n\\fB" },
{ "ifset", 1 },
{ "ifclear", 1 },
{ NULL }
};
size_t n;
@ -501,6 +502,11 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
{
fputs ("\\fR\n.RE\n", fp);
}
else if (n >= 5 && !memcmp (s, "ifset", 5)
&& (!n || s[5] == ' ' || s[5] == '\t' || s[5] == '\n'))
{
fputs ("\\fR\n.RE\n", fp);
}
/* Now throw away the entire line. */
s = memchr (rest, '\n', len);
return s? (s-rest)+1 : len;
@ -815,8 +821,8 @@ parse_file (const char *fname, FILE *fp, char **section_name)
while (*p == ' ' || *p == '\t')
p++;
if (skip_to_end
&&n == 4 && !memcmp (line, "@end", 4)
if (skip_to_end
&& n == 4 && !memcmp (line, "@end", 4)
&& (line[4]==' '||line[4]=='\t'||!line[4]))
{
skip_to_end = 0;
@ -881,12 +887,29 @@ parse_file (const char *fname, FILE *fp, char **section_name)
{
skip_to_end = 1;
}
else if (n == 8 && !memcmp (line, "@ifclear", 8)
&& !strncmp (p, "isman", 5) && (p[5]==' '||p[5]=='\t'||!p[5]))
{
skip_to_end = 1;
}
else if (n == 8 && !memcmp (line, "@include", 8)
&& (line[8]==' '||line[8]=='\t'||!line[8]))
{
char *incname = xstrdup (p);
FILE *incfp = fopen (incname, "r");
if (!incfp && opt_include && *opt_include && *p != '/')
{
free (incname);
incname = xmalloc (strlen (opt_include) + 1
+ strlen (p) + 1);
strcpy (incname, opt_include);
if ( incname[strlen (incname)-1] != '/' )
strcat (incname, "/");
strcat (incname, p);
incfp = fopen (incname, "r");
}
if (!incfp)
err ("can't open include file `%s':%s",
incname, strerror (errno));
@ -895,8 +918,9 @@ parse_file (const char *fname, FILE *fp, char **section_name)
parse_file (incname, incfp, section_name);
fclose (incfp);
}
free (incname);
}
else
else if (!skip_to_end)
got_line = 1;
}
else if (!skip_to_end)
@ -956,7 +980,8 @@ main (int argc, char **argv)
" --select NAME only output pages with @manpage NAME\n"
" --verbose enable extra informational output\n"
" --debug enable additional debug output\n"
" --help display this help and exit\n\n"
" --help display this help and exit\n"
" -I DIR also search in include DIR\n\n"
"With no FILE, or when FILE is -, read standard input.\n\n"
"Report bugs to <bugs@g10code.com>.");
exit (0);
@ -1021,6 +1046,15 @@ main (int argc, char **argv)
argc--; argv++;
}
}
else if (!strcmp (*argv, "-I"))
{
argc--; argv++;
if (argc)
{
opt_include = *argv;
argc--; argv++;
}
}
}
if (argc > 1)