add ext4,vfat and tar.bz2
[u-tools.git] / u-tools / apps / tar / gnu / printf-args.c
blob2e5a39dea7f42e35143af76a7c3cc0f951de631c
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Decomposed printf argument list.
4 Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2011 Free Software
5 Foundation, Inc.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
21 /* This file can be parametrized with the following macros:
22 ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
23 PRINTF_FETCHARGS Name of the function to be defined.
24 STATIC Set to 'static' to declare the function static. */
26 #ifndef PRINTF_FETCHARGS
27 # include <config.h>
28 #endif
30 /* Specification. */
31 #ifndef PRINTF_FETCHARGS
32 # include "printf-args.h"
33 #endif
35 #ifdef STATIC
36 STATIC
37 #endif
38 int
39 PRINTF_FETCHARGS (va_list args, arguments *a)
41 size_t i;
42 argument *ap;
44 for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
45 switch (ap->type)
47 case TYPE_SCHAR:
48 ap->a.a_schar = va_arg (args, /*signed char*/ int);
49 break;
50 case TYPE_UCHAR:
51 ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
52 break;
53 case TYPE_SHORT:
54 ap->a.a_short = va_arg (args, /*short*/ int);
55 break;
56 case TYPE_USHORT:
57 ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
58 break;
59 case TYPE_INT:
60 ap->a.a_int = va_arg (args, int);
61 break;
62 case TYPE_UINT:
63 ap->a.a_uint = va_arg (args, unsigned int);
64 break;
65 case TYPE_LONGINT:
66 ap->a.a_longint = va_arg (args, long int);
67 break;
68 case TYPE_ULONGINT:
69 ap->a.a_ulongint = va_arg (args, unsigned long int);
70 break;
71 #if HAVE_LONG_LONG_INT
72 case TYPE_LONGLONGINT:
73 ap->a.a_longlongint = va_arg (args, long long int);
74 break;
75 case TYPE_ULONGLONGINT:
76 ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
77 break;
78 #endif
79 case TYPE_DOUBLE:
80 ap->a.a_double = va_arg (args, double);
81 break;
82 case TYPE_LONGDOUBLE:
83 ap->a.a_longdouble = va_arg (args, long double);
84 break;
85 case TYPE_CHAR:
86 ap->a.a_char = va_arg (args, int);
87 break;
88 #if HAVE_WINT_T
89 case TYPE_WIDE_CHAR:
90 /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
91 default argument promotions", this is not the case in mingw32,
92 where wint_t is 'unsigned short'. */
93 ap->a.a_wide_char =
94 (sizeof (wint_t) < sizeof (int)
95 ? (wint_t) va_arg (args, int)
96 : va_arg (args, wint_t));
97 break;
98 #endif
99 case TYPE_STRING:
100 ap->a.a_string = va_arg (args, const char *);
101 /* A null pointer is an invalid argument for "%s", but in practice
102 it occurs quite frequently in printf statements that produce
103 debug output. Use a fallback in this case. */
104 if (ap->a.a_string == NULL)
105 ap->a.a_string = "(NULL)";
106 break;
107 #if HAVE_WCHAR_T
108 case TYPE_WIDE_STRING:
109 ap->a.a_wide_string = va_arg (args, const wchar_t *);
110 /* A null pointer is an invalid argument for "%ls", but in practice
111 it occurs quite frequently in printf statements that produce
112 debug output. Use a fallback in this case. */
113 if (ap->a.a_wide_string == NULL)
115 static const wchar_t wide_null_string[] =
117 (wchar_t)'(',
118 (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
119 (wchar_t)')',
120 (wchar_t)0
122 ap->a.a_wide_string = wide_null_string;
124 break;
125 #endif
126 case TYPE_POINTER:
127 ap->a.a_pointer = va_arg (args, void *);
128 break;
129 case TYPE_COUNT_SCHAR_POINTER:
130 ap->a.a_count_schar_pointer = va_arg (args, signed char *);
131 break;
132 case TYPE_COUNT_SHORT_POINTER:
133 ap->a.a_count_short_pointer = va_arg (args, short *);
134 break;
135 case TYPE_COUNT_INT_POINTER:
136 ap->a.a_count_int_pointer = va_arg (args, int *);
137 break;
138 case TYPE_COUNT_LONGINT_POINTER:
139 ap->a.a_count_longint_pointer = va_arg (args, long int *);
140 break;
141 #if HAVE_LONG_LONG_INT
142 case TYPE_COUNT_LONGLONGINT_POINTER:
143 ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
144 break;
145 #endif
146 #if ENABLE_UNISTDIO
147 /* The unistdio extensions. */
148 case TYPE_U8_STRING:
149 ap->a.a_u8_string = va_arg (args, const uint8_t *);
150 /* A null pointer is an invalid argument for "%U", but in practice
151 it occurs quite frequently in printf statements that produce
152 debug output. Use a fallback in this case. */
153 if (ap->a.a_u8_string == NULL)
155 static const uint8_t u8_null_string[] =
156 { '(', 'N', 'U', 'L', 'L', ')', 0 };
157 ap->a.a_u8_string = u8_null_string;
159 break;
160 case TYPE_U16_STRING:
161 ap->a.a_u16_string = va_arg (args, const uint16_t *);
162 /* A null pointer is an invalid argument for "%lU", but in practice
163 it occurs quite frequently in printf statements that produce
164 debug output. Use a fallback in this case. */
165 if (ap->a.a_u16_string == NULL)
167 static const uint16_t u16_null_string[] =
168 { '(', 'N', 'U', 'L', 'L', ')', 0 };
169 ap->a.a_u16_string = u16_null_string;
171 break;
172 case TYPE_U32_STRING:
173 ap->a.a_u32_string = va_arg (args, const uint32_t *);
174 /* A null pointer is an invalid argument for "%llU", but in practice
175 it occurs quite frequently in printf statements that produce
176 debug output. Use a fallback in this case. */
177 if (ap->a.a_u32_string == NULL)
179 static const uint32_t u32_null_string[] =
180 { '(', 'N', 'U', 'L', 'L', ')', 0 };
181 ap->a.a_u32_string = u32_null_string;
183 break;
184 #endif
185 default:
186 /* Unknown type. */
187 return -1;
189 return 0;