#!/bin/sh
#
-# Copyright (C) 2002-2008 Free Software Foundation, Inc.
+# Copyright (C) 2002-2008, 2010-2013 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
echo "\
Usage: posix-modules
+Lists the gnulib modules that implement POSIX interfaces.
+
Report bugs to <bug-gnulib@gnu.org>."
}
date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
version=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
else
- if test -d "$gnulib_dir"/CVS \
- && (cvs --version) >/dev/null 2>/dev/null; then
- # gnulib checked out from CVS.
- sed_extract_first_date='/^date: /{
-s/^date: \([0-9][0-9][0-9][0-9]\).\([0-9][0-9]\).\([0-9][0-9]\) \([0-9][0-9]:[0-9][0-9]:[0-9][0-9]\).*/\1-\2-\3 \4/p
-q
-}'
- date=`cd "$gnulib_dir" && cvs log -N ChangeLog 2>/dev/null | sed -n -e "$sed_extract_first_date"`
- else
- # gnulib copy without versioning information.
- date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
- fi
+ # gnulib copy without versioning information.
+ date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
version=
fi
year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed 's,^.* ,,'`
echo "\
-gnulib-tool (GNU $package $date)$version
+posix-modules (GNU $package $date)$version
Copyright (C) $year Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
# func_gnulib_dir
# locates the directory where the gnulib repository lives
+# Input:
+# - progname name of this program
# Sets variables
-# - self_abspathname absolute pathname of gnulib-tool
+# - self_abspathname absolute pathname of this program
# - gnulib_dir absolute pathname of gnulib repository
func_gnulib_dir ()
{
- case "$0" in
- /*) self_abspathname="$0" ;;
- */*) self_abspathname=`pwd`/"$0" ;;
+ case "$progname" in
+ /*) self_abspathname="$progname" ;;
+ */*) self_abspathname=`pwd`/"$progname" ;;
*)
# Look in $PATH.
# Iterate through the elements of $PATH.
# 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"
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
fi
if test "$PATH_SEPARATOR" = ";"; then
# On Windows, programs are searched in "." before $PATH.
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"
+ if test -x "$d/$progname" && test ! -d "$d/$progname"; then
+ self_abspathname="$d/$progname"
break
fi
done
IFS="$save_IFS"
if test -z "$self_abspathname"; then
- func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
+ func_fatal_error "could not locate the posix-modules program - how did you invoke it?"
fi
;;
esac
# func_tmpdir
# creates a temporary directory.
+# Input:
+# - progname name of this program
# Sets variable
# - tmp pathname of freshly created temporary directory
func_tmpdir ()
(umask 077 && mkdir "$tmp")
} ||
{
- echo "$0: cannot create a temporary directory in $TMPDIR" >&2
+ echo "$progname: cannot create a temporary directory in $TMPDIR" >&2
func_exit 1
}
}
# func_fatal_error message
# outputs to stderr a fatal error message, and terminates the program.
+# Input:
+# - progname name of this program
func_fatal_error ()
{
- echo "gnulib-tool: *** $1" 1>&2
- echo "gnulib-tool: *** Stop." 1>&2
+ echo "$progname: *** $1" 1>&2
+ echo "$progname: *** Stop." 1>&2
func_exit 1
}
esac
done
+func_gnulib_dir
(
# Get the header modules.
- LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/posix-headers/* 2>/dev/null \
+ LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/posix-headers/*.texi 2>/dev/null \
| sed -e 's,^Gnulib module: ,,'
# Get the function modules.
- LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/posix-functions/* 2>/dev/null \
+ LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/posix-functions/*.texi 2>/dev/null \
| sed -e 's,^Gnulib module: ,,'
# Then filter out the words "---", ",", "and", "or" and remove *-gnu modules.
) | sed -e 's/,/ /g' | LC_ALL=C sort | LC_ALL=C uniq \
tr ' ' '\012' | sed -e '/^---$/d' -e '/^and$/d' -e '/^or$/d' -e '/-gnu$/d'
} \
| LC_ALL=C sort | LC_ALL=C uniq
+
+# Local Variables:
+# indent-tabs-mode: nil
+# whitespace-check-buffer-indent: nil
+# End: