1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-04-17 15:44:34 +02:00

Update texinfo source from master.

* doc/gpg-agent.texi, doc/gpg.texi, doc/gpgsm.texi
* doc/scdaemon.texi,  doc/tools.texi: Update.
* doc/yat2m.c: Update.
This commit is contained in:
Werner Koch 2012-03-27 10:05:28 +02:00
parent cc4de72e7d
commit e23ca51ba0
6 changed files with 902 additions and 682 deletions

View File

@ -204,7 +204,6 @@ below the home directory of the user.
@item -v @item -v
@item --verbose @item --verbose
@opindex v
@opindex verbose @opindex verbose
Outputs additional information while running. Outputs additional information while running.
You can increase the verbosity by giving several You can increase the verbosity by giving several
@ -212,7 +211,6 @@ verbose commands to @command{gpgsm}, such as @samp{-vv}.
@item -q @item -q
@item --quiet @item --quiet
@opindex q
@opindex quiet @opindex quiet
Try to be as quiet as possible. Try to be as quiet as possible.
@ -300,9 +298,7 @@ debugging.
@itemx --sh @itemx --sh
@itemx -c @itemx -c
@itemx --csh @itemx --csh
@opindex s
@opindex sh @opindex sh
@opindex c
@opindex csh @opindex csh
Format the info output in daemon mode for use with the standard Bourne Format the info output in daemon mode for use with the standard Bourne
shell or the C-shell respectively. The default is to guess it based on shell or the C-shell respectively. The default is to guess it based on
@ -1369,7 +1365,7 @@ used a default value is used.
@ifset gpgtwoone @ifset gpgtwoone
@item s2k-count @item s2k-count
Instead of using the standard S2K counted (which is computed on the Instead of using the standard S2K count (which is computed on the
fly), the given S2K count is used for new keys or when changing the fly), the given S2K count is used for new keys or when changing the
passphrase of a key. Values below 65536 are considered to be 0. This passphrase of a key. Values below 65536 are considered to be 0. This
option is valid for the entire session or until reset to 0. This option is valid for the entire session or until reset to 0. This

File diff suppressed because it is too large Load Diff

View File

