Home Libraries Author Links

ctoperate Main Program


Detailed Description

Manual page and main function of the console program ctoperate.


Files

file  ctoperate.cpp
 Main program of the command line based ctoperate application.

Classes

struct  Mode
class  ArgList
struct  CtOperate
 An instance of POD type CtOperate is assigned to each directory to be handled. More...
struct  RootData
 An instance of RootData is assigned to the destination root directory. More...

Defines

#define PATHLEN   1024
#define PATHSEP   '/'

Typedefs

typedef stm::logger Logger

Functions

static bool isVobElement (const boost::filesystem::path &path)
 The local function isVobElement returns true, if path is a VOB element, else false.
static bool isCheckedOut (const boost::filesystem::path &path)
 The local function isCheckedOut returns true, if is checked out, else false.
static bool isLabel (const std::string &vobSelector, const std::string &label)
 The local function isLabel returns true, if label is defined as a label in the ClearCase VOB selected by vobSelector, else false.
static bool isWin32Executable (const boost::filesystem::path &path)
 The local function isWin32Executable returns true, if path designates a WIN32 executable file (case unsensitively the extension '.exe' or '.com').
static void execCommand (const std::string &command, const Mode &mode)
 The local function execCommand executes the console command.
static int elemhandler (const char *dirname, const char *entryname, const struct stat *direntry, int status, void *data, size_t len)
 The local function elemhandler serves as callback function of recurs.
int main (int argc, char *argv[])
 Main function implementing the command.

Variables

const char * CopyRight = "(C) 2005-2008 Tom Michaelis, SysToMath"
const char * Version = "1.17-r350"
static const char * man []
 Man page of the ClearCase Tool Suite command ctoperate.
static size_t ArgList::limit = 2048


Define Documentation

#define PATHLEN   1024

Definition at line 236 of file ctoperate.cpp.

#define PATHSEP   '/'

Definition at line 243 of file ctoperate.cpp.


Typedef Documentation

typedef stm::logger Logger

Definition at line 247 of file ctoperate.cpp.


Function Documentation

static bool isVobElement ( const boost::filesystem::path &  path  )  [static]

The local function isVobElement returns true, if path is a VOB element, else false.

Throws on error.

Definition at line 1405 of file ctoperate.cpp.

References PATHLEN.

static bool isCheckedOut ( const boost::filesystem::path &  path  )  [static]

The local function isCheckedOut returns true, if is checked out, else false.

Throws on error.

Definition at line 1449 of file ctoperate.cpp.

References PATHLEN.

static bool isLabel ( const std::string &  vobSelector,
const std::string &  label 
) [static]

The local function isLabel returns true, if label is defined as a label in the ClearCase VOB selected by vobSelector, else false.

Throws on error.

Definition at line 1493 of file ctoperate.cpp.

References PATHLEN.

Referenced by main().

static bool isWin32Executable ( const boost::filesystem::path &  path  )  [static]

The local function isWin32Executable returns true, if path designates a WIN32 executable file (case unsensitively the extension '.exe' or '.com').

Definition at line 1536 of file ctoperate.cpp.

static void execCommand ( const std::string &  command,
const Mode mode 
) [static]

The local function execCommand executes the console command.

If mode.action is Mode::Verbose, additional diagnostics are output to stdout. If mode.action is Mode::Simulate, actions are not performed but protocolled to stdout instead. On error a std::runtime_error exception is thrown.

Definition at line 1545 of file ctoperate.cpp.

References Mode::action, stm::basic_logger< std::string, stdIndent, lineLength, lockingPolicy >::Indent, Mode::logger, stm::basic_logger< std::string, stdIndent, lineLength, lockingPolicy >::NoPara, Mode::Simulate, and Mode::Verbose.

static int elemhandler ( const char *  dirname,
const char *  entryname,
const struct stat *  direntry,
int  status,
void *  data,
size_t  len 
) [static]

The local function elemhandler serves as callback function of recurs.

Definition at line 1090 of file ctoperate.cpp.

References Mode::Operation::CheckIn, CtOperate::destdir, isCheckedOut(), isVobElement(), isWin32Executable(), Mode::Operation::MkElem, CtOperate::mode, CtOperate::pCheckin, CtOperate::pMkelem, CtOperate::pMklabel, CtOperate::pRemove, CtOperate::pUncheckout, CtOperate::pWin32Execs, Mode::Operation::Remove, StmRecursDbeg, StmRecursDend, and StmRecursLeaf.

