|
|
If you select the sixth item in the task menu, "Change this text
string
", cscope accepts a search string,
prompts you for new text and
displays the lines containing the old text.
You can select the lines you want changed with any of the
following single-key commands:
Commands for selecting lines to be changed
1-9 | mark or unmark the line to be changed |
* | mark or unmark all displayed lines to be changed |
space | display next lines |
+ | display next lines |
- | display previous lines |
a | mark all lines to be changed |
<Ctrl>d | change the marked lines and exit |
<Esc> | exit without changing the marked lines |
Change this text string
"
and enter \100.
Now press <Return>; cscope will prompt you for the new text string. Type MAXSIZE. This process is illustrated in the following example:
cscope Press the ? key for helpThe lines containing the particular text string are displayed; cscope waits for you to specify the lines in which you want the text to be changed.
List references to this C symbol: Edit this function or #define: List functions called by this function: List functions calling this function: List lines containing this text string: Change this text string: 100 List file names containing this text string: To: MAXSIZE
Change "100" to "MAXSIZE"File Line 1 init.c 4 char s[100]; 2 init.c 26 for (i = 0; i < 100; i++) 3 find.c 8 if (c < 100) { 4 read.c 12 f = (bb & 0100); 5 err.c 19 p = total/100.0; /* get percentage */
List references to this C symbol: Edit this function or #define: List functions called by this function: List functions calling this function: List lines containing this text string: Change this text string: List file names containing this text string: Select lines to change (press the ? key for help):
Occurrences of 100
in lines 1, 2, and
3 of the list (from lines 4, 26, and 8 of the program) are
to be changed to MAXSIZE.
The occurrences of 100
in read.c
and err.c (lines 4 and 5 of the list) have a different
meaning; in these lines, 100
should not be changed.
Enter 1, 2, and 3.
The numbers you type are not printed on the screen.
Instead, cscope prints a ``>'' (greater
than) symbol after each number of the list that you type.
For example, after you type 1, a > symbol
is printed after the number 1 in the list (and before the line
``init.c 4 char s[100];
''), as shown in
the following example:
Change "100" to "MAXSIZE"After selecting lines, type <Ctrl>d to change them. Then cscope displays the lines that have been changed:File Line 1>init.c 4 char s[100]; 2>init.c 26 for (i = 0; i < 100; i++) 3>find.c 8 if (c < 100) { 4 read.c 12 f = (bb & 0100); 5 err.c 19 p = total/100.0; /* get percentage */
List references to this C symbol: Edit this function or #define: List functions called by this function: List functions calling this function: List lines containing this text string: Change this text string: List file names containing this text string: Select lines to change (press the ? key for help):
Changed lines: char s[MAXSIZE]; for (i = 0; i < MAXSIZE; i++) if (c < MAXSIZE) {When you type a character in response to this prompt, cscope will pause and redraw the screen before allowing you to continue with the session.Type any character to continue:
The next step is to add the #define for the new symbol MAXSIZE. Escape to the shell by typing an exclamation mark ``!''. The shell prompt will appear at the bottom of the screen. Then enter the editor and add the #define. To resume the cscope session, quit the editor and type <Ctrl>d to exit the shell.