Fix several warnings that appear in gcc 4.3.2.
[wvstreams.git] / utils / wvuid.cc
blob7fa10353dc9cddf35006e16dd8431c8781bb4574
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * Portable standins for getuid() and friends. See wvuid.h.
6 */
7 #include "wvautoconf.h"
8 #include "wvuid.h"
10 #if WIN32
13 WvString wv_username_from_uid(wvuid_t uid)
15 // FIXME not implemented
16 return WvString::null;
20 wvuid_t wv_uid_from_username(WvString username)
22 // FIXME not implemented
23 return WVUID_INVALID;
27 wvuid_t wvgetuid()
29 // FIXME not implemented
30 return WVUID_INVALID;
34 #else // not WIN32
37 WvString wv_username_from_uid(wvuid_t uid)
39 char buf[1024];
40 struct passwd pwbuf, *userinfo;
42 if (getpwuid_r(uid, &pwbuf, buf, sizeof(buf), &userinfo) == 0)
43 return userinfo->pw_name;
44 else
45 return WvString::null;
49 wvuid_t wv_uid_from_username(WvString username)
51 char buf[1024];
52 struct passwd pwbuf, *userinfo;
54 if (getpwnam_r(username, &pwbuf, buf, sizeof(buf), &userinfo) != 0)
55 return userinfo->pw_uid;
56 else
57 return WVUID_INVALID;
61 wvuid_t wvgetuid()
63 return getuid();
67 #endif