|
|
Four commands exist for displaying lines in the source file. They are useful for perusing the source program and determining the context of the current line. The commands are as follows:
When a line from a file is printed, it is preceded by its line number. This not only gives an indication of its relative position in the file, but it is also used as input by some sdb commands.
The e command is used to change the current source file.
*e function *e file.cEither of above forms may be used. The first causes the file containing the named function to become the current file, and the current line becomes the first line of the function. The other form causes the named file to become current. In this case, the current line is set to the first line of the named file. Finally, an e command with no argument causes the current function and file named to be printed.
The z and control-d commands have a side effect of changing the current line in the source file. The following paragraphs describe other commands that change the current line. There are two commands for searching for instances of regular expressions in source files. They are:
*/regular expression/ *?regular expression?The first command searches forward through the file for a line containing a string that matches the regular expression, and the second searches backwards. The trailing / and ? may be omitted from these commands. Regular expression matching is identical to that of ed(C).
The + and - commands may be used to move the current line forward or backward by a specified number of lines. Typing a new-line advances the current line by one, and typing a number causes that line to become the current line in the file. These commands may be combined with the display commands so that, the following advances the current line by 15 and then prints ten lines.
*+15z