Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/man/1/srch

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TH SRCH 1
.SH NAME
xid srch \- C source search
.SH SYNOPSIS
.B srch
[
.B -glvcfFPdsx
]
.I pattern
.PP
.B xid
[
.B -cv
] [
.B -p
.I path
] [
file
]
.SH DESCRIPTION
.I Srch
searches a database of C identifiers and comments for the given pattern.
The type of objects found may be restricted by the use of one or more options
below; by default all objects are extracted.
.PP
The options are:
.TP
.B -g
Global Variables
.TP
.B -l
Local variable
.TP
.B  -v
Variable use
.TP
.B  -c
Character constant
.TP
.B  -f
Function call
.TP
.B  -F
Function definition
.TP
.B  -P
Function prototype
.TP
.B  -d
#define
.TP
.B  -s
String constant
.TP
.B  -x
Comment
.PP
.I Xid
generates the indices consulted by
.IR srch , 
these files are created in the current directory or in that given on the
command line.
It reads standard input to get the list of C files to be searched.
.PP
The file
.B files.idx
contains two whitespace separated fields, the file name and file index number,
.B symbs.idx
has at least four fields, the identifier type letter, file index,
line number and identifier text (which may contain many words).
The identifier types are the same single letter codes defined
above for \fIsrch\fR's command line options.
.PP
xid takes several options which reduce the amount of information stored in the indices.
The \fB-v\fR disables indexing variable identifiers, \fB-c\fR disables indexing
of comments, and \fB-p\fR \fIpath\fR causes the leading \fIpath\fR to be stripped from
all filenames.
.PP
Note if the \fB-p\fR option is used then the \fIsrch\fR script may need to be edited to suit.
.SH EXAMPLE
Here a top level directory is created in the \fIother\fR partition
to contain the indices, which is updated every night by cron.
.EX
.CW

9fs idx; du -a /sys/src | awk '/\\.[chly]$/ {print $2}' | xid -v -p /sys/src

term% srch 'waiting 10 seconds' 
s /sys/srccmd/fossil/fs.c:206 could not write super block; waiting 10 seconds\n

.EE
.SH BUGS
As \fIxid\fR only performs a simple lexical analysis of C
some identifiers may be missed.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].