int main ( int  argc,
char *  argv[] 
)

Main function implementing the command.

Definition at line 453 of file ctoperate.cpp.

References Mode::action, stm::filespeclist::append(), stm::basic_logger< std::string, stdIndent, lineLength, lockingPolicy >::AutoInd, Mode::Operation::CheckIn, Mode::cicommentopt, CopyRight, elemhandler(), Mode::exclDirList, Mode::exclFileList, execCommand(), stm::basic_logger< std::string, stdIndent, lineLength, lockingPolicy >::Indent, stm::filefind< PathContainerT >::insert(), stm::pstring::isContainedIn(), isLabel(), isVobElement(), Mode::label, logger(), man, Mode::Operation::MkElem, Mode::Operation::None, stm::basic_logger< std::string, stdIndent, lineLength, lockingPolicy >::NoPara, stm::filespec::NoPathSeparators, Mode::Normal, Mode::operation, Mode::Operation::Remove, stm::logger< stdIndent, lineLength, errorConsole, lockingPolicy >::setConsole(), Mode::Simulate, stmDstrPrintf(), StmElements, stmGetopts(), StmGetoptsArgumentError, StmGetoptsEnd, stmGetoptsErrbuf, StmGetoptsOk, stmGetoptsOptarg, stmGetoptsOpterr, stmGetoptsOptind, StmGetoptsOptionArgError, StmGetoptsOptionError, stmGetoptsProg, stmGetoptsStrict, stmPrintManual(), stmPrintSynopsis(), StmRectrlTry, stmRecurs, StmRecursDoNotRecurse, StmTrue, Mode::Verbose, and Version.


Variable Documentation

const char* CopyRight = "(C) 2005-2008 Tom Michaelis, SysToMath"

Definition at line 71 of file ctoperate.cpp.

const char* Version = "1.17-r350"

Definition at line 72 of file ctoperate.cpp.

const char* man[] [static]

Initial value:

