Home Libraries Author Links

ctmktree Main Program


Detailed Description

Manual page and main function of the console program ctmktree.


Files

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

Classes

struct  CtData
 An instance of POD type CtData is assigned to each directory to be handled. More...

Defines

#define PATHLEN   1024
#define PATHSEP   '/'

Functions

static bool isVobElement (const std::string &path, bool isDirectory=false)
 The local function isVobElement returns true, if the file (default) or directory designated by path is a VOB element, else false.
static bool isCheckedOut (const std::string &path, bool isDirectory=false)
 The local function isCheckedOut returns true, if the file (default) or directory designated by path is checked out, else false.
static bool isWin32Executable (const std::string &path)
 The local function isWin32Executable returns true, if path designates a WIN32 executable file (case unsensitively the extension '.exe' or '.com').
static int execCommand (const std::string &command, bool verbose=false)
 The local function execCommand returns 0, if the console command was executed successfully.
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.
static void error (const char *msg,...)
 Print error message and terminate the program.
int main (int argc, char *argv[])
 Main function implementing the command.

Variables

const char * CopyRight = "(C) 2004-2008 Tom Michaelis, SysToMath"
const char * Version = "1.17-r350"
static const char * man []
 Man page of the ClearCase Tool Suite command ctmktree.


Define Documentation

#define PATHLEN   1024

Definition at line 197 of file ctmktree.cpp.

Referenced by isCheckedOut(), isLabel(), and isVobElement().

#define PATHSEP   '/'

Definition at line 204 of file ctmktree.cpp.

Referenced by elemhandler(), and main().


Function Documentation

static bool isVobElement ( const std::string &  path,
bool  isDirectory = false 
) [static]

The local function isVobElement returns true, if the file (default) or directory designated by path is a VOB element, else false.

Throws on error.

Definition at line 775 of file ctmktree.cpp.

References PATHLEN, and stmGetoptsProg.

Referenced by elemhandler(), CtOperate::init(), CtData::init(), and main().

static bool isCheckedOut ( const std::string &  path,
bool  isDirectory = false 
) [static]

The local function isCheckedOut returns true, if the file (default) or directory designated by path is checked out, else false.

Throws on error.

Definition at line 816 of file ctmktree.cpp.

References PATHLEN, and stmGetoptsProg.

Referenced by elemhandler(), CtOperate::init(), and CtData::init().

static bool isWin32Executable ( const std::string &  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 857 of file ctmktree.cpp.

Referenced by elemhandler(), and DirData::handler().

static int execCommand ( const std::string &  command,
bool  verbose = false 
) [static]

The local function execCommand returns 0, if the console command was executed successfully.

If verbose is true (default is false), additional diagnostics are output to stdout.

Definition at line 868 of file ctmktree.cpp.

Referenced by CtOperate::deinit(), elemhandler(), ArgList::exec(), CtOperate::init(), and main().

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 606 of file ctmktree.cpp.

References CtData::checkedOut, CtData::cicommentopt, CtData::deinit(), error(), execCommand(), CtData::init(), isVobElement(), isWin32Executable(), CtData::originallyCheckedOut, CtData::parentCheckedOut, CtData::parentpath, CtData::parentVobElement, PATHSEP, CtData::pElements, CtData::pWin32Execs, stmGetoptsProg, StmRecursDbeg, StmRecursDend, StmRecursLeaf, CtData::verbose, and CtData::vobElement.

Referenced by main().

static void error ( const char *  msg,
  ... 
) [static]

Print error message and terminate the program.

The local function error prints the printf like formatted message msg on stderr followed by a newline character and terminates the program with exit code 1.

Definition at line 893 of file ctmktree.cpp.

Referenced by elemhandler(), and main().

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

Main function implementing the command.

Definition at line 352 of file ctmktree.cpp.

References CopyRight, elemhandler(), error(), execCommand(), stm::pstring::isContainedIn(), man, PATHSEP, StmElements, stmGetopts(), StmGetoptsEnd, StmGetoptsOk, stmGetoptsOptarg, stmGetoptsOpterr, stmGetoptsOptfp, stmGetoptsOptind, StmGetoptsOptionArgError, stmGetoptsProg, stmGetoptsStrict, stmPrintManual(), stmPrintSynopsis(), stmRecurs, StmRecursDoNotRecurse, StmTrue, and Version.


Variable Documentation

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

Definition at line 71 of file ctmktree.cpp.

Referenced by main().

const char* Version = "1.17-r350"

Definition at line 72 of file ctmktree.cpp.

Referenced by main(), and CtUpdate::openProtocol().

const char* man[] [static]

Initial value:

{
"NAME                                                                         ",
"       ctmktree - make or augment a ClearCase tree                           ",
"                                                                             ",
"SYNOPSIS                                                                     ",
"       ctmktree [-vf] {-c <comment> | -C <comment-file> | -n} [<directory>]  ",
"       ctmktree -h                                                           ",
"       ctmktree -V                                                           ",
"                                                                             ",
"DESCRIPTION                                                                  ",
"       Recursively creates ClearCase VOB elements for all view private files "
"       and directories in the tree spanned by <directory> (or by the current "
"       working directory, if <directory> is not supplied).  For this to work,"
"       exactly one of the comment options -c, -C or -n has to be given.  If  "
"       option -f is given, the handling is not recursive.                    ",
"       For directories existing in the VOB, it is irrelevant, if they are    "
"       already checked out.  If a directory in which elements have to be     "
"       created is not yet checked out, it is checked out, worked on it and   "
"       then checked in again.  Directories already checkd out are left       "
"       checked out.  Directories not existing in the VOB are created using   "
"       the ClearCase command mkdir.  These directories are checked in with   "
"       version /main/1 after all its subelements have been created.  It is an"
"       error, if <directory> has to be created and its parent directory is   "
"       no ClearCase VOB element.                                             ",
"       For each file in the specified tree, ctmktree checks to see whether an"
"       element of that name exists in the VOB.  If not, ctmktree invokes the "
"       ClearCase command mkelem on the file and checks it in with version    "
"       /main/1.  Then, for each file checked in which has case insensitively "
"       the extension '.exe' or '.com', its executable attributes are set for "
"       everyone.                                                             ",
"       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.                                                   ",
"                                                                             ",
"       -v     verbose: issue additional diagnostic messages on stdout.       ",
"                                                                             ",
"       -f     flat: suppress recursive descent into the tree spanned by      "
"              <directory>.                                                   ",
"                                                                             ",
"       -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     "
"              <directory>.                                                   ",
"                                                                             ",
"       -n     use no ClearCase check in comment.                             "
}
Man page of the ClearCase Tool Suite command ctmktree.

Definition at line 113 of file ctmktree.cpp.


© Copyright Tom Michaelis 2002-2007

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