2002-03-15 23:42:59 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: Insight Segmentation & Registration Toolkit
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Insight Consortium. All rights reserved.
|
|
|
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
|
|
|
|
#include "cmMakefile.h"
|
|
|
|
#include "cmSystemTools.h"
|
|
|
|
|
|
|
|
void CMakeCommandUsage(const char* program)
|
|
|
|
{
|
|
|
|
std::strstream errorStream;
|
|
|
|
|
|
|
|
errorStream << "cmake version " << cmMakefile::GetMajorVersion()
|
|
|
|
<< "." << cmMakefile::GetMinorVersion() << "\n";
|
|
|
|
errorStream << "Usage: " << program << " [command] [arguments ...]\n"
|
2002-03-25 23:59:47 +03:00
|
|
|
<< "Available commands: \n"
|
|
|
|
<< " copy file destination - copy file to destination (either file or directory)\n"
|
|
|
|
<< " remove file1 file2 ... - remove the file(s)\n";
|
2002-03-15 23:42:59 +03:00
|
|
|
errorStream << std::ends;
|
|
|
|
cmSystemTools::Error(errorStream.str());
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int ac, char** av)
|
|
|
|
{
|
|
|
|
std::vector<std::string> args;
|
|
|
|
for(int i =0; i < ac; ++i)
|
|
|
|
{
|
|
|
|
args.push_back(av[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( args.size() > 1 )
|
|
|
|
{
|
|
|
|
if ( args[1] == "copy" && args.size() == 4 )
|
|
|
|
{
|
|
|
|
cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str());
|
2002-03-19 20:25:15 +03:00
|
|
|
return cmSystemTools::GetErrorOccuredFlag();
|
2002-03-15 23:42:59 +03:00
|
|
|
}
|
|
|
|
if ( args[1] == "remove" && args.size() > 2 )
|
|
|
|
{
|
2002-03-18 19:59:23 +03:00
|
|
|
for ( std::string::size_type cc = 2; cc < args.size(); cc ++ )
|
2002-03-15 23:42:59 +03:00
|
|
|
{
|
2002-03-26 20:38:52 +03:00
|
|
|
if(args[cc] != "-f")
|
|
|
|
{
|
|
|
|
if(args[cc] == "\\-f")
|
|
|
|
{
|
|
|
|
args[cc] = "-f";
|
|
|
|
}
|
|
|
|
cmSystemTools::RemoveFile(args[cc].c_str());
|
|
|
|
}
|
2002-03-15 23:42:59 +03:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
::CMakeCommandUsage(args[0].c_str());
|
|
|
|
return 1;
|
|
|
|
}
|