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 librararies 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
32 * (C) COPYRIGHT International Business Machines Corp. 1994,1995
34 * Licensed Materials - Property of IBM
35 * US Government Users Restricted Rights - Use, duplication or
36 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
38 /************************* DTSRDBREC.C **************************
39 * $XConsortium: dtsrdbrec.c /main/6 1996/08/12 12:18:12 cde-ibm $
41 * Prints out data in a dbrec system record in human readable form.
44 * Revision 2.4 1996/02/01 18:18:18 miker
45 * Added DtSrLaJPN2. Deleted BETA definition.
47 * Revision 2.3 1995/10/25 19:49:12 miker
48 * Renamed from dbrec.c. Added prolog.c.
51 * Revision 2.2 1995/10/19 20:31:07 miker
52 * No longer necessary to rename d00 file.
53 * Database files may be read-only.
55 * Revision 2.1 1995/09/22 19:34:56 miker
56 * Freeze DtSearch 0.1, AusText 2.1.8
58 * Revision 1.12 1995/09/19 21:51:43 miker
59 * ifdef DTSEARCH, use DtSrVERSION instead of AUSAPI_VERSION in banner.
61 * Revision 1.11 1995/08/31 22:24:50 miker
62 * Added report of or_language and other minor changes for DtSearch.
63 * DtSearch executable (without semantic report) renamed dtsrdbrec.
67 #define PROGNAME "DTSRDBREC"
71 /**#define MAIN_PROGRAM ***/
73 /************************************************/
77 /************************************************/
78 static char *language_name (int language_number)
80 switch (language_number) {
81 case DtSrLaENG: return "ENGLISH (ASCII)";
82 case DtSrLaENG2: return "ENGLISH (ISO Latin-1)";
83 case DtSrLaESP: return "SPANISH";
84 case DtSrLaFRA: return "FRENCH";
85 case DtSrLaITA: return "ITALIAN";
86 case DtSrLaDEU: return "GERMAN";
87 case DtSrLaJPN: return "JAPANESE (AUTO COMPOUNDS)";
88 case DtSrLaJPN2: return "JAPANESE (COMPOUNDS FROM LIST)";
89 default: return "USER DEFINED LANGUAGE";
93 /************************************************/
97 /************************************************/
98 void print_dbrec (char *dbname, struct or_dbrec * dbrec)
102 int blobs_are_possible = FALSE;
104 printf (catgets (dtsearch_catd, MS_dbrec, 1,
105 "---------- System Values for Database '%s' ----------\n"),
107 printf (catgets (dtsearch_catd, MS_dbrec, 2,
108 "Schema version number (version) is '%s'.\n"),
111 printf (catgets (dtsearch_catd, MS_dbrec, 3,
112 "Maximum object key size (sizeof(objkey)) is %ld bytes.\n"),
114 if (ORD_USEHUGEKEYS & dbrec->or_dbflags)
115 printf (catgets (dtsearch_catd, MS_dbrec, 4,
116 "Optional 'Huge' keys enabled.\n"));
118 printf (catgets (dtsearch_catd, MS_dbrec, 12,
119 "Maximum length of an abstract string (abstrsz) is %d.\n"),
121 if (dbrec->or_abstrsz == 0)
122 puts (catgets (dtsearch_catd, MS_dbrec, 14,
123 " (Abstracts are not used in this database)."));
126 * if they CAN be compressed, say whether or not they
129 if (dbrec->or_hufid != 0L)
130 printf (catgets (dtsearch_catd, MS_dbrec, 20,
131 "Abstracts are %scompressed.\n"),
132 (ORC_COMPABSTR & dbrec->or_compflags) ? "" : "not ");
135 printf (catgets (dtsearch_catd, MS_dbrec, 22,
136 "Parsing language is number %d, %s.\n"),
137 dbrec->or_language, language_name(dbrec->or_language));
139 printf (catgets (dtsearch_catd, MS_dbrec, 24,
140 "Minimum word length (minwordsz) is %d.\n"),
141 dbrec->or_minwordsz);
143 printf (catgets (dtsearch_catd, MS_dbrec, 26,
144 "Maximum word length (maxwordsz) is %d.\n"),
145 dbrec->or_maxwordsz);
147 printf (catgets (dtsearch_catd, MS_dbrec, 30,
148 "Number of .d00 slots per object (recslots) is %d.\n"),
151 printf (catgets (dtsearch_catd, MS_dbrec, 36,
152 " (Maximum number of database objects is %ld).\n"),
153 0xffffffL / (long) dbrec->or_recslots);
155 printf (catgets (dtsearch_catd, MS_dbrec, 40,
156 "Huffman compression table id (hufid) is %ld.\n"),
158 if (dbrec->or_hufid == 0L)
159 puts (catgets (dtsearch_catd, MS_dbrec, 42,
160 " (Compression is disabled in this database)."));
161 if (dbrec->or_hufid == -1L)
162 puts (catgets (dtsearch_catd, MS_dbrec, 44,
163 " (Specific compression table is not yet determined)."));
165 blobs_are_possible = FALSE;
166 switch (dbrec->or_dbaccess) {
168 puts (catgets (dtsearch_catd, MS_dbrec, 50,
169 "Engine accessibility to data may vary from object to object."));
170 blobs_are_possible = TRUE;
173 puts (catgets (dtsearch_catd, MS_dbrec, 54,
174 "Data objects are not directly accessible from the engine."));
177 puts (catgets (dtsearch_catd, MS_dbrec, 56,
178 "Data objects are stored internally as blobs."));
179 blobs_are_possible = TRUE;
182 puts (catgets (dtsearch_catd, MS_dbrec, 60,
183 "Only server file references to objects are stored in the blobs."));
186 puts (catgets (dtsearch_catd, MS_dbrec, 64,
187 "Only client file references to objects are stored in the blobs."));
190 puts (catgets (dtsearch_catd, MS_dbrec, 68,
191 "Object keys are server file references to the objects."));
194 puts (catgets (dtsearch_catd, MS_dbrec, 72,
195 "Object keys are client file references to the objects."));
198 puts (catgets (dtsearch_catd, MS_dbrec, 74,
199 "Server file references to objects are "
200 "stored in the 'huge' keys."));
203 puts (catgets (dtsearch_catd, MS_dbrec, 80,
204 "Server file references to objects are stored in the abstracts."));
207 puts (catgets (dtsearch_catd, MS_dbrec, 86,
208 "Client file references to objects are stored in the abstracts."));
211 printf (catgets (dtsearch_catd, MS_dbrec, 90,
212 "Error: meaning of or_dbaccess value (%hd) is unknown.\n"),
214 blobs_are_possible = TRUE;
216 } /* end or_dbaccess switch */
218 if (blobs_are_possible) {
220 * if they CAN be compressed, say whether or not they
223 if (dbrec->or_hufid != 0L)
224 printf (catgets (dtsearch_catd, MS_dbrec, 100,
225 "Repository blobs are %scompressed.\n"),
226 (ORC_COMPBLOB & dbrec->or_compflags) ? "" : "not ");
229 puts (catgets (dtsearch_catd, MS_dbrec, 110,
230 "Repository blobs are not used in this database."));
232 printf (catgets (dtsearch_catd, MS_dbrec, 120,
233 "Database switches (dbflags) are 0x%lx:\n"),
236 printf (catgets (dtsearch_catd, MS_dbrec, 130,
237 " Inverted index %s words exactly as parsed.\n"),
238 (ORD_XWORDS & dbrec->or_dbflags) ?
239 catgets (dtsearch_catd, MS_dbrec, 124, "INCLUDES") :
240 catgets (dtsearch_catd, MS_dbrec, 125, "EXCLUDES"));
242 printf (catgets (dtsearch_catd, MS_dbrec, 140,
243 " Inverted index %s word stems.\n"),
244 (ORD_XSTEMS & dbrec->or_dbflags) ?
245 catgets (dtsearch_catd, MS_dbrec, 124, "INCLUDES") :
246 catgets (dtsearch_catd, MS_dbrec, 125, "EXCLUDES"));
248 printf (catgets (dtsearch_catd, MS_dbrec, 160,
249 " Use of optional 'huge' keys is %s.\n"),
250 (ORD_USEHUGEKEYS & dbrec->or_dbflags) ?
251 catgets (dtsearch_catd, MS_dbrec, 126, "ENABLED") :
252 catgets (dtsearch_catd, MS_dbrec, 127, "DISABLED"));
254 printf (catgets (dtsearch_catd, MS_dbrec, 162,
255 " Mark-for-deletion is %s.\n"),
256 (ORD_NOMARKDEL & dbrec->or_dbflags) ?
257 catgets (dtsearch_catd, MS_dbrec, 127, "DISABLED") :
258 catgets (dtsearch_catd, MS_dbrec, 126, "ENABLED"));
260 printf (catgets (dtsearch_catd, MS_dbrec, 164,
261 " Appendable user notes are %s.\n"),
262 (ORD_NONOTES & dbrec->or_dbflags) ?
263 catgets (dtsearch_catd, MS_dbrec, 127, "DISABLED") :
264 catgets (dtsearch_catd, MS_dbrec, 126, "ENABLED"));
266 printf (catgets (dtsearch_catd, MS_dbrec, 170,
267 " Text characters are %s wide.\n"),
268 (ORD_WIDECHAR & dbrec->or_dbflags) ?
269 catgets (dtsearch_catd, MS_dbrec, 172, "MULTIPLE bytes") :
270 catgets (dtsearch_catd, MS_dbrec, 174, "a SINGLE byte"));
272 printf (catgets (dtsearch_catd, MS_dbrec, 200,
273 "Current number of database objects (reccount) is %ld.\n"),
276 printf (catgets (dtsearch_catd, MS_dbrec, 210,
277 "Last currently used slot number (maxdba) is %ld.\n"),
280 for (i = 58; i > 0; i--)
284 } /* print_dbrec() */
291 /************************************************/
295 /************************************************/
296 int main (int argc, char *argv[])
298 struct or_dbrec dbrec;
303 setlocale (LC_ALL, "");
304 dtsearch_catd = catopen (FNAME_DTSRCAT, 0);
305 austools_catd = catopen (FNAME_AUSCAT, 0);
308 strftime (renamebuf, sizeof (renamebuf),
309 catgets (dtsearch_catd, MS_misc, 22, "%A, %b %d %Y, %I:%M %p"),
311 printf (catgets (dtsearch_catd, MS_misc, 23,
312 "%s: Version %s. Run %s.\n"),
318 printf (catgets (dtsearch_catd, MS_dbrec, 310,
319 "USAGE: %s <dbname>\n"), aa_argv0);
322 sprintf (renamebuf, "%s.d00", argv[1]);
323 db_oflag = O_RDONLY; /* db files may be read-only */
324 d_open (argv[1], "o");
325 if (db_status != S_OKAY) {
326 printf (catgets (dtsearch_catd, MS_dbrec, 330,
327 "Could not open '%s' database.\n%s\n"),
328 argv[1], vista_msg(PROGNAME"293"));
331 d_recfrst (OR_DBREC, 0);
332 if (db_status != S_OKAY) {
333 printf (catgets (dtsearch_catd, MS_dbrec, 340,
334 "No dbrec record in database '%s'.\n"),
338 d_recread (&dbrec, 0);
339 if (db_status != S_OKAY) {
340 printf (catgets (dtsearch_catd, MS_dbrec, 350,
341 "Can't read dbrec record in database '%s'.\n%s\n"),
342 argv[1], vista_msg(PROGNAME"306"));
345 swab_dbrec (&dbrec, NTOH);
346 print_dbrec (argv[1], &dbrec);
352 /************************* DTSRDBREC.C **************************/