@ -304,7 +304,7 @@ and to change the default configuration.
* Certificate Options:: Certificate related options. * Certificate Options:: Certificate related options.
* Input and Output:: Input and Output. * Input and Output:: Input and Output.
* CMS Options:: How to change how the CMS is created. * CMS Options:: How to change how the CMS is created.
* Esoteric Options:: Doing things one usually don't want to do. * Esoteric Options:: Doing things one usually do not want to do.
@end menu @end menu
@ -346,14 +346,14 @@ Change the default name of the policy file to @var{filename}.
Specify an agent program to be used for secret key operations. The Specify an agent program to be used for secret key operations. The
default value is the @file{/usr/local/bin/gpg-agent}. This is only used default value is the @file{/usr/local/bin/gpg-agent}. This is only used
as a fallback when the environment variable @code{GPG_AGENT_INFO} is not as a fallback when the environment variable @code{GPG_AGENT_INFO} is not
set or a running agent can't be connected. set or a running agent cannot be connected.
@item --dirmngr-program @var{file} @item --dirmngr-program @var{file}
@opindex dirmnr-program @opindex dirmnr-program
Specify a dirmngr program to be used for @acronym{CRL} checks. The Specify a dirmngr program to be used for @acronym{CRL} checks. The
default value is @file{/usr/sbin/dirmngr}. This is only used as a default value is @file{/usr/sbin/dirmngr}. This is only used as a
fallback when the environment variable @code{DIRMNGR_INFO} is not set or fallback when the environment variable @code{DIRMNGR_INFO} is not set or
a running dirmngr can't be connected. a running dirmngr cannot be connected.
@item --prefer-system-dirmngr @item --prefer-system-dirmngr
@opindex prefer-system-dirmngr @opindex prefer-system-dirmngr
@ -367,7 +367,7 @@ Entirely disable the use of the Dirmngr.
@item --no-secmem-warning @item --no-secmem-warning
@opindex no-secmem-warning @opindex no-secmem-warning
Don't print a warning when the so called "secure memory" can't be used. Do not print a warning when the so called "secure memory" cannot be used.
@item --log-file @var{file} @item --log-file @var{file}
@opindex log-file @opindex log-file
@ -407,7 +407,7 @@ By default the @acronym{CRL} for trusted root certificates are checked
like for any other certificates. This allows a CA to revoke its own like for any other certificates. This allows a CA to revoke its own
certificates voluntary without the need of putting all ever issued certificates voluntary without the need of putting all ever issued
certificates into a CRL. The disable option may be used to switch this certificates into a CRL. The disable option may be used to switch this
extra check off. Due to the caching done by the Dirmngr, there won't be extra check off. Due to the caching done by the Dirmngr, there will not be
any noticeable performance gain. Note, that this also disables possible any noticeable performance gain. Note, that this also disables possible
OCSP checks for trusted root certificates. A more specific way of OCSP checks for trusted root certificates. A more specific way of
disabling this check is by adding the ``relax'' keyword to the root CA disabling this check is by adding the ``relax'' keyword to the root CA
@ -428,12 +428,12 @@ command. This option should not be used in a configuration file.
@itemx --disable-ocsp @itemx --disable-ocsp
@opindex enable-ocsp @opindex enable-ocsp
@opindex disable-ocsp @opindex disable-ocsp
Be default @acronym{OCSP} checks are disabled. The enable option may By default @acronym{OCSP} checks are disabled. The enable option may
be used to enable OCSP checks via Dirmngr. If @acronym{CRL} checks be used to enable OCSP checks via Dirmngr. If @acronym{CRL} checks
are also enabled, CRLs will be used as a fallback if for some reason an are also enabled, CRLs will be used as a fallback if for some reason an
OCSP request won't succeed. Note, that you have to allow OCSP OCSP request will not succeed. Note, that you have to allow OCSP
requests in Dirmngr's configuration too (option requests in Dirmngr's configuration too (option
@option{--allow-ocsp} and configure dirmngr properly. If you don't do @option{--allow-ocsp}) and configure Dirmngr properly. If you do not do
so you will get the error code @samp{Not supported}. so you will get the error code @samp{Not supported}.
@item --auto-issuer-key-retrieve @item --auto-issuer-key-retrieve
@ -451,10 +451,11 @@ address and the time when you verified the signature.
@item --validation-model @var{name} @item --validation-model @var{name}
@opindex validation-model @opindex validation-model
This option changes the default validation model. The only possible This option changes the default validation model. The only possible
values are "shell" (which is the default) and "chain" which forces the values are "shell" (which is the default), "chain" which forces the
use of the chain model. The chain model is also used if an option in use of the chain model and "steed" for a new simplified model. The
the @file{trustlist.txt} or an attribute of the certificate requests it. chain model is also used if an option in the @file{trustlist.txt} or
However the standard model (shell) is in that case always tried first. an attribute of the certificate requests it. However the standard
model (shell) is in that case always tried first.
@item --ignore-cert-extension @var{oid} @item --ignore-cert-extension @var{oid}
@opindex ignore-cert-extension @opindex ignore-cert-extension
@ -463,7 +464,7 @@ Add @var{oid} to the list of ignored certificate extensions. The
@code{2.5.29.3}. This option may be used more than once. Critical @code{2.5.29.3}. This option may be used more than once. Critical
flagged certificate extensions matching one of the OIDs in the list flagged certificate extensions matching one of the OIDs in the list
are treated as if they are actually handled and thus the certificate are treated as if they are actually handled and thus the certificate
won't be rejected due to an unknown critical extension. Use this will not be rejected due to an unknown critical extension. Use this
option with care because extensions are usually flagged as critical option with care because extensions are usually flagged as critical
for a reason. for a reason.
@ -479,7 +480,6 @@ for a reason.
@item --armor @item --armor
@itemx -a @itemx -a
@opindex armor @opindex armor
@opindex -a
Create PEM encoded output. Default is binary output. Create PEM encoded output. Default is binary output.
@item --base64 @item --base64
@ -506,7 +506,7 @@ Assume the input data is binary encoded.
PKCS#12 files. This option may be used to force the passphrase to be PKCS#12 files. This option may be used to force the passphrase to be
encoded in the specified encoding @var{name}. This is useful if the encoded in the specified encoding @var{name}. This is useful if the
application used to import the key uses a different encoding and thus application used to import the key uses a different encoding and thus
won't be able to import a file generated by @command{gpgsm}. Commonly will not be able to import a file generated by @command{gpgsm}. Commonly
used values for @var{name} are @code{Latin1} and @code{CP850}. Note used values for @var{name} are @code{Latin1} and @code{CP850}. Note
that @command{gpgsm} itself automagically imports any file with a that @command{gpgsm} itself automagically imports any file with a
passphrase encoded to the most commonly used encodings. passphrase encoded to the most commonly used encodings.
@ -523,7 +523,6 @@ set; however @option{--default-key} always overrides this.
@item --local-user @var{user_id} @item --local-user @var{user_id}
@item -u @var{user_id} @item -u @var{user_id}
@opindex local-user @opindex local-user
@opindex -u
Set the user(s) to be used for signing. The default is the first Set the user(s) to be used for signing. The default is the first
secret key found in the database. secret key found in the database.
@ -605,7 +604,7 @@ interoperability problems.
@c ******** ESOTERIC OPTIONS *************** @c ******** ESOTERIC OPTIONS ***************
@c ******************************************* @c *******************************************
@node Esoteric Options @node Esoteric Options
@subsection Doing things one usually don't want to do. @subsection Doing things one usually do not want to do.
@table @gnupgtabopt @table @gnupgtabopt
@ -954,7 +953,7 @@ of af a transfer error, a program error or tampering with the message).
@end table @end table
@item Error verifying a signature @item Error verifying a signature
For some reason the signature could not be verified, i.e. it can't be For some reason the signature could not be verified, i.e. it cannot be
decided whether the signature is valid or invalid. A common reason for decided whether the signature is valid or invalid. A common reason for
this is a missing certificate. this is a missing certificate.
@ -1044,9 +1043,9 @@ already existing key. Key-Length will be ignored when given.
@item Key-Usage: @var{usage-list} @item Key-Usage: @var{usage-list}
Space or comma delimited list of key usage, allowed values are Space or comma delimited list of key usage, allowed values are
@samp{encrypt} and @samp{sign}. This is used to generate the keyUsage @samp{encrypt}, @samp{sign} and @samp{cert}. This is used to generate
extension. Please make sure that the algorithm is capable of this the keyUsage extension. Please make sure that the algorithm is
usage. Default is to allow encrypt and sign. capable of this usage. Default is to allow encrypt and sign.
@item Name-DN: @var{subject-name} @item Name-DN: @var{subject-name}
This is the Distinguished Name (DN) of the subject in RFC-2253 format. This is the Distinguished Name (DN) of the subject in RFC-2253 format.
@ -1158,7 +1157,7 @@ Set the recipient for the encryption. @var{userID} should be the
internal representation of the key; the server may accept any other way internal representation of the key; the server may accept any other way
of specification. If this is a valid and trusted recipient the server of specification. If this is a valid and trusted recipient the server
does respond with OK, otherwise the return is an ERR with the reason why does respond with OK, otherwise the return is an ERR with the reason why
the recipient can't be used, the encryption will then not be done for the recipient cannot be used, the encryption will then not be done for
this recipient. If the policy is not to encrypt at all if not all this recipient. If the policy is not to encrypt at all if not all
recipients are valid, the client has to take care of this. All recipients are valid, the client has to take care of this. All
@code{RECIPIENT} commands are cumulative until a @code{RESET} or an @code{RECIPIENT} commands are cumulative until a @code{RESET} or an
@ -1206,7 +1205,8 @@ It takes the plaintext from the @code{INPUT} command, writes to the
ciphertext to the file descriptor set with the @code{OUTPUT} command, ciphertext to the file descriptor set with the @code{OUTPUT} command,
take the recipients from all the recipients set so far. If this command take the recipients from all the recipients set so far. If this command
fails the clients should try to delete all output currently done or fails the clients should try to delete all output currently done or
otherwise mark it as invalid. @command{GPGSM} does ensure that there won't be any otherwise mark it as invalid. @command{GPGSM} does ensure that there
will not be any
security problem with leftover data on the output in this case. security problem with leftover data on the output in this case.
This command should in general not fail, as all necessary checks have This command should in general not fail, as all necessary checks have
@ -1274,7 +1274,7 @@ to the signer's key. @var{userID} should be the
internal representation of the key; the server may accept any other way internal representation of the key; the server may accept any other way
of specification. If this is a valid and trusted recipient the server of specification. If this is a valid and trusted recipient the server
does respond with OK, otherwise the return is an ERR with the reason why does respond with OK, otherwise the return is an ERR with the reason why
the key can't be used, the signature will then not be created using the key cannot be used, the signature will then not be created using
this key. If the policy is not to sign at all if not all this key. If the policy is not to sign at all if not all
keys are valid, the client has to take care of this. All keys are valid, the client has to take care of this. All
@code{SIGNER} commands are cumulative until a @code{RESET} is done. @code{SIGNER} commands are cumulative until a @code{RESET} is done.

