diff options
author | Jim Meyering <meyering@redhat.com> | 2008-02-10 13:52:47 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-02-10 13:52:47 +0100 |
commit | d80aaca2dac2f63d6e095e887eabb4ecbc7dfaba (patch) | |
tree | 985dc3748cd2af768929a0b9a57ea0a1f1ffb713 | |
parent | 48b9ff855506b544b7670bb28989622ea283b79b (diff) | |
download | coreutils-d80aaca2dac2f63d6e095e887eabb4ecbc7dfaba.tar.xz |
Use a better dirname emulation.
* build-aux/check.mk (_dirname): Define.
(am__check_pre): Use it.
-rw-r--r-- | build-aux/check.mk | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/build-aux/check.mk b/build-aux/check.mk index f35007bb0..be255c4ca 100644 --- a/build-aux/check.mk +++ b/build-aux/check.mk @@ -90,9 +90,12 @@ tput sgr0 >/dev/null 2>&1 && \ SH_E_WORKAROUND = case $$- in *e*) set +e;; esac # Emulate dirname with sed. -# This approximation fails when the input is a single-component -# absolute directory name like /foo, but that never happens here. -approx_dirname_filter = sed 's,^[^/]*$$,.,;s,//*[^/]*$$,,' +_d_no_slash = s,^[^/]*$$,., +_d_strip_trailing = s,\([^/]\)//*$$,\1, +_d_abs_trivial = s,^//*[^/]*$$,/, +_d_rm_basename = s,\([^/]\)//*[^/]*$$,\1, +_dirname = \ + sed '$(_d_no_slash);$(_d_strip_trailing);$(_d_abs_trivial);$(_d_rm_basename)' # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory @@ -101,7 +104,7 @@ am__check_pre = \ $(SH_E_WORKAROUND); \ tst=`echo "$$src" | sed 's|^.*/||'`; \ rm -f $@-t; \ -$(mkdir_p) "$$(echo '$@'|$(approx_dirname_filter))" || exit; \ +$(mkdir_p) "$$(echo '$@'|$(_dirname))" || exit; \ if test -f "./$$src"; then dir=./; \ elif test -f "$$src"; then dir=; \ else dir="$(srcdir)/"; fi; \ |