summaryrefslogtreecommitdiffstats
path: root/lid.1
blob: ce98212b0d65fe74d717ce38747453bffa33bb4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
LID(1)                               General Commands Manual                               LID(1)

NAME
       lid, gid, eid, aid, pid - query id database

SYNOPSIS
       lid [-ffile] [-un] [-rdir] [-edoxamseknc] patterns...

       gid [-ffile] [-rdir] [-edoxamsec] patterns...

       eid [-ffile] [-rdir] [-doxamsec] patterns...

       aid [-ffile] [-rdir] [-doxamsc] patterns...

       pid [-ffile] [-rdir] [-ekncb] patterns...

DESCRIPTION
       These  commands  provide a flexible query interface to the id database.  Lid does a lookup
       on patters and prints out lines in this way:

       idname        ../hdir/hfile.h ../cdir/{cfile1,cfile2}.c

       Notice that multiple files with the same directory prefix and suffix are  concatenated  in
       the  globbing-set-notation  of csh(1).  Also notice that all of the id database query com-
       mands adjust the list of pathnames to be relative to your current working directory,  pro-
       vided  that  mkid(1) was used to build the database, and your working directory is located
       within the sub-tree covered by the id database.

       If multiple names match on pattern, then there will be one line of output per  name.   The
       mnemonic significance of the name is l(ookup) id.

       Gid  does  a lookup and then searches for the names it matches in the files where they oc-
       cur.  The mnemonic for this name is g(rep)id.

       Eid does a lookup, and then invokes an editor on all files with the  matched  name  as  an
       initial search string.  Of course, this name stands for e(dit) id.

       Eid  uses  four environment variables to control its invocation of the editor.  Naturally,
       EDITOR is used to locate the editing program.  EIDARG is a printf(3S) string used to spec-
       ify  the  form of the initial-search-string argument.  If the editor does not support such
       an argument, this variable may be left unset.  EIDLDEL and EIDRDEL specify the form of the
       left  and  right  word-delimiters  respectively.  The best way to explain the use of these
       last three variables is with an example.  Here are the proper settings for vi(1):
       EIDARG='+/%s/' # initial search argument template
       EIDLDEL='\<'   # left word-delimiter
       EIDRDEL='\>'   # right word-delimiter

       Patterns may be simple alpha-numeric strings, or  regular  expressions  in  the  style  of
       regcmp(3).   If  the string contains no regular-expression meta-characters, it is searched
       for as a word.  If the string contains meta-characters, or if the -e argument is supplied,
       it is searched for as regular-expression.

       Aid produces output in the style of lid but its pattern arguments are searched for as sub-
       strings within the identifiers in the database.   No  regular-expression  search  is  per-
       formed,  even  if the pattern contains meta-characters.  The search is conducted in an al-
       phabetic case insensitive manner.  The mnemonic for this name is a(propos) id.

       Pid is used to match the input patterns against the names of the  files  in  the  database
       rather  than  the  contents of the files. The pattern is assumed to be a simple shell wild
       card pattern unless the -e option is given, in which case full regular expression matching
       is  used.  The -b option can be used to restrict the match to just the basename portion of
       the full absolute path name of the file.  The mnemonic for this name is p(ath) id.

       The following options are recognized:

       -ffile    Use file as the database instead of the default ID.

       -un       Lists all identifiers in the database that are non-unique  within  the  first  n
                 characters.   This  facility is particularly helpful when porting a program to a
                 system whose compiler or linker has fewer  significant  characters  for  identi-
                 fiers.

       -rdir     Assume  the  names  stored in the database are relative to this directory.  This
                 option is useful if you create the database in one place, then move it somewhere
                 else. Normally all the query tools assume the names in the database are relative
                 to the location of the database.

       -c        This option is similar to -r, but it tells the id query tool to assume the names
                 in the ID database are stored relative to the current working directory.

       -k        Suppresses  the  use  of  {  and  } as a shorthand in the generated list of file
                 names. Each name is output in full.

       -n        Suppresses printing the name of the search string, only the names of  the  files
                 containing  the string are printed. Together with the -k option this can be used
                 to generate lists of files to pass to other programs.

       -b        In the pid program, the -b option is used to force pattern matching on just  the
                 base names of the file, otherwise the pattern matching is done on the full abso-
                 lute file name.

       The remaining options are for use in conjunction with numeric patterns:

       -doxa     These options may be specified in any combination.  They limit  numeric  matches
                 to  specific  radixes.  The -d, -o, and -x options limit matches to decimal, oc-
                 tal, and hexadecimal respectively.  The -a option is a shorthand for  specifying
                 all three radixes.

       Searches  for  numbers are conducted numerically rather than lexically, so that all repre-
       sentations for a given number are potentially available from a single search.

       -m        Merge multiple lines of output into a single line.

       -s        Limit the results of the search to identifiers that occur only once in  the  en-
                 tire  set of sources covered by the database.  This option is useful for finding
                 identifiers that are defined but never used.

SEE ALSO
       mkid(1), fid(1).

                                                                                           LID(1)