To show the differences between two file revisions:
$ cvs diff -kk -u -r 1.14 -r 1.15 file.c
To show the differences between two tagged versions/releases of the project (in each of the files):
$ cvs diff -r RELEASE_1_0 -r RELEASE_1_1
A context diff between two releases redirected to the file:
$ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
Thursday, October 20, 2011
cvs - show differences between revisions/releases
Wednesday, October 19, 2011
Ubuntu - startup programs
- Go to System > Preferences > Sessions.
- ‘Startup Programs’ tab.
- Click on Add
- Give the name and command, and hit OK
Tuesday, October 18, 2011
tee command in linux
Redirecting the output (standard output = stdout) of the program both to the file and to the screen:
program | tee outputfile.txt
Forcing both the standard error and the standard output to be written in the file:
program 2>&1 | tee outputfile.txt
Appending into the file instead of rewriting it:
program | tee -a outputfile.txt
Monday, October 17, 2011
C - parsing command line options with getopt
Very useful way to parse the command line options in C/C++:
void usage(){
std::cout << "Usage: Program.exe [options] inputFile" << std::endl;
std::cout << "Options are:" << std::endl;
std::cout << "-n x : read only n entries" << std::endl;
std::cout << "-o FILE: set output file" << std::endl;
}
int main(int argc, char* argv[]){
std::string outputFileName;
int nEvents = -1;
//Parse options from the command line
for(;;){
//Get option
int c = getopt(argc, argv, "n:o:");
//If end of options break...
if (c<0) break;
switch(c){
case 'n':{
nEvents = atoi(optarg);
std::cout << "Number of entries to read : " << nEvents << std::endl;
break;
}
case 'o':{
//std::cout << "Optarg:" << optarg << std::endl;
outputFileName = std::string(optarg);
std::cout << "Output filename is : " << outputFileName << std::endl;
break;
}
case '?':{
usage();
exit(0);
}//end of case
}//end of switch
}//end of for loop
if((argc - optind) < 1){
usage();
exit(1);
}
}