]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ddb/db_command.c
385e0148e6e449a941c26dd5b4ec3ad506833e0d
[apple/xnu.git] / osfmk / ddb / db_command.c
1 /*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * @OSF_COPYRIGHT@
32 */
33 /*
34 * Mach Operating System
35 * Copyright (c) 1991 Carnegie Mellon University
36 * All Rights Reserved.
37 *
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
43 *
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 *
48 * Carnegie Mellon requests users of this software to return to
49 *
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
54 *
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
57 */
58 /*
59 */
60 /*
61 * Author: David B. Golub, Carnegie Mellon University
62 * Date: 7/90
63 */
64
65 /*
66 * Command dispatcher.
67 */
68 #include <norma_vm.h>
69 #ifdef AT386
70 #include <norma_scsi.h>
71 #endif /* AT386 */
72
73 #include <mach/boolean.h>
74 #include <string.h>
75 #include <machine/db_machdep.h>
76
77 #if defined(__alpha)
78 # include <kdebug.h>
79 # if KDEBUG
80 # include <machine/kdebug.h>
81 # endif
82 #endif /* defined(__alpha) */
83
84 #include <ddb/db_lex.h>
85 #include <ddb/db_output.h>
86 #include <ddb/db_break.h>
87 #include <ddb/db_command.h>
88 #include <ddb/db_cond.h>
89 #include <ddb/db_examine.h>
90 #include <ddb/db_expr.h>
91 #include <ppc/db_low_trace.h>
92 #include <ddb/db_macro.h>
93 #include <ddb/db_print.h>
94 #include <ddb/db_run.h>
95 #include <ddb/db_task_thread.h>
96 #include <ddb/db_variables.h>
97 #include <ddb/db_watch.h>
98 #include <ddb/db_write_cmd.h>
99 #include <ddb/tr.h>
100
101 #include <machine/setjmp.h>
102 #include <kern/thread.h>
103
104 #include <kern/misc_protos.h>
105 #include <vm/vm_print.h>
106 #include <ipc/ipc_print.h>
107 #include <kern/kern_print.h>
108 #include <machine/db_machdep.h> /* For db_stack_trace_cmd(). */
109 #include <kern/zalloc.h> /* For db_show_one_zone, db_show_all_zones. */
110 #include <kern/lock.h> /* For db_show_all_slocks(). */
111
112 #if NORMA_VM
113 #include <xmm/xmm_obj.h>
114 #endif /* NORMA_VM */
115
116 /*
117 * Exported global variables
118 */
119 boolean_t db_cmd_loop_done;
120 jmp_buf_t *db_recover = 0;
121 db_addr_t db_dot;
122 db_addr_t db_last_addr;
123 db_addr_t db_prev;
124 db_addr_t db_next;
125
126 /*
127 * if 'ed' style: 'dot' is set at start of last item printed,
128 * and '+' points to next line.
129 * Otherwise: 'dot' points to next item, '..' points to last.
130 */
131 boolean_t db_ed_style = TRUE;
132
133 /*
134 * Results of command search.
135 */
136 #define CMD_UNIQUE 0
137 #define CMD_FOUND 1
138 #define CMD_NONE 2
139 #define CMD_AMBIGUOUS 3
140 #define CMD_HELP 4
141
142 /* Prototypes for functions local to this file. XXX -- should be static!
143 */
144
145 void db_command(
146 struct db_command **last_cmdp, /* IN_OUT */
147 db_expr_t *last_countp, /* IN_OUT */
148 char *last_modifp, /* IN_OUT */
149 struct db_command *cmd_table);
150
151 void db_help_cmd(void);
152
153 void db_output_prompt(void);
154
155 void db_fncall(void);
156
157 void db_cmd_list(struct db_command *table);
158
159 int db_cmd_search(
160 char * name,
161 struct db_command * table,
162 struct db_command ** cmdp); /* out */
163
164 void db_command_list(
165 struct db_command **last_cmdp, /* IN_OUT */
166 db_expr_t *last_countp, /* IN_OUT */
167 char *last_modifp, /* IN_OUT */
168 struct db_command *cmd_table);
169
170 /*
171 * Search for command prefix.
172 */
173 int
174 db_cmd_search(
175 char * name,
176 struct db_command * table,
177 struct db_command ** cmdp) /* out */
178 {
179 struct db_command *cmd;
180 int result = CMD_NONE;
181
182 for (cmd = table; cmd->name != 0; cmd++) {
183 register char *lp;
184 register char *rp;
185 register int c;
186
187 lp = name;
188 rp = cmd->name;
189 while ((c = *lp) == *rp) {
190 if (c == 0) {
191 /* complete match */
192 *cmdp = cmd;
193 return (CMD_UNIQUE);
194 }
195 lp++;
196 rp++;
197 }
198 if (c == 0) {
199 /* end of name, not end of command -
200 partial match */
201 if (result == CMD_FOUND) {
202 result = CMD_AMBIGUOUS;
203 /* but keep looking for a full match -
204 this lets us match single letters */
205 }
206 else {
207 *cmdp = cmd;
208 result = CMD_FOUND;
209 }
210 }
211 }
212 if (result == CMD_NONE) {
213 /* check for 'help' */
214 if (!strncmp(name, "help", strlen(name)))
215 result = CMD_HELP;
216 }
217 return (result);
218 }
219
220 void
221 db_cmd_list(struct db_command *table)
222 {
223 register struct db_command *new;
224 register struct db_command *old;
225 register struct db_command *cur;
226 unsigned int l;
227 unsigned int len;
228
229 len = 1;
230 for (cur = table; cur->name != 0; cur++)
231 if ((l = strlen(cur->name)) >= len)
232 len = l + 1;
233
234 old = (struct db_command *)0;
235 for (;;) {
236 new = (struct db_command *)0;
237 for (cur = table; cur->name != 0; cur++)
238 if ((new == (struct db_command *)0 ||
239 strcmp(cur->name, new->name) < 0) &&
240 (old == (struct db_command *)0 ||
241 strcmp(cur->name, old->name) > 0))
242 new = cur;
243 if (new == (struct db_command *)0)
244 return;
245 db_reserve_output_position(len);
246 db_printf("%-*s", len, new->name);
247 old = new;
248 }
249 }
250
251 void
252 db_command(
253 struct db_command **last_cmdp, /* IN_OUT */
254 db_expr_t *last_countp, /* IN_OUT */
255 char *last_modifp, /* IN_OUT */
256 struct db_command *cmd_table)
257 {
258 struct db_command *cmd;
259 int t;
260 char modif[TOK_STRING_SIZE];
261 char *modifp = &modif[0];
262 db_expr_t addr, count;
263 boolean_t have_addr;
264 int result;
265
266 t = db_read_token();
267 if (t == tEOL || t == tSEMI_COLON) {
268 /* empty line repeats last command, at 'next' */
269 cmd = *last_cmdp;
270 count = *last_countp;
271 modifp = last_modifp;
272 addr = (db_expr_t)db_next;
273 have_addr = FALSE;
274 if (t == tSEMI_COLON)
275 db_unread_token(t);
276 }
277 else if (t == tEXCL) {
278 db_fncall();
279 return;
280 }
281 else if (t != tIDENT) {
282 db_printf("?\n");
283 db_flush_lex();
284 return;
285 }
286 else {
287 /*
288 * Search for command
289 */
290 while (cmd_table) {
291 result = db_cmd_search(db_tok_string,
292 cmd_table,
293 &cmd);
294 switch (result) {
295 case CMD_NONE:
296 if (db_exec_macro(db_tok_string) == 0)
297 return;
298 db_printf("No such command \"%s\"\n", db_tok_string);
299 db_flush_lex();
300 return;
301 case CMD_AMBIGUOUS:
302 db_printf("Ambiguous\n");
303 db_flush_lex();
304 return;
305 case CMD_HELP:
306 db_cmd_list(cmd_table);
307 db_flush_lex();
308 return;
309 default:
310 break;
311 }
312 if ((cmd_table = cmd->more) != 0) {
313 t = db_read_token();
314 if (t != tIDENT) {
315 db_cmd_list(cmd_table);
316 db_flush_lex();
317 return;
318 }
319 }
320 }
321
322 if ((cmd->flag & CS_OWN) == 0) {
323 /*
324 * Standard syntax:
325 * command [/modifier] [addr] [,count]
326 */
327 t = db_read_token();
328 if (t == tSLASH) {
329 t = db_read_token();
330 if (t != tIDENT) {
331 db_printf("Bad modifier \"/%s\"\n", db_tok_string);
332 db_flush_lex();
333 return;
334 }
335 strcpy(modif, db_tok_string);
336 }
337 else {
338 db_unread_token(t);
339 modif[0] = '\0';
340 }
341
342 if (db_expression(&addr)) {
343 db_dot = (db_addr_t) addr;
344 db_last_addr = db_dot;
345 have_addr = TRUE;
346 }
347 else {
348 addr = (db_expr_t) db_dot;
349 have_addr = FALSE;
350 }
351 t = db_read_token();
352 if (t == tCOMMA) {
353 if (!db_expression(&count)) {
354 db_printf("Count missing after ','\n");
355 db_flush_lex();
356 return;
357 }
358 }
359 else {
360 db_unread_token(t);
361 count = -1;
362 }
363 }
364 }
365 if (cmd != 0) {
366 /*
367 * Execute the command.
368 */
369 (*cmd->fcn)(addr, have_addr, count, modifp);
370
371 if (cmd->flag & CS_SET_DOT) {
372 /*
373 * If command changes dot, set dot to
374 * previous address displayed (if 'ed' style).
375 */
376 if (db_ed_style) {
377 db_dot = db_prev;
378 }
379 else {
380 db_dot = db_next;
381 }
382 }
383 else {
384 /*
385 * If command does not change dot,
386 * set 'next' location to be the same.
387 */
388 db_next = db_dot;
389 }
390 }
391 *last_cmdp = cmd;
392 *last_countp = count;
393 strcpy(last_modifp, modifp);
394 }
395
396 void
397 db_command_list(
398 struct db_command **last_cmdp, /* IN_OUT */
399 db_expr_t *last_countp, /* IN_OUT */
400 char *last_modifp, /* IN_OUT */
401 struct db_command *cmd_table)
402 {
403 do {
404 db_command(last_cmdp, last_countp, last_modifp, cmd_table);
405 db_skip_to_eol();
406 } while (db_read_token() == tSEMI_COLON && db_cmd_loop_done == 0);
407 }
408
409
410 extern void db_system_stats(void);
411
412 struct db_command db_show_all_cmds[] = {
413 { "acts", db_show_all_acts, 0, 0 },
414 { "spaces", db_show_all_spaces, 0, 0 },
415 { "tasks", db_show_all_acts, 0, 0 },
416 /* temporary alias for sanity preservation */
417 { "threads", db_show_all_acts, 0, 0 },
418 { "zones", db_show_all_zones, 0, 0 },
419 { "vmtask", db_show_all_task_vm, 0, 0 },
420 { (char *)0 }
421 };
422
423 /* XXX */
424
425 extern void db_show_thread_log(void);
426 extern void db_show_one_lock(lock_t*);
427 extern void db_show_etap_log(db_expr_t, int, db_expr_t, char *);
428
429 struct db_command db_show_cmds[] = {
430 { "all", 0, 0, db_show_all_cmds },
431 { "registers", db_show_regs, 0, 0 },
432 { "variables", (db_func) db_show_variable, CS_OWN, 0 },
433 { "breaks", (db_func) db_listbreak_cmd, 0, 0 },
434 { "watches", (db_func) db_listwatch_cmd, 0, 0 },
435 { "task", db_show_one_task, 0, 0 },
436 { "act", db_show_one_act, 0, 0 },
437 { "shuttle", db_show_shuttle, 0, 0 },
438 #if 0
439 { "thread", db_show_one_thread, 0, 0 },
440 #endif
441 { "vmtask", db_show_one_task_vm, 0, 0 },
442 { "macro", (db_func) db_show_macro, CS_OWN, 0 },
443 { "runq", (db_func) db_show_runq, 0, 0 },
444 { "map", (db_func) vm_map_print, 0, 0 },
445 { "object", (db_func) vm_object_print, 0, 0 },
446 { "page", (db_func) vm_page_print, 0, 0 },
447 { "copy", (db_func) vm_map_copy_print, 0, 0 },
448 { "port", (db_func) ipc_port_print, 0, 0 },
449 { "pset", (db_func) ipc_pset_print, 0, 0 },
450 { "kmsg", (db_func) ipc_kmsg_print, 0, 0 },
451 { "msg", (db_func) ipc_msg_print, 0, 0 },
452 { "ipc_port", db_show_port_id, 0, 0 },
453 #if NORMA_VM
454 { "xmm_obj", (db_func) xmm_obj_print, 0, 0 },
455 { "xmm_reply", (db_func) xmm_reply_print, 0, 0 },
456 #endif /* NORMA_VM */
457 #if TRACE_BUFFER
458 { "tr", db_show_tr, 0, 0 },
459 #endif /* TRACE_BUFFER */
460 { "space", db_show_one_space, 0, 0 },
461 { "system", (db_func) db_system_stats, 0, 0 },
462 { "zone", db_show_one_zone, 0, 0 },
463 { "lock", (db_func)db_show_one_lock, 0, 0 },
464 { "mutex_lock", (db_func)db_show_one_mutex, 0, 0 },
465 { "simple_lock", (db_func)db_show_one_simple_lock, 0, 0 },
466 { "thread_log", (db_func)db_show_thread_log, 0, 0 },
467 { "shuttle", db_show_shuttle, 0, 0 },
468 { (char *)0, }
469 };
470
471 #define db_switch_cpu kdb_on
472 extern void db_switch_cpu(int);
473
474 struct db_command db_command_table[] = {
475 #if DB_MACHINE_COMMANDS
476
477 /* this must be the first entry, if it exists */
478 { "machine", 0, 0, 0 },
479 #endif
480 { "print", (db_func) db_print_cmd, CS_OWN, 0 },
481 { "examine", db_examine_cmd, CS_MORE|CS_SET_DOT, 0 },
482 { "x", db_examine_cmd, CS_MORE|CS_SET_DOT, 0 },
483 { "xf", db_examine_forward, CS_SET_DOT, 0 },
484 { "xb", db_examine_backward, CS_SET_DOT, 0 },
485 { "search", (db_func) db_search_cmd, CS_OWN|CS_SET_DOT, 0 },
486 { "set", (db_func) db_set_cmd, CS_OWN, 0 },
487 { "write", db_write_cmd, CS_MORE|CS_SET_DOT, 0 },
488 { "w", db_write_cmd, CS_MORE|CS_SET_DOT, 0 },
489 { "delete", (db_func) db_delete_cmd, CS_OWN, 0 },
490 { "d", (db_func) db_delete_cmd, CS_OWN, 0 },
491 { "break", db_breakpoint_cmd, CS_MORE, 0 },
492 { "dwatch", db_deletewatch_cmd, CS_MORE, 0 },
493 { "watch", db_watchpoint_cmd, CS_MORE, 0 },
494 { "step", db_single_step_cmd, 0, 0 },
495 { "s", db_single_step_cmd, 0, 0 },
496 { "continue", db_continue_cmd, 0, 0 },
497 { "c", db_continue_cmd, 0, 0 },
498 { "gdb", db_continue_gdb, 0, 0 },
499 { "until", db_trace_until_call_cmd, 0, 0 },
500
501 /* As per request of DNoveck, CR1550, leave this disabled */
502 #if 0 /* until CR1440 is fixed, to avoid toe-stubbing */
503 { "next", db_trace_until_matching_cmd, 0, 0 },
504 #endif
505 { "match", db_trace_until_matching_cmd, 0 , 0 },
506 { "trace", db_stack_trace_cmd, 0, 0 },
507 { "cond", (db_func) db_cond_cmd, CS_OWN, 0 },
508 { "call", (db_func) db_fncall, CS_OWN, 0 },
509 { "macro", (db_func) db_def_macro_cmd, CS_OWN, 0 },
510 { "dmacro", (db_func) db_del_macro_cmd, CS_OWN, 0 },
511 { "show", 0, 0, db_show_cmds },
512 { "cpu", (db_func) db_switch_cpu, 0, 0 },
513 { "dr", db_display_real, CS_MORE|CS_SET_DOT, 0 },
514 { "di", db_display_iokit, CS_MORE, 0 },
515 { "dk", db_display_kmod, CS_MORE, 0 },
516
517 { "reboot", (db_func) db_reboot, 0, 0 },
518 #if !defined(__ppc__)
519 { "pm", db_pmgr, CS_MORE, 0 },
520 { "na", db_nap, CS_MORE, 0 },
521 { "ms", db_msr, CS_MORE, 0 },
522 { "cp", db_cpuid, CS_MORE, 0 },
523 { "da", db_apic, CS_MORE, 0 },
524 { "ts", db_test, CS_MORE, 0 },
525 { "dn", db_intcnt, CS_MORE, 0 },
526 { "hp", db_hpet, CS_MORE, 0 },
527 { "cf", db_cfg, CS_MORE, 0 },
528 { "dt", db_dtimers, CS_MORE, 0 },
529 #endif
530 #if defined(__ppc__)
531 { "lt", db_low_trace, CS_MORE|CS_SET_DOT, 0 },
532 { "dl", db_display_long, CS_MORE|CS_SET_DOT, 0 },
533 { "dc", db_display_char, CS_MORE|CS_SET_DOT, 0 },
534 { "dv", db_display_virtual, CS_MORE|CS_SET_DOT, 0 },
535 { "dm", db_display_mappings, CS_MORE|CS_SET_DOT, 0 },
536 { "dh", db_display_hash, CS_MORE|CS_SET_DOT, 0 },
537 { "dp", db_display_pmap, CS_MORE, 0 },
538 { "ds", db_display_save, CS_MORE|CS_SET_DOT, 0 },
539 { "dx", db_display_xregs, CS_MORE|CS_SET_DOT, 0 },
540 { "gs", db_gsnoop, CS_MORE, 0 },
541 { "cm", db_check_mappings, CS_MORE, 0 },
542 { "cp", db_check_pmaps, CS_MORE, 0 },
543 #endif
544 { (char *)0, }
545 };
546
547 /* this function should be called to install the machine dependent
548 commands. It should be called before the debugger is enabled */
549 void db_machine_commands_install(struct db_command *ptr)
550 {
551 db_command_table[0].more = ptr;
552 return;
553 }
554
555
556 struct db_command *db_last_command = 0;
557 db_expr_t db_last_count = 0;
558 char db_last_modifier[TOK_STRING_SIZE] = { '\0' };
559
560 void
561 db_help_cmd(void)
562 {
563 struct db_command *cmd = db_command_table;
564
565 while (cmd->name != 0) {
566 db_printf("%-12s", cmd->name);
567 db_end_line();
568 cmd++;
569 }
570 }
571
572 int (*ddb_display)(void);
573
574 void
575 db_command_loop(void)
576 {
577 jmp_buf_t db_jmpbuf;
578 jmp_buf_t *prev = db_recover;
579 extern int db_output_line;
580 extern int db_macro_level;
581 extern int db_indent;
582
583 /*
584 * Initialize 'prev' and 'next' to dot.
585 */
586 db_prev = db_dot;
587 db_next = db_dot;
588
589 if (ddb_display)
590 (*ddb_display)();
591
592 db_cmd_loop_done = 0;
593 while (!db_cmd_loop_done) {
594 (void) _setjmp(db_recover = &db_jmpbuf);
595 db_macro_level = 0;
596 if (db_print_position() != 0)
597 db_printf("\n");
598 db_output_line = 0;
599 db_indent = 0;
600 db_reset_more();
601 db_output_prompt();
602
603 (void) db_read_line("!!");
604 db_command_list(&db_last_command, &db_last_count,
605 db_last_modifier, db_command_table);
606 }
607
608 db_recover = prev;
609 }
610
611 boolean_t
612 db_exec_cmd_nest(
613 const char *cmd,
614 int size)
615 {
616 struct db_lex_context lex_context;
617
618 db_cmd_loop_done = 0;
619 if (cmd) {
620 db_save_lex_context(&lex_context);
621 db_switch_input(cmd, size);
622 }
623 db_command_list(&db_last_command, &db_last_count,
624 db_last_modifier, db_command_table);
625 if (cmd)
626 db_restore_lex_context(&lex_context);
627 return(db_cmd_loop_done == 0);
628 }
629
630 void
631 db_error(const char *s)
632 {
633 extern int db_macro_level;
634
635 db_macro_level = 0;
636 if (db_recover) {
637 if (s > (char *)1)
638 db_printf(s);
639 db_flush_lex();
640 _longjmp(db_recover, (s == (char *)1) ? 2 : 1);
641 }
642 else
643 {
644 if (s > (char *)1)
645 db_printf(s);
646 panic("db_error");
647 }
648 }
649
650
651 /*
652 * Call random function:
653 * !expr(arg,arg,arg)
654 */
655 void
656 db_fncall(void)
657 {
658 db_expr_t fn_addr;
659 #define MAXARGS 11
660 uint32_t args[MAXARGS];
661 db_expr_t argwork;
662 int nargs = 0;
663 uint32_t retval;
664 uint32_t (*func)(uint32_t, ...);
665 int t;
666
667 if (!db_expression(&fn_addr)) {
668 db_printf("Bad function \"%s\"\n", db_tok_string);
669 db_flush_lex();
670 return;
671 }
672 func = (uint32_t (*) (uint32_t, ...)) fn_addr;
673
674 t = db_read_token();
675 if (t == tLPAREN) {
676 if (db_expression(&argwork)) {
677 args[nargs] = (uint32_t)argwork;
678 nargs++;
679 while ((t = db_read_token()) == tCOMMA) {
680 if (nargs == MAXARGS) {
681 db_printf("Too many arguments\n");
682 db_flush_lex();
683 return;
684 }
685 if (!db_expression(&argwork)) {
686 db_printf("Argument missing\n");
687 db_flush_lex();
688 return;
689 }
690 args[nargs] = (uint32_t)argwork;
691 nargs++;
692 }
693 db_unread_token(t);
694 }
695 if (db_read_token() != tRPAREN) {
696 db_printf("?\n");
697 db_flush_lex();
698 return;
699 }
700 }
701 while (nargs < MAXARGS) {
702 args[nargs++] = 0;
703 }
704
705 retval = (*func)(args[0], args[1], args[2], args[3], args[4],
706 args[5], args[6], args[7], args[8], args[9] );
707 db_printf(" %#n\n", retval);
708 }
709
710 boolean_t
711 db_option(
712 const char *modif,
713 int option)
714 {
715 register char *p;
716
717 for (p = modif; *p; p++)
718 if (*p == option)
719 return(TRUE);
720 return(FALSE);
721 }