Mercurial > gnulib
annotate posix-modules @ 40231:9b3c79fdfe0b
strtod: fix clash with strtold
Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817).
* lib/strtod.c (compute_minus_zero, minus_zero):
Simplify by remving the macro / external variable,
and having just a function. User changed. This avoids
the need for an external variable that might clash.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 11 Mar 2019 16:40:29 -0700 |
parents | b06060465f09 |
children |
rev | line source |
---|---|
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 #!/bin/sh |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2 # |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19569
diff
changeset
|
3 # Copyright (C) 2002-2008, 2010-2019 Free Software Foundation, Inc. |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 # |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9206
diff
changeset
|
5 # This program is free software: you can redistribute it and/or modify |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 # 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:
9206
diff
changeset
|
7 # 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:
9206
diff
changeset
|
8 # (at your option) any later version. |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 # |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 # This program is distributed in the hope that it will be useful, |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 # GNU General Public License for more details. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 # |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 # You should have received a copy of the GNU General Public License |
19190 | 16 # along with this program. If not, see <https://www.gnu.org/licenses/>. |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 # |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 progname=$0 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 package=gnulib |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 # func_usage |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 # outputs to stdout the --help usage message. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 func_usage () |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 { |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 echo "\ |
18604
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
27 Usage: posix-modules [option] |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 |
14469
a9eb5e05648e
posix-modules: say what it does.
Reuben Thomas <rrt@sc3d.org>
parents:
14079
diff
changeset
|
29 Lists the gnulib modules that implement POSIX interfaces. |
a9eb5e05648e
posix-modules: say what it does.
Reuben Thomas <rrt@sc3d.org>
parents:
14079
diff
changeset
|
30 |
18604
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
31 Options: |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
32 |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
33 --for-mingw list only modules that work on mingw |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
34 --for-msvc list only modules that work on MSVC |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
35 |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 Report bugs to <bug-gnulib@gnu.org>." |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 } |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 # func_version |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 # outputs to stdout the --version message. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 func_version () |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 { |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
43 func_gnulib_dir |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
44 if test -d "$gnulib_dir"/.git \ |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
45 && (git --version) >/dev/null 2>/dev/null \ |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
46 && (date --version) >/dev/null 2>/dev/null; then |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
47 # gnulib checked out from git. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
48 sed_extract_first_date='/^Date/{ |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
49 s/^Date:[ ]*//p |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
50 q |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
51 }' |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
52 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"` |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
53 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600". |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
54 sed_year_before_time='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /' |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
55 date=`echo "$date" | sed -e "$sed_year_before_time"` |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
56 # Use GNU date to compute the time in GMT. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
57 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"` |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
58 version=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'` |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
59 else |
17378
1d9362a18c34
Assume gnulib is checked out from Git, not CVS
Stefano Lattarini <stefano.lattarini@gmail.com>
parents:
17249
diff
changeset
|
60 # gnulib copy without versioning information. |
1d9362a18c34
Assume gnulib is checked out from Git, not CVS
Stefano Lattarini <stefano.lattarini@gmail.com>
parents:
17249
diff
changeset
|
61 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog` |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
62 version= |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
63 fi |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
64 year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed 's,^.* ,,'` |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 echo "\ |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
66 posix-modules (GNU $package $date)$version |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
67 Copyright (C) $year Free Software Foundation, Inc. |
19190 | 68 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
69 This is free software: you are free to change and redistribute it. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
70 There is NO WARRANTY, to the extent permitted by law. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
71 |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
72 Written by" "Bruno Haible" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
73 } |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
74 |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
75 # func_exit STATUS |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
76 # exits with a given status. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
77 # This function needs to be used, rather than 'exit', when a 'trap' handler is |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
78 # in effect that refers to $?. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
79 func_exit () |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
80 { |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
81 (exit $1); exit $1 |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
82 } |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
83 |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
84 # func_gnulib_dir |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
85 # locates the directory where the gnulib repository lives |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
86 # Input: |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
87 # - progname name of this program |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
88 # Sets variables |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
89 # - self_abspathname absolute pathname of this program |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
90 # - gnulib_dir absolute pathname of gnulib repository |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
91 func_gnulib_dir () |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
92 { |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
93 case "$progname" in |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
94 /*) self_abspathname="$progname" ;; |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
95 */*) self_abspathname=`pwd`/"$progname" ;; |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
96 *) |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
97 # Look in $PATH. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
98 # Iterate through the elements of $PATH. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
99 # We use IFS=: instead of |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
100 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'` |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
101 # because the latter does not work when some PATH element contains spaces. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
102 # We use a canonicalized $pathx instead of $PATH, because empty PATH |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
103 # elements are by definition equivalent to '.', however field splitting |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
104 # according to IFS=: loses empty fields in many shells: |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
105 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
106 # beginning, at the end, and in the middle), |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
107 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
108 # at the beginning and at the end, |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
109 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX, |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
110 # Solaris lose empty fields at the end. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
111 # The 'case' statement is an optimization, to avoid evaluating the |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
112 # explicit canonicalization command when $PATH contains no empty fields. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
113 self_abspathname= |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
114 if test "${PATH_SEPARATOR+set}" != set; then |
13625
c2d737898a4e
Set PATH_SEPARATOR the same way autoconf does.
Stefano Lattarini <stefano.lattarini@gmail.com>
parents:
13518
diff
changeset
|
115 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which |
c2d737898a4e
Set PATH_SEPARATOR the same way autoconf does.
Stefano Lattarini <stefano.lattarini@gmail.com>
parents:
13518
diff
changeset
|
116 # contains only /bin. Note that ksh looks also at the FPATH variable, |
c2d737898a4e
Set PATH_SEPARATOR the same way autoconf does.
Stefano Lattarini <stefano.lattarini@gmail.com>
parents:
13518
diff
changeset
|
117 # so we have to set that as well for the test. |
c2d737898a4e
Set PATH_SEPARATOR the same way autoconf does.
Stefano Lattarini <stefano.lattarini@gmail.com>
parents:
13518
diff
changeset
|
118 PATH_SEPARATOR=: |
c2d737898a4e
Set PATH_SEPARATOR the same way autoconf does.
Stefano Lattarini <stefano.lattarini@gmail.com>
parents:
13518
diff
changeset
|
119 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ |
c2d737898a4e
Set PATH_SEPARATOR the same way autoconf does.
Stefano Lattarini <stefano.lattarini@gmail.com>
parents:
13518
diff
changeset
|
120 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ |
c2d737898a4e
Set PATH_SEPARATOR the same way autoconf does.
Stefano Lattarini <stefano.lattarini@gmail.com>
parents:
13518
diff
changeset
|
121 || PATH_SEPARATOR=';' |
c2d737898a4e
Set PATH_SEPARATOR the same way autoconf does.
Stefano Lattarini <stefano.lattarini@gmail.com>
parents:
13518
diff
changeset
|
122 } |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
123 fi |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
124 if test "$PATH_SEPARATOR" = ";"; then |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
125 # On Windows, programs are searched in "." before $PATH. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
126 pathx=".;$PATH" |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
127 else |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
128 # On Unix, we have to convert empty PATH elements to ".". |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
129 pathx="$PATH" |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
130 case :$PATH: in |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
131 *::*) |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
132 pathx=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'` |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
133 ;; |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
134 esac |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
135 fi |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
136 save_IFS="$IFS" |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
137 IFS="$PATH_SEPARATOR" |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
138 for d in $pathx; do |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
139 IFS="$save_IFS" |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
140 test -z "$d" && d=. |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
141 if test -x "$d/$progname" && test ! -d "$d/$progname"; then |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
142 self_abspathname="$d/$progname" |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
143 break |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
144 fi |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
145 done |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
146 IFS="$save_IFS" |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
147 if test -z "$self_abspathname"; then |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
148 func_fatal_error "could not locate the posix-modules program - how did you invoke it?" |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
149 fi |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
150 ;; |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
151 esac |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
152 while test -h "$self_abspathname"; do |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
153 # Resolve symbolic link. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
154 linkval=`func_readlink "$self_abspathname"` |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
155 test -n "$linkval" || break |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
156 case "$linkval" in |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
157 /* ) self_abspathname="$linkval" ;; |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
158 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;; |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
159 esac |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
160 done |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
161 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'` |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
162 } |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
163 |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
164 # func_tmpdir |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
165 # creates a temporary directory. |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
166 # Input: |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
167 # - progname name of this program |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
168 # Sets variable |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
169 # - tmp pathname of freshly created temporary directory |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
170 func_tmpdir () |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
171 { |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
172 # Use the environment variable TMPDIR, falling back to /tmp. This allows |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
173 # users to specify a different temporary directory, for example, if their |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
174 # /tmp is filled up or too small. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
175 : ${TMPDIR=/tmp} |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
176 { |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
177 # Use the mktemp program if available. If not available, hide the error |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
178 # message. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
179 tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` && |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
180 test -n "$tmp" && test -d "$tmp" |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
181 } || |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
182 { |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
183 # Use a simple mkdir command. It is guaranteed to fail if the directory |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
184 # already exists. $RANDOM is bash specific and expands to empty in shells |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
185 # other than bash, ksh and zsh. Its use does not increase security; |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
186 # rather, it minimizes the probability of failure in a very cluttered /tmp |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
187 # directory. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
188 tmp=$TMPDIR/gl$$-$RANDOM |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
189 (umask 077 && mkdir "$tmp") |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
190 } || |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
191 { |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
192 echo "$progname: cannot create a temporary directory in $TMPDIR" >&2 |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
193 func_exit 1 |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
194 } |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
195 } |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
196 |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
197 # func_fatal_error message |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
198 # outputs to stderr a fatal error message, and terminates the program. |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
199 # Input: |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
200 # - progname name of this program |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
201 func_fatal_error () |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
202 { |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
203 echo "$progname: *** $1" 1>&2 |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
204 echo "$progname: *** Stop." 1>&2 |
10496
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
205 func_exit 1 |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
206 } |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
207 |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
208 # func_readlink SYMLINK |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
209 # outputs the target of the given symlink. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
210 if (type -p readlink) > /dev/null 2>&1; then |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
211 func_readlink () |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
212 { |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
213 # Use the readlink program from GNU coreutils. |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
214 readlink "$1" |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
215 } |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
216 else |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
217 func_readlink () |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
218 { |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
219 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p' |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
220 # would do the wrong thing if the link target contains " -> ". |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
221 LC_ALL=C ls -l "$1" | sed -e 's, -> ,#%%#,' | sed -n -e 's,^.*#%%#\(.*\)$,\1,p' |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
222 } |
a9bac140b5fa
Copy --version support from gnulib-tool to posix-modules.
Bruno Haible <bruno@clisp.org>
parents:
10494
diff
changeset
|
223 fi |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
224 |
18604
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
225 # Excludes for mingw. |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
226 exclude_for_mingw= |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
227 # <grp.h> does not exist. |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
228 exclude_for_mingw="$exclude_for_mingw pt_chown grantpt posix_openpt-tests posix_openpt" |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
229 # The functions getuid, getgid, geteuid, getegid don't exist. |
19569
b708f3116de0
euidaccess: Port to native Windows.
Bruno Haible <bruno@clisp.org>
parents:
19484
diff
changeset
|
230 exclude_for_mingw="$exclude_for_mingw faccessat" |
18604
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
231 exclude_for_mingw="$exclude_for_mingw fchownat-tests fchownat" |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
232 |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
233 # Excludes for MSVC. |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
234 exclude_for_msvc="$exclude_for_mingw" |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
235 |
9186
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
236 # Command-line option processing. |
18604
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
237 exclude= |
9186
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
238 while test $# -gt 0; do |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
239 case "$1" in |
18604
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
240 --for-mingw | --for-ming | --for-min | --for-mi ) |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
241 exclude="$exclude $exclude_for_mingw" |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
242 shift ;; |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
243 --for-msvc | --for-msv | --for-ms ) |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
244 exclude="$exclude $exclude_for_msvc" |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
245 shift ;; |
9186
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
246 --help | --hel | --he | --h ) |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
247 func_usage |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
248 exit $? ;; |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
249 --version | --versio | --versi | --vers | --ver | --ve | --v ) |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
250 func_version |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
251 exit $? ;; |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
252 -* ) |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
253 echo "posix-modules: unknown option $1" 1>&2 |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
254 echo "Try 'posix-modules --help' for more information." 1>&2 |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
255 exit 1 ;; |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
256 * ) |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
257 echo "posix-modules: too many arguments" 1>&2 |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
258 echo "Try 'posix-modules --help' for more information." 1>&2 |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
259 exit 1 ;; |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
260 esac |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
261 done |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
262 |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
263 func_gnulib_dir |
18604
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
264 func_tmpdir |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
265 trap 'exit_status=$? |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
266 if test "$signal" != 0; then |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
267 echo "caught signal $signal" >&2 |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
268 fi |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
269 rm -rf "$tmp" |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
270 exit $exit_status' 0 |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
271 for signal in 1 2 3 13 15; do |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
272 trap '{ signal='$signal'; func_exit 1; }' $signal |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
273 done |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
274 signal=0 |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
275 |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
276 ( |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
277 # Get the header modules. |
13518
88d6d025ee3b
posix-modules: Ignore backup files of documentation files.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
278 LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/posix-headers/*.texi 2>/dev/null \ |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
279 | sed -e 's,^Gnulib module: ,,' |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
280 # Get the function modules. |
13518
88d6d025ee3b
posix-modules: Ignore backup files of documentation files.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
281 LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/posix-functions/*.texi 2>/dev/null \ |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
282 | sed -e 's,^Gnulib module: ,,' |
10494
0b8d92b5a326
Make this script work again (broken since 2008-01-19).
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
283 # Then filter out the words "---", ",", "and", "or" and remove *-gnu modules. |
0b8d92b5a326
Make this script work again (broken since 2008-01-19).
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
284 ) | sed -e 's/,/ /g' | LC_ALL=C sort | LC_ALL=C uniq \ |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
285 | { # Then filter out the words "---", "and", "or" and remove *-gnu modules. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
286 tr ' ' '\012' | sed -e '/^---$/d' -e '/^and$/d' -e '/^or$/d' -e '/-gnu$/d' |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
287 } \ |
18604
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
288 | LC_ALL=C sort | LC_ALL=C uniq \ |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
289 | { # Then filter out the excludes. |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
290 if test -n "$exclude"; then |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
291 for m in $exclude; do echo $m; done | LC_ALL=C sort -u > "$tmp"/excludes |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
292 LC_ALL=C join -v 1 - "$tmp"/excludes |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
293 rm -f "$tmp"/excludes |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
294 else |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
295 cat |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
296 fi |
1bfb1ca01cac
posix-modules: Add options for specific platforms.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
297 } |
10501
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
298 |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
299 # Local Variables: |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
300 # indent-tabs-mode: nil |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
301 # whitespace-check-buffer-indent: nil |
4e04aaeb17f9
Fix previous patch, and tweak references to $0.
Eric Blake <ebb9@byu.net>
parents:
10496
diff
changeset
|
302 # End: |