Next: , Up: Standard Commands   [Contents][Index]


B.2.1 The DEFINE Command

The DEFINE command searches for definitions of a word.

Command: DEFINE db word

Look up the word word in database db. If db is ‘!’, then all the databases will be searched until the word is found, and all matches in that database will be returned. Similarly, if db is ‘*’, then all the databases will be searched and all matches in all databases will be returned. In these two cases, the databases are searched in the same order as that returned by SHOW DB command (see SHOW DB).

If the word was not found, response code 552 is returned.

If the word is found, a response code 150 is sent, followed by the number of definitions found. Then, for each definition a response code 151 is returned, followed by the textual body of the definition. In a 151 response, the first three space-delimited parameters give the word looked for, the name and a short description of the database. The latter two are the same as shown in the output from SHOW DB command.

The textual body of each definition is terminated with a dot (‘.’) on a line alone. If any line in the definition begins with a dot, it is duplicated to avoid confusion with body terminator.

After all of the definitions have been sent, a status code 250 is sent. If timing is set to ‘true’ in the configuration file, this latter response also carries timing information. See Tuning, for more information about timing output.

Possible responses from DEFINE command are:

550 Invalid database, use SHOW DB for a list
552 No match
150 n definitions found: list follows
151 word database name
250 ok (optional timing information here)

Example transaction:

C: DEFINE eng-swa man
S: 150 1 definitions found: list follows
S: 151 "man" eng-swa "English-Swahili xFried/FreeDict Dictionary"
S: man  <n.>
S: 
S:    mwanamume
S:
S: .
S: 250 Command complete [d/m/c = 1/0/12 0.000r 0.000u 0.000s]

Next: The MATCH Command, Up: Standard Commands   [Contents][Index]