Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / DtSvc / DtUtil2 / 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:19:09 rswiston $
25  * Language:     C
26  *
27  * (c) Copyright 1990, 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 _Dt_connect_h
36 #define _Dt_connect_h
37
38 #include <Dt/DtP.h>
39 #include <bms/connect.h>
40
41 #define DtGetShortHostname Xegetshorthostname
42 #define DtGetHostname      Xegethostname
43 /*
44     DESCRIPTION:
45     
46         These functions are similiar to gethostname(2), however
47         DtGetHostname always returns a full domain-qualified name 
48         and DtGetShortHostname returns a simple name.
49         
50     SYNOPSIS:
51     
52         status = DtGet[Short]Hostname (hostname, size)
53         
54         int status;             Returns 0 on success, -1 on failure.
55                                 [Actually it returns what gethostname(2)
56                                 returns, which is ambiguous in the
57                                 HP-UX manual.]
58                                 
59         char *hostname;         The hostname is returned here.
60         
61         int size;               The name is truncated to "size - 1" and
62                                 is null-terminated.
63 */
64
65 #define DtGetcwd       Xegetcwd
66 /*
67     DESCRIPTION:
68     
69         This function is similar to getcwd except it first checks $PWD.
70         It only calls getcwd if $PWD is not set.
71
72     SYNOPSIS:
73     
74         cwd = DtGetcwd (buf, size)
75
76         char *cwd;              Pointer to the returned value.  (Typically 
77                                 the same value as 'buf' that is passed in.)
78
79         char *buf;              Pointer to memory allocated by the caller.
80                                 Buf must be large enough to hold the string.
81
82         int size;               Size of buf in bytes.
83 */
84
85 #define DtIsLocalHostP XeIsLocalHostP
86 /*
87     DESCRIPTION:
88     
89         Tests whether a passed-in hostname identifies the host on which
90         the function is being executed.  This handles all combinations of
91         simple and domain-qualified names for either the hostname passed
92         in or the one defined on the local host.
93         
94         WARNING: Returns BOOLEAN, not INT.  DONT TREAT IT AS AN INT!
95         
96     SYNOPSIS:
97     
98         status = XeIsLocalHostP (hostname);
99         
100         Boolean status;         Returns TRUE if "hostname" identifies the
101                                 local host, FALSE otherwise.
102                                 
103         char *hostname;         The hostname (either simple or domain-
104                                 qualified) to test.
105 */
106
107 #define DtIsSameHostP XeIsSameHostP
108 /*
109     DESCRIPTION:
110     
111         Compares two hostnames to see if they specify the same host.
112         This handles combinations of simple and domain-qualified names.
113         This function canonicalizes both names and then compares them.
114         
115         WARNING: Returns BOOLEAN, not INT.  DONT TREAT IT AS AN INT!
116         
117     SYNOPSIS:
118     
119         status = DtIsSameHostP (host1, host2);
120         
121         Boolean status;         Returns TRUE if host1 and host2 identify
122                                 the same host, FALSE otherwise.
123                                 
124         char *host1, *host2;    The two hostnames (either simple or
125                                 domain-qualified) to compare.
126 */
127
128 #define DtCreateContextString XeCreateContextString
129 /*
130     DESCRIPTION:
131     
132         DtCreateContextString takes the three parts of a context and
133         puts them into a single string, in the form "host:/dir/file".
134
135         A NEW STRING, OWNED BY THE CALLER, is returned.
136         
137     SYNOPSIS:
138     
139         context_string = DtCreateContextString (host, dir, file);
140         
141         DtString context_string;  The returned context.  The memory is owned
142                                   by the caller.  "NULL" is returned if the
143                                   context cannot be created.
144                                 
145         DtString host;            The name of the host.
146         
147         DtString dir;             The directory.
148         
149         DtString file;            The name of the file.
150 */      
151         
152 #define DtEliminateDots XeEliminateDots
153 /*
154     DESCRIPTION:
155     
156         This routine removes /./'s and /../'s from a path.  It will 
157         OVERWRITE the path IT WAS PASSED.  If there are too many /../'s
158         in the path this function will return NULL, so you better keep
159         a pointer to the path if you hope to reclaim it.
160         
161         This function does not handle "host:/directory/file", shell
162         variables, or other exotic animals.
163         
164     SYNOPSIS:
165     
166         fixed_path = DtEliminateDots (path);
167         
168         DtString fixed_path;    A pointer to the same path that was passed in
169                                 (though now it is fixed up) or NULL if problems
170                                 were encountered.
171                                 
172         DtString path;          The path that needs fixing up.
173 */      
174         
175 #define DtParseFileString XeParseFileString
176
177 #endif /* _Dt_connect_h */
178 /* Do not add anything after this endif. */