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 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
25 * (c) Copyright 1993, 1994 International Business Machines Corp. *
26 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
27 * (c) Copyright 1993, 1994 Novell, Inc. *
32 * $XConsortium: DtsInit.c /main/5 1996/08/28 16:08:50 rswiston $
34 * RESTRICTED CONFIDENTIAL INFORMATION:
36 * The information in this document is subject to special restrictions in a
37 * confidential disclosure agreement bertween HP, IBM, Sun, USL, SCO and
38 * Univel. Do not distribute this document outside HP, IBM, Sun, USL, SCO,
39 * or Univel wihtout Sun's specific written approval. This documment and all
40 * copies and derivative works thereof must be returned or destroyed at Sun's
43 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
48 #include <sys/types.h>
54 #if defined(sun) || defined(CSRG_BASED)
58 #endif /* sun || CSRG_BASED */
70 #include <sys/param.h> /* MAXPATHLEN, MAXHOSTNAMELEN */
71 #include <Dt/DbReader.h>
74 #include "DtSvcLock.h"
76 extern int _DtDtsMMUnLoad(void);
78 static int cur_dc_count = 0;
79 static int cur_da_count = 0;
80 #define _DtFT_NUM_FIELDS 20
88 nextDCSeq = ++cur_dc_count;
89 _DtSvcProcessUnlock();
100 nextDASeq = ++cur_da_count;
101 _DtSvcProcessUnlock();
112 _DtSvcProcessUnlock();
115 _DtDtsDCConverter(DtDtsDbField * fields,
118 Boolean rejectionStatus)
126 db = _DtDtsDbGet(DtDTS_DC_NAME);
127 while (fields[i].fieldName && fields[i].fieldValue)
131 if(rec=_DtDtsDbGetRecordByName(db,fields[i].fieldValue))
133 char *value = _DtDtsDbGetFieldByName(rec,DtDTS_DA_IS_SYNTHETIC);
135 * Check if the record is SYNTHETIC --
136 * if so then replace it with this real
137 * definition -- otherwise return.
139 if (value && !strcmp(value,"True") )
141 /* free up the current record */
142 _DtDtsDbDeleteRecord(rec,db);
146 _DtSvcProcessUnlock();
150 rec = _DtDtsDbAddRecord(db);
151 rec->recordName = XrmStringToQuark(fields[i].fieldValue);
152 rec->seq = _DtDtsNextDCSeq();
153 rec->pathId = (int)pathId;
157 fld = _DtDtsDbAddField(rec);
158 fld->fieldName = fields[i].fieldName;
159 fld->fieldValue = strdup(fields[i].fieldValue);
163 _DtSvcProcessUnlock();
167 _DtDtsDAConverter(DtDtsDbField * fields,
170 Boolean rejectionStatus)
178 db = _DtDtsDbGet(DtDTS_DA_NAME);
180 while (fields[i].fieldName && fields[i].fieldValue)
184 if(rec = _DtDtsDbGetRecordByName(db, fields[i].fieldValue))
186 char *value = _DtDtsDbGetFieldByName(rec,DtDTS_DA_IS_SYNTHETIC);
188 * Check if the record is SYNTHETIC --
189 * if so then replace it with this real
190 * definition -- otherwise return.
192 if (value && !strcmp(value,"True") )
194 /* free up the current record */
195 _DtDtsDbDeleteRecord(rec,db);
199 _DtSvcProcessUnlock();
203 rec = _DtDtsDbAddRecord(db);
204 rec->recordName = XrmStringToQuark(fields[i].fieldValue);
205 rec->seq = _DtDtsNextDASeq();
206 fld = _DtDtsDbAddField(rec);
207 fld->fieldName = XrmStringToQuark(DtDTS_DA_DATA_HOST);
208 fld->fieldValue = hostPrefix?strdup(hostPrefix):(char *) 0;
209 rec->pathId = (int)pathId;
213 fld = _DtDtsDbAddField(rec);
214 fld->fieldName = fields[i].fieldName;
215 fld->fieldValue = strdup(fields[i].fieldValue);
219 _DtSvcProcessUnlock();
223 /******************************************************************************
225 * DtDtsLoadDataTypes -
227 * Reads in the file types and action databases.
229 * Also initializes the variable DtMaxFileTypes to the number
230 * of entries in the file types database.
235 * DtMaxFileTypes - set to the number of real filetypes
236 * ( Holdovers from previous filetypes stuff -- still used by
237 * some clients. i.e. dtfile )
239 *****************************************************************************/
242 DtDtsLoadDataTypes(void)
244 /* with new mmap database this function is not needed to
245 * load the database. Just to initialize it.