1 /* Copyright (C) 2001-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18 #include <shlib-compat.h>
19
20 /* For Linux/Alpha we have to make the wordexp symbols versioned. */
21 #define wordexp(words, pwordexp, flags) \
22 __new_wordexp (words, pwordexp, flags)
23
24 #include <posix/wordexp.c>
25
26 versioned_symbol (libc, __new_wordexp, wordexp, GLIBC_2_2_2);
27
28
29 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2_2)
30 /* The old, incorrect wordexp_t definition. */
31 typedef struct
32 {
33 int we_wordc; /* Count of words matched. */
34 char **we_wordv; /* List of expanded words. */
35 int we_offs; /* Slots to reserve in `we_wordv'. */
36 } old_wordexp_t;
37
38
39 int
40 attribute_compat_text_section
__old_wordexp(const char * words,old_wordexp_t * pwordexp,int flags)41 __old_wordexp (const char *words, old_wordexp_t *pwordexp, int flags)
42 {
43 wordexp_t we;
44 int result;
45
46 we.we_wordc = pwordexp->we_wordc;
47 we.we_wordv = pwordexp->we_wordv;
48 we.we_offs = pwordexp->we_offs;
49
50 result = __new_wordexp (words, &we, flags);
51
52 pwordexp->we_wordc = we.we_wordc;
53 pwordexp->we_wordv = we.we_wordv;
54 pwordexp->we_offs = we.we_offs;
55
56 return result;
57 }
58 compat_symbol (libc, __old_wordexp, wordexp, GLIBC_2_1);
59 #endif
60