2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * COMPONENT_NAME: austext
26 * FUNCTIONS: Opera_Engine
27 * alarm_signal_handler
39 * (C) COPYRIGHT International Business Machines Corp. 1991,1996
41 * Licensed Materials - Property of IBM
42 * US Government Users Restricted Rights - Use, duplication or
43 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
45 /******************************* DTOE.C ********************************
46 * $XConsortium: dtoe.c /main/6 1996/11/25 18:52:51 drk $
48 * Universal Opera Engine code.
49 * Additional functions in modules named OE...
50 * See comments in OE.H for Opera_Engine() function descriptions.
51 * References to 'socblk' have all been replaced by usrblk,
52 * which is now the universal data structure.
55 * Revision 2.8 1996/03/20 19:25:31 miker
56 * Use new hilite_cleartext() function call.
58 * Revision 2.7 1996/03/13 22:51:39 miker
59 * Changed char to UCHAR several places.
60 * Revision 2.6 1996/03/05 19:20:58 miker
61 * Replaced vewords with boolyac, boolpars, and boolsrch.
62 * oe_unblob no longer converts to uppercase.
63 * Revision 2.5 1996/02/01 17:15:18 miker
64 * 2.1.11: Changes to support parsers using readchar cofunctions.
65 * Changed hiliting calls to hilite_cleartext.
66 * Obsoleted OE_FINDSTR_REC, OE_DITTO2KWIC, OE_FINDSTR_HITL.
67 * Revision 2.4 1995/12/27 16:47:12 miker
69 * Revision 2.3 1995/10/24 22:31:32 miker
70 * Renamed from oe.c. Added prolog.
72 * Revision 2.2 1995/10/03 21:44:24 miker
73 * Deleted unsigned attrib from misc variables for portability.
74 * Revision 2.1 1995/09/22 21:29:45 miker
75 * Freeze DtSearch 0.1, AusText 2.1.8
76 * Revision 1.19 1995/09/05 18:49:45 miker
77 * Changed all socblk refs to usrblk. Obsoleted several globals.
78 * Conflated all msglists to one ausapi_msglist. Numerous name changes.
79 * Added DTSEARCH define. Remove password processing.
80 * Made usrblk a universal global. ...All for DtSearch.
81 * Revision 1.18 1995/07/19 21:02:59 miker
82 * 2.1.6c: Removed OE_mail_feature and OE_print_server.
83 * Revision 1.17 1995/06/22 20:49:33 miker
84 * 2.1.6: Additional debugging messages.
85 * Revision 1.16 1995/05/30 19:20:51 miker
86 * Print a little more of msglist when debugging engine return.
96 #define PROGNAME "DTOE"
97 #define MAX_LASTQRY 64
101 /*******#define DUMP_HITWORDS*******/
108 int boolean_parse (void);
109 void boolean_search (void);
110 void ve_delete (void);
112 /*------------------ OPERA ENGINE GLOBALS --------------------
113 * Default values set by init_globals() in oeinit.c
114 * (Some values preinitialized here by compiler because
115 * they may be used before the first call to init_globals()).
116 * Most can be overridden by site configuration file.
117 * Obviously any changes here should be reflected in init_globals().
118 * Other OE_... globals are located in loadocf.c
120 extern int debugging_jpn;
121 extern int debugging_teskey;
122 char *global_memory_ptr = NULL; /* shared mem, dynam
124 int shm_id = 0; /* shared mem, dynam defrag */
126 int OE_bmhtab_strlen[DtSrMAX_STEMCOUNT] = { 0 };
127 size_t OE_bmhtables[DtSrMAX_STEMCOUNT][MAX_BMHTAB] = { { 0 } };
128 int OE_dbn = 0; /* dynamic */
129 int OE_enable_markdel = 0;
130 int OE_enable_usernotes = 0;
131 int OE_fastdecode = 0;
132 char *OE_fileio = NULL;
134 long OE_objsize = 0L;
135 char *OE_prodname = PRODNAME; /* reset only in main() */
136 float OE_prox_factor = 0.0;
137 int OE_search_type = 0;
138 char *OE_sitecnfg_fname = NULL;
139 time_t OE_sitecnfg_mtime = 0L; /* reset only in oeinitialize() */
140 int OE_uppercase_keys = 0;
141 long OE_words_hitlimit = 0L;
143 static time_t my_expiration = 0L;
144 time_t *OE_expiration = &my_expiration;
146 char *OEF_audit = NULL;
147 char *OEF_discard = NULL;
148 char *OEF_news = NULL;
149 char *OEF_notesnot = NULL;
150 char *OEF_notessem = NULL;
151 char *OEF_readme = NULL;
154 /*------------ OTHER GLOBALS -----------*/
155 SAVEUSR saveusr = { 0 };
158 /****************************************/
162 /****************************************/
163 /* This function permanently disables opera
164 * if the license to opera has expired.
166 static void expired (char *sprintbuf)
168 sprintf (sprintbuf, catgets (dtsearch_catd, MS_oe, 71,
169 PROGNAME "71 %s has expired."),
171 DtSearchAddMessage (sprintbuf);
172 OE_flags |= OE_PERMERR;
173 usrblk.retncode = OE_ABORT;
178 /************************************************/
180 /* alarm_signal_handler */
182 /************************************************/
183 /* Interrupt handler for SIGALRM */
184 static void alarm_signal_handler (int sig)
186 fprintf (aa_stderr, PROGNAME "32 "
187 "%s %s shutdown due to excessive user idle time.\n",
188 nowstring (NULL), aa_argv0);
189 DtSearchExit (100 + sig);
190 } /* alarm_signal_handler() */
193 /****************************************/
197 /****************************************/
198 /* Converts a list of compressed text blob records
199 * straight out of vista into a single string of clear text.
200 * input = OE_objsize, dblk.hufid, passed bloblist (freed after use!).
201 * output = usrblk.cleartext, usrblk.clearlen.
202 * Returns OE_OK if all goes well, else returns other appropriate retncode.
204 int oe_unblob (LLIST *bloblist)
206 UCHAR *targ, *src, *stoploc;
208 LLIST *lptr, *nextlptr;
213 /* Free previous cleartext, if any, and allocate new buffer */
214 if (OE_objsize < 512)
217 mallocsz = OE_objsize + 4L;
218 if (usrblk.cleartext != NULL)
219 free (usrblk.cleartext);
220 usrblk.cleartext = austext_malloc (mallocsz, PROGNAME "188", NULL);
221 usrblk.clearlen = OE_objsize;
223 /* Uncompress/decipher bloblist into cleartext,
224 * freeing the blobs as we go.
226 targ = (UCHAR *) usrblk.cleartext;
227 stoploc = targ + OE_objsize;
229 while (lptr != NULL) {
230 /* Setup ptrs and counters for decoding */
231 bptr = (struct or_blobrec *) lptr->data;
232 src = (UCHAR *) bptr->or_blob;
233 blobclearlen = bptr->or_bloblen; /* len of cleartext in curr blob */
234 if (targ + blobclearlen > stoploc) {
235 DtSearchAddMessage (PROGNAME "242 Logical Error in database. "
236 "Object larger than stored size.");
237 free (usrblk.cleartext);
239 usrblk.retncode = OE_ABORT;
240 OE_flags |= OE_PERMERR;
244 /* Decode into clear text buffer */
245 hc_decode (src, targ, blobclearlen, usrblk.dblk->dbrec.or_hufid);
247 targ += blobclearlen;
249 /* free current blob, advance to next blob */
250 nextlptr = lptr->link; /* temp save next blob addr */
256 if (usrblk.debug & USRDBG_RETRVL)
257 fprintf (aa_stderr, PROGNAME "256 "
258 "oe_unblob: actual decompressed length = %ld.\n",
259 (long) (targ - (UCHAR *) usrblk.cleartext));
264 /************************************************/
268 /************************************************/
269 /* If AUDIT switch is turned on, saves query and start_time in saveusr
270 * for later printing when search process has completed.
272 static void save_query (char *prefix, time_t start_time)
274 char *src, *targ, *end;
276 if (saveusr.lastqry != NULL)
277 free (saveusr.lastqry);
278 saveusr.lastqry = austext_malloc (MAX_LASTQRY, PROGNAME "500", NULL);
280 /* First copy prefix and "=" */
281 targ = saveusr.lastqry;
287 /* Copy query after '=', replacing any ctrl chars
288 * with a displayable funny character (tilde ~).
290 if (usrblk.query == NULL)
291 strcpy (targ, catgets (dtsearch_catd, MS_misc, 1, "<null>"));
293 end = saveusr.lastqry + MAX_LASTQRY - 2;
295 while (*src != 0 && targ < end) {
303 saveusr.start_time = start_time;
308 /************************************************/
310 /* oe_write_audit_rec */
312 /************************************************/
313 /* Writes out audit data after uninterrupted completion of a search.
314 * Caller checks if AUDIT flag is on.
315 * Argument is number of hits (may or may not = dittocount).
316 * By convention, numhits = -1 means search was canceled by user,
317 * numhits = -2 means system canceled search.
318 * Requires various saveusr and usrblk fields to be correct.
320 void oe_write_audit_rec (long numhits)
322 char sprintbuf[1024];
326 if ((stream = fopen (OEF_audit, "a ")) == NULL)
327 /* the blank in "a " works around old aix bug */
329 sprintf (sprintbuf, catgets (dtsearch_catd, MS_misc, 1596,
330 PROGNAME "1596 Cannot open audit file %s: %s"),
331 OEF_audit, strerror (errno));
332 DtSearchAddMessage (sprintbuf);
333 OE_flags &= ~OE_AUDIT; /* don't try to audit anything else */
337 fprintf (stream, AUDIT_FORMAT "%s\n",
339 nowstring (&now_gmt),
340 now_gmt - saveusr.start_time, /* elapsed search time */
343 (saveusr.lastqry == NULL) ? \
344 catgets (dtsearch_catd, MS_misc, 1, "<null>") : saveusr.lastqry);
345 if (saveusr.lastqry != NULL) {
346 free (saveusr.lastqry);
347 saveusr.lastqry = NULL;
352 } /* oe_write_audit_rec() */
355 /************************************************/
359 /************************************************/
360 /* Returns FALSE if any keytype in usrblk.dblk is_selected.
361 * Otherwise appends an error msg, sets usrblk.retncode
362 * to OE_BAD_QUERY, and returns TRUE.
364 static int no_keytypes (void)
366 int i = usrblk.dblk->ktcount;
369 DtSrKeytype *keytypes = usrblk.dblk->keytypes;
371 if (keytypes[i].is_selected)
373 sprintf (sprintbuf, catgets (dtsearch_catd, MS_oe, 440,
374 PROGNAME "440 No record keytypes were selected in database '%s'."),
376 DtSearchAddMessage (sprintbuf);
377 usrblk.retncode = OE_BAD_QUERY;
379 } /* no_keytypes() */
382 /************************************************/
386 /************************************************/
387 /* Returns string identifier for OE_... request numbers for debugging */
388 static char *request_str (int reqnum)
390 static NUMSTR numstr[] = {
391 {OE_INITIALIZE, "INITIALIZE"}, /* 1 */
392 {OE_TEXT2FZKEY, "TEXT2FZKEY"}, /* 2 */
393 {OE_SRCH_FZKEY, "SRCH_FZKEY"}, /* 3 */
394 {OE_SRCH_STEMS, "SRCH_STEMS"}, /* 4 */
395 {OE_SRCH_WORDS, "SRCH_WORDS"}, /* 5 */
396 {OE_STOP_SRCH, "STOP_SRCH"}, /* 6 */
397 {OE_APPEND_NOTES, "APPEND_NOTES"}, /* 7 */
398 {OE_GETREC, "GETREC"}, /* 8 */
399 {OE_GETREC_STEMS, "GETREC_STEMS"}, /* 9 */
400 {OE_GETREC_WORDS, "GETREC_WORDS"}, /* 10 */
401 {OE_NEXT_DBA, "NEXT_DBA"}, /* 11 */
402 {OE_PREV_DBA, "PREV_DBA"}, /* 12 */
403 {OE_RECKEY2DBA, "RECKEY2DBA"}, /* 13 */
404 {OE_MARK_DELETION, "MARK_DELETION"}, /* 14 */
405 {OE_GETREC_DIC, "GETREC_DIC"}, /* 15 */
406 {OE_DITTO2KWIC, "DITTO2KWIC"}, /* 16 */
407 {OE_VALIDATE_PWD, "VALIDATE_PWD"}, /* 17 */
408 {OE_CHANGE_PWD, "CHANGE_PWD"}, /* 18 */
409 {OE_DELETE_RECID, "DELETE_RECID"}, /* 19 */
410 {OE_DELETE_BATCH, "DELETE_BATCH"}, /* 20 */
411 {OE_ASSIST, "ASSIST"}, /* 21 */
412 {OE_FINDSTR_REC, "FINDSTR_REC"}, /* 22 */
413 {OE_FINDSTR_HITL, "FINDSTR_HITL"}, /* 23 */
414 {OE_SRCH_STATISTICAL, "SRCH_STATISTICAL"}, /* 24 */
415 {OE_HILITE_STEMS, "HILITE_STEMS"}, /* 25 */
416 {OE_GET_EXPIRE, "GET_EXPIRE"}, /* 26 */
417 {OE_KILL, "KILL"}, /* 9997 */
418 {OE_PING, "PING"}, /* 9998 */
419 {OE_SHUTDOWN, "SHUTDOWN"}, /* 9999 */
422 NUMSTR *ptr = numstr;
424 while (reqnum != ptr->num && ptr->num != 0)
427 } /* request_str() */
430 /************************************************/
434 /************************************************/
435 /* Returns string identifier for OE_... retncode numbers for debugging */
436 char *retncode_str (int num)
438 static char buf [16];
439 static NUMSTR numstr[] = {
440 {OE_OK, "OE_OK"}, /* 1 */
441 {OE_REINIT, "OE_REINIT"}, /* 2 */
442 {OE_SEARCHING, "OE_SEARCHING"}, /* 3 */
443 {OE_BAD_DBLK, "OE_BAD_DBLK"}, /* 4 */
444 {OE_BAD_REQUEST,"OE_BAD_REQUEST"}, /* 5 */
445 {OE_BAD_QUERY, "OE_BAD_QUERY"}, /* 6 */
446 {OE_NOTAVAIL, "OE_NOTAVAIL"}, /* 7 */
447 {OE_TIMEOUT, "OE_TIMEOUT"}, /* 8 */
448 {OE_WRAPPED, "OE_WRAPPED"}, /* 9 */
449 {OE_SYSTEM_STOP,"OE_SYSTEM_STOP"}, /* 10 */
450 {OE_BAD_PASSWD, "OE_BAD_PASSWD"}, /* 11 */
451 {OE_BAD_HITLIST,"OE_BAD_HITLIST"}, /* 12 */
452 {OE_DISABLED, "OE_DISABLED"}, /* 13 */
453 {OE_USER_STOP, "OE_USER_STOP"}, /* 14 */
454 {OE_BAD_COMM, "OE_BAD_COMM"}, /* 15 */
455 {OE_NOOP, "OE_NOOP"}, /* 888 */
456 {OE_ABORT, "OE_ABORT"}, /* 999 */
459 NUMSTR *ptr = numstr;
461 while (num != ptr->num && ptr->num != 0)
464 sprintf (buf, "%d(?)", num);
466 } /* retncode_str() */
469 /************************************************/
473 /************************************************/
474 void Opera_Engine (void)
477 char sprintbuf [1024];
484 extern int database_has_changed (void);
486 time (&start_time); /* time that current call began */
488 if (usrblk.debug != 0L) {
489 if ((usrblk.debug & USRDBG_PARSE) != 0) {
490 debugging_jpn = TRUE;
491 debugging_teskey = TRUE;
494 * Place strings for 3 interesting time stamps at sprintbuf
495 * +0, +100, and +200.
497 strcpy (sprintbuf, nowstring (&start_time));
498 if (*OE_expiration != 0L)
499 strcpy (sprintbuf + 100, nowstring (OE_expiration));
501 strcpy (sprintbuf + 100, "0");
502 if (OE_sitecnfg_mtime != 0)
503 strcpy (sprintbuf + 200, nowstring (&OE_sitecnfg_mtime));
505 strcpy (sprintbuf + 200, "0");
507 "\n" PROGNAME "444 Opera_Engine Request %d (%s) at %s.\n"
508 " user='%s', usrblk.flags=%ld(x%04lx), usrblk.debug=%ld(x%04lx).\n"
509 " OE_flags=%ld(x%04lx), exp=%s, sitecnfg=%s.\n"
510 ,usrblk.request, request_str (usrblk.request), sprintbuf
511 ,usrblk.userid, usrblk.flags, usrblk.flags
512 ,usrblk.debug, usrblk.debug
513 ,OE_flags, OE_flags, sprintbuf + 100, sprintbuf + 200
516 for (db = usrblk.dblist; db != NULL; db = db->link) {
517 if (db == usrblk.dblk)
522 fprintf (aa_stderr, " dblk is %s\n",
523 (i) ? "INVALID!" : "null.");
525 fprintf (aa_stderr, " dblk #%d: name='%s', vistano=%d.\n"
526 ,i, usrblk.dblk->name, usrblk.dblk->vistano
531 /* Check if this copy of opera has expired.
532 * If *OE_expiration == 0, expiration checking disabled.
533 * If current time < expiration time, permit request.
534 * Otherwise disable this and all further requests.
537 if (*OE_expiration != 0L)
538 if (start_time > *OE_expiration)
541 if (OE_flags & OE_PERMERR) {
542 sprintf (sprintbuf, catgets (dtsearch_catd, MS_oe, 490,
543 PROGNAME "490 %s Engine permanently disabled."), OE_prodname);
544 DtSearchAddMessage (sprintbuf);
545 usrblk.retncode = OE_ABORT;
549 /* Ensure that the first call is always an OE_INITIALIZE call */
550 if ((usrblk.request != OE_INITIALIZE) && !(OE_flags & OE_INITOK)) {
551 DtSearchAddMessage (catgets (dtsearch_catd, MS_oe, 523,
552 PROGNAME "523 Request Denied: First request must "
553 "be Engine Initialization."));
554 usrblk.retncode = OE_NOOP;
558 /* Verify that none of the databases has changed since the last call. */
559 if (database_has_changed ())
562 /* Make usrblk ready. Basically ensure client side
563 * has not destroyed usrblk. Set OE_dbn to match user's dblk.
564 * The make-ready activity is not called for OE_INITIALIZE
565 * because the site's config file has not yet been called
566 * to create the OE's dblks.
568 if (usrblk.request != OE_INITIALIZE) {
569 /* Set OE_dbn to match selected dblk */
570 for ( db = usrblk.dblist, OE_dbn = 0;
572 db = db->link, OE_dbn++)
573 if (strcmp (usrblk.dblk->name, db->name) == 0)
576 sprintf (sprintbuf, catgets (dtsearch_catd, MS_oe, 48,
577 PROGNAME "48 Request Aborted: "
578 "'%s' database not available at this site."),
580 DtSearchAddMessage (sprintbuf);
581 usrblk.retncode = OE_ABORT;
582 OE_flags |= OE_PERMERR;
585 /* Override user switches if required by the engine */
586 if ((OE_flags & OE_NO_ITERATE) != 0)
587 usrblk.flags |= USR_NO_ITERATE;
590 /*----------------- BIG SWITCH ON REQUEST CODE ------------------*/
591 switch (usrblk.request) {
595 * Builds dittolist from query of stems/words +
596 * booleans. Swap stoplists to fool search functions.
601 (usrblk.request == OE_SRCH_WORDS)? 'W' : 'S';
602 if (OE_flags & OE_AUDIT)
603 save_query ("WORDS", start_time);
604 /****ve_word_search ();*****/
605 if (!boolean_parse()) {
606 usrblk.retncode = OE_BAD_QUERY;
610 if (usrblk.debug & USRDBG_SRCHCMPL)
611 print_stems (usrblk.stemcount, usrblk.stems, PROGNAME"637");
612 if (usrblk.debug & (USRDBG_SRCHCMPL | USRDBG_HITLIST))
613 print_dittolist (usrblk.dittolist, PROGNAME "657");
616 case OE_SRCH_STATISTICAL:
618 * Builds dittolist from query string of natural
619 * language text whose words cause statistical doc
624 if (OE_flags & OE_AUDIT)
625 save_query ("STAT", start_time);
627 if (usrblk.debug & USRDBG_SRCHCMPL)
628 print_stems (usrblk.stemcount, usrblk.stems,
629 PROGNAME"770 SRCH_STATISTICAL:");
630 if (usrblk.debug & (USRDBG_SRCHCMPL | USRDBG_HITLIST))
631 print_dittolist (usrblk.dittolist, PROGNAME "772");
634 case OE_HILITE_STEMS:
635 if (usrblk.debug & (USRDBG_RETRVL | USRDBG_HILITE)) {
636 fprintf (aa_stderr, PROGNAME "819 HILITE_STEMS: "
637 "srchtyp=%c clrln=%ld clrtxt='%.30s'\n",
638 usrblk.search_type, usrblk.clearlen,
639 NULLORSTR (usrblk.cleartext));
640 print_stems (usrblk.stemcount, usrblk.stems, " ");
642 if (usrblk.cleartext == NULL || usrblk.clearlen <= 0) {
645 PROGNAME "839 Client Error: No Text to highlight.");
646 usrblk.retncode = OE_BAD_QUERY;
649 if (usrblk.cleartext[0] == '\0')
651 if (usrblk.stemcount <= 0) {
652 DtSearchAddMessage (PROGNAME "846 Client Error: "
653 "Cannot highlight words, stemcount is zero.");
654 usrblk.retncode = OE_BAD_QUERY;
657 /* Subswitch: depending on request, load hitwords array */
658 switch (usrblk.search_type) {
669 PROGNAME "708 Word Highlighting is not available "
670 "for semantic searches.");
671 usrblk.retncode = OE_BAD_QUERY;
676 hilite_cleartext (i, (char *) usrblk.stems, usrblk.stemcount);
677 if (OE_flags & OE_PERMERR)
678 usrblk.retncode = OE_ABORT;
680 usrblk.retncode = OE_OK;
681 if (usrblk.debug & USRDBG_RETRVL) {
683 PROGNAME "820 HILITE_STEMS: hitwcount=%ld\n",
686 break; /* end OE_HILITE_STEMS */
690 /* interrupts long, ongoing search of database */
691 usrblk.flags |= USR_STOPSRCH;
692 usrblk.retncode = OE_OK;
697 case OE_GETREC_WORDS:
698 case OE_GETREC_STEMS:
701 * Retrieve database record, text blobs, notes, etc.
702 * Note that ve_getrec_dba() may return OE_OK even if
703 * there are no blobs. That will happen when it can
704 * return everything else about the record, but by
705 * design the text itself is not stored in the
706 * repository. In other words, no blobs is not an error
707 * so check if blobs were returned and adjust retncode
710 usrblk.retncode = ve_getrec_dba (&bloblist);
711 if (usrblk.retncode != OE_OK)
714 * If no text blobs, ensure cleartext and hitwords
715 * array are empty (which will cause OE_NOTAVAIL return
716 * below). Don't create a "no text" msg because many
717 * clients will want to retrieve the record text
718 * locally and they won't want an "error" msg
719 * cluttering up the msglist.
721 if (bloblist == NULL) {
723 if (usrblk.cleartext != NULL) {
724 free (usrblk.cleartext);
725 usrblk.cleartext = NULL;
730 * Otherwise if text blobs do exist, convert them into
731 * clear text and a hitwords array for hiliting.
734 usrblk.retncode = oe_unblob (bloblist);
735 if (usrblk.retncode != OE_OK)
738 /* Subswitch: depending on request, load hitwords array */
739 switch (usrblk.request) {
740 case OE_GETREC_WORDS:
741 hilite_cleartext ('W',
742 (char*) usrblk.stems, usrblk.stemcount);
745 case OE_GETREC_STEMS:
746 hilite_cleartext ('S',
747 (char*) usrblk.stems, usrblk.stemcount);
751 DtSearchAddMessage (PROGNAME "783 "
752 "Dictionary word hiliting function "
753 "is no longer supported.");
759 clear_hitwords (); /* ensure no hiliting */
760 } /* end hitwords subswitch */
762 #ifdef DUMP_HITWORDS /* dump the stems and hitwords arrays */
763 print_stems (usrblk.stemcount, usrblk.stems, "\nSTEMS:");
764 fprintf (aa_stderr, "HITWORDS: hitwcount = %d\n",
766 for (i = 0; i < usrblk.hitwcount; i++)
767 fprintf (aa_stderr, "offset = %4ld, len=%2d, '%.10s...'\n",
768 usrblk.hitwords[i].offset,
769 usrblk.hitwords[i].length,
770 usrblk.cleartext + usrblk.hitwords[i].offset);
772 } /* end if where blobs exist */
774 if (OE_flags & OE_PERMERR)
775 usrblk.retncode = OE_ABORT;
777 usrblk.retncode = ((usrblk.clearlen) ? OE_OK : OE_NOTAVAIL);
778 if (usrblk.debug & USRDBG_RETRVL)
779 print_usrblk_record (PROGNAME "957 final: ");
781 break; /* end cases OE_GETREC... */
786 * increments dba address field (not associated with
794 * decrements dba address field (not associated with
800 case OE_APPEND_NOTES:
801 /* appends user notes to record at dba */
802 usrblk.retncode = ve_append_notes ();
806 /* converts vista record key to database address */
807 usrblk.dba = ve_reckey2dba ();
808 if ((usrblk.debug & USRDBG_DELETE) != 0L)
809 fprintf (aa_stderr, PROGNAME "1089 RECKEY2DBA: "
810 "retncode=%d, reckey='%s' ->\tdba=%ld:%ld\n",
811 usrblk.retncode, usrblk.query,
812 (long) ((usrblk.dba) >> 24), (long) ((usrblk.dba) & 0xffffff));
815 case OE_DELETE_RECID:
817 * First converts recid to a db address. Then deletes
818 * entire record: blobs, notes, and words. Presumes
819 * only 2 retncodes from reckey2dba are OK and WRAPPED.
822 dba = ve_reckey2dba ();
823 if (usrblk.retncode != OE_OK) {
824 usrblk.retncode = OE_NOTAVAIL;
828 usrblk.dbatab = &usrblk.dba;
833 case OE_DELETE_BATCH:
834 /* deletes all records in a table of dba's */
840 * first call from UI. returns info used to build
847 usrblk.dba = *OE_expiration;
848 usrblk.retncode = OE_OK;
852 /* Null function. Just does REINIT checks etc. */
853 usrblk.retncode = OE_OK;
858 case OE_VALIDATE_PWD:
860 /* These functions are obsolete and harmless */
861 usrblk.retncode = OE_OK;
865 case OE_FINDSTR_HITL:
867 /* These functions are just obsolete */
869 PROGNAME"1027: User Interface Error. "
870 "%d is obsolete request code.\n",
872 DtSearchAddMessage (sprintbuf);
873 usrblk.retncode = OE_BAD_REQUEST;
877 sprintf (sprintbuf, catgets (dtsearch_catd, MS_oe, 367,
878 PROGNAME "367: User Interface Error. "
879 "%d is invalid request code.\n"),
881 DtSearchAddMessage (sprintbuf);
882 usrblk.retncode = OE_BAD_REQUEST;
888 if (usrblk.debug != 0L) {
889 if (!DtSearchHasMessages())
890 fprintf (aa_stderr, PROGNAME"998 Msglist is empty.\n");
893 "mmmmmmmmmm Msglist mmmmmmmmm\n%s\n"
894 "mmmmmmmmmmmmmmmmmmmmmmmmmmmm\n",
895 DtSearchGetMessages());
897 fprintf (aa_stderr, PROGNAME "999 usrblk.retncode = %d (%s).\n",
898 usrblk.retncode, retncode_str (usrblk.retncode));
902 } /* Opera_Engine() */
904 /******************************* DTOE.C ********************************/