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 * File: Connect.h $XConsortium: Connect.h /main/3 1995/10/26 15:19:09 rswiston $
27 * (c) Copyright 1990, Hewlett-Packard Company, all rights reserved.
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. *
39 #include <bms/connect.h>
41 #define DtGetShortHostname Xegetshorthostname
42 #define DtGetHostname Xegethostname
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.
52 status = DtGet[Short]Hostname (hostname, size)
54 int status; Returns 0 on success, -1 on failure.
55 [Actually it returns what gethostname(2)
56 returns, which is ambiguous in the
59 char *hostname; The hostname is returned here.
61 int size; The name is truncated to "size - 1" and
65 #define DtGetcwd Xegetcwd
69 This function is similar to getcwd except it first checks $PWD.
70 It only calls getcwd if $PWD is not set.
74 cwd = DtGetcwd (buf, size)
76 char *cwd; Pointer to the returned value. (Typically
77 the same value as 'buf' that is passed in.)
79 char *buf; Pointer to memory allocated by the caller.
80 Buf must be large enough to hold the string.
82 int size; Size of buf in bytes.
85 #define DtIsLocalHostP XeIsLocalHostP
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.
94 WARNING: Returns BOOLEAN, not INT. DONT TREAT IT AS AN INT!
98 status = XeIsLocalHostP (hostname);
100 Boolean status; Returns TRUE if "hostname" identifies the
101 local host, FALSE otherwise.
103 char *hostname; The hostname (either simple or domain-
107 #define DtIsSameHostP XeIsSameHostP
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.
115 WARNING: Returns BOOLEAN, not INT. DONT TREAT IT AS AN INT!
119 status = DtIsSameHostP (host1, host2);
121 Boolean status; Returns TRUE if host1 and host2 identify
122 the same host, FALSE otherwise.
124 char *host1, *host2; The two hostnames (either simple or
125 domain-qualified) to compare.
128 #define DtCreateContextString XeCreateContextString
132 DtCreateContextString takes the three parts of a context and
133 puts them into a single string, in the form "host:/dir/file".
135 A NEW STRING, OWNED BY THE CALLER, is returned.
139 context_string = DtCreateContextString (host, dir, file);
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.
145 DtString host; The name of the host.
147 DtString dir; The directory.
149 DtString file; The name of the file.
152 #define DtEliminateDots XeEliminateDots
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.
161 This function does not handle "host:/directory/file", shell
162 variables, or other exotic animals.
166 fixed_path = DtEliminateDots (path);
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
172 DtString path; The path that needs fixing up.
175 #define DtParseFileString XeParseFileString
177 #endif /* _Dt_connect_h */
178 /* Do not add anything after this endif. */