View File

@ -21,16 +21,16 @@
.IR dir ] .IR dir ]
.RB [ \-\-options .RB [ \-\-options
.IR file ] .IR file ]
.RI [ options ] .RI [ options ]
.B \-\-server .B \-\-server
.br .br
.B scdaemon .B scdaemon
.RB [ \-\-homedir .RB [ \-\-homedir
.IR dir ] .IR dir ]
.RB [ \-\-options .RB [ \-\-options
.IR file ] .IR file ]
.RI [ options ] .RI [ options ]
.B \-\-daemon .B \-\-daemon
.RI [ command_line ] .RI [ command_line ]
@end ifset @end ifset
@ -130,7 +130,7 @@ a numeric value or a keyword:
@item none @item none
No debugging at all. A value of less than 1 may be used instead of No debugging at all. A value of less than 1 may be used instead of
the keyword. the keyword.
@item basic @item basic
Some basic debug messages. A value between 1 and 2 may be used Some basic debug messages. A value between 1 and 2 may be used
instead of the keyword. instead of the keyword.
@item advanced @item advanced
@ -165,8 +165,8 @@ usual C-Syntax. The currently defined bits are:
@table @code @table @code
@item 0 (1) @item 0 (1)
command I/O command I/O
@item 1 (2) @item 1 (2)
values of big number integers values of big number integers
@item 2 (4) @item 2 (4)
low level crypto operations low level crypto operations
@item 5 (32) @item 5 (32)
@ -178,9 +178,11 @@ show memory statistics.
@item 9 (512) @item 9 (512)
write hashed data to files named @code{dbgmd-000*} write hashed data to files named @code{dbgmd-000*}
@item 10 (1024) @item 10 (1024)
trace Assuan protocol trace Assuan protocol. See also option @option{--debug-assuan-log-cats}.
@item 11 (2048) @item 11 (2048)
trace APDU I/O to the card. This may reveal sensitive data. trace APDU I/O to the card. This may reveal sensitive data.
@item 12 (4096)
trace some card reader related function calls.
@end table @end table
@item --debug-all @item --debug-all
@ -215,6 +217,15 @@ dump. This options enables it and also changes the working directory to
@opindex debug-log-tid @opindex debug-log-tid
This option appends a thread ID to the PID in the log output. This option appends a thread ID to the PID in the log output.
@item --debug-assuan-log-cats @var{cats}
@opindex debug-assuan-log-cats
Changes the active Libassuan logging categories to @var{cats}. The
value for @var{cats} is an unsigned integer given in usual C-Syntax.
A value of of 0 switches to a default category. If this option is not
used the categories are taken from the environment variable
@samp{ASSUAN_DEBUG}. Note that this option has only an effect if the
Assuan debug flag has also been with the option @option{--debug}. For
a list of categories see the Libassuan manual.
@item --no-detach @item --no-detach
@opindex no-detach @opindex no-detach
@ -240,7 +251,7 @@ Use @var{library} to access the smartcard reader. The current default
is @file{libtowitoko.so}. Note that the use of this interface is is @file{libtowitoko.so}. Note that the use of this interface is
deprecated; it may be removed in future releases. deprecated; it may be removed in future releases.
@item --disable-ccid @item --disable-ccid
@opindex disable-ccid @opindex disable-ccid
Disable the integrated support for CCID compliant readers. This Disable the integrated support for CCID compliant readers. This
allows to fall back to one of the other drivers even if the internal allows to fall back to one of the other drivers even if the internal
@ -318,6 +329,7 @@ stripping off the two leading dashes.
* DINSIG Card:: The DINSIG card application * DINSIG Card:: The DINSIG card application
* PKCS#15 Card:: The PKCS#15 card application * PKCS#15 Card:: The PKCS#15 card application
* Geldkarte Card:: The Geldkarte application * Geldkarte Card:: The Geldkarte application
* Undefined Card:: The Undefined stub application
@end menu @end menu
@node OpenPGP Card @node OpenPGP Card
@ -325,7 +337,7 @@ stripping off the two leading dashes.
This application is currently only used by @command{gpg} but may in This application is currently only used by @command{gpg} but may in
future also be useful with @command{gpgsm}. Version 1 and version 2 of future also be useful with @command{gpgsm}. Version 1 and version 2 of
the card is supported. the card is supported.
The specifications for these cards are available at The specifications for these cards are available at
@uref{http://g10code.com/docs/openpgp-card-1.0.pdf} and @uref{http://g10code.com/docs/openpgp-card-1.0.pdf} and
@ -358,6 +370,14 @@ This is a simple application to display information of a German
Geldkarte. The Geldkarte is a small amount debit card application which Geldkarte. The Geldkarte is a small amount debit card application which
comes with almost all German banking cards. comes with almost all German banking cards.
@node Undefined Card
@subsection The Undefined card application ``undefined''
This is a stub application to allow the use of the APDU command even
if no supported application is found on the card. This application is
not used automatically but must be explicitly requested using the
SERIALNO command.
@c ******************************************* @c *******************************************
@c *************** **************** @c *************** ****************
@ -395,7 +415,7 @@ about reader status changes. Its use is now deprecated in favor of
@end table @end table
@c @c
@c Examples @c Examples
@c @c
@mansect examples @mansect examples
@ -410,7 +430,7 @@ $ scdaemon --server -v
@c man end @c man end
@c @c
@c Assuan Protocol @c Assuan Protocol
@c @c
@manpause @manpause
@ -447,7 +467,7 @@ synchronizing access to a token between sessions.
* Scdaemon APDU:: Send a verbatim APDU to the card * Scdaemon APDU:: Send a verbatim APDU to the card
@end menu @end menu
@node Scdaemon SERIALNO @node Scdaemon SERIALNO
@subsection Return the serial number @subsection Return the serial number
This command should be used to check for the presence of a card. It is This command should be used to check for the presence of a card. It is
@ -470,7 +490,7 @@ Return the serial number of the card using a status response like:
@end example @end example
The trailing 0 should be ignored for now, it is reserved for a future The trailing 0 should be ignored for now, it is reserved for a future
extension. The serial number is the hex encoded value identified by extension. The serial number is the hex encoded value identified by
the @code{0x5A} tag in the GDO file (FIX=0x2F02). the @code{0x5A} tag in the GDO file (FIX=0x2F02).
@ -522,7 +542,7 @@ READKEY @var{hexified_certid}
@end example @end example
Return the public key for the given cert or key ID as an standard Return the public key for the given cert or key ID as an standard
S-Expression. S-Expression.
@ -619,7 +639,7 @@ TO BE WRITTEN.
@example @example
PASSWD [--reset] [--nullpin] @var{chvno} PASSWD [--reset] [--nullpin] @var{chvno}
@end example @end example
Change the PIN or reset the retry counter of the card holder Change the PIN or reset the retry counter of the card holder
verification vector number @var{chvno}. The option @option{--nullpin} verification vector number @var{chvno}. The option @option{--nullpin}
is used to initialize the PIN of TCOS cards (6 byte NullPIN only). is used to initialize the PIN of TCOS cards (6 byte NullPIN only).
@ -663,11 +683,11 @@ and only if the retry counter is still at 3.
Restart the current connection; this is a kind of warm reset. It Restart the current connection; this is a kind of warm reset. It
deletes the context used by this connection but does not actually deletes the context used by this connection but does not actually
reset the card. reset the card.
This is used by gpg-agent to reuse a primary pipe connection and This is used by gpg-agent to reuse a primary pipe connection and
may be used by clients to backup from a conflict in the serial may be used by clients to backup from a conflict in the serial
command; i.e. to select another application. command; i.e. to select another application.
@ -704,7 +724,7 @@ length up to N bytes. If N is not given a default value is used
@mansect see also @mansect see also
@ifset isman @ifset isman
@command{gpg-agent}(1), @command{gpg-agent}(1),
@command{gpgsm}(1), @command{gpgsm}(1),
@command{gpg2}(1) @command{gpg2}(1)
@end ifset @end ifset
@include see-also-note.texi @include see-also-note.texi

View File

@ -1193,7 +1193,6 @@ Specify the agent program to be started if none is running.
@item -S @item -S
@itemx --raw-socket @var{name} @itemx --raw-socket @var{name}
@opindex S
@opindex raw-socket @opindex raw-socket
Connect to socket @var{name} assuming this is an Assuan style server. Connect to socket @var{name} assuming this is an Assuan style server.
Do not run any special initializations or environment checks. This may Do not run any special initializations or environment checks. This may
@ -1408,11 +1407,11 @@ input lines which makes scripts easier to read.
@item /while @var{condition} @item /while @var{condition}
@itemx /end @itemx /end
These commands provide a way for executing loops. All lines between the These commands provide a way for executing loops. All lines between
@code{while} and the corresponding @code{end} are executed as long as the @code{while} and the corresponding @code{end} are executed as long
the evaluation of @var{condition} yields a non-zero value. The as the evaluation of @var{condition} yields a non-zero value or is the
evaluation is done by passing @var{condition} to the @code{strtol} string @code{true} or @code{yes}. The evaluation is done by passing
function. Example: @var{condition} to the @code{strtol} function. Example:
@smallexample @smallexample
/subst /subst
@ -1423,6 +1422,13 @@ function. Example:
/end /end
@end smallexample @end smallexample
@item /if @var{condition}
@itemx /end
These commands provide a way for conditional execution. All lines between
the @code{if} and the corresponding @code{end} are executed only if
the evaluation of @var{condition} yields a non-zero value or is the
string @code{true} or @code{yes}. The evaluation is done by passing
@var{condition} to the @code{strtol} function.
@item /run @var{file} @item /run @var{file}
Run commands from @var{file}. Run commands from @var{file}.

View File

@ -1,6 +1,6 @@
/* yat2m.c - Yet Another Texi 2 Man converter /* yat2m.c - Yet Another Texi 2 Man converter
* Copyright (C) 2005 g10 Code GmbH * Copyright (C) 2005 g10 Code GmbH
* Copyright (C) 2006, 2008 Free Software Foundation, Inc. * Copyright (C) 2006, 2008, 2011 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,11 +29,11 @@
@end macro @end macro
@macro mansect {a} @macro mansect {a}
@end macro @end macro
@macro manpause @macro manpause
@end macro @end macro
@macro mancont @macro mancont
@end macro @end macro
They are used by yat2m to select parts of the Texinfo which should They are used by yat2m to select parts of the Texinfo which should
go into the man page. These macros need to be used without leading go into the man page. These macros need to be used without leading
left space. Processing starts after a "manpage" macro has been left space. Processing starts after a "manpage" macro has been
@ -72,7 +72,21 @@
extracted from one file, either using the --store or the --select extracted from one file, either using the --store or the --select
option. option.
If you want to indent tables in the source use this style:
@table foo
@item
@item
@table
@item
@end
@end
Don't change the indentation within a table and keep the same
number of white space at the start of the line. yat2m simply
detects the number of white spaces in front of an @item and remove
this number of spaces from all following lines until a new @item
is found or there are less spaces than for the last @item.
*/ */
#include <stdio.h> #include <stdio.h>
@ -97,8 +111,8 @@
static int verbose; static int verbose;
static int quiet; static int quiet;
static int debug; static int debug;
static const char *opt_source; static const char *opt_source;
static const char *opt_release; static const char *opt_release;
static const char *opt_select; static const char *opt_select;
static const char *opt_include; static const char *opt_include;
static int opt_store; static int opt_store;
@ -148,22 +162,22 @@ struct section_buffer_s
typedef struct section_buffer_s *section_buffer_t; typedef struct section_buffer_s *section_buffer_t;
/* Variable to keep info about the current page together. */ /* Variable to keep info about the current page together. */
static struct static struct
{ {
/* Filename of the current page or NULL if no page is active. Malloced. */ /* Filename of the current page or NULL if no page is active. Malloced. */
char *name; char *name;
/* Number of allocated elements in SECTIONS below. */ /* Number of allocated elements in SECTIONS below. */
size_t n_sections; size_t n_sections;
/* Array with the data of the sections. */ /* Array with the data of the sections. */
section_buffer_t sections; section_buffer_t sections;
} thepage; } thepage;
/* The list of standard section names. COMMANDS and ASSUAN are GnuPG /* The list of standard section names. COMMANDS and ASSUAN are GnuPG
specific. */ specific. */
static const char * const standard_sections[] = static const char * const standard_sections[] =
{ "NAME", "SYNOPSIS", "DESCRIPTION", { "NAME", "SYNOPSIS", "DESCRIPTION",
"RETURN VALUE", "EXIT STATUS", "ERROR HANDLING", "ERRORS", "RETURN VALUE", "EXIT STATUS", "ERROR HANDLING", "ERRORS",
"COMMANDS", "OPTIONS", "USAGE", "EXAMPLES", "FILES", "COMMANDS", "OPTIONS", "USAGE", "EXAMPLES", "FILES",
@ -286,7 +300,7 @@ isodatestring (void)
static char buffer[11+5]; static char buffer[11+5];
struct tm *tp; struct tm *tp;
time_t atime = time (NULL); time_t atime = time (NULL);
if (atime < 0) if (atime < 0)
strcpy (buffer, "????" "-??" "-??"); strcpy (buffer, "????" "-??" "-??");
else else
@ -307,7 +321,7 @@ static section_buffer_t
get_section_buffer (const char *name) get_section_buffer (const char *name)
{ {
int i; int i;
section_buffer_t sect; section_buffer_t sect;
/* If there is no section we put everything into the required NAME /* If there is no section we put everything into the required NAME
section. Given that this is the first one listed it is likely section. Given that this is the first one listed it is likely
@ -452,8 +466,8 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
{ "sc", 0, "\\fB", "\\fR" }, { "sc", 0, "\\fB", "\\fR" },
{ "var", 0, "\\fI", "\\fR" }, { "var", 0, "\\fI", "\\fR" },
{ "samp", 0, "\\(aq", "\\(aq" }, { "samp", 0, "\\(aq", "\\(aq" },
{ "file", 0, "\\(oq\\fI","\\fR\\(cq" }, { "file", 0, "\\(oq\\fI","\\fR\\(cq" },
{ "env", 0, "\\(oq\\fI","\\fR\\(cq" }, { "env", 0, "\\(oq\\fI","\\fR\\(cq" },
{ "acronym", 0 }, { "acronym", 0 },
{ "dfn", 0 }, { "dfn", 0 },
{ "option", 0, "\\fB", "\\fR" }, { "option", 0, "\\fB", "\\fR" },
@ -467,7 +481,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
{ "uref", 0, "(\\fB", "\\fR)" }, { "uref", 0, "(\\fB", "\\fR)" },
{ "footnote",0, " ([", "])" }, { "footnote",0, " ([", "])" },
{ "emph", 0, "\\fI", "\\fR" }, { "emph", 0, "\\fI", "\\fR" },
{ "w", 1 }, { "w", 1 },
{ "c", 5 }, { "c", 5 },
{ "opindex", 1 }, { "opindex", 1 },
{ "cpindex", 1 }, { "cpindex", 1 },
@ -479,8 +493,8 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
{ "chapheading", 0}, { "chapheading", 0},
{ "item", 2, ".TP\n.B " }, { "item", 2, ".TP\n.B " },
{ "itemx", 2, ".TP\n.B " }, { "itemx", 2, ".TP\n.B " },
{ "table", 3 }, { "table", 3 },
{ "itemize", 3 }, { "itemize", 3 },
{ "bullet", 0, "* " }, { "bullet", 0, "* " },
{ "end", 4 }, { "end", 4 },
{ "quotation",1, ".RS\n\\fB" }, { "quotation",1, ".RS\n\\fB" },
@ -504,7 +518,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
{ {
case 1: /* Throw away the entire line. */ case 1: /* Throw away the entire line. */
s = memchr (rest, '\n', len); s = memchr (rest, '\n', len);
return s? (s-rest)+1 : len; return s? (s-rest)+1 : len;
case 2: /* Handle @item. */ case 2: /* Handle @item. */
break; break;
case 3: /* Handle table. */ case 3: /* Handle table. */
@ -512,7 +526,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
fputs (".RS\n", fp); fputs (".RS\n", fp);
/* Now throw away the entire line. */ /* Now throw away the entire line. */
s = memchr (rest, '\n', len); s = memchr (rest, '\n', len);
return s? (s-rest)+1 : len; return s? (s-rest)+1 : len;
break; break;
case 4: /* Handle end. */ case 4: /* Handle end. */
for (s=rest, n=len; n && (*s == ' ' || *s == '\t'); s++, n--) for (s=rest, n=len; n && (*s == ' ' || *s == '\t'); s++, n--)
@ -540,7 +554,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
} }
/* Now throw away the entire line. */ /* Now throw away the entire line. */
s = memchr (rest, '\n', len); s = memchr (rest, '\n', len);
return s? (s-rest)+1 : len; return s? (s-rest)+1 : len;
case 5: /* Handle special comments. */ case 5: /* Handle special comments. */
for (s=rest, n=len; n && (*s == ' ' || *s == '\t'); s++, n--) for (s=rest, n=len; n && (*s == ' ' || *s == '\t'); s++, n--)
; ;
@ -552,7 +566,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
} }
/* Now throw away the entire line. */ /* Now throw away the entire line. */
s = memchr (rest, '\n', len); s = memchr (rest, '\n', len);
return s? (s-rest)+1 : len; return s? (s-rest)+1 : len;
case 6: case 6:
*eol_action = 1; *eol_action = 1;
break; break;
@ -627,17 +641,17 @@ proc_texi_buffer (FILE *fp, const char *line, size_t len,
{ {
switch (*s) switch (*s)
{ {
case '@': case '{': case '}': case '@': case '{': case '}':
putc (*s, fp); in_cmd = 0; putc (*s, fp); in_cmd = 0;
break; break;
case ':': /* Not ending a sentence flag. */ case ':': /* Not ending a sentence flag. */
in_cmd = 0; in_cmd = 0;
break; break;
case '.': case '!': case '?': /* Ending a sentence. */ case '.': case '!': case '?': /* Ending a sentence. */
putc (*s, fp); in_cmd = 0; putc (*s, fp); in_cmd = 0;
break; break;
case ' ': case '\t': case '\n': /* Non collapsing spaces. */ case ' ': case '\t': case '\n': /* Non collapsing spaces. */
putc (*s, fp); in_cmd = 0; putc (*s, fp); in_cmd = 0;
break; break;
default: default:
cmdidx = 0; cmdidx = 0;
@ -655,7 +669,7 @@ proc_texi_buffer (FILE *fp, const char *line, size_t len,
s--; len++; s--; len++;
in_cmd = 0; in_cmd = 0;
} }
else if (cmdidx < sizeof cmdbuf -1) else if (cmdidx < sizeof cmdbuf -1)
cmdbuf[cmdidx++] = *s; cmdbuf[cmdidx++] = *s;
else else
{ {
@ -734,7 +748,7 @@ write_content (FILE *fp, line_buffer_t lines)
/* fputs ("---\n", fp); */ /* fputs ("---\n", fp); */
parse_texi_line (fp, line->line, &table_level); parse_texi_line (fp, line->line, &table_level);
} }
} }
} }
@ -823,7 +837,7 @@ finish_page (void)
write_content (fp, sect->lines); write_content (fp, sect->lines);
} }
} }
} }
} }
@ -856,10 +870,11 @@ parse_file (const char *fname, FILE *fp, char **section_name, int in_pause)
int in_gpgone = 0; /* Keep track of "@ifset gpgone" parts. */ int in_gpgone = 0; /* Keep track of "@ifset gpgone" parts. */
int not_in_gpgone = 0; /* Keep track of "@ifclear gpgone" parts. */ int not_in_gpgone = 0; /* Keep track of "@ifclear gpgone" parts. */
int not_in_man = 0; /* Keep track of "@ifclear isman" parts. */ int not_in_man = 0; /* Keep track of "@ifclear isman" parts. */
int item_indent = 0; /* How far is the current @item indented. */
/* Helper to define a macro. */ /* Helper to define a macro. */
char *macroname = NULL; char *macroname = NULL;
char *macrovalue = NULL; char *macrovalue = NULL;
size_t macrovaluesize = 0; size_t macrovaluesize = 0;
size_t macrovalueused = 0; size_t macrovalueused = 0;
@ -879,6 +894,24 @@ parse_file (const char *fname, FILE *fp, char **section_name, int in_pause)
} }
line[--n] = 0; line[--n] = 0;
/* Kludge to allow indentation of tables. */
for (p=line; *p == ' ' || *p == '\t'; p++)
;
if (*p)
{
if (*p == '@' && !strncmp (p+1, "item", 4))
item_indent = p - line; /* Set a new indent level. */
else if (p - line < item_indent)
item_indent = 0; /* Switch off indention. */
if (item_indent)
{
memmove (line, line+item_indent, n - item_indent + 1);
n -= item_indent;
}
}
if (*line == '@') if (*line == '@')
{ {
for (p=line+1, n=1; *p && *p != ' ' && *p != '\t'; p++) for (p=line+1, n=1; *p && *p != ' ' && *p != '\t'; p++)
@ -903,7 +936,7 @@ parse_file (const char *fname, FILE *fp, char **section_name, int in_pause)
macrovalue[--macrovalueused] = 0; /* Kill the last LF. */ macrovalue[--macrovalueused] = 0; /* Kill the last LF. */
macrovalue[macrovalueused] = 0; /* Terminate macro. */ macrovalue[macrovalueused] = 0; /* Terminate macro. */
macrovalue = xrealloc (macrovalue, macrovalueused+1); macrovalue = xrealloc (macrovalue, macrovalueused+1);
for (m= macrolist; m; m = m->next) for (m= macrolist; m; m = m->next)
if (!strcmp (m->name, macroname)) if (!strcmp (m->name, macroname))
break; break;
@ -1170,10 +1203,10 @@ top_parse_file (const char *fname, FILE *fp)
if not in a section. */ if not in a section. */
while (macrolist) while (macrolist)
{ {
macro_t m = macrolist->next; macro_t next = macrolist->next;
free (m->value); free (macrolist->value);
free (m); free (macrolist);
macrolist = m; macrolist = next;
} }
parse_file (fname, fp, &section_name, 0); parse_file (fname, fp, &section_name, 0);
@ -1182,7 +1215,7 @@ top_parse_file (const char *fname, FILE *fp)
} }
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int last_argc = -1; int last_argc = -1;
@ -1275,7 +1308,7 @@ main (int argc, char **argv)
opt_select = strrchr (*argv, '/'); opt_select = strrchr (*argv, '/');
if (opt_select) if (opt_select)
opt_select++; opt_select++;
else else
opt_select = *argv; opt_select = *argv;
argc--; argv++; argc--; argv++;
} }
@ -1299,8 +1332,8 @@ main (int argc, char **argv)
argc--; argv++; argc--; argv++;
} }
} }
} }
if (argc > 1) if (argc > 1)
die ("usage: " PGM " [OPTION] [FILE] (try --help for more information)\n"); die ("usage: " PGM " [OPTION] [FILE] (try --help for more information)\n");