/ [gnulib] / gnulib / posix-modules
To checkout: cvs -d:pserver:anonymous@cvs.gnu.org.ua:/cvsmirror/gnulib co gnulib/posix-modules
Puszcza

Contents of /gnulib/posix-modules

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Tue Sep 11 00:40:16 2007 UTC (14 years, 2 months ago) by haible
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -2 lines
Fix typo in error message.

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

Send suggestions and bug reports to Sergey Poznyakoff
ViewVC Help
Powered by ViewVC 1.1.20