This section describes a simple technique for incorporating a version string and/or time stamp into a C-language compiled executable. Including a version string or time stamp allows anyone (for example, a customer) to determine the exact version of a program by entering a shell command.
The technique involves adding a "what version?" command-line option to the executable itself:
Z:\> monet -Ver
monet R2.0 Baselevel 1 (Thu Feb 11 17:33:23 EST 1996)
After the particular version of the program is determined, you can use ClearCase commands to find a local copy, examine its config record, and if appropriate, reconstruct the source configuration with which it was built. (Presumably, the local copy is a derived object that has been checked in as a version of an element.)
You can identify the appropriate derived object by attaching a ClearCase attribute with the version string to the checked-in executable.
You can write a program to display the information stored in the version_string and version_time variables. An example of such a program is shown below:
#include <stdio.h>
main(argc,argv)
int argc;
char **argv;
{
/*
* implement -Ver option
*/
if (argc > 1 && strcmp(argv[1],"-Ver") == 0) {
char *version_string = "monet R2.0 Baselevel 1";
char *version_time= "Thu Feb 11 17:33:23 EST 1996";
/*
* Print version info
*/
printf ("%s (%s)\n",
version_string, version_time);
exit(0);
}
}
|
Feedback on the documentation in this site? We welcome any comments!
Copyright © 2001 by Rational Software Corporation. All rights reserved. |