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/8 1996/11/21 19:49:44 drk $
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 XOS_USE_NO_LOCKING
68 #define X_INCLUDE_TIME_H
69 #include <X11/Xos_r.h>
71 #define PROGNAME "DTSRDBREC"
75 /**#define MAIN_PROGRAM ***/
77 /************************************************/
81 /************************************************/
82 static char *language_name (int language_number)
84 switch (language_number) {
85 case DtSrLaENG: return "ENGLISH (ASCII)";
86 case DtSrLaENG2: return "ENGLISH (ISO Latin-1)";
87 case DtSrLaESP: return "SPANISH";
88 case DtSrLaFRA: return "FRENCH";
89 case DtSrLaITA: return "ITALIAN";
90 case DtSrLaDEU: return "GERMAN";
91 case DtSrLaJPN: return "JAPANESE (AUTO COMPOUNDS)";
92 case DtSrLaJPN2: return "JAPANESE (COMPOUNDS FROM LIST)";
93 default: return "USER DEFINED LANGUAGE";
97 /************************************************/
101 /************************************************/
102 void print_dbrec (char *dbname, struct or_dbrec * dbrec)
106 int blobs_are_possible = FALSE;
108 printf (catgets (dtsearch_catd, MS_dbrec, 1,
109 "---------- System Values for Database '%s' ----------\n"),
111 printf (catgets (dtsearch_catd, MS_dbrec, 2,
112 "Schema version number (version) is '%s'.\n"),
115 printf (catgets (dtsearch_catd, MS_dbrec, 3,
116 "Maximum object key size (sizeof(objkey)) is %ld bytes.\n"),
118 if (ORD_USEHUGEKEYS & dbrec->or_dbflags)
119 printf (catgets (dtsearch_catd, MS_dbrec, 4,
120 "Optional 'Huge' keys enabled.\n"));
122 printf (catgets (dtsearch_catd, MS_dbrec, 12,
123 "Maximum length of an abstract string (abstrsz) is %d.\n"),
125 if (dbrec->or_abstrsz == 0)
126 puts (catgets (dtsearch_catd, MS_dbrec, 14,
127 " (Abstracts are not used in this database)."));
130 * if they CAN be compressed, say whether or not they
133 if (dbrec->or_hufid != 0L)
134 printf (catgets (dtsearch_catd, MS_dbrec, 20,
135 "Abstracts are %scompressed.\n"),
136 (ORC_COMPABSTR & dbrec->or_compflags) ? "" : "not ");
139 printf (catgets (dtsearch_catd, MS_dbrec, 22,
140 "Parsing language is number %d, %s.\n"),
141 dbrec->or_language, language_name(dbrec->or_language));
143 printf (catgets (dtsearch_catd, MS_dbrec, 24,
144 "Minimum word length (minwordsz) is %d.\n"),
145 dbrec->or_minwordsz);
147 printf (catgets (dtsearch_catd, MS_dbrec, 26,
148 "Maximum word length (maxwordsz) is %d.\n"),
149 dbrec->or_maxwordsz);
151 printf (catgets (dtsearch_catd, MS_dbrec, 30,
152 "Number of .d00 slots per object (recslots) is %d.\n"),
155 printf (catgets (dtsearch_catd, MS_dbrec, 36,
156 " (Maximum number of database objects is %ld).\n"),
157 0xffffffL / (long) dbrec->or_recslots);
159 printf (catgets (dtsearch_catd, MS_dbrec, 40,
160 "Huffman compression table id (hufid) is %ld.\n"),
162 if (dbrec->or_hufid == 0L)
163 puts (catgets (dtsearch_catd, MS_dbrec, 42,
164 " (Compression is disabled in this database)."));
165 if (dbrec->or_hufid == -1L)
166 puts (catgets (dtsearch_catd, MS_dbrec, 44,
167 " (Specific compression table is not yet determined)."));
169 blobs_are_possible = FALSE;
170 switch (dbrec->or_dbaccess) {
172 puts (catgets (dtsearch_catd, MS_dbrec, 50,
173 "Engine accessibility to data may vary from object to object."));
174 blobs_are_possible = TRUE;
177 puts (catgets (dtsearch_catd, MS_dbrec, 54,
178 "Data objects are not directly accessible from the engine."));
181 puts (catgets (dtsearch_catd, MS_dbrec, 56,
182 "Data objects are stored internally as blobs."));
183 blobs_are_possible = TRUE;
186 puts (catgets (dtsearch_catd, MS_dbrec, 60,
187 "Only server file references to objects are stored in the blobs."));
190 puts (catgets (dtsearch_catd, MS_dbrec, 64,
191 "Only client file references to objects are stored in the blobs."));
194 puts (catgets (dtsearch_catd, MS_dbrec, 68,
195 "Object keys are server file references to the objects."));
198 puts (catgets (dtsearch_catd, MS_dbrec, 72,
199 "Object keys are client file references to the objects."));
202 puts (catgets (dtsearch_catd, MS_dbrec, 74,
203 "Server file references to objects are "
204 "stored in the 'huge' keys."));
207 puts (catgets (dtsearch_catd, MS_dbrec, 80,
208 "Server file references to objects are stored in the abstracts."));
211 puts (catgets (dtsearch_catd, MS_dbrec, 86,
212 "Client file references to objects are stored in the abstracts."));
215 printf (catgets (dtsearch_catd, MS_dbrec, 90,
216 "Error: meaning of or_dbaccess value (%hd) is unknown.\n"),
218 blobs_are_possible = TRUE;
220 } /* end or_dbaccess switch */
222 if (blobs_are_possible) {
224 * if they CAN be compressed, say whether or not they
227 if (dbrec->or_hufid != 0L)
228 printf (catgets (dtsearch_catd, MS_dbrec, 100,
229 "Repository blobs are %scompressed.\n"),
230 (ORC_COMPBLOB & dbrec->or_compflags) ? "" : "not ");
233 puts (catgets (dtsearch_catd, MS_dbrec, 110,
234 "Repository blobs are not used in this database."));
236 printf (catgets (dtsearch_catd, MS_dbrec, 120,
237 "Database switches (dbflags) are 0x%lx:\n"),
240 printf (catgets (dtsearch_catd, MS_dbrec, 130,
241 " Inverted index %s words exactly as parsed.\n"),
242 (ORD_XWORDS & dbrec->or_dbflags) ?
243 catgets (dtsearch_catd, MS_dbrec, 124, "INCLUDES") :
244 catgets (dtsearch_catd, MS_dbrec, 125, "EXCLUDES"));
246 printf (catgets (dtsearch_catd, MS_dbrec, 140,
247 " Inverted index %s word stems.\n"),
248 (ORD_XSTEMS & dbrec->or_dbflags) ?
249 catgets (dtsearch_catd, MS_dbrec, 124, "INCLUDES") :
250 catgets (dtsearch_catd, MS_dbrec, 125, "EXCLUDES"));
252 printf (catgets (dtsearch_catd, MS_dbrec, 160,
253 " Use of optional 'huge' keys is %s.\n"),
254 (ORD_USEHUGEKEYS & dbrec->or_dbflags) ?
255 catgets (dtsearch_catd, MS_dbrec, 126, "ENABLED") :
256 catgets (dtsearch_catd, MS_dbrec, 127, "DISABLED"));
258 printf (catgets (dtsearch_catd, MS_dbrec, 162,
259 " Mark-for-deletion is %s.\n"),
260 (ORD_NOMARKDEL & dbrec->or_dbflags) ?
261 catgets (dtsearch_catd, MS_dbrec, 127, "DISABLED") :
262 catgets (dtsearch_catd, MS_dbrec, 126, "ENABLED"));
264 printf (catgets (dtsearch_catd, MS_dbrec, 164,
265 " Appendable user notes are %s.\n"),
266 (ORD_NONOTES & dbrec->or_dbflags) ?
267 catgets (dtsearch_catd, MS_dbrec, 127, "DISABLED") :
268 catgets (dtsearch_catd, MS_dbrec, 126, "ENABLED"));
270 printf (catgets (dtsearch_catd, MS_dbrec, 170,
271 " Text characters are %s wide.\n"),
272 (ORD_WIDECHAR & dbrec->or_dbflags) ?
273 catgets (dtsearch_catd, MS_dbrec, 172, "MULTIPLE bytes") :
274 catgets (dtsearch_catd, MS_dbrec, 174, "a SINGLE byte"));
276 printf (catgets (dtsearch_catd, MS_dbrec, 200,
277 "Current number of database objects (reccount) is %ld.\n"),
280 printf (catgets (dtsearch_catd, MS_dbrec, 210,
281 "Last currently used slot number (maxdba) is %ld.\n"),
284 for (i = 58; i > 0; i--)
288 } /* print_dbrec() */
295 /************************************************/
299 /************************************************/
300 int main (int argc, char *argv[])
302 struct or_dbrec dbrec;
306 _Xltimeparams localtime_buf;
309 setlocale (LC_ALL, "");
310 dtsearch_catd = catopen (FNAME_DTSRCAT, 0);
311 austools_catd = catopen (FNAME_AUSCAT, 0);
314 time_ptr = _XLocaltime(&now, localtime_buf);
315 strftime (renamebuf, sizeof (renamebuf),
316 catgets (dtsearch_catd, MS_misc, 22, "%A, %b %d %Y, %I:%M %p"),
318 printf (catgets (dtsearch_catd, MS_misc, 23,
319 "%s: Version %s. Run %s.\n"),
325 printf (catgets (dtsearch_catd, MS_dbrec, 310,
326 "USAGE: %s <dbname>\n"), aa_argv0);
329 sprintf (renamebuf, "%s.d00", argv[1]);
330 db_oflag = O_RDONLY; /* db files may be read-only */
331 d_open (argv[1], "o");
332 if (db_status != S_OKAY) {
333 printf (catgets (dtsearch_catd, MS_dbrec, 330,
334 "Could not open '%s' database.\n%s\n"),
335 argv[1], vista_msg(PROGNAME"293"));
338 d_recfrst (OR_DBREC, 0);
339 if (db_status != S_OKAY) {
340 printf (catgets (dtsearch_catd, MS_dbrec, 340,
341 "No dbrec record in database '%s'.\n"),
345 d_recread (&dbrec, 0);
346 if (db_status != S_OKAY) {
347 printf (catgets (dtsearch_catd, MS_dbrec, 350,
348 "Can't read dbrec record in database '%s'.\n%s\n"),
349 argv[1], vista_msg(PROGNAME"306"));
352 swab_dbrec (&dbrec, NTOH);
353 print_dbrec (argv[1], &dbrec);
359 /************************* DTSRDBREC.C **************************/