SrchInit.sgm 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <!-- $XConsortium: dtsrinit.sgm 1996 -->
  2. <!-- (c) Copyright 1995 Digital Equipment Corporation. -->
  3. <!-- (c) Copyright 1995 Hewlett-Packard Company. -->
  4. <!-- (c) Copyright 1995 International Business Machines Corp. -->
  5. <!-- (c) Copyright 1995 Sun Microsystems, Inc. -->
  6. <!-- (c) Copyright 1995 Novell, Inc. -->
  7. <!-- (c) Copyright 1995 FUJITSU LIMITED. -->
  8. <!-- (c) Copyright 1995 Hitachi. -->
  9. <![ %CDE.C.CDE; [<refentry id="CDE.SEARCH.DtSearchInit">]]>
  10. <refmeta><refentrytitle>DtSearchInit</refentrytitle>
  11. <manvolnum>library call</manvolnum></refmeta>
  12. <refnamediv>
  13. <refname><function>DtSearchInit</function></refname>
  14. <refpurpose>Initialize
  15. the DtSearch online API for subsequent calls</refpurpose>
  16. </refnamediv>
  17. <refsynopsisdiv>
  18. <funcsynopsis>
  19. <funcsynopsisinfo>#include &lt;Dt/Search.h></funcsynopsisinfo>
  20. <funcdef>int <function>DtSearchInit</function></funcdef>
  21. <paramdef>void <parameter>*argv0</parameter></paramdef>
  22. <paramdef>char <parameter>*userid</parameter></paramdef>
  23. <paramdef>long <parameter>switches</parameter></paramdef>
  24. <paramdef>char <parameter>*ocf_file</parameter></paramdef>
  25. <paramdef>FILE <parameter>*err_file</parameter></paramdef>
  26. <paramdef>char <parameter>***dbnames</parameter></paramdef>
  27. <paramdef>int <parameter>*dbcount</parameter></paramdef>
  28. </funcsynopsis></refsynopsisdiv><refsect1>
  29. <title>DESCRIPTION</title>
  30. <para><function>DtSearchInit</function> opens databases and other files and
  31. initializes the search engine API for subsequent requests. It must be
  32. the first online DtSearch function called.
  33. </para>
  34. <para><function>DtSearchInit</function> may be called only once, although
  35. <function>DtSrReinit</function> may be called at any time after
  36. <function>DtSearchInit</function>.
  37. </para>
  38. <para>If this function fails, the caller should display the MessageList returned
  39. and exit; no subsequent requests will be possible.
  40. </para>
  41. </refsect1>
  42. <refsect1>
  43. <title>ARGUMENTS</title>
  44. <variablelist>
  45. <varlistentry><term><symbol role="Variable">argv0</symbol></term>
  46. <listitem>
  47. <para>Specifies the program name to be assembled into usage, error, and debug
  48. messages from the API. It is intended to be the value of
  49. <symbol role="Variable">argv[0]</symbol> from <literal>main</literal>.
  50. </para>
  51. </listitem>
  52. </varlistentry>
  53. <varlistentry><term><symbol role="Variable">userid</symbol></term>
  54. <listitem>
  55. <para>Specifies a 1- to 8-character name to use for log messages to distinguish between
  56. users and applications where multiple copies of the engine are running.
  57. </para>
  58. <para>If NULL, the first 8 characters of the <systemitem class="environvar">LOGNAME</systemitem> environment variable are used.
  59. </para>
  60. </listitem>
  61. </varlistentry>
  62. <varlistentry><term><symbol role="Variable">switches</symbol></term>
  63. <listitem>
  64. <para>Specifies a set of bit switches used principally to enable printing debugging
  65. statements and controlling <function>signal</function> registration.
  66. </para>
  67. <variablelist>
  68. <varlistentry><term><Symbol>DtSrInNOLOCALE</Symbol></term>
  69. <listitem>
  70. <para>Do not execute <function>setlocale</function> within <function>DtSearchInit</function>.
  71. </para>
  72. </listitem>
  73. </varlistentry>
  74. <varlistentry><term><Symbol>DtSrInSIGNAL</Symbol></term>
  75. <listitem>
  76. <para>Register DtSearch abort signal handlers.
  77. </para>
  78. </listitem>
  79. </varlistentry>
  80. <varlistentry><term><Symbol>DtSrInENAB_NOHUP</Symbol></term>
  81. <listitem>
  82. <para>Reenable NOHUP for offline background programs. This is also the normal
  83. action unless <Symbol>DtSrInSIGNAL</Symbol> has been specified, in
  84. which case normal action is to abort on <Symbol>SIGHUP</Symbol>
  85. signal.
  86. </para>
  87. </listitem>
  88. </varlistentry>
  89. <varlistentry><term><Symbol>DtSrInIDEBUG</Symbol></term>
  90. <listitem>
  91. <para>Writes initialization trace messages
  92. to <symbol role="Variable">err_file</symbol>.
  93. </para>
  94. </listitem>
  95. </varlistentry>
  96. <varlistentry><term><Symbol>DtSrInSDEBUG</Symbol></term>
  97. <listitem>
  98. <para>Writes query and search trace messages
  99. to <symbol role="Variable">err_file</symbol>.
  100. </para>
  101. </listitem>
  102. </varlistentry>
  103. <varlistentry><term><Symbol>DtSrInRDEBUG</Symbol></term>
  104. <listitem>
  105. <para>Writes document retrieval trace messages
  106. to <symbol role="Variable">err_file</symbol>.
  107. </para>
  108. </listitem>
  109. </varlistentry>
  110. <varlistentry><term><Symbol>DtSrInANY_DEBUG</Symbol></term>
  111. <listitem>
  112. <para>Equivalent to (<Symbol>DtSrInIDEBUG</Symbol> | <Symbol>DtSrInSDEBUG</Symbol> |<Symbol>DtSrInRDEBUG</Symbol>)
  113. </para>
  114. </listitem>
  115. </varlistentry>
  116. <varlistentry><term><Symbol>DtSrInRDWR</Symbol></term>
  117. <listitem>
  118. <para>Opens database files for both read
  119. and write. The default is read-only.
  120. </para>
  121. </listitem>
  122. </varlistentry>
  123. </variablelist>
  124. <para>For example, to enable trace statements only for search and retrieval
  125. operations, pass <symbol role="Variable">switches</symbol> as (<Symbol>DtSrInSDEBUG</Symbol> | <Symbol>DtSrInRDEBUG</Symbol>). Pass zero for <symbol role="Variable">switches</symbol> for most normal API operations.</para>
  126. </listitem>
  127. </varlistentry>
  128. <varlistentry><term><symbol role="Variable">ocf_file</symbol></term>
  129. <listitem>
  130. <para>Specifies the fully qualified path and base file name of the API ocf configuration
  131. file. If NULL, the initialization function looks for an <filename>ocf</filename>
  132. file with a base name of either <filename>dtsearch.ocf</filename> or
  133. <filename>austext.ocf</filename> in the directory specified by the <systemitem class="environvar">DTSROCFPATH</systemitem> environment variable, in the current working directory,
  134. or in the HOME directory, in that order. See &cdeman.dtsrocffile; for the format
  135. of an ocf file.</para>
  136. </listitem>
  137. </varlistentry>
  138. <varlistentry><term><symbol role="Variable">err_file</symbol></term>
  139. <listitem>
  140. <para>Specifies a pointer to a previously opened text stream file where the API will write
  141. fatal error and debug trace messages. The normal value passed for
  142. <symbol role="Variable">err_file</symbol> is NULL, in which case such messages will
  143. be written to <filename>stderr</filename>.</para>
  144. </listitem>
  145. </varlistentry>
  146. <varlistentry><term><symbol role="Variable">dbnames</symbol></term>
  147. <listitem>
  148. <para>Specifies an address where a pointer to an array of static database name string
  149. pointers will be placed. Each string identifies a single database successfully
  150. opened by this function.
  151. </para>
  152. <para>A database name string from this array will be used in most later API
  153. function calls.</para>
  154. <para>The <symbol role="Variable">dbn</symbol> member in
  155. <structname>DtSrResult</structname> is an index into this array.
  156. </para>
  157. </listitem>
  158. </varlistentry>
  159. <varlistentry><term><symbol role="Variable">dbcount</symbol></term>
  160. <listitem>
  161. <para>Specifies a pointer to the <StructName Role="typedef">int</StructName> where the size of the
  162. <symbol role="Variable">dbnames</symbol> array will be stored.
  163. </para>
  164. </listitem>
  165. </varlistentry>
  166. </variablelist>
  167. </refsect1><refsect1>
  168. <title>RETURN VALUE</title>
  169. <para><function>DtSearchInit</function> returns <systemitem class="constant">DtSrOK</systemitem>, and possible messages on the
  170. MessageList, if the API is successfully initialized. It returns
  171. <systemitem class="constant">DtSrFAIL</systemitem> and messages on the
  172. MessageList if the API cannot be successfully initialized.
  173. </para>
  174. </refsect1><refsect1>
  175. <title>ENVIRONMENT VARIABLES</title>
  176. <variablelist>
  177. <varlistentry><term><systemitem class="environvar">LOGNAME</systemitem></term>
  178. <listitem>
  179. <para>First 8 characters are used for <symbol role="Variable">userid</symbol>
  180. if that argument is not passed.
  181. </para>
  182. </listitem>
  183. </varlistentry>
  184. <varlistentry><term><systemitem class="environvar">DTSROCFPATH</systemitem></term>
  185. <listitem>
  186. <para>Specifies a directory where the API
  187. configuration <filename>ocf</filename> file may be located. Used in lieu
  188. of specifying the <symbol role="Variable">ocf_file</symbol> argument.
  189. </para>
  190. </listitem>
  191. </varlistentry>
  192. <varlistentry><term><systemitem class="environvar">HOME</systemitem></term>
  193. <listitem>
  194. <para>Specifies an alternative directory
  195. in which to look for the ocf file if the <symbol role="Variable">ocf_file</symbol>
  196. argument is not passed, if the <systemitem class="environvar">DTSROCFPATH</systemitem> environment variable is not specified, or if the ocf file is
  197. not found either in the <systemitem class="environvar">DTSROCFPATH</systemitem>
  198. directory or in the current working directory.
  199. </para>
  200. </listitem>
  201. </varlistentry>
  202. </variablelist>
  203. </refsect1>
  204. <refsect1>
  205. <title>SEE ALSO</title>
  206. <para>&cdeman.DtSrAPI;,
  207. &cdeman.DtSearchReinit;,
  208. &cdeman.DtSearchGetMessages;,
  209. &cdeman.dtsrocffile;,
  210. &cdeman.DtSearch;
  211. </para>
  212. </refsect1></refentry>