On 06/10/2014 11:10 PM, Bernhard Voelker wrote: > The attached patch implements this. > > BTW: the Texinfo manual was falsely stating that [g]install > would ignore the -D option when -t was given (instead, it > complained with ENOENT for the target_directory): > > `-D' > Create any missing parent directories of DEST, then copy SOURCE to > DEST. This option is ignored if a destination directory is > specified via `--target-directory=DIR'.
I've not looked in detail, but on the face of it -D should be able to create the single dir (hierarchy), either specified implicitly with DEST, or explicitly with -t. >>From c24ea15a50fdef0e141cdacd99e49e8fe8fec374 Mon Sep 17 00:00:00 2001 > From: Bernhard Voelker <[email protected]> > Date: Wed, 11 Jun 2014 00:04:27 +0200 > Subject: [PATCH] install: allow options -D and -t to be used together > > * src/install.c (install_file_in_file_parents): Factor out the > creation of any parent directories into ... > (mkancesdirs_safe_wd): ... this new function. > (install_file_in_dir): Add the parameter 'mkdir_and_install', and > call the above new function if it evaluates to true. > (main): During parsing of the -t option, move the check whether > the target_directory exists down after the option pparsing loop, s/pp/p/ > +static bool > +install_file_in_file_parents (char const *from, char *to, > + const struct cp_options *x) > +{ > + return ( mkancesdirs_safe_wd (from, to, (struct cp_options *)x) > + && install_file_in_file (from, to, x)); kinda hard to read that indenting Otherwise looks good. thanks! Pádraig.
