X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=posix-modules;h=16b2a00e31cad276abc0d0831e8bd5f8182bf40c;hb=46f5f314f34a08c9305758482d7d2fdb0e999d09;hp=2fa010bd6f4c980247afc6f54a715a4bc11946c7;hpb=4cd8485e904c1a98470eb548fe6ac0f04e343c4e;p=gnulib.git diff --git a/posix-modules b/posix-modules index 2fa010bd6..16b2a00e3 100755 --- a/posix-modules +++ b/posix-modules @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2002-2008 Free Software Foundation, Inc. +# Copyright (C) 2002-2008, 2010-2014 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 @@ -26,6 +26,8 @@ func_usage () echo "\ Usage: posix-modules +Lists the gnulib modules that implement POSIX interfaces. + Report bugs to ." } @@ -50,23 +52,13 @@ q 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 This is free software: you are free to change and redistribute it. @@ -86,14 +78,16 @@ func_exit () # 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. @@ -113,15 +107,14 @@ func_gnulib_dir () # 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. @@ -140,14 +133,14 @@ func_gnulib_dir () 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 @@ -165,6 +158,8 @@ func_gnulib_dir () # func_tmpdir # creates a temporary directory. +# Input: +# - progname name of this program # Sets variable # - tmp pathname of freshly created temporary directory func_tmpdir () @@ -189,17 +184,19 @@ 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 } @@ -240,12 +237,13 @@ while test $# -gt 0; do 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 \ @@ -253,3 +251,8 @@ done 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: