summaryrefslogtreecommitdiffstats
path: root/gl/printf-parse.h
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2007-01-24 22:47:25 +0000
committerTon Voon <tonvoon@users.sourceforge.net>2007-01-24 22:47:25 +0000
commitfe856aa957978504137c1d425815d4ed8a22be40 (patch)
treea5bb46ce0e64b2056f75700eadbf27aba7c39418 /gl/printf-parse.h
parent210f39bc84cfbb21cd72dc054e43f13815ee0616 (diff)
downloadmonitoring-plugins-fe856aa957978504137c1d425815d4ed8a22be40.tar.gz
Sync with gnulib - lots of extraneous code removed in preference to GNU code
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1580 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'gl/printf-parse.h')
-rw-r--r--gl/printf-parse.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/gl/printf-parse.h b/gl/printf-parse.h
new file mode 100644
index 00000000..82a0d37c
--- /dev/null
+++ b/gl/printf-parse.h
@@ -0,0 +1,74 @@
1/* Parse printf format string.
2 Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17
18#ifndef _PRINTF_PARSE_H
19#define _PRINTF_PARSE_H
20
21#include "printf-args.h"
22
23
24/* Flags */
25#define FLAG_GROUP 1 /* ' flag */
26#define FLAG_LEFT 2 /* - flag */
27#define FLAG_SHOWSIGN 4 /* + flag */
28#define FLAG_SPACE 8 /* space flag */
29#define FLAG_ALT 16 /* # flag */
30#define FLAG_ZERO 32
31
32/* arg_index value indicating that no argument is consumed. */
33#define ARG_NONE (~(size_t)0)
34
35/* A parsed directive. */
36typedef struct
37{
38 const char* dir_start;
39 const char* dir_end;
40 int flags;
41 const char* width_start;
42 const char* width_end;
43 size_t width_arg_index;
44 const char* precision_start;
45 const char* precision_end;
46 size_t precision_arg_index;
47 char conversion; /* d i o u x X f e E g G c s p n U % but not C S */
48 size_t arg_index;
49}
50char_directive;
51
52/* A parsed format string. */
53typedef struct
54{
55 size_t count;
56 char_directive *dir;
57 size_t max_width_length;
58 size_t max_precision_length;
59}
60char_directives;
61
62
63/* Parses the format string. Fills in the number N of directives, and fills
64 in directives[0], ..., directives[N-1], and sets directives[N].dir_start
65 to the end of the format string. Also fills in the arg_type fields of the
66 arguments and the needed count of arguments. */
67#ifdef STATIC
68STATIC
69#else
70extern
71#endif
72int printf_parse (const char *format, char_directives *d, arguments *a);
73
74#endif /* _PRINTF_PARSE_H */