Commit ffa1e2dc ffa1e2dcd8035704e825eafcf9e597a8f3b656ca by Sergey Poznyakoff

Added to the repository

1 parent 52b33f07
1 /* Formatted output to strings.
2 Copyright (C) 1999, 2002 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17
18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21
22 /* Specification. */
23 #include "vasprintf.h"
24
25 #include <stdarg.h>
26
27 int
28 asprintf (char **resultp, const char *format, ...)
29 {
30 va_list args;
31 int result;
32
33 va_start (args, format);
34 result = vasprintf (resultp, format, args);
35 va_end (args);
36 return result;
37 }
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2005 Free Software Foundation, Inc.
3
4 GNU Mailutils 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 GNU Mailutils 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
15 along with GNU Mailutils; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17
18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21
22 #include <stdlib.h>
23 #include <mailutils/errno.h>
24 #include <mailutils/error.h>
25
26 void
27 xalloc_die (void)
28 {
29 mu_error ("not enough memory");
30 exit (1);
31 }
1 # This file is generated automatically. Please, do not edit.
2 #
3 AC_DEFUN([libmailutils_GNULIB],[
4 # allocsa
5 gl_ALLOCSA
6
7 # error
8 gl_ERROR
9
10 # exit
11
12 # exitfail
13 gl_EXITFAIL
14
15 # stdbool
16 AM_STDBOOL_H
17
18 # xalloc
19 gl_XALLOC
20
21 # fnmatch
22 # No macro. You should also use one of fnmatch-posix or fnmatch-gnu.
23
24 # getpass-gnu
25 gl_FUNC_GETPASS_GNU
26
27 # malloc
28 AC_FUNC_MALLOC
29
30 # obstack
31 gl_OBSTACK
32
33 # realloc
34 AC_FUNC_REALLOC
35
36 # setenv
37 gt_FUNC_SETENV
38
39 # snprintf
40 gl_FUNC_SNPRINTF
41
42 # xstrtol
43 gl_XSTRTOL
44
45 # vasprintf
46 gl_FUNC_VASPRINTF
47
48 # xsize
49 gl_XSIZE
50
51 ])
52 AC_DEFUN([libmailbox_GNULIB],[
53 # alloca
54
55 # alloca-opt
56 gl_FUNC_ALLOCA
57
58 # argp
59 gl_ARGP
60
61 # getline
62 AM_FUNC_GETLINE
63
64 # regex
65 gl_REGEX
66
67 # strtok_r
68 gl_FUNC_STRTOK_R
69
70 # md5
71 gl_MD5
72
73 # extensions
74 dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac.
75
76 # getopt
77 gl_GETOPT
78
79 # gettext
80
81 # mempcpy
82 gl_FUNC_MEMPCPY
83
84 # minmax
85
86 # restrict
87 gl_C_RESTRICT
88
89 # strcase
90 gl_STRCASE
91
92 # strchrnul
93 gl_FUNC_STRCHRNUL
94
95 # strndup
96 gl_FUNC_STRNDUP
97
98 # strnlen
99 gl_FUNC_STRNLEN
100
101 # sysexits
102 gl_SYSEXITS
103
104 # vasnprintf
105 gl_FUNC_VASNPRINTF
106
107 # vsnprintf
108 gl_FUNC_VSNPRINTF
109
110 # xsize
111 gl_XSIZE
112
113 ])
1 /* Memory allocation on the stack.
2
3 Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004 Free Software
4 Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
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 General Public License for more details.
15
16 You should have received a copy of the GNU 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. */
20
21 /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
22 means there is a real alloca function. */
23 #ifndef _GNULIB_ALLOCA_H
24 # define _GNULIB_ALLOCA_H
25
26 /* alloca (N) returns a pointer to N bytes of memory
27 allocated on the stack, which will last until the function returns.
28 Use of alloca should be avoided:
29 - inside arguments of function calls - undefined behaviour,
30 - in inline functions - the allocation may actually last until the
31 calling function returns,
32 - for huge N (say, N >= 65536) - you never know how large (or small)
33 the stack is, and when the stack cannot fulfill the memory allocation
34 request, the program just crashes.
35 */
36
37 #ifdef __GNUC__
38 # define alloca __builtin_alloca
39 #elif defined _AIX
40 # define alloca __alloca
41 #elif defined _MSC_VER
42 # include <malloc.h>
43 # define alloca _alloca
44 #else
45 # include <stddef.h>
46 # ifdef __cplusplus
47 extern "C"
48 # endif
49 void *alloca (size_t);
50 #endif
51
52 #endif /* _GNULIB_ALLOCA_H */
1 /* Declarations for getopt.
2 Copyright (C) 1989-1994,1996-1999,2001,2003,2004
3 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
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
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation,
18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20 #ifndef _GETOPT_H
21
22 #ifndef __need_getopt
23 # define _GETOPT_H 1
24 #endif
25
26 /* Standalone applications should #define __GETOPT_PREFIX to an
27 identifier that prefixes the external functions and variables
28 defined in this header. When this happens, include the
29 headers that might declare getopt so that they will not cause
30 confusion if included after this file. Then systematically rename
31 identifiers so that they do not collide with the system functions
32 and variables. Renaming avoids problems with some compilers and
33 linkers. */
34 #if defined __GETOPT_PREFIX && !defined __need_getopt
35 # include <stdlib.h>
36 # include <stdio.h>
37 # if HAVE_UNISTD_H
38 # include <unistd.h>
39 # endif
40 # undef __need_getopt
41 # undef getopt
42 # undef getopt_long
43 # undef getopt_long_only
44 # undef optarg
45 # undef opterr
46 # undef optind
47 # undef optopt
48 # define __GETOPT_CONCAT(x, y) x ## y
49 # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
50 # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
51 # define getopt __GETOPT_ID (getopt)
52 # define getopt_long __GETOPT_ID (getopt_long)
53 # define getopt_long_only __GETOPT_ID (getopt_long_only)
54 # define optarg __GETOPT_ID (optarg)
55 # define opterr __GETOPT_ID (opterr)
56 # define optind __GETOPT_ID (optind)
57 # define optopt __GETOPT_ID (optopt)
58 #endif
59
60 /* Standalone applications get correct prototypes for getopt_long and
61 getopt_long_only; they declare "char **argv". libc uses prototypes
62 with "char *const *argv" that are incorrect because getopt_long and
63 getopt_long_only can permute argv; this is required for backward
64 compatibility (e.g., for LSB 2.0.1).
65
66 This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',
67 but it caused redefinition warnings if both unistd.h and getopt.h were
68 included, since unistd.h includes getopt.h having previously defined
69 __need_getopt.
70
71 The only place where __getopt_argv_const is used is in definitions
72 of getopt_long and getopt_long_only below, but these are visible
73 only if __need_getopt is not defined, so it is quite safe to rewrite
74 the conditional as follows:
75 */
76 #if !defined __need_getopt
77 # if defined __GETOPT_PREFIX
78 # define __getopt_argv_const /* empty */
79 # else
80 # define __getopt_argv_const const
81 # endif
82 #endif
83
84 /* If __GNU_LIBRARY__ is not already defined, either we are being used
85 standalone, or this is the first header included in the source file.
86 If we are being used with glibc, we need to include <features.h>, but
87 that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
88 not defined, include <ctype.h>, which will pull in <features.h> for us
89 if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
90 doesn't flood the namespace with stuff the way some other headers do.) */
91 #if !defined __GNU_LIBRARY__
92 # include <ctype.h>
93 #endif
94
95 #ifndef __THROW
96 # ifndef __GNUC_PREREQ
97 # define __GNUC_PREREQ(maj, min) (0)
98 # endif
99 # if defined __cplusplus && __GNUC_PREREQ (2,8)
100 # define __THROW throw ()
101 # else
102 # define __THROW
103 # endif
104 #endif
105
106 #ifdef __cplusplus
107 extern "C" {
108 #endif
109
110 /* For communication from `getopt' to the caller.
111 When `getopt' finds an option that takes an argument,
112 the argument value is returned here.
113 Also, when `ordering' is RETURN_IN_ORDER,
114 each non-option ARGV-element is returned here. */
115
116 extern char *optarg;
117
118 /* Index in ARGV of the next element to be scanned.
119 This is used for communication to and from the caller
120 and for communication between successive calls to `getopt'.
121
122 On entry to `getopt', zero means this is the first call; initialize.
123
124 When `getopt' returns -1, this is the index of the first of the
125 non-option elements that the caller should itself scan.
126
127 Otherwise, `optind' communicates from one call to the next
128 how much of ARGV has been scanned so far. */
129
130 extern int optind;
131
132 /* Callers store zero here to inhibit the error message `getopt' prints
133 for unrecognized options. */
134
135 extern int opterr;
136
137 /* Set to an option character which was unrecognized. */
138
139 extern int optopt;
140
141 #ifndef __need_getopt
142 /* Describe the long-named options requested by the application.
143 The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
144 of `struct option' terminated by an element containing a name which is
145 zero.
146
147 The field `has_arg' is:
148 no_argument (or 0) if the option does not take an argument,
149 required_argument (or 1) if the option requires an argument,
150 optional_argument (or 2) if the option takes an optional argument.
151
152 If the field `flag' is not NULL, it points to a variable that is set
153 to the value given in the field `val' when the option is found, but
154 left unchanged if the option is not found.
155
156 To have a long-named option do something other than set an `int' to
157 a compiled-in constant, such as set a value from `optarg', set the
158 option's `flag' field to zero and its `val' field to a nonzero
159 value (the equivalent single-letter option character, if there is
160 one). For long options that have a zero `flag' field, `getopt'
161 returns the contents of the `val' field. */
162
163 struct option
164 {
165 const char *name;
166 /* has_arg can't be an enum because some compilers complain about
167 type mismatches in all the code that assumes it is an int. */
168 int has_arg;
169 int *flag;
170 int val;
171 };
172
173 /* Names for the values of the `has_arg' field of `struct option'. */
174
175 # define no_argument 0
176 # define required_argument 1
177 # define optional_argument 2
178 #endif /* need getopt */
179
180
181 /* Get definitions and prototypes for functions to process the
182 arguments in ARGV (ARGC of them, minus the program name) for
183 options given in OPTS.
184
185 Return the option character from OPTS just read. Return -1 when
186 there are no more options. For unrecognized options, or options
187 missing arguments, `optopt' is set to the option letter, and '?' is
188 returned.
189
190 The OPTS string is a list of characters which are recognized option
191 letters, optionally followed by colons, specifying that that letter
192 takes an argument, to be placed in `optarg'.
193
194 If a letter in OPTS is followed by two colons, its argument is
195 optional. This behavior is specific to the GNU `getopt'.
196
197 The argument `--' causes premature termination of argument
198 scanning, explicitly telling `getopt' that there are no more
199 options.
200
201 If OPTS begins with `--', then non-option arguments are treated as
202 arguments to the option '\0'. This behavior is specific to the GNU
203 `getopt'. */
204
205 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
206 __THROW;
207
208 #ifndef __need_getopt
209 extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
210 const char *__shortopts,
211 const struct option *__longopts, int *__longind)
212 __THROW;
213 extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
214 const char *__shortopts,
215 const struct option *__longopts, int *__longind)
216 __THROW;
217
218 #endif
219
220 #ifdef __cplusplus
221 }
222 #endif
223
224 /* Make sure we later can get all the definitions and declarations. */
225 #undef __need_getopt
226
227 #endif /* getopt.h */