Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / DtSvc / include / bms / connect.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
23 /*
24  * File:         connect.h $XConsortium: connect.h /main/3 1995/10/26 15:47:00 rswiston $
25  * Language:     C
26  *
27  * (c) Copyright 1988, Hewlett-Packard Company, all rights reserved.
28  *
29  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
30  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
31  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
32  * (c) Copyright 1993, 1994 Novell, Inc.                                *
33  */
34
35 #ifndef _connect_h
36 #define _connect_h
37
38 #if defined(__cplusplus) && defined(__c_callable)
39 extern "C" {
40 #endif
41
42 int XeParseFileString 
43 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
44    (XeString line, XeString *host_addr, XeString *path_addr);
45 #else
46    ();
47 #endif
48 #if defined(__cplusplus) && defined(__c_callable)
49 }
50 #endif
51    
52 /*
53         Take the filespec as a line and return a path the host and path
54         components as separate fields (finds the ':' and replaces it with
55         NULL).  THIS FUNCTION MUNGES THE ORIGINAL LINE.
56 */
57      
58 extern XeString XeFindHost 
59 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
60    (XeString host_spec);
61 #else
62    ();
63 #endif
64
65 extern XeString XeFindShortHost 
66 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
67    (XeString host_spec);
68 #else
69    ();
70 #endif
71 /*
72         Returns a host name corresponding to host_spec. 
73
74         In all cases a NEW STRING, OWNED BY THE
75         CALLER, is returned.  XeFindHost returns the full host specification
76         including domain if there is one.  XeFindShortHost does not
77         include the domain.  These functions can be used to convert between
78         domain and simple names when needed.  The domain names should be
79         used always internally and the simple names only used for display.
80 */
81
82 extern int Xegethostname 
83 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
84    (XeString hostname, unsigned int size);
85 #else
86    ();
87 #endif
88
89 #if defined(__cplusplus) && defined(__c_callable)
90 extern "C" {
91 #else
92 extern 
93 #endif   
94 int Xegetshorthostname 
95 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
96    (XeString hostname, unsigned int size);
97 #else
98    ();
99 #endif
100 #if defined(__cplusplus) && defined(__c_callable)
101 }
102 #endif
103    
104 /*
105         Identical to the libc function gethostname, except that Xegethostname
106         returns a full domain qualified name and Xegetshorthostname returns
107         a simple name.  These functions are necessary because the system
108         hostname may or may not contain a domain name and the internal
109         representation should always be canonical form (domain qualified).
110         Use Xegethostname except when the name is being used for display
111         purposes only.  Storage allocation is identical to gethostname
112         (it copies into the caller's buffer).
113 */
114
115 #if defined(__cplusplus) && defined(__c_callable)
116 extern "C" {
117 #else
118 extern 
119 #endif   
120 Boolean XeIsLocalHostP
121 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
122    (XeString hostname);
123 #else
124    ();
125 #endif
126 #if defined(__cplusplus) && defined(__c_callable)
127 }
128 #endif
129    
130 /*
131         Returns true if the hostname passed in identifies the host on which
132         this function is executed.  This is needed in order to handle all
133         combinations of simple and domain-qualified names for either the
134         hostname passed in or the one defined on the local host.  Be sure
135         to include Xe.h or provide a local declaration for this function
136         as Boolean is not the same length as int and it won't function
137         correctly without the declaration.
138 */
139 #if defined(__cplusplus) && defined(__c_callable)
140 extern "C" {
141 #else
142 extern
143 #endif   
144 Boolean XeIsSameHostP
145 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
146    (XeString host1, XeString host2);
147 #else
148    ();
149 #endif
150 #if defined(__cplusplus) && defined(__c_callable)
151 }
152 #endif
153    
154 /*
155         Returns true if host1 and host2 specify the same host.  This is
156         needed, because either or both hosts may be specified with or
157         without domain qualifiers, and the correct result must be
158         obtained.  This function canonicalizes both and compares them
159         only in canonical form.
160 */
161
162 extern Boolean XeIsSameHostP 
163 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
164    (XeString host1, XeString host2);
165 #else
166    ();
167 #endif
168 /*
169         Returns true if host1 and host2 specify the same host.  This is
170         needed, because either or both hosts may be specified with or
171         without domain qualifiers, and the correct result must be
172         obtained.  This function canonicalizes both and compares them
173         only in canonical form.
174 */
175
176 XeString XeCreateContextString 
177 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
178    (XeString host, XeString directory, XeString file);
179 #else
180    ();
181 #endif
182 /* 
183         XeCreateContextString changes the given context into a
184         label which is exactly the same as the one shown in a
185         fileview modeline.  A NEW STRING, OWNED BY THE CALLER,
186         is returned.
187 */
188
189 #define XeEliminateDots(path) (XeString)pathcollapse(path, path, FALSE)   
190 /*
191         Removes /./'s and /../ 's from path.  THIS ROUTINE OVERWRITES
192         THE path IT WAS PASSED.  If there are too many ..'s in path,
193         NULL is returned, so you better keep a pointer to path if you hope
194         to reclaim it.  Does not handle host:/path, shell variables or other
195         exotic animals. 
196 */      
197
198 int Xechdir
199 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)   
200            (const char *path);
201 #else
202            ();
203 #endif
204 /*
205         performs a chdir and caches the new directory in $PWD so that
206         Xegetcwd() can get the current directory without slow stat calls
207 */
208
209 char *Xegetcwd
210 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
211                 (char *buf,
212                  int size);
213 #else
214                 ();
215 #endif
216 /*
217         version of getcwd() which uses cached $PWD (or $PWD from shell)
218         if available and calls getcwd only when PWD not set
219 */
220
221 /* DON'T ADD STUFF AFTER THIS #endif */
222 #endif /* _connect_h */
223