diff --git a/src/bin/copyattr.cpp b/src/bin/copyattr.cpp index 0267ea309c..690696c2aa 100644 --- a/src/bin/copyattr.cpp +++ b/src/bin/copyattr.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net. + * Copyright 2005-2008, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -19,6 +19,12 @@ #include #include +#include + + +using BPrivate::EntryFilter; + + static const char *kCommandName = "copyattr"; static const int kCopyBufferSize = 64 * 1024; // 64 KB @@ -68,6 +74,8 @@ const char *kUsage = " -t, --type - Copy only the attributes of type . If -n is\n" " specified too, only the attribute matching the name\n" " and the type is copied.\n" +" -x - Exclude source entries matching .\n" +" -X - Exclude source paths matching .\n" " -v, --verbose - Print more messages.\n" " -, -- - Marks the end of options. The arguments after, even\n" " if starting with \"-\" are considered file names.\n" @@ -121,6 +129,7 @@ private: type_code fType; }; + // Parameters struct Parameters { Parameters() @@ -136,6 +145,7 @@ struct Parameters { bool move_files; bool verbose; AttributeFilter attribute_filter; + EntryFilter entry_filter; }; @@ -275,6 +285,10 @@ static void copy_entry(const char *sourcePath, const char *destPath, const Parameters ¶meters) { + // apply entry filter + if (!parameters.entry_filter.Filter(sourcePath)) + return; + // stat source struct stat sourceStat; if (lstat(sourcePath, &sourceStat) < 0) { @@ -626,6 +640,12 @@ main(int argc, const char *const *argv) || strcmp(arg, "--verbose") == 0) { parameters.verbose = true; + } else if (strcmp(arg, "-x") == 0 || strcmp(arg, "--type") == 0) { + parameters.entry_filter.AddExcludeFilter(next_arg(argi), true); + + } else if (strcmp(arg, "-X") == 0 || strcmp(arg, "--type") == 0) { + parameters.entry_filter.AddExcludeFilter(next_arg(argi), false); + } else if (strcmp(arg, "-") == 0 || strcmp(arg, "--") == 0) { moreOptions = false; diff --git a/src/tools/Jamfile b/src/tools/Jamfile index 8f1151be94..7101582271 100644 --- a/src/tools/Jamfile +++ b/src/tools/Jamfile @@ -32,6 +32,7 @@ if $(HOST_PLATFORM) in r5 bone dano { BuildPlatformMain catattr : catattr.cpp : $(HOST_LIBBE) ; +UsePrivateObjectHeaders copyattr.cpp : shared : : true ; BuildPlatformMain copyattr : copyattr.cpp : $(HOST_LIBBE) $(HOST_LIBSTDC++) $(HOST_LIBSUPC++) ;