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