The ID database is useless without database query tools. The remainder of this document describes those tools.
The lid
, gid
,
aid
, eid
, and pid
programs are all the same program
installed with links to different names. The name used to invoke the
program determines how it will act.
The iid
program is an interactive query shell that sits on top
of the other query tools.
Since many of the programs are really links to one common program, it is only reasonable to expect that most of the query tools would share common command line options. Not all options make sense for all programs, but they are all described here. The description of each program gives the options that program uses.
-f<file>
-r<directory>
-r
option tells the
tools to look for the files relative to <directory> regardless
of the location of the database.
-c
-r`pwd`
. It tells the query tools to assume
the file names are stored relative to the current working directory.
-e
-w
-k
csh
brace notation. This option
suppresses the file name compression and outputs each name in full.
(This is particularly useful if you are a ksh
user and want to
feed the list of names to another command -- the -k
option
comes from the k
in ksh
).
-g
-k
option is the
default behavior. If this is the case for your system, the -g
option turns on the globbing of file names using the csh
brace
notation.
-n
-n
option suppresses the identifier and lists only
file names.
-b
pid
tool. It restricts pid
to pattern match only the basename part of a file name. Normally the
absolute file name is matched against the pattern.
-d -o -x -a
-d
option will allow matches on decimal
numbers, -o
on octal, and -x
on hexadecimal numbers.
The -a
option is shorthand for specifying all three. Any
combination of these options may be used.
-m
-s
-u<number>
You can attempt to match either simple identifiers or numbers in a query, or you can specify a regular expression pattern which may match many different identifiers in the database. The query programs use either regex and regcmp or re_comp and re_exec, depending on which one is available in the library on your system. These might not always support the exact same regular expression syntax, so consult your local man pages to find out. Any regular expression routines should support the following syntax:
.
[ ]
^
as the first character. A range of characters can be specified
using -
.
*
^
^
at the beginning of a pattern means the pattern must match
starting at the first character of the identifier.
$
$
at the end of the pattern means the pattern must match ending
at the last character in the identifier.
-f<file>
] [-u<n>
] [-r<dir>
] [-ewdoxamskgnc
] patterns...
The lid
program stands for lookup identifier.
It searches the database for any identifiers matching the patterns
and prints the names of the files that match each pattern. The exact
format of the output depends on the options.
-f<file>
] [-u<n>
] [-r<dir>
] [-doxamskgnc
] patterns...
The aid
command is an abbreviation for apropos identifier.
The patterns cannot be regular expressions, but it looks for them using
a case insensitive match, and any pattern that is a substring of an
identifier in the database will match that identifier.
For example `aid get' might match the identifiers fgets
,
GETLINE
, and getchar
.
-f<file>
] [-u<n>
] [-r<dir>
] [-doxasc
] patterns...
The gid
command stands for grep for identifiers. It finds
identifiers in the database that match the specified patterns, then
greps
for those identifiers in just the set of files containing
matches. In a large source tree, this saves a fantastic amount of time.
There is an emacs interface to this program (see section GNU Emacs Interface).
If you are an emacs user, you will probably prefer the emacs
interface over the eid
tool.
-f<file>
] [-u<n>
] [-r<dir>
] [-doxasc
] patterns...
The eid
command allows you to invoke an editor on each file containing
a matching pattern. The EDITOR
environment variable is the name of the
program to be invoked. If the specified editor can accept an initial search
argument on the command line, you can use the EIDARG
, EIDLDEL
,
and EIDRDEL
environment variables to specify the form of that argument.
EDITOR
EIDARG
vi
it should be set to `+/%s/''.
EIDLDEL
vi
,
this should be `\<'.
EIDRDEL
vi
, use `\>'.
-f<file>
] [-u<n>
] [-r<dir>
] [-ebkgnc
] patterns...
The pid
tool is unlike all the other tools. It matches the
patterns against the file names in the database rather than the
identifiers in the database. Patterns are treated as shell wild card
patterns unless the -e
option is given, in which case full
regular expression matching is done.
The wild card pattern is matched against the absolute path name of the
file. Most shells treat slashes `/' and file names that start with
dot `.' specially, pid
does not do this. It simply attempts
to match the absolute path name string against the wild card pattern.
The -b
option restricts the pattern matching to the base name of
the file (all the leading directory names are stripped prior to pattern
matching).