MAINSAIL Language Manual, Section 49.11

previous   next   top   complete contents   complete index   framed top   this page unframed


49.11. $userID

Figure 49–10. $userID
STRING
PROCEDURE   $userID     (OPTIONAL BITS ctrlBits);

$userID returns the user ID of the current user, if possible. The form of the user ID is described in the relevant part of the MAINSAIL System-Specific User's Guides.

If the operating system does not provide a user ID, a prompt is written to logFile and a user name read from cmdFile. After the user is prompted once, the user ID is remembered and returned on all subsequent calls to $userID within the same process.

The only valid ctrlBits bits are $login and errorOK.

If errorOK is set, the null STRING is returned without dialogue if the user ID is unavailable.

Some systems distinguish between a login user ID (the user ID under which the current user logged in) and the effective user ID (if the user ID was somehow changed during the login session). If $login is specified, the login user ID is returned, if available; otherwise, the effective user ID is returned, if available. The relevant part of the MAINSAIL System-Specific User's Guides for each system where $login makes a difference describes its effect.

It is advisable always to check $userID's return for the null STRING, since it is fairly common for either the effective user ID or the login user ID to be unavailable, depending on the operating system.


previous   next   top   complete contents   complete index   framed top   this page unframed

MAINSAIL Language Manual, Section 49.11