Connect.h 5.1 KB

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