From 3dd26cf0809384a80586113656fad0a4983a2a26 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 26 Dec 2013 00:33:05 +0100 Subject: install-sh: a slightly better diagnostic, and tests enhancements * lib/install-sh: When called with no non-option arguments and the '-t' option with an argument that is not an existing directory, have the diagnostic output complain about the lack of required arguments rather than about the bad argument passed to '-t'. * t/install-sh-unittests.sh: Enhance to also check diagnostic printed in cases of expected failure. Signed-off-by: Stefano Lattarini --- lib/install-sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/install-sh b/lib/install-sh index d8de87f30..0b0fdcbba 100755 --- a/lib/install-sh +++ b/lib/install-sh @@ -193,15 +193,6 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then done fi -if test -z "$dir_arg"; then - if test $# -gt 1 || test "$is_target_a_directory" = always; then - if test ! -d "$dst_arg"; then - echo "$0: $dst_arg: Is not a directory." >&2 - exit 1 - fi - fi -fi - if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 @@ -212,6 +203,15 @@ if test $# -eq 0; then exit 0 fi +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 -- cgit v1.2.1