{
"NAME                                                                         ",
"       ctoperate - operate on a ClearCase VOB                                ",
"                                                                             ",
"SYNOPSIS                                                                     ",
"       ctoperate [-f] [(-v | -t)] (-c <comment> | -C <comment-file> | -n)    ",
"                 [-o (mk | ci | rm)] [(-x <file-spec> | -X <dir-spec>)...]   ",
"                 [(-l | -L) <label>] [(<file-spec> | <dir-spec>)...]         ",
"       ctoperate -h                                                          ",
"       ctoperate -V                                                          ",
"                                                                             ",
"DESCRIPTION                                                                  ",
"       The command operates on all files specified by the <file-spec>        "
"       arguments and all elements in the trees spanned by the directories    "
"       specified by the <dir-spec> arguments (or by the current working      "
"       directory, if no arguments are supplied).  The command operation      "
"       has to be specified by supplying option -o.  Operation -o mk is used  "
"       to create ClearCase VOB elements for all view private files and       "
"       directories leaving them checked out.  Operation -o ci additionally   "
"       causes all checked out file and directory elements to be checked in.  "
"       In contrast to these operations operation -o rm removes view private  "
"       files and directories and does an uncheckout for checked out file and "
"       directory elements. If option -f is given, the handling of directories"
"       is not recursive.                                                     ",
"       The arguments <file-spec> and <dir-spec> may contain pattern matching "
"       operators as explained below.  Be sure to quote them according to the "
"       needs of the shell used.                                              ",
"       For ctoperate to work, the parent directories of the files and of the "
"       directories handled shall be ClearCase VOB elements. Moreover, exactly"
"       one of the comment options -c, -C or n has to be given.               ",
"       Unless option -h or -V is supplied, the command returns with an exit  "
"       code 0 on success and with an exit code 1, if any error did occur.    ",
"                                                                             ",
"OPTIONS                                                                      ",
"       -h     help: print this man page on standard output and exit with exit"
"              code 2.                                                        ",
"                                                                             ",
"       -V     version: print version info on standard output and exit with   "
"              exit code 2.                                                   ",
"                                                                             ",
"       -f     flat: suppress recursive descent into the trees spanned by     "
"              directories.                                                   ",
"                                                                             ",
"       -v     verbose: issue additional diagnostic messages on stdout.       ",
"                                                                             ",
"       -t     tell: do no actions, issue messages on stdout instead.         ",
"                                                                             ",
"       -c <comment>                                                          ",
"              use the string <comment> as ClearCase check in comment.        ",
"                                                                             ",
"       -C <comment-file>                                                     ",
"              use the content of <comment-file> as ClearCase check in        "
"              comment.  The file shall not be inside the tree spanned by one "
"              of the directories <directory>.                                ",
"                                                                             ",
"       -n     use no ClearCase check in comment.                             ",
"                                                                             ",
"       -o <operation>                                                        ",
"              <operation> is one of the following actions:                   ",
"              mk: make ClearCase VOB elements for view private elements      ",
"                  leaving them checked out                                   ",
"              ci: additionally check in checked out VOB elements             ",
"              rm: in contrast remove view private elements and uncheckout    ",
"                  checked out VOB elements                                   ",
"                                                                             ",
"       -x <file-spec>                                                        ",
"              exclude files matched by <file-spec> which may contain pattern "
"              matching operators as explained below but no path separator.   "
"              Be sure to quote <file-spec> according to the needs of the     "
"              shell used.                                                    ",
"                                                                             ",
"       -X <dir-spec>                                                         ",
"              exclude directories and the whole trees spanned by them matched"
"              by <dir-spec> which may contain pattern matching operators as  "
"              explained below but no path separator.  Be sure to quote       "
"              <dir-spec> according to the needs of the shell used.           ",
"                                                                             ",
"       -l <label-list>                                                       ",
"              label all elements handled with the labels specified by the    "
"              non-empty whitespace or comma separated list <label-list>.  The"
"              labels are generated from each list element by brace expansion "
"              as in the bash shell.  Be sure to quote <label-list> according "
"              to the needs of the shell used.  If a label does not yet exist,"
"              it is created.  This option may be used only in conjunction    "
"              with '-m ci -u ci'.  It is an error, if some other ClearCase   "
"              version of an element to be labeled already bears the label.   ",
"                                                                             ",
"       -L <label-list>                                                       ",
"              label all elements handled with the labels specified by the    "
"              non-empty whitespace or comma separated list <label-list>.  The"
"              labels are generated from each list element by brace expansion "
"              as in the bash shell.  Be sure to quote <label-list> according "
"              to the needs of the shell used.  If a label does not yet exist,"
"              it is created.  This option may be used only in conjunction    "
"              with '-m ci -u ci'.  If some other Clearcase version of an     "
"              element to be labeled already bears the label, this existing   "
"              label is moved to the version just handled.                    ",
"                                                                             ",
"FILENAME EXPANSION                                                           ",
"       The evaluation of the spec arguments <file-spec> and <dir-spec> is    "
"       done using pattern matching based file name expansion.  If the spec   "
"       contains one of the unescaped extended regular expression operators   "
"       '(' or '|', it is interpreted as extended regular expression as       "
"       defined in the Open System Group Base Specification Issue 6, IEEE Std "
"       1003.1-2004 (XBD: 9.4).  Otherwise if the spec contains no unescaped  "
"       '{', it is interpreted as filename expansion pattern as defined in    "
"       IEEE Std 1003.1-2004 (XCU: 2.13.3).  Else the spec is brace expanded  "
"       as in the bash shell and each of the resulting words is interpreted as"
"       filename expansion pattern.                                           ",
"       On windows systems as escape character for brace expansion '%' is used"
"       instead of the usual '\\'.  The bracket expressions used in the       "
"       regular expressions and in the filename expansion patterns conform to "
"       IEEE Std 1003.1-2004 (XBD: 9.3.5) with the exception that equivalence "
"       classes [=x=] of collating elements are not supported.                "
}
Man page of the ClearCase Tool Suite command ctoperate.

Definition at line 84 of file ctoperate.cpp.

size_t ArgList::limit = 2048 [static, private, inherited]

Definition at line 352 of file ctoperate.cpp.

Referenced by ArgList::operator+=().


© Copyright Tom Michaelis 2002-2007

Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).