Summary of Options Using indent Utility
7.3.1 Other Forms of diff Utility
There are two other important forms of the diff utility. These are diff3 and sdiff. The diff3 utility is used to compare three files and its general format is shown below. diff3 [options] mine older yours Suppose you and your colleague start working on a file simultaneously. The original file is the older file. Now you have your copy of the file the mine file and your colleague has his own copy of the file the yours file. If you want to compare both of these modified copies of the file with the original older file, diff3 is a useful tool. See man pages of the diff3 command for more details. Another important utility is sdiff that finds difference between two files and merges these two files into a third file. The general format of sdiff is as follows. sdiff –o outfile [options] file1 file2 The sdiff is useful when you want to interactively merge two files. This is the case when two people have made changes to a source file and at some point you want to merge these changes into a single file. The sdiff utility is interactive and it displays two files being com- pared in side-by-side fashion. It stops on each difference with a sign prompt. On this sign you can press different characters to make a decision. Common responses on the prompt are shown in Table 7-2. -c Context output -n RCS style of output -r Compare directories recursively -y Use side-by-side format Table 7-2 Commands used on prompt of sdiff Command Description L Use the left side of the version R Use the right side of the version e l Edit and then use the left side e r Edit and use the right side Q Quit Table 7-1 Common options used with the diff command Continued Option Description Using cscope and cbrowser 2197.4 Using cscope and cbrowser
The cscope is a very useful utility to browse through the source code tree of a large project. It was originally written by Santa Cruz Operations and made public later on. You can download it from http:cscope.sourceforge.net. For Linux, it is available in RPM format as well. It is a text-mode screen-oriented utility. When you start it using the cscope command, the initial screen looks like the one shown in Figure 7-1. When invoked, cscope first creates its symbol file cscope.out in the current direc- tory that contains a reference to symbols in source code files. This reference is generated from files with the extensions .c and .h. You can also use command line options to create this sym- bol file from a particular type of source code files. The bottom part of the screen shows options that can be used to look up a symbol in the source code. The cursor is blinking at the first option and can be moved to other options using arrow keys. For example, if you want to look up symbol “ msg” in all source code files, just type it in at the first line and press the Enter key. You will see a listing of files containing this symbol as shown in Figure 7-2. Figure 7-1 The cscope initial screen. 220 Chapter 7 • Miscellaneous Tools As you can see, there are five files listed in the top part of the screen that contain this sym- bol. This listing contains five columns as below:1. Number of row, starting with zero. 2. File name that contains the symbol.
3. Function name where symbol is used. If the symbol is not inside a function, it is
marked as global. 4. Line number where symbol is present in that file. 5. The line showing the definition or use of the symbol. You can move the cursor to a particular line and press the Enter key to edit that file. By default the file is opened in vi editor. However, you can configure to use an editor of your choice. To move back to the bottom part of the screen to search for another symbol, you can use the Tab key. Use the Ctrl+D key combination to quit the program. The utility is also very useful if you want to find non-utilized code in a software project. For example, if a function is present in the source code but never used anywhere in the project, it can be detected using cscope. It is also useful when you want to modify a particular symbol throughout the source code tree. Common options used with cscope are listed in Table 7-3. Figure 7-2 List of files with symbol msg.Parts
» the linux development platform 2003
» Requirement Gathering Life Cycle of a Software Development Project
» Writing Functional Specifications Life Cycle of a Software Development Project
» Creating Architecture and Design Documents
» Implementation and Coding Life Cycle of a Software Development Project
» Testing Life Cycle of a Software Development Project
» Technical documentation developed during the development process. This includes
» Technical documentation prepared for technical support staff. This includes technical
» End-user manuals and guides. This is the documentation for the end user to assist the
» Software Releases Support and New Features
» Hardware Platform Components of a Development System
» Operating System Components of a Development System
» Editors Components of a Development System
» Compilers and Assemblers Components of a Development System
» Debuggers Components of a Development System
» Version Control Systems Components of a Development System
» Selection Criteria for Hardware Platform Selection Criteria for Software Development Tools
» Creating Deadlines Managing Development Process
» Managing the Development Team
» Resolving Dependencies Managing Development Process
» Libraries Linux Development Platform Specifications LDPS and Linux
» Open Source Developers Network at http:www.osdn.org
» Extensibility What to Look for in an Editor
» References and Resources the linux development platform 2003
» Target machine. This is the machine for which the newly built compiler will generate
» Post-Installation Tasks Installing GNU Compiler
» Compiling to Intermediate Levels
» Compilation with Debug Support
» Compilation with Optimization Compiling a Program
» Compiling Source Code for Other Languages
» Linking a program Assembling a Program
» Creating Libraries the linux development platform 2003
» Standard Libraries the linux development platform 2003
» Compiling Fortran Programs the linux development platform 2003
» Smalltalk Oberon Other Compilers
» The target 2. Dependencies Basic Terminology
» The explicit rules 2. The implicit rules
» Input Files Introduction to GNU make
» Typical Contents of a Makefile
» Running make Introduction to GNU make
» Shell to Execute Commands Include Files
» The ftp server The The dnsresolver
» FTPOBJS OBJS Another Example of Makefile
» Explicit Rules The make Rules
» Implicit Rules The make Rules
» Defining Variables Types of Variables
» Pre-Defined Variables Automatic Variables
» Makefile in The Top Directory
» Makefile in common-dir Directory
» Makefile in the ftp-dir Directory
» Makefile in the tftp-dir Directory Makefile in the dns-dir Directory
» Building Everything Working with Multiple Makefiles and Directories
» The ifdef Directive Control Structures and Directives
» The ifndef Directive Control Structures and Directives
» Compilation Getting the Latest Version and Installation
» Most Commonly Used gdb Commands
» Passing Command Line Arguments to the Program Being Debugged
» The step and finish Commands
» Introduction to GDB Working with the Stack
» Displaying Program Variables Displaying Variables
» Automatic Displaying Variables with Each Command
» Displaying Environment Variables Displaying Variables
» Modifying Variables Displaying Variables
» Disabling Break Points Enabling Break Points
» Debugging Optimized Code the linux development platform 2003
» Debugging Running Processes the linux development platform 2003
» The kdbg Debugger Other Open Source Debuggers
» The ddd Debugger Other Open Source Debuggers
» The xxgdb Debugger Other Open Source Debuggers
» CVS Policies the linux development platform 2003
» Project Management and Communication
» Remote Repositories Checking out a Project
» Finding the Status of a Project
» Finding Differences Using the CVS Client
» Resolving Conflicts Using the CVS Client
» Checking the Project Back In Adding Files to a Project
» Removing Files from a Project
» Tags and Releases Using the CVS Client
» System Requirements Introduction to jCVS
» Installation Instructions Introduction to jCVS
» Using jCVS Introduction to jCVS
» Installing pcl-cvs Using Emacs with CVS
» Using pcl-cvs Using Emacs with CVS
» Have a shell account on the CVS server. 2. Create a publicprivate key pair on the client.
» Selecting Coding Styles Using indent Utility
» Formatting Braces Using indent Utility
» Formatting Declarations Using indent Utility
» Breaking Long Lines Using indent Utility
» Summary of Options Using indent Utility
» Using sed Utility Using cscope and cbrowser
» Generating C Function Prototypes from C Source Code Using cproto
» Using ltrace and strace Utilities
» Value 2. Type Name Using the nm Utility
» Using the ranlib Utility Using the strip Utility
» Using the strings Utility Using the addr2line Utility
» Host Machine Introduction to the Cross-Platform Development Process
» Target Machine Introduction to the Cross-Platform Development Process
» Cross Platform Development Cycle
» Embedded Systems and Moving Parts
» Embedded Systems and Power Consumption
» Embedded Operating Systems What are Embedded Systems?
» Knowledge of Target System Hardware
» Software Emulators Cross Compilations
» Using gdbserver with GNU Debugger
» Attaching to a Running Process Using gdbserver
» Arcom SBC-GX1 Board Hardware Used for Cross-Platform and Embedded Systems
» Artesyn PMPPC Mezzanine Card
» References the linux development platform 2003
» Java Compiler Java Virtual Machine
» Kaffe the linux development platform 2003
» The Jboss Java Development System
» Getting and Installing Java SDK from Sun Creating jar Files
» Creating Source Code File Compiling Java Code
» Running Java Applications Building Java Applications
» Using gcj to Build Java Applications
» Building Applets the linux development platform 2003
» Testing Applets with Netscape
» Jikes for Java the linux development platform 2003
Show more