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 * (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(USL) || defined(sco) || defined(__uxp__)
58 #endif /* sun || USL */
70 #include <sys/param.h> /* MAXPATHLEN, MAXHOSTNAMELEN */
71 #include <Dt/DbReader.h>
74 #include "DtSvcLock.h"
77 extern char *strdup(const char *);
80 static int cur_dc_count = 0;
81 static int cur_da_count = 0;
82 #define _DtFT_NUM_FIELDS 20
90 nextDCSeq = ++cur_dc_count;
91 _DtSvcProcessUnlock();
102 nextDASeq = ++cur_da_count;
103 _DtSvcProcessUnlock();
114 _DtSvcProcessUnlock();
117 _DtDtsDCConverter(DtDtsDbField * fields,
120 Boolean rejectionStatus)
128 db = _DtDtsDbGet(DtDTS_DC_NAME);
129 while (fields[i].fieldName && fields[i].fieldValue)
133 if(rec=_DtDtsDbGetRecordByName(db,fields[i].fieldValue))
135 char *value = _DtDtsDbGetFieldByName(rec,DtDTS_DA_IS_SYNTHETIC);
137 * Check if the record is SYNTHETIC --
138 * if so then replace it with this real
139 * definition -- otherwise return.
141 if (value && !strcmp(value,"True") )
143 /* free up the current record */
144 _DtDtsDbDeleteRecord(rec,db);
148 _DtSvcProcessUnlock();
152 rec = _DtDtsDbAddRecord(db);
153 rec->recordName = XrmStringToQuark(fields[i].fieldValue);
154 rec->seq = _DtDtsNextDCSeq();
155 rec->pathId = (int)pathId;
159 fld = _DtDtsDbAddField(rec);
160 fld->fieldName = fields[i].fieldName;
161 fld->fieldValue = strdup(fields[i].fieldValue);
165 _DtSvcProcessUnlock();
169 _DtDtsDAConverter(DtDtsDbField * fields,
172 Boolean rejectionStatus)
180 db = _DtDtsDbGet(DtDTS_DA_NAME);
182 while (fields[i].fieldName && fields[i].fieldValue)
186 if(rec = _DtDtsDbGetRecordByName(db, fields[i].fieldValue))
188 char *value = _DtDtsDbGetFieldByName(rec,DtDTS_DA_IS_SYNTHETIC);
190 * Check if the record is SYNTHETIC --
191 * if so then replace it with this real
192 * definition -- otherwise return.
194 if (value && !strcmp(value,"True") )
196 /* free up the current record */
197 _DtDtsDbDeleteRecord(rec,db);
201 _DtSvcProcessUnlock();
205 rec = _DtDtsDbAddRecord(db);
206 rec->recordName = XrmStringToQuark(fields[i].fieldValue);
207 rec->seq = _DtDtsNextDASeq();
208 fld = _DtDtsDbAddField(rec);
209 fld->fieldName = XrmStringToQuark(DtDTS_DA_DATA_HOST);
210 fld->fieldValue = hostPrefix?strdup(hostPrefix):(char *) 0;
211 rec->pathId = (int)pathId;
215 fld = _DtDtsDbAddField(rec);
216 fld->fieldName = fields[i].fieldName;
217 fld->fieldValue = strdup(fields[i].fieldValue);
221 _DtSvcProcessUnlock();
225 /******************************************************************************
227 * DtDtsLoadDataTypes -
229 * Reads in the file types and action databases.
231 * Also initializes the variable DtMaxFileTypes to the number
232 * of entries in the file types database.
237 * DtMaxFileTypes - set to the number of real filetypes
238 * ( Holdovers from previous filetypes stuff -- still used by
239 * some clients. i.e. dtfile )
241 *****************************************************************************/
244 DtDtsLoadDataTypes(void)
246 /* with new mmap database this function is not needed to
247 * load the database. Just to initialize it.