Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / texinfo / intl / printf-args.c
bloba6a089ce7bad39b904511b8cabce373e8afddf07
1 /* $NetBSD$ */
3 /* Decomposed printf argument list.
4 Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Library General Public License as published
8 by the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 USA. */
21 #ifdef HAVE_CONFIG_H
22 # include <config.h>
23 #endif
25 /* Specification. */
26 #include "printf-args.h"
28 #ifdef STATIC
29 STATIC
30 #endif
31 int
32 printf_fetchargs (va_list args, arguments *a)
34 size_t i;
35 argument *ap;
37 for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
38 switch (ap->type)
40 case TYPE_SCHAR:
41 ap->a.a_schar = va_arg (args, /*signed char*/ int);
42 break;
43 case TYPE_UCHAR:
44 ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
45 break;
46 case TYPE_SHORT:
47 ap->a.a_short = va_arg (args, /*short*/ int);
48 break;
49 case TYPE_USHORT:
50 ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
51 break;
52 case TYPE_INT:
53 ap->a.a_int = va_arg (args, int);
54 break;
55 case TYPE_UINT:
56 ap->a.a_uint = va_arg (args, unsigned int);
57 break;
58 case TYPE_LONGINT:
59 ap->a.a_longint = va_arg (args, long int);
60 break;
61 case TYPE_ULONGINT:
62 ap->a.a_ulongint = va_arg (args, unsigned long int);
63 break;
64 #ifdef HAVE_LONG_LONG
65 case TYPE_LONGLONGINT:
66 ap->a.a_longlongint = va_arg (args, long long int);
67 break;
68 case TYPE_ULONGLONGINT:
69 ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
70 break;
71 #endif
72 case TYPE_DOUBLE:
73 ap->a.a_double = va_arg (args, double);
74 break;
75 #ifdef HAVE_LONG_DOUBLE
76 case TYPE_LONGDOUBLE:
77 ap->a.a_longdouble = va_arg (args, long double);
78 break;
79 #endif
80 case TYPE_CHAR:
81 ap->a.a_char = va_arg (args, int);
82 break;
83 #ifdef HAVE_WINT_T
84 case TYPE_WIDE_CHAR:
85 ap->a.a_wide_char = va_arg (args, wint_t);
86 break;
87 #endif
88 case TYPE_STRING:
89 ap->a.a_string = va_arg (args, const char *);
90 break;
91 #ifdef HAVE_WCHAR_T
92 case TYPE_WIDE_STRING:
93 ap->a.a_wide_string = va_arg (args, const wchar_t *);
94 break;
95 #endif
96 case TYPE_POINTER:
97 ap->a.a_pointer = va_arg (args, void *);
98 break;
99 case TYPE_COUNT_SCHAR_POINTER:
100 ap->a.a_count_schar_pointer = va_arg (args, signed char *);
101 break;
102 case TYPE_COUNT_SHORT_POINTER:
103 ap->a.a_count_short_pointer = va_arg (args, short *);
104 break;
105 case TYPE_COUNT_INT_POINTER:
106 ap->a.a_count_int_pointer = va_arg (args, int *);
107 break;
108 case TYPE_COUNT_LONGINT_POINTER:
109 ap->a.a_count_longint_pointer = va_arg (args, long int *);
110 break;
111 #ifdef HAVE_LONG_LONG
112 case TYPE_COUNT_LONGLONGINT_POINTER:
113 ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
114 break;
115 #endif
116 default:
117 /* Unknown type. */
118 return -1;
120 return 0;