annotate lib/xvasprintf.h @ 17160:72f4bab621be

fts: introduce FTS_VERBATIM This gives clients the option to disable stripping of trailing slashes from input path names during fts_open initialization. The recent change v0.0-7611-g3a9002d that made fts_open strip trailing slashes from input path names had a negative impact on findutils that relies on the old fts_open behavior to implement POSIX requirement that each path operand of the find utility shall be evaluated unaltered as it was provided, including all trailing slash characters. * lib/fts_.h (FTS_VERBATIM): New bit flag. (FTS_OPTIONMASK, FTS_NAMEONLY, FTS_STOP): Adjust. * lib/fts.c (fts_open): Honor it.
author Dmitry V. Levin <ldv@altlinux.org>
date Sun, 18 Nov 2012 04:40:18 +0400
parents 8250f2777afc
children e542fd46ad6f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* vasprintf and asprintf with out-of-memory checking.
16201
8250f2777afc maint: update all copyright year number ranges
Jim Meyering <meyering@redhat.com>
parents: 14350
diff changeset
2 Copyright (C) 2002-2004, 2006-2012 Free Software Foundation, Inc.
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8386
diff changeset
4 This program is free software: you can redistribute it and/or modify
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8386
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8386
diff changeset
7 (at your option) any later version.
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8386
diff changeset
14 You should have received a copy of the GNU General Public License
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8386
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 #ifndef _XVASPRINTF_H
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #define _XVASPRINTF_H
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 /* Get va_list. */
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <stdarg.h>
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
12762
410eaa89fb57 Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
23 /* The __attribute__ feature is available in gcc versions 2.5 and later.
410eaa89fb57 Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
24 The __-protected variants of the attributes 'format' and 'printf' are
410eaa89fb57 Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
25 accepted by gcc versions 2.6.4 (effectively 2.7) and later.
14350
4cf3b58aaf12 Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
26 We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
12762
410eaa89fb57 Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
27 gnulib and libintl do '#define printf __printf__' when they override
410eaa89fb57 Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
28 the 'printf' function. */
14350
4cf3b58aaf12 Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
29 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
4cf3b58aaf12 Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
30 # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
4cf3b58aaf12 Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
31 #else
4cf3b58aaf12 Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
32 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 #endif
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34
8386
4ec84f742938 Convert tabs in the middle of preprocessor directives.
Bruno Haible <bruno@clisp.org>
parents: 6880
diff changeset
35 #ifdef __cplusplus
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 extern "C" {
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 #endif
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38
6880
4c57482eb676 Fix the comment fix.
Bruno Haible <bruno@clisp.org>
parents: 6879
diff changeset
39 /* Write formatted output to a string dynamically allocated with malloc(),
4c57482eb676 Fix the comment fix.
Bruno Haible <bruno@clisp.org>
parents: 6879
diff changeset
40 and return it. Upon [ENOMEM] memory allocation error, call xalloc_die.
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 On some other error
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 - [EOVERFLOW] resulting string length is > INT_MAX,
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 - [EINVAL] invalid format string,
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 - [EILSEQ] error during conversion between wide and multibyte characters,
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 return NULL. */
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 extern char *xasprintf (const char *format, ...)
14350
4cf3b58aaf12 Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
47 _GL_ATTRIBUTE_FORMAT ((__printf__, 1, 2));
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 extern char *xvasprintf (const char *format, va_list args)
14350
4cf3b58aaf12 Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
49 _GL_ATTRIBUTE_FORMAT ((__printf__, 1, 0));
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50
8386
4ec84f742938 Convert tabs in the middle of preprocessor directives.
Bruno Haible <bruno@clisp.org>
parents: 6880
diff changeset
51 #ifdef __cplusplus
5218
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 }
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 #endif
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54
f96c64693f86 New module 'xvasprintf'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 #endif /* _XVASPRINTF_H */