summaryrefslogtreecommitdiffstats
path: root/gl/printf-args.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-args.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-args.h')
-rw-r--r--gl/printf-args.h136
1 files changed, 136 insertions, 0 deletions
diff --git a/gl/printf-args.h b/gl/printf-args.h
new file mode 100644
index 00000000..5759da0e
--- /dev/null
+++ b/gl/printf-args.h
@@ -0,0 +1,136 @@
1/* Decomposed printf argument list.
2 Copyright (C) 1999, 2002-2003, 2006 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_ARGS_H
19#define _PRINTF_ARGS_H
20
21/* Get size_t. */
22#include <stddef.h>
23
24/* Get wchar_t. */
25#ifdef HAVE_WCHAR_T
26# include <stddef.h>
27#endif
28
29/* Get wint_t. */
30#ifdef HAVE_WINT_T
31# include <wchar.h>
32#endif
33
34/* Get va_list. */
35#include <stdarg.h>
36
37
38/* Argument types */
39typedef enum
40{
41 TYPE_NONE,
42 TYPE_SCHAR,
43 TYPE_UCHAR,
44 TYPE_SHORT,
45 TYPE_USHORT,
46 TYPE_INT,
47 TYPE_UINT,
48 TYPE_LONGINT,
49 TYPE_ULONGINT,
50#ifdef HAVE_LONG_LONG_INT
51 TYPE_LONGLONGINT,
52 TYPE_ULONGLONGINT,
53#endif
54 TYPE_DOUBLE,
55#ifdef HAVE_LONG_DOUBLE
56 TYPE_LONGDOUBLE,
57#endif
58 TYPE_CHAR,
59#ifdef HAVE_WINT_T
60 TYPE_WIDE_CHAR,
61#endif
62 TYPE_STRING,
63#ifdef HAVE_WCHAR_T
64 TYPE_WIDE_STRING,
65#endif
66 TYPE_POINTER,
67 TYPE_COUNT_SCHAR_POINTER,
68 TYPE_COUNT_SHORT_POINTER,
69 TYPE_COUNT_INT_POINTER,
70 TYPE_COUNT_LONGINT_POINTER
71#ifdef HAVE_LONG_LONG_INT
72, TYPE_COUNT_LONGLONGINT_POINTER
73#endif
74} arg_type;
75
76/* Polymorphic argument */
77typedef struct
78{
79 arg_type type;
80 union
81 {
82 signed char a_schar;
83 unsigned char a_uchar;
84 short a_short;
85 unsigned short a_ushort;
86 int a_int;
87 unsigned int a_uint;
88 long int a_longint;
89 unsigned long int a_ulongint;
90#ifdef HAVE_LONG_LONG_INT
91 long long int a_longlongint;
92 unsigned long long int a_ulonglongint;
93#endif
94 float a_float;
95 double a_double;
96#ifdef HAVE_LONG_DOUBLE
97 long double a_longdouble;
98#endif
99 int a_char;
100#ifdef HAVE_WINT_T
101 wint_t a_wide_char;
102#endif
103 const char* a_string;
104#ifdef HAVE_WCHAR_T
105 const wchar_t* a_wide_string;
106#endif
107 void* a_pointer;
108 signed char * a_count_schar_pointer;
109 short * a_count_short_pointer;
110 int * a_count_int_pointer;
111 long int * a_count_longint_pointer;
112#ifdef HAVE_LONG_LONG_INT
113 long long int * a_count_longlongint_pointer;
114#endif
115 }
116 a;
117}
118argument;
119
120typedef struct
121{
122 size_t count;
123 argument *arg;
124}
125arguments;
126
127
128/* Fetch the arguments, putting them into a. */
129#ifdef STATIC
130STATIC
131#else
132extern
133#endif
134int printf_fetchargs (va_list args, arguments *a);
135
136#endif /* _PRINTF_ARGS_H */