Mercurial > gnulib
annotate posix-modules @ 9186:2fc0bd767d53
Add --help and --version option processing.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 08 Sep 2007 22:45:08 +0000 |
parents | b8f4a5969ed1 |
children | e1e7f8a40d98 |
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 # |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 # Copyright (C) 2002-2007 Free Software Foundation, Inc. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 # |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 # This program is free software; you can redistribute it and/or modify |
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 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 # the Free Software Foundation; either version 2, or (at your option) |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 # any later version. |
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 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 # along with this program; if not, write to the Free Software Foundation, |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
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 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 progname=$0 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 package=gnulib |
9186
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
22 cvsdatestamp='$Date: 2007-09-08 22:45:08 $' |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` |
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 # func_usage |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 # outputs to stdout the --help usage message. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 func_usage () |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 { |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 echo "\ |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 Usage: posix-modules |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 Report bugs to <bug-gnulib@gnu.org>." |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 } |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 # func_version |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 # outputs to stdout the --version message. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 func_version () |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 { |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 year=`echo "$last_checkin_date" | sed -e 's,/.*$,,'` |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 echo "\ |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 $progname (GNU $package) $version |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 Copyright (C) $year Free Software Foundation, Inc. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 This is free software; see the source for copying conditions. There is NO |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
45 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
46 Written by" "Bruno Haible" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
47 } |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 case "$0" in |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 /*) self_abspathname="$0" ;; |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 */*) self_abspathname=`pwd`/"$0" ;; |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 *) |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 # Look in $PATH. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 # Iterate through the elements of $PATH. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 # We use IFS=: instead of |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'` |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 # because the latter does not work when some PATH element contains spaces. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 # We use a canonicalized $pathx instead of $PATH, because empty PATH |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 # elements are by definition equivalent to '.', however field splitting |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 # according to IFS=: loses empty fields in many shells: |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
62 # beginning, at the end, and in the middle), |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
63 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
64 # at the beginning and at the end, |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX, |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
66 # Solaris lose empty fields at the end. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
67 # The 'case' statement is an optimization, to avoid evaluating the |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
68 # explicit canonicalization command when $PATH contains no empty fields. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
69 self_abspathname= |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
70 if test "${PATH_SEPARATOR+set}" != set; then |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
71 func_tmpdir |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
72 { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
73 chmod +x "$tmp"/conf.sh |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
74 if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
75 PATH_SEPARATOR=';' |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
76 else |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
77 PATH_SEPARATOR=: |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
78 fi |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
79 rm -rf "$tmp" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
80 fi |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
81 if test "$PATH_SEPARATOR" = ";"; then |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
82 # On Windows, programs are searched in "." before $PATH. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
83 pathx=".;$PATH" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
84 else |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
85 # On Unix, we have to convert empty PATH elements to ".". |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
86 pathx="$PATH" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
87 case :$PATH: in |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
88 *::*) |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
89 pathx=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'` |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
90 ;; |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
91 esac |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
92 fi |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
93 save_IFS="$IFS" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
94 IFS="$PATH_SEPARATOR" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
95 for d in $pathx; do |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
96 IFS="$save_IFS" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
97 test -z "$d" && d=. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
98 if test -x "$d/$0" && test ! -d "$d/$0"; then |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
99 self_abspathname="$d/$0" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
100 break |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
101 fi |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
102 done |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
103 IFS="$save_IFS" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
104 if test -z "$self_abspathname"; then |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
105 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?" |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
106 fi |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
107 ;; |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
108 esac |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
109 while test -h "$self_abspathname"; do |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
110 # Resolve symbolic link. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
111 linkval=`func_readlink "$self_abspathname"` |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
112 test -n "$linkval" || break |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
113 case "$linkval" in |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
114 /* ) self_abspathname="$linkval" ;; |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
115 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;; |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
116 esac |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
117 done |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
118 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'` |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
119 |
9186
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
120 # Command-line option processing. |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
121 while test $# -gt 0; do |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
122 case "$1" in |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
123 --help | --hel | --he | --h ) |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
124 func_usage |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
125 exit $? ;; |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
126 --version | --versio | --versi | --vers | --ver | --ve | --v ) |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
127 func_version |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
128 exit $? ;; |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
129 -* ) |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
130 echo "posix-modules: unknown option $1" 1>&2 |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
131 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
|
132 exit 1 ;; |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
133 * ) |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
134 echo "posix-modules: too many arguments" 1>&2 |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
135 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
|
136 exit 1 ;; |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
137 esac |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
138 done |
2fc0bd767d53
Add --help and --version option processing.
Bruno Haible <bruno@clisp.org>
parents:
9185
diff
changeset
|
139 |
9185
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
140 ( |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
141 # Get the header modules. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
142 LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/headers/* 2>/dev/null \ |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
143 | sed -e 's,^Gnulib module: ,,' |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
144 # Get the function modules. |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
145 LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/functions/* 2>/dev/null \ |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
146 | sed -e 's,^Gnulib module: ,,' |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
147 # 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
|
148 ) | LC_ALL=C sort | LC_ALL=C uniq \ |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
149 | { # 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
|
150 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
|
151 } \ |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
152 | LC_ALL=C sort | LC_ALL=C uniq \ |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
153 | { # Except ftruncate, which aborts the configuration on mingw. FiXME |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
154 sed -e '/^ftruncate$/d' |
b8f4a5969ed1
Script to print the POSIX substitutes modules.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
155 } |