getpdomain() - retrieve name of principal domain
#include <interix/interix.h>
int getpdomain (char * buf, int bufsize)
The getpdomain(2) call retrieves the name of the machine's primary or principal domain. The principal domain is used to create short forms for user and group names.
A user's full login name consists of a domain name plus a user name. Any user names presented without a domain name are assumed to belong to the principal domain. For example, if the principal domain is SERVICES, the user SERVICES+dana is displayed as dana. On input, the name dana is taken as synonymous with SERVICES+dana.
A user named dana in a different domain is still displayed in the canonical form, such as DEV+dana. If your principal domain is SERVICES and you need to refer to the user DEV+dana, the canonical name still works.
The name of the primary domain is normally taken from the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Services For Unix\PrincipalDomain. A standalone machine, one without a primary domain controller, will not have this key set, and the getpdomain(2) call returns the name of the computer.
The call can return -1, 0, or a value greater than 0.
The getpdomain(2) call can fail for the following reasons:
pdomain(1)