HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_SysClone.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_SysClone.h ( UT Library, C++)
7  *
8  * COMMENTS: Functions and defines for WinNT or Linux to make it look
9  * like IRIX. The difference between this file and UT_SysSpecific
10  * is that this one simply replaces SGI system calls with
11  * custom calls of the same name, while SysSpecific is a true
12  * wrapper that hides even the system call name under a "UT"-
13  * prefixed name.
14  *
15  */
16 
17 #ifndef _UT_SysClone_h_
18 #define _UT_SysClone_h_
19 
20 #include "UT_API.h"
21 #include <SYS/SYS_Math.h>
22 #include <SYS/SYS_String.h>
23 
24 
25 #ifdef WIN32
26  #include "UT_NTUtil.h"
27  #include "UT_NTGetOpt.h"
28 #elif defined(MBSD)
29  #include "UT_MBSDUtil.h"
30 #else
31  #include "UT_NetUtil.h"
32  #include "UT_WorkBuffer.h"
33  #include <unistd.h>
34  #include <cstring>
35 
36  static inline void UTclearHostnameCache()
37  {
38  // Nothing to do here since we don't cache the hostname
39  }
40 
41  static inline int
42  UTgethostname(char *host, int len)
43  {
44  UT_WorkBuffer wbuf;
45  int result = gethostname(wbuf.lock(0, len), len);
46  wbuf.release(result == 0 ? 1 : 0);
47  if (result == 0)
48  {
49  SYSstrlcpy(host, wbuf.buffer(), len);
50  }
51  return result;
52  }
53 #endif
54 
55 class UT_String;
56 
57 UT_API extern int UTgethostname(UT_String &host);
58 
59 #if defined(MBSD)
60  #include "UT_MBSDUtil.h"
61 #endif
62 
63 #if defined(LINUX)
64  #include "UT_LinuxUtil.h"
65 #endif
66 
67 #include "UT_Access.h"
68 #include "UT_DirUtil.h"
69 #include "UT_NTStreamUtil.h"
70 
71 #endif // _UT_SysClone_h_
SYS_FORCE_INLINE const char * buffer() const
#define UT_API
Definition: UT_API.h:13
void release(bool recompute_length=false)
char * lock(exint offset=0, exint reserve_bytes=0)
size_t SYSstrlcpy(char *dest, const char *src, size_t size)
Definition: SYS_String.h:187
UT_API int UTgethostname(UT_String &host)
GLuint64EXT * result
Definition: glew.h:14007
GLenum GLsizei len
Definition: glew.h:7752