[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / OS_NS_pwd.inl
blobcb13fe8f29247cab18ddae8d9077584490888d46
1 // -*- C++ -*-
2 //
3 // $Id: OS_NS_pwd.inl 80826 2008-03-04 14:51:23Z wotte $
5 #include "ace/OS_NS_errno.h"
7 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
9 // Accessors to PWD file.
11 ACE_INLINE void
12 ACE_OS::endpwent (void)
14 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
15   ::endpwent ();
16 #endif /* ! ACE_LACKS_PWD_FUNCTIONS */
19 ACE_INLINE struct passwd *
20 ACE_OS::getpwent (void)
22 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
23   return ::getpwent ();
24 #else
25   ACE_NOTSUP_RETURN (0);
26 #endif /* ! ACE_LACKS_PWD_FUNCTIONS */
29 ACE_INLINE struct passwd *
30 ACE_OS::getpwnam (const char *name)
32 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
33   return ::getpwnam (name);
34 # else
35   ACE_UNUSED_ARG (name);
36   ACE_NOTSUP_RETURN (0);
37 #endif /* ACE_LACKS_PWD_FUNCTIONS */
40 ACE_INLINE struct passwd *
41 ACE_OS::getpwnam_r (const char *name, struct passwd *pwent,
42                     char *buffer, int buflen)
44 #if defined (ACE_HAS_POSIX_GETPWNAM_R)
45   struct passwd *result = 0;
47   int const status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
49   if (status != 0)
50   {
51     errno = status;
52     result = 0;
53   }
54   return result;
55 #elif !defined (ACE_LACKS_PWD_FUNCTIONS)
56 # if defined (ACE_HAS_REENTRANT_FUNCTIONS)
57 #   if !defined (ACE_LACKS_PWD_REENTRANT_FUNCTIONS)
58 #     if defined (ACE_HAS_PTHREADS) && \
59       !defined (ACE_HAS_STHREADS) || \
60       defined (HPUX_11)  || \
61       defined (__USLC__) // Added by Roland Gigler for SCO UnixWare 7.
62   struct passwd *result;
63   int status;
64 #       if defined (DIGITAL_UNIX)
65   ::_Pgetpwnam_r (name, pwent, buffer, buflen, &result);
66 #       else
67   // VAC++ doesn't correctly grok the ::getpwnam_r - the function is redefined
68   // in pwd.h, and that redefinition is used here
69 #         if defined (__IBMCPP__) && (__IBMCPP__ >= 400)   /* VAC++ 4 */
70   status = _posix_getpwnam_r (name, pwent, buffer, buflen, &result);
71 #         else
72   status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
73 #         endif /* __IBMCPP__ && (__IBMCPP__ >= 400) */
74   if (status != 0)
75     {
76       errno = status;
77       result = 0;
78     }
79 #       endif /* (DIGITAL_UNIX) */
80   return result;
81 #     elif defined (AIX)
82   if (::getpwnam_r (name, pwent, buffer, buflen) == -1)
83     return 0;
84   else
85     return pwent;
86 #     else
87   return ::getpwnam_r (name, pwent, buffer, buflen);
88 #     endif /* ACE_HAS_PTHREADS */
89 #   else
90   ACE_UNUSED_ARG (name);
91   ACE_UNUSED_ARG (pwent);
92   ACE_UNUSED_ARG (buffer);
93   ACE_UNUSED_ARG (buflen);
94   ACE_NOTSUP_RETURN (0);
95 #   endif /* ! ACE_LACKS_PWD_REENTRANT_FUNCTIONS */
96 # else
97   ACE_UNUSED_ARG (name);
98   ACE_UNUSED_ARG (pwent);
99   ACE_UNUSED_ARG (buffer);
100   ACE_UNUSED_ARG (buflen);
101   ACE_NOTSUP_RETURN (0);
102 # endif /* ACE_HAS_REENTRANT_FUNCTIONS */
103 #else
104   ACE_UNUSED_ARG (name);
105   ACE_UNUSED_ARG (pwent);
106   ACE_UNUSED_ARG (buffer);
107   ACE_UNUSED_ARG (buflen);
108   ACE_NOTSUP_RETURN (0);
109 #endif /* ACE_HAS_POSIX_GETPWNAM_R */
112 ACE_INLINE void
113 ACE_OS::setpwent (void)
115 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
116   ::setpwent ();
117 #endif /* ! ACE_LACKS_PWD_FUNCTIONS */
120 ACE_END_VERSIONED_NAMESPACE_DECL