Linux Bible

Home



The diff output is easier to understand than you might expect. Lines that begin with < appear in the first file (revision 1.2 of main.c) but not in the second (revision 1.3 of main.c). Similarly, lines beginning with > appear in the second file, but not in the first. Each section of diff output begins with an alphanumeric sequence such as 9,10c9,10 or 12c12.


The numeric values of the diff output indicate the lines in the first and second files to which an operation must be applied to get the second file from the first. The operation to perform (such as inserting, deleting, or changing lines) is specified by the alphabetic character. So, for example, the sequence 9,10c9,10 means that if you want to create the second file from the first, you have to change (c) lines 9 and 10 of the first file to lines 9 and 10 of the second file.


Finally, if you totally botch all of your changes to your working files and want to revert to the most recent versions, use the update command. It updates the specified directory with the most recent versions stored in the repository, as shown in the following example:
$ cd ~/projects/newhello
$ cvs update.
cvs update: Updating.
U showit.c
U msg.c
U hello.c


There's much more to CVS than the few examples presented here. For additional information, visit the CVS home page on the Web at www·nongnu·org/cvs.
While CVS improves a lot on the limitations of RCS, CVS has its own limitations. SVN, or Subversion, is a newer source code control system that aims to solve many of the limitations of CVS. See subversion.tigris·org for more on SVN


Debugging with GNU Debugger


Software is buggy, and some programs have more bugs than other programs. While debugging ses- sions will never be aggravation-free, the advanced features of GNU Debugger (GDB) lighten the load and enable you to be more productive in squashing bugs. A debugger runs a program in a special mode that allows you to view the inner workings of the programs, especially the value of variables at a given point in the code. The theory is that by exposing the inner workings of the pro- gram, you can more easily determine what is not correct in the program's source code - that is, where the bug is located.


 
© 2009