chiark / gitweb /
gpg agent threading bugs: Add some `xxx' comments.
[gnupg2.git] / common / server-help.h
1 /* server-help.h - Helper functions for writing Assuan servers.
2  *      Copyright (C) 2003, 2009, 2010 g10 Code GmbH
3  *
4  * This file is part of GnuPG.
5  *
6  * This file is free software; you can redistribute it and/or modify
7  * it under the terms of either
8  *
9  *   - the GNU Lesser General Public License as published by the Free
10  *     Software Foundation; either version 3 of the License, or (at
11  *     your option) any later version.
12  *
13  * or
14  *
15  *   - the GNU General Public License as published by the Free
16  *     Software Foundation; either version 2 of the License, or (at
17  *     your option) any later version.
18  *
19  * or both in parallel, as here.
20  *
21  * This file is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, see <https://www.gnu.org/licenses/>.
28  */
29
30 #ifndef GNUPG_COMMON_SERVER_HELP_H
31 #define GNUPG_COMMON_SERVER_HELP_H
32
33 /* Skip over options in LINE.
34
35    Blanks after the options are also removed.  Options are indicated
36    by two leading dashes followed by a string consisting of non-space
37    characters.  The special option "--" indicates an explicit end of
38    options; all what follows will not be considered an option.  The
39    first no-option string also indicates the end of option parsing. */
40 char *skip_options (const char *line);
41
42 /* Check whether the option NAME appears in LINE.  */
43 int has_option (const char *line, const char *name);
44
45 /* Same as has_option but only considers options at the begin of the
46    line.  This is useful for commands which allow arbitrary strings on
47    the line.  */
48 int has_leading_option (const char *line, const char *name);
49
50 /* Same as has_option but does only test for the name of the option
51    and ignores an argument, i.e. with NAME being "--hash" it would
52    return a pointer for "--hash" as well as for "--hash=foo".  If
53    there is no such option NULL is returned.  The pointer returned
54    points right behind the option name, this may be an equal sign, Nul
55    or a space.  */
56 const char *has_option_name (const char *line, const char *name);
57
58 /* Return a pointer to the argument of the option with NAME.  If such
59    an option is not given, NULL is returned. */
60 char *option_value (const char *line, const char *name);
61
62 #endif  /* GNUPG_COMMON_SERVER_HELP_H */