| #!/bin/sh |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| progname=$0 |
| package=gnulib |
|
|
| |
| |
| |
| |
| func_exit () |
| { |
| (exit $1); exit $1 |
| } |
|
|
| |
| |
| |
| |
| func_fatal_error () |
| { |
| echo "$progname: *** $1" 1>&2 |
| echo "$progname: *** Stop." 1>&2 |
| func_exit 1 |
| } |
|
|
| |
| |
| if (type readlink) > /dev/null 2>&1; then |
| func_readlink () |
| { |
| |
| readlink "$1" |
| } |
| else |
| func_readlink () |
| { |
| |
| |
| LC_ALL=C ls -l "$1" | sed -e 's, -> ,#%%#,' | sed -n -e 's,^.*#%%#\(.*\)$,\1,p' |
| } |
| fi |
|
|
| |
| |
| |
| |
| |
| |
| |
| func_gnulib_dir () |
| { |
| case "$progname" in |
| /* | ?:*) self_abspathname="$progname" ;; |
| */*) self_abspathname=`pwd`/"$progname" ;; |
| *) |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| self_abspathname= |
| if test "${PATH_SEPARATOR+set}" != set; then |
| |
| |
| |
| 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+set}" != set; then |
| |
| |
| |
| 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 |
| |
| pathx=".;$PATH" |
| else |
| |
| pathx="$PATH" |
| case :$PATH: in |
| *::*) |
| pathx=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'` |
| ;; |
| esac |
| fi |
| saved_IFS="$IFS" |
| IFS="$PATH_SEPARATOR" |
| for d in $pathx; do |
| IFS="$saved_IFS" |
| test -z "$d" && d=. |
| if test -x "$d/$progname" && test ! -d "$d/$progname"; then |
| self_abspathname="$d/$progname" |
| break |
| fi |
| done |
| IFS="$saved_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 |
| |
| 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,/[^/]*$,,'` |
| } |
|
|
| |
| |
| |
| |
| |
| |
| func_tmpdir () |
| { |
| |
| |
| |
| : "${TMPDIR=/tmp}" |
| { |
| |
| |
| tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` && |
| test -n "$tmp" && test -d "$tmp" |
| } || |
| { |
| |
| |
| |
| |
| |
| tmp=$TMPDIR/gl$$-$RANDOM |
| (umask 077 && mkdir "$tmp") |
| } || |
| { |
| echo "$progname: cannot create a temporary directory in $TMPDIR" >&2 |
| func_exit 1 |
| } |
| } |
|
|
| |
| |
| func_usage () |
| { |
| echo "\ |
| Usage: posix-modules [option] |
| |
| Lists the gnulib modules that implement POSIX interfaces. |
| |
| Options: |
| |
| --for-mingw list only modules that work on mingw |
| --for-msvc list only modules that work on MSVC |
| |
| Report bugs to <bug-gnulib@gnu.org>." |
| } |
|
|
| |
| |
| func_version () |
| { |
| func_gnulib_dir |
| if test -d "$gnulib_dir"/.git \ |
| && (git --version) >/dev/null 2>/dev/null \ |
| && (date --version) >/dev/null 2>/dev/null; then |
| |
| sed_extract_first_date='/^Date/{ |
| s/^Date:[ ]*//p |
| q |
| }' |
| date=`cd "$gnulib_dir" && git log -n 1 --format=medium --date=iso ChangeLog | sed -n -e "$sed_extract_first_date"` |
| |
| sed_year_before_time='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /' |
| date=`echo "$date" | sed -e "$sed_year_before_time"` |
| |
| 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 |
| |
| date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog` |
| version= |
| fi |
| year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed 's,^.* ,,'` |
| echo "\ |
| posix-modules (GNU $package $date)$version |
| Copyright (C) $year Free Software Foundation, Inc. |
| License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> |
| This is free software: you are free to change and redistribute it. |
| There is NO WARRANTY, to the extent permitted by law. |
| |
| Written by" "Bruno Haible" |
| } |
|
|
| |
| exclude_for_mingw= |
| |
| exclude_for_mingw="$exclude_for_mingw pt_chown grantpt posix_openpt-tests posix_openpt" |
| |
| exclude_for_mingw="$exclude_for_mingw faccessat" |
| exclude_for_mingw="$exclude_for_mingw fchownat-tests fchownat" |
|
|
| |
| exclude_for_msvc="$exclude_for_mingw" |
|
|
| |
| exclude= |
| while test $# -gt 0; do |
| case "$1" in |
| --for-mingw | --for-ming | --for-min | --for-mi ) |
| exclude="$exclude $exclude_for_mingw" |
| shift ;; |
| --for-msvc | --for-msv | --for-ms ) |
| exclude="$exclude $exclude_for_msvc" |
| shift ;; |
| --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 |
|
|
| func_gnulib_dir |
| func_tmpdir |
| trap 'exit_status=$? |
| if test "$signal" != EXIT; then |
| echo "caught signal SIG$signal" >&2 |
| fi |
| rm -rf "$tmp" |
| exit $exit_status' EXIT |
| for signal in HUP INT QUIT PIPE TERM; do |
| trap '{ signal='$signal'; func_exit 1; }' $signal |
| done |
| signal=EXIT |
|
|
| ( |
| |
| LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/posix-headers/*.texi 2>/dev/null \ |
| | sed -e 's,^Gnulib module: ,,' |
| |
| LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/posix-functions/*.texi 2>/dev/null \ |
| | sed -e 's,^Gnulib module: ,,' |
| |
| ) | 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 \ |
| | { |
| if test -n "$exclude"; then |
| for m in $exclude; do echo $m; done | LC_ALL=C sort -u > "$tmp"/excludes |
| LC_ALL=C join -v 1 - "$tmp"/excludes |
| rm -f "$tmp"/excludes |
| else |
| cat |
| fi |
| } |
|
|
| |
| |
| |
| |
|
|