Hi,

On Sat, Jun 26, 2004 at 12:06:19AM -0700, Paul Eggert wrote:
> The --target-directory option is documented for 'install', but it's
> not implemented.  Here's a patch to implement it.  It steals most of
> the code from the changes I've already proposed for cp/ln/mv.
[...]
> @@ -281,15 +329,25 @@ main (int argc, char **argv)
>    n_files = argc - optind;
>    file = argv + optind;
>  
> -  if (argc <= optind || (n_files == 1 && !dir_arg))
> +  if (n_files <= !target_directory)
>      {
> -      if (argc <= optind)
> -     error (0, 0, _("missing operand"));
> +      if (n_files <= 0)
> +     error (0, 0, _("missing file operand"));
>        else
> -     error (0, 0, _("missing operand after %s"), quote (argv[argc - 1]));
> +     error (0, 0, _("missing destination file operand after %s"),
> +            quote (file[0]));
>        usage (EXIT_FAILURE);
>      }
>  

This change also introduces regression:
$ install -d newdir
install: missing destination file operand after `newdir'

Proposed fix is attached.

Looks like our regression test suit for install program is incomplete.


-- 
ldv
2004-08-11  Dmitry V. Levin  <[EMAIL PROTECTED]>

        * src/install.c (main): Fix -d regression introduced with
        --target-directory support at 2004-06-25.

--- coreutils-200408100654/src/install.c.orig   2004-08-03 00:14:39 +0400
+++ coreutils-200408100654/src/install.c        2004-08-11 00:56:16 +0400
@@ -325,7 +325,7 @@ main (int argc, char **argv)
   n_files = argc - optind;
   file = argv + optind;
 
-  if (n_files <= !target_directory)
+  if (n_files <= !(dir_arg || target_directory))
     {
       if (n_files <= 0)
        error (0, 0, _("missing file operand"));

Attachment: pgp3d2Cbwl5b5.pgp
Description: PGP signature

_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to